Add gtk_widget_set_window()

New function as replacement for setting widget->window directly.
Should only be used in GtkWidget::realize().
This commit is contained in:
Michael Natterer 2009-08-28 16:51:48 +02:00
parent 0e52286d53
commit cc8927a589
3 changed files with 38 additions and 3 deletions

View File

@ -5088,6 +5088,7 @@ gtk_widget_set_tooltip_markup
gtk_widget_set_tooltip_text gtk_widget_set_tooltip_text
gtk_widget_set_tooltip_window gtk_widget_set_tooltip_window
gtk_widget_set_visible gtk_widget_set_visible
gtk_widget_set_window
gtk_widget_shape_combine_mask gtk_widget_shape_combine_mask
gtk_widget_input_shape_combine_mask gtk_widget_input_shape_combine_mask
gtk_widget_show gtk_widget_show

View File

@ -5737,8 +5737,8 @@ gtk_widget_is_drawable (GtkWidget *widget)
{ {
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0 && return ((GTK_WIDGET_FLAGS (widget) & GTK_VISIBLE) != 0 &&
(GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0); (GTK_WIDGET_FLAGS (widget) & GTK_MAPPED) != 0);
} }
/** /**
@ -10835,6 +10835,37 @@ gtk_widget_set_allocation (GtkWidget *widget,
widget->allocation = *allocation; widget->allocation = *allocation;
} }
/**
* gtk_widget_set_window:
* @widget: a #GtkWidget
* @window: a #GdkWindow
*
* Sets a widget's window. This function should only be used in a
* widget's GtkWidget::realize() implementation. The %window passed is
* usually either new window created with gdk_window_new(), or the
* window of its parent widget as returned by
* gtk_widget_get_parent_window().
*
* Widgets must indicate whether they will create their own #GdkWindow
* by calling gtk_widget_set_has_window(). This is usually done in the
* widget's init() function.
*
* Since: 2.18
*/
void
gtk_widget_set_window (GtkWidget *widget,
GdkWindow *window)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (widget->window != window)
{
widget->window = window;
g_object_notify (G_OBJECT (widget), "window");
}
}
/** /**
* gtk_widget_get_window: * gtk_widget_get_window:
* @widget: a #GtkWidget * @widget: a #GtkWidget

View File

@ -609,7 +609,10 @@ GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
void gtk_widget_set_child_visible (GtkWidget *widget, void gtk_widget_set_child_visible (GtkWidget *widget,
gboolean is_visible); gboolean is_visible);
gboolean gtk_widget_get_child_visible (GtkWidget *widget); gboolean gtk_widget_get_child_visible (GtkWidget *widget);
GdkWindow* gtk_widget_get_window (GtkWidget *widget);
void gtk_widget_set_window (GtkWidget *widget,
GdkWindow *window);
GdkWindow * gtk_widget_get_window (GtkWidget *widget);
void gtk_widget_get_allocation (GtkWidget *widget, void gtk_widget_get_allocation (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);