JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
removed DDC, all is Draw-dependent
[dwm.git] / draw.h
1 /* See LICENSE file for copyright and license details. */
2
3 struct _XCol {
4         unsigned long rgb;
5 };
6 typedef struct _XCol Col;
7
8 struct _XFont {
9         int ascent;
10         int descent;
11         unsigned int h, w;
12         XFontSet set;
13         XFontStruct *xfont;
14 };
15 typedef struct _XFont Fnt;
16 /* X11 types - end */
17
18 typedef struct {
19         unsigned int w;
20         unsigned int h;
21         int x;
22         int y;
23         int xOff;
24         int yOff;
25 } TextExtents;
26
27
28 /* X11 types - begin */
29 typedef struct _XDraw Draw;
30 struct _XDraw {
31         unsigned int w, h;
32         Display *dpy;
33         int screen;
34         Window win;
35         Drawable drawable;
36         GC gc;
37         Col *fg;
38         Col *bg;
39         Fnt *font;
40 };
41
42 /* Drawable abstraction */
43 Draw *draw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
44 void draw_resize(Draw *draw, unsigned int w, unsigned int h);
45 void draw_free(Draw *draw);
46
47 /* Fnt abstraction */
48 Fnt *font_create(const char *fontname);
49 void font_free(Fnt *font);
50
51 /* Colour abstraction */
52 Col *col_create(const char *colname);
53 void col_free(Col *col);
54
55 /* Drawing context manipulation */
56 void draw_setfont(Draw *draw, Fnt *font);
57 void draw_setfg(Draw *draw, Col *col);
58 void draw_setbg(Draw *draw, Col *col);
59
60 /* Drawing functions */
61 void draw_rect(Draw *draw, int x, int y, unsigned int w, unsigned int h);
62 void draw_text(Draw *draw, int x, int y, const char *text);
63
64 /* Map functions */
65 void draw_map(Draw *draw, int x, int y, unsigned int w, unsigned int h);
66
67 /* Text functions */
68 void draw_getextents(Draw *draw, const char *text, TextExtents *extents);
69