]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toolbar.cpp
Add new clipboard api and support for it in the ie backend. Also extend the sample...
[wxWidgets.git] / src / msw / toolbar.cpp
index e0a51a13c004b739ebccc8c8e2d4b69ade9df815..7e17a1828d393d32284fd87339e59ab5b5e57b58 100644 (file)
@@ -405,11 +405,7 @@ void wxToolBar::Recreate()
         m_hBitmap = 0;
     }
 
-    if ( m_disabledImgList )
-    {
-        delete m_disabledImgList;
-        m_disabledImgList = NULL;
-    }
+    wxDELETE(m_disabledImgList);
 
     Realize();
 }
@@ -610,11 +606,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
 
 void wxToolBar::CreateDisabledImageList()
 {
-    if (m_disabledImgList != NULL)
-    {
-        delete m_disabledImgList;
-        m_disabledImgList = NULL;
-    }
+    wxDELETE(m_disabledImgList);
 
     // as we can't use disabled image list with older versions of comctl32.dll,
     // don't even bother creating it
@@ -628,10 +620,11 @@ void wxToolBar::CreateDisabledImageList()
             wxBitmap bmpDisabled = tool->GetDisabledBitmap();
             if ( bmpDisabled.Ok() )
             {
+                const wxSize sizeBitmap = bmpDisabled.GetSize();
                 m_disabledImgList = new wxImageList
                                         (
-                                            m_defaultWidth,
-                                            m_defaultHeight,
+                                            sizeBitmap.x,
+                                            sizeBitmap.y,
                                             bmpDisabled.GetMask() != NULL,
                                             GetToolsCount()
                                         );
@@ -1303,7 +1296,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
     // Without the two lines of code below, if the toolbar was repainted during
     // OnLeftClick(), then it could end up without the tool bitmap temporarily
     // (see http://lists.nongnu.org/archive/html/lmi/2008-10/msg00014.html).
-    // The Update() call bellow ensures that this won't happen, by repainting
+    // The Update() call below ensures that this won't happen, by repainting
     // invalidated areas of the toolbar immediately.
     //
     // To complicate matters, the tool would be drawn in depressed state (this
@@ -1330,7 +1323,7 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
     ::SendMessage(GetHwnd(), TB_SETSTATE, id, MAKELONG(state, 0));
 
     // OnLeftClick() can veto the button state change - for buttons which
-    // may be toggled only, of couse
+    // may be toggled only, of course.
     if ( !allowLeftClick && tool->CanBeToggled() )
     {
         // revert back
@@ -1729,10 +1722,18 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
             {
                 // for some reason TB_GETITEMRECT returns a rectangle 1 pixel
                 // shorter than the full window size (at least under Windows 7)
-                // but we need to erase the full height below
+                // but we need to erase the full width/height below
                 RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex);
-                rcItem.top = 0;
-                rcItem.bottom = rectTotal.height;
+                if ( IsVertical() )
+                {
+                    rcItem.left = 0;
+                    rcItem.right = rectTotal.width;
+                }
+                else
+                {
+                    rcItem.top = 0;
+                    rcItem.bottom = rectTotal.height;
+                }
 
                 rgnDummySeps.Union(wxRectFromRECT(rcItem));
             }