]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/ogl/_basic.py
Added wx.lib.delayedresult from Oliver Schoenborn.
[wxWidgets.git] / wxPython / wx / lib / ogl / _basic.py
index 5ebf3287ca8d2a305e01dd0ed2a239937f1c3d27..db095dd16500e7ab2a562c1be31808a7dba4b395 100644 (file)
@@ -232,9 +232,9 @@ class Shape(ShapeEvtHandler):
         self._canvas = canvas
         self._xpos = 0.0
         self._ypos = 0.0
         self._canvas = canvas
         self._xpos = 0.0
         self._ypos = 0.0
-        self._pen = wx.Pen(wx.BLACK, 1, wx.SOLID)
+        self._pen = BlackForegroundPen
         self._brush = wx.WHITE_BRUSH
         self._brush = wx.WHITE_BRUSH
-        self._font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)
+        self._font = NormalFont
         self._textColour = wx.BLACK
         self._textColourName = wx.BLACK
         self._visible = False
         self._textColour = wx.BLACK
         self._textColourName = wx.BLACK
         self._visible = False
@@ -276,7 +276,7 @@ class Shape(ShapeEvtHandler):
         # the region eventually (the duplication is for compatibility)
         region = ShapeRegion()
         region.SetName("0")
         # the region eventually (the duplication is for compatibility)
         region = ShapeRegion()
         region.SetName("0")
-        region.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
+        region.SetFont(NormalFont)
         region.SetFormatMode(FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT)
         region.SetColour("BLACK")
         self._regions.append(region)
         region.SetFormatMode(FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT)
         region.SetColour("BLACK")
         self._regions.append(region)
@@ -288,9 +288,16 @@ class Shape(ShapeEvtHandler):
         return str(self.__class__).split(".")[-1][:-2]
 
     def Delete(self):
         return str(self.__class__).split(".")[-1][:-2]
 
     def Delete(self):
+        """
+        Fully disconnect this shape from parents, children, the
+        canvas, etc.
+        """
         if self._parent:
             self._parent.GetChildren().remove(self)
 
         if self._parent:
             self._parent.GetChildren().remove(self)
 
+        for child in self.GetChildren():
+            child.Delete()
+
         self.ClearText()
         self.ClearRegions()
         self.ClearAttachments()
         self.ClearText()
         self.ClearRegions()
         self.ClearAttachments()
@@ -749,18 +756,18 @@ class Shape(ShapeEvtHandler):
         if self._pen:
             dc.SetPen(self._pen)
 
         if self._pen:
             dc.SetPen(self._pen)
 
-        region = self._regions[0]
-        if region.GetFont():
-            dc.SetFont(region.GetFont())
+        for region in self._regions:
+            if region.GetFont():
+                dc.SetFont(region.GetFont())
 
 
-        dc.SetTextForeground(region.GetActualColourObject())
-        dc.SetBackgroundMode(wx.TRANSPARENT)
-        if not self._formatted:
-            CentreText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode())
-            self._formatted = True
+            dc.SetTextForeground(region.GetActualColourObject())
+            dc.SetBackgroundMode(wx.TRANSPARENT)
+            if not self._formatted:
+                CentreText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode())
+                self._formatted = True
 
 
-        if not self.GetDisableLabel():
-            DrawFormattedText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode())
+            if not self.GetDisableLabel():
+                DrawFormattedText(dc, region.GetFormattedText(), self._xpos, self._ypos, bound_x - 2 * self._textMarginX, bound_y - 2 * self._textMarginY, region.GetFormatMode())
             
 
     def DrawContents(self, dc):
             
 
     def DrawContents(self, dc):
@@ -1159,7 +1166,7 @@ class Shape(ShapeEvtHandler):
         """Flash the shape."""
         if self.GetCanvas():
             dc = wx.ClientDC(self.GetCanvas())
         """Flash the shape."""
         if self.GetCanvas():
             dc = wx.ClientDC(self.GetCanvas())
-            self.GetCanvas.PrepareDC(dc)
+            self.GetCanvas().PrepareDC(dc)
 
             dc.SetLogicalFunction(OGLRBLF)
             self.Draw(dc)
 
             dc.SetLogicalFunction(OGLRBLF)
             self.Draw(dc)
@@ -2171,7 +2178,7 @@ class Shape(ShapeEvtHandler):
         dc.SetLogicalFunction(OGLRBLF)
 
         bound_x, bound_y = self.GetBoundingBoxMin()
         dc.SetLogicalFunction(OGLRBLF)
 
         bound_x, bound_y = self.GetBoundingBoxMin()
-        self.GetEventHandler().OnEndSize(bound_x, bound_y)
+        self.GetEventHandler().OnBeginSize(bound_x, bound_y)
 
         # Choose the 'opposite corner' of the object as the stationary
         # point in case this is non-centring resizing.
 
         # Choose the 'opposite corner' of the object as the stationary
         # point in case this is non-centring resizing.
@@ -3040,7 +3047,7 @@ class ShapeRegion(object):
             return None
         if self._penColour=="Invisible":
             return None
             return None
         if self._penColour=="Invisible":
             return None
-        self._actualPenObject = wx.ThePenList.FindOrCreatePen(self._penColour, 1, self._penStyle)
+        self._actualPenObject = wx.Pen(self._penColour, 1, self._penStyle)
         return self._actualPenObject
 
     def SetText(self, s):
         return self._actualPenObject
 
     def SetText(self, s):