Added AlignMiddle to alignment_t structure

- Added AlignMiddle to denote a vertically centered element

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Lionel Ott 2009-03-06 13:43:03 +01:00 committed by Julien Danjou
parent cc54c32c5f
commit 970b566580
2 changed files with 5 additions and 2 deletions

6
draw.c
View File

@ -686,8 +686,8 @@ draw_text_extents(draw_text_context_t *data)
} }
/** Transform a string to a alignment_t type. /** Transform a string to a alignment_t type.
* Recognized string are flex, fixed, left, center or right. Everything else * Recognized string are flex, fixed, left, center, middle or right.
* will be recognized as AlignLeft. * Everything else will be recognized as AlignLeft.
* \param align Atring with align text. * \param align Atring with align text.
* \param len The string length. * \param len The string length.
* \return An alignment_t type. * \return An alignment_t type.
@ -703,6 +703,7 @@ draw_align_fromstr(const char *align, ssize_t len)
case A_TK_FIXED: return AlignFixed; case A_TK_FIXED: return AlignFixed;
case A_TK_TOP: return AlignTop; case A_TK_TOP: return AlignTop;
case A_TK_BOTTOM: return AlignBottom; case A_TK_BOTTOM: return AlignBottom;
case A_TK_MIDDLE: return AlignMiddle;
default: return AlignLeft; default: return AlignLeft;
} }
} }
@ -723,6 +724,7 @@ draw_align_tostr(alignment_t a)
case AlignFixed: return "fixed"; case AlignFixed: return "fixed";
case AlignBottom: return "bottom"; case AlignBottom: return "bottom";
case AlignTop: return "top"; case AlignTop: return "top";
case AlignMiddle: return "middle";
default: return NULL; default: return NULL;
} }
} }

1
draw.h
View File

@ -62,6 +62,7 @@ typedef enum
AlignBottom = (1 << 3), AlignBottom = (1 << 3),
AlignFlex = (1 << 4), AlignFlex = (1 << 4),
AlignFixed = (1 << 5), AlignFixed = (1 << 5),
AlignMiddle = (1 << 6)
} alignment_t; } alignment_t;
typedef struct vector_t vector_t; typedef struct vector_t vector_t;