imtk

view 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 source
1 #include "imtk.h"
2 #include "draw.h"
4 #define PROGR_SIZE 100
5 #define PROGR_HEIGHT 15
7 static void draw_progress(int id, float pos, int x, int y);
9 void imtk_progress(int id, float pos, int x, int y)
10 {
11 draw_progress(id, pos, x, y);
12 }
14 static void draw_progress(int id, float pos, int x, int y)
15 {
16 int bar_size = PROGR_SIZE * pos;
17 float b = imtk_get_bevel_width();
19 if(pos < 0.0) pos = 0.0;
20 if(pos > 1.0) pos = 1.0;
22 /* through */
23 imtk_draw_rect(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, imtk_get_color(IMTK_BASE_COLOR));
24 imtk_draw_frame(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, FRAME_INSET);
26 if(pos > 0.0) {
27 /* bar */
28 imtk_draw_rect(x, y, bar_size, PROGR_HEIGHT, imtk_get_color(IMTK_BASE_COLOR));
29 imtk_draw_frame(x, y, bar_size, PROGR_HEIGHT, FRAME_OUTSET);
30 }
31 }