]> git.saurik.com Git - wxWidgets.git/blame - include/wx/menuitem.h
Added wxExpr parser/lexer files which had somehow got lost;
[wxWidgets.git] / include / wx / menuitem.h
CommitLineData
c801d85f
KB
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// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
565215b2
JS
19#include "wx/setup.h"
20
c801d85f
KB
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 USE_OWNER_DRAWN
25#include "wx/ownerdrw.h"
26#endif
27
28// ----------------------------------------------------------------------------
29// constants
30// ----------------------------------------------------------------------------
31
32// id for a separator line in the menu (invalid for normal item)
33#define ID_SEPARATOR (-1)
34
35// ----------------------------------------------------------------------------
36// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
37// ----------------------------------------------------------------------------
38class WXDLLEXPORT wxMenuItem: public wxObject
39#if USE_OWNER_DRAWN
40 , public wxOwnerDrawn
41#endif
42{
43DECLARE_DYNAMIC_CLASS(wxMenuItem)
44
45public:
46 // ctor & dtor
47 wxMenuItem(wxMenu *pParentMenu = NULL, int id = ID_SEPARATOR,
48 const wxTString& strName = "", const wxTString& wxHelp = "",
49 bool bCheckable = FALSE, wxMenu *pSubMenu = NULL);
50 virtual ~wxMenuItem();
51
52 // accessors (some more are inherited from wxOwnerDrawn or are below)
53 bool IsSeparator() const { return m_idItem == ID_SEPARATOR; }
54 bool IsEnabled() const { return m_bEnabled; }
55 bool IsChecked() const { return m_bChecked; }
56
57 int GetId() const { return m_idItem; }
58 const wxString& GetHelp() const { return m_strHelp; }
59 wxMenu *GetSubMenu() const { return m_pSubMenu; }
60
61 // operations
62 void SetName(const wxString& strName) { m_strName = strName; }
63 void SetHelp(const wxString& strHelp) { m_strHelp = strHelp; }
64
65 void Enable(bool bDoEnable = TRUE);
66 void Check(bool bDoCheck = TRUE);
67
68 void DeleteSubMenu();
69
70private:
71 int m_idItem; // numeric id of the item
72 wxString m_strHelp; // associated help string
73 wxMenu *m_pSubMenu, // may be NULL
74 *m_pParentMenu; // menu this item is contained in
75 bool m_bEnabled, // enabled or greyed?
76 m_bChecked; // checked? (only if checkable)
77
78#if USE_OWNER_DRAWN
79 // wxOwnerDrawn base class already has these variables - nothing to do
80
81#else //!owner drawn
82 bool m_bCheckable; // can be checked?
83 wxString m_strName; // name or label of the item
84
85public:
86 const wxString& GetName() const { return m_strName; }
87 bool IsCheckable() const { return m_bCheckable; }
88#endif //owner drawn
89};
90
91#endif //_MENUITEM_H