]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/menuitem.h
check the item id validity in SetItem()
[wxWidgets.git] / include / wx / os2 / menuitem.h
CommitLineData
0e320a79 1///////////////////////////////////////////////////////////////////////////////
b73e73f9 2// Name: wx/os2/menuitem.h
0e320a79
DW
3// Purpose: wxMenuItem class
4// Author: Vadim Zeitlin
75f11ad7 5// Modified by:
0e320a79
DW
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
0e320a79
DW
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _MENUITEM_H
13#define _MENUITEM_H
14
0e320a79
DW
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
b73e73f9 19#include "wx/defs.h"
0e320a79
DW
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
75f11ad7 25 #include "wx/ownerdrw.h"
0e320a79
DW
26#endif
27
28// ----------------------------------------------------------------------------
29// constants
30// ----------------------------------------------------------------------------
31
0e320a79
DW
32// ----------------------------------------------------------------------------
33// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
34// ----------------------------------------------------------------------------
e92f266c 35class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
0e320a79
DW
36#if wxUSE_OWNER_DRAWN
37 , public wxOwnerDrawn
38#endif
39{
0e320a79 40public:
ab4fece8 41 //
e92f266c 42 // ctor & dtor
ab4fece8 43 //
22e90769 44 wxMenuItem( wxMenu* pParentMenu = NULL
4a277ceb 45 ,int nId = wxID_SEPARATOR
edf1dfa1
DW
46 ,const wxString& rStrName = wxEmptyString
47 ,const wxString& rWxHelp = wxEmptyString
598d8cac 48 ,wxItemKind eKind = wxITEM_NORMAL
22e90769
DW
49 ,wxMenu* pSubMenu = NULL
50 );
ab4fece8
DW
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 );
e92f266c 62 virtual ~wxMenuItem();
0e320a79 63
ab4fece8
DW
64 //
65 // Override base class virtuals
66 //
22e90769
DW
67 virtual void SetText(const wxString& rStrName);
68 virtual void SetCheckable(bool bCheckable);
0e320a79 69
b73e73f9
WS
70 virtual void Enable(bool bDoEnable = true);
71 virtual void Check(bool bDoCheck = true);
22e90769 72 virtual bool IsChecked(void) const;
75f11ad7 73
ab4fece8
DW
74 //
75 // Unfortunately needed to resolve ambiguity between
e92f266c 76 // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
ab4fece8 77 //
22e90769 78 bool IsCheckable(void) const { return wxMenuItemBase::IsCheckable(); }
0e320a79 79
ab4fece8
DW
80 //
81 // The id for a popup menu is really its menu handle (as required by
e92f266c
DW
82 // ::AppendMenu() API), so this function will return either the id or the
83 // menu handle depending on what we're
ab4fece8 84 //
22e90769 85 int GetRealId(void) const;
0e320a79 86
598d8cac
DW
87 //
88 // Mark item as belonging to the given radio group
89 //
ab4fece8
DW
90 void SetAsRadioGroupStart(void);
91 void SetRadioGroupStart(int nStart);
92 void SetRadioGroupEnd(int nEnd);
93
3e282d33
DW
94 //
95 // All OS/2PM Submenus and menus have one of these
96 //
97 MENUITEM m_vMenuData;
98
0e320a79 99private:
ab4fece8
DW
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;
598d8cac
DW
112 } m_vRadioGroup;
113
114 //
115 // Does this item start a radio group?
116 //
ab4fece8 117 bool m_bIsRadioGroupStart;
598d8cac 118
e92f266c 119 DECLARE_DYNAMIC_CLASS(wxMenuItem)
22e90769 120}; // end of CLASS wxMenuItem
0e320a79
DW
121
122#endif //_MENUITEM_H