]>
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 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "menuitem.h" | |
17 | #endif | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // headers | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | #if wxUSE_OWNER_DRAWN | |
24 | #include "wx/ownerdrw.h" // base class | |
25 | #endif | |
26 | ||
27 | // ---------------------------------------------------------------------------- | |
28 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
31 | class WXDLLEXPORT wxMenuItem : public wxMenuItemBase | |
32 | #if wxUSE_OWNER_DRAWN | |
33 | , public wxOwnerDrawn | |
34 | #endif | |
35 | { | |
36 | public: | |
37 | // ctor & dtor | |
38 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, | |
39 | int id = wxID_SEPARATOR, | |
40 | const wxString& name = wxEmptyString, | |
41 | const wxString& help = wxEmptyString, | |
42 | wxItemKind kind = wxITEM_NORMAL, | |
43 | wxMenu *subMenu = (wxMenu *)NULL); | |
44 | virtual ~wxMenuItem(); | |
45 | ||
46 | // override base class virtuals | |
47 | virtual void SetText(const wxString& strName); | |
48 | virtual void SetCheckable(bool checkable); | |
49 | ||
50 | virtual void Enable(bool bDoEnable = TRUE); | |
51 | virtual void Check(bool bDoCheck = TRUE); | |
52 | virtual bool IsChecked() const; | |
53 | ||
54 | // unfortunately needed to resolve ambiguity between | |
55 | // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() | |
56 | bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } | |
57 | ||
ffecfa5a JS |
58 | // mark item as belonging to the given radio group |
59 | void SetAsRadioGroupStart(); | |
60 | void SetRadioGroupStart(int start); | |
61 | void SetRadioGroupEnd(int end); | |
62 | ||
63 | // compatibility only, don't use in new code | |
64 | wxMenuItem(wxMenu *parentMenu, | |
65 | int id, | |
66 | const wxString& text, | |
67 | const wxString& help, | |
68 | bool isCheckable, | |
69 | wxMenu *subMenu = (wxMenu *)NULL); | |
70 | ||
71 | private: | |
72 | // common part of all ctors | |
73 | void Init(); | |
74 | ||
75 | // the positions of the first and last items of the radio group this item | |
76 | // belongs to or -1: start is the radio group start and is valid for all | |
77 | // but first radio group items (m_isRadioGroupStart == FALSE), end is valid | |
78 | // only for the first one | |
79 | union | |
80 | { | |
81 | int start; | |
82 | int end; | |
83 | } m_radioGroup; | |
84 | ||
85 | // does this item start a radio group? | |
86 | bool m_isRadioGroupStart; | |
87 | ||
88 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) | |
89 | }; | |
90 | ||
91 | #endif //_MENUITEM_H |