X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/28f92d74ee73176fc391fb8c3de75c76dd086319..2da25e49e59a072d337ff05583c17a49d26a7990:/src/univ/textctrl.cpp diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index 54c170b068..17ed256745 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -165,6 +165,33 @@ #include "wx/tokenzr.h" #endif // WXDEBUG_TEXT_REPLACE +// ---------------------------------------------------------------------------- +// 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; +}; + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -751,7 +778,7 @@ wxTextCtrl::~wxTextCtrl() // set/get the value // ---------------------------------------------------------------------------- -void wxTextCtrl::SetValue(const wxString& value) +void wxTextCtrl::ChangeValue(const wxString& value) { if ( IsSingleLine() && (value == GetValue()) ) { @@ -765,8 +792,12 @@ void wxTextCtrl::SetValue(const wxString& value) { SetInsertionPoint(0); } +} - // TODO: should we generate the event or not, finally? +void wxTextCtrl::SetValue(const wxString& value) +{ + ChangeValue(value); + SendTextUpdatedEvent(); } const wxArrayString& wxTextCtrl::GetLines() const @@ -4722,6 +4753,14 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) event.Skip(); } +/* static */ +wxInputHandler *wxTextCtrl::GetStdInputHandler(wxInputHandler *handlerDef) +{ + static wxStdTextCtrlInputHandler s_handler(handlerDef); + + return &s_handler; +} + // ---------------------------------------------------------------------------- // wxStdTextCtrlInputHandler // ----------------------------------------------------------------------------