// declarations
// ============================================================================
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "textctrlbase.h"
#endif
bool wxTextCtrlBase::SaveFile(const wxString& filename)
{
wxString filenameToUse = filename.IsEmpty() ? m_filename : filename;
- if ( !filenameToUse )
+ if ( filenameToUse.empty() )
{
// what kind of message to give? is it an error or a program bug?
wxLogDebug(wxT("Can't save textctrl to file without filename."));
}
#if wxUSE_FFILE
- wxFFile file(filename, _T("w"));
+ wxFFile file(filenameToUse, _T("w"));
if ( file.IsOpened() && file.Write(GetValue()) )
{
// it's not modified any longer
DiscardEdits();
- m_filename = filename;
+ // if it worked, save for future calls
+ m_filename = filenameToUse;
return TRUE;
}
+#endif // wxUSE_FFILE
wxLogError(_("The text couldn't be saved."));
-#endif // wxUSE_FFILE
return FALSE;
}
// emulating key presses
// ----------------------------------------------------------------------------
+#ifdef __WIN32__
+// the generic version is unused in wxMSW
+bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& WXUNUSED(event))
+{
+ return FALSE;
+}
+#else // !__WIN32__
bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
{
- // the generic version is unused in wxMSW
-#ifndef __WIN32__
wxChar ch = 0;
int keycode = event.GetKeyCode();
switch ( keycode )
return TRUE;
}
-#endif // !__WIN32__
return FALSE;
}
+#endif // !__WIN32__
// ----------------------------------------------------------------------------
// selection and ranges
return sel;
}
+// do the window-specific processing after processing the update event
+void wxTextCtrlBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
+{
+ if ( event.GetSetEnabled() )
+ Enable(event.GetEnabled());
+
+ if ( event.GetSetText() )
+ {
+ if ( event.GetText() != GetValue() )
+ SetValue(event.GetText());
+ }
+}
+
+
#else // !wxUSE_TEXTCTRL
// define this one even if !wxUSE_TEXTCTRL because it is also used by other