]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
construct brush used for painting disabled bitmap buttons dynamically (heavily modifi...
[wxWidgets.git] / src / common / tbarbase.cpp
index f2310dc1a912e1e92dfdf62172f7ae7efd2beeac..2496b8a9749f95617a530d51c375fd42025ffa78 100644 (file)
@@ -41,7 +41,7 @@
 #include "wx/toolbar.h"
 
 // ----------------------------------------------------------------------------
-// wxWindows macros
+// wxWidgets macros
 // ----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
@@ -141,6 +141,7 @@ wxToolBarToolBase *wxToolBarBase::DoAddTool(int id,
                                             wxCoord WXUNUSED(xPos),
                                             wxCoord WXUNUSED(yPos))
 {
+    InvalidateBestSize();
     return InsertTool(GetToolsCount(), id, label, bitmap, bmpDisabled,
                       kind, shortHelp, longHelp, clientData);
 }
@@ -621,6 +622,12 @@ void wxToolBarBase::UpdateWindowUI(long flags)
 {
     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();