]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp.in
Added Ryan Norton and myself to the list of contributors
[wxWidgets.git] / src / stc / stc.cpp.in
index 17143cf67853f9ba32f8f7b2865396bb0fdeeab2..18901c41f8d9aef6018834cc572a9458e480af49 100644 (file)
@@ -150,19 +150,20 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
 }
 
 
 }
 
 
-void wxStyledTextCtrl::Create(wxWindow *parent,
-                                   wxWindowID id,
-                                   const wxPoint& pos,
-                                   const wxSize& size,
-                                   long style,
-                                   const wxString& name)
+bool wxStyledTextCtrl::Create(wxWindow *parent,
+                              wxWindowID id,
+                              const wxPoint& pos,
+                              const wxSize& size,
+                              long style,
+                              const wxString& name)
 {
 #ifdef __WXMAC__
     style |= wxVSCROLL | wxHSCROLL;
 #endif
 {
 #ifdef __WXMAC__
     style |= wxVSCROLL | wxHSCROLL;
 #endif
-    wxControl::Create(parent, id, pos, size,
-              style | wxWANTS_CHARS | wxCLIP_CHILDREN,
-              wxDefaultValidator, name);
+    if (!wxControl::Create(parent, id, pos, size,
+                           style | wxWANTS_CHARS | wxCLIP_CHILDREN,
+                           wxDefaultValidator, name))
+        return false;
 
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
 
 #ifdef LINK_LEXERS
     Scintilla_LinkLexers();
@@ -181,6 +182,7 @@ void wxStyledTextCtrl::Create(wxWindow *parent,
 
     // Reduces flicker on GTK+/X11
     SetBackgroundStyle(wxBG_STYLE_CUSTOM);
 
     // Reduces flicker on GTK+/X11
     SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+    return true;
 }
 
 
 }
 
 
@@ -441,6 +443,109 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() {
     return m_swx->GetUseAntiAliasing();
 }
 
     return m_swx->GetUseAntiAliasing();
 }
 
+
+
+
+
+void wxStyledTextCtrl::AddTextRaw(const char* text)
+{
+    SendMsg(SCI_ADDTEXT, strlen(text), (long)text);
+}
+
+void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
+{
+    SendMsg(SCI_INSERTTEXT, pos, (long)text);
+}
+
+wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
+{
+    int len = LineLength(GetCurrentLine());
+    if (!len) {
+        if (linePos)  *linePos = 0;
+        wxCharBuffer empty;
+        return empty;
+    }
+
+    wxCharBuffer buf(len);
+    int pos = SendMsg(SCI_GETCURLINE, len, (long)buf.data());
+    if (linePos)  *linePos = pos;
+    return buf;
+}
+
+wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
+{
+    int len = LineLength(line);
+    if (!len) {
+        wxCharBuffer empty;
+        return empty;
+    }
+
+    wxCharBuffer buf(len);
+    SendMsg(SCI_GETLINE, line, (long)buf.data());
+    return buf;
+}
+
+wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
+{
+    int   start;
+    int   end;
+
+    GetSelection(&start, &end);
+    int   len  = end - start;
+    if (!len) {
+        wxCharBuffer empty;
+        return empty;
+    }        
+
+    wxCharBuffer buf(len);
+    SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
+    return buf;
+}
+
+wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
+{
+    if (endPos < startPos) {
+        int temp = startPos;
+        startPos = endPos;
+        endPos = temp;
+    }
+    int len  = endPos - startPos;
+    if (!len) {
+        wxCharBuffer empty;
+        return empty;
+    }        
+
+    wxCharBuffer buf(len);
+    TextRange tr;
+    tr.lpstrText = buf.data();
+    tr.chrg.cpMin = startPos;
+    tr.chrg.cpMax = endPos;
+    SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr);
+    return buf;
+}
+
+void wxStyledTextCtrl::SetTextRaw(const char* text)
+{
+    SendMsg(SCI_SETTEXT, 0, (long)text);
+}
+
+wxCharBuffer wxStyledTextCtrl::GetTextRaw()
+{
+    int len  = GetTextLength();
+    wxCharBuffer buf(len);
+    SendMsg(SCI_GETTEXT, len, (long)buf.data());
+    return buf;
+}
+
+void wxStyledTextCtrl::AppendTextRaw(const char* text)
+{
+    SendMsg(SCI_APPENDTEXT, strlen(text), (long)text);
+}
+
+
+
+
+
 //----------------------------------------------------------------------
 // Event handlers
 
 //----------------------------------------------------------------------
 // Event handlers