]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/demo/wxScrolledWindow.py
fixed bug in PS clipping (non-virtual SetClippingRegion was overloaded)
[wxWidgets.git] / utils / wxPython / demo / wxScrolledWindow.py
index 7012e38f9a9f3b9dad4b9cea94f509b7220769b7..936e48ef436a361edfdd427549d97128110aa3ba 100644 (file)
@@ -4,10 +4,12 @@ from wxPython.wx import *
 #---------------------------------------------------------------------------
 
 class MyCanvas(wxScrolledWindow):
-    def __init__(self, parent):
-        wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0), wxPyDefaultSize, wxSUNKEN_BORDER)
+    def __init__(self, parent, id = -1, size = wxDefaultSize):
+        wxScrolledWindow.__init__(self, parent, id, wxPoint(0, 0), size, wxSUNKEN_BORDER)
 
         self.lines = []
+        self.maxWidth  = 1000
+        self.maxHeight = 1000
 
         self.SetBackgroundColour(wxNamedColor("WHITE"))
         self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftButtonEvent)
@@ -18,7 +20,13 @@ class MyCanvas(wxScrolledWindow):
         bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
         self.bmp = bmp
 
-        self.SetScrollbars(20, 20, 50, 50)
+        self.SetScrollbars(20, 20, self.maxWidth/20, self.maxHeight/20)
+
+    def getWidth(self):
+        return self.maxWidth
+
+    def getHeight(self):
+        return self.maxHeight
 
 
     def OnPaint(self, event):
@@ -29,7 +37,6 @@ class MyCanvas(wxScrolledWindow):
 
     def DoDrawing(self, dc):
         dc.BeginDrawing()
-        #dc.Clear()
         pen1 = wxPen(wxNamedColour('RED'))
         dc.SetPen(pen1)
         dc.DrawRectangle(5, 5, 50, 50)
@@ -56,7 +63,7 @@ class MyCanvas(wxScrolledWindow):
 
         dc.DrawBitmap(self.bmp, 200, 20)
         dc.SetTextForeground(wxColour(0, 0xFF, 0x80))
-        dc.DrawText("a bitmap", 200, 80)
+        dc.DrawText("a bitmap", 200, 85)
 
         self.DrawSavedLines(dc)
         dc.EndDrawing()