implemented clipboard events support for wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -462,6 +462,48 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// clipboard events: "copy-clipboard", "cut-clipboard", "paste-clipboard"
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// common part of the event handlers below
|
||||||
|
static void
|
||||||
|
handle_text_clipboard_callback( GtkWidget *widget, wxTextCtrl *win,
|
||||||
|
wxEventType eventType, const gchar * signal_name)
|
||||||
|
{
|
||||||
|
wxClipboardTextEvent event( eventType, win->GetId() );
|
||||||
|
event.SetEventObject( win );
|
||||||
|
if ( win->GetEventHandler()->ProcessEvent( event ) )
|
||||||
|
{
|
||||||
|
// don't let the default processing to take place if we did something
|
||||||
|
// ourselves in the event handler
|
||||||
|
g_signal_stop_emission_by_name (widget, signal_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static void
|
||||||
|
gtk_copy_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
|
||||||
|
{
|
||||||
|
handle_text_clipboard_callback(
|
||||||
|
widget, win, wxEVT_COMMAND_TEXT_COPY, "copy-clipboard" );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_cut_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
|
||||||
|
{
|
||||||
|
handle_text_clipboard_callback(
|
||||||
|
widget, win, wxEVT_COMMAND_TEXT_CUT, "cut-clipboard" );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_paste_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
|
||||||
|
{
|
||||||
|
handle_text_clipboard_callback(
|
||||||
|
widget, win, wxEVT_COMMAND_TEXT_PASTE, "paste-clipboard" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "expose_event" from scrolled window and textview
|
// "expose_event" from scrolled window and textview
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -716,6 +758,13 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
G_CALLBACK (gtk_text_changed_callback), this);
|
G_CALLBACK (gtk_text_changed_callback), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_signal_connect (m_text, "copy-clipboard",
|
||||||
|
G_CALLBACK (gtk_copy_clipboard_callback), this);
|
||||||
|
g_signal_connect (m_text, "cut-clipboard",
|
||||||
|
G_CALLBACK (gtk_cut_clipboard_callback), this);
|
||||||
|
g_signal_connect (m_text, "paste-clipboard",
|
||||||
|
G_CALLBACK (gtk_paste_clipboard_callback), this);
|
||||||
|
|
||||||
m_cursor = wxCursor( wxCURSOR_IBEAM );
|
m_cursor = wxCursor( wxCURSOR_IBEAM );
|
||||||
|
|
||||||
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
|
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
|
||||||
|
Reference in New Issue
Block a user