]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/qt/menu.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
20 #include "wx/object.h"
22 #include "wx/window.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 #define ID_SEPARATOR (-1)
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
42 class wxMenuBar
: public wxWindow
44 DECLARE_DYNAMIC_CLASS(wxMenuBar
)
48 void Append( wxMenu
*menu
, const wxString
&title
);
50 int FindMenuItem( const wxString
&menuString
, const wxString
&itemString
) const;
51 wxMenuItem
* FindMenuItemById( int id
) const;
53 void Check( int id
, bool check
);
54 bool Checked( int id
) const;
55 void Enable( int id
, bool enable
);
56 bool Enabled( int id
) const;
57 inline bool IsEnabled(int Id
) const { return Enabled(Id
); };
58 inline bool IsChecked(int Id
) const { return Checked(Id
); };
60 int GetMenuCount() const { return m_menus
.Number(); }
61 wxMenu
*GetMenu(int n
) const { return (wxMenu
*)m_menus
.Nth(n
)->Data(); }
66 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
70 class wxMenuItem
: public wxObject
72 DECLARE_DYNAMIC_CLASS(wxMenuItem
)
79 void SetId(int id
) { m_id
= id
; }
80 int GetId() const { return m_id
; }
81 bool IsSeparator() const { return m_id
== ID_SEPARATOR
; }
84 void SetText(const wxString
& str
);
85 const wxString
& GetText() const { return m_text
; }
87 // what kind of menu item we are
88 void SetCheckable(bool checkable
) { m_isCheckMenu
= checkable
; }
89 bool IsCheckable() const { return m_isCheckMenu
; }
90 void SetSubMenu(wxMenu
*menu
) { m_subMenu
= menu
; }
91 wxMenu
*GetSubMenu() const { return m_subMenu
; }
92 bool IsSubMenu() const { return m_subMenu
!= NULL
; }
95 void Enable(bool enable
= TRUE
) { m_isEnabled
= enable
; }
96 bool IsEnabled() const { return m_isEnabled
; }
97 void Check(bool check
= TRUE
);
98 bool IsChecked() const;
100 // help string (displayed in the status bar by default)
101 void SetHelpString(const wxString
& str
) { m_helpStr
= str
; }
114 class wxMenu
: public wxEvtHandler
116 DECLARE_DYNAMIC_CLASS(wxMenu
)
120 wxMenu( const wxString
&title
= "" );
124 void AppendSeparator();
125 void Append(int id
, const wxString
&item
,
126 const wxString
&helpStr
= "", bool checkable
= FALSE
);
127 void Append(int id
, const wxString
&item
,
128 wxMenu
*subMenu
, const wxString
&helpStr
= "" );
131 // find item by name/id
132 int FindItem( const wxString itemString
) const;
133 wxMenuItem
*FindItem(int id
) const;
135 // get/set item's state
136 void Enable( int id
, bool enable
);
137 bool IsEnabled( int id
) const;
138 void Check( int id
, bool check
);
139 bool IsChecked( int id
) const;
141 void SetLabel( int id
, const wxString
&label
);
144 wxList
& GetItems() { return m_items
; }
147 void SetInvokingWindow( wxWindow
*win
);
148 wxWindow
*GetInvokingWindow();
152 wxWindow
*m_invokingWindow
;
155 #endif // __GTKMENUH__