dabo Commit Revision 1234 Date: 2005-08-31 17:18:12 -0700 (Wed, 31 Aug 2005) Author: ed
Changed: U trunk/dabo/ui/uiwx/dBitmapButton.py
Log: Converted the 'fudge' to a property, as it will need to be referenced by other classes when doing size calculations.
Diff: Modified: trunk/dabo/ui/uiwx/dBitmapButton.py =================================================================== --- trunk/dabo/ui/uiwx/dBitmapButton.py 2005-08-31 23:03:39 UTC (rev 1233) +++ trunk/dabo/ui/uiwx/dBitmapButton.py 2005-09-01 00:18:12 UTC (rev 1234) @@ -20,6 +20,9 @@ # This controls whether the button automatically resizes # itself when its Picture changes. self._autoSize = False + # On some platforms, we need to add some 'breathing room' + # around the bitmap image in order for it to appear correctly + self._bmpBorder = 10 cm.dControlMixin.__init__(self, preClass, parent, properties, *args, **kwargs) @@ -32,10 +35,8 @@ def __sizeToBitmap(self): if self.Picture: bmp = self.Bitmap - ## There's a certain border where the image will get clipped on the button, - ## to account for the curved corners. The fudge of 10 looks good on GTK. - fudge = 10 - self.Size = (bmp.GetWidth()+fudge, bmp.GetHeight()+fudge) + self.Size = (bmp.GetWidth() + self._bmpBorder, + bmp.GetHeight() + self._bmpBorder) # Property get/set/del methods follow. Scroll to bottom to see the property @@ -45,6 +46,14 @@ return self._autoSize def _setAutoSize(self, val): self._autoSize = val + + def _getBmpBorder(self): + return self._bmpBorder + def _setBmpBorder(self, val): + self._bmpBorder = val + if self._autoSize: + self.__sizeToBitmap() + def _getCancelButton(self): # need to implement @@ -151,6 +160,9 @@ Bitmap = property(_getNormalBitmap, None, None, _("""The bitmap normally displayed on the button. (wx.Bitmap)""")) + BitmapBorder = property(_getBmpBorder, _setBmpBorder, None, + _("""Extra space around the bitmap, used when auto-sizing. (int)""")) + CancelButton = property(_getCancelButton, _setCancelButton, None, _("Specifies whether this Bitmap button gets clicked on -Escape-."))
©2005 Ed Leafe |