int overflow(int i);
#endif // wxHAS_TEXT_WINDOW_STREAM
- virtual bool DoLoadFile(const wxString& file, int fileType);
- virtual bool DoSaveFile(const wxString& file, int fileType);
-
// Another wxTextAreaBase override.
virtual bool IsValidPosition(long pos) const
{
{
SetValue(text);
+ DiscardEdits();
+ m_filename = filename;
+
return true;
}
}
#endif // wxUSE_FFILE
+ wxLogError(_("File couldn't be loaded."));
+
return false;
}
-bool wxTextCtrlBase::DoLoadFile(const wxString& filename, int fileType)
+bool wxTextAreaBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
{
- if ( wxTextAreaBase::DoLoadFile(filename, fileType) )
+#if wxUSE_FFILE
+ wxFFile file(filename, wxT("w"));
+ if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) )
{
- DiscardEdits();
+ // if it worked, save for future calls
m_filename = filename;
+
+ // it's not modified any longer
+ DiscardEdits();
+
return true;
}
- wxLogError(_("File couldn't be loaded."));
- return false;
-}
+#endif // wxUSE_FFILE
-bool wxTextAreaBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
-{
-#if wxUSE_FFILE
- wxFFile file(filename, wxT("w"));
- return file.IsOpened() && file.Write(GetValue(), *wxConvCurrent);
-#else
return false;
-#endif // wxUSE_FFILE
}
bool wxTextAreaBase::SaveFile(const wxString& filename, int fileType)
return DoSaveFile(filenameToUse, fileType);
}
-bool wxTextCtrlBase::DoSaveFile(const wxString& filename, int fileType)
-{
- if ( wxTextAreaBase::DoSaveFile(filename, fileType) )
- {
- // if it worked, save for future calls
- m_filename = filename;
-
- // it's not modified any longer
- DiscardEdits();
-
- return true;
- }
- return false;
-}
-
// ----------------------------------------------------------------------------
// stream-like insertion operator
// ----------------------------------------------------------------------------