Remove old workarounds to get cut, copy, and paste working in embedded wxTextCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -418,9 +418,6 @@ enum wxPG_KEYBOARD_ACTIONS
|
|||||||
wxPG_ACTION_EXPAND_PROPERTY,
|
wxPG_ACTION_EXPAND_PROPERTY,
|
||||||
wxPG_ACTION_COLLAPSE_PROPERTY,
|
wxPG_ACTION_COLLAPSE_PROPERTY,
|
||||||
wxPG_ACTION_CANCEL_EDIT,
|
wxPG_ACTION_CANCEL_EDIT,
|
||||||
wxPG_ACTION_CUT,
|
|
||||||
wxPG_ACTION_COPY,
|
|
||||||
wxPG_ACTION_PASTE,
|
|
||||||
wxPG_ACTION_PRESS_BUTTON, // Causes editor button (if any) to be pressed
|
wxPG_ACTION_PRESS_BUTTON, // Causes editor button (if any) to be pressed
|
||||||
wxPG_ACTION_MAX
|
wxPG_ACTION_MAX
|
||||||
};
|
};
|
||||||
|
@@ -265,9 +265,6 @@ enum wxPG_KEYBOARD_ACTIONS
|
|||||||
wxPG_ACTION_EXPAND_PROPERTY,
|
wxPG_ACTION_EXPAND_PROPERTY,
|
||||||
wxPG_ACTION_COLLAPSE_PROPERTY,
|
wxPG_ACTION_COLLAPSE_PROPERTY,
|
||||||
wxPG_ACTION_CANCEL_EDIT,
|
wxPG_ACTION_CANCEL_EDIT,
|
||||||
wxPG_ACTION_CUT,
|
|
||||||
wxPG_ACTION_COPY,
|
|
||||||
wxPG_ACTION_PASTE,
|
|
||||||
wxPG_ACTION_MAX
|
wxPG_ACTION_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -579,12 +579,6 @@ void wxPropertyGrid::Init1()
|
|||||||
AddActionTrigger( wxPG_ACTION_EXPAND_PROPERTY, WXK_RIGHT);
|
AddActionTrigger( wxPG_ACTION_EXPAND_PROPERTY, WXK_RIGHT);
|
||||||
AddActionTrigger( wxPG_ACTION_COLLAPSE_PROPERTY, WXK_LEFT);
|
AddActionTrigger( wxPG_ACTION_COLLAPSE_PROPERTY, WXK_LEFT);
|
||||||
AddActionTrigger( wxPG_ACTION_CANCEL_EDIT, WXK_ESCAPE );
|
AddActionTrigger( wxPG_ACTION_CANCEL_EDIT, WXK_ESCAPE );
|
||||||
AddActionTrigger( wxPG_ACTION_CUT, 'X', wxMOD_CONTROL );
|
|
||||||
AddActionTrigger( wxPG_ACTION_CUT, WXK_DELETE, wxMOD_SHIFT );
|
|
||||||
AddActionTrigger( wxPG_ACTION_COPY, 'C', wxMOD_CONTROL);
|
|
||||||
AddActionTrigger( wxPG_ACTION_COPY, WXK_INSERT, wxMOD_CONTROL );
|
|
||||||
AddActionTrigger( wxPG_ACTION_PASTE, 'V', wxMOD_CONTROL );
|
|
||||||
AddActionTrigger( wxPG_ACTION_PASTE, WXK_INSERT, wxMOD_SHIFT );
|
|
||||||
AddActionTrigger( wxPG_ACTION_PRESS_BUTTON, WXK_DOWN, wxMOD_ALT );
|
AddActionTrigger( wxPG_ACTION_PRESS_BUTTON, WXK_DOWN, wxMOD_ALT );
|
||||||
AddActionTrigger( wxPG_ACTION_PRESS_BUTTON, WXK_F4 );
|
AddActionTrigger( wxPG_ACTION_PRESS_BUTTON, WXK_F4 );
|
||||||
|
|
||||||
@@ -4971,17 +4965,6 @@ void wxPropertyGrid::ClearActionTriggers( int action )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyTextToClipboard( const wxString& text )
|
|
||||||
{
|
|
||||||
if ( wxTheClipboard->Open() )
|
|
||||||
{
|
|
||||||
// This data objects are held by the clipboard,
|
|
||||||
// so do not delete them in the app.
|
|
||||||
wxTheClipboard->SetData( new wxTextDataObject(text) );
|
|
||||||
wxTheClipboard->Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -5022,12 +5005,6 @@ void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
|||||||
|
|
||||||
wxPGProperty* p = m_selected;
|
wxPGProperty* p = m_selected;
|
||||||
|
|
||||||
if ( action == wxPG_ACTION_COPY )
|
|
||||||
{
|
|
||||||
CopyTextToClipboard(p->GetDisplayedString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Travel and expand/collapse
|
// Travel and expand/collapse
|
||||||
int selectDir = -2;
|
int selectDir = -2;
|
||||||
|
|
||||||
@@ -5071,7 +5048,6 @@ void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
|
|||||||
DoSelectProperty(p);
|
DoSelectProperty(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If nothing was selected, select the first item now
|
// If nothing was selected, select the first item now
|
||||||
@@ -5122,64 +5098,6 @@ bool wxPropertyGrid::HandleChildKey( wxKeyEvent& event )
|
|||||||
res = false;
|
res = false;
|
||||||
UnfocusEditor();
|
UnfocusEditor();
|
||||||
}
|
}
|
||||||
else if ( action == wxPG_ACTION_COPY )
|
|
||||||
{
|
|
||||||
// NB: There is some problem with getting native cut-copy-paste keys to go through
|
|
||||||
// for embedded editor wxTextCtrl. This is why we emulate.
|
|
||||||
//
|
|
||||||
wxTextCtrl* tc = GetEditorTextCtrl();
|
|
||||||
if ( tc )
|
|
||||||
{
|
|
||||||
wxString sel = tc->GetStringSelection();
|
|
||||||
if ( sel.length() )
|
|
||||||
CopyTextToClipboard(sel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CopyTextToClipboard(m_selected->GetDisplayedString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( action == wxPG_ACTION_CUT )
|
|
||||||
{
|
|
||||||
wxTextCtrl* tc = GetEditorTextCtrl();
|
|
||||||
if ( tc )
|
|
||||||
{
|
|
||||||
long from, to;
|
|
||||||
tc->GetSelection(&from, &to);
|
|
||||||
if ( from < to )
|
|
||||||
{
|
|
||||||
CopyTextToClipboard(tc->GetStringSelection());
|
|
||||||
tc->Remove(from, to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( action == wxPG_ACTION_PASTE )
|
|
||||||
{
|
|
||||||
wxTextCtrl* tc = GetEditorTextCtrl();
|
|
||||||
if ( tc )
|
|
||||||
{
|
|
||||||
if (wxTheClipboard->Open())
|
|
||||||
{
|
|
||||||
if (wxTheClipboard->IsSupported( wxDF_TEXT ))
|
|
||||||
{
|
|
||||||
wxTextDataObject data;
|
|
||||||
wxTheClipboard->GetData( data );
|
|
||||||
long from, to;
|
|
||||||
tc->GetSelection(&from, &to);
|
|
||||||
if ( from < to )
|
|
||||||
{
|
|
||||||
tc->Remove(from, to);
|
|
||||||
tc->WriteText(data.GetText());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tc->WriteText(data.GetText());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wxTheClipboard->Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user