]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: menuitem.h | |
3 | // Purpose: wxMenuItem class | |
4 | // Author: Robert Roebling | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows license | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __GTKMENUITEMH__ | |
11 | #define __GTKMENUITEMH__ | |
12 | ||
13 | #ifdef __GNUG__ | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | #include "wx/defs.h" | |
18 | #include "wx/string.h" | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // constants | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | #define ID_SEPARATOR (-1) | |
25 | ||
26 | //----------------------------------------------------------------------------- | |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
30 | class wxMenuItem; | |
31 | ||
32 | class wxMenu; | |
33 | ||
34 | //----------------------------------------------------------------------------- | |
35 | // wxMenuItem | |
36 | //----------------------------------------------------------------------------- | |
37 | ||
38 | class wxMenuItem: public wxObject | |
39 | { | |
40 | DECLARE_DYNAMIC_CLASS(wxMenuItem) | |
41 | ||
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 = name | |
52 | void SetName(const wxString& str); | |
53 | void SetText(const wxString& str) { SetName(str); } // compatibility | |
54 | const wxString& GetName() const { return m_text; } | |
55 | const wxString& GetText() const { return GetName(); } | |
56 | ||
57 | // what kind of menu item we are | |
58 | void SetCheckable(bool checkable) { m_isCheckMenu = checkable; } | |
59 | bool IsCheckable() const { return m_isCheckMenu; } | |
60 | void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } | |
61 | wxMenu *GetSubMenu() const { return m_subMenu; } | |
62 | bool IsSubMenu() const { return m_subMenu != NULL; } | |
63 | ||
64 | // state | |
65 | void Enable( bool enable = TRUE ); | |
66 | bool IsEnabled() const { return m_isEnabled; } | |
67 | void Check( bool check = TRUE ); | |
68 | bool IsChecked() const; | |
69 | ||
70 | // help string (displayed in the status bar by default) | |
71 | void SetHelp(const wxString& str) { m_helpStr = str; } | |
72 | const wxString& GetHelp() const { return m_helpStr; } | |
73 | ||
74 | // implementation | |
75 | void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } | |
76 | GtkWidget *GetMenuItem() const { return m_menuItem; } | |
77 | ||
78 | private: | |
79 | int m_id; | |
80 | wxString m_text; | |
81 | bool m_isCheckMenu; | |
82 | bool m_isChecked; | |
83 | bool m_isEnabled; | |
84 | wxMenu *m_subMenu; | |
85 | wxString m_helpStr; | |
86 | ||
87 | GtkWidget *m_menuItem; // GtkMenuItem | |
88 | }; | |
89 | ||
90 | ||
91 | #endif | |
92 | //__GTKMENUITEMH__ |