]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/stc/stc.cpp
Typos fixed and further clarification of the Python situation on Panther
[wxWidgets.git] / contrib / src / stc / stc.cpp
index 493db91db63ba26bd3059a8d16800b27a1e2bf85..a9ca85c5c16ff28696266f08ae5a3c161ca54d26 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 | wxWANTS_CHARS | wxCLIP_CHILDREN,
+              wxDefaultValidator, name);
+
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
 #endif
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
 #endif
@@ -2131,20 +2144,16 @@ 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();
         if (len > 0)
         {
         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
+            wxMemoryBuffer buffer(len);
+            success = (file.Read(buffer.GetData(), len) == len);
             contents = wxString(buffer, *wxConvCurrent);
 #else
             contents = wxString(buffer, *wxConvCurrent);
 #else
+            wxString buffer;
+            success = (file.Read(wxStringBuffer(buffer, len), len) == len);
             contents = buffer;
 #endif
         }
             contents = buffer;
 #endif
         }
@@ -2163,6 +2172,7 @@ 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); 
 } 
 wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { 
         return m_swx->DoDragOver(x, y, def); 
 } 
@@ -2171,6 +2181,7 @@ wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def
 bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
     return m_swx->DoDropText(x, y, data);
 }
 bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { 
     return m_swx->DoDropText(x, y, data);
 }
+#endif
 
 
 //----------------------------------------------------------------------
 
 
 //----------------------------------------------------------------------
@@ -2199,8 +2210,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) {