imtk

view src/imtk.h @ 14:df2bc9406561

added gradients
author John Tsiombikas <nuclear@siggraph.org>
date Tue, 19 Apr 2011 03:01:46 +0300
parents 9c7987064bb0
children 6893b4dca5a3
line source
1 #ifndef IMTK_H_
2 #define IMTK_H_
4 #include <stdlib.h>
7 #define IMUID (__LINE__ << 10)
8 #define IMUID_IDX(i) ((__LINE__ << 10) + ((i) << 1))
11 /* key/button state enum */
12 enum {
13 IMTK_UP,
14 IMTK_DOWN
15 };
17 enum {
18 IMTK_LEFT_BUTTON,
19 IMTK_MIDDLE_BUTTON,
20 IMTK_RIGHT_BUTTON
21 };
23 enum {
24 IMTK_TEXT_COLOR,
25 IMTK_TOP_COLOR,
26 IMTK_BOTTOM_COLOR,
27 IMTK_BEVEL_LIT_COLOR,
28 IMTK_BEVEL_SHAD_COLOR,
29 IMTK_CURSOR_COLOR,
30 IMTK_SELECTION_COLOR,
31 IMTK_CHECK_COLOR
32 };
34 #define IMTK_FOCUS_BIT 0x100
35 #define IMTK_PRESS_BIT 0x200
37 #define IMTK_BASE_COLOR IMTK_BOTTOM_COLOR
38 #define IMTK_FOCUS_COLOR (IMTK_TOP_COLOR | IMTK_FOCUS_BIT)
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
46 void imtk_inp_key(int key, int state);
47 void imtk_inp_mouse(int bn, int state);
48 void imtk_inp_motion(int x, int y);
50 void imtk_set_viewport(int x, int y);
51 void imtk_get_viewport(int *width, int *height);
53 void imtk_post_redisplay(void);
55 void imtk_begin(void);
56 void imtk_end(void);
58 void imtk_label(const char *str, int x, int y);
59 int imtk_button(int id, const char *label, int x, int y);
60 int imtk_checkbox(int id, const char *label, int x, int y, int state);
61 void imtk_textbox(int id, char *textbuf, size_t buf_sz, int x, int y);
62 float imtk_slider(int id, float pos, float min, float max, int x, int y);
63 void imtk_progress(int id, float pos, int x, int y);
64 int imtk_listbox(int id, const char *list, int sel, int x, int y);
65 /*
66 int imtk_combobox(int id, char *textbuf, size_t buf_sz, const char *list, int sel, int x, int y);
67 */
69 /* helper functions to create and destroy item lists for listboxes and comboboxes */
70 char *imtk_create_list(const char *first, ...);
71 void imtk_free_list(char *list);
73 /* defined in draw.c */
74 void imtk_set_color(unsigned int col, float r, float g, float b, float a);
75 float *imtk_get_color(unsigned int col);
76 void imtk_set_alpha(float a);
77 float imtk_get_alpha(void);
78 void imtk_set_bevel_width(float b);
79 float imtk_get_bevel_width(void);
80 void imtk_set_focus_factor(float fact);
81 float imtk_get_focus_factor(void);
82 void imtk_set_press_factor(float fact);
83 float imtk_get_press_factor(void);
85 #ifdef __cplusplus
86 }
87 #endif
89 #endif /* IMTK_H_ */