]> git.decadent.org.uk Git - ion3.git/blobdiff - mod_statusbar/draw.c
Imported Upstream version 20090110
[ion3.git] / mod_statusbar / draw.c
index 29e9f0230a093be52c260e1a580d5489d084e732..6a9750ecf26843a9430ce3350375fb6c3d5e8876 100644 (file)
@@ -1,12 +1,9 @@
 /*
  * ion/mod_statusbar/draw.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2006
+ * Copyright (c) Tuomo Valkonen 1999-2009
  *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
  */
 
 #include <string.h>
@@ -109,7 +106,7 @@ void statusbar_calculate_xs(WStatusBar *sb)
 
 static void draw_elems(GrBrush *brush, WRectangle *g, int ty,
                        WSBElem *elems, int nelems, bool needfill, 
-                       const char *dfltattr, bool complete)
+                       bool complete)
 {
     int prevx=g->x;
     int maxx=g->x+g->w;
@@ -125,8 +122,15 @@ static void draw_elems(GrBrush *brush, WRectangle *g, int ty,
             const char *s=(elems->text!=NULL
                            ? elems->text 
                            : STATUSBAR_NX_STR);
-            grbrush_draw_string(brush, elems->x, ty, s, strlen(s), needfill, 
-                                elems->attr ? elems->attr : dfltattr);
+            
+            grbrush_set_attr(brush, elems->attr);
+            grbrush_set_attr(brush, elems->meter);
+                
+            grbrush_draw_string(brush, elems->x, ty, s, strlen(s), needfill);
+            
+            grbrush_unset_attr(brush, elems->meter);
+            grbrush_unset_attr(brush, elems->attr);
+            
             prevx=elems->x+elems->text_w;
         }
         elems++;
@@ -162,7 +166,7 @@ void statusbar_draw(WStatusBar *sb, bool complete)
     
     grbrush_begin(sb->brush, &g, (complete ? 0 : GRBRUSH_NO_CLEAR_OK));
     
-    grbrush_draw_border(sb->brush, &g, NULL);
+    grbrush_draw_border(sb->brush, &g);
     
     if(sb->elems==NULL)
         return;
@@ -174,8 +178,7 @@ void statusbar_draw(WStatusBar *sb, bool complete)
 
     ty=(g.y+fnte.baseline+(g.h-fnte.max_height)/2);
         
-    draw_elems(sb->brush, &g, ty, sb->elems, sb->nelems,
-               TRUE, NULL, complete);
+    draw_elems(sb->brush, &g, ty, sb->elems, sb->nelems, TRUE, complete);
     
     grbrush_end(sb->brush);
 }