]> git.saurik.com Git - wxWidgets.git/commitdiff
adding clipboard events, fixes #11906
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 6 Apr 2010 16:51:12 +0000 (16:51 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 6 Apr 2010 16:51:12 +0000 (16:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/textctrl.h
src/osx/textctrl_osx.cpp

index 762bf34a18b1903c4a9e5d1bca643f2a6b9e8709..988340df218c7b536cfd18cf9cc4958afa3a6028 100644 (file)
@@ -99,6 +99,7 @@ public:
     virtual void ShowPosition(long pos);
 
     // overrides so that we can send text updated events
+    virtual void Copy();
     virtual void Cut();
     virtual void Paste();
     
index 4262ff230147b72d8eb259b2f56fc011e5a413a9..869fcb5b506bd5125c0ded290a3ffbe576cbdb2a 100644 (file)
@@ -314,13 +314,31 @@ void wxTextCtrl::Clear()
     SendTextUpdatedEvent();
 }
 
+void wxTextCtrl::Copy()
+{
+    if (CanCopy())
+    {
+        wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_COPY, GetId());        
+        evt.SetEventObject(this);
+        if (!GetEventHandler()->ProcessEvent(evt))
+        {
+            wxTextEntry::Copy();
+        }
+    }
+}
+
 void wxTextCtrl::Cut()
 {
     if (CanCut())
     {
-        wxTextEntry::Cut() ;
+        wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_CUT, GetId());        
+        evt.SetEventObject(this);
+        if (!GetEventHandler()->ProcessEvent(evt))
+        {
+            wxTextEntry::Cut();
 
-        SendTextUpdatedEvent();
+            SendTextUpdatedEvent();
+        }
     }
 }
 
@@ -328,10 +346,15 @@ void wxTextCtrl::Paste()
 {
     if (CanPaste())
     {
-        wxTextEntry::Paste();
+        wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_PASTE, GetId());        
+        evt.SetEventObject(this);
+        if (!GetEventHandler()->ProcessEvent(evt))
+        {
+            wxTextEntry::Paste();
 
-        // TODO: eventually we should add setting the default style again
-        SendTextUpdatedEvent();
+            // TODO: eventually we should add setting the default style again
+            SendTextUpdatedEvent();
+        }
     }
 }