]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/menuitem.h
Avoid setting attributes in GTK wxDataViewRenderer if not supported.
[wxWidgets.git] / include / wx / msw / menuitem.h
CommitLineData
23d1d521
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: menuitem.h
3// Purpose: wxMenuItem class
4// Author: Vadim Zeitlin
c626a8b7 5// Modified by:
23d1d521
JS
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
23d1d521
JS
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _MENUITEM_H
13#define _MENUITEM_H
14
23d1d521
JS
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
47d67540 19#if wxUSE_OWNER_DRAWN
974e8d94 20 #include "wx/ownerdrw.h" // base class
23d1d521
JS
21#endif
22
23d1d521
JS
23// ----------------------------------------------------------------------------
24// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
25// ----------------------------------------------------------------------------
974e8d94 26
53a2db12 27class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
47d67540 28#if wxUSE_OWNER_DRAWN
974e8d94 29 , public wxOwnerDrawn
23d1d521
JS
30#endif
31{
23d1d521 32public:
974e8d94 33 // ctor & dtor
d3b9f782 34 wxMenuItem(wxMenu *parentMenu = NULL,
974e8d94
VZ
35 int id = wxID_SEPARATOR,
36 const wxString& name = wxEmptyString,
37 const wxString& help = wxEmptyString,
546bfbea 38 wxItemKind kind = wxITEM_NORMAL,
d3b9f782 39 wxMenu *subMenu = NULL);
974e8d94
VZ
40 virtual ~wxMenuItem();
41
42 // override base class virtuals
52af3158 43 virtual void SetItemLabel(const wxString& strName);
974e8d94
VZ
44 virtual void SetCheckable(bool checkable);
45
598ddd96
WS
46 virtual void Enable(bool bDoEnable = true);
47 virtual void Check(bool bDoCheck = true);
a8cfd0cb 48 virtual bool IsChecked() const;
974e8d94
VZ
49
50 // unfortunately needed to resolve ambiguity between
51 // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
52 bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
53
54 // the id for a popup menu is really its menu handle (as required by
55 // ::AppendMenu() API), so this function will return either the id or the
660e7fda
VZ
56 // menu handle depending on what we are
57 //
58 // notice that it also returns the id as an unsigned int, as required by
59 // Win32 API
dca0f651 60 WXWPARAM GetMSWId() const;
974e8d94 61
0472ece7 62 // mark item as belonging to the given radio group
be15b995
VZ
63 void SetAsRadioGroupStart();
64 void SetRadioGroupStart(int start);
65 void SetRadioGroupEnd(int end);
0472ece7 66
efebabb7 67#if WXWIN_COMPATIBILITY_2_8
2368dcda 68 // compatibility only, don't use in new code
efebabb7 69 wxDEPRECATED(
2368dcda
VZ
70 wxMenuItem(wxMenu *parentMenu,
71 int id,
72 const wxString& text,
73 const wxString& help,
74 bool isCheckable,
efebabb7
PC
75 wxMenu *subMenu = NULL)
76 );
77#endif
2368dcda 78
23d1d521 79private:
2368dcda
VZ
80 // common part of all ctors
81 void Init();
82
0472ece7 83 // the positions of the first and last items of the radio group this item
be15b995 84 // belongs to or -1: start is the radio group start and is valid for all
598ddd96 85 // but first radio group items (m_isRadioGroupStart == false), end is valid
be15b995
VZ
86 // only for the first one
87 union
88 {
89 int start;
90 int end;
91 } m_radioGroup;
92
93 // does this item start a radio group?
94 bool m_isRadioGroupStart;
0472ece7 95
fc7a2a60 96 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem)
23d1d521
JS
97};
98
99#endif //_MENUITEM_H