imtk

diff src/progress.c @ 13:9c7987064bb0

- fixed the frame drawing a bit - added global alpha value and various drawing parameters - backported the checkbox check mark from glamtk - fixed progress bar drawing so that the bevels of the trough and the bar won't overlap
author John Tsiombikas <nuclear@siggraph.org>
date Mon, 18 Apr 2011 06:15:46 +0300
parents 10604ff95527
children df2bc9406561
line diff
     1.1 --- a/src/progress.c	Sun Apr 17 18:20:23 2011 +0300
     1.2 +++ b/src/progress.c	Mon Apr 18 06:15:46 2011 +0300
     1.3 @@ -1,7 +1,8 @@
     1.4  #include "imtk.h"
     1.5  #include "draw.h"
     1.6  
     1.7 -#define SLIDER_SIZE             100
     1.8 +#define PROGR_SIZE             100
     1.9 +#define PROGR_HEIGHT			15
    1.10  
    1.11  static void draw_progress(int id, float pos, int x, int y);
    1.12  
    1.13 @@ -12,18 +13,19 @@
    1.14  
    1.15  static void draw_progress(int id, float pos, int x, int y)
    1.16  {
    1.17 -	int bar_size = SLIDER_SIZE * pos;
    1.18 +	int bar_size = PROGR_SIZE * pos;
    1.19 +	float b = imtk_get_bevel_width();
    1.20  
    1.21  	if(pos < 0.0) pos = 0.0;
    1.22  	if(pos > 1.0) pos = 1.0;
    1.23  
    1.24  	/* through */
    1.25 -	imtk_draw_rect(x - 1, y - 1, SLIDER_SIZE + 1, 18, imtk_get_color(IMTK_BASE_COLOR));
    1.26 -	imtk_draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET);
    1.27 +	imtk_draw_rect(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, imtk_get_color(IMTK_BASE_COLOR));
    1.28 +	imtk_draw_frame(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, FRAME_INSET);
    1.29  
    1.30  	if(pos > 0.0) {
    1.31  		/* bar */
    1.32 -		imtk_draw_rect(x, y, bar_size, 15, imtk_get_color(IMTK_BASE_COLOR));
    1.33 -		imtk_draw_frame(x, y, bar_size, 15, FRAME_OUTSET);
    1.34 +		imtk_draw_rect(x, y, bar_size, PROGR_HEIGHT, imtk_get_color(IMTK_BASE_COLOR));
    1.35 +		imtk_draw_frame(x, y, bar_size, PROGR_HEIGHT, FRAME_OUTSET);
    1.36  	}
    1.37  }