summaryrefslogtreecommitdiffstats
path: root/drw.h
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2013-04-17 21:21:47 +0200
committerAnselm R Garbe <anselm@garbe.us>2013-04-17 21:21:47 +0200
commitf2544a331845ad80655c1f79c9dc61922fe3441c (patch)
tree759d6c9be0fee0c3c334c4653c6633cce90b3be4 /drw.h
parentcontinued with draw.c and draw.h implementation, now the integration begins (diff)
downloaddwm-f2544a331845ad80655c1f79c9dc61922fe3441c.tar.gz
dwm-f2544a331845ad80655c1f79c9dc61922fe3441c.zip
renamed draw into drw
Diffstat (limited to '')
-rw-r--r--drw.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/drw.h b/drw.h
new file mode 100644
index 0000000..819da85
--- /dev/null
+++ b/drw.h
@@ -0,0 +1,61 @@
1/* See LICENSE file for copyright and license details. */
2
3typedef struct {
4 unsigned long rgb;
5} Clr;
6
7typedef struct {
8 int ascent;
9 int descent;
10 unsigned int h;
11 XFontSet set;
12 XFontStruct *xfont;
13} Fnt;
14
15typedef struct {
16 unsigned int w, h;
17 Display *dpy;
18 int screen;
19 Window win;
20 Drawable drwable;
21 GC gc;
22 Clr *fg;
23 Clr *bg;
24 Fnt *font;
25} Drw;
26
27typedef struct {
28 unsigned int w;
29 unsigned int h;
30 int xOff;
31 int yOff;
32} Extnts;
33
34/* Drawable abstraction */
35Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
36void drw_resize(Drw *drw, unsigned int w, unsigned int h);
37void drw_free(Drw *drw);
38
39/* Fnt abstraction */
40Fnt *drw_font_create(Drw *drw, const char *fontname);
41void drw_font_free(Drw *drw, Fnt *font);
42
43/* Clrour abstraction */
44Clr *drw_clr_create(Drw *drw, const char *clrname);
45void drw_clr_free(Drw *drw, Clr *clr);
46
47/* Drawing context manipulation */
48void drw_setfont(Drw *drw, Fnt *font);
49void drw_setfg(Drw *drw, Clr *clr);
50void drw_setbg(Drw *drw, Clr *clr);
51
52/* Drawing functions */
53void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, Bool filled, Bool empty, Bool invert);
54void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, Bool invert);
55
56/* Map functions */
57void drw_map(Drw *drw, int x, int y, unsigned int w, unsigned int h);
58
59/* Text functions */
60void drw_getexts(Drw *drw, const char *text, unsigned int len, Extnts *extnts);
61