1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenuItem class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKMENUITEMH__
11 #define __GTKMENUITEMH__
13 #include "wx/bitmap.h"
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxMenuItem
: public wxMenuItemBase
22 wxMenuItem(wxMenu
*parentMenu
= (wxMenu
*)NULL
,
23 int id
= wxID_SEPARATOR
,
24 const wxString
& text
= wxEmptyString
,
25 const wxString
& help
= wxEmptyString
,
26 wxItemKind kind
= wxITEM_NORMAL
,
27 wxMenu
*subMenu
= (wxMenu
*)NULL
);
28 virtual ~wxMenuItem();
30 // implement base class virtuals
31 virtual void SetItemLabel( const wxString
& str
);
32 virtual wxString
GetItemLabel() const;
33 virtual void Enable( bool enable
= TRUE
);
34 virtual void Check( bool check
= TRUE
);
35 virtual bool IsChecked() const;
36 virtual void SetBitmap(const wxBitmap
& bitmap
) { m_bitmap
= bitmap
; }
37 virtual const wxBitmap
& GetBitmap() const { return m_bitmap
; }
40 virtual wxAcceleratorEntry
*GetAccel() const;
44 void SetMenuItem(GtkWidget
*menuItem
) { m_menuItem
= menuItem
; }
45 GtkWidget
*GetMenuItem() const { return m_menuItem
; }
46 GtkWidget
*GetLabelWidget() const { return m_labelWidget
; }
47 void SetLabelWidget(GtkWidget
*labelWidget
) { m_labelWidget
= labelWidget
; }
48 wxString
GetFactoryPath() const;
50 wxString
GetHotKey() const { return m_hotKey
; }
52 // splits given string in the label, doing & => _ translation, which is returned,
53 // and in the hotkey which is used to set given pointer
54 static wxString
GTKProcessMenuItemLabel(const wxString
& str
, wxString
*hotKey
);
56 // compatibility only, don't use in new code
57 wxMenuItem(wxMenu
*parentMenu
,
62 wxMenu
*subMenu
= (wxMenu
*)NULL
);
65 // common part of all ctors
66 void Init(const wxString
& text
);
68 // DoSetText() transforms the accel mnemonics in our label from MSW/wxWin
69 // style to GTK+ and is called from ctor and SetText()
70 void DoSetText(const wxString
& text
);
73 wxBitmap m_bitmap
; // Bitmap for menuitem, if any
75 GtkWidget
*m_menuItem
; // GtkMenuItem
76 GtkWidget
* m_labelWidget
; // Label widget
78 DECLARE_DYNAMIC_CLASS(wxMenuItem
)