Fixes so bg colors in a notebook on XP are visible again
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,7 +64,6 @@ class TestPanel(wx.Panel):
|
|||||||
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wx.ALIGN_CENTER)
|
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wx.ALIGN_CENTER)
|
||||||
sizer.Add((0,0),1)
|
sizer.Add((0,0),1)
|
||||||
|
|
||||||
buttonPanel.SetAutoLayout(1)
|
|
||||||
buttonPanel.SetSizer(sizer)
|
buttonPanel.SetSizer(sizer)
|
||||||
sizer.Fit(buttonPanel)
|
sizer.Fit(buttonPanel)
|
||||||
|
|
||||||
@@ -77,12 +76,11 @@ class TestPanel(wx.Panel):
|
|||||||
sizer.Add(title3, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, 16)
|
sizer.Add(title3, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, 16)
|
||||||
sizer.Add(message2, 0, wx.ALIGN_CENTER | wx.ALL, 6)
|
sizer.Add(message2, 0, wx.ALIGN_CENTER | wx.ALL, 6)
|
||||||
sizer.Add(targetPanel, 2, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
|
sizer.Add(targetPanel, 2, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
|
||||||
self.SetAutoLayout(1)
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Tile(wx.Panel):
|
class Tile(wx.Window):
|
||||||
"""
|
"""
|
||||||
This outer class is responsible for changing
|
This outer class is responsible for changing
|
||||||
its border color in response to certain mouse
|
its border color in response to certain mouse
|
||||||
@@ -93,14 +91,14 @@ class Tile(wx.Panel):
|
|||||||
hover = wx.Colour(210,220,210)
|
hover = wx.Colour(210,220,210)
|
||||||
|
|
||||||
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3):
|
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3):
|
||||||
wx.Panel.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
|
wx.Window.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
|
||||||
self.tile = InnerTile(self, log, factor, thingToWatch, bgColor)
|
self.tile = InnerTile(self, log, factor, thingToWatch, bgColor)
|
||||||
self.log = log
|
self.log = log
|
||||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
sizer.Add(self.tile, 1, wx.EXPAND | wx.ALL, borderWidth)
|
sizer.Add(self.tile, 1, wx.EXPAND | wx.ALL, borderWidth)
|
||||||
self.SetAutoLayout(1)
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
em.eventManager.Register(self.doLayout, wx.EVT_SIZE, self)
|
||||||
self.SetBackgroundColour(Tile.normal)
|
self.SetBackgroundColour(Tile.normal)
|
||||||
if active:
|
if active:
|
||||||
# Register myself for mouse events over self.tile in order to
|
# Register myself for mouse events over self.tile in order to
|
||||||
@@ -111,6 +109,10 @@ class Tile(wx.Panel):
|
|||||||
em.eventManager.Register(self.setHover, wx.EVT_LEFT_UP, self.tile)
|
em.eventManager.Register(self.setHover, wx.EVT_LEFT_UP, self.tile)
|
||||||
|
|
||||||
|
|
||||||
|
def doLayout(self, event):
|
||||||
|
self.Layout()
|
||||||
|
|
||||||
|
|
||||||
def setHover(self, event):
|
def setHover(self, event):
|
||||||
self.SetBackgroundColour(Tile.hover)
|
self.SetBackgroundColour(Tile.hover)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
@@ -127,7 +129,7 @@ class Tile(wx.Panel):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class InnerTile(wx.Panel):
|
class InnerTile(wx.Window):
|
||||||
IDLE_COLOR = wx.Colour( 80, 10, 10)
|
IDLE_COLOR = wx.Colour( 80, 10, 10)
|
||||||
START_COLOR = wx.Colour(200, 70, 50)
|
START_COLOR = wx.Colour(200, 70, 50)
|
||||||
FINAL_COLOR = wx.Colour( 20, 80,240)
|
FINAL_COLOR = wx.Colour( 20, 80,240)
|
||||||
@@ -141,7 +143,7 @@ class InnerTile(wx.Panel):
|
|||||||
events over the 'thingToWatch'.
|
events over the 'thingToWatch'.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
|
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
|
||||||
wx.Panel.__init__(self, parent, -1)
|
wx.Window.__init__(self, parent, -1)
|
||||||
self.log=log
|
self.log=log
|
||||||
if bgColor:
|
if bgColor:
|
||||||
self.SetBackgroundColour(bgColor)
|
self.SetBackgroundColour(bgColor)
|
||||||
|
Reference in New Issue
Block a user