CGXSplitterWnd::m_apInsideWndState
CGXInsideWndState*m_apInsideWndState[4];
Remarks
An array with 4 docked windows. Window can be docked at the left and right side of the horizontal scrollbar and at the bottom and top side of the vertical scrollbar:
-
m_apInsideWndState[gxLeft = 0] stores the window to be docked at the left side of the horizontal scrollbar.
-
m_apInsideWndState[gxTop = 1] stores the window to be docked at the top side of the vertical scrollbar.
-
m_apInsideWndState[gxRight = 2] stores the window to be docked at the right side of the horizontal scrollbar.
- m_apInsideWndState[gxBottom = 3] stores the window to be docked at the bottom side of the vertical scrollbar.
Each member in this array is a pointer to a CGXInsideWndState structure:
struct CGXInsideWndState
{
CGXInsideWndState();
~CGXInsideWndState();
CWnd* pWnd;
int nAlign;
CSize size;
CSize sizeMin;
CSize sizeBox;
BOOL bResizable;
long lRelSize;
// will be assigned in RecalcLayout
CRect rectWnd;
CRect rectBox;
CSize sizeMax;
};
wheras
- pWnd holds a pointer to the CWnd to be docked
- nAlign stores the docking position (gxLeft, gxTop, gxBottom or gxRight)
- size stores the preferred size of the CWnd
- sizeMin stores the minimum size of the window (if resizable)
- sizeBox stores the size of the track box
- bResizable specifies wheter the window should be resizable
- lRelSize stores the relative size to the scollbar size (1000 is the whole scrollbar, 500 is half the scrollbar).
Example:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// use the new record info wnd with support for dynamic splitter views
m_pWndSplitter = new CGXRecordInfoSplitterWnd;
if (!m_pWndSplitter->Create( this,
2, 2, // TODO: adjust the number of rows, columns
CSize( 10, 10 ), // TODO: adjust the minimum pane size
pContext ))
return FALSE;
m_pWndSplitter->m_nhSplitterBoxPos = gxLeft;
m_pWndSplitter->m_nvSplitterBoxPos = gxBottom;
// This is just some fancy sample to demonstrate that
// you can embedd any CWnd into the scrollbar area
// (e.g. like in MS Word a page up/page down button)
{
CButton* pButton = new CButton();
pButton->Create(_T("Resizable Button"), BS_PUSHBUTTON|WS_VISIBLE,
CRect(0, 0, 1, 1),
m_pWndSplitter,
GX_IDW_INSIDE_FIRST+1);
m_pWndSplitter->m_apInsideWndState[gxRight] = new CGXInsideWndState;
CGXInsideWndState& state = *m_pWndSplitter->m_apInsideWndState[gxRight];
state.pWnd = pButton;
state.size = CSize(100, 5);
state.sizeMin = CSize(50, 0);
state.sizeBox = CSize(6, 0);
state.nAlign = gxRight;
state.bResizable = TRUE;
state.lRelSize = 500;
}
{
CButton* pButton = new CButton();
pButton->Create(_T("X"), BS_PUSHBUTTON|WS_VISIBLE,
CRect(0, 0, 1, 1),
m_pWndSplitter,
GX_IDW_INSIDE_FIRST+3);
m_pWndSplitter->m_apInsideWndState[gxBottom] = new CGXInsideWndState;
CGXInsideWndState& state = *m_pWndSplitter->m_apInsideWndState[gxBottom];
state.pWnd = pButton;
state.size = CSize(0,100);
state.sizeMin = CSize(0, 50);
state.sizeBox = CSize(0, 6);
state.nAlign = gxBottom;
state.bResizable = FALSE;
state.lRelSize = 500;
}
return TRUE;
}