]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/menuitem.h
1. added encoding param to wxFontEncoding::EnumFamilies() which allows to get
[wxWidgets.git] / include / wx / os2 / menuitem.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: 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 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
29 #include "wx/ownerdrw.h"
30 #endif
31
32 // ----------------------------------------------------------------------------
33 // constants
34 // ----------------------------------------------------------------------------
35
36 // ----------------------------------------------------------------------------
37 // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
38 // ----------------------------------------------------------------------------
39 class WXDLLEXPORT wxMenuItem: public wxObject
40 #if wxUSE_OWNER_DRAWN
41 , public wxOwnerDrawn
42 #endif
43 {
44 DECLARE_DYNAMIC_CLASS(wxMenuItem)
45
46 public:
47 // ctor & dtor
48 wxMenuItem(wxMenu *pParentMenu = NULL, int id = ID_SEPARATOR,
49 const wxString& strName = "", const wxString& wxHelp = "",
50 bool bCheckable = FALSE, wxMenu *pSubMenu = NULL);
51 virtual ~wxMenuItem();
52
53 // accessors (some more are inherited from wxOwnerDrawn or are below)
54 bool IsSeparator() const { return m_idItem == ID_SEPARATOR; }
55 bool IsEnabled() const { return m_bEnabled; }
56 bool IsChecked() const { return m_bChecked; }
57 bool IsSubMenu() const { return GetSubMenu() != NULL; }
58
59 int GetId() const { return m_idItem; }
60 const wxString& GetHelp() const { return m_strHelp; }
61 wxMenu *GetSubMenu() const { return m_pSubMenu; }
62
63 // the id for a popup menu is really its menu handle (as required by
64 // ::AppendMenu() API)
65 int GetRealId() const;
66
67 // operations
68 void SetName(const wxString& strName);
69 void SetHelp(const wxString& strHelp) { m_strHelp = strHelp; }
70
71 void Enable(bool bDoEnable = TRUE);
72 void Check(bool bDoCheck = TRUE);
73
74 void DeleteSubMenu();
75
76 private:
77 int m_idItem; // numeric id of the item
78 wxString m_strHelp; // associated help string
79 wxMenu *m_pSubMenu, // may be NULL
80 *m_pParentMenu; // menu this item is contained in
81 bool m_bEnabled, // enabled or greyed?
82 m_bChecked; // checked? (only if checkable)
83
84 #if wxUSE_OWNER_DRAWN
85 // wxOwnerDrawn base class already has these variables - nothing to do
86
87 #else //!owner drawn
88 bool m_bCheckable; // can be checked?
89 wxString m_strName; // name or label of the item
90
91 public:
92 const wxString& GetName() const { return m_strName; }
93 bool IsCheckable() const { return m_bCheckable; }
94 #endif //owner drawn
95 };
96
97 #endif //_MENUITEM_H