Print Page | Close Window

Setting Themes

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2388
Printed Date: 09 November 2025 at 8:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Setting Themes
Posted By: JayW
Subject: Setting Themes
Date Posted: 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:

  • Do I have to override each button with your CXTButton class?
  • What is the basic procedure to make sure general UI elements have the correct theme?

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 tab

contentPane->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;

else

m_MTIClientWnd.GetPaintManager()->m_bShowIcons = FALSE;

m_MTIClientWnd.SetAllowReorder(TRUE); // Allow the tabs to be reordered

theApp.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;

}




Replies:
Posted By: JamesH
Date Posted: 16 June 2005 at 12:00pm

Does this thread help?

http://forum.codejock.com/forum_posts.asp?TID=1214&KW=manifest - http://forum.codejock.com/forum_posts.asp?TID=1214&K W=manifest

 



Posted By: JayW
Date Posted: 16 June 2005 at 1:01pm

Thanks James... Problem Solved  

Jay




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net