imtk

annotate src/progress.c @ 12:17c9525b2e35

merged -lGLU fix with listbox patch
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 17 Apr 2011 18:20:23 +0300
parents 6d35e6c7b2ca
children 9c7987064bb0
rev   line source
nuclear@7 1 #include "imtk.h"
nuclear@7 2 #include "draw.h"
nuclear@7 3
nuclear@7 4 #define SLIDER_SIZE 100
nuclear@7 5
nuclear@7 6 static void draw_progress(int id, float pos, int x, int y);
nuclear@7 7
nuclear@7 8 void imtk_progress(int id, float pos, int x, int y)
nuclear@7 9 {
nuclear@7 10 draw_progress(id, pos, x, y);
nuclear@7 11 }
nuclear@7 12
nuclear@7 13 static void draw_progress(int id, float pos, int x, int y)
nuclear@7 14 {
nuclear@7 15 int bar_size = SLIDER_SIZE * pos;
nuclear@7 16
nuclear@7 17 if(pos < 0.0) pos = 0.0;
nuclear@7 18 if(pos > 1.0) pos = 1.0;
nuclear@7 19
nuclear@7 20 /* through */
nuclear@8 21 imtk_draw_rect(x - 1, y - 1, SLIDER_SIZE + 1, 18, imtk_get_color(IMTK_BASE_COLOR));
nuclear@7 22 imtk_draw_frame(x - 1, y - 1, SLIDER_SIZE + 2, 17, FRAME_INSET);
nuclear@7 23
nuclear@7 24 if(pos > 0.0) {
nuclear@7 25 /* bar */
nuclear@8 26 imtk_draw_rect(x, y, bar_size, 15, imtk_get_color(IMTK_BASE_COLOR));
nuclear@7 27 imtk_draw_frame(x, y, bar_size, 15, FRAME_OUTSET);
nuclear@7 28 }
nuclear@7 29 }