mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 06:40:08 +00:00
scalebutton: fix orientation not applied to scale
This commit is contained in:
parent
5ecd8a1c10
commit
d625ff8106
@ -816,6 +816,40 @@ gtk_scale_button_get_active (GtkScaleButton *button)
|
|||||||
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button));
|
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
apply_orientation (GtkScaleButton *button,
|
||||||
|
GtkOrientation orientation)
|
||||||
|
{
|
||||||
|
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
|
||||||
|
|
||||||
|
if (priv->applied_orientation != orientation)
|
||||||
|
{
|
||||||
|
priv->applied_orientation = orientation;
|
||||||
|
|
||||||
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), orientation);
|
||||||
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->scale), orientation);
|
||||||
|
|
||||||
|
if (orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
|
{
|
||||||
|
gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->scale,
|
||||||
|
priv->plus_button);
|
||||||
|
gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->minus_button,
|
||||||
|
priv->scale);
|
||||||
|
gtk_widget_set_size_request (GTK_WIDGET (priv->scale), -1, SCALE_SIZE);
|
||||||
|
gtk_range_set_inverted (GTK_RANGE (priv->scale), TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->scale,
|
||||||
|
priv->minus_button);
|
||||||
|
gtk_box_reorder_child_after (GTK_BOX (priv->box), priv->plus_button,
|
||||||
|
priv->scale);
|
||||||
|
gtk_widget_set_size_request (GTK_WIDGET (priv->scale), SCALE_SIZE, -1);
|
||||||
|
gtk_range_set_inverted (GTK_RANGE (priv->scale), FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_button_set_orientation_private (GtkScaleButton *button,
|
gtk_scale_button_set_orientation_private (GtkScaleButton *button,
|
||||||
GtkOrientation orientation)
|
GtkOrientation orientation)
|
||||||
@ -825,6 +859,9 @@ gtk_scale_button_set_orientation_private (GtkScaleButton *button,
|
|||||||
if (priv->orientation != orientation)
|
if (priv->orientation != orientation)
|
||||||
{
|
{
|
||||||
priv->orientation = orientation;
|
priv->orientation = orientation;
|
||||||
|
|
||||||
|
apply_orientation (button, priv->orientation);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (button), "orientation");
|
g_object_notify (G_OBJECT (button), "orientation");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -861,6 +898,8 @@ gtk_scale_popup (GtkWidget *widget)
|
|||||||
GtkScaleButton *button = GTK_SCALE_BUTTON (widget);
|
GtkScaleButton *button = GTK_SCALE_BUTTON (widget);
|
||||||
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
|
GtkScaleButtonPrivate *priv = gtk_scale_button_get_instance_private (button);
|
||||||
|
|
||||||
|
apply_orientation (button, priv->orientation);
|
||||||
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user