+bool wxStyledTextCtrl::SaveFile(const wxString& filename)
+{
+ wxFile file(filename, wxFile::write);
+
+ if (!file.IsOpened())
+ return false;
+
+ bool success = file.Write(GetText(), *wxConvCurrent);
+
+ if (success)
+ SetSavePoint();
+
+ return success;
+}
+
+bool wxStyledTextCtrl::LoadFile(const wxString& filename)
+{
+ bool success = false;
+ wxFile file(filename, wxFile::read);
+
+ if (file.IsOpened())
+ {
+ wxString contents;
+ // get the file size (assume it is not huge file...)
+ ssize_t len = (ssize_t)file.Length();
+
+ if (len > 0)
+ {
+#if wxUSE_UNICODE
+ wxMemoryBuffer buffer(len+1);
+ success = (file.Read(buffer.GetData(), len) == len);
+ if (success) {
+ ((char*)buffer.GetData())[len] = 0;
+ contents = wxString(buffer, *wxConvCurrent, len);
+ }
+#else
+ wxString buffer;
+ success = (file.Read(wxStringBuffer(buffer, len), len) == len);
+ contents = buffer;
+#endif
+ }
+ else
+ {
+ if (len == 0)
+ success = true; // empty file is ok
+ else
+ success = false; // len == wxInvalidOffset
+ }
+
+ if (success)
+ {
+ SetText(contents);
+ EmptyUndoBuffer();
+ SetSavePoint();
+ }
+ }
+
+ return success;
+}
+
+
+#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
+
+
+void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
+ m_swx->SetUseAntiAliasing(useAA);
+}
+
+bool wxStyledTextCtrl::GetUseAntiAliasing() {
+ return m_swx->GetUseAntiAliasing();
+}