]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/menu.h
added #define wxToolBar wxToolBarGTK for wxGTK
[wxWidgets.git] / include / wx / gtk1 / 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 wxMenuItem* FindMenuItemById( int id ) const;
52 bool IsChecked( int id ) const;
53 bool IsEnabled( int id ) const;
54
55 wxList m_menus;
56 GtkWidget *m_menubar;
57 };
58
59 //-----------------------------------------------------------------------------
60 // wxMenu
61 //-----------------------------------------------------------------------------
62
63 class wxMenuItem: public wxObject
64 {
65 DECLARE_DYNAMIC_CLASS(wxMenuItem)
66
67 public:
68
69 wxMenuItem(void);
70
71 int m_id;
72 wxString m_text;
73 bool m_isCheckMenu;
74 bool m_checked;
75 bool m_isSubMenu;
76 bool m_isEnabled;
77 wxMenu *m_subMenu;
78 wxString m_helpStr;
79
80 GtkWidget *m_menuItem; // GtkMenuItem
81
82 bool IsCheckable() const { return m_isCheckMenu; }
83 bool IsSeparator() const { return m_id == ID_SEPARATOR; }
84 bool IsEnabled() const { return m_isEnabled; }
85 int GetId() const { return m_id; }
86 const wxString& GetHelp() const { return m_helpStr; }
87 wxMenu *GetSubMenu() const { return m_subMenu; }
88
89 void Check( bool check );
90 bool IsChecked() const;
91 void Enable( bool enable );
92 };
93
94 class wxMenu: public wxEvtHandler
95 {
96 DECLARE_DYNAMIC_CLASS(wxMenu)
97
98 public:
99
100 wxMenu( const wxString &title = "" );
101 void AppendSeparator(void);
102 void Append( int id, const wxString &item,
103 const wxString &helpStr = "", bool checkable = FALSE );
104 void Append( int id, const wxString &item,
105 wxMenu *subMenu, const wxString &helpStr = "" );
106 int FindItem( const wxString itemString ) const;
107 wxMenuItem* FindItemForId( int id ) const;
108 void Break(void) {};
109 void Check(int id, bool Flag);
110 void Enable( int id, bool enable );
111 bool Enabled( int id ) const;
112 void SetLabel( int id, const wxString &label );
113
114 public:
115
116 int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
117 void SetInvokingWindow( wxWindow *win );
118 wxWindow *GetInvokingWindow(void);
119
120 wxString m_title;
121 wxList m_items;
122 wxWindow *m_invokingWindow;
123
124 GtkWidget *m_menu; // GtkMenu
125
126 };
127
128 #endif // __GTKMENUH__