X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3c7fc996a73e9f6a83067bc28a3c5581a3fee65..c534e69669840e016d9e109356d8839302bb95db:/include/wx/textctrl.h diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index a25c2f16e3..5494405586 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -39,13 +39,8 @@ #define wxHAS_TEXT_WINDOW_STREAM 0 #endif -#if WXWIN_COMPATIBILITY_2_4 && !wxHAS_TEXT_WINDOW_STREAM - // define old flag if one could use it somewhere - #define NO_TEXT_WINDOW_STREAM -#endif - -class WXDLLEXPORT wxTextCtrl; -class WXDLLEXPORT wxTextCtrlBase; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrlBase; // ---------------------------------------------------------------------------- // wxTextCtrl types @@ -128,6 +123,12 @@ const wxTextCoord wxInvalidTextCoord = -2; #define wxTE_CAPITALIZE 0 #endif +// ---------------------------------------------------------------------------- +// wxTextCtrl file types +// ---------------------------------------------------------------------------- + +#define wxTEXT_TYPE_ANY 0 + // ---------------------------------------------------------------------------- // wxTextCtrl::HitTest return values // ---------------------------------------------------------------------------- @@ -292,7 +293,12 @@ public: // --------- virtual wxString GetValue() const = 0; - virtual void SetValue(const wxString& value) = 0; + virtual bool IsEmpty() const { return GetValue().empty(); } + + virtual void SetValue(const wxString& value) + { DoSetValue(value, SetValue_SendEvent); } + virtual void ChangeValue(const wxString& value) + { DoSetValue(value); } virtual wxString GetRange(long from, long to) const; @@ -320,9 +326,13 @@ public: virtual void Replace(long from, long to, const wxString& value) = 0; virtual void Remove(long from, long to) = 0; - // load/save the controls contents from/to the file - virtual bool LoadFile(const wxString& file); - virtual bool SaveFile(const wxString& file = wxEmptyString); + // load/save the control's contents from/to a file + bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); } + bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); + + // implementation for loading/saving + virtual bool DoLoadFile(const wxString& file, int fileType); + virtual bool DoSaveFile(const wxString& file, int fileType); // sets/clears the dirty flag virtual void MarkDirty() = 0; @@ -408,6 +418,9 @@ public: wxTextCtrl& operator<<(double d); wxTextCtrl& operator<<(const wxChar c); + // generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does + void SendTextUpdatedEvent(); + // do the window-specific processing after processing the update event virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); @@ -419,6 +432,17 @@ protected: int overflow(int i); #endif // wxHAS_TEXT_WINDOW_STREAM + // flags for DoSetValue(): common part of SetValue() and ChangeValue() and + // also used to implement WriteText() in wxMSW + enum + { + SetValue_SendEvent = 1, + SetValue_SelectionOnly = 2 + }; + + virtual void DoSetValue(const wxString& value, int flags = 0) = 0; + + // the name of the last file loaded with LoadFile() which will be used by // SaveFile() by default wxString m_filename;