summaryrefslogtreecommitdiff
path: root/gtk/gtkscale.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-08-26 18:56:04 +0200
committerTimm Bäder <mail@baedert.org>2019-09-09 17:36:25 +0200
commit80411fb9053d3e9b5a0a84a46aaee8b5ce5990f7 (patch)
tree6de9044e939d5e514b6f3918ca442257d1f9840d /gtk/gtkscale.c
parentc9241e83dd48e4569a6bc2233e9ff91237e413fc (diff)
downloadgtk+-80411fb9053d3e9b5a0a84a46aaee8b5ce5990f7.tar.gz
scale: Use top/left/bottom/right style classes on value label
Just top/bottom is not enough anymore. 77769a52b3cc0b836b226457963d7b5fe92ee115 broke e.g. horizontal scales with the value on top/bottom, adding too much space.
Diffstat (limited to 'gtk/gtkscale.c')
-rw-r--r--gtk/gtkscale.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index fafcfab3bb..7a007c4e6b 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -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_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_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_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 ();
}
}