]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/DragAndDrop.py
Removed deprecation warnings in OGL and Gizmos
[wxWidgets.git] / wxPython / demo / DragAndDrop.py
index 090c162b890e9070eecaa4821ada00e4b10afc44..e99abc3660fdc7cc634b8b1d976e96206878484e 100644 (file)
@@ -8,7 +8,7 @@ class ClipTextPanel(wxPanel):
         wxPanel.__init__(self, parent, -1)
         self.log = log
 
-        #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
+        #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
 
         sizer = wxBoxSizer(wxVERTICAL)
         sizer.Add(wxStaticText(self, -1,
@@ -28,7 +28,7 @@ class ClipTextPanel(wxPanel):
         EVT_BUTTON(self, 6051, self.OnPaste)
         EVT_BUTTON(self, 6052, self.OnCopyBitmap)
 
-        self.SetAutoLayout(true)
+        self.SetAutoLayout(True)
         self.SetSizer(sizer)
 
 
@@ -86,7 +86,7 @@ class OtherDropTarget(wxPyDropTarget):
 
     def OnDrop(self, x, y):
         self.log.WriteText("OnDrop: %d %d\n" % (x, y))
-        return true
+        return True
 
     def OnData(self, x, y, d):
         self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
@@ -111,12 +111,24 @@ class MyFileDropTarget(wxFileDropTarget):
             self.window.WriteText(file + '\n')
 
 
+class MyTextDropTarget(wxTextDropTarget):
+    def __init__(self, window, log):
+        wxTextDropTarget.__init__(self)
+        self.window = window
+        self.log = log
+
+    def OnDropText(self, x, y, text):
+        self.window.WriteText("(%d, %d)\n%s\n" % (x, y, text))
+
+    def OnDragOver(self, x, y, d):
+        return wxDragCopy
+
 
 class FileDropPanel(wxPanel):
     def __init__(self, parent, log):
         wxPanel.__init__(self, parent, -1)
 
-        #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
+        #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
 
         sizer = wxBoxSizer(wxVERTICAL)
         sizer.Add(wxStaticText(self, -1, " \nDrag some files here:"),
@@ -128,7 +140,15 @@ class FileDropPanel(wxPanel):
         self.text.SetDropTarget(dt)
         sizer.Add(self.text, 1, wxEXPAND)
 
-        self.SetAutoLayout(true)
+        sizer.Add(wxStaticText(self, -1, " \nDrag some text here:"),
+                  0, wxEXPAND|wxALL, 2)
+        self.text2 = wxTextCtrl(self, -1, "",
+                               style = wxTE_MULTILINE|wxHSCROLL|wxTE_READONLY)
+        dt = MyTextDropTarget(self.text2, log)
+        self.text2.SetDropTarget(dt)
+        sizer.Add(self.text2, 1, wxEXPAND)
+
+        self.SetAutoLayout(True)
         self.SetSizer(sizer)
 
 
@@ -146,12 +166,12 @@ class TestPanel(wxPanel):
     def __init__(self, parent, log):
         wxPanel.__init__(self, parent, -1)
 
-        self.SetAutoLayout(true)
+        self.SetAutoLayout(True)
         outsideSizer = wxBoxSizer(wxVERTICAL)
 
         msg = "Clipboard / Drag-And-Drop"
         text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
-        text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
+        text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
         text.SetLabel(msg)
         w,h = text.GetTextExtent(msg)
         text.SetSize(wxSize(w,h+1))