]> git.saurik.com Git - wxWidgets.git/commitdiff
Added DoDragOver and DoDropText from Angelo Mandato, and ensured that
authorRobin Dunn <robin@alldunn.com>
Thu, 18 Sep 2003 22:28:25 +0000 (22:28 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 18 Sep 2003 22:28:25 +0000 (22:28 +0000)
my unicode LoadFile/SaveFile changes were in the .in file this time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/include/wx/stc/stc.h
contrib/src/stc/stc.cpp
contrib/src/stc/stc.cpp.in
contrib/src/stc/stc.h.in
include/wx/stc/stc.h
src/stc/stc.cpp
src/stc/stc.cpp.in
src/stc/stc.h.in

index de090b647e532db90d263086d2c4c9a0144f7110..7d39ec2c5cf55ff2214a420bf93d90393558052d 100644 (file)
@@ -2275,6 +2275,13 @@ public:
     // Load the contents of filename into the editor
     bool LoadFile(const wxString& filename);
 
+    // Allow for simulating a DnD DragOver
+    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); 
+
+    // Allow for simulating a DnD DropText
+    bool DoDropText(long x, long y, const wxString& data);
+
 
 //----------------------------------------------------------------------
 
index 829cb32e6173407be04e8cc4f1bdda9cda484b51..d51b8d04a0180f5a27e5e448c9b86e077111007d 100644 (file)
@@ -2117,9 +2117,9 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
 
     bool success = file.Write(GetText(), *wxConvCurrent);
 
-    if (success) {
+    if (success)
         SetSavePoint();
-    }
+
     return success;
 }
 
@@ -2136,14 +2136,13 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 #else
         wxString buffer;
 #endif
-        
         off_t len = file.Length();
         if (len > 0)
         {
             void *bufptr = buffer.GetWriteBuf(len);
             success = (file.Read(bufptr, len) == len);
             buffer.UngetWriteBuf(len);
-#if wxUSE_UNICODE
+#if #wxUSE_UNICODE
             contents = wxString(buffer, *wxConvCurrent);
 #else
             contents = buffer;
@@ -2164,6 +2163,16 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 }
 
 
+wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { 
+        return m_swx->DoDragOver(x, y, def); 
+} 
+
+
+bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
+    return m_swx->DoDropText(x, y, data);
+}
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
index be24cc98f7a5bc1b6125ec2eb4fb612176a8669e..fa23c2587b9ace0099a77119372c079364615c54 100644 (file)
@@ -320,7 +320,7 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
     if (!file.IsOpened())
         return FALSE;
 
-    bool success = file.Write(GetText());
+    bool success = file.Write(GetText(), *wxConvCurrent);
 
     if (success)
         SetSavePoint();
@@ -336,13 +336,22 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
     if (file.IsOpened())
     {
         wxString contents;
+#if wxUSE_UNICODE
+        wxMemoryBuffer buffer;
+#else
+        wxString buffer;
+#endif
         off_t len = file.Length();
-
         if (len > 0)
         {
-            wxChar *buf = contents.GetWriteBuf(len);
-            success = (file.Read(buf, len) == len);
-            contents.UngetWriteBuf();
+            void *bufptr = buffer.GetWriteBuf(len);
+            success = (file.Read(bufptr, len) == len);
+            buffer.UngetWriteBuf(len);
+#if #wxUSE_UNICODE
+            contents = wxString(buffer, *wxConvCurrent);
+#else
+            contents = buffer;
+#endif
         }
         else
             success = true;            // empty file is ok
@@ -359,6 +368,16 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 }
 
 
+wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { 
+        return m_swx->DoDragOver(x, y, def); 
+} 
+
+
+bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
+    return m_swx->DoDropText(x, y, data);
+}
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
index 5adb5df385203a3b682b9926888eb0897f834b70..6999efae4ee851fde5a43049eee124bb71f7f698 100644 (file)
@@ -191,6 +191,13 @@ public:
     // Load the contents of filename into the editor
     bool LoadFile(const wxString& filename);
 
