X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ea5ef0190b1b2f4d248af6b06d718a9adef2d41..f5fac4471b361f54ae6a09f6047ae4dbe30fcb86:/include/wx/osx/menu.h diff --git a/include/wx/osx/menu.h b/include/wx/osx/menu.h index bac68f21b5..17f351efd6 100644 --- a/include/wx/osx/menu.h +++ b/include/wx/osx/menu.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: menu.h +// Name: wx/osx/menu.h // Purpose: wxMenu, wxMenuBar classes // Author: Stefan Csomor // Modified by: @@ -41,10 +41,6 @@ public: bool ProcessCommand(wxCommandEvent& event); - // semi-private accessors - - // get the window which contains this menu - wxWindow *GetWindow() const; // get the menu handle WXHMENU GetHMenu() const ; @@ -58,20 +54,20 @@ public: void HandleMenuClosed(); wxMenuImpl* GetPeer() { return m_peer; } - + // make sure we can veto void SetAllowRearrange( bool allow ); bool AllowRearrange() const { return m_allowRearrange; } - + // if a menu is used purely for internal implementation reasons (eg wxChoice) // we don't want native menu events being triggered void SetNoEventsMode( bool noEvents ); bool GetNoEventsMode() const { return m_noEventsMode; } protected: // hide special menu items like exit, preferences etc - // that are expected in the app menu + // that are expected in the app menu void DoRearrange() ; - + bool DoHandleMenuEvent( wxEvent& evt ); virtual wxMenuItem* DoAppend(wxMenuItem *item); virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); @@ -87,18 +83,22 @@ private: // terminate the current radio group, if any void EndRadioGroup(); + // Common part of HandleMenu{Opened,Closed}(). + void DoHandleMenuOpenedOrClosed(wxEventType evtType); + + // if TRUE, insert a breal before appending the next item bool m_doBreak; // in this menu rearranging of menu items (esp hiding) is allowed bool m_allowRearrange; - + // don't trigger native events bool m_noEventsMode; - + // the position of the first item in the current radio group or -1 int m_startRadioGroup; - + wxMenuImpl* m_peer; DECLARE_DYNAMIC_CLASS(wxMenu) @@ -130,14 +130,11 @@ public: virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); virtual wxMenu *Remove(size_t pos); - virtual int FindMenuItem(const wxString& menuString, - const wxString& itemString) const; - virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; - virtual void EnableTop( size_t pos, bool flag ); + virtual bool IsEnabledTop(size_t pos) const; virtual void SetMenuLabel( size_t pos, const wxString& label ); virtual wxString GetMenuLabel( size_t pos ) const; - virtual bool Enable( bool enable = TRUE ); + virtual bool Enable( bool enable = true ); // for virtual function hiding virtual void Enable( int itemid, bool enable ) { @@ -145,7 +142,6 @@ public: } // implementation from now on - int FindMenu(const wxString& title); void Detach(); // returns TRUE if we're attached to a frame @@ -155,15 +151,9 @@ public: // attach to a frame void Attach(wxFrame *frame); - // clear the invoking window for all menus and submenus - void UnsetInvokingWindow() ; - - // set the invoking window for all menus and submenus - void SetInvokingWindow( wxFrame* frame ) ; - // if the menubar is modified, the display is not updated automatically, // call this function to update it (m_menuBarFrame should be !NULL) - void Refresh(bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL); + void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } @@ -178,16 +168,14 @@ public: protected: // common part of all ctors void Init(); - wxWindow *m_invokingWindow; - wxArrayString m_titles; static bool s_macAutoWindowMenu ; static WXHMENU s_macWindowMenuHandle ; private: static wxMenuBar* s_macInstalledMenuBar ; static wxMenuBar* s_macCommonMenuBar ; - + wxMenu* m_rootMenu; wxMenu* m_appleMenu;