# HG changeset patch # User John Tsiombikas # Date 1302938879 -10800 # Node ID eae09a1dca1d6e7a5874dedb8e41113162663dd6 # Parent 10604ff9552782477fbc16a7c3470011e8dddd26 checkbox is active over the whole length of the label too diff -r 10604ff95527 -r eae09a1dca1d src/checkbox.c --- a/src/checkbox.c Thu Apr 14 23:21:56 2011 +0300 +++ b/src/checkbox.c Sat Apr 16 10:27:59 2011 +0300 @@ -7,8 +7,7 @@ #define CHECKBOX_SIZE 14 -static void draw_checkbox(int id, const char *label, int x, int y, int state); - +static void draw_checkbox(int id, const char *label, int x, int y, int state, int over); int imtk_checkbox(int id, const char *label, int x, int y, int state) { @@ -17,7 +16,7 @@ assert(id >= 0); - if(imtk_hit_test(x, y, sz, sz)) { + if(imtk_hit_test(x, y, sz + imtk_string_size(label) + 5, sz)) { imtk_set_hot(id); over = 1; } @@ -35,15 +34,15 @@ } } - draw_checkbox(id, label, x, y, state); + draw_checkbox(id, label, x, y, state, over); return state; } -static void draw_checkbox(int id, const char *label, int x, int y, int state) +static void draw_checkbox(int id, const char *label, int x, int y, int state, int over) { static const int sz = CHECKBOX_SIZE; - if(imtk_hit_test(x, y, sz, sz)) { + if(over) { glColor4fv(imtk_get_color(IMTK_FOCUS_COLOR)); } else { glColor4fv(imtk_get_color(IMTK_BASE_COLOR));