X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4d3bed80a8bc6337bb2c36151a6f19b4d79922a..a01ada0599acdc11497850c4c8e846d3f237bf91:/include/wx/univ/textctrl.h diff --git a/include/wx/univ/textctrl.h b/include/wx/univ/textctrl.h index 8c7a4c0280..127c3f7c34 100644 --- a/include/wx/univ/textctrl.h +++ b/include/wx/univ/textctrl.h @@ -12,12 +12,8 @@ #ifndef _WX_UNIV_TEXTCTRL_H_ #define _WX_UNIV_TEXTCTRL_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "univtextctrl.h" -#endif - -class WXDLLEXPORT wxCaret; -class WXDLLEXPORT wxTextCtrlCommandProcessor; +class WXDLLIMPEXP_FWD_CORE wxCaret; +class WXDLLIMPEXP_FWD_CORE wxTextCtrlCommandProcessor; #include "wx/scrolwin.h" // for wxScrollHelper @@ -70,13 +66,14 @@ class WXDLLEXPORT wxTextCtrlCommandProcessor; // wxTextCtrl // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, public wxScrollHelper +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, + public wxScrollHelper { public: // creation // -------- - wxTextCtrl() { Init(); } + wxTextCtrl() : wxScrollHelper(this) { Init(); } wxTextCtrl(wxWindow *parent, wxWindowID id, @@ -86,6 +83,7 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr) + : wxScrollHelper(this) { Init(); @@ -107,7 +105,6 @@ public: // ---------------------------------- virtual wxString GetValue() const; - virtual void SetValue(const wxString& value); virtual int GetLineLength(wxTextCoord lineNo) const; virtual wxString GetLineText(wxTextCoord lineNo) const; @@ -221,27 +218,39 @@ public: virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const; virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const; - // ensure we have correct default border - virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; } - // perform an action virtual bool PerformAction(const wxControlAction& action, long numArg = -1, const wxString& strArg = wxEmptyString); + static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); + virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) + { + return GetStdInputHandler(handlerDef); + } + // override these methods to handle the caret virtual bool SetFont(const wxFont &font); virtual bool Enable(bool enable = true); // more readable flag testing methods - bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; } - bool WrapLines() const - { return !IsSingleLine() && !(GetWindowStyle() & wxHSCROLL); } + bool IsPassword() const { return HasFlag(wxTE_PASSWORD); } + bool WrapLines() const { return m_wrapLines; } // only for wxStdTextCtrlInputHandler void RefreshSelection(); + // override wxScrollHelper method to prevent (auto)scrolling beyond the end + // of line + virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; + + // idle processing + virtual void OnInternalIdle(); + protected: + // ensure we have correct default border + virtual wxBorder GetDefaultBorder() const { return wxBORDER_SUNKEN; } + // override base class methods virtual void DoDrawBorder(wxDC& dc, const wxRect& rect); virtual void DoDraw(wxControlRenderer *renderer); @@ -249,6 +258,9 @@ protected: // calc the size from the text extent virtual wxSize DoGetBestClientSize() const; + // implements Set/ChangeValue() + virtual void DoSetValue(const wxString& value, int flags = 0); + // common part of all ctors void Init(); @@ -427,10 +439,6 @@ protected: void OnChar(wxKeyEvent& event); void OnSize(wxSizeEvent& event); - // overrdie wxScrollHelper method to prevent (auto)scrolling beyond the end - // of line - virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const; - // return the struct containing control-type dependent data struct wxTextSingleLineData& SData() { return *m_data.sdata; } struct wxTextMultiLineData& MData() { return *m_data.mdata; } @@ -444,8 +452,6 @@ protected: bool DoCut(); bool DoPaste(); - // idle processing - virtual void OnInternalIdle(); private: // all these methods are for multiline text controls only @@ -493,7 +499,8 @@ private: // flags bool m_isModified:1, m_isEditable:1, - m_hasCaret:1; + m_hasCaret:1, + m_wrapLines:1; // can't be changed after creation // the rectangle (in client coordinates) to draw text inside wxRect m_rectText; @@ -523,32 +530,5 @@ private: friend class wxWrappedLineData; }; -// ---------------------------------------------------------------------------- -// wxStdTextCtrlInputHandler: this control handles only the mouse/kbd actions -// common to Win32 and GTK, platform-specific things are implemented elsewhere -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler -{ -public: - wxStdTextCtrlInputHandler(wxInputHandler *inphand); - - virtual bool HandleKey(wxInputConsumer *consumer, - const wxKeyEvent& event, - bool pressed); - virtual bool HandleMouse(wxInputConsumer *consumer, - const wxMouseEvent& event); - virtual bool HandleMouseMove(wxInputConsumer *consumer, - const wxMouseEvent& event); - virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event); - -protected: - // get the position of the mouse click - static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos); - - // capture data - wxTextCtrl *m_winCapture; -}; - #endif // _WX_UNIV_TEXTCTRL_H_