From ac349b6e662fbd445618f13dc3d9ae881c1e7ebf Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 6 Apr 2010 16:51:12 +0000 Subject: [PATCH] adding clipboard events, fixes #11906 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/textctrl.h | 1 + src/osx/textctrl_osx.cpp | 33 ++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include/wx/osx/textctrl.h b/include/wx/osx/textctrl.h index 762bf34a18..988340df21 100644 --- a/include/wx/osx/textctrl.h +++ b/include/wx/osx/textctrl.h @@ -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(); diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 4262ff2301..869fcb5b50 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -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(); + } } } -- 2.45.2