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