| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/mac/classic/menuitem.h |
| 3 | // Purpose: wxMenuItem class |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Modified by: |
| 6 | // Created: 11.11.97 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> |
| 9 | // Licence: wxWindows licence |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _MENUITEM_H |
| 13 | #define _MENUITEM_H |
| 14 | |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | // headers |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | |
| 19 | #include "wx/defs.h" |
| 20 | |
| 21 | // ---------------------------------------------------------------------------- |
| 22 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour |
| 23 | // ---------------------------------------------------------------------------- |
| 24 | class WXDLLEXPORT wxMenuItem: public wxMenuItemBase |
| 25 | { |
| 26 | public: |
| 27 | // ctor & dtor |
| 28 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, |
| 29 | int id = wxID_SEPARATOR, |
| 30 | const wxString& name = wxEmptyString, |
| 31 | const wxString& help = wxEmptyString, |
| 32 | wxItemKind kind = wxITEM_NORMAL, |
| 33 | wxMenu *subMenu = (wxMenu *)NULL); |
| 34 | virtual ~wxMenuItem(); |
| 35 | |
| 36 | // override base class virtuals |
| 37 | virtual void SetText(const wxString& strName); |
| 38 | |
| 39 | virtual void Enable(bool bDoEnable = true); |
| 40 | virtual void Check(bool bDoCheck = true); |
| 41 | |
| 42 | virtual void SetBitmap(const wxBitmap& bitmap) ; |
| 43 | virtual const wxBitmap& GetBitmap() const { return m_bitmap; } |
| 44 | |
| 45 | // update the os specific representation |
| 46 | void UpdateItemBitmap() ; |
| 47 | void UpdateItemText() ; |
| 48 | void UpdateItemStatus() ; |
| 49 | |
| 50 | // mark item as belonging to the given radio group |
| 51 | void SetAsRadioGroupStart(); |
| 52 | void SetRadioGroupStart(int start); |
| 53 | void SetRadioGroupEnd(int end); |
| 54 | |
| 55 | private: |
| 56 | void UncheckRadio() ; |
| 57 | |
| 58 | // the positions of the first and last items of the radio group this item |
| 59 | // belongs to or -1: start is the radio group start and is valid for all |
| 60 | // but first radio group items (m_isRadioGroupStart == FALSE), end is valid |
| 61 | // only for the first one |
| 62 | union |
| 63 | { |
| 64 | int start; |
| 65 | int end; |
| 66 | } m_radioGroup; |
| 67 | |
| 68 | // does this item start a radio group? |
| 69 | bool m_isRadioGroupStart; |
| 70 | |
| 71 | wxBitmap m_bitmap; // Bitmap for menuitem, if any |
| 72 | void* m_menu ; // the appropriate menu , may also be a system menu |
| 73 | |
| 74 | DECLARE_DYNAMIC_CLASS(wxMenuItem) |
| 75 | }; |
| 76 | |
| 77 | #endif //_MENUITEM_H |