svkbd

simple virtual keyboard
git clone git://git.suckless.org/svkbd
Log | Files | Refs | README | LICENSE

drw.h (1533B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 typedef struct Fnt {
      4 	Display *dpy;
      5 	unsigned int h;
      6 	XftFont *xfont;
      7 	FcPattern *pattern;
      8 	struct Fnt *next;
      9 } Fnt;
     10 
     11 enum { ColFg, ColBg }; /* Clr scheme index */
     12 typedef XftColor Clr;
     13 
     14 typedef struct {
     15 	unsigned int w, h;
     16 	Display *dpy;
     17 	int screen;
     18 	Window root;
     19 	Drawable drawable;
     20 	GC gc;
     21 	Clr *scheme;
     22 	Fnt *fonts;
     23 } Drw;
     24 
     25 /* Drawable abstraction */
     26 Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
     27 void drw_resize(Drw *drw, unsigned int w, unsigned int h);
     28 void drw_free(Drw *drw);
     29 
     30 /* Fnt abstraction */
     31 Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
     32 void drw_fontset_free(Fnt* set);
     33 unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
     34 void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
     35 
     36 /* Colorscheme abstraction */
     37 void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
     38 Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
     39 
     40 /* Drawing context manipulation */
     41 void drw_setfontset(Drw *drw, Fnt *set);
     42 void drw_setscheme(Drw *drw, Clr *scm);
     43 
     44 /* Drawing functions */
     45 void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
     46 int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
     47 
     48 /* Map functions */
     49 void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
     50 void drw_sync(Drw *drw);