]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp.in
removed assert which became incorrect after last change
[wxWidgets.git] / src / stc / stc.cpp.in
index be24cc98f7a5bc1b6125ec2eb4fb612176a8669e..4cc177306fdeb4d35c55fb4386947b63d120edd8 100644 (file)
@@ -136,11 +136,24 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
                                    const wxPoint& pos,
                                    const wxSize& size,
                                    long style,
-                                   const wxString& name) :
-    wxControl(parent, id, pos, size,
-              style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
-              wxDefaultValidator, name)
+                                   const wxString& name)
 {
 {
+    m_swx = NULL;
+    Create(parent, id, pos, size, style, name);
+}
+
+
+void wxStyledTextCtrl::Create(wxWindow *parent,
+                                   wxWindowID id,
+                                   const wxPoint& pos,
+                                   const wxSize& size,
+                                   long style,
+                                   const wxString& name)
+{
+    wxControl::Create(parent, id, pos, size,
+              style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
+              wxDefaultValidator, name);
+
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
 #endif
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
 #endif
@@ -320,7 +333,7 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
     if (!file.IsOpened())
         return FALSE;
 
     if (!file.IsOpened())
         return FALSE;
 
-    bool success = file.Write(GetText());
+    bool success = file.Write(GetText(), *wxConvCurrent);
 
     if (success)
         SetSavePoint();
 
     if (success)
         SetSavePoint();
@@ -336,13 +349,22 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
     if (file.IsOpened())
     {
         wxString contents;
     if (file.IsOpened())
     {
         wxString contents;
+#if wxUSE_UNICODE
+        wxMemoryBuffer buffer;
+#else
+        wxString buffer;
+#endif
         off_t len = file.Length();
         off_t len = file.Length();
-
         if (len > 0)
         {
         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
         }
         else
             success = true;            // empty file is ok
@@ -359,6 +381,18 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
 }
 
 
 }
 
 
+#if wxUSE_DRAG_AND_DROP
+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);
+}
+#endif
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
 //----------------------------------------------------------------------
 // Event handlers
 
@@ -385,8 +419,10 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
 }
 
 void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
 }
 
 void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
-    wxSize sz = GetClientSize();
-    m_swx->DoSize(sz.x, sz.y);
+    if (m_swx) {
+        wxSize sz = GetClientSize();
+        m_swx->DoSize(sz.x, sz.y);
+    }
 }
 
 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
 }
 
 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {