[gtk+/composite-templates] levelbar: start filling from the bottom
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] levelbar: start filling from the bottom
- Date: Sat, 6 Oct 2012 17:02:56 +0000 (UTC)
commit 1990420efd68353b9c32cfdb8a6059ef0ea83b18
Author: Stefano Facchini <stefano facchini gmail com>
Date: Mon Sep 17 22:29:54 2012 +0200
levelbar: start filling from the bottom
As long as we don't have an API for explicitly inverting the bar, it
makes more sense for the progress in vertical orientation to fill from
the bottom.
gtk/gtklevelbar.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index d82d385..72ee80f 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -339,9 +339,14 @@ gtk_level_bar_draw_fill_continuous (GtkLevelBar *self,
(self->priv->max_value - self->priv->min_value);
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- block_area.width = (gint) floor (block_area.width * fill_percentage);
+ {
+ block_area.width = (gint) floor (block_area.width * fill_percentage);
+ }
else
- block_area.height = (gint) floor (block_area.height * fill_percentage);
+ {
+ block_area.height = (gint) floor (block_area.height * fill_percentage);
+ block_area.y += base_area.height - block_area.height;
+ }
gtk_render_background (context, cr, block_area.x, block_area.y,
block_area.width, block_area.height);
@@ -392,6 +397,7 @@ gtk_level_bar_draw_fill_discrete (GtkLevelBar *self,
{
block_draw_width = MAX (block_draw_width, block_area.width - block_margin.left - block_margin.right);
block_area.x += block_margin.left;
+ block_area.y += block_area.height - block_draw_height;
}
for (idx = 0; idx < num_blocks; idx++)
@@ -399,7 +405,7 @@ gtk_level_bar_draw_fill_discrete (GtkLevelBar *self,
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
block_area.x += block_margin.left;
else
- block_area.y += block_margin.top;
+ block_area.y -= block_margin.bottom;
if (idx > num_filled - 1)
gtk_style_context_add_class (context, STYLE_CLASS_EMPTY_FILL_BLOCK);
@@ -414,7 +420,7 @@ gtk_level_bar_draw_fill_discrete (GtkLevelBar *self,
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
block_area.x += block_draw_width + block_margin.right;
else
- block_area.y += block_draw_height + block_margin.bottom;
+ block_area.y -= block_draw_height + block_margin.top;
}
gtk_style_context_restore (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]