PageRenderTime 31ms CodeModel.GetById 14ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 1ms

/script_binding/lua/lua_ftk_theme.c

http://ftk.googlecode.com/
C | 198 lines | 157 code | 40 blank | 1 comment | 18 complexity | 5dd8b6e77531a146b681d4e9409cf650 MD5 | raw file
  1/*This file is generated by luagen.*/
  2#include "lua_ftk_theme.h"
  3#include "lua_ftk_callbacks.h"
  4
  5static void tolua_reg_types (lua_State* L)
  6{
  7	tolua_usertype(L, "FtkTheme");
  8}
  9
 10static int lua_ftk_theme_create(lua_State* L)
 11{
 12	tolua_Error err = {0};
 13	FtkTheme* retv;
 14	int init_default;
 15	int param_ok = tolua_isnumber(L, 1, 0, &err);
 16
 17	return_val_if_fail(param_ok, 0);
 18
 19	init_default = tolua_tonumber(L, 1, 0);
 20	retv = ftk_theme_create(init_default);
 21	tolua_pushusertype(L, (FtkTheme*)retv, "FtkTheme");
 22
 23	return 1;
 24}
 25
 26static int lua_ftk_theme_parse_file(lua_State* L)
 27{
 28	tolua_Error err = {0};
 29	Ret retv;
 30	FtkTheme* thiz;
 31	const char* filename;
 32	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 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	filename = tolua_tostring(L, 2, 0);
 38	retv = ftk_theme_parse_file(thiz, filename);
 39	tolua_pushnumber(L, (lua_Number)retv);
 40
 41	return 1;
 42}
 43
 44static int lua_ftk_theme_parse_data(lua_State* L)
 45{
 46	tolua_Error err = {0};
 47	Ret retv;
 48	FtkTheme* thiz;
 49	const char* data;
 50	int length;
 51	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);
 52
 53	return_val_if_fail(param_ok, 0);
 54
 55	thiz = tolua_tousertype(L, 1, 0);
 56	data = tolua_tostring(L, 2, 0);
 57	length = tolua_tonumber(L, 3, 0);
 58	retv = ftk_theme_parse_data(thiz, data, length);
 59	tolua_pushnumber(L, (lua_Number)retv);
 60
 61	return 1;
 62}
 63
 64static int lua_ftk_theme_load_image(lua_State* L)
 65{
 66	tolua_Error err = {0};
 67	FtkBitmap* retv;
 68	FtkTheme* thiz;
 69	const char* filename;
 70	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isstring(L, 2, 0, &err);
 71
 72	return_val_if_fail(param_ok, 0);
 73
 74	thiz = tolua_tousertype(L, 1, 0);
 75	filename = tolua_tostring(L, 2, 0);
 76	retv = ftk_theme_load_image(thiz, filename);
 77	tolua_pushusertype(L, (FtkBitmap*)retv, "FtkBitmap");
 78
 79	return 1;
 80}
 81
 82static int lua_ftk_theme_get_bg(lua_State* L)
 83{
 84	tolua_Error err = {0};
 85	FtkBitmap* retv;
 86	FtkTheme* thiz;
 87	FtkWidgetType type;
 88	FtkWidgetState state;
 89	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isusertype(L, 2, "FtkWidgetType", 0, &err) && tolua_isusertype(L, 3, "FtkWidgetState", 0, &err);
 90
 91	return_val_if_fail(param_ok, 0);
 92
 93	thiz = tolua_tousertype(L, 1, 0);
 94	type = *(FtkWidgetType*)tolua_tousertype(L, 2, 0);
 95	state = *(FtkWidgetState*)tolua_tousertype(L, 3, 0);
 96	retv = ftk_theme_get_bg(thiz, type, state);
 97	tolua_pushusertype(L, (FtkBitmap*)retv, "FtkBitmap");
 98
 99	return 1;
100}
101
102static int lua_ftk_theme_get_bg_color(lua_State* L)
103{
104	tolua_Error err = {0};
105	FtkColor retv;
106	FtkTheme* thiz;
107	FtkWidgetType type;
108	FtkWidgetState state;
109	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isusertype(L, 2, "FtkWidgetType", 0, &err) && tolua_isusertype(L, 3, "FtkWidgetState", 0, &err);
110
111	return_val_if_fail(param_ok, 0);
112
113	thiz = tolua_tousertype(L, 1, 0);
114	type = *(FtkWidgetType*)tolua_tousertype(L, 2, 0);
115	state = *(FtkWidgetState*)tolua_tousertype(L, 3, 0);
116	retv = ftk_theme_get_bg_color(thiz, type, state);
117	{FtkColor* copy=malloc(sizeof(FtkColor)); if(copy != NULL) memcpy(copy, &retv, sizeof(FtkColor));tolua_pushusertype_and_takeownership(L, (FtkColor*)copy, "FtkColor");}
118
119	return 1;
120}
121
122static int lua_ftk_theme_get_fg_color(lua_State* L)
123{
124	tolua_Error err = {0};
125	FtkColor retv;
126	FtkTheme* thiz;
127	FtkWidgetType type;
128	FtkWidgetState state;
129	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isusertype(L, 2, "FtkWidgetType", 0, &err) && tolua_isusertype(L, 3, "FtkWidgetState", 0, &err);
130
131	return_val_if_fail(param_ok, 0);
132
133	thiz = tolua_tousertype(L, 1, 0);
134	type = *(FtkWidgetType*)tolua_tousertype(L, 2, 0);
135	state = *(FtkWidgetState*)tolua_tousertype(L, 3, 0);
136	retv = ftk_theme_get_fg_color(thiz, type, state);
137	{FtkColor* copy=malloc(sizeof(FtkColor)); if(copy != NULL) memcpy(copy, &retv, sizeof(FtkColor));tolua_pushusertype_and_takeownership(L, (FtkColor*)copy, "FtkColor");}
138
139	return 1;
140}
141
142static int lua_ftk_theme_get_border_color(lua_State* L)
143{
144	tolua_Error err = {0};
145	FtkColor retv;
146	FtkTheme* thiz;
147	FtkWidgetType type;
148	FtkWidgetState state;
149	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err) && tolua_isusertype(L, 2, "FtkWidgetType", 0, &err) && tolua_isusertype(L, 3, "FtkWidgetState", 0, &err);
150
151	return_val_if_fail(param_ok, 0);
152
153	thiz = tolua_tousertype(L, 1, 0);
154	type = *(FtkWidgetType*)tolua_tousertype(L, 2, 0);
155	state = *(FtkWidgetState*)tolua_tousertype(L, 3, 0);
156	retv = ftk_theme_get_border_color(thiz, type, state);
157	{FtkColor* copy=malloc(sizeof(FtkColor)); if(copy != NULL) memcpy(copy, &retv, sizeof(FtkColor));tolua_pushusertype_and_takeownership(L, (FtkColor*)copy, "FtkColor");}
158
159	return 1;
160}
161
162static int lua_ftk_theme_destroy(lua_State* L)
163{
164	tolua_Error err = {0};
165	FtkTheme* thiz;
166	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err);
167
168	return_val_if_fail(param_ok, 0);
169
170	thiz = tolua_tousertype(L, 1, 0);
171	ftk_theme_destroy(thiz);
172
173	return 1;
174}
175
176int tolua_ftk_theme_init(lua_State* L)
177{
178	tolua_open(L);
179	tolua_reg_types(L);
180	tolua_module(L, NULL, 0);
181	tolua_beginmodule(L, NULL);
182	tolua_cclass(L,"FtkTheme", "FtkTheme", "", NULL);
183	tolua_beginmodule(L, "FtkTheme");
184	tolua_function(L, "Create", lua_ftk_theme_create);
185	tolua_function(L, "ParseFile", lua_ftk_theme_parse_file);
186	tolua_function(L, "ParseData", lua_ftk_theme_parse_data);
187	tolua_function(L, "LoadImage", lua_ftk_theme_load_image);
188	tolua_function(L, "GetBg", lua_ftk_theme_get_bg);
189	tolua_function(L, "GetBgColor", lua_ftk_theme_get_bg_color);
190	tolua_function(L, "GetFgColor", lua_ftk_theme_get_fg_color);
191	tolua_function(L, "GetBorderColor", lua_ftk_theme_get_border_color);
192	tolua_function(L, "Destroy", lua_ftk_theme_destroy);
193	tolua_endmodule(L);
194	tolua_endmodule(L);
195
196
197	return 1;
198}