computing textwidth with the function drawtext
[xmenu] / xmenu.h
diff --git a/xmenu.h b/xmenu.h
index 11fd29f..0f32fac 100644 (file)
--- a/xmenu.h
+++ b/xmenu.h
@@ -5,9 +5,10 @@
 #define ITEMNEXT 1
 
 /* macros */
 #define ITEMNEXT 1
 
 /* macros */
-#define LEN(x) (sizeof (x) / sizeof (x[0]))
-#define MAX(x,y) ((x)>(y)?(x):(y))
-#define MIN(x,y) ((x)<(y)?(x):(y))
+#define LEN(x)              (sizeof (x) / sizeof (x[0]))
+#define MAX(x,y)            ((x)>(y)?(x):(y))
+#define MIN(x,y)            ((x)<(y)?(x):(y))
+#define BETWEEN(x, a, b)    ((a) <= (x) && (x) <= (b))
 
 /* color enum */
 enum {ColorFG, ColorBG, ColorLast};
 
 /* color enum */
 enum {ColorFG, ColorBG, ColorLast};
@@ -17,27 +18,27 @@ enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
 
 /* configuration structure */
 struct Config {
 
 /* configuration structure */
 struct Config {
+       /* the values below are set by config.h */
        const char *font;
        const char *font;
-
        const char *background_color;
        const char *foreground_color;
        const char *selbackground_color;
        const char *selforeground_color;
        const char *separator_color;
        const char *border_color;
        const char *background_color;
        const char *foreground_color;
        const char *selbackground_color;
        const char *selforeground_color;
        const char *separator_color;
        const char *border_color;
-
        int width_pixels;
        int height_pixels;
        int border_pixels;
        int separator_pixels;
        int gap_pixels;
        int width_pixels;
        int height_pixels;
        int border_pixels;
        int separator_pixels;
        int gap_pixels;
-
        int triangle_width;
        int triangle_height;
        int triangle_width;
        int triangle_height;
-
        int iconpadding;
        int iconpadding;
+       int horzpadding;
 
 
-       int cursx, cursy;           /* cursor position */
+       /* the values below are computed by xmenu */
+       int iconsize;
+       int posx, posy;           /* cursor position */
        int screenw, screenh;       /* screen width and height */
 };
 
        int screenw, screenh;       /* screen width and height */
 };
 
@@ -49,7 +50,9 @@ struct DC {
        XftColor separator;
 
        GC gc;
        XftColor separator;
 
        GC gc;
-       XftFont *font;
+
+       XftFont **fonts;
+       size_t nfonts;
 };
 
 /* menu item structure */
 };
 
 /* menu item structure */
@@ -63,6 +66,7 @@ struct Item {
        struct Item *prev;      /* previous item */
        struct Item *next;      /* next item */
        struct Menu *submenu;   /* submenu spawned by clicking on item */
        struct Item *prev;      /* previous item */
        struct Item *next;      /* next item */
        struct Menu *submenu;   /* submenu spawned by clicking on item */
+       Drawable sel, unsel;    /* pixmap for selected and unselected item */
        Imlib_Image icon;
 };
 
        Imlib_Image icon;
 };
 
@@ -74,7 +78,5 @@ struct Menu {
        struct Item *selected;  /* item currently selected in the menu */
        int x, y, w, h;         /* menu geometry */
        unsigned level;         /* menu level relative to root */
        struct Item *selected;  /* item currently selected in the menu */
        int x, y, w, h;         /* menu geometry */
        unsigned level;         /* menu level relative to root */
-       Drawable pixmap;        /* pixmap to draw the menu on */
-       XftDraw *draw;
        Window win;             /* menu window to map on the screen */
 };
        Window win;             /* menu window to map on the screen */
 };