#include "wx/toolbar.h"
// ----------------------------------------------------------------------------
-// wxWindows macros
+// wxWidgets macros
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
// wxToolBarToolBase
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject)
bool wxToolBarToolBase::Enable(bool enable)
{
wxCoord WXUNUSED(xPos),
wxCoord WXUNUSED(yPos))
{
+ InvalidateBestSize();
return InsertTool(GetToolsCount(), id, label, bitmap, bmpDisabled,
kind, shortHelp, longHelp, clientData);
}
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
break;
- tool->Toggle(false);
+ if ( tool->Toggle(false) )
+ {
+ DoToggleTool(tool, false);
+ }
nodeNext = nodeNext->GetNext();
}
if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO )
break;
- tool->Toggle(false);
+ if ( tool->Toggle(false) )
+ {
+ DoToggleTool(tool, false);
+ }
nodePrev = nodePrev->GetPrevious();
}
}
// Called when the mouse cursor enters a tool bitmap (no button pressed).
-// Argument is -1 if mouse is exiting the toolbar.
+// Argument is wxID_ANY if mouse is exiting the toolbar.
// Note that for this event, the id of the window is used,
// and the integer parameter of wxCommandEvent is used to retrieve
// the tool id.
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if( frame )
{
- wxToolBarToolBase* tool = id == -1 ? (wxToolBarToolBase*)0 : FindById(id);
+ wxToolBarToolBase* tool = id == wxID_ANY ? (wxToolBarToolBase*)0 : FindById(id);
wxString help = tool ? tool->GetLongHelp() : wxString();
- frame->DoGiveHelp( help, id != -1 );
+ frame->DoGiveHelp( help, id != wxID_ANY );
}
(void)GetEventHandler()->ProcessEvent(event);
{
wxWindowBase::UpdateWindowUI(flags);
+ // There is no sense in updating the toolbar UI
+ // if the parent window is about to get destroyed
+ wxWindow *tlw = wxGetTopLevelParent( this );
+ if (tlw && wxPendingDelete.Member( tlw ))
+ return;
+
wxEvtHandler* evtHandler = GetEventHandler() ;
for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();