]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/menuitem.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/menuitem.h
3 // Purpose: wxMenuItem class for wxUniversal
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_MENUITEM_H_
13 #define _WX_UNIV_MENUITEM_H_
16 #pragma interface "univmenuitem.h"
19 // ----------------------------------------------------------------------------
20 // wxMenuItem implements wxMenuItemBase
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxMenuItem
: public wxMenuItemBase
27 wxMenuItem(wxMenu
*parentMenu
= (wxMenu
*)NULL
,
28 int id
= wxID_SEPARATOR
,
29 const wxString
& name
= wxEmptyString
,
30 const wxString
& help
= wxEmptyString
,
31 wxItemKind kind
= wxItem_Normal
,
32 wxMenu
*subMenu
= (wxMenu
*)NULL
);
33 virtual ~wxMenuItem();
35 // override base class virtuals to update the item appearance on screen
36 virtual void SetText(const wxString
& text
);
37 virtual void SetCheckable(bool checkable
);
39 virtual void Enable(bool enable
= TRUE
);
40 virtual void Check(bool check
= TRUE
);
42 // we add some extra functions which are also available under MSW from
43 // wxOwnerDrawn class - they will be moved to wxMenuItemBase later
45 void SetBitmaps(const wxBitmap
& bmpChecked
,
46 const wxBitmap
& bmpUnchecked
= wxNullBitmap
);
47 void SetBitmap(const wxBitmap
& bmp
) { SetBitmaps(bmp
); }
48 const wxBitmap
& GetBitmap(bool checked
= TRUE
) const
49 { return checked
? m_bmpChecked
: m_bmpUnchecked
; }
51 // wxUniv-specific methods for implementation only starting from here
53 // get the accel index of our label or -1 if none
54 int GetAccelIndex() const { return m_indexAccel
; }
56 // get the accel string (displayed to the right of the label)
57 const wxString
& GetAccelString() const { return m_strAccel
; }
59 // set/get the y coord and the height of this item: note that it must be
60 // set first and retrieved later, the item doesn't calculate it itself
61 void SetGeometry(wxCoord y
, wxCoord height
)
67 wxCoord
GetPosition() const
69 wxASSERT_MSG( m_posY
!= -1, _T("must call SetHeight first!") );
74 wxCoord
GetHeight() const
76 wxASSERT_MSG( m_height
!= -1, _T("must call SetHeight first!") );
82 // notify the menu about the change in this item
83 inline void NotifyMenu();
85 // set the accel index and string from text
86 void UpdateAccelInfo();
88 // the bitmaps (may be invalid, then they're not used)
89 wxBitmap m_bmpChecked
,
92 // the position of the accelerator in our label, -1 if none
95 // the accel string (i.e. "Ctrl-Q" or "Alt-F1")
98 // the position and height of the displayed item
103 DECLARE_DYNAMIC_CLASS(wxMenuItem
)
106 #endif // _WX_UNIV_MENUITEM_H_