]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/CustomDragAndDrop.py
Automatically disable wxDialupManager for wxMac and wxCocoa,
[wxWidgets.git] / wxPython / demo / CustomDragAndDrop.py
index 13a78426bbc16b1eaa69de2d303e7d86411f15d7..1c2b33777d4664976979ca90954269147d8749f3 100644 (file)
@@ -1,11 +1,3 @@
-# 11/5/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-# 
-# o Updated for wx namespace
-#
-# 11/24/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-# 
-# o Issues around line 167. I'm stuck.
-#
 
 import  cPickle
 import  wx
@@ -63,20 +55,21 @@ class DoodlePad(wx.Window):
 
 
     def OnLeftUp(self, event):
-        self.lines.append(self.curLine)
-        self.curLine = []
-        self.ReleaseMouse()
+        if self.HasCapture():
+            self.lines.append(self.curLine)
+            self.curLine = []
+            self.ReleaseMouse()
 
     def OnRightUp(self, event):
         self.lines = []
         self.Refresh()
 
     def OnMotion(self, event):
-        if event.Dragging() and not self.mode == "Drag":
+        if self.HasCapture() and event.Dragging() and not self.mode == "Drag":
             dc = wx.ClientDC(self)
             dc.BeginDrawing()
             dc.SetPen(wx.Pen(wx.BLUE, 3))
-            coords = ((self.x, self.y), event.GetPositionTuple())
+            coords = (self.x, self.y) + event.GetPositionTuple()
             self.curLine.append(coords)
             dc.DrawLine(*coords)
             self.x, self.y = event.GetPositionTuple()
@@ -89,7 +82,7 @@ class DoodlePad(wx.Window):
 
         # create our own data format and use it in a
         # custom data object
-        ldata = wx.CustomDataObject(wx.CustomDataFormat("DoodleLines"))
+        ldata = wx.CustomDataObject("DoodleLines")
         ldata.SetData(linesdata)
 
         # Also create a Bitmap version of the drawing
@@ -132,8 +125,7 @@ class DoodleDropTarget(wx.PyDropTarget):
         self.dv = window
 
         # specify the type of data we will accept
-        self.df = wx.CustomDataFormat("DoodleLines")
-        self.data = wx.CustomDataObject(self.df)
+        self.data = wx.CustomDataObject("DoodleLines")
         self.SetDataObject(self.data)
 
 
@@ -223,8 +215,8 @@ class CustomDnDPanel(wx.Panel):
                             "Draw a little picture in this window\n"
                             "then switch the mode below and drag the\n"
                             "picture to the lower window or to another\n"
-                            "application that accepts BMP's as a drop\n"
-                             "target.\n"
+                            "application that accepts Bitmaps as a\n"
+                             "drop target.\n"
                             )
 
         rb1 = wx.RadioButton(self, -1, "Draw", style=wx.RB_GROUP)