imtk

annotate src/imtk.h @ 16:1cf212375db3

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