]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/ColourDB.py
Bitmap updates
[wxWidgets.git] / wxPython / demo / ColourDB.py
index 1f0978818dc64aa955097c995758abc38006d794..8e00407dba60196db5cca2dfaecf4b137762c8d1 100644 (file)
@@ -17,6 +17,7 @@ class TestWindow(wxScrolledWindow):
         wxScrolledWindow.__init__(self, parent, -1)
 
         self.clrList = colourdb.getColourList()
+        #self.clrList.sort()
         self.bg_bmp = images.getGridBGBitmap()
 
         EVT_PAINT(self, self.OnPaint)
@@ -60,6 +61,8 @@ class TestWindow(wxScrolledWindow):
         dc = evt.GetDC()
         if not dc:
             dc = wxClientDC(self)
+            rect = self.GetUpdateRegion().GetBox()
+            dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height)
         self.TileBackground(dc)
 
 
@@ -86,7 +89,7 @@ class TestWindow(wxScrolledWindow):
             stop = pixStop / self.lineHeight
         else:
             start = 0
-            stop = len(numColours)
+            stop = numColours
 
         for line in range(max(0,start), min(stop,numColours)):
             clr = colours[line]
@@ -100,12 +103,24 @@ class TestWindow(wxScrolledWindow):
         dc.EndDrawing()
 
 
+# On wxGTK there needs to be a panel under wxScrolledWindows if they are
+# going to be in a wxNotebook...
+class TestPanel(wxPanel):
+    def __init__(self, parent):
+        wxPanel.__init__(self, parent, -1)
+        self.win = TestWindow(self)
+        EVT_SIZE(self, self.OnSize)
+
+    def OnSize(self, evt):
+        self.win.SetSize(evt.GetSize())
+
+
 
 #----------------------------------------------------------------------
 
 
 def runTest(frame, nb, log):
-    win = TestWindow(nb)
+    win = TestPanel(nb)
     return win
 
 #----------------------------------------------------------------------