PageRenderTime 26ms CodeModel.GetById 14ms app.highlight 6ms RepoModel.GetById 4ms app.codeStats 0ms

/script_binding/lua/lua_ftk_file_browser.c

http://ftk.googlecode.com/
C | 114 lines | 89 code | 24 blank | 1 comment | 3 complexity | e37953a034c151c74808a22f32d9763d MD5 | raw file
  1/*This file is generated by luagen.*/
  2#include "lua_ftk_file_browser.h"
  3#include "lua_ftk_callbacks.h"
  4
  5static void tolua_reg_types (lua_State* L)
  6{
  7	tolua_usertype(L, "FtkFileBrowser");
  8}
  9
 10static int lua_ftk_file_browser_create(lua_State* L)
 11{
 12	tolua_Error err = {0};
 13	FtkFileBrowser* retv;
 14	int type;
 15	int param_ok = tolua_isnumber(L, 1, 0, &err);
 16
 17	return_val_if_fail(param_ok, 0);
 18
 19	type = tolua_tonumber(L, 1, 0);
 20	retv = ftk_file_browser_create(type);
 21	tolua_pushusertype(L, (FtkFileBrowser*)retv, "FtkFileBrowser");
 22
 23	return 1;
 24}
 25
 26static int lua_ftk_file_browser_set_path(lua_State* L)
 27{
 28	tolua_Error err = {0};
 29	Ret retv;
 30	FtkWidget* thiz;
 31	const char* path;
 32	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 33
 34	return_val_if_fail(param_ok, 0);
 35
 36	thiz = tolua_tousertype(L, 1, 0);
 37	path = tolua_tostring(L, 2, 0);
 38	retv = ftk_file_browser_set_path(thiz, path);
 39	tolua_pushnumber(L, (lua_Number)retv);
 40
 41	return 1;
 42}
 43
 44static int lua_ftk_file_browser_set_filter(lua_State* L)
 45{
 46	tolua_Error err = {0};
 47	Ret retv;
 48	FtkWidget* thiz;
 49	const char* mime_type;
 50	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 51
 52	return_val_if_fail(param_ok, 0);
 53
 54	thiz = tolua_tousertype(L, 1, 0);
 55	mime_type = tolua_tostring(L, 2, 0);
 56	retv = ftk_file_browser_set_filter(thiz, mime_type);
 57	tolua_pushnumber(L, (lua_Number)retv);
 58
 59	return 1;
 60}
 61
 62static int lua_ftk_file_browser_set_choosed_handler(lua_State* L)
 63{
 64	tolua_Error err = {0};
 65	Ret retv;
 66	FtkWidget* thiz;
 67	char* on_choosed;
 68	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 69
 70	return_val_if_fail(param_ok, 0);
 71
 72	thiz = tolua_tousertype(L, 1, 0);
 73	on_choosed = (char*)tolua_tostring(L, 2, 0);
 74	retv = ftk_file_browser_set_choosed_handler(thiz, lua_ftk_file_browser_on_choosed_func, on_choosed);
 75	tolua_pushnumber(L, (lua_Number)retv);
 76
 77	return 1;
 78}
 79
 80static int lua_ftk_file_browser_load(lua_State* L)
 81{
 82	tolua_Error err = {0};
 83	Ret retv;
 84	FtkWidget* thiz;
 85	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 86
 87	return_val_if_fail(param_ok, 0);
 88
 89	thiz = tolua_tousertype(L, 1, 0);
 90	retv = ftk_file_browser_load(thiz);
 91	tolua_pushnumber(L, (lua_Number)retv);
 92
 93	return 1;
 94}
 95
 96int tolua_ftk_file_browser_init(lua_State* L)
 97{
 98	tolua_open(L);
 99	tolua_reg_types(L);
100	tolua_module(L, NULL, 0);
101	tolua_beginmodule(L, NULL);
102	tolua_cclass(L,"FtkFileBrowser", "FtkFileBrowser", "FtkWidget", NULL);
103	tolua_beginmodule(L, "FtkFileBrowser");
104	tolua_function(L, "Create", lua_ftk_file_browser_create);
105	tolua_function(L, "SetPath", lua_ftk_file_browser_set_path);
106	tolua_function(L, "SetFilter", lua_ftk_file_browser_set_filter);
107	tolua_function(L, "SetChoosedHandler", lua_ftk_file_browser_set_choosed_handler);
108	tolua_function(L, "Load", lua_ftk_file_browser_load);
109	tolua_endmodule(L);
110	tolua_endmodule(L);
111
112
113	return 1;
114}