gltiki
diff src/gltiki_impl.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/src/gltiki_impl.h Sat Jul 07 07:07:40 2012 +0300 1.3 @@ -0,0 +1,91 @@ 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_IMPL_H_ 1.22 +#define GLTIKI_IMPL_H_ 1.23 + 1.24 +#include "gltiki.h" 1.25 + 1.26 +enum { UNKNOWN, LABEL, BUTTON, CHECKBOX, SLIDER, INTSLIDER, LISTBOX }; 1.27 + 1.28 +#define GLTK_CAST(w, t, ctype) \ 1.29 + ((w)->type == (t) ? ((ctype)(w)) : 0) 1.30 + 1.31 +#define GLTK_LABEL(w) GLTK_CAST(w, LABEL, struct gltk_label) 1.32 +#define GLTK_BUTTON(w) GLTK_CAST(w, BUTTON, struct gltk_button) 1.33 +#define GLTK_CHECKBOX(w) GLTK_CAST(w, CHECKBOX, struct gltk_checkbox) 1.34 +#define GLTK_SLIDER(w) GLTK_CAST(w, SLIDER, struct gltk_slider) 1.35 +#define GLTK_INTSLIDER(w) GLTK_CAST(w, INTSLIDER, struct gltk_int_slider) 1.36 +#define GLTK_LISTBOX(w) GLTK_CAST(w, LISTBOX, struct gltk_listbox) 1.37 + 1.38 +#define GLTK_WIDGET_VARS \ 1.39 + int type; \ 1.40 + float x, y, width, height; \ 1.41 + int active; \ 1.42 + struct gltk_widget *next; \ 1.43 + gltk_callback callback; \ 1.44 + void *cls; \ 1.45 + void (*draw)() 1.46 + 1.47 +struct gltk_widget { 1.48 + GLTK_WIDGET_VARS; 1.49 +}; 1.50 + 1.51 +struct gltk_label { 1.52 + GLTK_WIDGET_VARS; 1.53 + char *text; 1.54 +}; 1.55 + 1.56 +struct gltk_button { 1.57 + GLTK_WIDGET_VARS; 1.58 + char *text; 1.59 +}; 1.60 + 1.61 +struct gltk_checkbox { 1.62 + GLTK_WIDGET_VARS; 1.63 + char *text; 1.64 + int state; 1.65 +}; 1.66 + 1.67 +struct gltk_slider { 1.68 + GLTK_WIDGET_VARS; 1.69 + float value, min, max; 1.70 +}; 1.71 + 1.72 +struct gltk_int_slider { 1.73 + GLTK_WIDGET_VARS; 1.74 + int value, min, max; 1.75 +}; 1.76 + 1.77 +struct gltk_listbox { 1.78 + GLTK_WIDGET_VARS; 1.79 + int sel; 1.80 + int vislines; 1.81 + gltk_item *items, *items_tail, *sel_item; 1.82 +}; 1.83 + 1.84 +struct gltk_item { 1.85 + char *text; 1.86 + gltk_pixmap *img; 1.87 +}; 1.88 + 1.89 +struct gltk_pixmap { 1.90 + int width, height; 1.91 + unsigned char *pixels; 1.92 +}; 1.93 + 1.94 +#endif /* GLTIKI_IMPL_H_ */