]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tbar95.cpp
avoid flicker when setting the text which is the same as the current status bar pane...
[wxWidgets.git] / src / msw / tbar95.cpp
index 64a3802e260ea5492881730cc2b425b450ef07f0..6b10c338c67718dd8fe7d612230d922d46728acf 100644 (file)
@@ -680,8 +680,8 @@ bool wxToolBar::Realize()
                         // no disabled bitmap specified but we still need to
                         // fill the space in the image list with something, so
                         // we grey out the normal bitmap
-                        wxImage imgGreyed;
-                        wxCreateGreyedImage(bmp.ConvertToImage(), imgGreyed);
+                        wxImage
+                          imgGreyed = bmp.ConvertToImage().ConvertToGreyscale();
 
 #ifdef wxREMAP_BUTTON_COLOURS
                         if ( remapValue == Remap_Buttons )
@@ -1071,9 +1071,9 @@ bool wxToolBar::Realize()
     }
     else if ( m_nButtons > 0 ) // vertical non empty toolbar
     {
-        if ( m_maxRows == 0 )
-            // if not set yet, have one column
-            SetRows(m_nButtons);
+        // if not set yet, have one column
+        m_maxRows = 1;
+        SetRows(m_nButtons);
     }
 
     InvalidateBestSize();
@@ -1331,6 +1331,30 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog
     wxFAIL_MSG( _T("not implemented") );
 }
 
+void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
+{
+    wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
+    if ( tool )
+    {
+        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+        tool->SetNormalBitmap(bitmap);
+        Realize();
+    }
+}
+
+void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
+{
+    wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id));
+    if ( tool )
+    {
+        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+        tool->SetDisabledBitmap(bitmap);
+        Realize();
+    }
+}
+
 // ----------------------------------------------------------------------------
 // event handlers
 // ----------------------------------------------------------------------------