]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toolbar.cpp
Test using wxString::ToCDouble() in wxAny.
[wxWidgets.git] / src / msw / toolbar.cpp
index 697b9c6c8d67fe8cfbd631109656f58be0287a84..1011c5d3e271528a21dc3e723b260ddfbad4af3d 100644 (file)
@@ -985,7 +985,7 @@ bool wxToolBar::Realize()
                 {
                     const wxString& label = tool->GetLabel();
                     if ( !label.empty() )
-                        button.iString = (INT_PTR)label.wx_str();
+                        button.iString = (INT_PTR) wxMSW_CONV_LPCTSTR(label);
                 }
 
                 button.idCommand = tool->GetId();
@@ -1053,6 +1053,14 @@ bool wxToolBar::Realize()
                         break;
                 }
 
+                // Instead of using fixed widths for all buttons, size them
+                // automatically according to the size of their bitmap and text
+                // label, if present. This particularly matters for toolbars
+                // with the wxTB_HORZ_LAYOUT style: they look hideously ugly
+                // without autosizing when the labels have even slightly
+                // different lengths.
+                button.fsStyle |= TBSTYLE_AUTOSIZE;
+
                 bitmapId++;
                 break;
         }
@@ -1383,7 +1391,7 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl),
     {
         LPNMTOOLBAR tbhdr = (LPNMTOOLBAR)lParam;
 
-        wxCommandEvent evt(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, tbhdr->iItem);
+        wxCommandEvent evt(wxEVT_TOOL_DROPDOWN, tbhdr->iItem);
         if ( HandleWindowEvent(evt) )
         {
             // Event got handled, don't display default popup menu
@@ -1687,7 +1695,9 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event)
 // toolbar icons with comctl32.dll < 6.0.
 void wxToolBar::OnEraseBackground(wxEraseEvent& event)
 {
+#ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK
     MSWDoEraseBackground(event.GetDC()->GetHDC());
+#endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK
 }
 
 bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)