Commit 40408e74 authored by Michael Natterer's avatar Michael Natterer 😴

Two more getters for flags plus one new property

More stuff based on patches from Christian Dywan:
- gtk_widget_get_app_paintable()
- gtk_widget_get_double_buffered()
- r/w property "double-buffered"
parent 33ada9e9
......@@ -4957,6 +4957,7 @@ gtk_widget_event
gtk_widget_freeze_child_notify
gtk_widget_get_accessible
gtk_widget_get_ancestor
gtk_widget_get_app_paintable
gtk_widget_get_child_requisition
gtk_widget_get_child_visible
gtk_widget_get_clipboard
......@@ -4968,6 +4969,7 @@ gtk_widget_get_default_style
gtk_widget_get_default_visual
gtk_widget_get_direction
gtk_widget_get_display
gtk_widget_get_double_buffered
gtk_widget_get_events
gtk_widget_get_extension_events
gtk_widget_get_has_tooltip
......
......@@ -154,7 +154,8 @@ enum {
PROP_HAS_TOOLTIP,
PROP_TOOLTIP_MARKUP,
PROP_TOOLTIP_TEXT,
PROP_WINDOW
PROP_WINDOW,
PROP_DOUBLE_BUFFERED
};
typedef struct _GtkStateData GtkStateData;
......@@ -692,6 +693,21 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GDK_TYPE_WINDOW,
GTK_PARAM_READABLE));
/**
* GtkWidget::double-buffered
*
* Whether or not the widget is double buffered.
*
* Since: 2.18
*/
g_object_class_install_property (gobject_class,
PROP_DOUBLE_BUFFERED,
g_param_spec_boolean ("double-buffered",
P_("Double Buffered"),
P_("Whether or not the widget is double buffered"),
TRUE,
GTK_PARAM_READWRITE));
widget_signals[SHOW] =
g_signal_new (I_("show"),
G_TYPE_FROM_CLASS (gobject_class),
......@@ -2523,6 +2539,9 @@ gtk_widget_set_property (GObject *object,
if (GTK_WIDGET_VISIBLE (widget))
gtk_widget_queue_tooltip_query (widget);
break;
case PROP_DOUBLE_BUFFERED:
gtk_widget_set_double_buffered (widget, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -2630,6 +2649,9 @@ gtk_widget_get_property (GObject *object,
case PROP_WINDOW:
g_value_set_object (value, gtk_widget_get_window (widget));
break;
case PROP_DOUBLE_BUFFERED:
g_value_set_boolean (value, gtk_widget_get_double_buffered (widget));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -5650,6 +5672,27 @@ gtk_widget_set_app_paintable (GtkWidget *widget,
}
}
/**
* gtk_widget_get_app_paintable:
* @widget: a #GtkWidget
*
* Determines whether the application intends to draw on the widget in
* an #GtkWidget::expose-event handler.
*
* See gtk_widget_set_app_paintable()
*
* Return value: %TRUE if the widget is app paintable
*
* Since: 2.18
**/
gboolean
gtk_widget_get_app_paintable (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return (GTK_WIDGET_FLAGS (widget) & GTK_APP_PAINTABLE) != 0;
}
/**
* gtk_widget_set_double_buffered:
* @widget: a #GtkWidget
......@@ -5680,10 +5723,35 @@ gtk_widget_set_double_buffered (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (double_buffered)
GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED);
if (double_buffered != GTK_WIDGET_DOUBLE_BUFFERED (widget))
{
if (double_buffered)
GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED);
g_object_notify (G_OBJECT (widget), "double-buffered");
}
}
/**
* gtk_widget_get_double_buffered:
* @widget: a #GtkWidget
*
* Determines whether the widget is double buffered.
*
* See gtk_widget_set_double_buffered()
*
* Return value: %TRUE if the widget is double buffered
*
* Since: 2.18
**/
gboolean
gtk_widget_get_double_buffered (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return (GTK_WIDGET_FLAGS (widget) & GTK_DOUBLE_BUFFERED) != 0;
}
/**
......
......@@ -580,8 +580,12 @@ gboolean gtk_widget_get_has_window (GtkWidget *widget);
void gtk_widget_set_app_paintable (GtkWidget *widget,
gboolean app_paintable);
gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
void gtk_widget_set_double_buffered (GtkWidget *widget,
gboolean double_buffered);
gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
gboolean redraw_on_allocate);
void gtk_widget_set_parent (GtkWidget *widget,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment