]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/menuitem.h
Fix tab navigation bug with static boxes without enabled children.
[wxWidgets.git] / include / wx / osx / menuitem.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/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 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/defs.h"
20 #include "wx/bitmap.h"
21
22 // ----------------------------------------------------------------------------
23 // wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
24 // ----------------------------------------------------------------------------
25
26 class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ;
27
28 class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase
29 {
30 public:
31 // ctor & dtor
32 wxMenuItem(wxMenu *parentMenu = NULL,
33 int id = wxID_SEPARATOR,
34 const wxString& name = wxEmptyString,
35 const wxString& help = wxEmptyString,
36 wxItemKind kind = wxITEM_NORMAL,
37 wxMenu *subMenu = NULL);
38 virtual ~wxMenuItem();
39
40 // override base class virtuals
41 virtual void SetItemLabel(const wxString& strName);
42
43 virtual void Enable(bool bDoEnable = true);
44 virtual void Check(bool bDoCheck = true);
45
46 virtual void SetBitmap(const wxBitmap& bitmap) ;
47 virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
48
49
50 // Implementation only from now on.
51
52 // update the os specific representation
53 void UpdateItemBitmap() ;
54 void UpdateItemText() ;
55 void UpdateItemStatus() ;
56
57 // mark item as belonging to the given radio group
58 void SetAsRadioGroupStart(bool start = true);
59 void SetRadioGroupStart(int start);
60 void SetRadioGroupEnd(int end);
61
62 // return true if this is the starting item of a radio group
63 bool IsRadioGroupStart() const;
64
65 // get the start of the radio group this item belongs to: should not be
66 // called for the starting radio group item itself because it doesn't have
67 // this information
68 int GetRadioGroupStart() const;
69
70 // get the end of the radio group this item belongs to: should be only
71 // called for the starting radio group item, i.e. if IsRadioGroupStart() is
72 // true
73 int GetRadioGroupEnd() const;
74
75 wxMenuItemImpl* GetPeer() { return m_peer; }
76 private:
77 void UncheckRadio() ;
78
79 // the positions of the first and last items of the radio group this item
80 // belongs to or -1: start is the radio group start and is valid for all
81 // but first radio group items (m_isRadioGroupStart == FALSE), end is valid
82 // only for the first one
83 union
84 {
85 int start;
86 int end;
87 } m_radioGroup;
88
89 // does this item start a radio group?
90 bool m_isRadioGroupStart;
91
92 wxBitmap m_bitmap; // Bitmap for menuitem, if any
93
94 wxMenuItemImpl* m_peer;
95
96 DECLARE_DYNAMIC_CLASS(wxMenuItem)
97 };
98
99 #endif //_MENUITEM_H