start by copying windtk and dropping dirty rects and indexed colors
[anigui] / src / agimpl.h
1 #ifndef AGIMPL_H_
2 #define AGIMPL_H_
3
4 #include <stdlib.h>
5 #include "anigui.h"
6 #include "widget.h"
7
8 enum {
9         COL_FG,
10         COL_BG,
11         COL_BGHI,
12         COL_BGLO,
13         COL_FRM,
14         COL_FRMHI,
15         COL_FRMLO,
16         COL_FFRM,
17         COL_FFRMHI,
18         COL_FFRMLO,
19
20         NUM_COLORS
21 };
22
23 enum { FRM_OUT, FRM_IN, FRM_NOFILL = 0x8000 };
24 #define FRMSTYLE(x)     ((x) & 0xff)
25
26 #define MAX_UPD_RECTS   16
27
28 struct ag_context {
29         struct ag_graphics gfx;
30         struct ag_rect vp;
31         ag_widget *root;
32         struct ag_theme *theme;
33
34         unsigned int colors[NUM_COLORS];
35
36         ag_widget *focuswin;
37 };
38
39 extern struct ag_context *ag_curctx_;
40 #define ag      ag_curctx_
41
42 extern void *(*ag_alloc)(size_t sz);
43 extern void (*ag_free)(void *p);
44
45 void *ag_zalloc(size_t sz);
46
47 void ag_gfx_color(int cidx);
48 void ag_gfx_fillrect(struct ag_rect *r);
49 void ag_gfx_frame(struct ag_rect *r, int style, int basecol);
50 void ag_gfx_line(int x0, int y0, int x1, int y1);
51
52 void ag_calc_window_rect(struct ag_rect *r, ag_widget *w);
53
54 #endif  /* AGIMPL_H_ */