// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/toolbar.h"
-
#if wxUSE_TOOLBAR_NATIVE
+#include "wx/toolbar.h"
+
#ifndef WX_PRECOMP
#include "wx/frame.h"
#endif
Init();
}
- wxToolBarTool(wxToolBar *tbar, wxControl *control)
- : wxToolBarToolBase(tbar, control)
+ wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
+ : wxToolBarToolBase(tbar, control, label)
{
Init();
}
clientData, shortHelpString, longHelpString);
}
-wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
+wxToolBarToolBase *
+wxToolBar::CreateTool(wxControl *control, const wxString& label)
{
- return new wxToolBarTool(this, control);
+ return new wxToolBarTool(this, control, label);
}
//-----------------------------------------------------------------------------
return false;
}
+ FixupStyle();
+
GtkOrientation orient;
GtkToolbarStyle gtkStyle;
GetGtkStyle(style, &orient, >kStyle);
return true;
}
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
switch ( tool->GetStyle() )
{
case wxTOOL_STYLE_CONTROL:
- tool->GetControl()->Destroy();
+ // don't destroy the control here as we can be called from
+ // RemoveTool() and then we need to keep the control alive;
+ // while if we're called from DeleteTool() the control will
+ // be destroyed when wxToolBarToolBase itself is deleted
break;
case wxTOOL_STYLE_BUTTON:
gtk_widget_destroy( tool->m_item );
break;
+
+ default:
+ wxFAIL_MSG( "unknown tool style" );
+ return false;
}
InvalidateBestSize();