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