]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement SetBitmaps()
authorDavid Elliott <dfe@tgwbd.org>
Fri, 26 Mar 2004 20:59:06 +0000 (20:59 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Fri, 26 Mar 2004 20:59:06 +0000 (20:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/menuitem.mm

index f035d27581104e4fcf7f8229c196a1ba2bedb024..5d85321a8721c9445f16724ba1e54494f7143669 100644 (file)
@@ -163,6 +163,25 @@ wxMenuItem::~wxMenuItem()
 // misc
 // ----------------------------------------------------------------------------
 
 // misc
 // ----------------------------------------------------------------------------
 
+void wxMenuItem::SetBitmaps(const wxBitmap& bmpChecked,
+        const wxBitmap& bmpUnchecked)
+{
+    wxCHECK_RET(m_kind != wxITEM_SEPARATOR, wxT("Separator items do not have bitmaps."));
+    wxAutoNSAutoreleasePool pool;
+    m_bmpChecked = bmpChecked;
+    m_bmpUnchecked = bmpUnchecked;
+    if(IsCheckable())
+    {
+        [m_cocoaNSMenuItem setOnStateImage: bmpChecked.GetNSImage(true)];
+        [m_cocoaNSMenuItem setOffStateImage: bmpUnchecked.GetNSImage(true)];
+    }
+    else
+    {
+        wxASSERT_MSG(!bmpUnchecked.Ok(),wxT("Normal menu items should only have one bitmap"));
+        [m_cocoaNSMenuItem setImage: bmpChecked.GetNSImage(true)];
+    }
+}
+
 // change item state
 // -----------------
 
 // change item state
 // -----------------