+    // Allow for simulating a DnD DragOver
+    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); 
+
+    // Allow for simulating a DnD DropText
+    bool DoDropText(long x, long y, const wxString& data);
+
 
 //----------------------------------------------------------------------
 
index de090b647e532db90d263086d2c4c9a0144f7110..7d39ec2c5cf55ff2214a420bf93d90393558052d 100644 (file)
@@ -2275,6 +2275,13 @@ public:
     // Load the contents of filename into the editor
     bool LoadFile(const wxString& filename);
 
+    // Allow for simulating a DnD DragOver
+    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); 
+
+    // Allow for simulating a DnD DropText
+    bool DoDropText(long x, long y, const wxString& data);
+
 
 //----------------------------------------------------------------------
 
index 829cb32e6173407be04e8cc4f1bdda9cda484b51..d51b8d04a0180f5a27e5e448c9b86e077111007d 100644 (file)
@@ -2117,9 +2117,9 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
 
     bool success = file.Write(GetText(), *wxConvCurrent);
 
-    if (success) {
+    if (success)
         SetSavePoint();
-    }
+
     return success;
 }
 
@@ -2136,14 +2136,13 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 #else
         wxString buffer;
 #endif
-        
         off_t len = file.Length();
         if (len > 0)
         {
             void *bufptr = buffer.GetWriteBuf(len);
             success = (file.Read(bufptr, len) == len);
             buffer.UngetWriteBuf(len);
-#if wxUSE_UNICODE
+#if #wxUSE_UNICODE
             contents = wxString(buffer, *wxConvCurrent);
 #else
             contents = buffer;
@@ -2164,6 +2163,16 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 }
 
 
+wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { 
+        return m_swx->DoDragOver(x, y, def); 
+} 
+
+
+bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
+    return m_swx->DoDropText(x, y, data);
+}
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
index be24cc98f7a5bc1b6125ec2eb4fb612176a8669e..fa23c2587b9ace0099a77119372c079364615c54 100644 (file)
@@ -320,7 +320,7 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
     if (!file.IsOpened())
         return FALSE;
 
-    bool success = file.Write(GetText());
+    bool success = file.Write(GetText(), *wxConvCurrent);
 
     if (success)
         SetSavePoint();
@@ -336,13 +336,22 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
     if (file.IsOpened())
     {
         wxString contents;
+#if wxUSE_UNICODE
+        wxMemoryBuffer buffer;
+#else
+        wxString buffer;
+#endif
         off_t len = file.Length();
-
         if (len > 0)
         {
-            wxChar *buf = contents.GetWriteBuf(len);
-            success = (file.Read(buf, len) == len);
-            contents.UngetWriteBuf();
+            void *bufptr = buffer.GetWriteBuf(len);
+            success = (file.Read(bufptr, len) == len);
+            buffer.UngetWriteBuf(len);
+#if #wxUSE_UNICODE
+            contents = wxString(buffer, *wxConvCurrent);
+#else
+            contents = buffer;
+#endif
         }
         else
             success = true;            // empty file is ok
@@ -359,6 +368,16 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 }
 
 
+wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { 
+        return m_swx->DoDragOver(x, y, def); 
+} 
+
+
+bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
+    return m_swx->DoDropText(x, y, data);
+}
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
index 5adb5df385203a3b682b9926888eb0897f834b70..6999efae4ee851fde5a43049eee124bb71f7f698 100644 (file)
@@ -191,6 +191,13 @@ public:
     // Load the contents of filename into the editor
     bool LoadFile(const wxString& filename);
 
+    // Allow for simulating a DnD DragOver
+    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); 
+
+    // Allow for simulating a DnD DropText
+    bool DoDropText(long x, long y, const wxString& data);
+
 
 //----------------------------------------------------------------------