gltiki

annotate 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
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_IMPL_H_
nuclear@0 19 #define GLTIKI_IMPL_H_
nuclear@0 20
nuclear@0 21 #include "gltiki.h"
nuclear@0 22
nuclear@0 23 enum { UNKNOWN, LABEL, BUTTON, CHECKBOX, SLIDER, INTSLIDER, LISTBOX };
nuclear@0 24
nuclear@0 25 #define GLTK_CAST(w, t, ctype) \
nuclear@0 26 ((w)->type == (t) ? ((ctype)(w)) : 0)
nuclear@0 27
nuclear@0 28 #define GLTK_LABEL(w) GLTK_CAST(w, LABEL, struct gltk_label)
nuclear@0 29 #define GLTK_BUTTON(w) GLTK_CAST(w, BUTTON, struct gltk_button)
nuclear@0 30 #define GLTK_CHECKBOX(w) GLTK_CAST(w, CHECKBOX, struct gltk_checkbox)
nuclear@0 31 #define GLTK_SLIDER(w) GLTK_CAST(w, SLIDER, struct gltk_slider)
nuclear@0 32 #define GLTK_INTSLIDER(w) GLTK_CAST(w, INTSLIDER, struct gltk_int_slider)
nuclear@0 33 #define GLTK_LISTBOX(w) GLTK_CAST(w, LISTBOX, struct gltk_listbox)
nuclear@0 34
nuclear@0 35 #define GLTK_WIDGET_VARS \
nuclear@0 36 int type; \
nuclear@0 37 float x, y, width, height; \
nuclear@0 38 int active; \
nuclear@0 39 struct gltk_widget *next; \
nuclear@0 40 gltk_callback callback; \
nuclear@0 41 void *cls; \
nuclear@0 42 void (*draw)()
nuclear@0 43
nuclear@0 44 struct gltk_widget {
nuclear@0 45 GLTK_WIDGET_VARS;
nuclear@0 46 };
nuclear@0 47
nuclear@0 48 struct gltk_label {
nuclear@0 49 GLTK_WIDGET_VARS;
nuclear@0 50 char *text;
nuclear@0 51 };
nuclear@0 52
nuclear@0 53 struct gltk_button {
nuclear@0 54 GLTK_WIDGET_VARS;
nuclear@0 55 char *text;
nuclear@0 56 };
nuclear@0 57
nuclear@0 58 struct gltk_checkbox {
nuclear@0 59 GLTK_WIDGET_VARS;
nuclear@0 60 char *text;
nuclear@0 61 int state;
nuclear@0 62 };
nuclear@0 63
nuclear@0 64 struct gltk_slider {
nuclear@0 65 GLTK_WIDGET_VARS;
nuclear@0 66 float value, min, max;
nuclear@0 67 };
nuclear@0 68
nuclear@0 69 struct gltk_int_slider {
nuclear@0 70 GLTK_WIDGET_VARS;
nuclear@0 71 int value, min, max;
nuclear@0 72 };
nuclear@0 73
nuclear@0 74 struct gltk_listbox {
nuclear@0 75 GLTK_WIDGET_VARS;
nuclear@0 76 int sel;
nuclear@0 77 int vislines;
nuclear@0 78 gltk_item *items, *items_tail, *sel_item;
nuclear@0 79 };
nuclear@0 80
nuclear@0 81 struct gltk_item {
nuclear@0 82 char *text;
nuclear@0 83 gltk_pixmap *img;
nuclear@0 84 };
nuclear@0 85
nuclear@0 86 struct gltk_pixmap {
nuclear@0 87 int width, height;
nuclear@0 88 unsigned char *pixels;
nuclear@0 89 };
nuclear@0 90
nuclear@0 91 #endif /* GLTIKI_IMPL_H_ */