X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83885a398be7f011ae6e5aa030dca2b2a1e281d5..dc86cb34c3a8f141686339f1285cf259dec5faaa:/include/wx/gtk/menu.h diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 38da6ec98f..7060ea2dd0 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -2,9 +2,8 @@ // Name: menu.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -49,13 +48,17 @@ public: int FindMenuItem( const wxString &menuString, const wxString &itemString ) const; wxMenuItem* FindMenuItemById( int id ) const; + + void Check( int id, bool check ); + bool Checked( int id ) const; + void Enable( int id, bool enable ); + bool Enabled( int id ) const; + inline bool IsEnabled(int Id) const { return Enabled(Id); }; + inline bool IsChecked(int Id) const { return Checked(Id); }; int GetMenuCount() const { return m_menus.Number(); } wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } - bool IsChecked( int id ) const; - bool IsEnabled( int id ) const; - wxList m_menus; GtkWidget *m_menubar; }; @@ -89,13 +92,14 @@ public: bool IsSubMenu() const { return m_subMenu != NULL; } // state - void Enable(bool enable = TRUE) { m_isEnabled = enable; } + void Enable( bool enable = TRUE ); bool IsEnabled() const { return m_isEnabled; } - void Check(bool check = TRUE); + void Check( bool check = TRUE ); bool IsChecked() const; // help string (displayed in the status bar by default) - void SetHelpString(const wxString& str) { m_helpStr = str; } + void SetHelp(const wxString& str) { m_helpStr = str; } + const wxString& GetHelp() const { return m_helpStr; } // implementation void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } @@ -119,9 +123,12 @@ DECLARE_DYNAMIC_CLASS(wxMenu) public: // construction - wxMenu( const wxString &title = "" ); + wxMenu( const wxString& title = wxEmptyString, const wxFunction func = (wxFunction) NULL ); // operations + // title + void SetTitle(const wxString& label); + const wxString GetTitle() const; // menu creation void AppendSeparator(); void Append(int id, const wxString &item, @@ -132,7 +139,8 @@ public: // find item by name/id int FindItem( const wxString itemString ) const; - wxMenuItem *FindItem(int id) const; + wxMenuItem *FindItem( int id ) const; + wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); } // get/set item's state void Enable( int id, bool enable ); @@ -141,20 +149,32 @@ public: bool IsChecked( int id ) const; void SetLabel( int id, const wxString &label ); + wxString GetLabel(int id) const; + // helpstring + virtual void SetHelpString(int id, const wxString& helpString); + virtual wxString GetHelpString(int id) const ; + // accessors wxList& GetItems() { return m_items; } + inline void Callback(const wxFunction func) { m_callback = func; } + + inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } + inline wxEvtHandler *GetEventHandler() { return m_eventHandler; } + public: int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; void SetInvokingWindow( wxWindow *win ); wxWindow *GetInvokingWindow(); - wxString m_title; - wxList m_items; - wxWindow *m_invokingWindow; + wxString m_title; + wxList m_items; + wxWindow *m_invokingWindow; + wxFunction m_callback; + wxEvtHandler *m_eventHandler; - GtkWidget *m_menu; // GtkMenu + GtkWidget *m_menu; // GtkMenu }; #endif // __GTKMENUH__