[util] Change Alignment type to alignment_t

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-11 11:18:23 +02:00
parent 20442adfa0
commit df7db5e86b
7 changed files with 20 additions and 20 deletions

View File

@ -98,7 +98,7 @@ static int
cfg_alignment_parse(cfg_t *cfg, cfg_opt_t *opt, cfg_alignment_parse(cfg_t *cfg, cfg_opt_t *opt,
const char *value, void *result) const char *value, void *result)
{ {
Alignment *p = p_new(Alignment, 1); alignment_t *p = p_new(alignment_t, 1);
if((*p = draw_align_get_from_str(value)) == Auto if((*p = draw_align_get_from_str(value)) == Auto
&& a_strcmp(value, "auto")) && a_strcmp(value, "auto"))
@ -119,19 +119,19 @@ cfg_value_free(void *value)
p_delete(&value); p_delete(&value);
} }
Alignment alignment_t
cfg_opt_getnalignment(cfg_opt_t *opt, unsigned int oindex) cfg_opt_getnalignment(cfg_opt_t *opt, unsigned int oindex)
{ {
return * (Alignment *) cfg_opt_getnptr(opt, oindex); return * (alignment_t *) cfg_opt_getnptr(opt, oindex);
} }
Alignment alignment_t
cfg_getnalignment(cfg_t *cfg, const char *name, unsigned int oindex) cfg_getnalignment(cfg_t *cfg, const char *name, unsigned int oindex)
{ {
return cfg_opt_getnalignment(cfg_getopt(cfg, name), oindex); return cfg_opt_getnalignment(cfg_getopt(cfg, name), oindex);
} }
Alignment alignment_t
cfg_getalignment(cfg_t *cfg, const char *name) cfg_getalignment(cfg_t *cfg, const char *name)
{ {
return cfg_getnalignment(cfg, name, 0); return cfg_getnalignment(cfg, name, 0);

View File

@ -28,9 +28,9 @@ cfg_t * cfg_new(void);
char * config_file(void); char * config_file(void);
int config_check(const char *); int config_check(const char *);
Alignment cfg_opt_getnalignment(cfg_opt_t *, unsigned int); alignment_t cfg_opt_getnalignment(cfg_opt_t *, unsigned int);
Alignment cfg_getnalignment(cfg_t *, const char *, unsigned int); alignment_t cfg_getnalignment(cfg_t *, const char *, unsigned int);
Alignment cfg_getalignment(cfg_t *, const char *); alignment_t cfg_getalignment(cfg_t *, const char *);
Position cfg_opt_getnposition(cfg_opt_t *, unsigned int); Position cfg_opt_getnposition(cfg_opt_t *, unsigned int);
Position cfg_getnposition(cfg_t *, const char *, unsigned int); Position cfg_getnposition(cfg_t *, const char *, unsigned int);

View File

@ -225,7 +225,7 @@ draw_font_delete(font_t **font)
void void
draw_text(DrawCtx *ctx, draw_text(DrawCtx *ctx,
area_t area, area_t area,
Alignment align, alignment_t align,
int padding, int padding,
char *text, char *text,
style_t style) style_t style)
@ -893,13 +893,13 @@ draw_textwidth(xcb_connection_t *conn, int default_screen, font_t *font, const c
return ext.width; return ext.width;
} }
/** Transform a string to a Alignment type. /** Transform a string to a alignment_t type.
* Recognized string are left, center or right. Everything else will be * Recognized string are left, center or right. Everything else will be
* recognized as AlignAuto. * recognized as AlignAuto.
* \param align string with align text * \param align string with align text
* \return Alignment type * \return alignment_t type
*/ */
Alignment alignment_t
draw_align_get_from_str(const char *align) draw_align_get_from_str(const char *align)
{ {
if(!a_strcmp(align, "left")) if(!a_strcmp(align, "left"))

View File

@ -40,7 +40,7 @@ typedef enum
AlignCenter, AlignCenter,
AlignFlex, AlignFlex,
AlignAuto AlignAuto
} Alignment; } alignment_t;
typedef struct area_t area_t; typedef struct area_t area_t;
struct area_t struct area_t
@ -125,7 +125,7 @@ void draw_context_delete(DrawCtx **);
font_t *draw_font_new(xcb_connection_t *, int, char *); font_t *draw_font_new(xcb_connection_t *, int, char *);
void draw_font_delete(font_t **); void draw_font_delete(font_t **);
void draw_text(DrawCtx *, area_t, Alignment, int, char *, style_t); void draw_text(DrawCtx *, area_t, alignment_t, int, char *, style_t);
void draw_rectangle(DrawCtx *, area_t, float, bool, xcolor_t); void draw_rectangle(DrawCtx *, area_t, float, bool, xcolor_t);
void draw_rectangle_gradient(DrawCtx *, area_t, float, bool, area_t, xcolor_t *, xcolor_t *, xcolor_t *); void draw_rectangle_gradient(DrawCtx *, area_t, float, bool, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
@ -138,7 +138,7 @@ void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char
area_t draw_get_image_size(const char *filename); area_t draw_get_image_size(const char *filename);
void draw_rotate(DrawCtx *, xcb_drawable_t, int, int, double, int, int); void draw_rotate(DrawCtx *, xcb_drawable_t, int, int, double, int, int);
unsigned short draw_textwidth(xcb_connection_t *, int, font_t *, const char *); unsigned short draw_textwidth(xcb_connection_t *, int, font_t *, const char *);
Alignment draw_align_get_from_str(const char *); alignment_t draw_align_get_from_str(const char *);
bool draw_color_new(xcb_connection_t *, int, const char *, xcolor_t *); bool draw_color_new(xcb_connection_t *, int, const char *, xcolor_t *);
void draw_style_init(xcb_connection_t *, int, cfg_t *, style_t *, style_t *); void draw_style_init(xcb_connection_t *, int, cfg_t *, style_t *, style_t *);

View File

@ -50,8 +50,8 @@ typedef struct
simple_window_t *sw; simple_window_t *sw;
Position position; Position position;
Position dposition; Position dposition;
Alignment align; alignment_t align;
Alignment text_align; alignment_t text_align;
int width, height; int width, height;
/** Colors */ /** Colors */
struct struct
@ -134,7 +134,7 @@ struct Widget
/** Statusbar */ /** Statusbar */
Statusbar *statusbar; Statusbar *statusbar;
/** Alignement */ /** Alignement */
Alignment alignment; alignment_t alignment;
/** Misc private data */ /** Misc private data */
void *data; void *data;
/** true if user supplied coords */ /** true if user supplied coords */

View File

@ -43,7 +43,7 @@ typedef struct
{ {
ShowClient show; ShowClient show;
bool show_icons; bool show_icons;
Alignment align; alignment_t align;
struct struct
{ {
style_t normal; style_t normal;

View File

@ -30,7 +30,7 @@ typedef struct
{ {
char *text; char *text;
int width; int width;
Alignment align; alignment_t align;
style_t style; style_t style;
} Data; } Data;