]>
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 |
23d1d521 JS |
7 | // Licence: wxWindows license |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
6ca41e57 RR |
10 | #ifndef __GTKMENUITEMH__ |
11 | #define __GTKMENUITEMH__ | |
23d1d521 JS |
12 | |
13 | #ifdef __GNUG__ | |
6ca41e57 | 14 | #pragma interface |
23d1d521 JS |
15 | #endif |
16 | ||
6ca41e57 RR |
17 | #include "wx/defs.h" |
18 | #include "wx/string.h" | |
23d1d521 JS |
19 | |
20 | // ---------------------------------------------------------------------------- | |
21 | // constants | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
23d1d521 JS |
24 | #define ID_SEPARATOR (-1) |
25 | ||
6ca41e57 RR |
26 | //----------------------------------------------------------------------------- |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
23d1d521 | 29 | |
6ca41e57 | 30 | class wxMenuItem; |
23d1d521 | 31 | |
6ca41e57 | 32 | class wxMenu; |
23d1d521 | 33 | |
6ca41e57 RR |
34 | //----------------------------------------------------------------------------- |
35 | // wxMenuItem | |
36 | //----------------------------------------------------------------------------- | |
23d1d521 | 37 | |
6ca41e57 RR |
38 | class wxMenuItem: public wxObject |
39 | { | |
40 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
23d1d521 | 41 | |
6ca41e57 RR |
42 | public: |
43 | wxMenuItem(); | |
44 | ||
45 | // accessors | |
46 | // id | |
47 | void SetId(int id) { m_id = id; } | |
48 | int GetId() const { return m_id; } | |
49 | bool IsSeparator() const { return m_id == ID_SEPARATOR; } | |
50 | ||
51 | // the item's text | |
52 | void SetText(const wxString& str); | |
53 | const wxString& GetText() const { return m_text; } | |
54 | ||
55 | // what kind of menu item we are | |
56 | void SetCheckable(bool checkable) { m_isCheckMenu = checkable; } | |
57 | bool IsCheckable() const { return m_isCheckMenu; } | |
58 | void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } | |
59 | wxMenu *GetSubMenu() const { return m_subMenu; } | |
60 | bool IsSubMenu() const { return m_subMenu != NULL; } | |
61 | ||
62 | // state | |
63 | void Enable( bool enable = TRUE ); | |
64 | bool IsEnabled() const { return m_isEnabled; } | |
65 | void Check( bool check = TRUE ); | |
66 | bool IsChecked() const; | |
67 | ||
68 | // help string (displayed in the status bar by default) | |
69 | void SetHelp(const wxString& str) { m_helpStr = str; } | |
70 | const wxString& GetHelp() const { return m_helpStr; } | |
71 | ||
72 | // implementation | |
73 | void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } | |
74 | GtkWidget *GetMenuItem() const { return m_menuItem; } | |
23d1d521 JS |
75 | |
76 | private: | |
6ca41e57 RR |
77 | int m_id; |
78 | wxString m_text; | |
79 | bool m_isCheckMenu; | |
80 | bool m_isChecked; | |
81 | bool m_isEnabled; | |
82 | wxMenu *m_subMenu; | |
83 | wxString m_helpStr; | |
84 | ||
85 | GtkWidget *m_menuItem; // GtkMenuItem | |
23d1d521 JS |
86 | }; |
87 | ||
6ca41e57 RR |
88 | |
89 | #endif | |
90 | //__GTKMENUITEMH__ |