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

@@ -99,6 +99,7 @@ public:
virtual void ShowPosition(long pos); virtual void ShowPosition(long pos);
// overrides so that we can send text updated events // overrides so that we can send text updated events
virtual void Copy();
virtual void Cut(); virtual void Cut();
virtual void Paste(); virtual void Paste();

View File

@@ -314,13 +314,31 @@ void wxTextCtrl::Clear()
SendTextUpdatedEvent(); 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() void wxTextCtrl::Cut()
{ {
if (CanCut()) 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()) 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 // TODO: eventually we should add setting the default style again
SendTextUpdatedEvent(); SendTextUpdatedEvent();
}
} }
} }