From 982fc42718584b842fbd3b986c88e7219d15e644 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 26 Mar 2004 20:59:06 +0000 Subject: [PATCH] Implement SetBitmaps() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/cocoa/menuitem.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/cocoa/menuitem.mm b/src/cocoa/menuitem.mm index f035d27581..5d85321a87 100644 --- a/src/cocoa/menuitem.mm +++ b/src/cocoa/menuitem.mm @@ -163,6 +163,25 @@ wxMenuItem::~wxMenuItem() // 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 // ----------------- -- 2.45.2