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