]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | /////////////////////////////////////////////////////////////////////////////// |
e1d63b79 | 2 | // Name: wx/palmos/menuitem.h |
ffecfa5a | 3 | // Purpose: wxMenuItem class |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ffecfa5a JS |
5 | // Modified by: |
6 | // Created: 10/13/04 | |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _MENUITEM_H | |
13 | #define _MENUITEM_H | |
14 | ||
ffecfa5a JS |
15 | // ---------------------------------------------------------------------------- |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | #if wxUSE_OWNER_DRAWN | |
20 | #include "wx/ownerdrw.h" // base class | |
21 | #endif | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
53a2db12 | 27 | class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase |
ffecfa5a JS |
28 | #if wxUSE_OWNER_DRAWN |
29 | , public wxOwnerDrawn | |
30 | #endif | |
31 | { | |
32 | public: | |
33 | // ctor & dtor | |
d3b9f782 | 34 | wxMenuItem(wxMenu *parentMenu = NULL, |
ffecfa5a JS |
35 | int id = wxID_SEPARATOR, |
36 | const wxString& name = wxEmptyString, | |
37 | const wxString& help = wxEmptyString, | |
38 | wxItemKind kind = wxITEM_NORMAL, | |
d3b9f782 | 39 | wxMenu *subMenu = NULL); |
ffecfa5a JS |
40 | virtual ~wxMenuItem(); |
41 | ||
42 | // override base class virtuals | |
52af3158 | 43 | virtual void SetItemLabel(const wxString& strName); |
ffecfa5a JS |
44 | virtual void SetCheckable(bool checkable); |
45 | ||
46 | virtual void Enable(bool bDoEnable = TRUE); | |
47 | virtual void Check(bool bDoCheck = TRUE); | |
48 | virtual bool IsChecked() const; | |
49 | ||
50 | // unfortunately needed to resolve ambiguity between | |
51 | // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() | |
52 | bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } | |
53 | ||
ffecfa5a JS |
54 | // mark item as belonging to the given radio group |
55 | void SetAsRadioGroupStart(); | |
56 | void SetRadioGroupStart(int start); | |
57 | void SetRadioGroupEnd(int end); | |
58 | ||
59 | // compatibility only, don't use in new code | |
60 | wxMenuItem(wxMenu *parentMenu, | |
61 | int id, | |
62 | const wxString& text, | |
63 | const wxString& help, | |
64 | bool isCheckable, | |
d3b9f782 | 65 | wxMenu *subMenu = NULL); |
ffecfa5a JS |
66 | |
67 | private: | |
68 | // common part of all ctors | |
69 | void Init(); | |
70 | ||
71 | // the positions of the first and last items of the radio group this item | |
72 | // belongs to or -1: start is the radio group start and is valid for all | |
73 | // but first radio group items (m_isRadioGroupStart == FALSE), end is valid | |
74 | // only for the first one | |
75 | union | |
76 | { | |
77 | int start; | |
78 | int end; | |
79 | } m_radioGroup; | |
80 | ||
81 | // does this item start a radio group? | |
82 | bool m_isRadioGroupStart; | |
83 | ||
84 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) | |
85 | }; | |
86 | ||
87 | #endif //_MENUITEM_H |