scale: Use top/left/bottom/right style classes on value label
Just top/bottom is not enough anymore.
77769a52b3 broke e.g. horizontal scales
with the value on top/bottom, adding too much space.
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
* │ ┊ ╰── indicator
|
||||
* ┊ ┊
|
||||
* │ ╰── mark
|
||||
* ├── [value][.top][.bottom]
|
||||
* ├── [value][.top][.right][.bottom][.left]
|
||||
* ├── trough
|
||||
* │ ├── [fill]
|
||||
* │ ├── [highlight]
|
||||
@@ -1049,15 +1049,19 @@ update_value_position (GtkScale *scale)
|
||||
|
||||
context = gtk_widget_get_style_context (priv->value_widget);
|
||||
|
||||
if (priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
|
||||
|
||||
switch (priv->value_pos)
|
||||
{
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
|
||||
case GTK_POS_TOP: gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP); break;
|
||||
case GTK_POS_RIGHT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT); break;
|
||||
case GTK_POS_BOTTOM: gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM); break;
|
||||
case GTK_POS_LEFT: gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT); break;
|
||||
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3197,8 +3197,8 @@ scale {
|
||||
}
|
||||
}
|
||||
|
||||
>value.top { margin-bottom: 9px; }
|
||||
>value.bottom { margin-top: 9px; }
|
||||
> value.left { margin-right: 9px; }
|
||||
> value.right { margin-left: 9px; }
|
||||
|
||||
&.fine-tune >marks {
|
||||
&.top { margin-top: 3px; }
|
||||
@@ -3221,8 +3221,8 @@ scale {
|
||||
}
|
||||
}
|
||||
|
||||
>value.top { margin-bottom: 9px; }
|
||||
>value.bottom { margin-top: 9px; }
|
||||
> value.top { margin-bottom: 9px; }
|
||||
> value.bottom { margin-top: 9px; }
|
||||
|
||||
&.fine-tune >marks {
|
||||
&.top { margin-left: 3px; }
|
||||
|
||||
Reference in New Issue
Block a user