PageRenderTime 1112ms CodeModel.GetById 118ms app.highlight 713ms RepoModel.GetById 180ms app.codeStats 0ms

/script_binding/lua/lua_ftk_widget.c

http://ftk.googlecode.com/
C | 1093 lines | 840 code | 252 blank | 1 comment | 39 complexity | b6cd33d08b47a33a4e4c902597fbf581 MD5 | raw file
   1/*This file is generated by luagen.*/
   2#include "lua_ftk_widget.h"
   3#include "lua_ftk_callbacks.h"
   4
   5static void tolua_reg_types (lua_State* L)
   6{
   7	tolua_usertype(L, "FtkWidget");
   8}
   9
  10static int lua_ftk_widget_type(lua_State* L)
  11{
  12	tolua_Error err = {0};
  13	int retv;
  14	FtkWidget* thiz;
  15	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  16
  17	return_val_if_fail(param_ok, 0);
  18
  19	thiz = tolua_tousertype(L, 1, 0);
  20	retv = ftk_widget_type(thiz);
  21	tolua_pushnumber(L, (lua_Number)retv);
  22
  23	return 1;
  24}
  25
  26static int lua_ftk_widget_top(lua_State* L)
  27{
  28	tolua_Error err = {0};
  29	int retv;
  30	FtkWidget* thiz;
  31	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  32
  33	return_val_if_fail(param_ok, 0);
  34
  35	thiz = tolua_tousertype(L, 1, 0);
  36	retv = ftk_widget_top(thiz);
  37	tolua_pushnumber(L, (lua_Number)retv);
  38
  39	return 1;
  40}
  41
  42static int lua_ftk_widget_left(lua_State* L)
  43{
  44	tolua_Error err = {0};
  45	int retv;
  46	FtkWidget* thiz;
  47	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  48
  49	return_val_if_fail(param_ok, 0);
  50
  51	thiz = tolua_tousertype(L, 1, 0);
  52	retv = ftk_widget_left(thiz);
  53	tolua_pushnumber(L, (lua_Number)retv);
  54
  55	return 1;
  56}
  57
  58static int lua_ftk_widget_top_abs(lua_State* L)
  59{
  60	tolua_Error err = {0};
  61	int retv;
  62	FtkWidget* thiz;
  63	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  64
  65	return_val_if_fail(param_ok, 0);
  66
  67	thiz = tolua_tousertype(L, 1, 0);
  68	retv = ftk_widget_top_abs(thiz);
  69	tolua_pushnumber(L, (lua_Number)retv);
  70
  71	return 1;
  72}
  73
  74static int lua_ftk_widget_left_abs(lua_State* L)
  75{
  76	tolua_Error err = {0};
  77	int retv;
  78	FtkWidget* thiz;
  79	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  80
  81	return_val_if_fail(param_ok, 0);
  82
  83	thiz = tolua_tousertype(L, 1, 0);
  84	retv = ftk_widget_left_abs(thiz);
  85	tolua_pushnumber(L, (lua_Number)retv);
  86
  87	return 1;
  88}
  89
  90static int lua_ftk_widget_top_in_window(lua_State* L)
  91{
  92	tolua_Error err = {0};
  93	int retv;
  94	FtkWidget* thiz;
  95	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
  96
  97	return_val_if_fail(param_ok, 0);
  98
  99	thiz = tolua_tousertype(L, 1, 0);
 100	retv = ftk_widget_top_in_window(thiz);
 101	tolua_pushnumber(L, (lua_Number)retv);
 102
 103	return 1;
 104}
 105
 106static int lua_ftk_widget_left_in_window(lua_State* L)
 107{
 108	tolua_Error err = {0};
 109	int retv;
 110	FtkWidget* thiz;
 111	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 112
 113	return_val_if_fail(param_ok, 0);
 114
 115	thiz = tolua_tousertype(L, 1, 0);
 116	retv = ftk_widget_left_in_window(thiz);
 117	tolua_pushnumber(L, (lua_Number)retv);
 118
 119	return 1;
 120}
 121
 122static int lua_ftk_widget_width(lua_State* L)
 123{
 124	tolua_Error err = {0};
 125	int retv;
 126	FtkWidget* thiz;
 127	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 128
 129	return_val_if_fail(param_ok, 0);
 130
 131	thiz = tolua_tousertype(L, 1, 0);
 132	retv = ftk_widget_width(thiz);
 133	tolua_pushnumber(L, (lua_Number)retv);
 134
 135	return 1;
 136}
 137
 138static int lua_ftk_widget_height(lua_State* L)
 139{
 140	tolua_Error err = {0};
 141	int retv;
 142	FtkWidget* thiz;
 143	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 144
 145	return_val_if_fail(param_ok, 0);
 146
 147	thiz = tolua_tousertype(L, 1, 0);
 148	retv = ftk_widget_height(thiz);
 149	tolua_pushnumber(L, (lua_Number)retv);
 150
 151	return 1;
 152}
 153
 154static int lua_ftk_widget_is_insensitive(lua_State* L)
 155{
 156	tolua_Error err = {0};
 157	int retv;
 158	FtkWidget* thiz;
 159	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 160
 161	return_val_if_fail(param_ok, 0);
 162
 163	thiz = tolua_tousertype(L, 1, 0);
 164	retv = ftk_widget_is_insensitive(thiz);
 165	tolua_pushnumber(L, (lua_Number)retv);
 166
 167	return 1;
 168}
 169
 170static int lua_ftk_widget_is_visible(lua_State* L)
 171{
 172	tolua_Error err = {0};
 173	int retv;
 174	FtkWidget* thiz;
 175	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 176
 177	return_val_if_fail(param_ok, 0);
 178
 179	thiz = tolua_tousertype(L, 1, 0);
 180	retv = ftk_widget_is_visible(thiz);
 181	tolua_pushnumber(L, (lua_Number)retv);
 182
 183	return 1;
 184}
 185
 186static int lua_ftk_widget_is_focused(lua_State* L)
 187{
 188	tolua_Error err = {0};
 189	int retv;
 190	FtkWidget* thiz;
 191	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 192
 193	return_val_if_fail(param_ok, 0);
 194
 195	thiz = tolua_tousertype(L, 1, 0);
 196	retv = ftk_widget_is_focused(thiz);
 197	tolua_pushnumber(L, (lua_Number)retv);
 198
 199	return 1;
 200}
 201
 202static int lua_ftk_widget_is_active(lua_State* L)
 203{
 204	tolua_Error err = {0};
 205	int retv;
 206	FtkWidget* thiz;
 207	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 208
 209	return_val_if_fail(param_ok, 0);
 210
 211	thiz = tolua_tousertype(L, 1, 0);
 212	retv = ftk_widget_is_active(thiz);
 213	tolua_pushnumber(L, (lua_Number)retv);
 214
 215	return 1;
 216}
 217
 218static int lua_ftk_widget_id(lua_State* L)
 219{
 220	tolua_Error err = {0};
 221	int retv;
 222	FtkWidget* thiz;
 223	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 224
 225	return_val_if_fail(param_ok, 0);
 226
 227	thiz = tolua_tousertype(L, 1, 0);
 228	retv = ftk_widget_id(thiz);
 229	tolua_pushnumber(L, (lua_Number)retv);
 230
 231	return 1;
 232}
 233
 234static int lua_ftk_widget_update(lua_State* L)
 235{
 236	tolua_Error err = {0};
 237	Ret retv;
 238	FtkWidget* thiz;
 239	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 240
 241	return_val_if_fail(param_ok, 0);
 242
 243	thiz = tolua_tousertype(L, 1, 0);
 244	retv = ftk_widget_update(thiz);
 245	tolua_pushnumber(L, (lua_Number)retv);
 246
 247	return 1;
 248}
 249
 250static int lua_ftk_widget_get_gc(lua_State* L)
 251{
 252	tolua_Error err = {0};
 253	FtkGc* retv;
 254	FtkWidget* thiz;
 255	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 256
 257	return_val_if_fail(param_ok, 0);
 258
 259	thiz = tolua_tousertype(L, 1, 0);
 260	retv = ftk_widget_get_gc(thiz);
 261	tolua_pushusertype(L, (FtkGc*)retv, "FtkGc");
 262
 263	return 1;
 264}
 265
 266static int lua_ftk_widget_canvas(lua_State* L)
 267{
 268	tolua_Error err = {0};
 269	FtkCanvas* retv;
 270	FtkWidget* thiz;
 271	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 272
 273	return_val_if_fail(param_ok, 0);
 274
 275	thiz = tolua_tousertype(L, 1, 0);
 276	retv = ftk_widget_canvas(thiz);
 277	tolua_pushusertype(L, (FtkCanvas*)retv, "FtkCanvas");
 278
 279	return 1;
 280}
 281
 282static int lua_ftk_widget_has_attr(lua_State* L)
 283{
 284	tolua_Error err = {0};
 285	int retv;
 286	FtkWidget* thiz;
 287	int attr;
 288	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 289
 290	return_val_if_fail(param_ok, 0);
 291
 292	thiz = tolua_tousertype(L, 1, 0);
 293	attr = tolua_tonumber(L, 2, 0);
 294	retv = ftk_widget_has_attr(thiz, attr);
 295	tolua_pushnumber(L, (lua_Number)retv);
 296
 297	return 1;
 298}
 299
 300static int lua_ftk_widget_state(lua_State* L)
 301{
 302	tolua_Error err = {0};
 303	int retv;
 304	FtkWidget* thiz;
 305	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 306
 307	return_val_if_fail(param_ok, 0);
 308
 309	thiz = tolua_tousertype(L, 1, 0);
 310	retv = ftk_widget_state(thiz);
 311	tolua_pushnumber(L, (lua_Number)retv);
 312
 313	return 1;
 314}
 315
 316static int lua_ftk_widget_user_data(lua_State* L)
 317{
 318	tolua_Error err = {0};
 319	void* retv;
 320	FtkWidget* thiz;
 321	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 322
 323	return_val_if_fail(param_ok, 0);
 324
 325	thiz = tolua_tousertype(L, 1, 0);
 326	retv = ftk_widget_user_data(thiz);
 327	tolua_pushusertype(L, (void*)retv, "void");
 328
 329	return 1;
 330}
 331
 332static int lua_ftk_widget_get_text(lua_State* L)
 333{
 334	tolua_Error err = {0};
 335	const char* retv;
 336	FtkWidget* thiz;
 337	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 338
 339	return_val_if_fail(param_ok, 0);
 340
 341	thiz = tolua_tousertype(L, 1, 0);
 342	retv = ftk_widget_get_text(thiz);
 343	tolua_pushstring(L, (const char*)retv);
 344
 345	return 1;
 346}
 347
 348static int lua_ftk_widget_invalidate(lua_State* L)
 349{
 350	tolua_Error err = {0};
 351	Ret retv;
 352	FtkWidget* thiz;
 353	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 354
 355	return_val_if_fail(param_ok, 0);
 356
 357	thiz = tolua_tousertype(L, 1, 0);
 358	retv = ftk_widget_invalidate(thiz);
 359	tolua_pushnumber(L, (lua_Number)retv);
 360
 361	return 1;
 362}
 363
 364static int lua_ftk_widget_show(lua_State* L)
 365{
 366	tolua_Error err = {0};
 367	FtkWidget* thiz;
 368	int visible;
 369	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 370
 371	return_val_if_fail(param_ok, 0);
 372
 373	thiz = tolua_tousertype(L, 1, 0);
 374	visible = tolua_tonumber(L, 2, 0);
 375	ftk_widget_show(thiz, visible);
 376
 377	return 1;
 378}
 379
 380static int lua_ftk_widget_show_all(lua_State* L)
 381{
 382	tolua_Error err = {0};
 383	FtkWidget* thiz;
 384	int visible;
 385	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 386
 387	return_val_if_fail(param_ok, 0);
 388
 389	thiz = tolua_tousertype(L, 1, 0);
 390	visible = tolua_tonumber(L, 2, 0);
 391	ftk_widget_show_all(thiz, visible);
 392
 393	return 1;
 394}
 395
 396static int lua_ftk_widget_set_visible(lua_State* L)
 397{
 398	tolua_Error err = {0};
 399	FtkWidget* thiz;
 400	int visible;
 401	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 402
 403	return_val_if_fail(param_ok, 0);
 404
 405	thiz = tolua_tousertype(L, 1, 0);
 406	visible = tolua_tonumber(L, 2, 0);
 407	ftk_widget_set_visible(thiz, visible);
 408
 409	return 1;
 410}
 411
 412static int lua_ftk_widget_move(lua_State* L)
 413{
 414	tolua_Error err = {0};
 415	FtkWidget* thiz;
 416	int x;
 417	int y;
 418	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);
 419
 420	return_val_if_fail(param_ok, 0);
 421
 422	thiz = tolua_tousertype(L, 1, 0);
 423	x = tolua_tonumber(L, 2, 0);
 424	y = tolua_tonumber(L, 3, 0);
 425	ftk_widget_move(thiz, x, y);
 426
 427	return 1;
 428}
 429
 430static int lua_ftk_widget_resize(lua_State* L)
 431{
 432	tolua_Error err = {0};
 433	FtkWidget* thiz;
 434	int width;
 435	int height;
 436	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);
 437
 438	return_val_if_fail(param_ok, 0);
 439
 440	thiz = tolua_tousertype(L, 1, 0);
 441	width = tolua_tonumber(L, 2, 0);
 442	height = tolua_tonumber(L, 3, 0);
 443	ftk_widget_resize(thiz, width, height);
 444
 445	return 1;
 446}
 447
 448static int lua_ftk_widget_move_resize(lua_State* L)
 449{
 450	tolua_Error err = {0};
 451	FtkWidget* thiz;
 452	int x;
 453	int y;
 454	int width;
 455	int height;
 456	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err) && tolua_isnumber(L, 5, 0, &err);
 457
 458	return_val_if_fail(param_ok, 0);
 459
 460	thiz = tolua_tousertype(L, 1, 0);
 461	x = tolua_tonumber(L, 2, 0);
 462	y = tolua_tonumber(L, 3, 0);
 463	width = tolua_tonumber(L, 4, 0);
 464	height = tolua_tonumber(L, 5, 0);
 465	ftk_widget_move_resize(thiz, x, y, width, height);
 466
 467	return 1;
 468}
 469
 470static int lua_ftk_widget_set_type(lua_State* L)
 471{
 472	tolua_Error err = {0};
 473	FtkWidget* thiz;
 474	int type;
 475	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 476
 477	return_val_if_fail(param_ok, 0);
 478
 479	thiz = tolua_tousertype(L, 1, 0);
 480	type = tolua_tonumber(L, 2, 0);
 481	ftk_widget_set_type(thiz, type);
 482
 483	return 1;
 484}
 485
 486static int lua_ftk_widget_set_insensitive(lua_State* L)
 487{
 488	tolua_Error err = {0};
 489	FtkWidget* thiz;
 490	int insensitive;
 491	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 492
 493	return_val_if_fail(param_ok, 0);
 494
 495	thiz = tolua_tousertype(L, 1, 0);
 496	insensitive = tolua_tonumber(L, 2, 0);
 497	ftk_widget_set_insensitive(thiz, insensitive);
 498
 499	return 1;
 500}
 501
 502static int lua_ftk_widget_set_focused(lua_State* L)
 503{
 504	tolua_Error err = {0};
 505	FtkWidget* thiz;
 506	int focused;
 507	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 508
 509	return_val_if_fail(param_ok, 0);
 510
 511	thiz = tolua_tousertype(L, 1, 0);
 512	focused = tolua_tonumber(L, 2, 0);
 513	ftk_widget_set_focused(thiz, focused);
 514
 515	return 1;
 516}
 517
 518static int lua_ftk_widget_set_active(lua_State* L)
 519{
 520	tolua_Error err = {0};
 521	FtkWidget* thiz;
 522	int active;
 523	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 524
 525	return_val_if_fail(param_ok, 0);
 526
 527	thiz = tolua_tousertype(L, 1, 0);
 528	active = tolua_tonumber(L, 2, 0);
 529	ftk_widget_set_active(thiz, active);
 530
 531	return 1;
 532}
 533
 534static int lua_ftk_widget_set_id(lua_State* L)
 535{
 536	tolua_Error err = {0};
 537	FtkWidget* thiz;
 538	int id;
 539	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 540
 541	return_val_if_fail(param_ok, 0);
 542
 543	thiz = tolua_tousertype(L, 1, 0);
 544	id = tolua_tonumber(L, 2, 0);
 545	ftk_widget_set_id(thiz, id);
 546
 547	return 1;
 548}
 549
 550static int lua_ftk_widget_set_canvas(lua_State* L)
 551{
 552	tolua_Error err = {0};
 553	FtkWidget* thiz;
 554	FtkCanvas* canvas;
 555	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkCanvas", 0, &err);
 556
 557	return_val_if_fail(param_ok, 0);
 558
 559	thiz = tolua_tousertype(L, 1, 0);
 560	canvas = tolua_tousertype(L, 2, 0);
 561	ftk_widget_set_canvas(thiz, canvas);
 562
 563	return 1;
 564}
 565
 566static int lua_ftk_widget_set_parent(lua_State* L)
 567{
 568	tolua_Error err = {0};
 569	FtkWidget* thiz;
 570	FtkWidget* parent;
 571	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkWidget", 0, &err);
 572
 573	return_val_if_fail(param_ok, 0);
 574
 575	thiz = tolua_tousertype(L, 1, 0);
 576	parent = tolua_tousertype(L, 2, 0);
 577	ftk_widget_set_parent(thiz, parent);
 578
 579	return 1;
 580}
 581
 582static int lua_ftk_widget_set_text(lua_State* L)
 583{
 584	tolua_Error err = {0};
 585	FtkWidget* thiz;
 586	const char* text;
 587	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 588
 589	return_val_if_fail(param_ok, 0);
 590
 591	thiz = tolua_tousertype(L, 1, 0);
 592	text = tolua_tostring(L, 2, 0);
 593	ftk_widget_set_text(thiz, text);
 594
 595	return 1;
 596}
 597
 598static int lua_ftk_widget_set_font(lua_State* L)
 599{
 600	tolua_Error err = {0};
 601	FtkWidget* thiz;
 602	const char* font_desc;
 603	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 604
 605	return_val_if_fail(param_ok, 0);
 606
 607	thiz = tolua_tousertype(L, 1, 0);
 608	font_desc = tolua_tostring(L, 2, 0);
 609	ftk_widget_set_font(thiz, font_desc);
 610
 611	return 1;
 612}
 613
 614static int lua_ftk_widget_set_font_size(lua_State* L)
 615{
 616	tolua_Error err = {0};
 617	FtkWidget* thiz;
 618	int font_size;
 619	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 620
 621	return_val_if_fail(param_ok, 0);
 622
 623	thiz = tolua_tousertype(L, 1, 0);
 624	font_size = tolua_tonumber(L, 2, 0);
 625	ftk_widget_set_font_size(thiz, font_size);
 626
 627	return 1;
 628}
 629
 630static int lua_ftk_widget_append_child(lua_State* L)
 631{
 632	tolua_Error err = {0};
 633	FtkWidget* thiz;
 634	FtkWidget* child;
 635	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkWidget", 0, &err);
 636
 637	return_val_if_fail(param_ok, 0);
 638
 639	thiz = tolua_tousertype(L, 1, 0);
 640	child = tolua_tousertype(L, 2, 0);
 641	ftk_widget_append_child(thiz, child);
 642
 643	return 1;
 644}
 645
 646static int lua_ftk_widget_append_sibling(lua_State* L)
 647{
 648	tolua_Error err = {0};
 649	FtkWidget* thiz;
 650	FtkWidget* next;
 651	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkWidget", 0, &err);
 652
 653	return_val_if_fail(param_ok, 0);
 654
 655	thiz = tolua_tousertype(L, 1, 0);
 656	next = tolua_tousertype(L, 2, 0);
 657	ftk_widget_append_sibling(thiz, next);
 658
 659	return 1;
 660}
 661
 662static int lua_ftk_widget_remove_child(lua_State* L)
 663{
 664	tolua_Error err = {0};
 665	FtkWidget* thiz;
 666	FtkWidget* child;
 667	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkWidget", 0, &err);
 668
 669	return_val_if_fail(param_ok, 0);
 670
 671	thiz = tolua_tousertype(L, 1, 0);
 672	child = tolua_tousertype(L, 2, 0);
 673	ftk_widget_remove_child(thiz, child);
 674
 675	return 1;
 676}
 677
 678static int lua_ftk_widget_set_attr(lua_State* L)
 679{
 680	tolua_Error err = {0};
 681	FtkWidget* thiz;
 682	int attr;
 683	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 684
 685	return_val_if_fail(param_ok, 0);
 686
 687	thiz = tolua_tousertype(L, 1, 0);
 688	attr = tolua_tonumber(L, 2, 0);
 689	ftk_widget_set_attr(thiz, attr);
 690
 691	return 1;
 692}
 693
 694static int lua_ftk_widget_unset_attr(lua_State* L)
 695{
 696	tolua_Error err = {0};
 697	FtkWidget* thiz;
 698	int attr;
 699	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 700
 701	return_val_if_fail(param_ok, 0);
 702
 703	thiz = tolua_tousertype(L, 1, 0);
 704	attr = tolua_tonumber(L, 2, 0);
 705	ftk_widget_unset_attr(thiz, attr);
 706
 707	return 1;
 708}
 709
 710static int lua_ftk_widget_set_user_data(lua_State* L)
 711{
 712	tolua_Error err = {0};
 713	FtkWidget* thiz;
 714	char* destroy;
 715	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 716
 717	return_val_if_fail(param_ok, 0);
 718
 719	thiz = tolua_tousertype(L, 1, 0);
 720	destroy = (char*)tolua_tostring(L, 2, 0);
 721	ftk_widget_set_user_data(thiz, lua_ftk_destroy_func, destroy);
 722
 723	return 1;
 724}
 725
 726static int lua_ftk_widget_set_gc(lua_State* L)
 727{
 728	tolua_Error err = {0};
 729	FtkWidget* thiz;
 730	int state;
 731	FtkGc* gc;
 732	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isusertype(L, 3, "FtkGc", 0, &err);
 733
 734	return_val_if_fail(param_ok, 0);
 735
 736	thiz = tolua_tousertype(L, 1, 0);
 737	state = tolua_tonumber(L, 2, 0);
 738	gc = tolua_tousertype(L, 3, 0);
 739	ftk_widget_set_gc(thiz, state, gc);
 740
 741	return 1;
 742}
 743
 744static int lua_ftk_widget_reset_gc(lua_State* L)
 745{
 746	tolua_Error err = {0};
 747	FtkWidget* thiz;
 748	int state;
 749	FtkGc* gc;
 750	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isusertype(L, 3, "FtkGc", 0, &err);
 751
 752	return_val_if_fail(param_ok, 0);
 753
 754	thiz = tolua_tousertype(L, 1, 0);
 755	state = tolua_tonumber(L, 2, 0);
 756	gc = tolua_tousertype(L, 3, 0);
 757	ftk_widget_reset_gc(thiz, state, gc);
 758
 759	return 1;
 760}
 761
 762static int lua_ftk_widget_set_event_listener(lua_State* L)
 763{
 764	tolua_Error err = {0};
 765	FtkWidget* thiz;
 766	char* listener;
 767	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err);
 768
 769	return_val_if_fail(param_ok, 0);
 770
 771	thiz = tolua_tousertype(L, 1, 0);
 772	listener = (char*)tolua_tostring(L, 2, 0);
 773	ftk_widget_set_event_listener(thiz, lua_ftk_event_listener_func, listener);
 774
 775	return 1;
 776}
 777
 778static int lua_ftk_widget_toplevel(lua_State* L)
 779{
 780	tolua_Error err = {0};
 781	FtkWidget* retv;
 782	FtkWidget* thiz;
 783	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 784
 785	return_val_if_fail(param_ok, 0);
 786
 787	thiz = tolua_tousertype(L, 1, 0);
 788	retv = ftk_widget_toplevel(thiz);
 789	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 790
 791	return 1;
 792}
 793
 794static int lua_ftk_widget_parent(lua_State* L)
 795{
 796	tolua_Error err = {0};
 797	FtkWidget* retv;
 798	FtkWidget* thiz;
 799	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 800
 801	return_val_if_fail(param_ok, 0);
 802
 803	thiz = tolua_tousertype(L, 1, 0);
 804	retv = ftk_widget_parent(thiz);
 805	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 806
 807	return 1;
 808}
 809
 810static int lua_ftk_widget_prev(lua_State* L)
 811{
 812	tolua_Error err = {0};
 813	FtkWidget* retv;
 814	FtkWidget* thiz;
 815	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 816
 817	return_val_if_fail(param_ok, 0);
 818
 819	thiz = tolua_tousertype(L, 1, 0);
 820	retv = ftk_widget_prev(thiz);
 821	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 822
 823	return 1;
 824}
 825
 826static int lua_ftk_widget_next(lua_State* L)
 827{
 828	tolua_Error err = {0};
 829	FtkWidget* retv;
 830	FtkWidget* thiz;
 831	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 832
 833	return_val_if_fail(param_ok, 0);
 834
 835	thiz = tolua_tousertype(L, 1, 0);
 836	retv = ftk_widget_next(thiz);
 837	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 838
 839	return 1;
 840}
 841
 842static int lua_ftk_widget_child(lua_State* L)
 843{
 844	tolua_Error err = {0};
 845	FtkWidget* retv;
 846	FtkWidget* thiz;
 847	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 848
 849	return_val_if_fail(param_ok, 0);
 850
 851	thiz = tolua_tousertype(L, 1, 0);
 852	retv = ftk_widget_child(thiz);
 853	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 854
 855	return 1;
 856}
 857
 858static int lua_ftk_widget_last_child(lua_State* L)
 859{
 860	tolua_Error err = {0};
 861	FtkWidget* retv;
 862	FtkWidget* thiz;
 863	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 864
 865	return_val_if_fail(param_ok, 0);
 866
 867	thiz = tolua_tousertype(L, 1, 0);
 868	retv = ftk_widget_last_child(thiz);
 869	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 870
 871	return 1;
 872}
 873
 874static int lua_ftk_widget_lookup(lua_State* L)
 875{
 876	tolua_Error err = {0};
 877	FtkWidget* retv;
 878	FtkWidget* thiz;
 879	int id;
 880	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err);
 881
 882	return_val_if_fail(param_ok, 0);
 883
 884	thiz = tolua_tousertype(L, 1, 0);
 885	id = tolua_tonumber(L, 2, 0);
 886	retv = ftk_widget_lookup(thiz, id);
 887	tolua_pushusertype(L, (FtkWidget*)retv, "FtkWidget");
 888
 889	return 1;
 890}
 891
 892static int lua_ftk_widget_paint(lua_State* L)
 893{
 894	tolua_Error err = {0};
 895	FtkWidget* thiz;
 896	FtkRect* rects;
 897	int rect_nr;
 898	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkRect", 0, &err) && tolua_isnumber(L, 3, 0, &err);
 899
 900	return_val_if_fail(param_ok, 0);
 901
 902	thiz = tolua_tousertype(L, 1, 0);
 903	rects = tolua_tousertype(L, 2, 0);
 904	rect_nr = tolua_tonumber(L, 3, 0);
 905	ftk_widget_paint(thiz, rects, rect_nr);
 906
 907	return 1;
 908}
 909
 910static int lua_ftk_widget_destroy(lua_State* L)
 911{
 912	tolua_Error err = {0};
 913	FtkWidget* thiz;
 914	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 915
 916	return_val_if_fail(param_ok, 0);
 917
 918	thiz = tolua_tousertype(L, 1, 0);
 919	ftk_widget_destroy(thiz);
 920
 921	return 1;
 922}
 923
 924static int lua_ftk_widget_ref(lua_State* L)
 925{
 926	tolua_Error err = {0};
 927	FtkWidget* thiz;
 928	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 929
 930	return_val_if_fail(param_ok, 0);
 931
 932	thiz = tolua_tousertype(L, 1, 0);
 933	ftk_widget_ref(thiz);
 934
 935	return 1;
 936}
 937
 938static int lua_ftk_widget_unref(lua_State* L)
 939{
 940	tolua_Error err = {0};
 941	FtkWidget* thiz;
 942	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 943
 944	return_val_if_fail(param_ok, 0);
 945
 946	thiz = tolua_tousertype(L, 1, 0);
 947	ftk_widget_unref(thiz);
 948
 949	return 1;
 950}
 951
 952static int lua_ftk_widget_paint_self(lua_State* L)
 953{
 954	tolua_Error err = {0};
 955	Ret retv;
 956	FtkWidget* thiz;
 957	FtkRect* rects;
 958	int rect_nr;
 959	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkRect", 0, &err) && tolua_isnumber(L, 3, 0, &err);
 960
 961	return_val_if_fail(param_ok, 0);
 962
 963	thiz = tolua_tousertype(L, 1, 0);
 964	rects = tolua_tousertype(L, 2, 0);
 965	rect_nr = tolua_tonumber(L, 3, 0);
 966	retv = ftk_widget_paint_self(thiz, rects, rect_nr);
 967	tolua_pushnumber(L, (lua_Number)retv);
 968
 969	return 1;
 970}
 971
 972static int lua_ftk_widget_ref_self(lua_State* L)
 973{
 974	tolua_Error err = {0};
 975	FtkWidget* thiz;
 976	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 977
 978	return_val_if_fail(param_ok, 0);
 979
 980	thiz = tolua_tousertype(L, 1, 0);
 981	ftk_widget_ref_self(thiz);
 982
 983	return 1;
 984}
 985
 986static int lua_ftk_widget_unref_self(lua_State* L)
 987{
 988	tolua_Error err = {0};
 989	FtkWidget* thiz;
 990	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err);
 991
 992	return_val_if_fail(param_ok, 0);
 993
 994	thiz = tolua_tousertype(L, 1, 0);
 995	ftk_widget_unref_self(thiz);
 996
 997	return 1;
 998}
 999
