]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/textctrl.cpp
compilation fix after last commit (apparently patch was misapplied)
[wxWidgets.git] / src / univ / textctrl.cpp
index 8de05acfcd5c7801b649278608c888f7ec8f4e52..17ed256745af3b68c26d4d8c5664439a096d0d4d 100644 (file)
     #include "wx/log.h"
     #include "wx/dcclient.h"
     #include "wx/validate.h"
+    #include "wx/dataobj.h"
 #endif
 
 #include <ctype.h>
 
 #include "wx/cmdproc.h"
 
-#if wxUSE_CLIPBOARD
-#include "wx/dataobj.h"
-#endif
-
 // turn extra wxTextCtrl-specific debugging on/off
 #define WXDEBUG_TEXT
 
     #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
 // ----------------------------------------------------------------------------
@@ -754,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()) )
     {
@@ -768,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
@@ -4725,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
 // ----------------------------------------------------------------------------