commit 07494795c61b2314a24207fc9b8e27e185107398
parent 1b6bf46fe6d278cb81f3b52355743f1a8e117197
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 13 Jun 2006 18:00:04 +0200
removing type
Diffstat:
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/liblitz/blitz.h b/liblitz/blitz.h
@@ -10,7 +10,6 @@
#define BLITZ_SELCOLORS "#ffffff #335577 #447799"
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
-enum {BLITZ_LAYOUT, BLITZ_LABEL, BLITZ_LAST};
typedef struct Blitz Blitz;
typedef enum BlitzAlign BlitzAlign;
typedef struct BlitzColor BlitzColor;
@@ -60,36 +59,34 @@ struct BlitzWin{
};
struct BlitzLayout {
- int type;
XRectangle rect;
Bool expand;
BlitzWidget *next;
+ void (*draw)(BlitzWidget *);
/* widget specific */
BlitzWin *win;
BlitzWidget *rows;
BlitzWidget *cols;
- void (*scale)(BlitzWidget *l);
- void (*draw)(BlitzWidget *l);
+ void (*scale)(BlitzWidget *);
};
struct BlitzLabel {
- int type;
XRectangle rect;
Bool expand;
BlitzWidget *next;
+ void (*draw)(BlitzWidget *);
/* widget specific */
BlitzColor color;
BlitzAlign align;
BlitzFont font;
char *text;
- void (*draw)(BlitzWidget *l);
};
union BlitzWidget {
- int type;
XRectangle rect;
Bool expand;
BlitzWidget *next;
+ void (*draw)(BlitzWidget *);
BlitzLabel label;
};
diff --git a/liblitz/layout.c b/liblitz/layout.c
@@ -23,26 +23,15 @@ xscale(BlitzWidget *w)
}
static void
-xdraww(BlitzWidget *w)
-{
- switch(w->type) {
- case BLITZ_LABEL:
- BLITZLABEL(w)->draw(w);
- break;
- case BLITZ_LAYOUT:
- BLITZLAYOUT(w)->draw(w);
- break;
- }
-}
-
-static void
xdraw(BlitzWidget *w)
{
BlitzLayout *l = BLITZLAYOUT(w);
for(w = l->cols; w; w = w->next)
- xdraww(w);
+ if(w->draw)
+ w->draw(w);
for(w = l->rows; w; w = w->next)
- xdraww(w);
+ if(w->draw)
+ w->draw(w);
}
BlitzLayout *