X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae53c98c9f71acb0876846b9c5b1e56adfdb6186..2b835535a92d6c281084c10e46d51029c1eb776d:/include/wx/gtk/menu.h diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 3638cee90e..dfa0569718 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -92,7 +92,7 @@ public: // implementation only wxList& GetMenus() { return m_menus; } - + void SetInvokingWindow( wxWindow *win ); void UnsetInvokingWindow( wxWindow *win ); @@ -101,6 +101,7 @@ public: wxList m_menus; GtkWidget *m_menubar; long m_style; + wxWindow *m_invokingWindow; }; //----------------------------------------------------------------------------- @@ -112,17 +113,26 @@ class wxMenu : public wxEvtHandler DECLARE_DYNAMIC_CLASS(wxMenu) public: - wxMenu( const wxString& title = wxEmptyString, - const wxFunction func = (wxFunction) NULL, - long style = 0); - wxMenu( long style ); + wxMenu( const wxString& title, const wxFunction func) + { + Init(title, 0, func); + } + wxMenu( long style ) + { + Init( wxEmptyString, style ); + } + wxMenu( const wxString& title = wxEmptyString, long style = 0 ) + { + Init(title, style); + } + ~wxMenu(); - // operations - // title + // title void SetTitle(const wxString& label); const wxString GetTitle() const; - // menu creation + + // menu creation void AppendSeparator(); void Append(int id, const wxString &item, const wxString &helpStr = "", bool checkable = FALSE); @@ -131,6 +141,9 @@ public: void Append(wxMenuItem *pItem); void Break() { } + // delete item. don't delete the wxMenu if it's a submenu + void Delete( int id ); + // find item by name/id int FindItem( const wxString itemString ) const; wxMenuItem *FindItem( int id ) const; @@ -165,13 +178,16 @@ public: wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); } -#ifdef WXWIN_COMPATIBILITY wxFunction GetCallback() const { return m_callback; } void Callback(const wxFunction func) { m_callback = func; } + wxFunction m_callback; + +#ifdef WXWIN_COMPATIBILITY // compatibility: these functions are deprecated bool Enabled(int id) const { return IsEnabled(id); } bool Checked(int id) const { return IsChecked(id); } + #endif // WXWIN_COMPATIBILITY // implementation @@ -186,17 +202,17 @@ public: GtkItemFactory *m_factory; // used by wxMenuBar - inline long GetStyle(void) const { return m_style; } - private: + long GetStyle(void) const { return m_style; } + +private: // common code for both constructors: void Init( const wxString& title, - const wxFunction func, - long style); + long style, + const wxFunction func = (wxFunction) NULL ); wxString m_title; wxList m_items; wxWindow *m_invokingWindow; - wxFunction m_callback; wxEvtHandler *m_eventHandler; void *m_clientData; long m_style;