]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toolbar.cpp
more wxSocket code wx-ification: use wxDynamicLibrary instead of raw Win32 calls
[wxWidgets.git] / src / msw / toolbar.cpp
index bc29e616991529f9d1b594abcd3bfca6f52239a0..63994652231284c368143c9f648f0f097c898cf4 100644 (file)
@@ -1250,7 +1250,16 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
 
     bool allowLeftClick = OnLeftClick(id, toggled);
 
-    // restore the unpressed state
+    // Restore the unpressed state. Enabled/toggled state might have been
+    // changed since so take care of it.
+    if (tool->IsEnabled())
+        state |= TBSTATE_ENABLED;
+    else
+        state &= ~TBSTATE_ENABLED;
+    if (tool->IsToggled())
+        state |= TBSTATE_CHECKED;
+    else
+        state &= ~TBSTATE_CHECKED;
     ::SendMessage(GetHwnd(), TB_SETSTATE, id, MAKELONG(state, 0));
 
     // OnLeftClick() can veto the button state change - for buttons which