AquaButton: apply patch from Werner to allow the definition of a disabled colour.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Andrea Gavana
2012-12-03 21:16:07 +00:00
parent b117617572
commit 6d0ef23bee
2 changed files with 64 additions and 5 deletions

View File

@@ -120,7 +120,7 @@ andrea.gavana@maerskoil.com
AGW version: 0.9.7
Last updated: 31 October 2012, 21.00 GMT
Last updated: 03 December 2012, 21.00 GMT
"""

View File

@@ -2,7 +2,7 @@
# AQUABUTTON wxPython IMPLEMENTATION
#
# Andrea Gavana, @ 07 October 2008
# Latest Revision: 24 Nov 2011, 22.00 GMT
# Latest Revision: 03 Dec 2012, 21.00 GMT
#
#
# TODO List
@@ -100,7 +100,7 @@ License And Version
:class:`AquaButton` control is distributed under the wxPython license.
Latest Revision: Andrea Gavana @ 22 Nov 2011, 22.00 GMT
Latest Revision: Andrea Gavana @ 03 Dec 2012, 21.00 GMT
Version 0.4
@@ -216,11 +216,15 @@ class AquaButton(wx.PyControl):
self._hoverColour = self.LightColour(self._backColour, 30)
self._disableColour = self.LightColour(self._backColour, 70)
self._textColour = wx.BLACK
self._shadowColour = wx.Colour("grey")
self._rectColour = self.GetParent().GetBackgroundColour()
else:
self._backColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVECAPTION)
self._hoverColour = self.LightColour(self._backColour, 30)
self._disableColour = self.LightColour(self._backColour, 70)
self._textColour = wx.WHITE
self._shadowColour = wx.Colour("grey")
self._rectColour = self.GetParent().GetBackgroundColour()
def SetBitmapLabel(self, bitmap):
@@ -273,7 +277,7 @@ class AquaButton(wx.PyControl):
xpos, ypos, width, height = self.GetClientRect()
dc.SetBackground(wx.Brush(self.GetParent().GetBackgroundColour()))
dc.SetBackground(wx.Brush(self._rectColour))
dc.Clear()
gc.SetBrush(wx.WHITE_BRUSH)
@@ -302,7 +306,7 @@ class AquaButton(wx.PyControl):
path2 = self.GetPath(gc, rc2, 10)
br2 = gc.CreateRadialGradientBrush(rc2.x, rc2.y,
rc2.x+rc2.width, rc2.y+rc2.height,
rc2.width, wx.NamedColour("grey"), wx.WHITE)
rc2.width, self._shadowColour, wx.WHITE)
# Create top water colour to give "aqua" effect
rc3 = wx.Rect(*rc1)
@@ -734,11 +738,66 @@ class AquaButton(wx.PyControl):
return self._disableColour
def SetShadowColour(self, colour):
"""
Sets the button shadow colour.
:param `colour`: a valid :class:`Colour` object.
.. versionadded:: 0.9.7
"""
self._shadowColour = colour
self.Invalidate()
def GetShadowColour(self):
"""
Returns the button shadow colour.
:return: An instance of :class:`Colour`.
.. versionadded:: 0.9.7
"""
return self._shadowColour
def SetRectColour(self, colour):
"""
Sets the button rectangular background colour.
:param `colour`: a valid :class:`Colour` object.
.. versionadded:: 0.9.7
"""
self._rectColour = colour
self.Invalidate()
def GetRectColour(self):
"""
Returns the button rectangular background colour.
:return: An instance of :class:`Colour`.
.. versionadded:: 0.9.7
"""
return self._rectColour
SetBackgroundColor = SetBackgroundColour
SetHoverColor = SetHoverColour
GetHoverColor = GetHoverColour
SetDisabledColor = SetDisabledColour
GetDisabledColor = GetDisabledColour
SetShadowColor = SetShadowColour
GetShadowColor = SetShadowColour
SetRectColor = SetRectColour
GetRectColor = SetRectColour
def SetForegroundColour(self, colour):