]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/os2/menuitem.h
fixed Cygwin compilation (there's no _get_osfhandle)
[wxWidgets.git] / include / wx / os2 / menuitem.h
... / ...
CommitLineData
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 licence
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// ----------------------------------------------------------------------------
39class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
40#if wxUSE_OWNER_DRAWN
41 , public wxOwnerDrawn
42#endif
43{
44public:
45 //
46 // ctor & dtor
47 //
48 wxMenuItem( wxMenu* pParentMenu = NULL
49 ,int nId = wxID_SEPARATOR
50 ,const wxString& rStrName = ""
51 ,const wxString& rWxHelp = ""
52 ,wxItemKind eKind = wxITEM_NORMAL
53 ,wxMenu* pSubMenu = NULL
54 );
55
56 //
57 // Depricated, do not use in new code
58 //
59 wxMenuItem( wxMenu* pParentMenu
60 ,int vId
61 ,const wxString& rsText
62 ,const wxString& rsHelp
63 ,bool bIsCheckable
64 ,wxMenu* pSubMenu = (wxMenu *)NULL
65 );
66 virtual ~wxMenuItem();
67
68 //
69 // Override base class virtuals
70 //
71 virtual void SetText(const wxString& rStrName);
72 virtual void SetCheckable(bool bCheckable);
73
74 virtual void Enable(bool bDoEnable = TRUE);
75 virtual void Check(bool bDoCheck = TRUE);
76 virtual bool IsChecked(void) const;
77
78 //
79 // Unfortunately needed to resolve ambiguity between
80 // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
81 //
82 bool IsCheckable(void) const { return wxMenuItemBase::IsCheckable(); }
83
84 //
85 // The id for a popup menu is really its menu handle (as required by
86 // ::AppendMenu() API), so this function will return either the id or the
87 // menu handle depending on what we're
88 //
89 int GetRealId(void) const;
90
91 //
92 // Mark item as belonging to the given radio group
93 //
94 void SetAsRadioGroupStart(void);
95 void SetRadioGroupStart(int nStart);
96 void SetRadioGroupEnd(int nEnd);
97
98 //
99 // All OS/2PM Submenus and menus have one of these
100 //
101 MENUITEM m_vMenuData;
102
103private:
104 void Init();
105
106 //
107 // The positions of the first and last items of the radio group this item
108 // belongs to or -1: start is the radio group start and is valid for all
109 // but first radio group items (m_isRadioGroupStart == FALSE), end is valid
110 // only for the first one
111 //
112 union
113 {
114 int m_nStart;
115 int m_nEnd;
116 } m_vRadioGroup;
117
118 //
119 // Does this item start a radio group?
120 //
121 bool m_bIsRadioGroupStart;
122
123 DECLARE_DYNAMIC_CLASS(wxMenuItem)
124}; // end of CLASS wxMenuItem
125
126#endif //_MENUITEM_H