gltiki

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/gltiki.h	Sat Jul 07 07:07:40 2012 +0300
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 +A simple cross-platform OpenGL GUI toolkit
     1.6 +Copyright (C) 2012  John Tsiombikas <nuclear@member.fsf.org>
     1.7 +
     1.8 +This program is free software: you can redistribute it and/or modify
     1.9 +it under the terms of the GNU Lesser General Public License as published by
    1.10 +the Free Software Foundation, either version 3 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU Lesser General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU Lesser General Public License
    1.19 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 +*/
    1.21 +#ifndef GLTIKI_H_
    1.22 +#define GLTIKI_H_
    1.23 +
    1.24 +typedef struct gltk_widget gltk_widget;
    1.25 +typedef struct gltk_item gltk_item;
    1.26 +typedef struct gltk_pixmap gltk_pixmap;
    1.27 +
    1.28 +typedef void (*gltk_callback)(gltk_widget *w, void *cls);
    1.29 +
    1.30 +#ifdef __cplusplus
    1.31 +extern "C" {
    1.32 +#endif
    1.33 +
    1.34 +int gltk_init(void);
    1.35 +void gltk_cleanup(void);
    1.36 +
    1.37 +gltk_widget *gltk_create_widget(void);
    1.38 +void gltk_free_widget(gltk_widget *w);
    1.39 +
    1.40 +void gltk_move(gltk_widget *w, float x, float y);
    1.41 +void gltk_resize(gltk_widget *w, float xsz, float ysz);
    1.42 +
    1.43 +/* label */
    1.44 +gltk_widget *gltk_label(const char *text);
    1.45 +
    1.46 +/* button */
    1.47 +gltk_widget *gltk_button(const char *text);
    1.48 +gltk_widget *gltk_button_cb(const char *text, gltk_callback cb, void *cls);
    1.49 +
    1.50 +/* checkbox */
    1.51 +gltk_widget *gltk_checkbox(const char *text, int checked);
    1.52 +gltk_widget *gltk_checkbox_cb(const char *text, int checked, gltk_callback cb, void *cls);
    1.53 +gltk_widget *gltk_checkbox_link(const char *text, int checked, int *link);
    1.54 +
    1.55 +void gltk_set_checkbox_state(gltk_widget *w, int val);
    1.56 +int gltk_get_checkbox_state(gltk_widget *w);
    1.57 +
    1.58 +/* continuous slider */
    1.59 +gltk_widget *gltk_slider(float val, float min, float max);
    1.60 +gltk_widget *gltk_slider_cb(float val, float min, float max, gltk_callback cb, void *cls);
    1.61 +gltk_widget *gltk_slider_link(float val, float min, float max, float *link);
    1.62 +
    1.63 +void gltk_set_slider_range(gltk_widget *w, float min, float max);
    1.64 +void gltk_set_slider_value(gltk_widget *w, float val);
    1.65 +float gltk_get_slider_value(gltk_widget *w);
    1.66 +
    1.67 +/* discrete int slider */
    1.68 +gltk_widget *gltk_int_slider(int val, int min, int max);
    1.69 +gltk_widget *gltk_int_slider_cb(int val, int min, int max, gltk_callback cb, void *cls);
    1.70 +gltk_widget *gltk_int_slider_link(int val, int min, int max, int *link);
    1.71 +
    1.72 +void gltk_set_int_slider_range(gltk_widget *w, int min, int max);
    1.73 +void gltk_set_int_slider_value(gltk_widget *w, int val);
    1.74 +int gltk_get_int_slider_value(gltk_widget *w);
    1.75 +
    1.76 +/* listbox */
    1.77 +gltk_widget *gltk_listbox(gltk_item *items, int sel, int visrows);
    1.78 +gltk_widget *gltk_listbox_cb(gltk_item *items, int sel, int visrows, gltk_callback cb, void *cls);
    1.79 +gltk_widget *gltk_listbox_link(gltk_item *items, int sel, int visrows, int *link);
    1.80 +
    1.81 +gltk_item *gltk_create_item(const char *text, gltk_pixmap *img);
    1.82 +void gltk_free_item(gltk_item *item);
    1.83 +
    1.84 +void gltk_set_listbox_selection(gltk_widget *listbox, int sel);
    1.85 +int gltk_get_listbox_selection(gltk_widget *listbox);
    1.86 +void gltk_add_listbox_item(gltk_widget *listbox, gltk_item *item);
    1.87 +void gltk_remove_listbox_item(gltk_widget *listbox, gltk_item *item);
    1.88 +gltk_item *gltk_get_listbox_item(gltk_widget *listbox, int idx);
    1.89 +
    1.90 +/* events */
    1.91 +void gltk_event_button(int bn, int state, float x, float y);
    1.92 +void gltk_event_motion(float x, float y);
    1.93 +void gltk_event_keyboard(int key, int state);
    1.94 +
    1.95 +/* drawing */
    1.96 +void gltk_draw(gltk_widget *wlist);
    1.97 +
    1.98 +/* GUI file format */
    1.99 +gltk_widget *gltk_load(const char *fname);
   1.100 +int gltk_save(const char *fname, gltk_widget *wlist);
   1.101 +
   1.102 +#ifdef __cplusplus
   1.103 +}
   1.104 +#endif
   1.105 +
   1.106 +#endif	/* GLTIKI_H_ */