Print Page | Close Window

CMenu and custom XTP 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=3965
Printed Date: 14 May 2025 at 3:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CMenu and custom XTP themes
Posted By: klisa
Subject: CMenu and custom XTP themes
Date Posted: 10 April 2006 at 5:24am

[Environment: Windows XP SP2, Visual Studio 2003, XTP 9800.]

Hi,

I need a help/hint regarding the usage of custom XTP themes.

Here's is the scenario:

- There is a simple custom paint theme in which paint and pane managers are derived from CXTPPaintManager and CXTPDockingPanePaintManager classes, respectively.
- The main application window is a CXTPFrameWnd-derived window;
- The main application menu is a regular MFC CMenu and not a CXTPMenuBar (this is important).

When the custom theme is applied like this (below is the main frame window's code)

    CXTPPaintManager* customTheme = ...;
    CXTPPaintManager::SetCustomTheme(customTheme);
    CXTPDockingPanePaintManager* customPaneTheme = ...;
    GetDockingPaneManager()->SetCustomTheme(customPaneTheme);

the custom theme affects only toolbars/command bars that are created using GetCommandBars()->Add() and CXTPToolBar::LoadToolbar() methods. The main application menu (CMenu) remains drawn in whatever is the current XTP standard theme.

Now, if the main application menu becomes a command bar (that is, if it's created like this):

    CXTPMenuBar* menuBar = GetCommandBars()->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);

then the custom theme affects it.

Unfortunately, the main application menu absolutely has to stay a CMenu because of the existing code (a lots of it) that enumerates/adds/modifies/removes *CMenu* items.

Switching to CXTPMenuBar simply isn't an option because it would require all that code to be changed to work with CXTPCommandBars and CXTPControls instead.

The question:

Is there a way to keep CMenu as the main application menu (in other words, not to load it as a command bar) and still to have it drawn using the custom theme painting?

Thanks,
Vladimir




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