capi.widget: added widget.type getter
Signed-off-by: Lukas Hrazky <lukkash@email.cz> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
9a51955279
commit
f885b8e954
|
@ -494,6 +494,17 @@ luaA_widget_extents(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_widget_get_type(lua_State *L, widget_t *w)
|
||||
{
|
||||
if (w->type == widget_textbox) lua_pushstring(L, "textbox");
|
||||
else if (w->type == widget_systray) lua_pushstring(L, "systray");
|
||||
else if (w->type == widget_imagebox) lua_pushstring(L, "imagebox");
|
||||
else lua_pushstring(L, "unknown");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
luaA_widget_set_type(lua_State *L, widget_t *w)
|
||||
{
|
||||
|
@ -572,7 +583,7 @@ widget_class_setup(lua_State *L)
|
|||
(lua_class_propfunc_t) luaA_widget_set_visible);
|
||||
luaA_class_add_property(&widget_class, A_TK_TYPE,
|
||||
(lua_class_propfunc_t) luaA_widget_set_type,
|
||||
NULL,
|
||||
(lua_class_propfunc_t) luaA_widget_get_type,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue