aboutsummaryrefslogtreecommitdiff
path: root/drw.h
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2013-04-17 21:21:47 +0200
committerAnselm R Garbe <anselm@garbe.us>2013-04-17 21:21:47 +0200
commitf2544a331845ad80655c1f79c9dc61922fe3441c (patch)
tree759d6c9be0fee0c3c334c4653c6633cce90b3be4 /drw.h
parentaafeaf731701e528f4ae9d7c7432b3e92fee4392 (diff)
downloaddwm-f2544a331845ad80655c1f79c9dc61922fe3441c.tar.gz
dwm-f2544a331845ad80655c1f79c9dc61922fe3441c.tar.bz2
dwm-f2544a331845ad80655c1f79c9dc61922fe3441c.zip
renamed draw into drw
Diffstat (limited to 'drw.h')
-rw-r--r--drw.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/drw.h b/drw.h
new file mode 100644
index 0000000..819da85
--- /dev/null
+++ b/drw.h
@@ -0,0 +1,61 @@
+/* See LICENSE file for copyright and license details. */
+
+typedef struct {
+ unsigned long rgb;
+} Clr;
+
+typedef struct {
+ int ascent;
+ int descent;
+ unsigned int h;
+ XFontSet set;
+ XFontStruct *xfont;
+} Fnt;
+
+typedef struct {
+ unsigned int w, h;
+ Display *dpy;
+ int screen;
+ Window win;
+ Drawable drwable;
+ GC gc;
+ Clr *fg;
+ Clr *bg;
+ Fnt *font;
+} Drw;
+
+typedef struct {
+ unsigned int w;
+ unsigned int h;
+ int xOff;
+ int yOff;
+} Extnts;
+
+/* Drawable abstraction */
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+void drw_resize(Drw *drw, unsigned int w, unsigned int h);
+void drw_free(Drw *drw);
+
+/* Fnt abstraction */
+Fnt *drw_font_create(Drw *drw, const char *fontname);
+void drw_font_free(Drw *drw, Fnt *font);
+
+/* Clrour abstraction */
+Clr *drw_clr_create(Drw *drw, const char *clrname);
+void drw_clr_free(Drw *drw, Clr *clr);
+
+/* Drawing context manipulation */
+void drw_setfont(Drw *drw, Fnt *font);
+void drw_setfg(Drw *drw, Clr *clr);
+void drw_setbg(Drw *drw, Clr *clr);
+
+/* Drawing functions */
+void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, Bool filled, Bool empty, Bool invert);
+void drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, Bool invert);
+
+/* Map functions */
+void drw_map(Drw *drw, int x, int y, unsigned int w, unsigned int h);
+
+/* Text functions */
+void drw_getexts(Drw *drw, const char *text, unsigned int len, Extnts *extnts);
+