]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: menuitem.h | |
3 | // Purpose: wxMenuItem class | |
4 | // Author: Vadim Zeitlin | |
75f11ad7 | 5 | // Modified by: |
0e320a79 DW |
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 | |
75f11ad7 | 29 | #include "wx/ownerdrw.h" |
0e320a79 DW |
30 | #endif |
31 | ||
32 | // ---------------------------------------------------------------------------- | |
33 | // constants | |
34 | // ---------------------------------------------------------------------------- | |
35 | ||
0e320a79 DW |
36 | // ---------------------------------------------------------------------------- |
37 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
38 | // ---------------------------------------------------------------------------- | |
e92f266c | 39 | class WXDLLEXPORT wxMenuItem: public wxMenuItemBase |
0e320a79 DW |
40 | #if wxUSE_OWNER_DRAWN |
41 | , public wxOwnerDrawn | |
42 | #endif | |
43 | { | |
0e320a79 | 44 | public: |
ab4fece8 | 45 | // |
e92f266c | 46 | // ctor & dtor |
ab4fece8 | 47 | // |
22e90769 | 48 | wxMenuItem( wxMenu* pParentMenu = NULL |
4a277ceb | 49 | ,int nId = wxID_SEPARATOR |
22e90769 DW |
50 | ,const wxString& rStrName = "" |
51 | ,const wxString& rWxHelp = "" | |
ab4fece8 | 52 | ,wxItemKind kind = wxITEM_NORMAL |
22e90769 DW |
53 | ,wxMenu* pSubMenu = NULL |
54 | ); | |
ab4fece8 DW |
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 | ); | |
e92f266c | 66 | virtual ~wxMenuItem(); |
0e320a79 | 67 | |
ab4fece8 DW |
68 | // |
69 | // Override base class virtuals | |
70 | // | |
22e90769 DW |
71 | virtual void SetText(const wxString& rStrName); |
72 | virtual void SetCheckable(bool bCheckable); | |
0e320a79 | 73 | |
e92f266c DW |
74 | virtual void Enable(bool bDoEnable = TRUE); |
75 | virtual void Check(bool bDoCheck = TRUE); | |
22e90769 | 76 | virtual bool IsChecked(void) const; |
75f11ad7 | 77 | |
ab4fece8 DW |
78 | // |
79 | // Unfortunately needed to resolve ambiguity between | |
e92f266c | 80 | // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() |
ab4fece8 | 81 | // |
22e90769 | 82 | bool IsCheckable(void) const { return wxMenuItemBase::IsCheckable(); } |
0e320a79 | 83 | |
ab4fece8 DW |
84 | // |
85 | // The id for a popup menu is really its menu handle (as required by | |
e92f266c DW |
86 | // ::AppendMenu() API), so this function will return either the id or the |
87 | // menu handle depending on what we're | |
ab4fece8 | 88 | // |
22e90769 | 89 | int GetRealId(void) const; |
0e320a79 | 90 | |
ab4fece8 DW |
91 | void SetAsRadioGroupStart(void); |
92 | void SetRadioGroupStart(int nStart); | |
93 | void SetRadioGroupEnd(int nEnd); | |
94 | ||
3e282d33 DW |
95 | // |
96 | // All OS/2PM Submenus and menus have one of these | |
97 | // | |
98 | MENUITEM m_vMenuData; | |
99 | ||
0e320a79 | 100 | private: |
ab4fece8 DW |
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 | bool m_bIsRadioGroupStart; | |
e92f266c | 115 | DECLARE_DYNAMIC_CLASS(wxMenuItem) |
22e90769 | 116 | }; // end of CLASS wxMenuItem |
0e320a79 DW |
117 | |
118 | #endif //_MENUITEM_H |