imtk
diff test.c @ 20:c7a7ddbe7714
half-arsed automatic layout
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sat, 30 Apr 2011 05:23:59 +0300 |
parents | 737e9047d9c9 |
children | f416d8def7ef |
line diff
1.1 --- a/test.c Tue Apr 26 22:53:21 2011 +0300 1.2 +++ b/test.c Sat Apr 30 05:23:59 2011 +0300 1.3 @@ -125,6 +125,7 @@ 1.4 char *itemlist; 1.5 1.6 imtk_begin(); 1.7 + imtk_layout_start(30, 50, 10, IMTK_VERTICAL); 1.8 1.9 /*glBegin(GL_QUADS); 1.10 glColor3f(0.6, 0.6, 0.6); 1.11 @@ -134,47 +135,49 @@ 1.12 glVertex2f(0, glutGet(GLUT_WINDOW_HEIGHT)); 1.13 glEnd();*/ 1.14 1.15 - if(imtk_button(IMUID, "red", 30, 50)) { 1.16 + if(imtk_button(IMUID, "red", IMTK_AUTO, IMTK_AUTO)) { 1.17 float color[] = {1, 0.4, 0.3, 1}; 1.18 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color); 1.19 glutPostRedisplay(); 1.20 } 1.21 - if(imtk_button(IMUID, "blue", 30, 80)) { 1.22 + if(imtk_button(IMUID, "blue", IMTK_AUTO, IMTK_AUTO)) { 1.23 float color[] = {0.3, 0.4, 1, 1}; 1.24 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color); 1.25 glutPostRedisplay(); 1.26 } 1.27 1.28 itemlist = imtk_create_list("teapot", "torus", "sphere", NULL); 1.29 - if((objsel = imtk_radiogroup(IMUID, itemlist, prev_sel, 30, 120)) != prev_sel) { 1.30 + if((objsel = imtk_radiogroup(IMUID, itemlist, prev_sel, IMTK_AUTO, IMTK_AUTO)) != prev_sel) { 1.31 prev_sel = objsel; 1.32 glutPostRedisplay(); 1.33 } 1.34 imtk_free_list(itemlist); 1.35 1.36 - imtk_textbox(IMUID, textbuf, sizeof textbuf, 30, 200); 1.37 - imtk_textbox(IMUID, textbuf2, sizeof textbuf2, 30, 250); 1.38 + imtk_textbox(IMUID, textbuf, sizeof textbuf, IMTK_AUTO, IMTK_AUTO); 1.39 + imtk_textbox(IMUID, textbuf2, sizeof textbuf2, IMTK_AUTO, IMTK_AUTO); 1.40 1.41 - if((bnshow = imtk_checkbox(IMUID, "show hidden button", 30, 300, bnshow))) { 1.42 - if(imtk_button(IMUID, "yellow", 50, 340)) { 1.43 + if((bnshow = imtk_checkbox(IMUID, "show hidden button", IMTK_AUTO, IMTK_AUTO, bnshow))) { 1.44 + if(imtk_button(IMUID, "yellow", IMTK_AUTO, IMTK_AUTO)) { 1.45 float color[] = {0.8, 0.75, 0.3, 1}; 1.46 glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color); 1.47 glutPostRedisplay(); 1.48 } 1.49 } 1.50 1.51 - val = imtk_slider(IMUID, angle, 0.0, 360.0, 30, 390); 1.52 + val = imtk_slider(IMUID, angle, 0.0, 360.0, IMTK_AUTO, IMTK_AUTO); 1.53 if(val != angle) { 1.54 angle = val; 1.55 glutPostRedisplay(); 1.56 } 1.57 1.58 - imtk_progress(IMUID, val / 360.0, 30, 420); 1.59 + imtk_progress(IMUID, val / 360.0, IMTK_AUTO, IMTK_AUTO); 1.60 1.61 - imtk_label("alpha:", 24, 473); 1.62 - imtk_set_alpha(imtk_slider(IMUID, imtk_get_alpha(), 0.0, 1.0, 60, 470)); 1.63 + imtk_layout_dir(IMTK_HORIZONTAL); 1.64 + imtk_label("alpha:", IMTK_AUTO, IMTK_AUTO); 1.65 + imtk_set_alpha(imtk_slider(IMUID, imtk_get_alpha(), 0.0, 1.0, IMTK_AUTO, IMTK_AUTO)); 1.66 + imtk_layout_dir(IMTK_VERTICAL); 1.67 1.68 - if(imtk_button(IMUID, "Quit", 30, 500)) { 1.69 + if(imtk_button(IMUID, "Quit", IMTK_AUTO, IMTK_AUTO)) { 1.70 exit(0); 1.71 } 1.72