]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/ogl/_bmpshape.py
   1 # -*- coding: iso-8859-1 -*- 
   2 #---------------------------------------------------------------------------- 
   4 # Purpose:      Bitmap shape 
   6 # Author:       Pierre Hjälm (from C++ original by Julian Smart) 
  10 # Copyright:    (c) 2004 Pierre Hjälm - 1998 Julian Smart 
  11 # Licence:      wxWindows license 
  12 #---------------------------------------------------------------------------- 
  14 from __future__ 
import division
 
  16 from _basic 
import RectangleShape
 
  19 class BitmapShape(RectangleShape
): 
  20     """Draws a bitmap (non-resizable).""" 
  22         RectangleShape
.__init
__(self
, 100, 50) 
  26         if not self
._bitmap
.Ok(): 
  29         x 
= self
._xpos
-self
._bitmap
.GetWidth() / 2 
  30         y 
= self
._ypos
-self
._bitmap
.GetHeight() / 2 
  31         dc
.DrawBitmap(self
._bitmap
, x
, y
, True) 
  33     def SetSize(self
, w
, h
, recursive 
= True): 
  35             w 
= self
._bitmap
.GetWidth() 
  36             h 
= self
._bitmap
.GetHeight() 
  38         self
.SetAttachmentSize(w
, h
) 
  43         self
.SetDefaultRegionSize() 
  46         """Return a the bitmap associated with this shape.""" 
  49     def SetBitmap(self
, bitmap
): 
  50         """Set the bitmap associated with this shape. 
  52         You can delete the bitmap from the calling application, since 
  53         reference counting will take care of holding on to the internal bitmap 
  58             self
.SetSize(self
._bitmap
.GetWidth(), self
._bitmap
.GetHeight()) 
  60     def SetFilename(self
, f
): 
  61         """Set the bitmap filename.""" 
  64     def GetFilename(self
): 
  65         """Return the bitmap filename."""