]> git.saurik.com Git - wxWidgets.git/commitdiff
Use explicit menu item background if it's given under MSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Nov 2010 10:57:19 +0000 (10:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Nov 2010 10:57:19 +0000 (10:57 +0000)
An explicit item background colour specified in user code should override the
default theme background.

Closes #12652.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/menu/menu.cpp
src/msw/menuitem.cpp

index 7fd3a3292afc73a7f9daf1ad680ae47744a5eba0..48bd9e9de4c4a678f9c91aed325e8f48e4589646 100644 (file)
@@ -465,6 +465,8 @@ MyFrame::MyFrame()
 #if USE_LOG_WINDOW
     wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
                                       wxT("Clear &log\tCtrl-L"));
+    item->SetBackgroundColour(*wxBLACK);
+    item->SetTextColour(*wxRED);
 #if wxUSE_OWNER_DRAWN || defined(__WXGTK__)
     item->SetBitmap(copy_xpm);
 #endif
index 4d8ae82a8a17724e50f0b448b303e8f07dc5afe5..0c69e199bdbfb776e82089289894f4e6e40d813f 100644 (file)
@@ -959,7 +959,11 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc,
             rcText.top--;
 
 #if wxUSE_UXTHEME
-        wxUxThemeEngine* theme = MenuDrawData::GetUxThemeEngine();
+        // If a custom background colour is explicitly specified, we should use
+        // it instead of the default theme background.
+        wxUxThemeEngine* const theme = GetBackgroundColour().IsOk()
+                                        ? NULL
+                                        : MenuDrawData::GetUxThemeEngine();
         if ( theme )
         {
             POPUPITEMSTATES state;