1000static int lua_ftk_widget_event(lua_State* L)
1001{
1002	tolua_Error err = {0};
1003	Ret retv;
1004	FtkWidget* thiz;
1005	FtkEvent* event;
1006	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isusertype(L, 2, "FtkEvent", 0, &err);
1007
1008	return_val_if_fail(param_ok, 0);
1009
1010	thiz = tolua_tousertype(L, 1, 0);
1011	event = tolua_tousertype(L, 2, 0);
1012	retv = ftk_widget_event(thiz, event);
1013	tolua_pushnumber(L, (lua_Number)retv);
1014
1015	return 1;
1016}
1017
1018int tolua_ftk_widget_init(lua_State* L)
1019{
1020	tolua_open(L);
1021	tolua_reg_types(L);
1022	tolua_module(L, NULL, 0);
1023	tolua_beginmodule(L, NULL);
1024	tolua_cclass(L,"FtkWidget", "FtkWidget", "", NULL);
1025	tolua_beginmodule(L, "FtkWidget");
1026	tolua_function(L, "Type", lua_ftk_widget_type);
1027	tolua_function(L, "Top", lua_ftk_widget_top);
1028	tolua_function(L, "Left", lua_ftk_widget_left);
1029	tolua_function(L, "TopAbs", lua_ftk_widget_top_abs);
1030	tolua_function(L, "LeftAbs", lua_ftk_widget_left_abs);
1031	tolua_function(L, "TopInWindow", lua_ftk_widget_top_in_window);
1032	tolua_function(L, "LeftInWindow", lua_ftk_widget_left_in_window);
1033	tolua_function(L, "Width", lua_ftk_widget_width);
1034	tolua_function(L, "Height", lua_ftk_widget_height);
1035	tolua_function(L, "IsInsensitive", lua_ftk_widget_is_insensitive);
1036	tolua_function(L, "IsVisible", lua_ftk_widget_is_visible);
1037	tolua_function(L, "IsFocused", lua_ftk_widget_is_focused);
1038	tolua_function(L, "IsActive", lua_ftk_widget_is_active);
1039	tolua_function(L, "Id", lua_ftk_widget_id);
1040	tolua_function(L, "Update", lua_ftk_widget_update);
1041	tolua_function(L, "GetGc", lua_ftk_widget_get_gc);
1042	tolua_function(L, "Canvas", lua_ftk_widget_canvas);
1043	tolua_function(L, "HasAttr", lua_ftk_widget_has_attr);
1044	tolua_function(L, "State", lua_ftk_widget_state);
1045	tolua_function(L, "UserData", lua_ftk_widget_user_data);
1046	tolua_function(L, "GetText", lua_ftk_widget_get_text);
1047	tolua_function(L, "Invalidate", lua_ftk_widget_invalidate);
1048	tolua_function(L, "Show", lua_ftk_widget_show);
1049	tolua_function(L, "ShowAll", lua_ftk_widget_show_all);
1050	tolua_function(L, "SetVisible", lua_ftk_widget_set_visible);
1051	tolua_function(L, "Move", lua_ftk_widget_move);
1052	tolua_function(L, "Resize", lua_ftk_widget_resize);
1053	tolua_function(L, "MoveResize", lua_ftk_widget_move_resize);
1054	tolua_function(L, "SetType", lua_ftk_widget_set_type);
1055	tolua_function(L, "SetInsensitive", lua_ftk_widget_set_insensitive);
1056	tolua_function(L, "SetFocused", lua_ftk_widget_set_focused);
1057	tolua_function(L, "SetActive", lua_ftk_widget_set_active);
1058	tolua_function(L, "SetId", lua_ftk_widget_set_id);
1059	tolua_function(L, "SetCanvas", lua_ftk_widget_set_canvas);
1060	tolua_function(L, "SetParent", lua_ftk_widget_set_parent);
1061	tolua_function(L, "SetText", lua_ftk_widget_set_text);
1062	tolua_function(L, "SetFont", lua_ftk_widget_set_font);
1063	tolua_function(L, "SetFontSize", lua_ftk_widget_set_font_size);
1064	tolua_function(L, "AppendChild", lua_ftk_widget_append_child);
1065	tolua_function(L, "AppendSibling", lua_ftk_widget_append_sibling);
1066	tolua_function(L, "RemoveChild", lua_ftk_widget_remove_child);
1067	tolua_function(L, "SetAttr", lua_ftk_widget_set_attr);
1068	tolua_function(L, "UnsetAttr", lua_ftk_widget_unset_attr);
1069	tolua_function(L, "SetUserData", lua_ftk_widget_set_user_data);
1070	tolua_function(L, "SetGc", lua_ftk_widget_set_gc);
1071	tolua_function(L, "ResetGc", lua_ftk_widget_reset_gc);
1072	tolua_function(L, "SetEventListener", lua_ftk_widget_set_event_listener);
1073	tolua_function(L, "Toplevel", lua_ftk_widget_toplevel);
1074	tolua_function(L, "Parent", lua_ftk_widget_parent);
1075	tolua_function(L, "Prev", lua_ftk_widget_prev);
1076	tolua_function(L, "Next", lua_ftk_widget_next);
1077	tolua_function(L, "Child", lua_ftk_widget_child);
1078	tolua_function(L, "LastChild", lua_ftk_widget_last_child);
1079	tolua_function(L, "Lookup", lua_ftk_widget_lookup);
1080	tolua_function(L, "Paint", lua_ftk_widget_paint);
1081	tolua_function(L, "Destroy", lua_ftk_widget_destroy);
1082	tolua_function(L, "Ref", lua_ftk_widget_ref);
1083	tolua_function(L, "Unref", lua_ftk_widget_unref);
1084	tolua_function(L, "PaintSelf", lua_ftk_widget_paint_self);
1085	tolua_function(L, "RefSelf", lua_ftk_widget_ref_self);
1086	tolua_function(L, "UnrefSelf", lua_ftk_widget_unref_self);
1087	tolua_function(L, "Event", lua_ftk_widget_event);
1088	tolua_endmodule(L);
1089	tolua_endmodule(L);
1090
1091
1092	return 1;
1093}