+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;
+ off_t len = file.Length();
+ if (len > 0)
+ {
+#if wxUSE_UNICODE
+ wxMemoryBuffer buffer(len);
+ success = (file.Read(buffer.GetData(), len) == len);
+ contents = wxString(buffer, *wxConvCurrent);
+#else
+ wxString buffer;
+ success = (file.Read(wxStringBuffer(buffer, len), len) == len);
+ contents = buffer;
+#endif
+ }
+ else
+ success = true; // empty file is ok
+
+ 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
+