- DECLARE_DYNAMIC_CLASS(wxMenuBar)
-
- wxMenuBar();
- wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
- ~wxMenuBar();
-
- void Append(wxMenu *menu, const wxString& title);
- // Must only be used AFTER menu has been attached to frame,
- // otherwise use individual menus to enable/disable items
- void Enable(int Id, bool Flag);
- bool Enabled(int Id) const ;
- inline bool IsEnabled(int Id) const { return Enabled(Id); };
- void EnableTop(int pos, bool Flag);
- void Check(int id, bool Flag);
- bool Checked(int id) const ;
- inline bool IsChecked(int Id) const { return Checked(Id); };
- void SetLabel(int id, const wxString& label) ;
- wxString GetLabel(int id) const ;
- void SetLabelTop(int pos, const wxString& label) ;
- wxString GetLabelTop(int pos) const ;
- virtual void Delete(wxMenu *menu, int index = 0); /* Menu not destroyed */
- virtual bool OnAppend(wxMenu *menu, const char *title);
- virtual bool OnDelete(wxMenu *menu, int index);
-
- virtual void SetHelpString(int Id, const wxString& helpString);
- virtual wxString GetHelpString(int Id) const ;
-
- virtual int FindMenuItem(const wxString& menuString, const wxString& itemString) const ;
-
- // Find wxMenuItem for item ID, and return item's
- // menu too if itemMenu is non-NULL.
- wxMenuItem *FindItemForId(int itemId, wxMenu **menuForItem = NULL) const ;
-
- inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
- inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
-
- inline int GetMenuCount() const { return m_menuCount; }
- inline wxMenu* GetMenu(int i) const { return m_menus[i]; }
-
- public:
- wxEvtHandler * m_eventHandler;
- int m_menuCount;
- wxMenu ** m_menus;
- wxString * m_titles;
- wxFrame * m_menuBarFrame;
-/* TODO: data that represents the actual menubar when created.
- */
+public:
+ //
+ // Ctors & dtor
+ //
+
+ //
+ // Default constructor
+ //
+ wxMenuBar();
+
+ //
+ // Unused under OS2
+ wxMenuBar(long lStyle);
+
+ //
+ // Menubar takes ownership of the menus arrays but copies the titles
+ //
+ wxMenuBar( int n
+ ,wxMenu* vMenus[]
+ ,const wxString sTitles[]
+ );
+ virtual ~wxMenuBar();
+
+ //
+ // Menubar construction
+ //
+ virtual bool Append( wxMenu* pMenu
+ ,const wxString& rTitle
+ );
+ virtual bool Insert( size_t nPos
+ ,wxMenu* pMenu
+ ,const wxString& rTitle
+ );
+ virtual wxMenu* Replace( size_t nPos
+ ,wxMenu* pMenu
+ ,const wxString& rTitle
+ );
+ virtual wxMenu* Remove(size_t nPos);
+ virtual int FindMenuItem( const wxString& rMenuString
+ ,const wxString& rItemString
+ ) const;
+ virtual wxMenuItem* FindItem( int nId
+ ,wxMenu** ppMenu = NULL
+ ) const;
+ virtual wxMenuItem* FindItem( int nId
+ ,ULONG hItem
+ ,wxMenu** ppMenu = NULL
+ ) const;
+ virtual void EnableTop( size_t nPos
+ ,bool bFlag
+ );
+ virtual void SetLabelTop( size_t nPos
+ ,const wxString& rLabel
+ );
+ virtual wxString GetLabelTop(size_t nPos) const;
+
+ //
+ // Compatibility: these functions are deprecated
+ //
+#if WXWIN_COMPATIBILITY
+ void SetEventHandler(wxEvtHandler* pHandler) { m_pEventHandler = pHandler; }
+ wxEvtHandler* GetEventHandler(void) { return m_pEventHandler; }
+ bool Enabled(int nId) const { return IsEnabled(nId); }
+ bool Checked(int nId) const { return IsChecked(nId); }
+#endif // WXWIN_COMPATIBILITY
+
+ //
+ // Implementation from now on
+ //
+ WXHMENU Create(void);
+ virtual void Detach(void);
+ virtual void Attach(wxFrame* pFrame);
+
+#if wxUSE_ACCEL
+ //
+ // Get the accel table for all the menus
+ //
+ const wxAcceleratorTable& GetAccelTable(void) const { return m_vAccelTable; }
+
+ //
+ // Update the accel table (must be called after adding/deletign a menu)
+ //
+ void RebuildAccelTable(void);
+#endif // wxUSE_ACCEL
+
+ //
+ // Get the menu handle
+ WXHMENU GetHMenu(void) const { return m_hMenu; }
+
+ //
+ // If the menubar is modified, the display is not updated automatically,
+ // call this function to update it (m_menuBarFrame should be !NULL)
+ //
+ void Refresh(void);
+
+protected:
+ //
+ // Common part of all ctors
+ //
+ void Init(void);
+
+#if WXWIN_COMPATIBILITY
+ wxEvtHandler* m_pEventHandler;
+#endif // WXWIN_COMPATIBILITY
+
+ wxArrayString m_titles;
+
+ WXHMENU m_hMenu;
+
+#if wxUSE_ACCEL
+ //
+ // The accelerator table for all accelerators in all our menus
+ //
+ wxAcceleratorTable m_vAccelTable;
+#endif // wxUSE_ACCEL
+
+ wxFrame* m_pMenuBarFrame;
+
+private:
+ //
+ // Virtual function hiding suppression
+ //
+ void Refresh( bool bErase
+ ,const wxRect* pRect
+ )
+ { wxWindow::Refresh(bErase, pRect); }
+
+ DECLARE_DYNAMIC_CLASS(wxMenuBar)