X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e425133fbdde2e2663e443bcaadf4a35914d845..0b7e6e7da208b6a95fb23cb50286a09dc90d96d2:/utils/wxPython/lib/buttons.py?ds=sidebyside diff --git a/utils/wxPython/lib/buttons.py b/utils/wxPython/lib/buttons.py index 9c4a79110a..7d63710314 100644 --- a/utils/wxPython/lib/buttons.py +++ b/utils/wxPython/lib/buttons.py @@ -232,6 +232,7 @@ class wxGenButton(wxControl): if self.hasFocus and self.useFocusInd: self.DrawFocusIndicator(dc, width, height) + def OnEraseBackground(self, event): pass @@ -293,6 +294,7 @@ class wxGenButton(wxControl): self.Refresh() event.Skip() + def OnKeyUp(self, event): if self.hasFocus and event.KeyCode() == ord(" "): self.up = true @@ -361,7 +363,8 @@ class wxGenBitmapButton(wxGenButton): bw,bh = bmp.GetWidth(), bmp.GetHeight() if not self.up: dw = dy = 1 - dc.DrawBitmap(bmp, (width-bw)/2+dw, (height-bh)/2+dy, true) + hasMask = bmp.GetMask() != None + dc.DrawBitmap(bmp, (width-bw)/2+dw, (height-bh)/2+dy, hasMask) @@ -378,6 +381,7 @@ class __ToggleMixin: def OnLeftDown(self, event): if not self.IsEnabled(): return + self.saveUp = self.up self.up = not self.up self.CaptureMouse() self.SetFocus() @@ -386,7 +390,8 @@ class __ToggleMixin: def OnLeftUp(self, event): if not self.IsEnabled(): return - self.Notify() + if self.up != self.saveUp: + self.Notify() self.ReleaseMouse() self.Refresh()