util.h
changeset 2 a79188fe4a40
child 3 e969f3575b7a
equal deleted inserted replaced
1:f10194d4b76d 2:a79188fe4a40
       
     1 /*
       
     2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
       
     3  * See LICENSE file for license details.
       
     4  */
       
     5 
       
     6 #include <X11/Xlib.h>
       
     7 #include <X11/Xlocale.h>
       
     8 
       
     9 typedef struct Brush Brush;
       
    10 typedef struct Color Color;
       
    11 typedef struct Fnt Fnt;
       
    12 
       
    13 struct Color {
       
    14 	unsigned long bg;
       
    15 	unsigned long fg;
       
    16 	unsigned long border;
       
    17 };
       
    18 
       
    19 struct Fnt {
       
    20 	XFontStruct *xfont;
       
    21 	XFontSet set;
       
    22 	int ascent;
       
    23 	int descent;
       
    24 };
       
    25 
       
    26 struct Brush {
       
    27 	GC gc;
       
    28 	Drawable drawable;
       
    29 	XRectangle rect;
       
    30 	Bool border;
       
    31 	Fnt *font;
       
    32 	Color color;
       
    33 	const char *text;
       
    34 };
       
    35 
       
    36 extern void draw(Display *dpy, Brush *b);
       
    37 extern void loadcolor(Display *dpy, int screen, Color *c,
       
    38 		const char *bg, const char *fg, const char *bo);
       
    39 extern unsigned int textwidth_l(Fnt *font, char *text, unsigned int len);
       
    40 extern unsigned int textwidth(Fnt *font, char *text);
       
    41 extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);