Hi,
I am migrating my MDI application with toolbar and docking windows to Xtreme toolkit.
I replaced the CToolbar class with CXTToolbar as follow the guidance of ToolkitProManual.
I planed to change toolbar immediately and to defer changing the docking windows later for some reasons.
Docking window uses a CSizingControlBar(from codeguru) -derived class.
But, unfortunately, I can't layout toolbar and docking bars pretty.
I want to put docking window below the toolbar..
Can I do this job without replacing the docking window to the one in Xtreme toolkit ?
Below is my test program's CMainFrame::OnCreate()
=============================================
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;
// --- status bar creation if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create }
EnableDocking(CBRS_ALIGN_ANY);
// --- instant bar --- Docking window not derived from xtreme toolkit if (!m_wndInstantBar.Create(_T("Instant Bar"), this, 127)) { TRACE0("Failed to create instant bar\n"); return -1; // fail to create } m_wndInstantBar.SetSCBStyle(m_wndInstantBar.GetSCBStyl e() | SCBS_SIZECHILD); if (!m_wndIBTree.Create(WS_CHILD|WS_VISIBLE| TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT, CRect(0, 0, 0, 0), &m_wndInstantBar, 100)) { TRACE0("Failed to create instant bar child\n"); return -1; // fail to create } m_wndIBTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE); // bring the tooltips to front CWnd* pTT = FromHandle((HWND) m_wndIBTree.SendMessage(TVM_GETTOOLTIPS)); if (pTT != NULL) pTT->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); // populate the treectrl HTREEITEM hti = m_wndIBTree.InsertItem(_T("Node 1")); m_wndIBTree.InsertItem(_T("Node 2")); m_wndIBTree.InsertItem(_T("SubNode 11"), hti); m_wndIBTree.InsertItem(_T("SubNode 12"), hti); // --- end instant bar creation and child setup --- m_wndInstantBar.SetBarStyle(m_wndInstantBar.GetBarStyl e() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndInstantBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALI GN_RIGHT);
#ifdef _SCB_REPLACE_MINIFRAME m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd); #endif //_SCB_REPLACE_MINIFRAME
// dock mybar2 on the same row with mybar1 RecalcLayout(); CRect rBar; DockControlBar(&m_wndInstantBar, AFX_IDW_DOCKBAR_LEFT); CString sProfile = _T("BarState"); if (VerifyBarState(sProfile)) { CSizingControlBar::GlobalLoadState(this, sProfile); LoadBarState(sProfile); }
// --- instant bar --- creation end //////////////////////////////////////////////////////////// ////// // xtreme toolkit command bar creation start // Initialize the command bars if (!InitCommandBars()) return -1;
// Get a pointer to the command bars object. CXTPCommandBars* pCommandBars = GetCommandBars(); if(pCommandBars == NULL) { TRACE0("Failed to create command bars object.\n"); return -1; // fail to create }
// Add the menu bar CXTPToolBar* pMenuBar = pCommandBars->SetMenu( _T("Menu Bar"), IDR_MAINFRAME); if(pMenuBar == NULL) { TRACE0("Failed to create menu bar.\n"); return -1; // fail to create }
// Create ToolBar CXTPToolBar* pToolBar = (CXTPToolBar*) pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; }
pMenuBar->SetFlags(xtpFlagAddMDISysPopup); // Set Office 2003 Theme CXTPPaintManager::SetTheme(xtpThemeOffice2003);
return 0; }
Please let me know the best way to layout normally.
Thanks in advance,
Joyce
|