]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/menu.h
many fixes to wxTextCrtl, wxTreeCrtl, wxListBox,
[wxWidgets.git] / include / wx / gtk / menu.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: menu.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11
12 #ifndef __GTKMENUH__
13 #define __GTKMENUH__
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21 #include "wx/list.h"
22 #include "wx/window.h"
23
24 //-----------------------------------------------------------------------------
25 // classes
26 //-----------------------------------------------------------------------------
27
28 class wxMenuBar;
29 class wxMenuItem;
30 class wxMenu;
31
32 //-----------------------------------------------------------------------------
33 // const
34 //-----------------------------------------------------------------------------
35
36 #define ID_SEPARATOR (-1)
37
38 //-----------------------------------------------------------------------------
39 // wxMenuBar
40 //-----------------------------------------------------------------------------
41
42 class wxMenuBar: public wxWindow
43 {
44 DECLARE_DYNAMIC_CLASS(wxMenuBar)
45
46 public:
47
48 wxMenuBar(void);
49 void Append( wxMenu *menu, const wxString &title );
50 int FindMenuItem( const wxString &menuString, const wxString &itemString ) const;
51
52 wxList m_menus;
53 GtkWidget *m_menubar;
54 };
55
56 //-----------------------------------------------------------------------------
57 // wxMenu
58 //-----------------------------------------------------------------------------
59
60 class wxMenuItem: public wxObject
61 {
62 DECLARE_DYNAMIC_CLASS(wxMenuItem)
63
64 public:
65
66 wxMenuItem(void);
67
68 int m_id;
69 wxString m_text;
70 bool m_isCheckMenu;
71 bool m_checked;
72 bool m_isSubMenu;
73 bool m_isEnabled;
74 wxMenu *m_subMenu;
75 wxString m_helpStr;
76
77 GtkWidget *m_menuItem; // GtkMenuItem
78
79 bool IsSeparator() const { return m_id == ID_SEPARATOR; }
80 bool IsEnabled() const { return m_isEnabled; }
81 bool IsChecked() const { return m_checked; }
82
83 int GetId() const { return m_id; }
84 const wxString& GetHelp() const { return m_helpStr; }
85 wxMenu *GetSubMenu() const { return m_subMenu; }
86
87 };
88
89 class wxMenu: public wxEvtHandler
90 {
91 DECLARE_DYNAMIC_CLASS(wxMenu)
92
93 public:
94
95 wxMenu( const wxString &title = "" );
96 void AppendSeparator(void);
97 void Append( int id, const wxString &item,
98 const wxString &helpStr = "", bool checkable = FALSE );
99 void Append( int id, const wxString &item,
100 wxMenu *subMenu, const wxString &helpStr = "" );
101 int FindItem( const wxString itemString ) const;
102 void Break(void) {};
103 void Check(int id, bool Flag);
104 void Enable( int id, bool enable );
105 bool Enabled( int id ) const;
106 void SetLabel( int id, const wxString &label );
107
108 public:
109
110 int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
111 void SetInvokingWindow( wxWindow *win );
112 wxWindow *GetInvokingWindow(void);
113
114 wxString m_title;
115 wxList m_items;
116 wxWindow *m_invokingWindow;
117
118 GtkWidget *m_menu; // GtkMenu
119
120 };
121
122 #endif // __GTKMENUH__