PageRenderTime 162ms CodeModel.GetById 43ms app.highlight 87ms RepoModel.GetById 17ms app.codeStats 1ms

/script_binding/lua/lua_ftk.c

http://ftk.googlecode.com/
C | 494 lines | 381 code | 112 blank | 1 comment | 9 complexity | 55dac347d777d9040aa47f4d60d6aba3 MD5 | raw file
  1/*This file is generated by luagen.*/
  2#include "lua_ftk.h"
  3#include "lua_ftk_callbacks.h"
  4
  5static void tolua_reg_types (lua_State* L)
  6{
  7	tolua_usertype(L, "Ftk");
  8}
  9
 10static int lua_ftk_default_display(lua_State* L)
 11{
 12	FtkDisplay* retv;
 13	retv = ftk_default_display();
 14	tolua_pushusertype(L, (FtkDisplay*)retv, "FtkDisplay");
 15
 16	return 1;
 17}
 18
 19static int lua_ftk_default_main_loop(lua_State* L)
 20{
 21	FtkMainLoop* retv;
 22	retv = ftk_default_main_loop();
 23	tolua_pushusertype(L, (FtkMainLoop*)retv, "FtkMainLoop");
 24
 25	return 1;
 26}
 27
 28static int lua_ftk_default_log_level(lua_State* L)
 29{
 30	FtkLogLevel retv;
 31	retv = ftk_default_log_level();
 32	{FtkLogLevel* copy=malloc(sizeof(FtkLogLevel)); if(copy != NULL) memcpy(copy, &retv, sizeof(FtkLogLevel));tolua_pushusertype_and_takeownership(L, (FtkLogLevel*)copy, "FtkLogLevel");}
 33
 34	return 1;
 35}
 36
 37static int lua_ftk_default_wnd_manager(lua_State* L)
 38{
 39	FtkWndManager* retv;
 40	retv = ftk_default_wnd_manager();
 41	tolua_pushusertype(L, (FtkWndManager*)retv, "FtkWndManager");
 42
 43	return 1;
 44}
 45
 46static int lua_ftk_default_status_panel(lua_State* L)
 47{
 48	FtkWidget* retv;
 49	retv = ftk_default_status_panel();
 50	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 51
 52	return 1;
 53}
 54
 55static int lua_ftk_default_bitmap_factory(lua_State* L)
 56{
 57	FtkBitmapFactory* retv;
 58	retv = ftk_default_bitmap_factory();
 59	tolua_pushusertype(L, (FtkBitmapFactory*)retv, "FtkBitmapFactory");
 60
 61	return 1;
 62}
 63
 64static int lua_ftk_default_sources_manager(lua_State* L)
 65{
 66	FtkSourcesManager* retv;
 67	retv = ftk_default_sources_manager();
 68	tolua_pushusertype(L, (FtkSourcesManager*)retv, "FtkSourcesManager");
 69
 70	return 1;
 71}
 72
 73static int lua_ftk_shared_canvas(lua_State* L)
 74{
 75	FtkCanvas* retv;
 76	retv = ftk_shared_canvas();
 77	tolua_pushusertype(L, (FtkCanvas*)retv, "FtkCanvas");
 78
 79	return 1;
 80}
 81
 82static int lua_ftk_default_theme(lua_State* L)
 83{
 84	FtkTheme* retv;
 85	retv = ftk_default_theme();
 86	tolua_pushusertype(L, (FtkTheme*)retv, "FtkTheme");
 87
 88	return 1;
 89}
 90
 91static int lua_ftk_primary_source(lua_State* L)
 92{
 93	FtkSource* retv;
 94	retv = ftk_primary_source();
 95	tolua_pushusertype(L, (FtkSource*)retv, "FtkSource");
 96
 97	return 1;
 98}
 99
