- // 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.
- */
+class wxMenuBar : public wxMenuBarBase
+{
+public:
+ wxMenuBar() { Init(); }
+ wxMenuBar(long WXUNUSED(style)) { Init(); }
+ wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
+ wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles);
+ 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 SetLabelTop( size_t pos, const wxString& label );
+ virtual wxString GetLabelTop( 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)