awtk/lua/tk_lua.c
2018-06-22 17:46:09 +08:00

4223 lines
110 KiB
C

/*XXX: generated by lua_gen. dont edit it.*/
#include "lua/lua.h"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
#include "base/utf8.h"
#include "base/array.h"
#include "base/bitmap.h"
#include "base/buffer.h"
#include "base/button.h"
#include "base/canvas.h"
#include "base/check_button.h"
#include "base/dialog.h"
#include "base/edit.h"
#include "base/emitter.h"
#include "base/events.h"
#include "base/font_manager.h"
#include "base/group_box.h"
#include "base/idle.h"
#include "base/image_loader.h"
#include "base/image_manager.h"
#include "base/image.h"
#include "base/input_method.h"
#include "base/keyboard.h"
#include "base/label.h"
#include "base/lcd.h"
#include "base/locale.h"
#include "base/mutex.h"
#include "base/pages.h"
#include "base/progress_bar.h"
#include "base/rect.h"
#include "base/resource_manager.h"
#include "base/slide_view.h"
#include "base/slider.h"
#include "base/str.h"
#include "base/system_info.h"
#include "base/theme.h"
#include "base/thread.h"
#include "base/timer.h"
#include "base/tokenizer.h"
#include "base/types_def.h"
#include "base/value.h"
#include "base/velocity.h"
#include "base/vgcanvas.h"
#include "base/view.h"
#include "base/widget_animator.h"
#include "base/widget.h"
#include "base/window_animator.h"
#include "base/window_manager.h"
#include "base/window.h"
#include "base/wstr.h"
#include "src/tk.h"
#include "widget_animators/widget_animator_move.h"
#include "widget_animators/widget_animator_opacity.h"
#include "widget_animators/widget_animator_rotation.h"
#include "widget_animators/widget_animator_scale.h"
#include "widget_animators/widget_animator_scroll.h"
#include "widget_animators/widget_animator_value.h"
#include "custom.c"
static int wrap_button_t_get_prop(lua_State* L);
static int wrap_button_t_set_prop(lua_State* L);
static int wrap_canvas_t_get_prop(lua_State* L);
static int wrap_canvas_t_set_prop(lua_State* L);
static int wrap_check_button_t_get_prop(lua_State* L);
static int wrap_check_button_t_set_prop(lua_State* L);
static int wrap_dialog_t_get_prop(lua_State* L);
static int wrap_dialog_t_set_prop(lua_State* L);
static int wrap_edit_t_get_prop(lua_State* L);
static int wrap_edit_t_set_prop(lua_State* L);
static int wrap_emitter_t_get_prop(lua_State* L);
static int wrap_emitter_t_set_prop(lua_State* L);
static int wrap_event_t_get_prop(lua_State* L);
static int wrap_event_t_set_prop(lua_State* L);
static int wrap_pointer_event_t_get_prop(lua_State* L);
static int wrap_pointer_event_t_set_prop(lua_State* L);
static int wrap_key_event_t_get_prop(lua_State* L);
static int wrap_key_event_t_set_prop(lua_State* L);
static int wrap_paint_event_t_get_prop(lua_State* L);
static int wrap_paint_event_t_set_prop(lua_State* L);
static int wrap_group_box_t_get_prop(lua_State* L);
static int wrap_group_box_t_set_prop(lua_State* L);
static int wrap_image_t_get_prop(lua_State* L);
static int wrap_image_t_set_prop(lua_State* L);
static int wrap_input_method_t_get_prop(lua_State* L);
static int wrap_input_method_t_set_prop(lua_State* L);
static int wrap_im_commit_event_t_get_prop(lua_State* L);
static int wrap_im_commit_event_t_set_prop(lua_State* L);
static int wrap_im_action_button_info_event_t_get_prop(lua_State* L);
static int wrap_im_action_button_info_event_t_set_prop(lua_State* L);
static int wrap_im_candidates_event_t_get_prop(lua_State* L);
static int wrap_im_candidates_event_t_set_prop(lua_State* L);
static int wrap_keyboard_t_get_prop(lua_State* L);
static int wrap_keyboard_t_set_prop(lua_State* L);
static int wrap_label_t_get_prop(lua_State* L);
static int wrap_label_t_set_prop(lua_State* L);
static int wrap_pages_t_get_prop(lua_State* L);
static int wrap_pages_t_set_prop(lua_State* L);
static int wrap_progress_bar_t_get_prop(lua_State* L);
static int wrap_progress_bar_t_set_prop(lua_State* L);
static int wrap_point_t_get_prop(lua_State* L);
static int wrap_point_t_set_prop(lua_State* L);
static int wrap_rect_t_get_prop(lua_State* L);
static int wrap_rect_t_set_prop(lua_State* L);
static int wrap_slide_view_t_get_prop(lua_State* L);
static int wrap_slide_view_t_set_prop(lua_State* L);
static int wrap_slider_t_get_prop(lua_State* L);
static int wrap_slider_t_set_prop(lua_State* L);
static int wrap_value_t_get_prop(lua_State* L);
static int wrap_value_t_set_prop(lua_State* L);
static int wrap_view_t_get_prop(lua_State* L);
static int wrap_view_t_set_prop(lua_State* L);
static int wrap_widget_t_get_prop(lua_State* L);
static int wrap_widget_t_set_prop(lua_State* L);
static int wrap_window_t_get_prop(lua_State* L);
static int wrap_window_t_set_prop(lua_State* L);
static int wrap_tk_quit(lua_State* L) {
ret_t ret = 0;
ret = (ret_t)tk_quit();
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_tk_set_lcd_orientation(lua_State* L) {
ret_t ret = 0;
int orientation = (int)luaL_checkinteger(L, 1);
ret = (ret_t)tk_set_lcd_orientation(orientation);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static void globals_init(lua_State* L) {
lua_pushcfunction(L, wrap_tk_quit);
lua_setglobal(L, "tk_quit");
lua_pushcfunction(L, wrap_tk_set_lcd_orientation);
lua_setglobal(L, "tk_set_lcd_orientation");
lua_pushcfunction(L, to_str);
lua_setglobal(L, "to_str");
lua_pushcfunction(L, to_wstr);
lua_setglobal(L, "to_wstr");
}
static int wrap_button_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)button_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/button_t/widget_t", "awtk.button_t");
}
static const struct luaL_Reg button_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_button_t_set_prop(lua_State* L) {
button_t* obj = (button_t*)tk_checkudata(L, 1, "button_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_button_t_get_prop(lua_State* L) {
button_t* obj = (button_t*)tk_checkudata(L, 1, "button_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(button_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void button_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_button_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_button_t_get_prop},
{"__newindex", wrap_button_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.button_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Button", static_funcs, 0);
lua_settop(L, 0);
}
static const struct luaL_Reg canvas_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_canvas_t_set_prop(lua_State* L) {
canvas_t* obj = (canvas_t*)tk_checkudata(L, 1, "canvas_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_canvas_t_get_prop(lua_State* L) {
canvas_t* obj = (canvas_t*)tk_checkudata(L, 1, "canvas_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(canvas_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void canvas_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_canvas_t_get_prop},
{"__newindex", wrap_canvas_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.canvas_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Canvas", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_check_button_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)check_button_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/check_button_t/widget_t", "awtk.check_button_t");
}
static int wrap_check_button_create_radio(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)check_button_create_radio(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/check_button_t/widget_t", "awtk.check_button_t");
}
static int wrap_check_button_set_value(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t value = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)check_button_set_value(widget, value);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg check_button_t_member_funcs[] = {
{"set_value", wrap_check_button_set_value},
{NULL, NULL}
};
static int wrap_check_button_t_set_prop(lua_State* L) {
check_button_t* obj = (check_button_t*)tk_checkudata(L, 1, "check_button_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "value") == 0) {
printf("value is readonly\n");
return 0;
}
else {
return wrap_widget_t_set_prop(L);
}
}
static int wrap_check_button_t_get_prop(lua_State* L) {
check_button_t* obj = (check_button_t*)tk_checkudata(L, 1, "check_button_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(check_button_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "value") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->value));
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void check_button_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_check_button_create},
{"create_radio", wrap_check_button_create_radio},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_check_button_t_get_prop},
{"__newindex", wrap_check_button_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.check_button_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "CheckButton", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_dialog_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)dialog_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/dialog_t/widget_t", "awtk.dialog_t");
}
static int wrap_dialog_open(lua_State* L) {
widget_t* ret = NULL;
char* name = (char*)luaL_checkstring(L, 1);
ret = (widget_t*)dialog_open(name);
return tk_newuserdata(L, ret, "/dialog_t/widget_t", "awtk.dialog_t");
}
static int wrap_dialog_set_title(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
wchar_t* title = (wchar_t*)lua_touserdata(L, 2);
ret = (ret_t)dialog_set_title(widget, title);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_dialog_modal(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)dialog_modal(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_dialog_quit(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t code = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)dialog_quit(widget, code);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg dialog_t_member_funcs[] = {
{"set_title", wrap_dialog_set_title},
{"modal", wrap_dialog_modal},
{"quit", wrap_dialog_quit},
{NULL, NULL}
};
static int wrap_dialog_t_set_prop(lua_State* L) {
dialog_t* obj = (dialog_t*)tk_checkudata(L, 1, "dialog_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_dialog_t_get_prop(lua_State* L) {
dialog_t* obj = (dialog_t*)tk_checkudata(L, 1, "dialog_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(dialog_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void dialog_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_dialog_create},
{"open", wrap_dialog_open},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_dialog_t_get_prop},
{"__newindex", wrap_dialog_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.dialog_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Dialog", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_edit_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)edit_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/edit_t/widget_t", "awtk.edit_t");
}
static int wrap_edit_set_text_limit(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t min = (uint32_t)luaL_checkinteger(L, 2);
uint32_t max = (uint32_t)luaL_checkinteger(L, 3);
ret = (ret_t)edit_set_text_limit(widget, min, max);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_int_limit(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
int32_t min = (int32_t)luaL_checkinteger(L, 2);
int32_t max = (int32_t)luaL_checkinteger(L, 3);
ret = (ret_t)edit_set_int_limit(widget, min, max);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_float_limit(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
float min = (float)luaL_checknumber(L, 2);
float max = (float)luaL_checknumber(L, 3);
float step = (float)luaL_checknumber(L, 4);
ret = (ret_t)edit_set_float_limit(widget, min, max, step);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_readonly(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t readonly = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)edit_set_readonly(widget, readonly);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_input_type(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
input_type_t type = (input_type_t)luaL_checkinteger(L, 2);
ret = (ret_t)edit_set_input_type(widget, type);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_input_tips(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
wchar_t* tips = (wchar_t*)lua_touserdata(L, 2);
ret = (ret_t)edit_set_input_tips(widget, tips);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_edit_set_password_visible(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t password_visible = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)edit_set_password_visible(widget, password_visible);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg edit_t_member_funcs[] = {
{"set_text_limit", wrap_edit_set_text_limit},
{"set_int_limit", wrap_edit_set_int_limit},
{"set_float_limit", wrap_edit_set_float_limit},
{"set_readonly", wrap_edit_set_readonly},
{"set_input_type", wrap_edit_set_input_type},
{"set_input_tips", wrap_edit_set_input_tips},
{"set_password_visible", wrap_edit_set_password_visible},
{NULL, NULL}
};
static int wrap_edit_t_set_prop(lua_State* L) {
edit_t* obj = (edit_t*)tk_checkudata(L, 1, "edit_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_edit_t_get_prop(lua_State* L) {
edit_t* obj = (edit_t*)tk_checkudata(L, 1, "edit_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(edit_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void edit_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_edit_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_edit_t_get_prop},
{"__newindex", wrap_edit_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.edit_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Edit", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_emitter_create(lua_State* L) {
emitter_t* ret = NULL;
ret = (emitter_t*)emitter_create();
return tk_newuserdata(L, ret, "/emitter_t", "awtk.emitter_t");
}
static int wrap_emitter_init(lua_State* L) {
emitter_t* ret = NULL;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (emitter_t*)emitter_init(emitter);
return tk_newuserdata(L, ret, "/emitter_t", "awtk.emitter_t");
}
static int wrap_emitter_dispatch(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
event_t* e = (event_t*)tk_checkudata(L, 2, "event_t");
ret = (ret_t)emitter_dispatch(emitter, e);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_on(lua_State* L) {
uint32_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
event_type_t type = (event_type_t)luaL_checkinteger(L, 2);
event_func_t on_event = (event_func_t)lua_tocfunction(L, 3);
void* ctx = NULL;
ret = (uint32_t)emitter_on(emitter, type, on_event, ctx);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_emitter_off(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
uint32_t id = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)emitter_off(emitter, id);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_off_by_func(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
event_type_t type = (event_type_t)luaL_checkinteger(L, 2);
event_func_t on_event = (event_func_t)lua_tocfunction(L, 3);
void* ctx = NULL;
ret = (ret_t)emitter_off_by_func(emitter, type, on_event, ctx);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_find(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
uint32_t id = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)emitter_find(emitter, id);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_enable(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (ret_t)emitter_enable(emitter);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_disable(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (ret_t)emitter_disable(emitter);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_size(lua_State* L) {
uint32_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (uint32_t)emitter_size(emitter);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_emitter_deinit(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (ret_t)emitter_deinit(emitter);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_emitter_destroy(lua_State* L) {
ret_t ret = 0;
emitter_t* emitter = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
ret = (ret_t)emitter_destroy(emitter);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg emitter_t_member_funcs[] = {
{"dispatch", wrap_emitter_dispatch},
{"on", wrap_emitter_on},
{"off", wrap_emitter_off},
{"off_by_func", wrap_emitter_off_by_func},
{"find", wrap_emitter_find},
{"enable", wrap_emitter_enable},
{"disable", wrap_emitter_disable},
{"size", wrap_emitter_size},
{"deinit", wrap_emitter_deinit},
{"destroy", wrap_emitter_destroy},
{NULL, NULL}
};
static int wrap_emitter_t_set_prop(lua_State* L) {
emitter_t* obj = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "enable") == 0) {
printf("enable is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_emitter_t_get_prop(lua_State* L) {
emitter_t* obj = (emitter_t*)tk_checkudata(L, 1, "emitter_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(emitter_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "enable") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->enable));
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void emitter_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_emitter_create},
{"init", wrap_emitter_init},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_emitter_t_get_prop},
{"__newindex", wrap_emitter_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.emitter_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Emitter", static_funcs, 0);
lua_settop(L, 0);
}
static void event_type_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "EventType");
lua_getglobal(L, "EventType");
lua_pushstring(L, "NONE");
lua_pushinteger(L, EVT_NONE);
lua_settable(L, -3);
lua_pushstring(L, "POINTER_DOWN");
lua_pushinteger(L, EVT_POINTER_DOWN);
lua_settable(L, -3);
lua_pushstring(L, "POINTER_MOVE");
lua_pushinteger(L, EVT_POINTER_MOVE);
lua_settable(L, -3);
lua_pushstring(L, "POINTER_UP");
lua_pushinteger(L, EVT_POINTER_UP);
lua_settable(L, -3);
lua_pushstring(L, "POINTER_ENTER");
lua_pushinteger(L, EVT_POINTER_ENTER);
lua_settable(L, -3);
lua_pushstring(L, "POINTER_LEAVE");
lua_pushinteger(L, EVT_POINTER_LEAVE);
lua_settable(L, -3);
lua_pushstring(L, "CLICK");
lua_pushinteger(L, EVT_CLICK);
lua_settable(L, -3);
lua_pushstring(L, "FOCUS");
lua_pushinteger(L, EVT_FOCUS);
lua_settable(L, -3);
lua_pushstring(L, "BLUR");
lua_pushinteger(L, EVT_BLUR);
lua_settable(L, -3);
lua_pushstring(L, "KEY_DOWN");
lua_pushinteger(L, EVT_KEY_DOWN);
lua_settable(L, -3);
lua_pushstring(L, "KEY_UP");
lua_pushinteger(L, EVT_KEY_UP);
lua_settable(L, -3);
lua_pushstring(L, "MOVE");
lua_pushinteger(L, EVT_MOVE);
lua_settable(L, -3);
lua_pushstring(L, "RESIZE");
lua_pushinteger(L, EVT_RESIZE);
lua_settable(L, -3);
lua_pushstring(L, "DESTROY");
lua_pushinteger(L, EVT_DESTROY);
lua_settable(L, -3);
lua_pushstring(L, "MOVE_RESIZE");
lua_pushinteger(L, EVT_MOVE_RESIZE);
lua_settable(L, -3);
lua_pushstring(L, "PROP_CHANGED");
lua_pushinteger(L, EVT_PROP_CHANGED);
lua_settable(L, -3);
lua_pushstring(L, "VALUE_CHANGED");
lua_pushinteger(L, EVT_VALUE_CHANGED);
lua_settable(L, -3);
lua_pushstring(L, "VALUE_CHANGING");
lua_pushinteger(L, EVT_VALUE_CHANGING);
lua_settable(L, -3);
lua_pushstring(L, "PAINT");
lua_pushinteger(L, EVT_PAINT);
lua_settable(L, -3);
lua_pushstring(L, "BEFORE_PAINT");
lua_pushinteger(L, EVT_BEFORE_PAINT);
lua_settable(L, -3);
lua_pushstring(L, "AFTER_PAINT");
lua_pushinteger(L, EVT_AFTER_PAINT);
lua_settable(L, -3);
lua_pushstring(L, "LOCALE_CHANGED");
lua_pushinteger(L, EVT_LOCALE_CHANGED);
lua_settable(L, -3);
lua_pushstring(L, "ANIM_START");
lua_pushinteger(L, EVT_ANIM_START);
lua_settable(L, -3);
lua_pushstring(L, "ANIM_STOP");
lua_pushinteger(L, EVT_ANIM_STOP);
lua_settable(L, -3);
lua_pushstring(L, "ANIM_ONCE");
lua_pushinteger(L, EVT_ANIM_ONCE);
lua_settable(L, -3);
lua_pushstring(L, "ANIM_END");
lua_pushinteger(L, EVT_ANIM_END);
lua_settable(L, -3);
lua_pushstring(L, "WINDOW_LOAD");
lua_pushinteger(L, EVT_WINDOW_LOAD);
lua_settable(L, -3);
lua_pushstring(L, "WINDOW_OPEN");
lua_pushinteger(L, EVT_WINDOW_OPEN);
lua_settable(L, -3);
lua_pushstring(L, "IM_COMMIT");
lua_pushinteger(L, EVT_IM_COMMIT);
lua_settable(L, -3);
lua_pushstring(L, "IM_SHOW_CANDIDATES");
lua_pushinteger(L, EVT_IM_SHOW_CANDIDATES);
lua_settable(L, -3);
lua_pushstring(L, "IM_ACTION");
lua_pushinteger(L, EVT_IM_ACTION);
lua_settable(L, -3);
lua_pushstring(L, "IM_ACTION_INFO");
lua_pushinteger(L, EVT_IM_ACTION_INFO);
lua_settable(L, -3);
lua_pushstring(L, "REQ_START");
lua_pushinteger(L, EVT_REQ_START);
lua_settable(L, -3);
lua_pushstring(L, "USER_START");
lua_pushinteger(L, EVT_USER_START);
lua_settable(L, -3);
}
static const struct luaL_Reg event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_event_t_set_prop(lua_State* L) {
event_t* obj = (event_t*)tk_checkudata(L, 1, "event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "type") == 0) {
printf("type is readonly\n");
return 0;
}
else if(strcmp(name, "time") == 0) {
printf("time is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_event_t_get_prop(lua_State* L) {
event_t* obj = (event_t*)tk_checkudata(L, 1, "event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "type") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->type));
return 1;
}
else if(strcmp(name, "time") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->time));
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_event_t_get_prop},
{"__newindex", wrap_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Event", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_pointer_event_cast(lua_State* L) {
pointer_event_t* ret = NULL;
event_t* event = (event_t*)tk_checkudata(L, 1, "event_t");
ret = (pointer_event_t*)pointer_event_cast(event);
return tk_newuserdata(L, ret, "/pointer_event_t/event_t", "awtk.pointer_event_t");
}
static const struct luaL_Reg pointer_event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_pointer_event_t_set_prop(lua_State* L) {
pointer_event_t* obj = (pointer_event_t*)tk_checkudata(L, 1, "pointer_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "x") == 0) {
printf("x is readonly\n");
return 0;
}
else if(strcmp(name, "y") == 0) {
printf("y is readonly\n");
return 0;
}
else if(strcmp(name, "button") == 0) {
printf("button is readonly\n");
return 0;
}
else if(strcmp(name, "pressed") == 0) {
printf("pressed is readonly\n");
return 0;
}
else if(strcmp(name, "alt") == 0) {
printf("alt is readonly\n");
return 0;
}
else if(strcmp(name, "ctrl") == 0) {
printf("ctrl is readonly\n");
return 0;
}
else if(strcmp(name, "shift") == 0) {
printf("shift is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_pointer_event_t_get_prop(lua_State* L) {
pointer_event_t* obj = (pointer_event_t*)tk_checkudata(L, 1, "pointer_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(pointer_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "x") == 0) {
lua_pushnumber(L,(lua_Number)(obj->x));
return 1;
}
else if(strcmp(name, "y") == 0) {
lua_pushnumber(L,(lua_Number)(obj->y));
return 1;
}
else if(strcmp(name, "button") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->button));
return 1;
}
else if(strcmp(name, "pressed") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->pressed));
return 1;
}
else if(strcmp(name, "alt") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->alt));
return 1;
}
else if(strcmp(name, "ctrl") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->ctrl));
return 1;
}
else if(strcmp(name, "shift") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->shift));
return 1;
}
else {
return wrap_event_t_get_prop(L);
}
}
static void pointer_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"cast", wrap_pointer_event_cast},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_pointer_event_t_get_prop},
{"__newindex", wrap_pointer_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.pointer_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "PointerEvent", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_key_event_cast(lua_State* L) {
key_event_t* ret = NULL;
event_t* event = (event_t*)tk_checkudata(L, 1, "event_t");
ret = (key_event_t*)key_event_cast(event);
return tk_newuserdata(L, ret, "/key_event_t/event_t", "awtk.key_event_t");
}
static const struct luaL_Reg key_event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_key_event_t_set_prop(lua_State* L) {
key_event_t* obj = (key_event_t*)tk_checkudata(L, 1, "key_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "key") == 0) {
printf("key is readonly\n");
return 0;
}
else if(strcmp(name, "alt") == 0) {
printf("alt is readonly\n");
return 0;
}
else if(strcmp(name, "ctrl") == 0) {
printf("ctrl is readonly\n");
return 0;
}
else if(strcmp(name, "shift") == 0) {
printf("shift is readonly\n");
return 0;
}
else if(strcmp(name, "caplock") == 0) {
printf("caplock is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_key_event_t_get_prop(lua_State* L) {
key_event_t* obj = (key_event_t*)tk_checkudata(L, 1, "key_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(key_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "key") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->key));
return 1;
}
else if(strcmp(name, "alt") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->alt));
return 1;
}
else if(strcmp(name, "ctrl") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->ctrl));
return 1;
}
else if(strcmp(name, "shift") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->shift));
return 1;
}
else if(strcmp(name, "caplock") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->caplock));
return 1;
}
else {
return wrap_event_t_get_prop(L);
}
}
static void key_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"cast", wrap_key_event_cast},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_key_event_t_get_prop},
{"__newindex", wrap_key_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.key_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "KeyEvent", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_paint_event_cast(lua_State* L) {
paint_event_t* ret = NULL;
event_t* event = (event_t*)tk_checkudata(L, 1, "event_t");
ret = (paint_event_t*)paint_event_cast(event);
return tk_newuserdata(L, ret, "/paint_event_t/event_t", "awtk.paint_event_t");
}
static const struct luaL_Reg paint_event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_paint_event_t_set_prop(lua_State* L) {
paint_event_t* obj = (paint_event_t*)tk_checkudata(L, 1, "paint_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "c") == 0) {
printf("c is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_paint_event_t_get_prop(lua_State* L) {
paint_event_t* obj = (paint_event_t*)tk_checkudata(L, 1, "paint_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(paint_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "c") == 0) {
return tk_newuserdata(L, obj->c, "/canvas_t", "awtk.canvas_t");
}
else {
return wrap_event_t_get_prop(L);
}
}
static void paint_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"cast", wrap_paint_event_cast},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_paint_event_t_get_prop},
{"__newindex", wrap_paint_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.paint_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "PaintEvent", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_group_box_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)group_box_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/group_box_t/widget_t", "awtk.group_box_t");
}
static const struct luaL_Reg group_box_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_group_box_t_set_prop(lua_State* L) {
group_box_t* obj = (group_box_t*)tk_checkudata(L, 1, "group_box_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_group_box_t_get_prop(lua_State* L) {
group_box_t* obj = (group_box_t*)tk_checkudata(L, 1, "group_box_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(group_box_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void group_box_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_group_box_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_group_box_t_get_prop},
{"__newindex", wrap_group_box_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.group_box_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "GroupBox", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_idle_count(lua_State* L) {
uint32_t ret = 0;
ret = (uint32_t)idle_count();
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static void idle_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"add", wrap_idle_add},
{"remove", wrap_idle_remove},
{"count", wrap_idle_count},
{NULL, NULL}
};
luaL_openlib(L, "Idle", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_image_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)image_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/image_t/widget_t", "awtk.image_t");
}
static int wrap_image_set_image_name(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
ret = (ret_t)image_set_image_name(widget, name);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_image_set_draw_type(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
image_draw_type_t draw_type = (image_draw_type_t)luaL_checkinteger(L, 2);
ret = (ret_t)image_set_draw_type(widget, draw_type);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg image_t_member_funcs[] = {
{"set_image_name", wrap_image_set_image_name},
{"set_draw_type", wrap_image_set_draw_type},
{NULL, NULL}
};
static int wrap_image_t_set_prop(lua_State* L) {
image_t* obj = (image_t*)tk_checkudata(L, 1, "image_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_image_t_get_prop(lua_State* L) {
image_t* obj = (image_t*)tk_checkudata(L, 1, "image_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(image_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void image_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_image_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_image_t_get_prop},
{"__newindex", wrap_image_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.image_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Image", static_funcs, 0);
lua_settop(L, 0);
}
static void input_type_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "InputType");
lua_getglobal(L, "InputType");
lua_pushstring(L, "TEXT");
lua_pushinteger(L, INPUT_TEXT);
lua_settable(L, -3);
lua_pushstring(L, "INT");
lua_pushinteger(L, INPUT_INT);
lua_settable(L, -3);
lua_pushstring(L, "UINT");
lua_pushinteger(L, INPUT_UINT);
lua_settable(L, -3);
lua_pushstring(L, "HEX");
lua_pushinteger(L, INPUT_HEX);
lua_settable(L, -3);
lua_pushstring(L, "FLOAT");
lua_pushinteger(L, INPUT_FLOAT);
lua_settable(L, -3);
lua_pushstring(L, "UFLOAT");
lua_pushinteger(L, INPUT_UFLOAT);
lua_settable(L, -3);
lua_pushstring(L, "EMAIL");
lua_pushinteger(L, INPUT_EMAIL);
lua_settable(L, -3);
lua_pushstring(L, "PASSWORD");
lua_pushinteger(L, INPUT_PASSWORD);
lua_settable(L, -3);
lua_pushstring(L, "PHONE");
lua_pushinteger(L, INPUT_PHONE);
lua_settable(L, -3);
}
static const struct luaL_Reg input_method_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_input_method_t_set_prop(lua_State* L) {
input_method_t* obj = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "widget") == 0) {
printf("widget is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_input_method_t_get_prop(lua_State* L) {
input_method_t* obj = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(input_method_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "widget") == 0) {
return tk_newuserdata(L, obj->widget, "/widget_t", "awtk.widget_t");
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void input_method_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_input_method_t_get_prop},
{"__newindex", wrap_input_method_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.input_method_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "InputMethod", static_funcs, 0);
lua_settop(L, 0);
}
static const struct luaL_Reg im_commit_event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_im_commit_event_t_set_prop(lua_State* L) {
im_commit_event_t* obj = (im_commit_event_t*)tk_checkudata(L, 1, "im_commit_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "text") == 0) {
printf("text is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_im_commit_event_t_get_prop(lua_State* L) {
im_commit_event_t* obj = (im_commit_event_t*)tk_checkudata(L, 1, "im_commit_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(im_commit_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "text") == 0) {
lua_pushstring(L,(char*)(obj->text));
return 1;
}
else {
return wrap_event_t_get_prop(L);
}
}
static void im_commit_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_im_commit_event_t_get_prop},
{"__newindex", wrap_im_commit_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.im_commit_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "ImCommitEvent", static_funcs, 0);
lua_settop(L, 0);
}
static const struct luaL_Reg im_action_button_info_event_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_im_action_button_info_event_t_set_prop(lua_State* L) {
im_action_button_info_event_t* obj = (im_action_button_info_event_t*)tk_checkudata(L, 1, "im_action_button_info_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "text") == 0) {
printf("text is readonly\n");
return 0;
}
else if(strcmp(name, "enable") == 0) {
printf("enable is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_im_action_button_info_event_t_get_prop(lua_State* L) {
im_action_button_info_event_t* obj = (im_action_button_info_event_t*)tk_checkudata(L, 1, "im_action_button_info_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(im_action_button_info_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "text") == 0) {
lua_pushstring(L,(char*)(obj->text));
return 1;
}
else if(strcmp(name, "enable") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->enable));
return 1;
}
else {
return wrap_event_t_get_prop(L);
}
}
static void im_action_button_info_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_im_action_button_info_event_t_get_prop},
{"__newindex", wrap_im_action_button_info_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.im_action_button_info_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "ImActionButtonInfoEvent", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_input_method_dispatch(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
event_t* e = (event_t*)tk_checkudata(L, 2, "event_t");
ret = (ret_t)input_method_dispatch(im, e);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_dispatch_to_widget(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
event_t* e = (event_t*)tk_checkudata(L, 2, "event_t");
ret = (ret_t)input_method_dispatch_to_widget(im, e);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_on(lua_State* L) {
uint32_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
event_type_t type = (event_type_t)luaL_checkinteger(L, 2);
event_func_t on_event = (event_func_t)lua_tocfunction(L, 3);
void* ctx = NULL;
ret = (uint32_t)input_method_on(im, type, on_event, ctx);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_input_method_off(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
uint32_t id = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)input_method_off(im, id);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_request(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
widget_t* widget = (widget_t*)tk_checkudata(L, 2, "widget_t");
ret = (ret_t)input_method_request(im, widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_update_action_button_info(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
char* text = (char*)luaL_checkstring(L, 2);
bool_t enable = (bool_t)lua_toboolean(L, 3);
ret = (ret_t)input_method_update_action_button_info(im, text, enable);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_dispatch_action(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
ret = (ret_t)input_method_dispatch_action(im);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_commit_text(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
char* text = (char*)luaL_checkstring(L, 2);
ret = (ret_t)input_method_commit_text(im, text);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_dispatch_key(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
uint32_t key = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)input_method_dispatch_key(im, key);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method_create(lua_State* L) {
input_method_t* ret = NULL;
ret = (input_method_t*)input_method_create();
return tk_newuserdata(L, ret, "/input_method_t", "awtk.input_method_t");
}
static int wrap_input_method_destroy(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
ret = (ret_t)input_method_destroy(im);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_input_method(lua_State* L) {
input_method_t* ret = NULL;
ret = (input_method_t*)input_method();
return tk_newuserdata(L, ret, "/input_method_t", "awtk.input_method_t");
}
static int wrap_input_method_set(lua_State* L) {
ret_t ret = 0;
input_method_t* im = (input_method_t*)tk_checkudata(L, 1, "input_method_t");
ret = (ret_t)input_method_set(im);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg im_candidates_event_t_member_funcs[] = {
{"input_method_dispatch", wrap_input_method_dispatch},
{"input_method_dispatch_to_widget", wrap_input_method_dispatch_to_widget},
{"input_method_on", wrap_input_method_on},
{"input_method_off", wrap_input_method_off},
{"input_method_request", wrap_input_method_request},
{"input_method_update_action_button_info", wrap_input_method_update_action_button_info},
{"input_method_dispatch_action", wrap_input_method_dispatch_action},
{"input_method_commit_text", wrap_input_method_commit_text},
{"input_method_dispatch_key", wrap_input_method_dispatch_key},
{"input_method_create", wrap_input_method_create},
{"input_method_destroy", wrap_input_method_destroy},
{"input_method", wrap_input_method},
{"input_method_set", wrap_input_method_set},
{NULL, NULL}
};
static int wrap_im_candidates_event_t_set_prop(lua_State* L) {
im_candidates_event_t* obj = (im_candidates_event_t*)tk_checkudata(L, 1, "im_candidates_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "candidates") == 0) {
printf("candidates is readonly\n");
return 0;
}
else if(strcmp(name, "candidates_nr") == 0) {
printf("candidates_nr is readonly\n");
return 0;
}
else {
return wrap_event_t_set_prop(L);
}
}
static int wrap_im_candidates_event_t_get_prop(lua_State* L) {
im_candidates_event_t* obj = (im_candidates_event_t*)tk_checkudata(L, 1, "im_candidates_event_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(im_candidates_event_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "candidates") == 0) {
lua_pushstring(L,(char*)(obj->candidates));
return 1;
}
else if(strcmp(name, "candidates_nr") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->candidates_nr));
return 1;
}
else {
return wrap_event_t_get_prop(L);
}
}
static void im_candidates_event_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_im_candidates_event_t_get_prop},
{"__newindex", wrap_im_candidates_event_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.im_candidates_event_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "ImCandidatesEvent", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_keyboard_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)keyboard_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/keyboard_t/widget_t", "awtk.keyboard_t");
}
static int wrap_keyboard_close(lua_State* L) {
ret_t ret = 0;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)keyboard_close(parent);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg keyboard_t_member_funcs[] = {
{"close", wrap_keyboard_close},
{NULL, NULL}
};
static int wrap_keyboard_t_set_prop(lua_State* L) {
keyboard_t* obj = (keyboard_t*)tk_checkudata(L, 1, "keyboard_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_keyboard_t_get_prop(lua_State* L) {
keyboard_t* obj = (keyboard_t*)tk_checkudata(L, 1, "keyboard_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(keyboard_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void keyboard_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_keyboard_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_keyboard_t_get_prop},
{"__newindex", wrap_keyboard_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.keyboard_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Keyboard", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_label_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)label_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/label_t/widget_t", "awtk.label_t");
}
static const struct luaL_Reg label_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_label_t_set_prop(lua_State* L) {
label_t* obj = (label_t*)tk_checkudata(L, 1, "label_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_label_t_get_prop(lua_State* L) {
label_t* obj = (label_t*)tk_checkudata(L, 1, "label_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(label_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void label_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_label_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_label_t_get_prop},
{"__newindex", wrap_label_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.label_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Label", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_pages_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)pages_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/pages_t/widget_t", "awtk.pages_t");
}
static int wrap_pages_set_active(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t index = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)pages_set_active(widget, index);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_pages_set_active_by_name(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
ret = (ret_t)pages_set_active_by_name(widget, name);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg pages_t_member_funcs[] = {
{"set_active", wrap_pages_set_active},
{"set_active_by_name", wrap_pages_set_active_by_name},
{NULL, NULL}
};
static int wrap_pages_t_set_prop(lua_State* L) {
pages_t* obj = (pages_t*)tk_checkudata(L, 1, "pages_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "active") == 0) {
printf("active is readonly\n");
return 0;
}
else {
return wrap_widget_t_set_prop(L);
}
}
static int wrap_pages_t_get_prop(lua_State* L) {
pages_t* obj = (pages_t*)tk_checkudata(L, 1, "pages_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(pages_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "active") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->active));
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void pages_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_pages_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_pages_t_get_prop},
{"__newindex", wrap_pages_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.pages_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Pages", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_progress_bar_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)progress_bar_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/progress_bar_t/widget_t", "awtk.progress_bar_t");
}
static int wrap_progress_bar_set_value(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint8_t value = (uint8_t)luaL_checkinteger(L, 2);
ret = (ret_t)progress_bar_set_value(widget, value);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_progress_bar_set_vertical(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t vertical = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)progress_bar_set_vertical(widget, vertical);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_progress_bar_set_show_text(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t show_text = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)progress_bar_set_show_text(widget, show_text);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg progress_bar_t_member_funcs[] = {
{"set_value", wrap_progress_bar_set_value},
{"set_vertical", wrap_progress_bar_set_vertical},
{"set_show_text", wrap_progress_bar_set_show_text},
{NULL, NULL}
};
static int wrap_progress_bar_t_set_prop(lua_State* L) {
progress_bar_t* obj = (progress_bar_t*)tk_checkudata(L, 1, "progress_bar_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "value") == 0) {
printf("value is readonly\n");
return 0;
}
else if(strcmp(name, "vertical") == 0) {
printf("vertical is readonly\n");
return 0;
}
else if(strcmp(name, "show_text") == 0) {
printf("show_text is readonly\n");
return 0;
}
else {
return wrap_widget_t_set_prop(L);
}
}
static int wrap_progress_bar_t_get_prop(lua_State* L) {
progress_bar_t* obj = (progress_bar_t*)tk_checkudata(L, 1, "progress_bar_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(progress_bar_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "value") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->value));
return 1;
}
else if(strcmp(name, "vertical") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->vertical));
return 1;
}
else if(strcmp(name, "show_text") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->show_text));
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void progress_bar_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_progress_bar_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_progress_bar_t_get_prop},
{"__newindex", wrap_progress_bar_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.progress_bar_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "ProgressBar", static_funcs, 0);
lua_settop(L, 0);
}
static const struct luaL_Reg point_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_point_t_set_prop(lua_State* L) {
point_t* obj = (point_t*)tk_checkudata(L, 1, "point_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "x") == 0) {
printf("x is readonly\n");
return 0;
}
else if(strcmp(name, "y") == 0) {
printf("y is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_point_t_get_prop(lua_State* L) {
point_t* obj = (point_t*)tk_checkudata(L, 1, "point_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(point_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "x") == 0) {
lua_pushnumber(L,(lua_Number)(obj->x));
return 1;
}
else if(strcmp(name, "y") == 0) {
lua_pushnumber(L,(lua_Number)(obj->y));
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void point_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_point_t_get_prop},
{"__newindex", wrap_point_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.point_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Point", static_funcs, 0);
lua_settop(L, 0);
}
static const struct luaL_Reg rect_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_rect_t_set_prop(lua_State* L) {
rect_t* obj = (rect_t*)tk_checkudata(L, 1, "rect_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "x") == 0) {
printf("x is readonly\n");
return 0;
}
else if(strcmp(name, "y") == 0) {
printf("y is readonly\n");
return 0;
}
else if(strcmp(name, "w") == 0) {
printf("w is readonly\n");
return 0;
}
else if(strcmp(name, "h") == 0) {
printf("h is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_rect_t_get_prop(lua_State* L) {
rect_t* obj = (rect_t*)tk_checkudata(L, 1, "rect_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(rect_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "x") == 0) {
lua_pushnumber(L,(lua_Number)(obj->x));
return 1;
}
else if(strcmp(name, "y") == 0) {
lua_pushnumber(L,(lua_Number)(obj->y));
return 1;
}
else if(strcmp(name, "w") == 0) {
lua_pushnumber(L,(lua_Number)(obj->w));
return 1;
}
else if(strcmp(name, "h") == 0) {
lua_pushnumber(L,(lua_Number)(obj->h));
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void rect_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_rect_t_get_prop},
{"__newindex", wrap_rect_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.rect_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Rect", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_slide_view_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)slide_view_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/slide_view_t/widget_t", "awtk.slide_view_t");
}
static int wrap_slide_view_set_auto_play(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint16_t auto_play = (uint16_t)luaL_checkinteger(L, 2);
ret = (ret_t)slide_view_set_auto_play(widget, auto_play);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slide_view_set_active(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t index = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)slide_view_set_active(widget, index);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slide_view_set_vertical(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t vertical = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)slide_view_set_vertical(widget, vertical);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg slide_view_t_member_funcs[] = {
{"set_auto_play", wrap_slide_view_set_auto_play},
{"set_active", wrap_slide_view_set_active},
{"set_vertical", wrap_slide_view_set_vertical},
{NULL, NULL}
};
static int wrap_slide_view_t_set_prop(lua_State* L) {
slide_view_t* obj = (slide_view_t*)tk_checkudata(L, 1, "slide_view_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "vertical") == 0) {
printf("vertical is readonly\n");
return 0;
}
else if(strcmp(name, "auto_play") == 0) {
printf("auto_play is readonly\n");
return 0;
}
else {
return wrap_widget_t_set_prop(L);
}
}
static int wrap_slide_view_t_get_prop(lua_State* L) {
slide_view_t* obj = (slide_view_t*)tk_checkudata(L, 1, "slide_view_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(slide_view_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "vertical") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->vertical));
return 1;
}
else if(strcmp(name, "auto_play") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->auto_play));
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void slide_view_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_slide_view_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_slide_view_t_get_prop},
{"__newindex", wrap_slide_view_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.slide_view_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "SlideView", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_slider_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)slider_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/slider_t/widget_t", "awtk.slider_t");
}
static int wrap_slider_set_value(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint16_t value = (uint16_t)luaL_checkinteger(L, 2);
ret = (ret_t)slider_set_value(widget, value);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slider_set_min(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint16_t min = (uint16_t)luaL_checkinteger(L, 2);
ret = (ret_t)slider_set_min(widget, min);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slider_set_max(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint16_t max = (uint16_t)luaL_checkinteger(L, 2);
ret = (ret_t)slider_set_max(widget, max);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slider_set_step(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint16_t step = (uint16_t)luaL_checkinteger(L, 2);
ret = (ret_t)slider_set_step(widget, step);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_slider_set_vertical(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t vertical = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)slider_set_vertical(widget, vertical);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg slider_t_member_funcs[] = {
{"set_value", wrap_slider_set_value},
{"set_min", wrap_slider_set_min},
{"set_max", wrap_slider_set_max},
{"set_step", wrap_slider_set_step},
{"set_vertical", wrap_slider_set_vertical},
{NULL, NULL}
};
static int wrap_slider_t_set_prop(lua_State* L) {
slider_t* obj = (slider_t*)tk_checkudata(L, 1, "slider_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "value") == 0) {
printf("value is readonly\n");
return 0;
}
else if(strcmp(name, "min") == 0) {
printf("min is readonly\n");
return 0;
}
else if(strcmp(name, "max") == 0) {
printf("max is readonly\n");
return 0;
}
else if(strcmp(name, "step") == 0) {
printf("step is readonly\n");
return 0;
}
else if(strcmp(name, "vertical") == 0) {
printf("vertical is readonly\n");
return 0;
}
else {
return wrap_widget_t_set_prop(L);
}
}
static int wrap_slider_t_get_prop(lua_State* L) {
slider_t* obj = (slider_t*)tk_checkudata(L, 1, "slider_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(slider_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "value") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->value));
return 1;
}
else if(strcmp(name, "min") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->min));
return 1;
}
else if(strcmp(name, "max") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->max));
return 1;
}
else if(strcmp(name, "step") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->step));
return 1;
}
else if(strcmp(name, "vertical") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->vertical));
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void slider_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_slider_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_slider_t_get_prop},
{"__newindex", wrap_slider_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.slider_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Slider", static_funcs, 0);
lua_settop(L, 0);
}
static void align_v_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "AlignV");
lua_getglobal(L, "AlignV");
lua_pushstring(L, "NONE");
lua_pushinteger(L, ALIGN_V_NONE);
lua_settable(L, -3);
lua_pushstring(L, "MIDDLE");
lua_pushinteger(L, ALIGN_V_MIDDLE);
lua_settable(L, -3);
lua_pushstring(L, "TOP");
lua_pushinteger(L, ALIGN_V_TOP);
lua_settable(L, -3);
lua_pushstring(L, "BOTTOM");
lua_pushinteger(L, ALIGN_V_BOTTOM);
lua_settable(L, -3);
}
static void align_h_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "AlignH");
lua_getglobal(L, "AlignH");
lua_pushstring(L, "NONE");
lua_pushinteger(L, ALIGN_H_NONE);
lua_settable(L, -3);
lua_pushstring(L, "CENTER");
lua_pushinteger(L, ALIGN_H_CENTER);
lua_settable(L, -3);
lua_pushstring(L, "LEFT");
lua_pushinteger(L, ALIGN_H_LEFT);
lua_settable(L, -3);
lua_pushstring(L, "RIGHT");
lua_pushinteger(L, ALIGN_H_RIGHT);
lua_settable(L, -3);
}
static int wrap_timer_count(lua_State* L) {
uint32_t ret = 0;
ret = (uint32_t)timer_count();
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_timer_next_time(lua_State* L) {
uint32_t ret = 0;
ret = (uint32_t)timer_next_time();
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_timer_now(lua_State* L) {
uint32_t ret = 0;
ret = (uint32_t)timer_now();
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static void timer_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"add", wrap_timer_add},
{"remove", wrap_timer_remove},
{"count", wrap_timer_count},
{"next_time", wrap_timer_next_time},
{"now", wrap_timer_now},
{NULL, NULL}
};
luaL_openlib(L, "Timer", static_funcs, 0);
lua_settop(L, 0);
}
static void ret_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "Ret");
lua_getglobal(L, "Ret");
lua_pushstring(L, "OK");
lua_pushinteger(L, RET_OK);
lua_settable(L, -3);
lua_pushstring(L, "OOM");
lua_pushinteger(L, RET_OOM);
lua_settable(L, -3);
lua_pushstring(L, "FAIL");
lua_pushinteger(L, RET_FAIL);
lua_settable(L, -3);
lua_pushstring(L, "NOT_IMPL");
lua_pushinteger(L, RET_NOT_IMPL);
lua_settable(L, -3);
lua_pushstring(L, "QUIT");
lua_pushinteger(L, RET_QUIT);
lua_settable(L, -3);
lua_pushstring(L, "FOUND");
lua_pushinteger(L, RET_FOUND);
lua_settable(L, -3);
lua_pushstring(L, "REMOVE");
lua_pushinteger(L, RET_REMOVE);
lua_settable(L, -3);
lua_pushstring(L, "REPEAT");
lua_pushinteger(L, RET_REPEAT);
lua_settable(L, -3);
lua_pushstring(L, "NOT_FOUND");
lua_pushinteger(L, RET_NOT_FOUND);
lua_settable(L, -3);
lua_pushstring(L, "DONE");
lua_pushinteger(L, RET_DONE);
lua_settable(L, -3);
lua_pushstring(L, "STOP");
lua_pushinteger(L, RET_STOP);
lua_settable(L, -3);
lua_pushstring(L, "BAD_PARAMS");
lua_pushinteger(L, RET_BAD_PARAMS);
lua_settable(L, -3);
}
static void value_type_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "ValueType");
lua_getglobal(L, "ValueType");
lua_pushstring(L, "INVALID");
lua_pushinteger(L, VALUE_TYPE_INVALID);
lua_settable(L, -3);
lua_pushstring(L, "BOOL");
lua_pushinteger(L, VALUE_TYPE_BOOL);
lua_settable(L, -3);
lua_pushstring(L, "INT8");
lua_pushinteger(L, VALUE_TYPE_INT8);
lua_settable(L, -3);
lua_pushstring(L, "UINT8");
lua_pushinteger(L, VALUE_TYPE_UINT8);
lua_settable(L, -3);
lua_pushstring(L, "INT16");
lua_pushinteger(L, VALUE_TYPE_INT16);
lua_settable(L, -3);
lua_pushstring(L, "UINT16");
lua_pushinteger(L, VALUE_TYPE_UINT16);
lua_settable(L, -3);
lua_pushstring(L, "INT32");
lua_pushinteger(L, VALUE_TYPE_INT32);
lua_settable(L, -3);
lua_pushstring(L, "UINT32");
lua_pushinteger(L, VALUE_TYPE_UINT32);
lua_settable(L, -3);
lua_pushstring(L, "INT64");
lua_pushinteger(L, VALUE_TYPE_INT64);
lua_settable(L, -3);
lua_pushstring(L, "UINT64");
lua_pushinteger(L, VALUE_TYPE_UINT64);
lua_settable(L, -3);
lua_pushstring(L, "POINTER");
lua_pushinteger(L, VALUE_TYPE_POINTER);
lua_settable(L, -3);
lua_pushstring(L, "FLOAT");
lua_pushinteger(L, VALUE_TYPE_FLOAT);
lua_settable(L, -3);
lua_pushstring(L, "DOUBLE");
lua_pushinteger(L, VALUE_TYPE_DOUBLE);
lua_settable(L, -3);
lua_pushstring(L, "STRING");
lua_pushinteger(L, VALUE_TYPE_STRING);
lua_settable(L, -3);
lua_pushstring(L, "WSTRING");
lua_pushinteger(L, VALUE_TYPE_WSTRING);
lua_settable(L, -3);
}
static int wrap_value_set_bool(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
bool_t value = (bool_t)lua_toboolean(L, 2);
ret = (value_t*)value_set_bool(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_bool(lua_State* L) {
bool_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (bool_t)value_bool(v);
lua_pushboolean(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_int8(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
int8_t value = (int8_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_int8(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_int8(lua_State* L) {
int8_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int8_t)value_int8(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_uint8(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
uint8_t value = (uint8_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_uint8(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_uint8(lua_State* L) {
int8_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int8_t)value_uint8(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_int16(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
int16_t value = (int16_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_int16(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_int16(lua_State* L) {
int16_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int16_t)value_int16(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_uint16(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
uint16_t value = (uint16_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_uint16(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_uint16(lua_State* L) {
uint16_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (uint16_t)value_uint16(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_int32(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
int32_t value = (int32_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_int32(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_int32(lua_State* L) {
int32_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int32_t)value_int32(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_uint32(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
uint32_t value = (uint32_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_uint32(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_uint32(lua_State* L) {
uint32_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (uint32_t)value_uint32(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_int64(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
int64_t value = (int64_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_int64(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_int64(lua_State* L) {
int64_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int64_t)value_int64(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_uint64(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
uint64_t value = (uint64_t)luaL_checkinteger(L, 2);
ret = (value_t*)value_set_uint64(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_uint64(lua_State* L) {
uint64_t ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (uint64_t)value_uint64(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_set_float(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
float value = (float)luaL_checknumber(L, 2);
ret = (value_t*)value_set_float(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_float(lua_State* L) {
float ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (float)value_float(v);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_value_set_double(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
double value = (double)luaL_checknumber(L, 2);
ret = (value_t*)value_set_double(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_double(lua_State* L) {
double ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (double)value_double(v);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_value_set_str(lua_State* L) {
value_t* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
char* value = (char*)luaL_checkstring(L, 2);
ret = (value_t*)value_set_str(v, value);
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_str(lua_State* L) {
const char* ret = NULL;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (const char*)value_str(v);
lua_pushstring(L,(char*)(ret));
return 1;
}
static int wrap_value_is_null(lua_State* L) {
bool_t ret = 0;
value_t* value = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (bool_t)value_is_null(value);
lua_pushboolean(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_int(lua_State* L) {
int ret = 0;
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
ret = (int)value_int(v);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_value_copy(lua_State* L) {
value_t* dst = (value_t*)tk_checkudata(L, 1, "value_t");
value_t* src = (value_t*)tk_checkudata(L, 2, "value_t");
(void)value_copy(dst, src);
return 0;
}
static int wrap_value_create(lua_State* L) {
value_t* ret = NULL;
ret = (value_t*)value_create();
return tk_newuserdata(L, ret, "/value_t", "awtk.value_t");
}
static int wrap_value_destroy(lua_State* L) {
value_t* v = (value_t*)tk_checkudata(L, 1, "value_t");
(void)value_destroy(v);
return 0;
}
static const struct luaL_Reg value_t_member_funcs[] = {
{"set_bool", wrap_value_set_bool},
{"bool", wrap_value_bool},
{"set_int8", wrap_value_set_int8},
{"int8", wrap_value_int8},
{"set_uint8", wrap_value_set_uint8},
{"uint8", wrap_value_uint8},
{"set_int16", wrap_value_set_int16},
{"int16", wrap_value_int16},
{"set_uint16", wrap_value_set_uint16},
{"uint16", wrap_value_uint16},
{"set_int32", wrap_value_set_int32},
{"int32", wrap_value_int32},
{"set_uint32", wrap_value_set_uint32},
{"uint32", wrap_value_uint32},
{"set_int64", wrap_value_set_int64},
{"int64", wrap_value_int64},
{"set_uint64", wrap_value_set_uint64},
{"uint64", wrap_value_uint64},
{"set_float", wrap_value_set_float},
{"float", wrap_value_float},
{"set_double", wrap_value_set_double},
{"double", wrap_value_double},
{"set_str", wrap_value_set_str},
{"str", wrap_value_str},
{"is_null", wrap_value_is_null},
{"int", wrap_value_int},
{"copy", wrap_value_copy},
{"destroy", wrap_value_destroy},
{NULL, NULL}
};
static int wrap_value_t_set_prop(lua_State* L) {
value_t* obj = (value_t*)tk_checkudata(L, 1, "value_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "type") == 0) {
printf("type is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_value_t_get_prop(lua_State* L) {
value_t* obj = (value_t*)tk_checkudata(L, 1, "value_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(value_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "type") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->type));
return 1;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void value_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_value_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_value_t_get_prop},
{"__newindex", wrap_value_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.value_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Value", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_view_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)view_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/view_t/widget_t", "awtk.view_t");
}
static const struct luaL_Reg view_t_member_funcs[] = {
{NULL, NULL}
};
static int wrap_view_t_set_prop(lua_State* L) {
view_t* obj = (view_t*)tk_checkudata(L, 1, "view_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_view_t_get_prop(lua_State* L) {
view_t* obj = (view_t*)tk_checkudata(L, 1, "view_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(view_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void view_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_view_create},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_view_t_get_prop},
{"__newindex", wrap_view_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.view_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "View", static_funcs, 0);
lua_settop(L, 0);
}
static void widget_state_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "WidgetState");
lua_getglobal(L, "WidgetState");
lua_pushstring(L, "STATE_NONE");
lua_pushinteger(L, WIDGET_STATE_NONE);
lua_settable(L, -3);
lua_pushstring(L, "STATE_NORMAL");
lua_pushinteger(L, WIDGET_STATE_NORMAL);
lua_settable(L, -3);
lua_pushstring(L, "STATE_PRESSED");
lua_pushinteger(L, WIDGET_STATE_PRESSED);
lua_settable(L, -3);
lua_pushstring(L, "STATE_OVER");
lua_pushinteger(L, WIDGET_STATE_OVER);
lua_settable(L, -3);
lua_pushstring(L, "STATE_DISABLE");
lua_pushinteger(L, WIDGET_STATE_DISABLE);
lua_settable(L, -3);
lua_pushstring(L, "STATE_FOCUSED");
lua_pushinteger(L, WIDGET_STATE_FOCUSED);
lua_settable(L, -3);
lua_pushstring(L, "STATE_CHECKED");
lua_pushinteger(L, WIDGET_STATE_CHECKED);
lua_settable(L, -3);
lua_pushstring(L, "STATE_UNCHECKED");
lua_pushinteger(L, WIDGET_STATE_UNCHECKED);
lua_settable(L, -3);
lua_pushstring(L, "STATE_EMPTY");
lua_pushinteger(L, WIDGET_STATE_EMPTY);
lua_settable(L, -3);
lua_pushstring(L, "STATE_ERROR");
lua_pushinteger(L, WIDGET_STATE_ERROR);
lua_settable(L, -3);
}
static void widget_type_t_init(lua_State* L) {
lua_newtable(L);
lua_setglobal(L, "WidgetType");
lua_getglobal(L, "WidgetType");
lua_pushstring(L, "WIDGET_NONE");
lua_pushinteger(L, WIDGET_NONE);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_WINDOW_MANAGER");
lua_pushinteger(L, WIDGET_WINDOW_MANAGER);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_NORMAL_WINDOW");
lua_pushinteger(L, WIDGET_NORMAL_WINDOW);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_TOOL_BAR");
lua_pushinteger(L, WIDGET_TOOL_BAR);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_DIALOG");
lua_pushinteger(L, WIDGET_DIALOG);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_POPUP");
lua_pushinteger(L, WIDGET_POPUP);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_SPRITE");
lua_pushinteger(L, WIDGET_SPRITE);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_KEYBOARD");
lua_pushinteger(L, WIDGET_KEYBOARD);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_DRAGGER");
lua_pushinteger(L, WIDGET_DRAGGER);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_LABEL");
lua_pushinteger(L, WIDGET_LABEL);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_BUTTON");
lua_pushinteger(L, WIDGET_BUTTON);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_IMAGE");
lua_pushinteger(L, WIDGET_IMAGE);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_EDIT");
lua_pushinteger(L, WIDGET_EDIT);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_PROGRESS_BAR");
lua_pushinteger(L, WIDGET_PROGRESS_BAR);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_GROUP_BOX");
lua_pushinteger(L, WIDGET_GROUP_BOX);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_CHECK_BUTTON");
lua_pushinteger(L, WIDGET_CHECK_BUTTON);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_RADIO_BUTTON");
lua_pushinteger(L, WIDGET_RADIO_BUTTON);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_DIALOG_TITLE");
lua_pushinteger(L, WIDGET_DIALOG_TITLE);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_DIALOG_CLIENT");
lua_pushinteger(L, WIDGET_DIALOG_CLIENT);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_SLIDER");
lua_pushinteger(L, WIDGET_SLIDER);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_VIEW");
lua_pushinteger(L, WIDGET_VIEW);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_SLIDE_VIEW");
lua_pushinteger(L, WIDGET_SLIDE_VIEW);
lua_settable(L, -3);
lua_pushstring(L, "WIDGET_PAGES");
lua_pushinteger(L, WIDGET_PAGES);
lua_settable(L, -3);
}
static int wrap_widget_count_children(lua_State* L) {
uint32_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (uint32_t)widget_count_children(widget);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_widget_get_child(lua_State* L) {
widget_t* ret = NULL;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t index = (uint32_t)luaL_checkinteger(L, 2);
ret = (widget_t*)widget_get_child(widget, index);
return tk_newuserdata(L, ret, "/widget_t", "awtk.widget_t");
}
static int wrap_widget_move(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
ret = (ret_t)widget_move(widget, x, y);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_resize(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
wh_t w = (wh_t)luaL_checkinteger(L, 2);
wh_t h = (wh_t)luaL_checkinteger(L, 3);
ret = (ret_t)widget_resize(widget, w, h);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_move_resize(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (ret_t)widget_move_resize(widget, x, y, w, h);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_value(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint32_t value = (uint32_t)luaL_checkinteger(L, 2);
ret = (ret_t)widget_set_value(widget, value);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_use_style(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* value = (char*)luaL_checkstring(L, 2);
ret = (ret_t)widget_use_style(widget, value);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_text(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
wchar_t* text = (wchar_t*)lua_touserdata(L, 2);
ret = (ret_t)widget_set_text(widget, text);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_text_utf8(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* text = (char*)luaL_checkstring(L, 2);
ret = (ret_t)widget_set_text_utf8(widget, text);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_tr_text(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* text = (char*)luaL_checkstring(L, 2);
ret = (ret_t)widget_set_tr_text(widget, text);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_re_translate_text(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)widget_re_translate_text(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_get_value(lua_State* L) {
uint32_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (uint32_t)widget_get_value(widget);
lua_pushinteger(L,(lua_Integer)(ret));
return 1;
}
static int wrap_widget_get_text(lua_State* L) {
wchar_t* ret = NULL;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (wchar_t*)widget_get_text(widget);
lua_pushlightuserdata(L,(void*)(ret));
return 1;
}
static int wrap_widget_to_local(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
point_t* p = (point_t*)tk_checkudata(L, 2, "point_t");
ret = (ret_t)widget_to_local(widget, p);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_to_global(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
point_t* p = (point_t*)tk_checkudata(L, 2, "point_t");
ret = (ret_t)widget_to_global(widget, p);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_name(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
ret = (ret_t)widget_set_name(widget, name);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_enable(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t enable = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)widget_set_enable(widget, enable);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_focused(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t focused = (bool_t)lua_toboolean(L, 2);
ret = (ret_t)widget_set_focused(widget, focused);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_state(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
widget_state_t state = (widget_state_t)luaL_checkinteger(L, 2);
ret = (ret_t)widget_set_state(widget, state);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_opacity(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
uint8_t opacity = (uint8_t)luaL_checkinteger(L, 2);
ret = (ret_t)widget_set_opacity(widget, opacity);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_rotation(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
float_t rotation = (float_t)luaL_checknumber(L, 2);
ret = (ret_t)widget_set_rotation(widget, rotation);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_scale(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
float_t scale_x = (float_t)luaL_checknumber(L, 2);
float_t scale_y = (float_t)luaL_checknumber(L, 3);
ret = (ret_t)widget_set_scale(widget, scale_x, scale_y);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_anchor(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
float_t anchor_x = (float_t)luaL_checknumber(L, 2);
float_t anchor_y = (float_t)luaL_checknumber(L, 3);
ret = (ret_t)widget_set_anchor(widget, anchor_x, anchor_y);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_destroy_children(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)widget_destroy_children(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_add_child(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
widget_t* child = (widget_t*)tk_checkudata(L, 2, "widget_t");
ret = (ret_t)widget_add_child(widget, child);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_remove_child(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
widget_t* child = (widget_t*)tk_checkudata(L, 2, "widget_t");
ret = (ret_t)widget_remove_child(widget, child);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_lookup(lua_State* L) {
widget_t* ret = NULL;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
bool_t recursive = (bool_t)lua_toboolean(L, 3);
ret = (widget_t*)widget_lookup(widget, name, recursive);
return tk_newuserdata(L, ret, "/widget_t", "awtk.widget_t");
}
static int wrap_widget_set_visible(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
bool_t visible = (bool_t)lua_toboolean(L, 2);
bool_t recursive = (bool_t)lua_toboolean(L, 3);
ret = (ret_t)widget_set_visible(widget, visible, recursive);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_invalidate(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
rect_t* r = (rect_t*)tk_checkudata(L, 2, "rect_t");
ret = (ret_t)widget_invalidate(widget, r);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_invalidate_force(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)widget_invalidate_force(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_get_prop(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
value_t* v = (value_t*)tk_checkudata(L, 3, "value_t");
ret = (ret_t)widget_get_prop(widget, name, v);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_set_prop(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
char* name = (char*)luaL_checkstring(L, 2);
value_t* v = (value_t*)tk_checkudata(L, 3, "value_t");
ret = (ret_t)widget_set_prop(widget, name, v);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_grab(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
widget_t* child = (widget_t*)tk_checkudata(L, 2, "widget_t");
ret = (ret_t)widget_grab(widget, child);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_ungrab(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
widget_t* child = (widget_t*)tk_checkudata(L, 2, "widget_t");
ret = (ret_t)widget_ungrab(widget, child);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static int wrap_widget_get_window(lua_State* L) {
widget_t* ret = NULL;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (widget_t*)widget_get_window(widget);
return tk_newuserdata(L, ret, "/widget_t", "awtk.widget_t");
}
static int wrap_widget_destroy(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)widget_destroy(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg widget_t_member_funcs[] = {
{"count_children", wrap_widget_count_children},
{"get_child", wrap_widget_get_child},
{"move", wrap_widget_move},
{"resize", wrap_widget_resize},
{"move_resize", wrap_widget_move_resize},
{"set_value", wrap_widget_set_value},
{"use_style", wrap_widget_use_style},
{"set_text", wrap_widget_set_text},
{"set_text_utf8", wrap_widget_set_text_utf8},
{"set_tr_text", wrap_widget_set_tr_text},
{"re_translate_text", wrap_widget_re_translate_text},
{"get_value", wrap_widget_get_value},
{"get_text", wrap_widget_get_text},
{"to_local", wrap_widget_to_local},
{"to_global", wrap_widget_to_global},
{"set_name", wrap_widget_set_name},
{"set_enable", wrap_widget_set_enable},
{"set_focused", wrap_widget_set_focused},
{"set_state", wrap_widget_set_state},
{"set_opacity", wrap_widget_set_opacity},
{"set_rotation", wrap_widget_set_rotation},
{"set_scale", wrap_widget_set_scale},
{"set_anchor", wrap_widget_set_anchor},
{"destroy_children", wrap_widget_destroy_children},
{"add_child", wrap_widget_add_child},
{"remove_child", wrap_widget_remove_child},
{"lookup", wrap_widget_lookup},
{"set_visible", wrap_widget_set_visible},
{"on", wrap_widget_on},
{"off", wrap_widget_off},
{"on", wrap_widget_on},
{"invalidate", wrap_widget_invalidate},
{"invalidate_force", wrap_widget_invalidate_force},
{"get_prop", wrap_widget_get_prop},
{"set_prop", wrap_widget_set_prop},
{"grab", wrap_widget_grab},
{"ungrab", wrap_widget_ungrab},
{"get_window", wrap_widget_get_window},
{"destroy", wrap_widget_destroy},
{NULL, NULL}
};
static int wrap_widget_t_set_prop(lua_State* L) {
widget_t* obj = (widget_t*)tk_checkudata(L, 1, "widget_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
if(strcmp(name, "x") == 0) {
printf("x is readonly\n");
return 0;
}
else if(strcmp(name, "y") == 0) {
printf("y is readonly\n");
return 0;
}
else if(strcmp(name, "w") == 0) {
printf("w is readonly\n");
return 0;
}
else if(strcmp(name, "h") == 0) {
printf("h is readonly\n");
return 0;
}
else if(strcmp(name, "type") == 0) {
printf("type is readonly\n");
return 0;
}
else if(strcmp(name, "style_type") == 0) {
printf("style_type is readonly\n");
return 0;
}
else if(strcmp(name, "state") == 0) {
printf("state is readonly\n");
return 0;
}
else if(strcmp(name, "enable") == 0) {
printf("enable is readonly\n");
return 0;
}
else if(strcmp(name, "visible") == 0) {
printf("visible is readonly\n");
return 0;
}
else if(strcmp(name, "focused") == 0) {
printf("focused is readonly\n");
return 0;
}
else if(strcmp(name, "parent") == 0) {
printf("parent is readonly\n");
return 0;
}
else {
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static int wrap_widget_t_get_prop(lua_State* L) {
widget_t* obj = (widget_t*)tk_checkudata(L, 1, "widget_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(widget_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
if(strcmp(name, "x") == 0) {
lua_pushnumber(L,(lua_Number)(obj->x));
return 1;
}
else if(strcmp(name, "y") == 0) {
lua_pushnumber(L,(lua_Number)(obj->y));
return 1;
}
else if(strcmp(name, "w") == 0) {
lua_pushnumber(L,(lua_Number)(obj->w));
return 1;
}
else if(strcmp(name, "h") == 0) {
lua_pushnumber(L,(lua_Number)(obj->h));
return 1;
}
else if(strcmp(name, "type") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->type));
return 1;
}
else if(strcmp(name, "style_type") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->style_type));
return 1;
}
else if(strcmp(name, "state") == 0) {
lua_pushinteger(L,(lua_Integer)(obj->state));
return 1;
}
else if(strcmp(name, "enable") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->enable));
return 1;
}
else if(strcmp(name, "visible") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->visible));
return 1;
}
else if(strcmp(name, "focused") == 0) {
lua_pushboolean(L,(lua_Integer)(obj->focused));
return 1;
}
else if(strcmp(name, "parent") == 0) {
return tk_newuserdata(L, obj->parent, "/widget_t", "awtk.widget_t");
}
else {
widget_t* child = widget_lookup(obj, name, FALSE);
if(child != NULL) {
return tk_newuserdata(L, child, "/widget_t", "awtk.widget_t");
}
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
}
static void widget_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_widget_t_get_prop},
{"__newindex", wrap_widget_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.widget_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Widget", static_funcs, 0);
lua_settop(L, 0);
}
static int wrap_window_create(lua_State* L) {
widget_t* ret = NULL;
widget_t* parent = (widget_t*)tk_checkudata(L, 1, "widget_t");
xy_t x = (xy_t)luaL_checkinteger(L, 2);
xy_t y = (xy_t)luaL_checkinteger(L, 3);
wh_t w = (wh_t)luaL_checkinteger(L, 4);
wh_t h = (wh_t)luaL_checkinteger(L, 5);
ret = (widget_t*)window_create(parent, x, y, w, h);
return tk_newuserdata(L, ret, "/window_t/widget_t", "awtk.window_t");
}
static int wrap_window_open(lua_State* L) {
widget_t* ret = NULL;
char* name = (char*)luaL_checkstring(L, 1);
ret = (widget_t*)window_open(name);
return tk_newuserdata(L, ret, "/window_t/widget_t", "awtk.window_t");
}
static int wrap_window_close(lua_State* L) {
ret_t ret = 0;
widget_t* widget = (widget_t*)tk_checkudata(L, 1, "widget_t");
ret = (ret_t)window_close(widget);
lua_pushnumber(L,(lua_Number)(ret));
return 1;
}
static const struct luaL_Reg window_t_member_funcs[] = {
{"close", wrap_window_close},
{NULL, NULL}
};
static int wrap_window_t_set_prop(lua_State* L) {
window_t* obj = (window_t*)tk_checkudata(L, 1, "window_t");
const char* name = (const char*)luaL_checkstring(L, 2);
(void)obj;
(void)name;
return wrap_widget_t_set_prop(L);
printf("%s: not supported %s\n", __FUNCTION__, name);
return 0;
}
static int wrap_window_t_get_prop(lua_State* L) {
window_t* obj = (window_t*)tk_checkudata(L, 1, "window_t");
const char* name = (const char*)luaL_checkstring(L, 2);
const luaL_Reg* ret = find_member(window_t_member_funcs, name);
(void)obj;
(void)name;
if(ret) {
lua_pushcfunction(L, ret->func);
return 1;
}
else {
return wrap_widget_t_get_prop(L);
}
}
static void window_t_init(lua_State* L) {
static const struct luaL_Reg static_funcs[] = {
{"create", wrap_window_create},
{"open", wrap_window_open},
{NULL, NULL}
};
static const struct luaL_Reg index_funcs[] = {
{"__index", wrap_window_t_get_prop},
{"__newindex", wrap_window_t_set_prop},
{NULL, NULL}
};
luaL_newmetatable(L, "awtk.window_t");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3);
luaL_openlib(L, NULL, index_funcs, 0);
luaL_openlib(L, "Window", static_funcs, 0);
lua_settop(L, 0);
}
void luaL_openawtk(lua_State* L) {
globals_init(L);
button_t_init(L);
canvas_t_init(L);
check_button_t_init(L);
dialog_t_init(L);
edit_t_init(L);
emitter_t_init(L);
event_type_t_init(L);
event_t_init(L);
pointer_event_t_init(L);
key_event_t_init(L);
paint_event_t_init(L);
group_box_t_init(L);
idle_t_init(L);
image_t_init(L);
input_type_t_init(L);
input_method_t_init(L);
im_commit_event_t_init(L);
im_action_button_info_event_t_init(L);
im_candidates_event_t_init(L);
keyboard_t_init(L);
label_t_init(L);
pages_t_init(L);
progress_bar_t_init(L);
point_t_init(L);
rect_t_init(L);
slide_view_t_init(L);
slider_t_init(L);
align_v_t_init(L);
align_h_t_init(L);
timer_t_init(L);
ret_t_init(L);
value_type_t_init(L);
value_t_init(L);
view_t_init(L);
widget_state_t_init(L);
widget_type_t_init(L);
widget_t_init(L);
window_t_init(L);
s_current_L = L;
}