]> git.saurik.com Git - wxWidgets.git/commitdiff
Always provide wxMenuItem bitmap-related methods in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:55 +0000 (00:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Mar 2012 00:29:55 +0000 (00:29 +0000)
Define these methods even when wxUSE_OWNER_DRAWN is turned off for some
reason. This allows to avoid ugly tests for !defined(__WXMSW__) ||
wxUSE_OWNER_DRAWN in the code that just wants to set a bitmap for a menu item.

Closes #12664.

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

include/wx/msw/menuitem.h
samples/menu/menu.cpp

index 1fe684971bf3ef757afaa007fa77fb3554003a43..fb6ef62e5e43b86fe3fa78535c3688f255be5e32 100644 (file)
@@ -119,7 +119,16 @@ private:
     // helper function for draw std menu check mark
     void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat);
 
-#endif // wxUSE_OWNER_DRAWN
+#else // !wxUSE_OWNER_DRAWN
+    // Provide stubs for the public functions above to ensure that the code
+    // still compiles without wxUSE_OWNER_DRAWN -- it makes sense to just drop
+    // the bitmaps then instead of failing compilation.
+    void SetBitmaps(const wxBitmap& WXUNUSED(bmpChecked),
+                    const wxBitmap& WXUNUSED(bmpUnchecked) = wxNullBitmap) { }
+    void SetBitmap(const wxBitmap& WXUNUSED(bmp),
+                   bool WXUNUSED(bChecked) = true) { }
+    const wxBitmap& GetBitmap() const { return wxNullBitmap; }
+#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
 
 private:
     // common part of all ctors
index 3d65f8c4e45b3901f28ffd3ccff32bb692341c67..3c8f97df67b197f8d5f877beb4101d417b004b4f 100644 (file)
@@ -466,9 +466,7 @@ MyFrame::MyFrame()
 #if USE_LOG_WINDOW
     wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
                                       wxT("Clear &log\tCtrl-L"));
-#if wxUSE_OWNER_DRAWN || defined(__WXGTK__)
     item->SetBitmap(copy_xpm);
-#endif
     fileMenu->Append(item);
     fileMenu->AppendSeparator();
 #endif // USE_LOG_WINDOW