[gtk/wip/baedert/for-master: 38/58] widget: Move a few vfunc implementations above class_init
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 38/58] widget: Move a few vfunc implementations above class_init
- Date: Sun, 3 Jan 2021 11:36:30 +0000 (UTC)
commit ebdf2989f87290e7ff044002b0723647b470eaa8
Author: Timm Bäder <mail baedert org>
Date: Sun Dec 27 12:57:22 2020 +0100
widget: Move a few vfunc implementations above class_init
And save us the prototypes at the top of the file this way.
gtk/gtkwidget.c | 789 +++++++++++++++++++++++++++-----------------------------
1 file changed, 380 insertions(+), 409 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b26103e87b..dd1d7cfd00 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -539,14 +539,6 @@ static void gtk_widget_class_init (GtkWidgetClass *klass);
static void gtk_widget_base_class_finalize (GtkWidgetClass *klass);
static void gtk_widget_init (GTypeInstance *instance,
gpointer g_class);
-static void gtk_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
static void gtk_widget_dispose (GObject *object);
static void gtk_widget_finalize (GObject *object);
static void gtk_widget_real_destroy (GtkWidget *object);
@@ -558,18 +550,9 @@ static void gtk_widget_real_map (GtkWidget *widget);
static void gtk_widget_real_unmap (GtkWidget *widget);
static void gtk_widget_real_realize (GtkWidget *widget);
static void gtk_widget_real_unrealize (GtkWidget *widget);
-static void gtk_widget_real_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline);
static void gtk_widget_real_direction_changed(GtkWidget *widget,
GtkTextDirection previous_direction);
-static gboolean gtk_widget_real_query_tooltip (GtkWidget *widget,
- int x,
- int y,
- gboolean keyboard_tip,
- GtkTooltip *tooltip);
static void gtk_widget_real_css_changed (GtkWidget *widget,
GtkCssStyleChange *change);
static void gtk_widget_real_system_setting_changed (GtkWidget *widget,
@@ -596,16 +579,6 @@ static void gtk_widget_propagate_state (GtkWidget
const GtkStateData *data);
static gboolean gtk_widget_real_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
-static void gtk_widget_real_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline);
-static void gtk_widget_real_state_flags_changed (GtkWidget *widget,
- GtkStateFlags old_state);
-
static void gtk_widget_accessible_interface_init (GtkAccessibleInterface *iface);
static void gtk_widget_buildable_interface_init (GtkBuildableIface *iface);
@@ -638,8 +611,6 @@ static void gtk_widget_set_accessible_role (GtkWidget
GtkAccessibleRole role);
static GtkAccessibleRole gtk_widget_get_accessible_role (GtkWidget *self);
-static GtkSizeRequestMode gtk_widget_real_get_request_mode (GtkWidget *widget);
-
static void template_data_free (GtkWidgetTemplate*template_data);
static void gtk_widget_set_usize_internal (GtkWidget *widget,
@@ -745,7 +716,7 @@ gtk_widget_base_class_init (gpointer g_class)
GtkWidgetClassPrivate *priv;
priv = klass->priv = G_TYPE_CLASS_GET_PRIVATE (g_class, GTK_TYPE_WIDGET, GtkWidgetClassPrivate);
-
+
priv->template = NULL;
if (priv->shortcuts == NULL)
@@ -864,6 +835,305 @@ gtk_widget_constructed (GObject *object)
}
}
+static void
+gtk_widget_real_measure (GtkWidget *widget,
+ GtkOrientation orientation,
+ int for_size,
+ int *minimum,
+ int *natural,
+ int *minimum_baseline,
+ int *natural_baseline)
+{
+ *minimum = 0;
+ *natural = 0;
+}
+
+static GtkSizeRequestMode
+gtk_widget_real_get_request_mode (GtkWidget *widget)
+{
+ /* By default widgets don't trade size at all. */
+ return GTK_SIZE_REQUEST_CONSTANT_SIZE;
+}
+
+static void
+gtk_widget_real_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags old_state)
+{
+}
+
+static gboolean
+gtk_widget_real_query_tooltip (GtkWidget *widget,
+ int x,
+ int y,
+ gboolean keyboard_tip,
+ GtkTooltip *tooltip)
+{
+ const char *tooltip_markup;
+ gboolean has_tooltip;
+
+ has_tooltip = gtk_widget_get_has_tooltip (widget);
+ tooltip_markup = gtk_widget_get_tooltip_markup (widget);
+ if (tooltip_markup == NULL)
+ tooltip_markup = gtk_widget_get_tooltip_text (widget);
+
+ if (has_tooltip && tooltip_markup != NULL)
+ {
+ gtk_tooltip_set_markup (tooltip, tooltip_markup);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+gtk_widget_real_size_allocate (GtkWidget *widget,
+ int width,
+ int height,
+ int baseline)
+{
+}
+
+static void
+gtk_widget_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkWidget *widget = GTK_WIDGET (object);
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ gtk_widget_set_name (widget, g_value_get_string (value));
+ break;
+ case PROP_WIDTH_REQUEST:
+ gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2);
+ break;
+ case PROP_HEIGHT_REQUEST:
+ gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value));
+ break;
+ case PROP_VISIBLE:
+ gtk_widget_set_visible (widget, g_value_get_boolean (value));
+ break;
+ case PROP_SENSITIVE:
+ gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
+ break;
+ case PROP_CAN_FOCUS:
+ gtk_widget_set_can_focus (widget, g_value_get_boolean (value));
+ break;
+ case PROP_FOCUSABLE:
+ gtk_widget_set_focusable (widget, g_value_get_boolean (value));
+ break;
+ case PROP_CAN_TARGET:
+ gtk_widget_set_can_target (widget, g_value_get_boolean (value));
+ break;
+ case PROP_FOCUS_ON_CLICK:
+ gtk_widget_set_focus_on_click (widget, g_value_get_boolean (value));
+ break;
+ case PROP_RECEIVES_DEFAULT:
+ gtk_widget_set_receives_default (widget, g_value_get_boolean (value));
+ break;
+ case PROP_CURSOR:
+ gtk_widget_set_cursor (widget, g_value_get_object (value));
+ break;
+ case PROP_HAS_TOOLTIP:
+ gtk_widget_set_has_tooltip (widget, g_value_get_boolean (value));
+ break;
+ case PROP_TOOLTIP_MARKUP:
+ gtk_widget_set_tooltip_markup (widget, g_value_get_string (value));
+ break;
+ case PROP_TOOLTIP_TEXT:
+ gtk_widget_set_tooltip_text (widget, g_value_get_string (value));
+ break;
+ case PROP_HALIGN:
+ gtk_widget_set_halign (widget, g_value_get_enum (value));
+ break;
+ case PROP_VALIGN:
+ gtk_widget_set_valign (widget, g_value_get_enum (value));
+ break;
+ case PROP_MARGIN_START:
+ gtk_widget_set_margin_start (widget, g_value_get_int (value));
+ break;
+ case PROP_MARGIN_END:
+ gtk_widget_set_margin_end (widget, g_value_get_int (value));
+ break;
+ case PROP_MARGIN_TOP:
+ gtk_widget_set_margin_top (widget, g_value_get_int (value));
+ break;
+ case PROP_MARGIN_BOTTOM:
+ gtk_widget_set_margin_bottom (widget, g_value_get_int (value));
+ break;
+ case PROP_HEXPAND:
+ gtk_widget_set_hexpand (widget, g_value_get_boolean (value));
+ break;
+ case PROP_HEXPAND_SET:
+ gtk_widget_set_hexpand_set (widget, g_value_get_boolean (value));
+ break;
+ case PROP_VEXPAND:
+ gtk_widget_set_vexpand (widget, g_value_get_boolean (value));
+ break;
+ case PROP_VEXPAND_SET:
+ gtk_widget_set_vexpand_set (widget, g_value_get_boolean (value));
+ break;
+ case PROP_OPACITY:
+ gtk_widget_set_opacity (widget, g_value_get_double (value));
+ break;
+ case PROP_OVERFLOW:
+ gtk_widget_set_overflow (widget, g_value_get_enum (value));
+ break;
+ case PROP_CSS_NAME:
+ if (g_value_get_string (value) != NULL)
+ gtk_css_node_set_name (priv->cssnode, g_quark_from_string (g_value_get_string (value)));
+ break;
+ case PROP_CSS_CLASSES:
+ gtk_widget_set_css_classes (widget, g_value_get_boxed (value));
+ break;
+ case PROP_LAYOUT_MANAGER:
+ gtk_widget_set_layout_manager (widget, g_value_dup_object (value));
+ break;
+ case PROP_ACCESSIBLE_ROLE:
+ gtk_widget_set_accessible_role (widget, g_value_get_enum (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_widget_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkWidget *widget = GTK_WIDGET (object);
+ GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ if (priv->name)
+ g_value_set_string (value, priv->name);
+ else
+ g_value_set_static_string (value, "");
+ break;
+ case PROP_PARENT:
+ g_value_set_object (value, priv->parent);
+ break;
+ case PROP_ROOT:
+ g_value_set_object (value, priv->root);
+ break;
+ case PROP_WIDTH_REQUEST:
+ {
+ int w;
+ gtk_widget_get_size_request (widget, &w, NULL);
+ g_value_set_int (value, w);
+ }
+ break;
+ case PROP_HEIGHT_REQUEST:
+ {
+ int h;
+ gtk_widget_get_size_request (widget, NULL, &h);
+ g_value_set_int (value, h);
+ }
+ break;
+ case PROP_VISIBLE:
+ g_value_set_boolean (value, _gtk_widget_get_visible (widget));
+ break;
+ case PROP_SENSITIVE:
+ g_value_set_boolean (value, gtk_widget_get_sensitive (widget));
+ break;
+ case PROP_CAN_FOCUS:
+ g_value_set_boolean (value, gtk_widget_get_can_focus (widget));
+ break;
+ case PROP_FOCUSABLE:
+ g_value_set_boolean (value, gtk_widget_get_focusable (widget));
+ break;
+ case PROP_HAS_FOCUS:
+ g_value_set_boolean (value, gtk_widget_has_focus (widget));
+ break;
+ case PROP_CAN_TARGET:
+ g_value_set_boolean (value, gtk_widget_get_can_target (widget));
+ break;
+ case PROP_FOCUS_ON_CLICK:
+ g_value_set_boolean (value, gtk_widget_get_focus_on_click (widget));
+ break;
+ case PROP_HAS_DEFAULT:
+ g_value_set_boolean (value, gtk_widget_has_default (widget));
+ break;
+ case PROP_RECEIVES_DEFAULT:
+ g_value_set_boolean (value, gtk_widget_get_receives_default (widget));
+ break;
+ case PROP_CURSOR:
+ g_value_set_object (value, gtk_widget_get_cursor (widget));
+ break;
+ case PROP_HAS_TOOLTIP:
+ g_value_set_boolean (value, gtk_widget_get_has_tooltip (widget));
+ break;
+ case PROP_TOOLTIP_TEXT:
+ g_value_set_string (value, gtk_widget_get_tooltip_text (widget));
+ break;
+ case PROP_TOOLTIP_MARKUP:
+ g_value_set_string (value, gtk_widget_get_tooltip_markup (widget));
+ break;
+ case PROP_HALIGN:
+ g_value_set_enum (value, gtk_widget_get_halign (widget));
+ break;
+ case PROP_VALIGN:
+ g_value_set_enum (value, gtk_widget_get_valign (widget));
+ break;
+ case PROP_MARGIN_START:
+ g_value_set_int (value, gtk_widget_get_margin_start (widget));
+ break;
+ case PROP_MARGIN_END:
+ g_value_set_int (value, gtk_widget_get_margin_end (widget));
+ break;
+ case PROP_MARGIN_TOP:
+ g_value_set_int (value, gtk_widget_get_margin_top (widget));
+ break;
+ case PROP_MARGIN_BOTTOM:
+ g_value_set_int (value, gtk_widget_get_margin_bottom (widget));
+ break;
+ case PROP_HEXPAND:
+ g_value_set_boolean (value, gtk_widget_get_hexpand (widget));
+ break;
+ case PROP_HEXPAND_SET:
+ g_value_set_boolean (value, gtk_widget_get_hexpand_set (widget));
+ break;
+ case PROP_VEXPAND:
+ g_value_set_boolean (value, gtk_widget_get_vexpand (widget));
+ break;
+ case PROP_VEXPAND_SET:
+ g_value_set_boolean (value, gtk_widget_get_vexpand_set (widget));
+ break;
+ case PROP_OPACITY:
+ g_value_set_double (value, gtk_widget_get_opacity (widget));
+ break;
+ case PROP_OVERFLOW:
+ g_value_set_enum (value, gtk_widget_get_overflow (widget));
+ break;
+ case PROP_SCALE_FACTOR:
+ g_value_set_int (value, gtk_widget_get_scale_factor (widget));
+ break;
+ case PROP_CSS_NAME:
+ g_value_set_string (value, gtk_widget_get_css_name (widget));
+ break;
+ case PROP_CSS_CLASSES:
+ g_value_take_boxed (value, gtk_widget_get_css_classes (widget));
+ break;
+ case PROP_LAYOUT_MANAGER:
+ g_value_set_object (value, gtk_widget_get_layout_manager (widget));
+ break;
+ case PROP_ACCESSIBLE_ROLE:
+ g_value_set_enum (value, gtk_widget_get_accessible_role (widget));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
@@ -1541,332 +1811,91 @@ gtk_widget_class_init (GtkWidgetClass *klass)
*/
widget_signals[MOVE_FOCUS] =
g_signal_new (I_("move-focus"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkWidgetClass, move_focus),
- NULL, NULL,
- NULL,
- G_TYPE_NONE,
- 1,
- GTK_TYPE_DIRECTION_TYPE);
-
- /**
- * GtkWidget::keynav-failed:
- * @widget: the object which received the signal
- * @direction: the direction of movement
- *
- * Gets emitted if keyboard navigation fails.
- * See gtk_widget_keynav_failed() for details.
- *
- * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE
- * if the emitting widget should try to handle the keyboard
- * navigation attempt in its parent widget(s).
- **/
- widget_signals[KEYNAV_FAILED] =
- g_signal_new (I_("keynav-failed"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkWidgetClass, keynav_failed),
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__ENUM,
- G_TYPE_BOOLEAN, 1,
- GTK_TYPE_DIRECTION_TYPE);
- g_signal_set_va_marshaller (widget_signals[KEYNAV_FAILED],
- G_TYPE_FROM_CLASS (klass),
- _gtk_marshal_BOOLEAN__ENUMv);
-
- /**
- * GtkWidget::query-tooltip:
- * @widget: the object which received the signal
- * @x: the x coordinate of the cursor position where the request has
- * been emitted, relative to @widget's left side
- * @y: the y coordinate of the cursor position where the request has
- * been emitted, relative to @widget's top
- * @keyboard_mode: %TRUE if the tooltip was triggered using the keyboard
- * @tooltip: a #GtkTooltip
- *
- * Emitted when #GtkWidget:has-tooltip is %TRUE and the hover timeout
- * has expired with the cursor hovering "above" @widget; or emitted when @widget got
- * focus in keyboard mode.
- *
- * Using the given coordinates, the signal handler should determine
- * whether a tooltip should be shown for @widget. If this is the case
- * %TRUE should be returned, %FALSE otherwise. Note that if
- * @keyboard_mode is %TRUE, the values of @x and @y are undefined and
- * should not be used.
- *
- * The signal handler is free to manipulate @tooltip with the therefore
- * destined function calls.
- *
- * Returns: %TRUE if @tooltip should be shown right now, %FALSE otherwise.
- */
- widget_signals[QUERY_TOOLTIP] =
- g_signal_new (I_("query-tooltip"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkWidgetClass, query_tooltip),
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECT,
- G_TYPE_BOOLEAN, 4,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_BOOLEAN,
- GTK_TYPE_TOOLTIP);
- g_signal_set_va_marshaller (widget_signals[QUERY_TOOLTIP],
- G_TYPE_FROM_CLASS (klass),
- _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECTv);
-
- gtk_widget_class_set_css_name (klass, I_("widget"));
- gtk_widget_class_set_accessible_role (klass, GTK_ACCESSIBLE_ROLE_WIDGET);
-}
-
-static void
-gtk_widget_base_class_finalize (GtkWidgetClass *klass)
-{
-
- template_data_free (klass->priv->template);
- g_object_unref (klass->priv->shortcuts);
-}
-
-static void
-gtk_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GtkWidget *widget = GTK_WIDGET (object);
- GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
-
- switch (prop_id)
- {
- case PROP_NAME:
- gtk_widget_set_name (widget, g_value_get_string (value));
- break;
- case PROP_WIDTH_REQUEST:
- gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2);
- break;
- case PROP_HEIGHT_REQUEST:
- gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value));
- break;
- case PROP_VISIBLE:
- gtk_widget_set_visible (widget, g_value_get_boolean (value));
- break;
- case PROP_SENSITIVE:
- gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
- break;
- case PROP_CAN_FOCUS:
- gtk_widget_set_can_focus (widget, g_value_get_boolean (value));
- break;
- case PROP_FOCUSABLE:
- gtk_widget_set_focusable (widget, g_value_get_boolean (value));
- break;
- case PROP_CAN_TARGET:
- gtk_widget_set_can_target (widget, g_value_get_boolean (value));
- break;
- case PROP_FOCUS_ON_CLICK:
- gtk_widget_set_focus_on_click (widget, g_value_get_boolean (value));
- break;
- case PROP_RECEIVES_DEFAULT:
- gtk_widget_set_receives_default (widget, g_value_get_boolean (value));
- break;
- case PROP_CURSOR:
- gtk_widget_set_cursor (widget, g_value_get_object (value));
- break;
- case PROP_HAS_TOOLTIP:
- gtk_widget_set_has_tooltip (widget, g_value_get_boolean (value));
- break;
- case PROP_TOOLTIP_MARKUP:
- gtk_widget_set_tooltip_markup (widget, g_value_get_string (value));
- break;
- case PROP_TOOLTIP_TEXT:
- gtk_widget_set_tooltip_text (widget, g_value_get_string (value));
- break;
- case PROP_HALIGN:
- gtk_widget_set_halign (widget, g_value_get_enum (value));
- break;
- case PROP_VALIGN:
- gtk_widget_set_valign (widget, g_value_get_enum (value));
- break;
- case PROP_MARGIN_START:
- gtk_widget_set_margin_start (widget, g_value_get_int (value));
- break;
- case PROP_MARGIN_END:
- gtk_widget_set_margin_end (widget, g_value_get_int (value));
- break;
- case PROP_MARGIN_TOP:
- gtk_widget_set_margin_top (widget, g_value_get_int (value));
- break;
- case PROP_MARGIN_BOTTOM:
- gtk_widget_set_margin_bottom (widget, g_value_get_int (value));
- break;
- case PROP_HEXPAND:
- gtk_widget_set_hexpand (widget, g_value_get_boolean (value));
- break;
- case PROP_HEXPAND_SET:
- gtk_widget_set_hexpand_set (widget, g_value_get_boolean (value));
- break;
- case PROP_VEXPAND:
- gtk_widget_set_vexpand (widget, g_value_get_boolean (value));
- break;
- case PROP_VEXPAND_SET:
- gtk_widget_set_vexpand_set (widget, g_value_get_boolean (value));
- break;
- case PROP_OPACITY:
- gtk_widget_set_opacity (widget, g_value_get_double (value));
- break;
- case PROP_OVERFLOW:
- gtk_widget_set_overflow (widget, g_value_get_enum (value));
- break;
- case PROP_CSS_NAME:
- if (g_value_get_string (value) != NULL)
- gtk_css_node_set_name (priv->cssnode, g_quark_from_string (g_value_get_string (value)));
- break;
- case PROP_CSS_CLASSES:
- gtk_widget_set_css_classes (widget, g_value_get_boxed (value));
- break;
- case PROP_LAYOUT_MANAGER:
- gtk_widget_set_layout_manager (widget, g_value_dup_object (value));
- break;
- case PROP_ACCESSIBLE_ROLE:
- gtk_widget_set_accessible_role (widget, g_value_get_enum (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GtkWidgetClass, move_focus),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE,
+ 1,
+ GTK_TYPE_DIRECTION_TYPE);
+
+ /**
+ * GtkWidget::keynav-failed:
+ * @widget: the object which received the signal
+ * @direction: the direction of movement
+ *
+ * Gets emitted if keyboard navigation fails.
+ * See gtk_widget_keynav_failed() for details.
+ *
+ * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE
+ * if the emitting widget should try to handle the keyboard
+ * navigation attempt in its parent widget(s).
+ **/
+ widget_signals[KEYNAV_FAILED] =
+ g_signal_new (I_("keynav-failed"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkWidgetClass, keynav_failed),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__ENUM,
+ G_TYPE_BOOLEAN, 1,
+ GTK_TYPE_DIRECTION_TYPE);
+ g_signal_set_va_marshaller (widget_signals[KEYNAV_FAILED],
+ G_TYPE_FROM_CLASS (klass),
+ _gtk_marshal_BOOLEAN__ENUMv);
+
+ /**
+ * GtkWidget::query-tooltip:
+ * @widget: the object which received the signal
+ * @x: the x coordinate of the cursor position where the request has
+ * been emitted, relative to @widget's left side
+ * @y: the y coordinate of the cursor position where the request has
+ * been emitted, relative to @widget's top
+ * @keyboard_mode: %TRUE if the tooltip was triggered using the keyboard
+ * @tooltip: a #GtkTooltip
+ *
+ * Emitted when #GtkWidget:has-tooltip is %TRUE and the hover timeout
+ * has expired with the cursor hovering "above" @widget; or emitted when @widget got
+ * focus in keyboard mode.
+ *
+ * Using the given coordinates, the signal handler should determine
+ * whether a tooltip should be shown for @widget. If this is the case
+ * %TRUE should be returned, %FALSE otherwise. Note that if
+ * @keyboard_mode is %TRUE, the values of @x and @y are undefined and
+ * should not be used.
+ *
+ * The signal handler is free to manipulate @tooltip with the therefore
+ * destined function calls.
+ *
+ * Returns: %TRUE if @tooltip should be shown right now, %FALSE otherwise.
+ */
+ widget_signals[QUERY_TOOLTIP] =
+ g_signal_new (I_("query-tooltip"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkWidgetClass, query_tooltip),
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECT,
+ G_TYPE_BOOLEAN, 4,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_BOOLEAN,
+ GTK_TYPE_TOOLTIP);
+ g_signal_set_va_marshaller (widget_signals[QUERY_TOOLTIP],
+ G_TYPE_FROM_CLASS (klass),
+ _gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECTv);
+
+ gtk_widget_class_set_css_name (klass, I_("widget"));
+ gtk_widget_class_set_accessible_role (klass, GTK_ACCESSIBLE_ROLE_WIDGET);
}
static void
-gtk_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gtk_widget_base_class_finalize (GtkWidgetClass *klass)
{
- GtkWidget *widget = GTK_WIDGET (object);
- GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- switch (prop_id)
- {
- case PROP_NAME:
- if (priv->name)
- g_value_set_string (value, priv->name);
- else
- g_value_set_static_string (value, "");
- break;
- case PROP_PARENT:
- g_value_set_object (value, priv->parent);
- break;
- case PROP_ROOT:
- g_value_set_object (value, priv->root);
- break;
- case PROP_WIDTH_REQUEST:
- {
- int w;
- gtk_widget_get_size_request (widget, &w, NULL);
- g_value_set_int (value, w);
- }
- break;
- case PROP_HEIGHT_REQUEST:
- {
- int h;
- gtk_widget_get_size_request (widget, NULL, &h);
- g_value_set_int (value, h);
- }
- break;
- case PROP_VISIBLE:
- g_value_set_boolean (value, _gtk_widget_get_visible (widget));
- break;
- case PROP_SENSITIVE:
- g_value_set_boolean (value, gtk_widget_get_sensitive (widget));
- break;
- case PROP_CAN_FOCUS:
- g_value_set_boolean (value, gtk_widget_get_can_focus (widget));
- break;
- case PROP_FOCUSABLE:
- g_value_set_boolean (value, gtk_widget_get_focusable (widget));
- break;
- case PROP_HAS_FOCUS:
- g_value_set_boolean (value, gtk_widget_has_focus (widget));
- break;
- case PROP_CAN_TARGET:
- g_value_set_boolean (value, gtk_widget_get_can_target (widget));
- break;
- case PROP_FOCUS_ON_CLICK:
- g_value_set_boolean (value, gtk_widget_get_focus_on_click (widget));
- break;
- case PROP_HAS_DEFAULT:
- g_value_set_boolean (value, gtk_widget_has_default (widget));
- break;
- case PROP_RECEIVES_DEFAULT:
- g_value_set_boolean (value, gtk_widget_get_receives_default (widget));
- break;
- case PROP_CURSOR:
- g_value_set_object (value, gtk_widget_get_cursor (widget));
- break;
- case PROP_HAS_TOOLTIP:
- g_value_set_boolean (value, gtk_widget_get_has_tooltip (widget));
- break;
- case PROP_TOOLTIP_TEXT:
- g_value_set_string (value, gtk_widget_get_tooltip_text (widget));
- break;
- case PROP_TOOLTIP_MARKUP:
- g_value_set_string (value, gtk_widget_get_tooltip_markup (widget));
- break;
- case PROP_HALIGN:
- g_value_set_enum (value, gtk_widget_get_halign (widget));
- break;
- case PROP_VALIGN:
- g_value_set_enum (value, gtk_widget_get_valign (widget));
- break;
- case PROP_MARGIN_START:
- g_value_set_int (value, gtk_widget_get_margin_start (widget));
- break;
- case PROP_MARGIN_END:
- g_value_set_int (value, gtk_widget_get_margin_end (widget));
- break;
- case PROP_MARGIN_TOP:
- g_value_set_int (value, gtk_widget_get_margin_top (widget));
- break;
- case PROP_MARGIN_BOTTOM:
- g_value_set_int (value, gtk_widget_get_margin_bottom (widget));
- break;
- case PROP_HEXPAND:
- g_value_set_boolean (value, gtk_widget_get_hexpand (widget));
- break;
- case PROP_HEXPAND_SET:
- g_value_set_boolean (value, gtk_widget_get_hexpand_set (widget));
- break;
- case PROP_VEXPAND:
- g_value_set_boolean (value, gtk_widget_get_vexpand (widget));
- break;
- case PROP_VEXPAND_SET:
- g_value_set_boolean (value, gtk_widget_get_vexpand_set (widget));
- break;
- case PROP_OPACITY:
- g_value_set_double (value, gtk_widget_get_opacity (widget));
- break;
- case PROP_OVERFLOW:
- g_value_set_enum (value, gtk_widget_get_overflow (widget));
- break;
- case PROP_SCALE_FACTOR:
- g_value_set_int (value, gtk_widget_get_scale_factor (widget));
- break;
- case PROP_CSS_NAME:
- g_value_set_string (value, gtk_widget_get_css_name (widget));
- break;
- case PROP_CSS_CLASSES:
- g_value_take_boxed (value, gtk_widget_get_css_classes (widget));
- break;
- case PROP_LAYOUT_MANAGER:
- g_value_set_object (value, gtk_widget_get_layout_manager (widget));
- break;
- case PROP_ACCESSIBLE_ROLE:
- g_value_set_enum (value, gtk_widget_get_accessible_role (widget));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ template_data_free (klass->priv->template);
+ g_object_unref (klass->priv->shortcuts);
}
static void
@@ -4086,14 +4115,6 @@ gtk_widget_compute_point (GtkWidget *widget,
return TRUE;
}
-static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- int width,
- int height,
- int baseline)
-{
-}
-
/**
* gtk_widget_class_add_binding: (skip)
* @widget_class: the class to add the binding to
@@ -4752,30 +4773,6 @@ gtk_widget_grab_focus_child (GtkWidget *widget)
return FALSE;
}
-static gboolean
-gtk_widget_real_query_tooltip (GtkWidget *widget,
- int x,
- int y,
- gboolean keyboard_tip,
- GtkTooltip *tooltip)
-{
- const char *tooltip_markup;
- gboolean has_tooltip;
-
- has_tooltip = gtk_widget_get_has_tooltip (widget);
- tooltip_markup = gtk_widget_get_tooltip_markup (widget);
- if (tooltip_markup == NULL)
- tooltip_markup = gtk_widget_get_tooltip_text (widget);
-
- if (has_tooltip && tooltip_markup != NULL)
- {
- gtk_tooltip_set_markup (tooltip, tooltip_markup);
- return TRUE;
- }
-
- return FALSE;
-}
-
gboolean
gtk_widget_query_tooltip (GtkWidget *widget,
int x,
@@ -4796,12 +4793,6 @@ gtk_widget_query_tooltip (GtkWidget *widget,
return retval;
}
-static void
-gtk_widget_real_state_flags_changed (GtkWidget *widget,
- GtkStateFlags old_state)
-{
-}
-
static void
gtk_widget_real_css_changed (GtkWidget *widget,
GtkCssStyleChange *change)
@@ -9075,26 +9066,6 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
}
}
-static GtkSizeRequestMode
-gtk_widget_real_get_request_mode (GtkWidget *widget)
-{
- /* By default widgets don't trade size at all. */
- return GTK_SIZE_REQUEST_CONSTANT_SIZE;
-}
-
-static void
-gtk_widget_real_measure (GtkWidget *widget,
- GtkOrientation orientation,
- int for_size,
- int *minimum,
- int *natural,
- int *minimum_baseline,
- int *natural_baseline)
-{
- *minimum = 0;
- *natural = 0;
-}
-
/**
* gtk_widget_get_halign:
* @widget: a #GtkWidget
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]