widgets: get rid of align attribute

Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2009-03-20 21:15:38 +01:00 committed by Julien Danjou
parent 6bbcb1f56e
commit aa9a7b1fc8
5 changed files with 4 additions and 26 deletions

3
draw.c
View File

@ -660,7 +660,6 @@ draw_text_extents(draw_text_context_t *data)
/** Transform a string to a alignment_t type.
* Recognized string are flex, fixed, left, center, middle or right.
* Everything else will be recognized as AlignLeft.
* \param align Atring with align text.
* \param len The string length.
* \return An alignment_t type.
@ -672,7 +671,6 @@ draw_align_fromstr(const char *align, ssize_t len)
{
case A_TK_CENTER: return AlignCenter;
case A_TK_RIGHT: return AlignRight;
case A_TK_FLEX: return AlignFlex;
case A_TK_FIXED: return AlignFixed;
case A_TK_TOP: return AlignTop;
case A_TK_BOTTOM: return AlignBottom;
@ -693,7 +691,6 @@ draw_align_tostr(alignment_t a)
case AlignLeft: return "left";
case AlignCenter: return "center";
case AlignRight: return "right";
case AlignFlex: return "flex";
case AlignFixed: return "fixed";
case AlignBottom: return "bottom";
case AlignTop: return "top";

5
draw.h
View File

@ -51,9 +51,8 @@ typedef enum
AlignCenter = (1 << 1),
AlignTop = (1 << 2),
AlignBottom = (1 << 3),
AlignFlex = (1 << 4),
AlignFixed = (1 << 5),
AlignMiddle = (1 << 6)
AlignFixed = (1 << 4),
AlignMiddle = (1 << 5)
} alignment_t;
typedef struct vector_t vector_t;

View File

@ -383,14 +383,13 @@ widget_invalidate_bywidget(widget_t *widget)
* \param L The Lua VM state.
*
* \luastack
* \lparam A table with at least a type value. Optional attributes
* are: align.
* \lparam A table with at least a type value.
* \lreturn A brand new widget.
*/
static int
luaA_widget_new(lua_State *L)
{
const char *align, *type;
const char *type;
widget_t *w;
widget_constructor_t *wc = NULL;
size_t len;
@ -433,10 +432,6 @@ luaA_widget_new(lua_State *L)
w->type = wc;
align = luaA_getopt_lstring(L, 2, "align", "left", &len);
w->align_supported |= AlignLeft | AlignRight | AlignFixed;
w->align = draw_align_fromstr(align, len);
/* Set visible by default. */
w->isvisible = true;
@ -472,7 +467,6 @@ luaA_widget_buttons(lua_State *L)
* \param L The Lua VM state.
* \return The number of elements pushed on stack.
* \luastack
* \lfield align The widget alignment.
* \lfield visible The widget visibility.
* \lfield mouse_enter A function to execute when the mouse enter the widget.
* \lfield mouse_leave A function to execute when the mouse leave the widget.
@ -490,9 +484,6 @@ luaA_widget_index(lua_State *L)
switch((token = a_tokenize(buf, len)))
{
case A_TK_ALIGN:
lua_pushstring(L, draw_align_tostr(widget->align));
return 1;
case A_TK_VISIBLE:
lua_pushboolean(L, widget->isvisible);
return 1;
@ -529,10 +520,6 @@ luaA_widget_newindex(lua_State *L)
switch((token = a_tokenize(buf, len)))
{
case A_TK_ALIGN:
buf = luaL_checklstring(L, 3, &len);
widget->align = draw_align_fromstr(buf, len);
break;
case A_TK_VISIBLE:
widget->isvisible = luaA_checkboolean(L, 3);
break;

View File

@ -48,10 +48,6 @@ struct widget_t
int (*newindex)(lua_State *, awesome_token_t);
/** Mouse over event handler */
luaA_ref mouse_enter, mouse_leave;
/** Alignement */
alignment_t align;
/** Supported alignment */
alignment_t align_supported;
/** Misc private data */
void *data;
/** Button bindings */

View File

@ -372,7 +372,6 @@ luaA_textbox_newindex(lua_State *L, awesome_token_t token)
widget_t *
widget_textbox(widget_t *w)
{
w->align_supported |= AlignFlex;
w->draw = textbox_draw;
w->index = luaA_textbox_index;
w->newindex = luaA_textbox_newindex;