The Ultimate Toolbox Application Skins





5.00/5 (16 votes)
The Ultimate Toolbox supports Office XP, Office 2003, and Classic application skins
- Download the Ultimate Toolbox source code - 3 MB
- Download the Ultimate Toolbox sample projects - 5.4 MB
- Download the Ultimate Toolbox documentation in compiled HTML help (CHM) format - 4.9 MB
Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.
Source code and project files for this sample can be found in the samples\advanced\SkinsDemo directory of the sample projects download.
Overview
The Skins Demo demonstrates the skinning framework available in The Ultimate Toolbox library. You can choose between the Office 2003, Office XP and Classic skins, and you can also change skins dynamically when the application is running.
Setting a Skin to Your Application
- Derive your application class from
COXSkinnedApp
instead of fromCWinApp
. Do not forget to include OXSkins.h. - Derive your main frame window from
COXMenuBarFrame<CMDIFrameWnd, COXSizeDockBar>
instead of fromCMDIFrameWnd
for MDI applications. For SDI applications, derive your main frame window fromCOXMenuBarFrame<CFrameWnd, COXSizeDockBar>
instead of fromCFrameWnd
. - In the constructor of your main frame class call the constructor of
COXMenuBarFrame<…>
and passCBRS_ALIGN_ANY
for the first parameter andRUNTIME_CLASS(COXSizableMiniDockFrameWnd)
for the second parameter. - Derive or instantiate your toolbars from
COXCoolToolBar
instead of fromCToolBar
. - Add an instance of
COXBitmapMenuOrganizer
to your main frame class. In theWM_CREATE
handler of your main frame window callCOXBitmapMenuOrganizer::AttachFrameWnd(…)
and thenCOXBitmapMenuOrganizer:: AutoSetMenuImage(…)
. - Add an instance of
COXTabClientWnd
to your main frame class. This will enable the MDI tabs. In theWM_CREATE
handler of your main frame window callCOXTabClientWnd::Attach(...)
. - Derive or instantiate your status bar from
COXStatusBar
instead ofCStatusBar
. - Derive your view class from
COXSkinedView<PARENT>
, wherePARENT
is the class from which your view was previously derived.
In the very beginning of your application class's InitInstance
call SetCurrentSkin(_T("<skin name here>"))
. Choose from "Classic", "Office XP", and "Office 2003" skins. You can call this method again at any time to allow the user to switch between skins.
If you are having trouble following these steps they way they are outlined, just open the SkinsDemo project and do a text search for "STEP". You will find specific comments in all the places where the code needs to be modified:
Here is the related code which shows these actions in more detail:
// STEP 1 - Derive your application class from COXSkinnedApp insted of
// CWinApp.
class CSkinsDemoApp : public COXSkinnedApp
{
public:
CSkinsDemoApp();
...
// STEP 2 - Derive you main frame window from COXMenuBarFrame<cmdiframewnd, />.
class CMainFrame : public COXMenuBarFrame<cmdiframewnd, />
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
...
// STEP 3 - Call the constructor of COXMenuBarFrame<cmdiframewnd, /> and
// pass CBRS_ALIGN_ANY for the first parameter and
// RUNTIME_CLASS(COXSizableMiniDockFrameWnd) for the second parameter
CMainFrame::CMainFrame() :
COXMenuBarFrame<cmdiframewnd,coxsizedockbar />(CBRS_ALIGN_ANY,
RUNTIME_CLASS(COXSizableMiniDockFrameWnd))
{ ...
// STEP 4 - Derive or instantiate your toolbars from COXCoolToolBar instead
// of CToolBar.
COXCoolToolBar m_wndToolBar;
COXCoolToolBar m_wndToolBar2;
// STEP 5 - Add an instance of COXBitmapMenuOrganizer to your main frame
// class. This will enable your menus to show bitmaps.
COXBitmapMenuOrganizer m_BMO;
// STEP 5 (Cont'd) - Call COXBitmapMenuOrganizer::AttachFrameWnd(...) and then
// COXBitmapMenuOrganizer::AttachFrameWnd(...)
m_BMO.AttachFrameWnd(this);
m_BMO.AutoSetMenuImage(); // (place this code in the OnCreate handler
// of your CMainFrame class)
// STEP 6 - Add an instance of COXTabClientWnd to your main frame class.
// This will enable the MDI tabs.
COXTabClientWnd m_MTIClientWnd;
// STEP 6 (Cont'd) - Call COXTabClientWnd::Attach(...) in the OnCreate() of
// the main frame class
m_MTIClientWnd.Attach(this);
// STEP 7 - Derive or instantiate your status bar from COXStatusBar instead
// of CStatusBar.
COXStatusBar m_wndStatusBar;
// STEP 8: Derive your view class from COXSkinnedView<...>
#define BASEVIEW CView
class CSkinsDemoView : public COXSkinnedView<baseview />
{
protected: // create from serialization only
History
Initial CodeProject release August 2007.