]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/menuitem.h
Don't call IAutoComplete::Init() twice for the same control as this leaks memory...
[wxWidgets.git] / include / wx / gtk1 / menuitem.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/menuitem.h
3 // Purpose: wxMenuItem class
4 // Author: Robert Roebling
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKMENUITEMH__
11 #define __GTKMENUITEMH__
12
13 #include "wx/bitmap.h"
14
15 //-----------------------------------------------------------------------------
16 // wxMenuItem
17 //-----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
20 {
21 public:
22 wxMenuItem(wxMenu *parentMenu = NULL,
23 int id = wxID_SEPARATOR,
24 const wxString& text = wxEmptyString,
25 const wxString& help = wxEmptyString,
26 wxItemKind kind = wxITEM_NORMAL,
27 wxMenu *subMenu = NULL);
28 virtual ~wxMenuItem();
29
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; }
38
39 #if wxUSE_ACCEL
40 virtual wxAcceleratorEntry *GetAccel() const;
41 #endif // wxUSE_ACCEL
42
43 // implementation
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;
49
50 wxString GetHotKey() const { return m_hotKey; }
51
52 // compatibility only, don't use in new code
53 wxMenuItem(wxMenu *parentMenu,
54 int id,
55 const wxString& text,
56 const wxString& help,
57 bool isCheckable,
58 wxMenu *subMenu = NULL);
59
60 private:
61 // common part of all ctors
62 void Init();
63
64 // DoSetText() transforms the accel mnemonics in our label from MSW/wxWin
65 // style to GTK+ and is called from ctor and SetText()
66 void DoSetText(const wxString& text);
67
68 wxString m_hotKey;
69 wxBitmap m_bitmap; // Bitmap for menuitem, if any
70
71 GtkWidget *m_menuItem; // GtkMenuItem
72 GtkWidget* m_labelWidget; // Label widget
73
74 DECLARE_DYNAMIC_CLASS(wxMenuItem)
75 };
76
77 #endif
78 //__GTKMENUITEMH__