+ void SetLabel(int id, const wxString& label);
+ wxString GetLabel(int id) const;
+
+ virtual void SetHelpString(int id, const wxString& helpString);
+ virtual wxString GetHelpString(int id) const;
+
+ // misc accessors
+ // --------------
+
+ // the title
+ virtual void SetTitle(const wxString& title) { m_title = title; }
+ const wxString GetTitle() const { return m_title; }
+
+ // client data
+ void SetClientData(void* clientData) { m_clientData = clientData; }
+ void* GetClientData() const { return m_clientData; }
+
+ // event handler
+ void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
+ wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
+
+ // invoking window
+ void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; }
+ wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
+
+ // style
+ long GetStyle() const { return m_style; }
+
+ // implementation helpers
+ // ----------------------
+
+ // Updates the UI for a menu and all submenus recursively. source is the
+ // object that has the update event handlers defined for it. If NULL, the
+ // menu or associated window will be used.
+ void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
+
+ // is the menu attached to a menu bar (or is it a popup one)?
+ bool IsAttached() const { return m_menuBar != NULL; }
+
+ // set/get the parent of this menu
+ void SetParent(wxMenu *parent) { m_menuParent = parent; }
+ wxMenu *GetParent() const { return m_menuParent; }
+
+#if WXWIN_COMPATIBILITY
+ // compatibility: these functions are deprecated, use the new ones instead
+ bool Enabled(int id) const { return IsEnabled(id); }
+ bool Checked(int id) const { return IsChecked(id); }
+
+ wxMenuItem* FindItemForId(int itemId, wxMenu **itemMenu) const
+ { return FindItem(itemId, itemMenu); }
+
+ wxList& GetItems() const { return (wxList &)m_items; }
+#endif // WXWIN_COMPATIBILITY
+
+#if wxUSE_MENU_CALLBACK
+ // wxWin 1.6x compatible menu event handling
+ wxFunction GetCallback() const { return m_callback; }
+ void Callback(const wxFunction func) { m_callback = func; }
+
+ wxFunction m_callback;
+#endif // wxUSE_MENU_CALLBACK
+
+ // unlike FindItem(), this function doesn't recurse but only looks through
+ // our direct children and also may return the index of the found child if
+ // pos != NULL
+ wxMenuItem *FindChildItem(int id, size_t *pos = NULL) const;
+
+protected:
+ // virtuals to override in derived classes
+ // ---------------------------------------
+
+ virtual bool DoAppend(wxMenuItem *item);
+ virtual bool DoInsert(size_t pos, wxMenuItem *item);
+
+ virtual wxMenuItem *DoRemove(wxMenuItem *item);
+ virtual bool DoDelete(wxMenuItem *item);
+ virtual bool DoDestroy(wxMenuItem *item);
+
+ // helpers
+ // -------
+
+ // common part of all ctors
+ void Init(long style);
+
+protected:
+ wxMenuBar *m_menuBar; // menubar we belong to or NULL
+ wxMenu *m_menuParent; // parent menu or NULL
+
+ wxString m_title; // the menu title or label
+ wxMenuItemList m_items; // the list of menu items
+
+ wxWindow *m_invokingWindow; // for popup menus
+ void *m_clientData; // associated with the menu
+
+ long m_style; // combination of wxMENU_XXX flags
+
+ wxEvtHandler *m_eventHandler; // a pluggable in event handler
+};