imtk
diff src/checkbox.c @ 20:c7a7ddbe7714
half-arsed automatic layout
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sat, 30 Apr 2011 05:23:59 +0300 |
parents | df2bc9406561 |
children |
line diff
1.1 --- a/src/checkbox.c Tue Apr 26 22:53:21 2011 +0300 1.2 +++ b/src/checkbox.c Sat Apr 30 05:23:59 2011 +0300 1.3 @@ -13,11 +13,16 @@ 1.4 int imtk_checkbox(int id, const char *label, int x, int y, int state) 1.5 { 1.6 int sz = CHECKBOX_SIZE; 1.7 - int over = 0; 1.8 + int full_size, over = 0; 1.9 1.10 assert(id >= 0); 1.11 1.12 - if(imtk_hit_test(x, y, sz + imtk_string_size(label) + 5, sz)) { 1.13 + if(x == IMTK_AUTO || y == IMTK_AUTO) { 1.14 + imtk_layout_get_pos(&x, &y); 1.15 + } 1.16 + 1.17 + full_size = sz + imtk_string_size(label) + 5; 1.18 + if(imtk_hit_test(x, y, full_size, sz)) { 1.19 imtk_set_hot(id); 1.20 over = 1; 1.21 } 1.22 @@ -36,6 +41,7 @@ 1.23 } 1.24 1.25 draw_checkbox(id, label, x, y, state, over); 1.26 + imtk_layout_advance(full_size, sz); 1.27 return state; 1.28 } 1.29