rayfract
diff src/imtk/imtk.h @ 10:1496aae2e7d4
- simplified build by including dependences in the source tree
- added make dep tracking
- added mingw cross-build rules
- added readme & licence
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 31 Jul 2023 18:58:56 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/imtk/imtk.h Mon Jul 31 18:58:56 2023 +0300 1.3 @@ -0,0 +1,106 @@ 1.4 +#ifndef IMTK_H_ 1.5 +#define IMTK_H_ 1.6 + 1.7 +#include <stdlib.h> 1.8 +#include <limits.h> 1.9 + 1.10 +#define IMUID (__LINE__ << 10) 1.11 +#define IMUID_IDX(i) ((__LINE__ << 10) + ((i) << 1)) 1.12 + 1.13 + 1.14 +/* key/button state enum */ 1.15 +enum { 1.16 + IMTK_UP, 1.17 + IMTK_DOWN 1.18 +}; 1.19 + 1.20 +enum { 1.21 + IMTK_LEFT_BUTTON, 1.22 + IMTK_MIDDLE_BUTTON, 1.23 + IMTK_RIGHT_BUTTON 1.24 +}; 1.25 + 1.26 +enum { 1.27 + IMTK_TEXT_COLOR, 1.28 + IMTK_TOP_COLOR, 1.29 + IMTK_BOTTOM_COLOR, 1.30 + IMTK_BEVEL_LIT_COLOR, 1.31 + IMTK_BEVEL_SHAD_COLOR, 1.32 + IMTK_CURSOR_COLOR, 1.33 + IMTK_SELECTION_COLOR, 1.34 + IMTK_CHECK_COLOR 1.35 +}; 1.36 + 1.37 +enum { 1.38 + IMTK_HORIZONTAL, 1.39 + IMTK_VERTICAL 1.40 +}; 1.41 + 1.42 +#define IMTK_FOCUS_BIT 0x100 1.43 +#define IMTK_PRESS_BIT 0x200 1.44 +#define IMTK_SEL_BIT 0x400 1.45 + 1.46 +#define IMTK_AUTO INT_MIN 1.47 + 1.48 +#ifdef __cplusplus 1.49 +extern "C" { 1.50 +#endif 1.51 + 1.52 + 1.53 +void imtk_inp_key(int key, int state); 1.54 +void imtk_inp_mouse(int bn, int state); 1.55 +void imtk_inp_motion(int x, int y); 1.56 + 1.57 +void imtk_set_viewport(int x, int y); 1.58 +void imtk_get_viewport(int *width, int *height); 1.59 + 1.60 +void imtk_post_redisplay(void); 1.61 + 1.62 +void imtk_begin(void); 1.63 +void imtk_end(void); 1.64 + 1.65 +void imtk_label(const char *str, int x, int y); 1.66 +int imtk_button(int id, const char *label, int x, int y); 1.67 +int imtk_checkbox(int id, const char *label, int x, int y, int state); 1.68 +void imtk_textbox(int id, char *textbuf, size_t buf_sz, int x, int y); 1.69 +float imtk_slider(int id, float pos, float min, float max, int x, int y); 1.70 +void imtk_progress(int id, float pos, int x, int y); 1.71 +int imtk_listbox(int id, const char *list, int sel, int x, int y); 1.72 +int imtk_radiogroup(int id, const char *list, int sel, int x, int y); 1.73 + 1.74 +int imtk_begin_frame(int id, const char *label, int x, int y); 1.75 +void imtk_end_frame(void); 1.76 + 1.77 +/* helper functions to create and destroy item lists for listboxes */ 1.78 +char *imtk_create_list(const char *first, ...); 1.79 +void imtk_free_list(char *list); 1.80 + 1.81 +/* automatic layout */ 1.82 +int imtk_layout_push(void); 1.83 +int imtk_layout_pop(void); 1.84 +void imtk_layout_start(int x, int y); 1.85 +void imtk_layout_dir(int dir); 1.86 +void imtk_layout_spacing(int spacing); 1.87 +void imtk_layout_advance(int width, int height); 1.88 +void imtk_layout_newline(void); 1.89 +void imtk_layout_get_pos(int *x, int *y); 1.90 +void imtk_layout_get_bounds(int *bbox); 1.91 +int imtk_layout_contains(int x, int y); 1.92 + 1.93 +/* defined in draw.c */ 1.94 +void imtk_set_color(unsigned int col, float r, float g, float b, float a); 1.95 +float *imtk_get_color(unsigned int col); 1.96 +void imtk_set_alpha(float a); 1.97 +float imtk_get_alpha(void); 1.98 +void imtk_set_bevel_width(float b); 1.99 +float imtk_get_bevel_width(void); 1.100 +void imtk_set_focus_factor(float fact); 1.101 +float imtk_get_focus_factor(void); 1.102 +void imtk_set_press_factor(float fact); 1.103 +float imtk_get_press_factor(void); 1.104 + 1.105 +#ifdef __cplusplus 1.106 +} 1.107 +#endif 1.108 + 1.109 +#endif /* IMTK_H_ */