1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| static void Edit_Cut(GtkWidget *w,gpointer data)
{
GtkTextBuffer *p_TextBuffer = NULL ;
GtkTextIter start ;
GtkTextIter end ;
GtkClipboard *p_Clipboard ;
gchar *lpszString ;
p_TextBuffer = gtk_text_view_get_buffer(p_Edit) ;
if(p_TextBuffer)
{
if(gtk_text_buffer_get_selection_bounds(p_TextBuffer,&start,&end))
{
lpszString = gtk_text_buffer_get_text(p_TextBuffer,&start,&end,TRUE) ;
p_Clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD) ;
gtk_clipboard_set_text(p_Clipboard,lpszString,-1) ;
gtk_text_buffer_delete_selection(p_TextBuffer,TRUE,TRUE) ;
g_free(lpszString) ;
}
}
return ;
} |