]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: 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 = (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 | ~wxMenuItem(); | |
29 | ||
30 | // implement base class virtuals | |
31 | virtual void SetText( const wxString& str ); | |
32 | virtual void Enable( bool enable = TRUE ); | |
33 | virtual void Check( bool check = TRUE ); | |
34 | virtual bool IsChecked() const; | |
35 | virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } | |
36 | virtual const wxBitmap& GetBitmap() const { return m_bitmap; } | |
37 | ||
38 | #if wxUSE_ACCEL | |
39 | virtual wxAcceleratorEntry *GetAccel() const; | |
40 | #endif // wxUSE_ACCEL | |
41 | ||
42 | // implementation | |
43 | void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } | |
44 | GtkWidget *GetMenuItem() const { return m_menuItem; } | |
45 | GtkWidget *GetLabelWidget() const { return m_labelWidget; } | |
46 | void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; } | |
47 | wxString GetFactoryPath() const; | |
48 | ||
49 | wxString GetHotKey() const { return m_hotKey; } | |
50 | ||
51 | // compatibility only, don't use in new code | |
52 | wxMenuItem(wxMenu *parentMenu, | |
53 | int id, | |
54 | const wxString& text, | |
55 | const wxString& help, | |
56 | bool isCheckable, | |
57 | wxMenu *subMenu = (wxMenu *)NULL); | |
58 | ||
59 | private: | |
60 | // common part of all ctors | |
61 | void Init(const wxString& text); | |
62 | ||
63 | // DoSetText() transforms the accel mnemonics in our label from MSW/wxWin | |
64 | // style to GTK+ and is called from ctor and SetText() | |
65 | void DoSetText(const wxString& text); | |
66 | ||
67 | wxString m_hotKey; | |
68 | wxBitmap m_bitmap; // Bitmap for menuitem, if any | |
69 | ||
70 | GtkWidget *m_menuItem; // GtkMenuItem | |
71 | GtkWidget* m_labelWidget; // Label widget | |
72 | ||
73 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
74 | }; | |
75 | ||
76 | ||
77 | #endif | |
78 | //__GTKMENUITEMH__ |