added draw.h
[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         GC gc;
13         struct {
14                 XFontStruct *xfont;
15                 XFontSet set;
16                 int ascent;
17                 int descent;
18                 int height;
19         } font;
20 } DC; /* draw context */
21
22 /* forward declarations */
23 void drawcleanup(void);
24 void drawsetup(void);
25 void drawtext(const char *text, unsigned long col[ColLast]);
26 void eprint(const char *errstr, ...);
27 unsigned long getcolor(const char *colstr);
28 void initfont(const char *fontstr);
29 int textnw(const char *text, unsigned int len);
30 int textw(const char *text);
31
32 /* variables */
33 Display *dpy;
34 DC dc;
35 int screen;
36 unsigned int mw, mh;
37 unsigned int spaceitem;
38 Window parent;
39
40 /* style */
41 const char *font;
42 const char *normbgcolor;
43 const char *normfgcolor;
44 const char *selbgcolor;
45 const char *selfgcolor;