decoupled draw.c from dmenu & dinput
[dmenu.git] / draw.h
1 /* See LICENSE file for copyright and license details. */
2
3 /* enums */
4 enum { ColFG, ColBG, ColLast };
5
6 /* typedefs */
7 typedef struct {
8         int x, y, w, h;
9         unsigned long norm[ColLast];
10         unsigned long sel[ColLast];
11         Drawable drawable;
12         Display *dpy;
13         GC gc;
14         struct {
15                 XFontStruct *xfont;
16                 XFontSet set;
17                 int ascent;
18                 int descent;
19                 int height;
20         } font;
21 } DC; /* draw context */
22
23 /* forward declarations */
24 void cleanupdraw(DC *dc);
25 void setupdraw(DC *dc, Window w);
26 void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
27 void eprint(const char *fmt, ...);
28 unsigned long getcolor(DC *dc, const char *colstr);
29 void initfont(DC *dc, const char *fontstr);
30 int textnw(DC *dc, const char *text, unsigned int len);
31 int textw(DC *dc, const char *text);
32
33 /* variables */
34 extern const char *progname;