]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/menuitem.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenuItem class
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // an exception to the general rule that a normal header doesn't include other
20 // headers - only because ownerdrw.h is not always included and I don't want
21 // to write #ifdef's everywhere...
23 #include "wx/ownerdrw.h"
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 // id for a separator line in the menu (invalid for normal item)
31 #define ID_SEPARATOR (-1)
33 // ----------------------------------------------------------------------------
34 // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
35 // ----------------------------------------------------------------------------
36 class WXDLLEXPORT wxMenuItem
: public wxObject
41 DECLARE_DYNAMIC_CLASS(wxMenuItem
)
45 wxMenuItem(wxMenu
*pParentMenu
= NULL
, int id
= ID_SEPARATOR
,
46 const wxTString
& strName
= "", const wxTString
& wxHelp
= "",
47 bool bCheckable
= FALSE
, wxMenu
*pSubMenu
= NULL
);
48 virtual ~wxMenuItem();
50 // accessors (some more are inherited from wxOwnerDrawn or are below)
51 bool IsSeparator() const { return m_idItem
== ID_SEPARATOR
; }
52 bool IsEnabled() const { return m_bEnabled
; }
53 bool IsChecked() const { return m_bChecked
; }
55 int GetId() const { return m_idItem
; }
56 const wxString
& GetHelp() const { return m_strHelp
; }
57 wxMenu
*GetSubMenu() const { return m_pSubMenu
; }
60 void SetName(const wxString
& strName
) { m_strName
= strName
; }
61 void SetHelp(const wxString
& strHelp
) { m_strHelp
= strHelp
; }
63 void Enable(bool bDoEnable
= TRUE
);
64 void Check(bool bDoCheck
= TRUE
);
69 int m_idItem
; // numeric id of the item
70 wxString m_strHelp
; // associated help string
71 wxMenu
*m_pSubMenu
, // may be NULL
72 *m_pParentMenu
; // menu this item is contained in
73 bool m_bEnabled
, // enabled or greyed?
74 m_bChecked
; // checked? (only if checkable)
77 // wxOwnerDrawn base class already has these variables - nothing to do
80 bool m_bCheckable
; // can be checked?
81 wxString m_strName
; // name or label of the item
84 const wxString
& GetName() const { return m_strName
; }
85 bool IsCheckable() const { return m_bCheckable
; }