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_IMPL_H_ nuclear@0: #define GLTIKI_IMPL_H_ nuclear@0: nuclear@0: #include "gltiki.h" nuclear@0: nuclear@0: enum { UNKNOWN, LABEL, BUTTON, CHECKBOX, SLIDER, INTSLIDER, LISTBOX }; nuclear@0: nuclear@0: #define GLTK_CAST(w, t, ctype) \ nuclear@0: ((w)->type == (t) ? ((ctype)(w)) : 0) nuclear@0: nuclear@0: #define GLTK_LABEL(w) GLTK_CAST(w, LABEL, struct gltk_label) nuclear@0: #define GLTK_BUTTON(w) GLTK_CAST(w, BUTTON, struct gltk_button) nuclear@0: #define GLTK_CHECKBOX(w) GLTK_CAST(w, CHECKBOX, struct gltk_checkbox) nuclear@0: #define GLTK_SLIDER(w) GLTK_CAST(w, SLIDER, struct gltk_slider) nuclear@0: #define GLTK_INTSLIDER(w) GLTK_CAST(w, INTSLIDER, struct gltk_int_slider) nuclear@0: #define GLTK_LISTBOX(w) GLTK_CAST(w, LISTBOX, struct gltk_listbox) nuclear@0: nuclear@0: #define GLTK_WIDGET_VARS \ nuclear@0: int type; \ nuclear@0: float x, y, width, height; \ nuclear@0: int active; \ nuclear@0: struct gltk_widget *next; \ nuclear@0: gltk_callback callback; \ nuclear@0: void *cls; \ nuclear@0: void (*draw)() nuclear@0: nuclear@0: struct gltk_widget { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_label { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: char *text; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_button { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: char *text; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_checkbox { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: char *text; nuclear@0: int state; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_slider { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: float value, min, max; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_int_slider { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: int value, min, max; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_listbox { nuclear@0: GLTK_WIDGET_VARS; nuclear@0: int sel; nuclear@0: int vislines; nuclear@0: gltk_item *items, *items_tail, *sel_item; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_item { nuclear@0: char *text; nuclear@0: gltk_pixmap *img; nuclear@0: }; nuclear@0: nuclear@0: struct gltk_pixmap { nuclear@0: int width, height; nuclear@0: unsigned char *pixels; nuclear@0: }; nuclear@0: nuclear@0: #endif /* GLTIKI_IMPL_H_ */