forked from AuroraMiddleware/gtk
scale: deprecate slider-length style property
This can be achieved using min-height/min-width CSS properties now.
This commit is contained in:
parent
c1eff2cce5
commit
d1c5ecfaef
@ -3995,3 +3995,9 @@ gtk_range_get_trough_node (GtkRange *range)
|
|||||||
{
|
{
|
||||||
return gtk_css_gadget_get_node (range->priv->trough_gadget);
|
return gtk_css_gadget_get_node (range->priv->trough_gadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkCssGadget *
|
||||||
|
gtk_range_get_slider_gadget (GtkRange *range)
|
||||||
|
{
|
||||||
|
return range->priv->slider_gadget;
|
||||||
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <gtk/gtkrange.h>
|
#include <gtk/gtkrange.h>
|
||||||
|
#include <gtk/gtkcssgadgetprivate.h>
|
||||||
#include <gtk/gtkcssnodeprivate.h>
|
#include <gtk/gtkcssnodeprivate.h>
|
||||||
|
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ void _gtk_range_set_steppers (GtkRange *range
|
|||||||
gboolean has_d);
|
gboolean has_d);
|
||||||
|
|
||||||
GtkCssNode *gtk_range_get_trough_node (GtkRange *range);
|
GtkCssNode *gtk_range_get_trough_node (GtkRange *range);
|
||||||
|
GtkCssGadget *gtk_range_get_slider_gadget (GtkRange *range);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -268,12 +268,14 @@ gtk_scale_update_style (GtkScale *scale)
|
|||||||
{
|
{
|
||||||
gint slider_length;
|
gint slider_length;
|
||||||
GtkRange *range;
|
GtkRange *range;
|
||||||
|
GtkCssGadget *slider_gadget;
|
||||||
|
|
||||||
range = GTK_RANGE (scale);
|
range = GTK_RANGE (scale);
|
||||||
|
slider_gadget = gtk_range_get_slider_gadget (range);
|
||||||
gtk_widget_style_get (GTK_WIDGET (scale),
|
gtk_css_gadget_get_preferred_size (slider_gadget,
|
||||||
"slider-length", &slider_length,
|
gtk_orientable_get_orientation (GTK_ORIENTABLE (scale)), -1,
|
||||||
NULL);
|
&slider_length, NULL,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
gtk_range_set_min_slider_size (range, slider_length);
|
gtk_range_set_min_slider_size (range, slider_length);
|
||||||
gtk_scale_clear_layout (scale);
|
gtk_scale_clear_layout (scale);
|
||||||
@ -376,12 +378,20 @@ gtk_scale_class_init (GtkScaleClass *class)
|
|||||||
|
|
||||||
g_object_class_install_properties (gobject_class, LAST_PROP, properties);
|
g_object_class_install_properties (gobject_class, LAST_PROP, properties);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkScale:slider-length:
|
||||||
|
*
|
||||||
|
* Length of scale's slider.
|
||||||
|
*
|
||||||
|
* Deprecated: 3.20: Use min-height/min-width CSS properties on the slider
|
||||||
|
* element instead. The value of this style property is ignored.
|
||||||
|
*/
|
||||||
gtk_widget_class_install_style_property (widget_class,
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
g_param_spec_int ("slider-length",
|
g_param_spec_int ("slider-length",
|
||||||
P_("Slider Length"),
|
P_("Slider Length"),
|
||||||
P_("Length of scale's slider"),
|
P_("Length of scale's slider"),
|
||||||
0, G_MAXINT, 31,
|
0, G_MAXINT, 31,
|
||||||
GTK_PARAM_READABLE));
|
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
|
||||||
|
|
||||||
gtk_widget_class_install_style_property (widget_class,
|
gtk_widget_class_install_style_property (widget_class,
|
||||||
g_param_spec_int ("value-spacing",
|
g_param_spec_int ("value-spacing",
|
||||||
@ -1086,7 +1096,7 @@ gtk_scale_get_preferred_width (GtkWidget *widget,
|
|||||||
gint slider_length;
|
gint slider_length;
|
||||||
gint w;
|
gint w;
|
||||||
|
|
||||||
gtk_widget_style_get (widget, "slider-length", &slider_length, NULL);
|
slider_length = gtk_range_get_min_slider_size (GTK_RANGE (widget));
|
||||||
|
|
||||||
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
|
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
|
||||||
|
|
||||||
@ -1113,7 +1123,7 @@ gtk_scale_get_preferred_height (GtkWidget *widget,
|
|||||||
gint slider_length;
|
gint slider_length;
|
||||||
gint h;
|
gint h;
|
||||||
|
|
||||||
gtk_widget_style_get (widget, "slider-length", &slider_length, NULL);
|
slider_length = gtk_range_get_min_slider_size (GTK_RANGE (widget));
|
||||||
|
|
||||||
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
|
gtk_scale_get_mark_label_size (GTK_SCALE (widget), GTK_POS_TOP, &n1, &w1, &h1, &n2, &w2, &h2);
|
||||||
h1 = (n1 - 1) * h1 + MAX (h1, slider_length);
|
h1 = (n1 - 1) * h1 + MAX (h1, slider_length);
|
||||||
@ -1159,13 +1169,17 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
GtkRange *range = GTK_RANGE (scale);
|
GtkRange *range = GTK_RANGE (scale);
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
gint *marks;
|
gint *marks;
|
||||||
gint slider_width;
|
|
||||||
gint value_spacing;
|
gint value_spacing;
|
||||||
gint min_sep = 4;
|
gint min_sep = 4;
|
||||||
|
GtkCssGadget *slider_gadget;
|
||||||
|
GtkAllocation slider_alloc;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
slider_gadget = gtk_range_get_slider_gadget (range);
|
||||||
|
gtk_css_gadget_get_content_allocation (slider_gadget,
|
||||||
|
&slider_alloc, NULL);
|
||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"slider-width", &slider_width,
|
|
||||||
"value-spacing", &value_spacing,
|
"value-spacing", &value_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -1200,14 +1214,14 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
x1 = marks[i];
|
x1 = marks[i];
|
||||||
if (mark->position == GTK_POS_TOP)
|
if (mark->position == GTK_POS_TOP)
|
||||||
{
|
{
|
||||||
y1 = range_rect.y + slider_width / 4;
|
y1 = range_rect.y + slider_alloc.height / 4;
|
||||||
y2 = range_rect.y;
|
y2 = range_rect.y;
|
||||||
min_pos = min_pos_before;
|
min_pos = min_pos_before;
|
||||||
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
|
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y1 = range_rect.y + range_rect.height - slider_width / 4;
|
y1 = range_rect.y + slider_alloc.height / 4;
|
||||||
y2 = range_rect.y + range_rect.height;
|
y2 = range_rect.y + range_rect.height;
|
||||||
min_pos = min_pos_after;
|
min_pos = min_pos_after;
|
||||||
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
|
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
|
||||||
@ -1245,14 +1259,14 @@ gtk_scale_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
if (mark->position == GTK_POS_TOP)
|
if (mark->position == GTK_POS_TOP)
|
||||||
{
|
{
|
||||||
x1 = range_rect.x + slider_width / 4;
|
x1 = range_rect.x + slider_alloc.width / 4;
|
||||||
x2 = range_rect.x;
|
x2 = range_rect.x;
|
||||||
min_pos = min_pos_before;
|
min_pos = min_pos_before;
|
||||||
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
|
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_TOP) - min_sep;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x1 = range_rect.x + range_rect.width - slider_width / 4;
|
x1 = range_rect.x + slider_alloc.width / 4;
|
||||||
x2 = range_rect.x + range_rect.width;
|
x2 = range_rect.x + range_rect.width;
|
||||||
min_pos = min_pos_after;
|
min_pos = min_pos_after;
|
||||||
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
|
max_pos = find_next_pos (widget, m, marks + i, GTK_POS_BOTTOM) - min_sep;
|
||||||
|
@ -2483,8 +2483,6 @@ treeview.view radio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scale {
|
scale {
|
||||||
-GtkScale-slider-length: 22;
|
|
||||||
|
|
||||||
outline-offset: -10px;
|
outline-offset: -10px;
|
||||||
-gtk-outline-radius: 7px;
|
-gtk-outline-radius: 7px;
|
||||||
|
|
||||||
@ -2496,6 +2494,7 @@ scale {
|
|||||||
slider {
|
slider {
|
||||||
margin: 5px 1px;
|
margin: 5px 1px;
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
|
min-width: 22px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2506,6 +2505,7 @@ scale {
|
|||||||
}
|
}
|
||||||
slider {
|
slider {
|
||||||
margin: 1px 5px;
|
margin: 1px 5px;
|
||||||
|
min-height: 22px;
|
||||||
min-width: 22px;
|
min-width: 22px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2645,6 @@ scale highlight, progressbar progress {
|
|||||||
border-color: transparent; }
|
border-color: transparent; }
|
||||||
|
|
||||||
scale {
|
scale {
|
||||||
-GtkScale-slider-length: 22;
|
|
||||||
outline-offset: -10px;
|
outline-offset: -10px;
|
||||||
-gtk-outline-radius: 7px; }
|
-gtk-outline-radius: 7px; }
|
||||||
scale.horizontal trough {
|
scale.horizontal trough {
|
||||||
@ -2653,12 +2652,14 @@ scale {
|
|||||||
min-height: 3px; }
|
min-height: 3px; }
|
||||||
scale.horizontal slider {
|
scale.horizontal slider {
|
||||||
margin: 5px 1px;
|
margin: 5px 1px;
|
||||||
min-height: 22px; }
|
min-height: 22px;
|
||||||
|
min-width: 22px; }
|
||||||
scale.vertical trough {
|
scale.vertical trough {
|
||||||
margin: 12px 15px;
|
margin: 12px 15px;
|
||||||
min-width: 3px; }
|
min-width: 3px; }
|
||||||
scale.vertical slider {
|
scale.vertical slider {
|
||||||
margin: 1px 5px;
|
margin: 1px 5px;
|
||||||
|
min-height: 22px;
|
||||||
min-width: 22px; }
|
min-width: 22px; }
|
||||||
scale.fine-tune {
|
scale.fine-tune {
|
||||||
outline-offset: -8px;
|
outline-offset: -8px;
|
||||||
|
@ -2676,7 +2676,6 @@ scale highlight, progressbar progress {
|
|||||||
border-color: transparent; }
|
border-color: transparent; }
|
||||||
|
|
||||||
scale {
|
scale {
|
||||||
-GtkScale-slider-length: 22;
|
|
||||||
outline-offset: -10px;
|
outline-offset: -10px;
|
||||||
-gtk-outline-radius: 7px; }
|
-gtk-outline-radius: 7px; }
|
||||||
scale.horizontal trough {
|
scale.horizontal trough {
|
||||||
@ -2684,12 +2683,14 @@ scale {
|
|||||||
min-height: 3px; }
|
min-height: 3px; }
|
||||||
scale.horizontal slider {
|
scale.horizontal slider {
|
||||||
margin: 5px 1px;
|
margin: 5px 1px;
|
||||||
min-height: 22px; }
|
min-height: 22px;
|
||||||
|
min-width: 22px; }
|
||||||
scale.vertical trough {
|
scale.vertical trough {
|
||||||
margin: 12px 15px;
|
margin: 12px 15px;
|
||||||
min-width: 3px; }
|
min-width: 3px; }
|
||||||
scale.vertical slider {
|
scale.vertical slider {
|
||||||
margin: 1px 5px;
|
margin: 1px 5px;
|
||||||
|
min-height: 22px;
|
||||||
min-width: 22px; }
|
min-width: 22px; }
|
||||||
scale.fine-tune {
|
scale.fine-tune {
|
||||||
outline-offset: -8px;
|
outline-offset: -8px;
|
||||||
|
Loading…
Reference in New Issue
Block a user