mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 20:51:07 +00:00
levelbar: loop over all block gadgets to determine min size
Instead of just picking the first. This is because the theme might set a border on only one of them, like the HighContrast theme does.
This commit is contained in:
parent
183bcb41ec
commit
637ade656a
@ -255,23 +255,6 @@ gtk_level_bar_value_in_interval (GtkLevelBar *self,
|
||||
(value <= self->priv->max_value));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_get_min_block_size (GtkLevelBar *self,
|
||||
gint *block_width,
|
||||
gint *block_height)
|
||||
{
|
||||
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[0],
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
-1,
|
||||
block_width, NULL,
|
||||
NULL, NULL);
|
||||
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[0],
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
-1,
|
||||
block_height, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_level_bar_get_num_blocks (GtkLevelBar *self)
|
||||
{
|
||||
@ -292,6 +275,35 @@ gtk_level_bar_get_num_block_nodes (GtkLevelBar *self)
|
||||
return gtk_level_bar_get_num_blocks (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_get_min_block_size (GtkLevelBar *self,
|
||||
gint *block_width,
|
||||
gint *block_height)
|
||||
{
|
||||
guint i, n_blocks;
|
||||
gint width, height;
|
||||
|
||||
*block_width = *block_height = 0;
|
||||
n_blocks = gtk_level_bar_get_num_block_nodes (self);
|
||||
|
||||
for (i = 0; i < n_blocks; i++)
|
||||
{
|
||||
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[i],
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
-1,
|
||||
&width, NULL,
|
||||
NULL, NULL);
|
||||
gtk_css_gadget_get_preferred_size (self->priv->block_gadget[i],
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
-1,
|
||||
&height, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
*block_width = MAX (width, *block_width);
|
||||
*block_height = MAX (height, *block_height);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_level_bar_get_real_inverted (GtkLevelBar *self)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user