- 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:
+ wxMenuBar() { Init(); }
+ wxMenuBar(long WXUNUSED(style)) { Init(); }
+ wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
+ wxMenuBar(size_t n, wxMenu *menus[], const wxArrayString& titles, long style = 0);
+ virtual ~wxMenuBar();
+
+ // implement base class (pure) virtuals
+ // ------------------------------------
+
+ virtual bool Append( wxMenu *menu, const wxString &title );
+ virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
+ 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 void SetMenuLabel( size_t pos, const wxString& label );
+ virtual wxString GetMenuLabel( size_t pos ) const;
+
+ // implementation only from now on
+ // -------------------------------
+
+ wxFrame* GetMenuBarFrame() const { return m_menuBarFrame; }
+ void SetMenuBarFrame(wxFrame* frame) { m_menuBarFrame = frame; }
+ WXWidget GetMainWidget() const { return m_mainWidget; }
+ void SetMainWidget(WXWidget widget) { m_mainWidget = widget; }
+
+ // Create menubar
+ bool CreateMenuBar(wxFrame* frame);
+
+ // Destroy menubar, but keep data structures intact so we can recreate it.
+ bool DestroyMenuBar();
+
+ const wxColour& GetBackgroundColour() const { return m_backgroundColour; }
+ const wxColour& GetForegroundColour() const { return m_foregroundColour; }
+ const wxFont& GetFont() const { return m_font; }
+
+ virtual bool SetBackgroundColour(const wxColour& colour);
+ virtual bool SetForegroundColour(const wxColour& colour);
+ virtual bool SetFont(const wxFont& colour);
+ void ChangeFont(bool keepOriginalSize = false);
+
+public:
+ // common part of all ctors
+ void Init();
+
+ wxArrayString m_titles;
+ wxFrame *m_menuBarFrame;
+
+ WXWidget m_mainWidget;
+
+ wxColour m_foregroundColour;
+ wxColour m_backgroundColour;
+ wxFont m_font;
+
+ DECLARE_DYNAMIC_CLASS(wxMenuBar)