]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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 | // wxMenuBar | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
36 | class wxMenuBar: public wxWindow | |
37 | { | |
38 | DECLARE_DYNAMIC_CLASS(wxMenuBar) | |
39 | ||
40 | public: | |
41 | ||
42 | wxMenuBar(void); | |
43 | void Append( wxMenu *menu, const wxString &title ); | |
44 | int FindMenuItem( const wxString &menuString, const wxString &itemString ) const; | |
45 | ||
46 | wxList m_menus; | |
47 | GtkWidget *m_menubar; | |
48 | }; | |
49 | ||
50 | //----------------------------------------------------------------------------- | |
51 | // wxMenu | |
52 | //----------------------------------------------------------------------------- | |
53 | ||
54 | class wxMenuItem: public wxObject | |
55 | { | |
56 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
57 | ||
58 | public: | |
59 | ||
60 | wxMenuItem(void); | |
61 | ||
62 | int m_id; | |
63 | wxString m_text; | |
64 | bool m_isCheckMenu; | |
65 | bool m_checked; | |
66 | bool m_isSubMenu; | |
67 | bool m_isEnabled; | |
68 | wxMenu *m_subMenu; | |
69 | wxString m_helpStr; | |
70 | ||
71 | GtkWidget *m_menuItem; // GtkMenuItem | |
72 | ||
73 | }; | |
74 | ||
75 | class wxMenu: public wxEvtHandler | |
76 | { | |
77 | DECLARE_DYNAMIC_CLASS(wxMenu) | |
78 | ||
79 | public: | |
80 | ||
81 | wxMenu( const wxString &title = "" ); | |
82 | void AppendSeparator(void); | |
83 | void Append( const int id, const wxString &item, | |
84 | const wxString &helpStr = "", const bool checkable = FALSE ); | |
85 | void Append( const int id, const wxString &item, | |
86 | wxMenu *subMenu, const wxString &helpStr = "" ); | |
87 | int FindItem( const wxString itemString ) const; | |
88 | void Break(void) {}; | |
89 | void Enable( const int id, const bool enable ); | |
90 | bool Enabled( const int id ) const; | |
91 | void SetLabel( const int id, const wxString &label ); | |
92 | ||
93 | public: | |
94 | ||
95 | int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; | |
96 | void SetInvokingWindow( wxWindow *win ); | |
97 | wxWindow *GetInvokingWindow(void); | |
98 | ||
99 | wxString m_title; | |
100 | wxList m_items; | |
101 | wxWindow *m_invokingWindow; | |
102 | ||
103 | GtkWidget *m_menu; // GtkMenu | |
104 | ||
105 | }; | |
106 | ||
107 | #endif // __GTKMENUH__ |