100static int lua_ftk_default_allocator(lua_State* L)
101{
102	FtkAllocator* retv;
103	retv = ftk_default_allocator();
104	tolua_pushusertype(L, (FtkAllocator*)retv, "FtkAllocator");
105
106	return 1;
107}
108
109static int lua_ftk_default_config(lua_State* L)
110{
111	FtkConfig* retv;
112	retv = ftk_default_config();
113	tolua_pushusertype(L, (FtkConfig*)retv, "FtkConfig");
114
115	return 1;
116}
117
118static int lua_ftk_default_input_method_manager(lua_State* L)
119{
120	FtkInputMethodManager* retv;
121	retv = ftk_default_input_method_manager();
122	tolua_pushusertype(L, (FtkInputMethodManager*)retv, "FtkInputMethodManager");
123
124	return 1;
125}
126
127static int lua_ftk_default_input_method_preeditor(lua_State* L)
128{
129	FtkImPreeditor* retv;
130	retv = ftk_default_input_method_preeditor();
131	tolua_pushusertype(L, (FtkImPreeditor*)retv, "FtkImPreeditor");
132
133	return 1;
134}
135
136static int lua_ftk_set_display(lua_State* L)
137{
138	tolua_Error err = {0};
139	FtkDisplay* display;
140	int param_ok = tolua_isusertype(L, 1, "FtkDisplay", 0, &err);
141
142	return_val_if_fail(param_ok, 0);
143
144	display = tolua_tousertype(L, 1, 0);
145	ftk_set_display(display);
146
147	return 1;
148}
149
150static int lua_ftk_set_main_loop(lua_State* L)
151{
152	tolua_Error err = {0};
153	FtkMainLoop* main_loop;
154	int param_ok = tolua_isusertype(L, 1, "FtkMainLoop", 0, &err);
155
156	return_val_if_fail(param_ok, 0);
157
158	main_loop = tolua_tousertype(L, 1, 0);
159	ftk_set_main_loop(main_loop);
160
161	return 1;
162}
163
164static int lua_ftk_set_log_level(lua_State* L)
165{
166	tolua_Error err = {0};
167	FtkLogLevel level;
168	int param_ok = tolua_isusertype(L, 1, "FtkLogLevel", 0, &err);
169
170	return_val_if_fail(param_ok, 0);
171
172	level = *(FtkLogLevel*)tolua_tousertype(L, 1, 0);
173	ftk_set_log_level(level);
174
175	return 1;
176}
177
178static int lua_ftk_set_status_panel(lua_State* L)
179{
180	tolua_Error err = {0};
181	FtkWidget* status_panel;
182	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
183
184	return_val_if_fail(param_ok, 0);
185
186	status_panel = tolua_tousertype(L, 1, 0);
187	ftk_set_status_panel(status_panel);
188
189	return 1;
190}
191
192static int lua_ftk_set_wnd_manager(lua_State* L)
193{
194	tolua_Error err = {0};
195	FtkWndManager* wnd_manager;
196	int param_ok = tolua_isusertype(L, 1, "FtkWndManager", 0, &err);
197
198	return_val_if_fail(param_ok, 0);
199
200	wnd_manager = tolua_tousertype(L, 1, 0);
201	ftk_set_wnd_manager(wnd_manager);
202
203	return 1;
204}
205
206static int lua_ftk_set_bitmap_factory(lua_State* L)
207{
208	tolua_Error err = {0};
209	FtkBitmapFactory* bitmap_factory;
210	int param_ok = tolua_isusertype(L, 1, "FtkBitmapFactory", 0, &err);
211
212	return_val_if_fail(param_ok, 0);
213
214	bitmap_factory = tolua_tousertype(L, 1, 0);
215	ftk_set_bitmap_factory(bitmap_factory);
216
217	return 1;
218}
219
220static int lua_ftk_set_sources_manager(lua_State* L)
221{
222	tolua_Error err = {0};
223	FtkSourcesManager* sources_manager;
224	int param_ok = tolua_isusertype(L, 1, "FtkSourcesManager", 0, &err);
225
226	return_val_if_fail(param_ok, 0);
227
228	sources_manager = tolua_tousertype(L, 1, 0);
229	ftk_set_sources_manager(sources_manager);
230
231	return 1;
232}
233
234static int lua_ftk_set_shared_canvas(lua_State* L)
235{
236	tolua_Error err = {0};
237	FtkCanvas* canvas;
238	int param_ok = tolua_isusertype(L, 1, "FtkCanvas", 0, &err);
239
240	return_val_if_fail(param_ok, 0);
241
242	canvas = tolua_tousertype(L, 1, 0);
243	ftk_set_shared_canvas(canvas);
244
245	return 1;
246}
247
248static int lua_ftk_set_theme(lua_State* L)
249{
250	tolua_Error err = {0};
251	FtkTheme* theme;
252	int param_ok = tolua_isusertype(L, 1, "FtkTheme", 0, &err);
253
254	return_val_if_fail(param_ok, 0);
255
256	theme = tolua_tousertype(L, 1, 0);
257	ftk_set_theme(theme);
258
259	return 1;
260}
261
262static int lua_ftk_set_config(lua_State* L)
263{
264	tolua_Error err = {0};
265	FtkConfig* config;
266	int param_ok = tolua_isusertype(L, 1, "FtkConfig", 0, &err);
267
268	return_val_if_fail(param_ok, 0);
269
270	config = tolua_tousertype(L, 1, 0);
271	ftk_set_config(config);
272
273	return 1;
274}
275
276static int lua_ftk_set_primary_source(lua_State* L)
277{
278	tolua_Error err = {0};
279	FtkSource* source;
280	int param_ok = tolua_isusertype(L, 1, "FtkSource", 0, &err);
281
282	return_val_if_fail(param_ok, 0);
283
284	source = tolua_tousertype(L, 1, 0);
285	ftk_set_primary_source(source);
286
287	return 1;
288}
289
290static int lua_ftk_set_allocator(lua_State* L)
291{
292	tolua_Error err = {0};
293	FtkAllocator* allocator;
294	int param_ok = tolua_isusertype(L, 1, "FtkAllocator", 0, &err);
295
296	return_val_if_fail(param_ok, 0);
297
298	allocator = tolua_tousertype(L, 1, 0);
299	ftk_set_allocator(allocator);
300
301	return 1;
302}
303
304static int lua_ftk_set_input_method_manager(lua_State* L)
305{
306	tolua_Error err = {0};
307	FtkInputMethodManager* input_manager_manager;
308	int param_ok = tolua_isusertype(L, 1, "FtkInputMethodManager", 0, &err);
309
310	return_val_if_fail(param_ok, 0);
311
312	input_manager_manager = tolua_tousertype(L, 1, 0);
313	ftk_set_input_method_manager(input_manager_manager);
314
315	return 1;
316}
317
318static int lua_ftk_set_input_method_preeditor(lua_State* L)
319{
320	tolua_Error err = {0};
321	FtkImPreeditor* input_method_preeditor;
322	int param_ok = tolua_isusertype(L, 1, "FtkImPreeditor", 0, &err);
323
324	return_val_if_fail(param_ok, 0);
325
326	input_method_preeditor = tolua_tousertype(L, 1, 0);
327	ftk_set_input_method_preeditor(input_method_preeditor);
328
329	return 1;
330}
331
332static int lua_ftk_init(lua_State* L)
333{
334	tolua_Error err = {0};
335	Ret retv;
336	int argc;
337	char** argv;
338	int param_ok = tolua_isnumber(L, 1, 0, &err) && tolua_istable(L, 2, 0, &err);
339
340	return_val_if_fail(param_ok, 0);
341
342	argc = tolua_tonumber(L, 1, 0);
343	argv = (char**)tolua_tostrings(L, 2, 0);
344	retv = ftk_init(argc, argv);
345	tolua_pushnumber(L, (lua_Number)retv);
346	free(argv);
347
348	return 1;
349}
350
351static int lua_ftk_run(lua_State* L)
352{
353	Ret retv;
354	retv = ftk_run();
355	tolua_pushnumber(L, (lua_Number)retv);
356
357	return 1;
358}
359
360static int lua_ftk_quit(lua_State* L)
361{
362	ftk_quit();
363
364	return 1;
365}
366
367static int lua_ftk_tips(lua_State* L)
368{
369	tolua_Error err = {0};
370	int retv;
371	const char* text;
372	int param_ok = tolua_isstring(L, 1, 0, &err);
373
374	return_val_if_fail(param_ok, 0);
375
376	text = tolua_tostring(L, 1, 0);
377	retv = ftk_tips(text);
378	tolua_pushnumber(L, (lua_Number)retv);
379
380	return 1;
381}
382
383static int lua_ftk_warning(lua_State* L)
384{
385	tolua_Error err = {0};
386	int retv;
387	const char* title;
388	const char* text;
389	const char** buttons;
390	int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_istable(L, 3, 0, &err);
391
392	return_val_if_fail(param_ok, 0);
393
394	title = tolua_tostring(L, 1, 0);
395	text = tolua_tostring(L, 2, 0);
396	buttons = tolua_tostrings(L, 3, 0);
397	retv = ftk_warning(title, text, buttons);
398	tolua_pushnumber(L, (lua_Number)retv);
399	free(buttons);
400
401	return 1;
402}
403
404static int lua_ftk_question(lua_State* L)
405{
406	tolua_Error err = {0};
407	int retv;
408	const char* title;
409	const char* text;
410	const char** buttons;
411	int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_istable(L, 3, 0, &err);
412
413	return_val_if_fail(param_ok, 0);
414
415	title = tolua_tostring(L, 1, 0);
416	text = tolua_tostring(L, 2, 0);
417	buttons = tolua_tostrings(L, 3, 0);
418	retv = ftk_question(title, text, buttons);
419	tolua_pushnumber(L, (lua_Number)retv);
420	free(buttons);
421
422	return 1;
423}
424
425static int lua_ftk_infomation(lua_State* L)
426{
427	tolua_Error err = {0};
428	int retv;
429	const char* title;
430	const char* text;
431	const char** buttons;
432	int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_istable(L, 3, 0, &err);
433
434	return_val_if_fail(param_ok, 0);
435
436	title = tolua_tostring(L, 1, 0);
437	text = tolua_tostring(L, 2, 0);
438	buttons = tolua_tostrings(L, 3, 0);
439	retv = ftk_infomation(title, text, buttons);
440	tolua_pushnumber(L, (lua_Number)retv);
441	free(buttons);
442
443	return 1;
444}
445
446int tolua_ftk_init(lua_State* L)
447{
448	tolua_open(L);
449	tolua_reg_types(L);
450	tolua_module(L, NULL, 0);
451	tolua_beginmodule(L, NULL);
452	tolua_cclass(L,"Ftk", "Ftk", "", NULL);
453	tolua_beginmodule(L, "Ftk");
454	tolua_function(L, "DefaultDisplay", lua_ftk_default_display);
455	tolua_function(L, "DefaultMainLoop", lua_ftk_default_main_loop);
456	tolua_function(L, "DefaultLogLevel", lua_ftk_default_log_level);
457	tolua_function(L, "DefaultWndManager", lua_ftk_default_wnd_manager);
458	tolua_function(L, "DefaultStatusPanel", lua_ftk_default_status_panel);
459	tolua_function(L, "DefaultBitmapFactory", lua_ftk_default_bitmap_factory);
460	tolua_function(L, "DefaultSourcesManager", lua_ftk_default_sources_manager);
461	tolua_function(L, "SharedCanvas", lua_ftk_shared_canvas);
462	tolua_function(L, "DefaultTheme", lua_ftk_default_theme);
463	tolua_function(L, "PrimarySource", lua_ftk_primary_source);
464	tolua_function(L, "DefaultAllocator", lua_ftk_default_allocator);
465	tolua_function(L, "DefaultConfig", lua_ftk_default_config);
466	tolua_function(L, "DefaultInputMethodManager", lua_ftk_default_input_method_manager);
467	tolua_function(L, "DefaultInputMethodPreeditor", lua_ftk_default_input_method_preeditor);
468	tolua_function(L, "SetDisplay", lua_ftk_set_display);
469	tolua_function(L, "SetMainLoop", lua_ftk_set_main_loop);
470	tolua_function(L, "SetLogLevel", lua_ftk_set_log_level);
471	tolua_function(L, "SetStatusPanel", lua_ftk_set_status_panel);
472	tolua_function(L, "SetWndManager", lua_ftk_set_wnd_manager);
473	tolua_function(L, "SetBitmapFactory", lua_ftk_set_bitmap_factory);
474	tolua_function(L, "SetSourcesManager", lua_ftk_set_sources_manager);
475	tolua_function(L, "SetSharedCanvas", lua_ftk_set_shared_canvas);
476	tolua_function(L, "SetTheme", lua_ftk_set_theme);
477	tolua_function(L, "SetConfig", lua_ftk_set_config);
478	tolua_function(L, "SetPrimarySource", lua_ftk_set_primary_source);
479	tolua_function(L, "SetAllocator", lua_ftk_set_allocator);
480	tolua_function(L, "SetInputMethodManager", lua_ftk_set_input_method_manager);
481	tolua_function(L, "SetInputMethodPreeditor", lua_ftk_set_input_method_preeditor);
482	tolua_function(L, "Init", lua_ftk_init);
483	tolua_function(L, "Run", lua_ftk_run);
484	tolua_function(L, "Quit", lua_ftk_quit);
485	tolua_function(L, "Tips", lua_ftk_tips);
486	tolua_function(L, "Warning", lua_ftk_warning);
487	tolua_function(L, "Question", lua_ftk_question);
488	tolua_function(L, "Infomation", lua_ftk_infomation);
489	tolua_endmodule(L);
490	tolua_endmodule(L);
491
492
493	return 1;
494}