/** * gtk_scale_button_get_popup: * @button: a #GtkScaleButton * * Retrieves the popup of the #GtkScaleButton. * * Returns: the popup of the #GtkScaleButton * * Since: 2.14 */ GtkWidget * gtk_scale_button_get_popup (GtkScaleButton *button) { g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL); return button->priv->dock; }
/** * gtk_scale_button_get_adjustment: * @button: a #GtkScaleButton * * Gets the #GtkAdjustment associated with the #GtkScaleButton's scale. * See gtk_range_get_adjustment() for details. * * Returns: the adjustment associated with the scale * * Since: 2.12 */ GtkAdjustment* gtk_scale_button_get_adjustment (GtkScaleButton *button) { g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL); return button->priv->adjustment; }
/** * gtk_scale_button_get_minus_button: * @button: a #GtkScaleButton * * Retrieves the minus button of the #GtkScaleButton. * * Returns: the minus button of the #GtkScaleButton. * * Since: 2.14 */ GtkWidget * gtk_scale_button_get_minus_button (GtkScaleButton *button) { g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), NULL); return button->minus_button; }
/** * gtk_scale_button_get_orientation: * @button: a #GtkScaleButton * * Gets the orientation of the #GtkScaleButton's popup window. * * Returns: the #GtkScaleButton's orientation. * * Since: 2.14 **/ GtkOrientation gtk_scale_button_get_orientation (GtkScaleButton *button) { g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), GTK_ORIENTATION_VERTICAL); return button->priv->orientation; }
/** * gtk_scale_button_set_orientation: * @button: a #GtkScaleButton * @orientation: the new orientation * * Sets the orientation of the #GtkScaleButton's popup window. * * Since: 2.14 * * Deprecated: 2.16: Use gtk_orientable_set_orientation() instead. **/ void gtk_scale_button_set_orientation (GtkScaleButton *button, GtkOrientation orientation) { g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); gtk_scale_button_set_orientation_private (button, orientation); }
static void test_scale_button_basic (void) { GtkWidget *widget; widget = gtk_scale_button_new (GTK_ICON_SIZE_MENU, 0, 100, 10, NULL); g_assert (GTK_IS_SCALE_BUTTON (widget)); gtk_widget_destroy (widget); }
/** * gtk_scale_button_get_value: * @button: a #GtkScaleButton * * Gets the current value of the scale button. * * Return value: current value of the scale button * * Since: 2.12 */ gdouble gtk_scale_button_get_value (GtkScaleButton * button) { GtkScaleButtonPrivate *priv; g_return_val_if_fail (GTK_IS_SCALE_BUTTON (button), 0); priv = button->priv; return gtk_adjustment_get_value (priv->adjustment); }
/** * gtk_scale_button_set_value: * @button: a #GtkScaleButton * @value: new value of the scale button * * Sets the current value of the scale; if the value is outside * the minimum or maximum range values, it will be clamped to fit * inside them. The scale button emits the #GtkScaleButton::value-changed * signal if the value changes. * * Since: 2.12 */ void gtk_scale_button_set_value (GtkScaleButton *button, gdouble value) { GtkScaleButtonPrivate *priv; g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); priv = button->priv; gtk_range_set_value (GTK_RANGE (priv->scale), value); }
/** * gtk_scale_button_set_icons: * @button: a #GtkScaleButton * @icons: a %NULL-terminated array of icon names * * Sets the icons to be used by the scale button. * For details, see the #GtkScaleButton:icons property. * * Since: 2.12 */ void gtk_scale_button_set_icons (GtkScaleButton *button, const gchar **icons) { GtkScaleButtonPrivate *priv; gchar **tmp; g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); priv = button->priv; tmp = priv->icon_list; priv->icon_list = g_strdupv ((gchar **) icons); g_strfreev (tmp); gtk_scale_button_update_icon (button); g_object_notify (G_OBJECT (button), "icons"); }
gboolean focus_in_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) { (void)event; if ( IS_EGE_ADJUSTMENT_ACTION(data) ) { EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( data ); if ( GTK_IS_SPIN_BUTTON(widget) ) { action->private_data->lastVal = gtk_spin_button_get_value( GTK_SPIN_BUTTON(widget) ); #if GTK_CHECK_VERSION(2,12,0) } else if ( GTK_IS_SCALE_BUTTON(widget) ) { action->private_data->lastVal = gtk_scale_button_get_value( GTK_SCALE_BUTTON(widget) ); #endif /* GTK_CHECK_VERSION(2,12,0) */ } else if (GTK_IS_RANGE(widget) ) { action->private_data->lastVal = gtk_range_get_value( GTK_RANGE(widget) ); } action->private_data->transferFocus = TRUE; } return FALSE; /* report event not consumed */ }
/** * gtk_scale_button_set_orientation: * @button: a #GtkScaleButton * @orientation: the new orientation * * Sets the orientation of the #GtkScaleButton's popup window. * * Since: 2.14 **/ void gtk_scale_button_set_orientation (GtkScaleButton *button, GtkOrientation orientation) { GtkScaleButtonPrivate *priv; g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); priv = button->priv; if (orientation != priv->orientation) { priv->orientation = orientation; if (priv->scale) { GtkWidget *box = priv->scale->parent; GtkWidget *frame = box->parent; g_object_ref (button->plus_button); g_object_ref (button->minus_button); gtk_container_remove (GTK_CONTAINER (box), button->plus_button); gtk_container_remove (GTK_CONTAINER (box), button->minus_button); gtk_container_remove (GTK_CONTAINER (box), priv->scale); gtk_container_remove (GTK_CONTAINER (frame), box); box = gtk_scale_button_scale_box_new (button); gtk_container_add (GTK_CONTAINER (frame), box); /* FIXME: without this, the popup window appears as a square * after changing the orientation */ gtk_window_resize (GTK_WINDOW (priv->dock), 1, 1); g_object_unref (button->plus_button); g_object_unref (button->minus_button); } g_object_notify (G_OBJECT (button), "orientation"); } }
static void gail_scale_button_notify_gtk (GObject *obj, GParamSpec *pspec) { GtkScaleButton *gtk_scale_button; GailScaleButton *scale_button; g_return_if_fail (GTK_IS_SCALE_BUTTON (obj)); gtk_scale_button = GTK_SCALE_BUTTON (obj); scale_button = GAIL_SCALE_BUTTON (gtk_widget_get_accessible (GTK_WIDGET (gtk_scale_button))); if (strcmp (pspec->name, "value") == 0) { g_object_notify (G_OBJECT (scale_button), "accessible-value"); } else { GAIL_WIDGET_CLASS (gail_scale_button_parent_class)->notify_gtk (obj, pspec); } }
/** * gtk_scale_button_set_adjustment: * @button: a #GtkScaleButton * @adjustment: a #GtkAdjustment * * Sets the #GtkAdjustment to be used as a model * for the #GtkScaleButton's scale. * See gtk_range_set_adjustment() for details. * * Since: 2.12 */ void gtk_scale_button_set_adjustment (GtkScaleButton *button, GtkAdjustment *adjustment) { g_return_if_fail (GTK_IS_SCALE_BUTTON (button)); if (!adjustment) adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); else g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); if (button->priv->adjustment != adjustment) { if (button->priv->adjustment) g_object_unref (button->priv->adjustment); button->priv->adjustment = g_object_ref_sink (adjustment); if (button->priv->scale) gtk_range_set_adjustment (GTK_RANGE (button->priv->scale), adjustment); g_object_notify (G_OBJECT (button), "adjustment"); } }
void glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor, GladeWidget * widget, GladeXmlContext * context, GladeXmlNode * node) { GladeProperty *prop; gboolean use_stock; gchar *stock = NULL; if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) || glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE))) return; /* Do not save GtkColorButton GtkFontButton and GtkScaleButton label property */ if (!(GTK_IS_COLOR_BUTTON (glade_widget_get_object (widget)) || GTK_IS_FONT_BUTTON (glade_widget_get_object (widget)) || GTK_IS_SCALE_BUTTON (glade_widget_get_object (widget)))) { /* Make a copy of the GladeProperty, * override its value and ensure non-translatable if use-stock is TRUE */ prop = glade_widget_get_property (widget, "label"); prop = glade_property_dup (prop, widget); glade_widget_property_get (widget, "use-stock", &use_stock); if (use_stock) { glade_widget_property_get (widget, "stock", &stock); glade_property_i18n_set_translatable (prop, FALSE); glade_property_set (prop, stock); } glade_property_write (prop, context, node); g_object_unref (G_OBJECT (prop)); } /* Write out other normal properties and any other class derived custom properties after ... */ GWA_GET_CLASS (GTK_TYPE_CONTAINER)->write_widget (adaptor, widget, context, node); }