X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9a0ceca5b549414a6119e98bc6d868c071a8b1b..9e50ed28d99a07bff5f63c9f7952c3ae6be6cab0:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 071dac26d3..0e6d905ab3 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -62,6 +62,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject) wxToolBarToolBase::~wxToolBarToolBase() { delete m_dropdownMenu; + if ( IsControl() ) + GetControl()->Destroy(); } @@ -125,6 +127,7 @@ void wxToolBarToolBase::SetDropdownMenu(wxMenu* menu) m_dropdownMenu = menu; } + // ---------------------------------------------------------------------------- // wxToolBarBase adding/deleting items // ---------------------------------------------------------------------------- @@ -207,6 +210,7 @@ wxToolBarBase::InsertTool(size_t pos, wxToolBarToolBase *tool) } m_tools.Insert(pos, tool); + tool->Attach(this); return tool; } @@ -313,17 +317,19 @@ wxToolBarToolBase *wxToolBarBase::RemoveTool(int id) { // don't give any error messages - sometimes we might call RemoveTool() // without knowing whether the tool is or not in the toolbar - return (wxToolBarToolBase *)NULL; + return NULL; } wxToolBarToolBase *tool = node->GetData(); + wxCHECK_MSG( tool, NULL, "NULL tool in the tools list?" ); + if ( !DoDeleteTool(pos, tool) ) - { - return (wxToolBarToolBase *)NULL; - } + return NULL; m_tools.Erase(node); + tool->Detach(); + return tool; } @@ -596,6 +602,12 @@ void wxToolBarBase::SetRows(int WXUNUSED(nRows)) // nothing } +bool wxToolBarBase::IsVertical() const +{ + return HasFlag(wxTB_LEFT | wxTB_RIGHT); +} + + // ---------------------------------------------------------------------------- // event processing // ----------------------------------------------------------------------------