]>
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 | |
37d403aa JS |
13 | #include "wx/bitmap.h" |
14 | ||
6ca41e57 RR |
15 | //----------------------------------------------------------------------------- |
16 | // wxMenuItem | |
17 | //----------------------------------------------------------------------------- | |
23d1d521 | 18 | |
20123d49 | 19 | class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase |
6ca41e57 | 20 | { |
6ca41e57 | 21 | public: |
974e8d94 VZ |
22 | wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, |
23 | int id = wxID_SEPARATOR, | |
24 | const wxString& text = wxEmptyString, | |
25 | const wxString& help = wxEmptyString, | |
546bfbea | 26 | wxItemKind kind = wxITEM_NORMAL, |
974e8d94 | 27 | wxMenu *subMenu = (wxMenu *)NULL); |
d3c7fc99 | 28 | virtual ~wxMenuItem(); |
c626a8b7 | 29 | |
974e8d94 | 30 | // implement base class virtuals |
52af3158 JS |
31 | virtual void SetItemLabel( const wxString& str ); |
32 | virtual wxString GetItemLabel() const; | |
974e8d94 VZ |
33 | virtual void Enable( bool enable = TRUE ); |
34 | virtual void Check( bool check = TRUE ); | |
35 | virtual bool IsChecked() const; | |
37d403aa JS |
36 | virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } |
37 | virtual const wxBitmap& GetBitmap() const { return m_bitmap; } | |
c626a8b7 | 38 | |
717a57c2 VZ |
39 | #if wxUSE_ACCEL |
40 | virtual wxAcceleratorEntry *GetAccel() const; | |
41 | #endif // wxUSE_ACCEL | |
42 | ||
c626a8b7 VZ |
43 | // implementation |
44 | void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } | |
45 | GtkWidget *GetMenuItem() const { return m_menuItem; } | |
37d403aa JS |
46 | GtkWidget *GetLabelWidget() const { return m_labelWidget; } |
47 | void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; } | |
354aa1e3 | 48 | wxString GetFactoryPath() const; |
c626a8b7 | 49 | |
974e8d94 | 50 | wxString GetHotKey() const { return m_hotKey; } |
c626a8b7 | 51 | |
ee0a94cf RR |
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); | |
55 | ||
2368dcda VZ |
56 | // compatibility only, don't use in new code |
57 | wxMenuItem(wxMenu *parentMenu, | |
58 | int id, | |
59 | const wxString& text, | |
60 | const wxString& help, | |
61 | bool isCheckable, | |
62 | wxMenu *subMenu = (wxMenu *)NULL); | |
63 | ||
c626a8b7 | 64 | private: |
2368dcda | 65 | // common part of all ctors |
092f7536 | 66 | void Init(const wxString& text); |
2368dcda | 67 | |
974e8d94 VZ |
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); | |
71 | ||
72 | wxString m_hotKey; | |
37d403aa | 73 | wxBitmap m_bitmap; // Bitmap for menuitem, if any |
974e8d94 VZ |
74 | |
75 | GtkWidget *m_menuItem; // GtkMenuItem | |
37d403aa | 76 | GtkWidget* m_labelWidget; // Label widget |
c626a8b7 | 77 | |
974e8d94 | 78 | DECLARE_DYNAMIC_CLASS(wxMenuItem) |
23d1d521 JS |
79 | }; |
80 | ||
8bbe427f | 81 | #endif |
6ca41e57 | 82 | //__GTKMENUITEMH__ |