adding clipboard events, fixes #11906

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2010-04-06 16:51:12 +00:00
parent b11b437e8d
commit ac349b6e66
2 changed files with 29 additions and 5 deletions

View 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();
}
}
}