added Add/InsertTool() (patch 672032)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-01-27 01:13:35 +00:00
parent fccacb2a9d
commit dd91da4ed1
4 changed files with 36 additions and 6 deletions

View File

@@ -164,13 +164,32 @@ wxToolBarToolBase *wxToolBarBase::InsertTool(size_t pos,
wxToolBarToolBase *tool = CreateTool(id, label, bitmap, bmpDisabled, kind,
clientData, shortHelp, longHelp);
if ( !tool || !DoInsertTool(pos, tool) )
if ( !InsertTool(pos, tool) )
{
delete tool;
return NULL;
}
return tool;
}
wxToolBarToolBase *wxToolBarBase::AddTool(wxToolBarToolBase *tool)
{
return InsertTool(GetToolsCount(), tool);
}
wxToolBarToolBase *
wxToolBarBase::InsertTool(size_t pos, wxToolBarToolBase *tool)
{
wxCHECK_MSG( pos <= GetToolsCount(), (wxToolBarToolBase *)NULL,
_T("invalid position in wxToolBar::InsertTool()") );
if ( !tool || !DoInsertTool(pos, tool) )
{
return NULL;
}
m_tools.Insert(pos, tool);
return tool;
@@ -194,15 +213,13 @@ wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control)
wxToolBarToolBase *tool = CreateTool(control);
if ( !tool || !DoInsertTool(pos, tool) )
if ( !InsertTool(pos, tool) )
{
delete tool;
return NULL;
}
m_tools.Insert(pos, tool);
return tool;
}
@@ -213,7 +230,7 @@ wxControl *wxToolBarBase::FindControl( int id )
node = node->GetNext() )
{
wxControl *control = node->GetData()->GetControl();
if (control)
{
if (control->GetId() == id)