220 lines
7.3 KiB
C++
220 lines
7.3 KiB
C++
/*=============================================================================
|
|
*
|
|
* Filename: FRMSplit.hpp
|
|
* Version: 1.0
|
|
* Date: 06/11/96
|
|
* Author: V.L.
|
|
*
|
|
* Description: definition off following class:
|
|
* CPaneFrame each pane contain a CPaneView which contain a CPaneFrame
|
|
* CPaneView each pane contain a CPaneView
|
|
* CVectorSplitterWnd the Wnd that manage splitters, call by this name
|
|
* because it could only be a (1,n) or a (n,1) splitter
|
|
* CSplitFrame a classe derived from FRMBase that contain splitter
|
|
*
|
|
*===========================================================================*/
|
|
|
|
#ifndef __FRMSPLIT_HPP__
|
|
#define __FRMSPLIT_HPP__
|
|
|
|
/****************************************/
|
|
#ifndef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
#endif
|
|
/****************************************/
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
|
|
#include "afxext.h"
|
|
#include "FRMBase.hpp"
|
|
#include "CPAMCapt.hpp"
|
|
|
|
/*=============================================================================
|
|
* Defines
|
|
=============================================================================*/
|
|
/* caption height or width*/
|
|
/*#define C_wCaptionHeight 18*/
|
|
#define C_wCaptionHeight 11
|
|
|
|
/* Splitter type*/
|
|
#define C_cHorizontalSplitter 0
|
|
#define C_cVerticalSplitter 1
|
|
|
|
|
|
/*=============================================================================
|
|
* CPaneFrame class
|
|
=============================================================================*/
|
|
class CPA_EXPORT CPaneFrame : public CFrameWnd
|
|
{
|
|
DECLARE_DYNCREATE(CPaneFrame)
|
|
|
|
private:
|
|
int m_a_iButton[4]; /* buttons to draw in frame title bar*/
|
|
|
|
public:
|
|
CPaneFrame();
|
|
|
|
protected:
|
|
void m_fn_vDrawHorizontalCaption( void );
|
|
void m_fn_vDrawVerticalCaption( void );
|
|
void m_fn_vDrawButton( CWindowDC *pDC, int iX, int iY, UINT nIDResource);
|
|
|
|
int m_fn_iGetButtonFromPoint( CPoint point);
|
|
|
|
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
|
|
afx_msg void OnNcPaint( void );
|
|
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
|
|
afx_msg UINT OnNcHitTest(CPoint point);
|
|
afx_msg void OnNcLButtonUp(UINT HitTest, CPoint point);
|
|
afx_msg void OnNcLButtonDown(UINT HitTest, CPoint point);
|
|
afx_msg void OnNcLButtonDblClk( UINT nHitTest, CPoint point );
|
|
afx_msg void OnNcRButtonDown( UINT nHitTest, CPoint point );
|
|
afx_msg void OnDrawItem( int nIDCtl, LPDRAWITEMSTRUCT lpDIS );
|
|
afx_msg void OnMeasureItem( int nIDCtl, LPMEASUREITEMSTRUCT lpMIS );
|
|
afx_msg void m_fn_vOnTile( void );
|
|
afx_msg void m_fn_vOnMaximize( void );
|
|
afx_msg void m_fn_vOnReduce( void );
|
|
afx_msg void m_fn_vMinimizeUp( void );
|
|
afx_msg void m_fn_vMinimizeDown( void );
|
|
afx_msg void m_fn_vSavePos( UINT uID );
|
|
afx_msg void m_fn_vRestorePos( UINT uID );
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
/*=============================================================================
|
|
* CPaneView class
|
|
=============================================================================*/
|
|
class CPA_EXPORT CPaneView : public CView
|
|
{
|
|
DECLARE_DYNCREATE(CPaneView)
|
|
|
|
private:
|
|
CPaneFrame *m_p_oPaneFrame; /* frame associated with this view*/
|
|
|
|
public:
|
|
CPaneView();
|
|
CPaneFrame *m_fn_p_oGetFrame() { return m_p_oPaneFrame; }
|
|
|
|
protected:
|
|
void OnDraw( CDC* pDC );
|
|
|
|
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
|
|
afx_msg void OnSize( UINT nType, int cx, int cy );
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
/*=============================================================================
|
|
* CVectorSplitterWnd class
|
|
=============================================================================*/
|
|
class CPA_EXPORT CVectorSplitterWnd : public CSplitterWnd, public CPA_MouseCapturer
|
|
{
|
|
DECLARE_DYNCREATE(CVectorSplitterWnd)
|
|
|
|
private:
|
|
char m_cType; /* Horizontal or Vertical*/
|
|
int m_iMaximizedSize; /* the maximum size for a pane*/
|
|
int m_iTileSize; /* the pane size for a tile view*/
|
|
int m_iNumberOfPanes; /* number of pane*/
|
|
|
|
char m_a_cState[16]; /* state of each panel*/
|
|
char m_a_cCloseDir[16]; /* the direction the window was closed*/
|
|
int m_a_iSize[16]; /* size of each panel, size is the width for an horizontal splitter, height for vertical*/
|
|
int m_a_iSizeBeforeMax[16]; /* size of each panel before a maximize operation*/
|
|
|
|
int m_aa_iSavePosition[4][16]; /* saved position*/
|
|
|
|
int m_iTrackPane; /* pane that is being sized*/
|
|
CPoint m_oBeginPoint; /* point when track begin*/
|
|
|
|
public:
|
|
int m_iCaptionDelta; /* used by CPaneFrame*/
|
|
int m_iPopupClosed; /* used by CPaneFrame*/
|
|
|
|
/*any class deriving from CPA_MouseCapturer one must declare this method as is*/
|
|
CWnd *m_p_oGrabCapture() { return m_p_oGrabCaptureFor(this); }
|
|
|
|
CVectorSplitterWnd();
|
|
~CVectorSplitterWnd();
|
|
|
|
BOOL Create( CWnd *_pParentWnd, char _cType, int _iNumberOfPanes );
|
|
BOOL CreateView( int _iPane, CRuntimeClass *_pViewClass, char *_szName, int _iSize );
|
|
BOOL SetPaneView( int _iPane, CView *_pView, char *_szName, int _iSize);
|
|
|
|
int m_fn_iGetNumberOfPanes( void ) { return m_iNumberOfPanes; }
|
|
|
|
char m_fn_cGetType( void ) { return m_cType; }
|
|
CWnd *m_fn_p_oGetPane( int _iPane );
|
|
|
|
void m_fn_vMinimizePane( CWnd *p_xPane, BOOL _bTop = TRUE );
|
|
void m_fn_vMaximizePane( CWnd *p_xPane );
|
|
void m_fn_vResizePane( CWnd *p_xPane );
|
|
void m_fn_vTilePanes( void );
|
|
void m_fn_vSavePos( char cSave );
|
|
void m_fn_vRestorePos( char cRestore );
|
|
BOOL m_fn_bIsSavedUsed( char cSave );
|
|
void m_fn_vGetPositionRatio( char cSave, float *p_aRatio16 );
|
|
|
|
void m_fn_vChangePaneSize( int _iPane, int _iNewSize, BOOL bBottomOrRight = TRUE);
|
|
|
|
void m_fn_vGetButton( CWnd *p_xPane, int *p_a_iButton );
|
|
|
|
int m_fn_iGetPaneSize( int _iPane );
|
|
|
|
private:
|
|
int m_fn_iGetNextOpenPane( int iFromPane, BOOL bBottomOrRight );
|
|
int m_fn_iGetNextPane( int iFromPane, BOOL bBottomOrRight );
|
|
|
|
void m_fn_vPaneToRowCol( int _iPane, int& _iRow,int& _iCol);
|
|
int m_fn_iRowColToPane( int _iRow,int _iCol);
|
|
void m_fn_vSetPaneSize( int _iPane, int _iSize );
|
|
|
|
int HitTest(CPoint pt) const;
|
|
|
|
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
|
|
afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
|
|
afx_msg void OnMouseMove( UINT nFlags, CPoint point );
|
|
afx_msg void OnSize( UINT nType, int cx, int cy );
|
|
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
/*=============================================================================
|
|
* CSplitFrame
|
|
=============================================================================*/
|
|
class CPA_EXPORT CSplitFrame : public FRMBase
|
|
{
|
|
DECLARE_DYNCREATE(CSplitFrame)
|
|
|
|
private:
|
|
CVectorSplitterWnd *m_p_oView;
|
|
|
|
|
|
public:
|
|
CSplitFrame();
|
|
|
|
BOOL CreateSplitter( char cType, int iNumberOfPanes );
|
|
BOOL CreateView( int iPane, CRuntimeClass *pViewClass, char *szName, int iSize);
|
|
BOOL SetPaneView( int iPane, CView *pView, char *szName, int iSize);
|
|
void SetPaneSize( int iPane, int iNewSize, BOOL bBottomOrRight = TRUE );
|
|
int GetPaneSize( int iPane ) { return m_p_oView->m_fn_iGetPaneSize(iPane); }
|
|
CWnd *m_fn_p_oGetPane( int _iPane );
|
|
|
|
protected:
|
|
|
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
#endif /* ACTIVE_EDITOR */
|
|
|
|
#endif /* __FRMSPLIT_HPP__ */
|