1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/menuitem.h
3 // Purpose: wxMenuItem class
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 #include "wx/bitmap.h"
21 // ----------------------------------------------------------------------------
22 // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
23 // ----------------------------------------------------------------------------
25 class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl
;
27 class WXDLLIMPEXP_CORE wxMenuItem
: public wxMenuItemBase
31 wxMenuItem(wxMenu
*parentMenu
= NULL
,
32 int id
= wxID_SEPARATOR
,
33 const wxString
& name
= wxEmptyString
,
34 const wxString
& help
= wxEmptyString
,
35 wxItemKind kind
= wxITEM_NORMAL
,
36 wxMenu
*subMenu
= NULL
);
37 virtual ~wxMenuItem();
39 // override base class virtuals
40 virtual void SetItemLabel(const wxString
& strName
);
42 virtual void Enable(bool bDoEnable
= true);
43 virtual void Check(bool bDoCheck
= true);
45 virtual void SetBitmap(const wxBitmap
& bitmap
) ;
46 virtual const wxBitmap
& GetBitmap() const { return m_bitmap
; }
49 // Implementation only from now on.
51 // update the os specific representation
52 void UpdateItemBitmap() ;
53 void UpdateItemText() ;
54 void UpdateItemStatus() ;
56 // mark item as belonging to the given radio group
57 void SetAsRadioGroupStart(bool start
= true);
58 void SetRadioGroupStart(int start
);
59 void SetRadioGroupEnd(int end
);
61 // return true if this is the starting item of a radio group
62 bool IsRadioGroupStart() const;
64 // get the start of the radio group this item belongs to: should not be
65 // called for the starting radio group item itself because it doesn't have
67 int GetRadioGroupStart() const;
69 // get the end of the radio group this item belongs to: should be only
70 // called for the starting radio group item, i.e. if IsRadioGroupStart() is
72 int GetRadioGroupEnd() const;
74 wxMenuItemImpl
* GetPeer() { return m_peer
; }
78 // the positions of the first and last items of the radio group this item
79 // belongs to or -1: start is the radio group start and is valid for all
80 // but first radio group items (m_isRadioGroupStart == FALSE), end is valid
81 // only for the first one
88 // does this item start a radio group?
89 bool m_isRadioGroupStart
;
91 wxBitmap m_bitmap
; // Bitmap for menuitem, if any
93 wxMenuItemImpl
* m_peer
;
95 DECLARE_DYNAMIC_CLASS(wxMenuItem
)