]>
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 | ||
95 | ||
3e282d33 DW |
96 | // |
97 | // All OS/2PM Submenus and menus have one of these | |
98 | // | |
99 | MENUITEM m_vMenuData; | |
100 | ||
0e320a79 | 101 | private: |
ab4fece8 DW |
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; | |
e92f266c | 116 | DECLARE_DYNAMIC_CLASS(wxMenuItem) |
22e90769 | 117 | }; // end of CLASS wxMenuItem |
0e320a79 DW |
118 | |
119 | #endif //_MENUITEM_H |