]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/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 | #include "wx/os2/private.h" // for MENUITEM | |
21 | ||
22 | // an exception to the general rule that a normal header doesn't include other | |
23 | // headers - only because ownerdrw.h is not always included and I don't want | |
24 | // to write #ifdef's everywhere... | |
25 | #if wxUSE_OWNER_DRAWN | |
26 | #include "wx/ownerdrw.h" | |
27 | #endif | |
28 | ||
29 | // ---------------------------------------------------------------------------- | |
30 | // constants | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
33 | // ---------------------------------------------------------------------------- | |
34 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
35 | // ---------------------------------------------------------------------------- | |
36 | class WXDLLEXPORT wxMenuItem: public wxMenuItemBase | |
37 | #if wxUSE_OWNER_DRAWN | |
38 | , public wxOwnerDrawn | |
39 | #endif | |
40 | { | |
41 | public: | |
42 | // | |
43 | // ctor & dtor | |
44 | // | |
45 | wxMenuItem( wxMenu* pParentMenu = NULL | |
46 | ,int nId = wxID_SEPARATOR | |
47 | ,const wxString& rStrName = wxEmptyString | |
48 | ,const wxString& rWxHelp = wxEmptyString | |
49 | ,wxItemKind eKind = wxITEM_NORMAL | |
50 | ,wxMenu* pSubMenu = NULL | |
51 | ); | |
52 | ||
53 | // | |
54 | // Depricated, do not use in new code | |
55 | // | |
56 | wxMenuItem( wxMenu* pParentMenu | |
57 | ,int vId | |
58 | ,const wxString& rsText | |
59 | ,const wxString& rsHelp | |
60 | ,bool bIsCheckable | |
61 | ,wxMenu* pSubMenu = (wxMenu *)NULL | |
62 | ); | |
63 | virtual ~wxMenuItem(); | |
64 | ||
65 | // | |
66 | // Override base class virtuals | |
67 | // | |
68 | virtual void SetItemLabel(const wxString& rStrName); | |
69 | virtual void SetCheckable(bool bCheckable); | |
70 | ||
71 | virtual void Enable(bool bDoEnable = true); | |
72 | virtual void Check(bool bDoCheck = true); | |
73 | virtual bool IsChecked(void) const; | |
74 | ||
75 | // | |
76 | // Unfortunately needed to resolve ambiguity between | |
77 | // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() | |
78 | // | |
79 | bool IsCheckable(void) const { return wxMenuItemBase::IsCheckable(); } | |
80 | ||
81 | // | |
82 | // The id for a popup menu is really its menu handle (as required by | |
83 | // ::AppendMenu() API), so this function will return either the id or the | |
84 | // menu handle depending on what we're | |
85 | // | |
86 | int GetRealId(void) const; | |
87 | ||
88 | // | |
89 | // Mark item as belonging to the given radio group | |
90 | // | |
91 | void SetAsRadioGroupStart(void); | |
92 | void SetRadioGroupStart(int nStart); | |
93 | void SetRadioGroupEnd(int nEnd); | |
94 | ||
95 | // | |
96 | // All OS/2PM Submenus and menus have one of these | |
97 | // | |
98 | MENUITEM m_vMenuData; | |
99 | ||
100 | private: | |
101 | void Init(); | |
102 | ||
103 | // | |
104 | // The positions of the first and last items of the radio group this item | |
105 | // belongs to or -1: start is the radio group start and is valid for all | |
106 | // but first radio group items (m_isRadioGroupStart == FALSE), end is valid | |
107 | // only for the first one | |
108 | // | |
109 | union | |
110 | { | |
111 | int m_nStart; | |
112 | int m_nEnd; | |
113 | } m_vRadioGroup; | |
114 | ||
115 | // | |
116 | // Does this item start a radio group? | |
117 | // | |
118 | bool m_bIsRadioGroupStart; | |
119 | ||
120 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
121 | }; // end of CLASS wxMenuItem | |
122 | ||
123 | #endif //_MENUITEM_H |