dmenu

Mahdi's build of dmenu
git clone git://mahdi.pw/dmenu.git
Log | Files | Refs | README | LICENSE

drw.h (1875B)


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