// file IO functions
// ----------------------------------------------------------------------------
-bool wxTextCtrlBase::LoadFile(const wxString& filename)
+bool wxTextCtrlBase::DoLoadFile(const wxString& filename, int WXUNUSED(fileType))
{
#if wxUSE_FFILE
wxFFile file(filename);
return false;
}
-bool wxTextCtrlBase::SaveFile(const wxString& filename)
+bool wxTextCtrlBase::SaveFile(const wxString& filename, int fileType)
{
wxString filenameToUse = filename.empty() ? m_filename : filename;
if ( filenameToUse.empty() )
return false;
}
+ return DoSaveFile(filenameToUse, fileType);
+}
+
+bool wxTextCtrlBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
+{
#if wxUSE_FFILE
- wxFFile file(filenameToUse, _T("w"));
+ wxFFile file(filename, _T("w"));
if ( file.IsOpened() && file.Write(GetValue()) )
{
+ // if it worked, save for future calls
+ m_filename = filename;
+
// it's not modified any longer
DiscardEdits();
- // if it worked, save for future calls
- m_filename = filenameToUse;
-
return true;
}
#endif // wxUSE_FFILE
return wxTE_HT_UNKNOWN;
}
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+void wxTextCtrlBase::SendTextUpdatedEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+
+ // do not do this as it could be very inefficient if the text control
+ // contains a lot of text and we're not using ref-counted wxString
+ // implementation -- instead, event.GetString() will query the control for
+ // its current text if needed
+ //event.SetString(GetValue());
+
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+}
+
#else // !wxUSE_TEXTCTRL
// define this one even if !wxUSE_TEXTCTRL because it is also used by other