# HG changeset patch # User John Tsiombikas # Date 1303053475 -10800 # Node ID 467a520f5c00fe632f2fef9329aaff986ef3316e # Parent 1b27a69603aca355b72a723e28fecc439fca1682 implemented the listbox correctly, no scrollbars or explicit sizing yet diff -r 1b27a69603ac -r 467a520f5c00 src/imtk.h --- a/src/imtk.h Sat Apr 16 22:59:23 2011 +0300 +++ b/src/imtk.h Sun Apr 17 18:17:55 2011 +0300 @@ -43,16 +43,14 @@ void imtk_textbox(int id, char *textbuf, size_t buf_sz, int x, int y); float imtk_slider(int id, float pos, float min, float max, int x, int y); void imtk_progress(int id, float pos, int x, int y); +int imtk_listbox(int id, const char *list, int sel, int x, int y); /* -int imtk_listbox(int id, const char *list, int sel, int x, int y); int imtk_combobox(int id, char *textbuf, size_t buf_sz, const char *list, int sel, int x, int y); */ /* helper functions to create and destroy item lists for listboxes and comboboxes */ -/* char *imtk_create_list(const char *first, ...); void imtk_free_list(char *list); -*/ #ifdef __cplusplus } diff -r 1b27a69603ac -r 467a520f5c00 test.c --- a/test.c Sat Apr 16 22:59:23 2011 +0300 +++ b/test.c Sun Apr 17 18:17:55 2011 +0300 @@ -108,8 +108,8 @@ static char textbuf[256]; static char textbuf2[256]; static float val; - /*static int prev_sel; - char *itemlist;*/ + static int prev_sel = 0; + char *itemlist; imtk_begin(); @@ -132,12 +132,12 @@ glutPostRedisplay(); } - /*itemlist = imtk_create_list("teapot", "torus", "sphere", NULL); + itemlist = imtk_create_list("teapot", "torus", "sphere", NULL); if((objsel = imtk_listbox(IMUID, itemlist, prev_sel, 30, 120)) != prev_sel) { prev_sel = objsel; glutPostRedisplay(); } - imtk_free_list(itemlist);*/ + imtk_free_list(itemlist); imtk_textbox(IMUID, textbuf, sizeof textbuf, 30, 200); imtk_textbox(IMUID, textbuf2, sizeof textbuf2, 30, 250);