Merge pull request #1759 from Metallicow/AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR

Add agw.aui.AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR theming
This commit is contained in:
Robin Dunn
2020-10-08 20:59:36 -07:00
committed by GitHub
4 changed files with 33 additions and 12 deletions

View File

@@ -58,6 +58,9 @@ New and improved in this release:
* Simplified the implementation of the wx.App.InitLocale method. See the
MigrationGuide for more information.
* Added wx.lib.agw.aui.AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR constant
so the hint window border color can be themed as well.

View File

@@ -345,6 +345,8 @@ AUI_DOCKART_DRAW_SASH_GRIP = 18
""" Draw a sash grip on the sash. """
AUI_DOCKART_HINT_WINDOW_COLOUR = 19
""" Customizes the hint window background colour (currently light blue). """
AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR = 20
""" Customizes the hint window border background colour (currently grey). """
# Caption Gradient Type
AUI_GRADIENT_NONE = 0
@@ -2576,6 +2578,7 @@ colourIconDockingPart2 = wx.Colour(180, 201, 225)
colourIconShadow = wx.Colour(198, 198, 198)
colourIconArrow = wx.Colour(77, 79, 170)
colourHintBackground = wx.Colour(0, 64, 255)
colourHintBorder = wx.Colour(60, 60, 60)
guideSizeX, guideSizeY = 29, 32
aeroguideSizeX, aeroguideSizeY = 31, 32
whidbeySizeX, whidbeySizeY = 43, 30

View File

@@ -90,6 +90,7 @@ class AuiDefaultDockArt(object):
``AUI_DOCKART_GRADIENT_TYPE`` Customizes the gradient type (no gradient, vertical or horizontal)
``AUI_DOCKART_DRAW_SASH_GRIP`` Draw a sash grip on the sash
``AUI_DOCKART_HINT_WINDOW_COLOUR`` Customizes the hint window background colour (currently light blue)
``AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR`` Customizes the hint window border background colour (currently grey)
================================================ ======================================
@@ -241,6 +242,7 @@ class AuiDefaultDockArt(object):
self._gripper_pen3 = wx.WHITE_PEN
self._hint_background_colour = colourHintBackground
self._hint_border_colour = colourHintBorder
def GetMetric(self, id):
@@ -326,6 +328,8 @@ class AuiDefaultDockArt(object):
return self._gripper_brush.GetColour()
elif id == AUI_DOCKART_HINT_WINDOW_COLOUR:
return self._hint_background_colour
elif id == AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR:
return self._hint_border_colour
else:
raise Exception("Invalid Colour Ordinal.")
@@ -377,6 +381,8 @@ class AuiDefaultDockArt(object):
self._gripper_pen2.SetColour(StepColour(colour, 60))
elif id == AUI_DOCKART_HINT_WINDOW_COLOUR:
self._hint_background_colour = colour
elif id == AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR:
self._hint_border_colour = colour
else:
raise Exception("Invalid Colour Ordinal.")

View File

@@ -2728,6 +2728,8 @@ class AuiDockingHintWindow(wx.Frame):
self._art = parent.GetEventHandler().GetArtProvider()
background = self._art.GetColour(AUI_DOCKART_HINT_WINDOW_COLOUR)
self.SetBackgroundColour(background)
border = self._art.GetColour(AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR)
self._border_pen = wx.Pen(border, 5)
# Can't set background colour on a frame on wxMac
# so add a panel to set the colour on.
@@ -2750,17 +2752,22 @@ class AuiDockingHintWindow(wx.Frame):
"""
amount = 128
size = self.GetClientSize()
region = wx.Region(0, 0, size.x, 1)
size_x, size_y = self.GetClientSize()
region = wx.Region(0, 0, size_x, 1)
for y in range(size.y):
# Reverse the order of the bottom 4 bits
j = (y & 8 and [1] or [0])[0] | (y & 4 and [2] or [0])[0] | \
(y & 2 and [4] or [0])[0] | (y & 1 and [8] or [0])[0]
if 16*j+8 < amount:
region.Union(0, y, size.x, 1)
## for y in range(size_y):
##
## # Reverse the order of the bottom 4 bits
## j = (y & 8 and [1] or [0])[0] | (y & 4 and [2] or [0])[0] | \
## (y & 2 and [4] or [0])[0] | (y & 1 and [8] or [0])[0]
##
## if 16*j+8 < amount:
## region.Union(0, y, size_x, 1)
region_Union = region.Union # local opt
[region_Union(0, y, size_x, 1) for y in range(size_y)
if 16 * ((y & 8 and [1] or [0])[0] | (y & 4 and [2] or [0])[0] |
(y & 2 and [4] or [0])[0] | (y & 1 and [8] or [0])[0])
+ 8 < amount]
self.SetShape(region)
@@ -2814,6 +2821,8 @@ class AuiDockingHintWindow(wx.Frame):
"""
background = self._art.GetColour(AUI_DOCKART_HINT_WINDOW_COLOUR)
border = self._art.GetColour(AUI_DOCKART_HINT_WINDOW_BORDER_COLOUR)
self._border_pen = wx.Pen(border, 5)
if wx.Platform == '__WXMAC__':
self.panel.SetBackgroundColour(background)
@@ -2848,13 +2857,13 @@ class AuiDockingHintWindow(wx.Frame):
:param `event`: an instance of :class:`PaintEvent` to be processed.
"""
rect = wx.Rect(wx.Point(0, 0), self.GetSize())
rect = wx.Rect((0, 0), self.GetSize())
dc = wx.PaintDC(self)
event.Skip()
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetPen(wx.Pen(wx.Colour(60, 60, 60), 5))
dc.SetPen(self._border_pen)
rect.Deflate(1, 1)
dc.DrawRectangle(rect)