added support for drop down toolbar buttons (patch 1713470)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-11 23:35:49 +00:00
parent 884898a79a
commit a9a0ceca5b
8 changed files with 133 additions and 5 deletions

View File

@@ -71,7 +71,8 @@ public:
const wxString& longHelpString = wxEmptyString)
: m_label(label),
m_shortHelpString(shortHelpString),
m_longHelpString(longHelpString)
m_longHelpString(longHelpString),
m_dropdownMenu(NULL)
{
m_tbar = tbar;
m_id = toolid;
@@ -106,9 +107,11 @@ public:
m_toggled = false;
m_toolStyle = wxTOOL_STYLE_CONTROL;
m_dropdownMenu = 0;
}
virtual ~wxToolBarToolBase(){}
virtual ~wxToolBarToolBase();
// accessors
// ---------
@@ -197,6 +200,11 @@ public:
virtual void Detach() { m_tbar = (wxToolBarBase *)NULL; }
virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; }
// these methods are only for tools of wxITEM_DROPDOWN kind (but even such
// tools can have a NULL associated menu)
void SetDropdownMenu(wxMenu *menu);
wxMenu *GetDropdownMenu() const { return m_dropdownMenu; }
protected:
wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL)
@@ -227,6 +235,8 @@ protected:
wxString m_shortHelpString;
wxString m_longHelpString;
wxMenu *m_dropdownMenu;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase)
};
@@ -525,6 +535,9 @@ public:
// don't want toolbars to accept the focus
virtual bool AcceptsFocus() const { return false; }
// Set dropdown menu
bool SetDropdownMenu(int toolid, wxMenu *menu);
protected:
// to implement in derived classes
// -------------------------------