+class DividedShape(ogl.DividedShape):
+ def __init__(self, width, height, canvas):
+ ogl.DividedShape.__init__(self, width, height)
+
+ region1 = ogl.ShapeRegion()
+ region1.SetText('DividedShape')
+ region1.SetProportions(0.0, 0.2)
+ region1.SetFormatMode(ogl.FORMAT_CENTRE_HORIZ)
+ self.AddRegion(region1)
+
+ region2 = ogl.ShapeRegion()
+ region2.SetText('This is Region number two.')
+ region2.SetProportions(0.0, 0.3)
+ region2.SetFormatMode(ogl.FORMAT_CENTRE_HORIZ|ogl.FORMAT_CENTRE_VERT)
+ self.AddRegion(region2)
+
+ region3 = ogl.ShapeRegion()
+ region3.SetText('Region 3\nwith embedded\nline breaks')
+ region3.SetProportions(0.0, 0.5)
+ region3.SetFormatMode(ogl.FORMAT_NONE)
+ self.AddRegion(region3)
+
+ self.SetRegionSizes()
+ self.ReformatRegions(canvas)
+
+
+ def ReformatRegions(self, canvas=None):
+ rnum = 0
+
+ if canvas is None:
+ canvas = self.GetCanvas()
+
+ dc = wx.ClientDC(canvas) # used for measuring
+
+ for region in self.GetRegions():
+ text = region.GetText()
+ self.FormatText(dc, text, rnum)
+ rnum += 1
+
+
+ def OnSizingEndDragLeft(self, pt, x, y, keys, attch):
+ print "***", self
+ self.base_OnSizingEndDragLeft(pt, x, y, keys, attch)
+ self.SetRegionSizes()
+ self.ReformatRegions()
+ self.GetCanvas().Refresh()
+
+
+#----------------------------------------------------------------------
+
+class MyEvtHandler(ogl.ShapeEvtHandler):