gltiki

annotate include/gltiki.h @ 0:ea177566fe79

initial commit
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sat, 07 Jul 2012 07:07:40 +0300
parents
children
rev   line source
nuclear@0 1 /*
nuclear@0 2 A simple cross-platform OpenGL GUI toolkit
nuclear@0 3 Copyright (C) 2012 John Tsiombikas <nuclear@member.fsf.org>
nuclear@0 4
nuclear@0 5 This program is free software: you can redistribute it and/or modify
nuclear@0 6 it under the terms of the GNU Lesser General Public License as published by
nuclear@0 7 the Free Software Foundation, either version 3 of the License, or
nuclear@0 8 (at your option) any later version.
nuclear@0 9
nuclear@0 10 This program is distributed in the hope that it will be useful,
nuclear@0 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
nuclear@0 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
nuclear@0 13 GNU Lesser General Public License for more details.
nuclear@0 14
nuclear@0 15 You should have received a copy of the GNU Lesser General Public License
nuclear@0 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
nuclear@0 17 */
nuclear@0 18 #ifndef GLTIKI_H_
nuclear@0 19 #define GLTIKI_H_
nuclear@0 20
nuclear@0 21 typedef struct gltk_widget gltk_widget;
nuclear@0 22 typedef struct gltk_item gltk_item;
nuclear@0 23 typedef struct gltk_pixmap gltk_pixmap;
nuclear@0 24
nuclear@0 25 typedef void (*gltk_callback)(gltk_widget *w, void *cls);
nuclear@0 26
nuclear@0 27 #ifdef __cplusplus
nuclear@0 28 extern "C" {
nuclear@0 29 #endif
nuclear@0 30
nuclear@0 31 int gltk_init(void);
nuclear@0 32 void gltk_cleanup(void);
nuclear@0 33
nuclear@0 34 gltk_widget *gltk_create_widget(void);
nuclear@0 35 void gltk_free_widget(gltk_widget *w);
nuclear@0 36
nuclear@0 37 void gltk_move(gltk_widget *w, float x, float y);
nuclear@0 38 void gltk_resize(gltk_widget *w, float xsz, float ysz);
nuclear@0 39
nuclear@0 40 /* label */
nuclear@0 41 gltk_widget *gltk_label(const char *text);
nuclear@0 42
nuclear@0 43 /* button */
nuclear@0 44 gltk_widget *gltk_button(const char *text);
nuclear@0 45 gltk_widget *gltk_button_cb(const char *text, gltk_callback cb, void *cls);
nuclear@0 46
nuclear@0 47 /* checkbox */
nuclear@0 48 gltk_widget *gltk_checkbox(const char *text, int checked);
nuclear@0 49 gltk_widget *gltk_checkbox_cb(const char *text, int checked, gltk_callback cb, void *cls);
nuclear@0 50 gltk_widget *gltk_checkbox_link(const char *text, int checked, int *link);
nuclear@0 51
nuclear@0 52 void gltk_set_checkbox_state(gltk_widget *w, int val);
nuclear@0 53 int gltk_get_checkbox_state(gltk_widget *w);
nuclear@0 54
nuclear@0 55 /* continuous slider */
nuclear@0 56 gltk_widget *gltk_slider(float val, float min, float max);
nuclear@0 57 gltk_widget *gltk_slider_cb(float val, float min, float max, gltk_callback cb, void *cls);
nuclear@0 58 gltk_widget *gltk_slider_link(float val, float min, float max, float *link);
nuclear@0 59
nuclear@0 60 void gltk_set_slider_range(gltk_widget *w, float min, float max);
nuclear@0 61 void gltk_set_slider_value(gltk_widget *w, float val);
nuclear@0 62 float gltk_get_slider_value(gltk_widget *w);
nuclear@0 63
nuclear@0 64 /* discrete int slider */
nuclear@0 65 gltk_widget *gltk_int_slider(int val, int min, int max);
nuclear@0 66 gltk_widget *gltk_int_slider_cb(int val, int min, int max, gltk_callback cb, void *cls);
nuclear@0 67 gltk_widget *gltk_int_slider_link(int val, int min, int max, int *link);
nuclear@0 68
nuclear@0 69 void gltk_set_int_slider_range(gltk_widget *w, int min, int max);
nuclear@0 70 void gltk_set_int_slider_value(gltk_widget *w, int val);
nuclear@0 71 int gltk_get_int_slider_value(gltk_widget *w);
nuclear@0 72
nuclear@0 73 /* listbox */
nuclear@0 74 gltk_widget *gltk_listbox(gltk_item *items, int sel, int visrows);
nuclear@0 75 gltk_widget *gltk_listbox_cb(gltk_item *items, int sel, int visrows, gltk_callback cb, void *cls);
nuclear@0 76 gltk_widget *gltk_listbox_link(gltk_item *items, int sel, int visrows, int *link);
nuclear@0 77
nuclear@0 78 gltk_item *gltk_create_item(const char *text, gltk_pixmap *img);
nuclear@0 79 void gltk_free_item(gltk_item *item);
nuclear@0 80
nuclear@0 81 void gltk_set_listbox_selection(gltk_widget *listbox, int sel);
nuclear@0 82 int gltk_get_listbox_selection(gltk_widget *listbox);
nuclear@0 83 void gltk_add_listbox_item(gltk_widget *listbox, gltk_item *item);
nuclear@0 84 void gltk_remove_listbox_item(gltk_widget *listbox, gltk_item *item);
nuclear@0 85 gltk_item *gltk_get_listbox_item(gltk_widget *listbox, int idx);
nuclear@0 86
nuclear@0 87 /* events */
nuclear@0 88 void gltk_event_button(int bn, int state, float x, float y);
nuclear@0 89 void gltk_event_motion(float x, float y);
nuclear@0 90 void gltk_event_keyboard(int key, int state);
nuclear@0 91
nuclear@0 92 /* drawing */
nuclear@0 93 void gltk_draw(gltk_widget *wlist);
nuclear@0 94
nuclear@0 95 /* GUI file format */
nuclear@0 96 gltk_widget *gltk_load(const char *fname);
nuclear@0 97 int gltk_save(const char *fname, gltk_widget *wlist);
nuclear@0 98
nuclear@0 99 #ifdef __cplusplus
nuclear@0 100 }
nuclear@0 101 #endif
nuclear@0 102
nuclear@0 103 #endif /* GLTIKI_H_ */