]>
Commit | Line | Data |
---|---|---|
23d1d521 JS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: menuitem.h | |
3 | // Purpose: wxMenuItem class | |
6ca41e57 | 4 | // Author: Robert Roebling |
23d1d521 | 5 | // RCS-ID: $Id$ |
6ca41e57 | 6 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 7 | // Licence: wxWindows licence |
23d1d521 JS |
8 | /////////////////////////////////////////////////////////////////////////////// |
9 | ||
6ca41e57 RR |
10 | #ifndef __GTKMENUITEMH__ |
11 | #define __GTKMENUITEMH__ | |
23d1d521 | 12 | |
12028905 | 13 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
6ca41e57 | 14 | #pragma interface |
23d1d521 JS |
15 | #endif |
16 | ||
37d403aa JS |
17 | #include "wx/bitmap.h" |
18 | ||
6ca41e57 RR |
19 | //----------------------------------------------------------------------------- |
20 | // wxMenuItem | |
21 | //----------------------------------------------------------------------------- | |
23d1d521 | 22 | |
20123d49 | 23 | class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase |
6ca41e57 | 24 | { |
6ca41e57 | 25 | public: |
974e8d94 VZ |
26 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, |
27 | int id = wxID_SEPARATOR, | |
28 | const wxString& text = wxEmptyString, | |
29 | const wxString& help = wxEmptyString, | |
546bfbea | 30 | wxItemKind kind = wxITEM_NORMAL, |
974e8d94 | 31 | wxMenu *subMenu = (wxMenu *)NULL); |
d1b15f03 | 32 | ~wxMenuItem(); |
c626a8b7 | 33 | |
974e8d94 | 34 | // implement base class virtuals |
354aa1e3 | 35 | virtual void SetText( const wxString& str ); |
974e8d94 VZ |
36 | virtual void Enable( bool enable = TRUE ); |
37 | virtual void Check( bool check = TRUE ); | |
38 | virtual bool IsChecked() const; | |
37d403aa JS |
39 | virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } |
40 | virtual const wxBitmap& GetBitmap() const { return m_bitmap; } | |
c626a8b7 | 41 | |
717a57c2 VZ |
42 | #if wxUSE_ACCEL |
43 | virtual wxAcceleratorEntry *GetAccel() const; | |
44 | #endif // wxUSE_ACCEL | |
45 | ||
c626a8b7 VZ |
46 | // implementation |
47 | void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } | |
48 | GtkWidget *GetMenuItem() const { return m_menuItem; } | |
37d403aa JS |
49 | GtkWidget *GetLabelWidget() const { return m_labelWidget; } |
50 | void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; } | |
354aa1e3 | 51 | wxString GetFactoryPath() const; |
c626a8b7 | 52 | |
974e8d94 | 53 | wxString GetHotKey() const { return m_hotKey; } |
c626a8b7 | 54 | |
2368dcda VZ |
55 | // compatibility only, don't use in new code |
56 | wxMenuItem(wxMenu *parentMenu, | |
57 | int id, | |
58 | const wxString& text, | |
59 | const wxString& help, | |
60 | bool isCheckable, | |
61 | wxMenu *subMenu = (wxMenu *)NULL); | |
62 | ||
c626a8b7 | 63 | private: |
2368dcda | 64 | // common part of all ctors |
092f7536 | 65 | void Init(const wxString& text); |
2368dcda | 66 | |
974e8d94 VZ |
67 | // DoSetText() transforms the accel mnemonics in our label from MSW/wxWin |
68 | // style to GTK+ and is called from ctor and SetText() | |
69 | void DoSetText(const wxString& text); | |
70 | ||
71 | wxString m_hotKey; | |
37d403aa | 72 | wxBitmap m_bitmap; // Bitmap for menuitem, if any |
974e8d94 VZ |
73 | |
74 | GtkWidget *m_menuItem; // GtkMenuItem | |
37d403aa | 75 | GtkWidget* m_labelWidget; // Label widget |
c626a8b7 | 76 | |
974e8d94 | 77 | DECLARE_DYNAMIC_CLASS(wxMenuItem) |
23d1d521 JS |
78 | }; |
79 | ||
6ca41e57 | 80 | |
8bbe427f | 81 | #endif |
6ca41e57 | 82 | //__GTKMENUITEMH__ |