정리

'툴바'에 해당되는 글 1건

  1. [MFC] CDockablePane

[MFC] CDockablePane

저장소/VC++
출처 :  http://knob.egloos.com/2780159


1. CFrameWndEx 상속 클래스에 다음과 같이 CDockablePane 객체를 선언하고.

CDockablePane m_Panes[5]; // 필요한 만큼의 갯수로 선언

2. CFrameWndEx 상속 클래스의 OnCreate()에 다음과 같은 부분들이 있는지 확인 한 후에,

// 메뉴 모음을 활성화해도 포커스가 이동하지 않게 합니다.
CMFCPopupMenu::SetForceMenuFocus(FALSE);
// 사용자 정의 도구 모음 작업을 허용합니다.
InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);
// 도구 모음 및 도킹 창 메뉴 바꾸기를 활성화합니다.
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, 0, ID_VIEW_TOOLBAR);
// Visual Studio 2005 스타일 도킹 창 동작을 활성화합니다.
CDockingManager::SetDockingMode(DT_SMART);
// Visual Studio 2005 스타일 도킹 창 자동 숨김 동작을 활성화합니다.
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// Enable Docking
EnableDocking(CBRS_ALIGN_ANY);

3. 그 뒤에 아래와 같이 배치해 준다.

if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // LEFT

if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[1]); // BOTTOM
DockPane(&m_Panes[0]); // LEFT


if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // LEFT
DockPane(&m_Panes[1]); // BOTTOM
if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // LEFT
DockPane(&m_Panes[1]); // LEFT
// 0번을 2번의 위에 위치 시킨다.
m_Panes[0].DockToWindow(&m_Panes[1], CBRS_TOP);
if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // LEFT
DockPane(&m_Panes[1]); // LEFT
CDockablePane* pTabbedBar = NULL;
// Tab 형식으로 붙인다. 
m_Panes[1].AttachToTabWnd(&m_Panes[0], DM_SHOW, TRUE, &pTabbedBar);


if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[2].Create(_T("Pane 2"), this, CRect(0, 0, 200, 100), TRUE, 1002,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[2].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // LEFT
DockPane(&m_Panes[1]); // LEFT
DockPane(&m_Panes[2]); // LEFT
// 0번을 2번의 위에 위치 시킨다.
m_Panes[0].DockToWindow(&m_Panes[2], CBRS_TOP);
CDockablePane* pTabbedBar = NULL;
// 1을 0에 Tab 형식으로 붙인다. 
m_Panes[1].AttachToTabWnd(&m_Panes[0], DM_SHOW, TRUE, &pTabbedBar);
if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // BOTTOM
DockPane(&m_Panes[1]); // BOTTOM
CDockablePane* pTabbedBar = NULL;
// 0번을 1번의 왼쪽에 위치 시킨다.
m_Panes[0].DockToWindow(&m_Panes[1], CBRS_LEFT);
if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[2].Create(_T("Pane 2"), this, CRect(0, 0, 200, 100), TRUE, 1002,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[3].Create(_T("Pane 3"), this, CRect(0, 0, 200, 100), TRUE, 1003,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[4].Create(_T("Pane 4"), this, CRect(0, 0, 200, 100), TRUE, 1004,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[2].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[3].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[4].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // BOTTOM
DockPane(&m_Panes[1]); // BOTTOM
DockPane(&m_Panes[2]); // LEFT
DockPane(&m_Panes[3]); // LEFT
DockPane(&m_Panes[4]); // RIGHT
// 0번을 1번의 왼쪽에 위치 시킨다.
CDockablePane* pTabbedBar = NULL;
m_Panes[0].DockToWindow(&m_Panes[1], CBRS_LEFT);
// 3을 2에 Tab 형식으로 붙인다. 
m_Panes[3].AttachToTabWnd(&m_Panes[2], DM_SHOW, TRUE, &pTabbedBar);
if (!m_Panes[0].Create(_T("Pane 0"), this, CRect(0, 0, 200, 100), TRUE, 1000,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[1].Create(_T("Pane 1"), this, CRect(0, 0, 200, 100), TRUE, 1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[2].Create(_T("Pane 2"), this, CRect(0, 0, 200, 100), TRUE, 1002,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[3].Create(_T("Pane 3"), this, CRect(0, 0, 200, 100), TRUE, 1003,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
{return FALSE;}
if (!m_Panes[4].Create(_T("Pane 4"), this, CRect(0, 0, 200, 100), TRUE, 1004,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
{return FALSE;}
m_Panes[0].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[1].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[2].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[3].EnableDocking(CBRS_ALIGN_ANY);
m_Panes[4].EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_Panes[0]); // BOTTOM
DockPane(&m_Panes[1]); // BOTTOM
DockPane(&m_Panes[2]); // LEFT
DockPane(&m_Panes[3]); // LEFT
DockPane(&m_Panes[4]); // RIGHT
CDockablePane* pTabbedBar = NULL;
// 1을 0에 Tab 형식으로 붙인다
m_Panes[1].AttachToTabWnd(&m_Panes[0], DM_SHOW, TRUE, &pTabbedBar);
// 3을 2에 Tab 형식으로 붙인다. 
m_Panes[3].AttachToTabWnd(&m_Panes[2], DM_SHOW, TRUE, &pTabbedBar);