gltiki

view include/gltiki.h @ 0:ea177566fe79

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