]>
Commit | Line | Data |
---|---|---|
23d1d521 JS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: menuitem.h | |
3 | // Purpose: wxMenuItem class | |
4 | // Author: Vadim Zeitlin | |
c626a8b7 | 5 | // Modified by: |
23d1d521 JS |
6 | // Created: 11.11.97 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
65571936 | 9 | // Licence: wxWindows licence |
23d1d521 JS |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _MENUITEM_H | |
13 | #define _MENUITEM_H | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
c626a8b7 | 16 | #pragma interface "menuitem.h" |
23d1d521 JS |
17 | #endif |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // headers | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
47d67540 | 23 | #if wxUSE_OWNER_DRAWN |
974e8d94 | 24 | #include "wx/ownerdrw.h" // base class |
23d1d521 JS |
25 | #endif |
26 | ||
23d1d521 JS |
27 | // ---------------------------------------------------------------------------- |
28 | // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour | |
29 | // ---------------------------------------------------------------------------- | |
974e8d94 VZ |
30 | |
31 | class WXDLLEXPORT wxMenuItem : public wxMenuItemBase | |
47d67540 | 32 | #if wxUSE_OWNER_DRAWN |
974e8d94 | 33 | , public wxOwnerDrawn |
23d1d521 JS |
34 | #endif |
35 | { | |
23d1d521 | 36 | public: |
974e8d94 VZ |
37 | // ctor & dtor |
38 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, | |
39 | int id = wxID_SEPARATOR, | |
40 | const wxString& name = wxEmptyString, | |
41 | const wxString& help = wxEmptyString, | |
546bfbea | 42 | wxItemKind kind = wxITEM_NORMAL, |
974e8d94 VZ |
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); | |
a8cfd0cb | 52 | virtual bool IsChecked() const; |
974e8d94 VZ |
53 | |
54 | // unfortunately needed to resolve ambiguity between | |
55 | // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() | |
56 | bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } | |
57 | ||
58 | // the id for a popup menu is really its menu handle (as required by | |
59 | // ::AppendMenu() API), so this function will return either the id or the | |
60 | // menu handle depending on what we're | |
61 | int GetRealId() const; | |
62 | ||
0472ece7 | 63 | // mark item as belonging to the given radio group |
be15b995 VZ |
64 | void SetAsRadioGroupStart(); |
65 | void SetRadioGroupStart(int start); | |
66 | void SetRadioGroupEnd(int end); | |
0472ece7 | 67 | |
2368dcda VZ |
68 | // compatibility only, don't use in new code |
69 | wxMenuItem(wxMenu *parentMenu, | |
70 | int id, | |
71 | const wxString& text, | |
72 | const wxString& help, | |
73 | bool isCheckable, | |
74 | wxMenu *subMenu = (wxMenu *)NULL); | |
75 | ||
23d1d521 | 76 | private: |
2368dcda VZ |
77 | // common part of all ctors |
78 | void Init(); | |
79 | ||
0472ece7 | 80 | // the positions of the first and last items of the radio group this item |
be15b995 VZ |
81 | // belongs to or -1: start is the radio group start and is valid for all |
82 | // but first radio group items (m_isRadioGroupStart == FALSE), end is valid | |
83 | // only for the first one | |
84 | union | |
85 | { | |
86 | int start; | |
87 | int end; | |
88 | } m_radioGroup; | |
89 | ||
90 | // does this item start a radio group? | |
91 | bool m_isRadioGroupStart; | |
0472ece7 | 92 | |
fc7a2a60 | 93 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) |
23d1d521 JS |
94 | }; |
95 | ||
96 | #endif //_MENUITEM_H |