mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 15:14:17 +00:00
expander: don't use focus padding
This commit is contained in:
parent
d2f77984dc
commit
24a422631d
@ -541,7 +541,6 @@ get_prelight_area_bounds (GtkExpander *expander,
|
|||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkContainer *container;
|
GtkContainer *container;
|
||||||
int focus_width;
|
int focus_width;
|
||||||
int focus_pad;
|
|
||||||
int expander_size;
|
int expander_size;
|
||||||
int expander_spacing;
|
int expander_spacing;
|
||||||
guint border_width;
|
guint border_width;
|
||||||
@ -553,7 +552,6 @@ get_prelight_area_bounds (GtkExpander *expander,
|
|||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
@ -576,7 +574,7 @@ get_prelight_area_bounds (GtkExpander *expander,
|
|||||||
else
|
else
|
||||||
area->height = 0;
|
area->height = 0;
|
||||||
|
|
||||||
area->height += (focus_width + focus_pad);
|
area->height += focus_width;
|
||||||
area->height = MAX (area->height, expander_size + 2 * expander_spacing);
|
area->height = MAX (area->height, expander_size + 2 * expander_spacing);
|
||||||
area->height += border.top + border.bottom;
|
area->height += border.top + border.bottom;
|
||||||
}
|
}
|
||||||
@ -647,7 +645,6 @@ get_expander_bounds (GtkExpander *expander,
|
|||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
gboolean ltr;
|
gboolean ltr;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
@ -660,7 +657,6 @@ get_expander_bounds (GtkExpander *expander,
|
|||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
@ -684,7 +680,7 @@ get_expander_bounds (GtkExpander *expander,
|
|||||||
gtk_widget_get_allocation (priv->label_widget, &label_allocation);
|
gtk_widget_get_allocation (priv->label_widget, &label_allocation);
|
||||||
|
|
||||||
if (expander_size < label_allocation.height)
|
if (expander_size < label_allocation.height)
|
||||||
rect->y += focus_width + focus_pad + (label_allocation.height - expander_size) / 2;
|
rect->y += focus_width + (label_allocation.height - expander_size) / 2;
|
||||||
else
|
else
|
||||||
rect->y += expander_spacing;
|
rect->y += expander_spacing;
|
||||||
}
|
}
|
||||||
@ -708,7 +704,6 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
|||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
gint label_height;
|
gint label_height;
|
||||||
gint label_xpad, label_xoffset;
|
gint label_xpad, label_xoffset;
|
||||||
gint child_ypad, child_yoffset;
|
gint child_ypad, child_yoffset;
|
||||||
@ -724,15 +719,14 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
get_padding_and_border (widget, &border);
|
get_padding_and_border (widget, &border);
|
||||||
|
|
||||||
/* Calculate some offsets/padding first */
|
/* Calculate some offsets/padding first */
|
||||||
label_xoffset = border_width + expander_size + focus_width + 2 * expander_spacing + focus_pad + border.left;
|
label_xoffset = border_width + expander_size + focus_width + 2 * expander_spacing + border.left;
|
||||||
label_xpad = 2 * border_width + expander_size + 2 * focus_width + 2 * expander_spacing + 2 * focus_pad + border.left + border.right;
|
label_xpad = 2 * border_width + expander_size + 2 * focus_width + 2 * expander_spacing + border.left + border.right;
|
||||||
|
|
||||||
child_yoffset = border_width + priv->spacing + border.top + border.bottom;
|
child_yoffset = border_width + priv->spacing + border.top + border.bottom;
|
||||||
child_ypad = 2 * border_width + priv->spacing + border.top + border.bottom;
|
child_ypad = 2 * border_width + priv->spacing + border.top + border.bottom;
|
||||||
@ -769,10 +763,10 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
|||||||
label_allocation.x = allocation->x + allocation->width -
|
label_allocation.x = allocation->x + allocation->width -
|
||||||
(label_allocation.width + label_xoffset);
|
(label_allocation.width + label_xoffset);
|
||||||
|
|
||||||
label_allocation.y = allocation->y + border_width + focus_width + focus_pad + border.top;
|
label_allocation.y = allocation->y + border_width + focus_width + border.top;
|
||||||
label_allocation.height = MIN (label_height,
|
label_allocation.height = MIN (label_height,
|
||||||
allocation->height - 2 * border_width -
|
allocation->height - 2 * border_width -
|
||||||
2 * focus_width - 2 * focus_pad -
|
2 * focus_width -
|
||||||
border.top - border.bottom -
|
border.top - border.bottom -
|
||||||
(child_visible ? priv->spacing : 0));
|
(child_visible ? priv->spacing : 0));
|
||||||
label_allocation.height = MAX (label_allocation.height, 1);
|
label_allocation.height = MAX (label_allocation.height, 1);
|
||||||
@ -803,7 +797,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
|
|||||||
gint top_height;
|
gint top_height;
|
||||||
|
|
||||||
top_height = MAX (2 * expander_spacing + expander_size,
|
top_height = MAX (2 * expander_spacing + expander_size,
|
||||||
label_height + (2 * focus_width + 2 * focus_pad));
|
label_height + 2 * focus_width);
|
||||||
|
|
||||||
child_allocation.x = allocation->x + border_width;
|
child_allocation.x = allocation->x + border_width;
|
||||||
child_allocation.y = allocation->y + top_height + child_yoffset;
|
child_allocation.y = allocation->y + top_height + child_yoffset;
|
||||||
@ -920,7 +914,6 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
gint border_width;
|
gint border_width;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gboolean ltr;
|
gboolean ltr;
|
||||||
@ -935,7 +928,6 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
|
|
||||||
gtk_widget_style_get (widget,
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
@ -956,8 +948,8 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
height = label_allocation.height;
|
height = label_allocation.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
width += 2 * focus_pad + 2 * focus_width;
|
width += 2 * focus_width;
|
||||||
height += 2 * focus_pad + 2 * focus_width;
|
height += 2 * focus_width;
|
||||||
|
|
||||||
x = border_width + border.left;
|
x = border_width + border.left;
|
||||||
y = border_width + border.top;
|
y = border_width + border.top;
|
||||||
@ -976,10 +968,10 @@ gtk_expander_paint_focus (GtkExpander *expander,
|
|||||||
{
|
{
|
||||||
get_expander_bounds (expander, &rect);
|
get_expander_bounds (expander, &rect);
|
||||||
|
|
||||||
x = rect.x - allocation.x - focus_pad;
|
x = rect.x - allocation.x;
|
||||||
y = rect.y - allocation.y - focus_pad;
|
y = rect.y - allocation.y;
|
||||||
width = rect.width + 2 * focus_pad;
|
width = rect.width;
|
||||||
height = rect.height + 2 * focus_pad;
|
height = rect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
@ -1414,7 +1406,6 @@ gtk_expander_get_preferred_width (GtkWidget *widget,
|
|||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
@ -1425,7 +1416,6 @@ gtk_expander_get_preferred_width (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1433,7 +1423,7 @@ gtk_expander_get_preferred_width (GtkWidget *widget,
|
|||||||
|
|
||||||
*minimum_size = *natural_size =
|
*minimum_size = *natural_size =
|
||||||
expander_size + 2 * expander_spacing +
|
expander_size + 2 * expander_spacing +
|
||||||
2 * focus_width + 2 * focus_pad;
|
2 * focus_width;
|
||||||
|
|
||||||
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
||||||
{
|
{
|
||||||
@ -1474,7 +1464,6 @@ gtk_expander_get_preferred_height (GtkWidget *widget,
|
|||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
@ -1485,13 +1474,12 @@ gtk_expander_get_preferred_height (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
get_padding_and_border (widget, &border);
|
get_padding_and_border (widget, &border);
|
||||||
|
|
||||||
*minimum_size = *natural_size = 2 * focus_width + 2 * focus_pad;
|
*minimum_size = *natural_size = 2 * focus_width;
|
||||||
|
|
||||||
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
||||||
{
|
{
|
||||||
@ -1536,7 +1524,6 @@ gtk_expander_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
gint expander_size;
|
gint expander_size;
|
||||||
gint expander_spacing;
|
gint expander_spacing;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint focus_pad;
|
|
||||||
gint label_xpad;
|
gint label_xpad;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
@ -1548,16 +1535,14 @@ gtk_expander_get_preferred_height_for_width (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (widget),
|
gtk_widget_style_get (GTK_WIDGET (widget),
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
"focus-padding", &focus_pad,
|
|
||||||
"expander-size", &expander_size,
|
"expander-size", &expander_size,
|
||||||
"expander-spacing", &expander_spacing,
|
"expander-spacing", &expander_spacing,
|
||||||
NULL);
|
NULL);
|
||||||
get_padding_and_border (widget, &border);
|
get_padding_and_border (widget, &border);
|
||||||
|
|
||||||
label_xpad = 2 * border_width + expander_size + 2 * expander_spacing - 2 * focus_width + 2 * focus_pad;
|
label_xpad = 2 * border_width + expander_size + 2 * expander_spacing - 2 * focus_width;
|
||||||
|
|
||||||
*minimum_height = *natural_height = 2 * focus_width + 2 * focus_pad;
|
|
||||||
|
|
||||||
|
*minimum_height = *natural_height = 2 * focus_width;
|
||||||
|
|
||||||
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
if (priv->label_widget && gtk_widget_get_visible (priv->label_widget))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user