diff options
| author | Connor Lane Smith <cls@lubutu.com> | 2011-05-20 19:10:26 +0100 |
|---|---|---|
| committer | Connor Lane Smith <cls@lubutu.com> | 2011-05-20 19:10:26 +0100 |
| commit | e7d41cc18824114300a09d3bdb26c536f30b466e (patch) | |
| tree | 442c48c4b7f8465e5f922e54143f97d8299da340 /draw.h | |
| parent | applied Evil_Bobs cleanup patch (diff) | |
| download | dwm-e7d41cc18824114300a09d3bdb26c536f30b466e.tar.gz dwm-e7d41cc18824114300a09d3bdb26c536f30b466e.zip | |
added draw.h, draw.c
Diffstat (limited to 'draw.h')
| -rw-r--r-- | draw.h | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -0,0 +1,35 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | ||
| 2 | |||
| 3 | #define FG(dc, col) ((col)[(dc)->invert ? ColBG : ColFG]) | ||
| 4 | #define BG(dc, col) ((col)[(dc)->invert ? ColFG : ColBG]) | ||
| 5 | |||
| 6 | enum { ColBG, ColFG, ColBorder, ColLast }; | ||
| 7 | |||
| 8 | typedef struct { | ||
| 9 | int x, y, w, h; | ||
| 10 | Bool invert; | ||
| 11 | Display *dpy; | ||
| 12 | GC gc; | ||
| 13 | Pixmap canvas; | ||
| 14 | struct { | ||
| 15 | int ascent; | ||
| 16 | int descent; | ||
| 17 | int height; | ||
| 18 | int width; | ||
| 19 | XFontSet set; | ||
| 20 | XFontStruct *xfont; | ||
| 21 | } font; | ||
| 22 | } DC; /* draw context */ | ||
| 23 | |||
| 24 | void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color); | ||
| 25 | void drawtext(DC *dc, const char *text, unsigned long col[ColLast]); | ||
| 26 | void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]); | ||
| 27 | void eprintf(const char *fmt, ...); | ||
| 28 | void freedc(DC *dc); | ||
| 29 | unsigned long getcolor(DC *dc, const char *colstr); | ||
| 30 | DC *initdc(void); | ||
| 31 | void initfont(DC *dc, const char *fontstr); | ||
| 32 | void mapdc(DC *dc, Window win, unsigned int w, unsigned int h); | ||
| 33 | void resizedc(DC *dc, unsigned int w, unsigned int h); | ||
| 34 | int textnw(DC *dc, const char *text, size_t len); | ||
| 35 | int textw(DC *dc, const char *text); | ||
