Updated ShapedWindow demo, don't try to start out without the shape.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,17 +16,22 @@ class TestFrame(wxFrame):
|
|||||||
EVT_MOTION(self, self.OnMouseMove)
|
EVT_MOTION(self, self.OnMouseMove)
|
||||||
EVT_RIGHT_UP(self, self.OnExit)
|
EVT_RIGHT_UP(self, self.OnExit)
|
||||||
EVT_PAINT(self, self.OnPaint)
|
EVT_PAINT(self, self.OnPaint)
|
||||||
EVT_SIZE(self, self.OnSize)
|
|
||||||
|
|
||||||
self.bmp = images.getTuxBitmap()
|
self.bmp = images.getTuxBitmap()
|
||||||
w, h = self.bmp.GetWidth(), self.bmp.GetHeight()
|
w, h = self.bmp.GetWidth(), self.bmp.GetHeight()
|
||||||
#self.SetClientSize( (w, h) )
|
self.SetClientSize( (w, h) )
|
||||||
self.SetToolTipString("Right-click to close the window")
|
self.SetToolTipString("Right-click to close the window\n"
|
||||||
s = wxStaticText(self, -1, "Double-click the image to set the window shape",
|
"Double-click the image to set/unset the window shape")
|
||||||
pos = (w+10, h))
|
|
||||||
s.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD))
|
if wxPlatform == "__WXGTK__":
|
||||||
s.SetSize(s.GetBestSize())
|
# wxGTK requires that the window be created before you can
|
||||||
self.Fit()
|
# set its shape, so delay the call to SetWindowShape until
|
||||||
|
# this event.
|
||||||
|
EVT_WINDOW_CREATE(self, self.SetWindowShape)
|
||||||
|
else:
|
||||||
|
# On wxMSW the window has already been created, so go for it.
|
||||||
|
self.SetWindowShape()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def SetWindowShape(self, *evt):
|
def SetWindowShape(self, *evt):
|
||||||
@@ -46,9 +51,6 @@ class TestFrame(wxFrame):
|
|||||||
dc = wxPaintDC(self)
|
dc = wxPaintDC(self)
|
||||||
dc.DrawBitmap(self.bmp, 0,0, True)
|
dc.DrawBitmap(self.bmp, 0,0, True)
|
||||||
|
|
||||||
def OnSize(self, evt):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def OnExit(self, evt):
|
def OnExit(self, evt):
|
||||||
self.Close()
|
self.Close()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user