nuclear@0: /* nuclear@0: A simple cross-platform OpenGL GUI toolkit nuclear@0: Copyright (C) 2012 John Tsiombikas nuclear@0: nuclear@0: This program is free software: you can redistribute it and/or modify nuclear@0: it under the terms of the GNU Lesser General Public License as published by nuclear@0: the Free Software Foundation, either version 3 of the License, or nuclear@0: (at your option) any later version. nuclear@0: nuclear@0: This program is distributed in the hope that it will be useful, nuclear@0: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@0: GNU Lesser General Public License for more details. nuclear@0: nuclear@0: You should have received a copy of the GNU Lesser General Public License nuclear@0: along with this program. If not, see . nuclear@0: */ nuclear@0: #ifndef GLTIKI_H_ nuclear@0: #define GLTIKI_H_ nuclear@0: nuclear@0: typedef struct gltk_widget gltk_widget; nuclear@0: typedef struct gltk_item gltk_item; nuclear@0: typedef struct gltk_pixmap gltk_pixmap; nuclear@0: nuclear@0: typedef void (*gltk_callback)(gltk_widget *w, void *cls); nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: int gltk_init(void); nuclear@0: void gltk_cleanup(void); nuclear@0: nuclear@0: gltk_widget *gltk_create_widget(void); nuclear@0: void gltk_free_widget(gltk_widget *w); nuclear@0: nuclear@0: void gltk_move(gltk_widget *w, float x, float y); nuclear@0: void gltk_resize(gltk_widget *w, float xsz, float ysz); nuclear@0: nuclear@0: /* label */ nuclear@0: gltk_widget *gltk_label(const char *text); nuclear@0: nuclear@0: /* button */ nuclear@0: gltk_widget *gltk_button(const char *text); nuclear@0: gltk_widget *gltk_button_cb(const char *text, gltk_callback cb, void *cls); nuclear@0: nuclear@0: /* checkbox */ nuclear@0: gltk_widget *gltk_checkbox(const char *text, int checked); nuclear@0: gltk_widget *gltk_checkbox_cb(const char *text, int checked, gltk_callback cb, void *cls); nuclear@0: gltk_widget *gltk_checkbox_link(const char *text, int checked, int *link); nuclear@0: nuclear@0: void gltk_set_checkbox_state(gltk_widget *w, int val); nuclear@0: int gltk_get_checkbox_state(gltk_widget *w); nuclear@0: nuclear@0: /* continuous slider */ nuclear@0: gltk_widget *gltk_slider(float val, float min, float max); nuclear@0: gltk_widget *gltk_slider_cb(float val, float min, float max, gltk_callback cb, void *cls); nuclear@0: gltk_widget *gltk_slider_link(float val, float min, float max, float *link); nuclear@0: nuclear@0: void gltk_set_slider_range(gltk_widget *w, float min, float max); nuclear@0: void gltk_set_slider_value(gltk_widget *w, float val); nuclear@0: float gltk_get_slider_value(gltk_widget *w); nuclear@0: nuclear@0: /* discrete int slider */ nuclear@0: gltk_widget *gltk_int_slider(int val, int min, int max); nuclear@0: gltk_widget *gltk_int_slider_cb(int val, int min, int max, gltk_callback cb, void *cls); nuclear@0: gltk_widget *gltk_int_slider_link(int val, int min, int max, int *link); nuclear@0: nuclear@0: void gltk_set_int_slider_range(gltk_widget *w, int min, int max); nuclear@0: void gltk_set_int_slider_value(gltk_widget *w, int val); nuclear@0: int gltk_get_int_slider_value(gltk_widget *w); nuclear@0: nuclear@0: /* listbox */ nuclear@0: gltk_widget *gltk_listbox(gltk_item *items, int sel, int visrows); nuclear@0: gltk_widget *gltk_listbox_cb(gltk_item *items, int sel, int visrows, gltk_callback cb, void *cls); nuclear@0: gltk_widget *gltk_listbox_link(gltk_item *items, int sel, int visrows, int *link); nuclear@0: nuclear@0: gltk_item *gltk_create_item(const char *text, gltk_pixmap *img); nuclear@0: void gltk_free_item(gltk_item *item); nuclear@0: nuclear@0: void gltk_set_listbox_selection(gltk_widget *listbox, int sel); nuclear@0: int gltk_get_listbox_selection(gltk_widget *listbox); nuclear@0: void gltk_add_listbox_item(gltk_widget *listbox, gltk_item *item); nuclear@0: void gltk_remove_listbox_item(gltk_widget *listbox, gltk_item *item); nuclear@0: gltk_item *gltk_get_listbox_item(gltk_widget *listbox, int idx); nuclear@0: nuclear@0: /* events */ nuclear@0: void gltk_event_button(int bn, int state, float x, float y); nuclear@0: void gltk_event_motion(float x, float y); nuclear@0: void gltk_event_keyboard(int key, int state); nuclear@0: nuclear@0: /* drawing */ nuclear@0: void gltk_draw(gltk_widget *wlist); nuclear@0: nuclear@0: /* GUI file format */ nuclear@0: gltk_widget *gltk_load(const char *fname); nuclear@0: int gltk_save(const char *fname, gltk_widget *wlist); nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: #endif /* GLTIKI_H_ */