![]() |
Setting Themes |
Post Reply
|
| Author | |
JayW
Newbie
Joined: 25 May 2005 Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Topic: Setting ThemesPosted: 16 June 2005 at 8:07am |
|
I'm trying to get a consistent theme throughout my application (Whidbey) and so far have only been able to get the docking panes and menus to work. For example, my dialog (all derived from CTXResizeDialog) buttons are the standard MFC style and even the toolbar customization dialog (I used your code to the line...) comes up looking like this:
instead of this (from your sample...):
Questions:
I'm sorry for the obviously dumb question since I couldn't find the answer on the forums or by looking at the samples. Jay PS - Here is the OnCreate() and OnCustomize() code from MainFrm.cpp, the vast majority of which is lifted from your samples. /* * Main window initialization on creation */ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {CXTPCommandBar *pMenuBar; CXTPToolBar *pToolBar; if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; /** Create Status bar. * Important: All control bars including the Status Bar * must be created before CommandBars. */ if (!m_wndStatusBar.Create(this) ||!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) {TRACE0("Failed to create status bar\n"); return -1; // Failed to create} /** Initialize the command bars */ if (!InitCommandBars()) return -1; /** Set "Whidbey" Theme (Note: Whidbey is the look and feel * first implemented in Visual Studio .NET 2005. "Whidbey" * was the project code name.) */ CXTPPaintManager::SetTheme(xtpThemeWhidbey); /** Get a pointer to the command bars object. */ m_pCommandBars = GetCommandBars(); if(m_pCommandBars == NULL) {TRACE0("Failed to create command bars object.\n"); return -1; // Failed to create} /** Add the main menu bar for customization */ pMenuBar = m_pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); if(pMenuBar == NULL) {TRACE0("Failed to create menu bar.\n"); return -1; // Failed to create} /** Create ToolBar */ pToolBar = (CXTPToolBar*) m_pCommandBars->Add(_T("Standard"), xtpBarTop); if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME)) {TRACE0("Failed to create toolbar\n"); return -1;} /** Load the previous state for toolbars and menus. */ LoadCommandBars(_T("CommandBars")); /** Initialize the docking pane manager. * Do this only after all control bars objects * have been created and docked. */ m_paneManager.InstallDockingPanes( this);m_paneManager.SetTheme(xtpPaneThemeWhidbey); /** Create docking panes for Content and Resource view. */ CXTPDockingPane* contentPane = m_paneManager.CreatePane( IDR_VIEW_CONTENT_PANE, CRect(0, 0, 230, 140), xtpPaneDockLeft); CXTPDockingPane* resourcePane = m_paneManager.CreatePane( IDR_VIEW_RESOURCE_PANE, CRect(0, 0, 230, 140), xtpPaneDockLeft); m_paneManager.AttachPane(resourcePane, contentPane); contentPane->Select(); // Select Content view as the default tabcontentPane->SetTitle(CONTENT_VIEW_PANE_TAB_TITLE); resourcePane->SetTitle(RESOURCE_VIEW_PANE_TAB_TITLE); CXTPImageManager* pImageManager = m_pCommandBars->GetImageManager(); pImageManager->InternalAddRef(); m_paneManager.SetImageManager(pImageManager); /** Enable the Whidbey-style docking helpers. */ m_paneManager.SetAlphaDockingContext(TRUE); m_paneManager.SetShowDockingContextStickers(TRUE); /** Set MDI child windows to be controlled by the tab * interface. (The second argument enables tab groups. */ VERIFY(m_MTIClientWnd.Attach( this, TRUE));m_MTIClientWnd.EnableToolTips(); // Shows full path in tool // tips for tab. /** Show/don't show icons on tabs depending on pref setting. */ if (appPrefs.IsBitPrefSet(SHOW_TAB_ICONS))m_MTIClientWnd.GetPaintManager()->m_bShowIcons = TRUE; elsem_MTIClientWnd.GetPaintManager()->m_bShowIcons = FALSE; m_MTIClientWnd.SetAllowReorder(TRUE); // Allow the tabs to be reorderedtheApp.SetGlobalTabFrame(&m_MTIClientWnd); return 0;}
void CMainFrame::OnCustomize() {CXTPCommandBars *m_pCommandBars; CXTPCustomizeCommandsPage *pCommands; /** Get a pointer to the command bars object. */ m_pCommandBars = GetCommandBars(); if(m_pCommandBars != NULL) { /** Create the customize dialog object. */ CXTPCustomizeSheet dlg(m_pCommandBars); /** Add the options page to the customize dialog. */ CXTPCustomizeOptionsPage pageOptions(&dlg); dlg.AddPage(&pageOptions); /** Add the commands page to the customize dialog. */ pCommands = dlg.GetCommandsPage(); pCommands->AddCategories(IDR_MAINFRAME); /** Use the command bar manager to initialize the * customize dialog. */ pCommands->InsertAllCommandsCategory(); pCommands->InsertBuiltInMenus(IDR_MAINFRAME); pCommands->InsertNewMenuCategory(); /** Display the dialog. */ dlg.DoModal(); } return;} |
|
![]() |
|
JamesH
Senior Member
Joined: 01 December 2004 Status: Offline Points: 149 |
Post Options
Thanks(0)
Quote Reply
Posted: 16 June 2005 at 12:00pm |
![]() |
|
JayW
Newbie
Joined: 25 May 2005 Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Posted: 16 June 2005 at 1:01pm |
|
Thanks James... Problem Solved Jay |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |