X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e39af974ef7846e26686ae39d74e4696c1fef0c3..e276acb530f41f0b87c4576c0215201a8a767dff:/include/wx/x11/textctrl.h diff --git a/include/wx/x11/textctrl.h b/include/wx/x11/textctrl.h index 2dd4196a92..b076e0ec72 100644 --- a/include/wx/x11/textctrl.h +++ b/include/wx/x11/textctrl.h @@ -11,19 +11,22 @@ #ifndef __X11TEXTCTRLH__ #define __X11TEXTCTRLH__ -#if defined(__GNUG__) && !defined(__APPLE__) - #pragma interface "textctrl.h" -#endif +// Set to 1 to use wxUniv's implementation, 0 +// to use wxX11's. +#define wxUSE_UNIV_TEXTCTRL 1 + +#if wxUSE_UNIV_TEXTCTRL +#include "wx/univ/textctrl.h" +#else #include "wx/scrolwin.h" -#include "wx/dynarray.h" -#include "wx/datetime.h" +#include "wx/arrstr.h" //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- -class wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; //----------------------------------------------------------------------------- // helpers @@ -81,7 +84,7 @@ enum wxSourceLanguage // wxTextCtrl //----------------------------------------------------------------------------- -class wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper { public: wxTextCtrl() { Init(); } @@ -93,6 +96,7 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString &name = wxTextCtrlNameStr); + virtual ~wxTextCtrl(); bool Create(wxWindow *parent, wxWindowID id, @@ -111,8 +115,7 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); + virtual void ChangeValue(const wxString &value); virtual int GetLineLength(long lineNo) const; virtual wxString GetLineText(long lineNo) const; @@ -124,9 +127,8 @@ public: // more readable flag testing methods // ---------------------------------- - bool IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); } bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; } - bool WrapLines() const { return FALSE; } + bool WrapLines() const { return false; } // If the return values from and to are the same, there is no selection. virtual void GetSelection(long* from, long* to) const; @@ -171,18 +173,18 @@ public: virtual void Redo() {} virtual bool CanUndo() const { return (m_undos.GetCount() > 0); } - virtual bool CanRedo() const { return FALSE; } + virtual bool CanRedo() const { return false; } // Insertion point virtual void SetInsertionPoint(long pos); virtual void SetInsertionPointEnd(); virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; + virtual wxTextPos GetLastPosition() const; virtual void SetSelection(long from, long to); virtual void SetEditable(bool editable); - virtual bool Enable( bool enable = TRUE ); + virtual bool Enable( bool enable = true ); void OnCut(wxCommandEvent& event); void OnCopy(wxCommandEvent& event); @@ -200,10 +202,7 @@ public: bool SetForegroundColour(const wxColour& colour); bool SetBackgroundColour(const wxColour& colour); - void SetModified() { m_modified = TRUE; } - - virtual void Freeze(); - virtual void Thaw(); + void SetModified() { m_modified = true; } // textctrl specific scrolling virtual bool ScrollLines(int lines); @@ -254,7 +253,7 @@ public: void OnInternalIdle(); void RefreshLine( int n ); void RefreshDown( int n ); - void MoveCursor( int new_x, int new_y, bool shift = FALSE, bool centre = FALSE ); + void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false ); void MyAdjustScrollbars(); protected: @@ -263,6 +262,8 @@ protected: virtual wxSize DoGetBestSize() const; + virtual void DoSetValue(const wxString& value, int flags = 0); + friend class wxSourceUndoStep; wxSourceLineArray m_lines; @@ -358,24 +359,17 @@ private: // wxTextCtrl types // ---------------------------------------------------------------------------- -// wxTextPos is the position in the text -typedef long wxTextPos; - -// wxTextCoord is the line or row number (which should have been unsigned but -// is long for backwards compatibility) -typedef long wxTextCoord; - -class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler +class WXDLLIMPEXP_CORE wxStdTextCtrlInputHandler : public wxStdInputHandler { public: wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {} virtual bool HandleKey(wxInputConsumer *consumer, const wxKeyEvent& event, - bool pressed) { return FALSE; } - virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; } - virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; } - virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return FALSE; } + bool pressed) { return false; } + virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; } protected: // get the position of the mouse click @@ -385,5 +379,8 @@ protected: wxTextCtrl *m_winCapture; }; -#endif // __GTKTEXTCTRLH__ +#endif +// wxUSE_UNIV_TEXTCTRL + +#endif // __X11TEXTCTRLH__