mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 21:50:34 +00:00
expander: Flip the alignment of the vertical box
To ensure that the title moves to the other side as expected in RTL, use GTK_ALIGN_START/END instead of GTK_ALIGN_FILL when packing the title gadget into the vertical box, and flip the alignment when the text direction changes.
This commit is contained in:
parent
296f80a580
commit
2a665715b6
@ -450,7 +450,7 @@ gtk_expander_init (GtkExpander *expander)
|
|||||||
priv->gadget,
|
priv->gadget,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->title_gadget), GTK_ORIENTATION_HORIZONTAL);
|
gtk_box_gadget_set_orientation (GTK_BOX_GADGET (priv->title_gadget), GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), -1, priv->title_gadget, FALSE, FALSE, GTK_ALIGN_FILL);
|
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), -1, priv->title_gadget, FALSE, FALSE, GTK_ALIGN_START);
|
||||||
|
|
||||||
priv->arrow_gadget = gtk_builtin_icon_new ("arrow",
|
priv->arrow_gadget = gtk_builtin_icon_new ("arrow",
|
||||||
GTK_WIDGET (expander),
|
GTK_WIDGET (expander),
|
||||||
@ -778,9 +778,14 @@ gtk_expander_direction_changed (GtkWidget *widget,
|
|||||||
GtkTextDirection previous_direction)
|
GtkTextDirection previous_direction)
|
||||||
{
|
{
|
||||||
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
|
GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
|
||||||
|
GtkAlign align;
|
||||||
|
|
||||||
gtk_box_gadget_reverse_children (GTK_BOX_GADGET (priv->title_gadget));
|
gtk_box_gadget_reverse_children (GTK_BOX_GADGET (priv->title_gadget));
|
||||||
|
|
||||||
|
align = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START;
|
||||||
|
gtk_box_gadget_remove_gadget (GTK_BOX_GADGET (priv->gadget), priv->title_gadget);
|
||||||
|
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), 0, priv->title_gadget, FALSE, FALSE, align);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_expander_parent_class)->direction_changed (widget, previous_direction);
|
GTK_WIDGET_CLASS (gtk_expander_parent_class)->direction_changed (widget, previous_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user