widget: Add gtk_widget_get_clipboard()

... and gtk_widget_get_primary_clipboard().

They both give out the new GdkClipboard.
This commit is contained in:
Benjamin Otte 2017-11-25 23:55:34 +01:00
parent a59572f96d
commit 54c8a4b3b7
3 changed files with 50 additions and 0 deletions

View File

@ -4530,6 +4530,8 @@ gtk_widget_freeze_child_notify
gtk_widget_get_child_visible
gtk_widget_get_parent
gtk_widget_get_settings
gtk_widget_get_clipboard
gtk_widget_get_primary_clipboard
gtk_widget_get_old_clipboard
gtk_widget_get_display
gtk_widget_get_size_request

View File

@ -12379,6 +12379,50 @@ gtk_widget_set_margin_bottom (GtkWidget *widget,
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_MARGIN_BOTTOM]);
}
/**
* gtk_widget_get_clipboard:
* @widget: a #GtkWidget
*
* This is a utility function to get the clipboard object for the
* #GdkDisplay that @widget is using.
*
* Note that this function always works, even when @widget is not
* realized yet.
*
* Returns: (transfer none): the appropriate clipboard object.
*
* Since: 3.94
**/
GdkClipboard *
gtk_widget_get_clipboard (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return gdk_display_get_clipboard (gtk_widget_get_display (widget));
}
/**
* gtk_widget_get_primary_clipboard:
* @widget: a #GtkWidget
*
* This is a utility function to get the primary clipboard object
* for the #GdkDisplay that @widget is using.
*
* Note that this function always works, even when @widget is not
* realized yet.
*
* Returns: (transfer none): the appropriate clipboard object.
*
* Since: 3.94
**/
GdkClipboard *
gtk_widget_get_primary_clipboard (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return gdk_display_get_primary_clipboard (gtk_widget_get_display (widget));
}
/**
* gtk_widget_get_old_clipboard:
* @widget: a #GtkWidget

View File

@ -782,6 +782,10 @@ GDK_AVAILABLE_IN_ALL
GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
GDK_AVAILABLE_IN_3_94
GdkClipboard *gtk_widget_get_clipboard (GtkWidget *widget);
GDK_AVAILABLE_IN_3_94
GdkClipboard *gtk_widget_get_primary_clipboard (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GtkClipboard *gtk_widget_get_old_clipboard (GtkWidget *widget,
GdkAtom selection);