ElementFormControlInput.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #include "precompiled.h"
  2. #include "ElementFormControlInput.h"
  3. #include <Rocket/Controls/ElementFormControl.h>
  4. using Rocket::Controls::ElementFormControl;
  5. namespace Rocket {
  6. namespace Core {
  7. namespace Lua {
  8. //getters
  9. int ElementFormControlInputGetAttrchecked(lua_State* L)
  10. {
  11. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  12. LUACHECKOBJ(obj);
  13. lua_pushboolean(L,obj->HasAttribute("checked"));
  14. return 1;
  15. }
  16. int ElementFormControlInputGetAttrmaxlength(lua_State* L)
  17. {
  18. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  19. LUACHECKOBJ(obj);
  20. lua_pushinteger(L,obj->GetAttribute<int>("maxlength",-1));
  21. return 1;
  22. }
  23. int ElementFormControlInputGetAttrsize(lua_State* L)
  24. {
  25. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  26. LUACHECKOBJ(obj);
  27. lua_pushinteger(L,obj->GetAttribute<int>("size",20));
  28. return 1;
  29. }
  30. int ElementFormControlInputGetAttrmax(lua_State* L)
  31. {
  32. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  33. LUACHECKOBJ(obj);
  34. lua_pushinteger(L,obj->GetAttribute<int>("max",100));
  35. return 1;
  36. }
  37. int ElementFormControlInputGetAttrmin(lua_State* L)
  38. {
  39. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  40. LUACHECKOBJ(obj);
  41. lua_pushinteger(L,obj->GetAttribute<int>("min",0));
  42. return 1;
  43. }
  44. int ElementFormControlInputGetAttrstep(lua_State* L)
  45. {
  46. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  47. LUACHECKOBJ(obj);
  48. lua_pushinteger(L,obj->GetAttribute<int>("step",1));
  49. return 1;
  50. }
  51. //setters
  52. int ElementFormControlInputSetAttrchecked(lua_State* L)
  53. {
  54. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  55. LUACHECKOBJ(obj);
  56. bool checked = CHECK_BOOL(L,2);
  57. if(checked)
  58. obj->SetAttribute("checked",true);
  59. else
  60. obj->RemoveAttribute("checked");
  61. return 0;
  62. }
  63. int ElementFormControlInputSetAttrmaxlength(lua_State* L)
  64. {
  65. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  66. LUACHECKOBJ(obj);
  67. int maxlength = luaL_checkint(L,2);
  68. obj->SetAttribute("maxlength",maxlength);
  69. return 0;
  70. }
  71. int ElementFormControlInputSetAttrsize(lua_State* L)
  72. {
  73. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  74. LUACHECKOBJ(obj);
  75. int size = luaL_checkint(L,2);
  76. obj->SetAttribute("size",size);
  77. return 0;
  78. }
  79. int ElementFormControlInputSetAttrmax(lua_State* L)
  80. {
  81. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  82. LUACHECKOBJ(obj);
  83. int max = luaL_checkint(L,2);
  84. obj->SetAttribute("max",max);
  85. return 0;
  86. }
  87. int ElementFormControlInputSetAttrmin(lua_State* L)
  88. {
  89. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  90. LUACHECKOBJ(obj);
  91. int min = luaL_checkint(L,2);
  92. obj->SetAttribute("min",min);
  93. return 0;
  94. }
  95. int ElementFormControlInputSetAttrstep(lua_State* L)
  96. {
  97. ElementFormControlInput* obj = LuaType<ElementFormControlInput>::check(L,1);
  98. LUACHECKOBJ(obj);
  99. int step = luaL_checkint(L,2);
  100. obj->SetAttribute("step",step);
  101. return 0;
  102. }
  103. RegType<ElementFormControlInput> ElementFormControlInputMethods[] =
  104. {
  105. {NULL,NULL},
  106. };
  107. luaL_reg ElementFormControlInputGetters[] =
  108. {
  109. LUAGETTER(ElementFormControlInput,checked)
  110. LUAGETTER(ElementFormControlInput,maxlength)
  111. LUAGETTER(ElementFormControlInput,size)
  112. LUAGETTER(ElementFormControlInput,max)
  113. LUAGETTER(ElementFormControlInput,min)
  114. LUAGETTER(ElementFormControlInput,step)
  115. {NULL,NULL},
  116. };
  117. luaL_reg ElementFormControlInputSetters[] =
  118. {
  119. LUASETTER(ElementFormControlInput,checked)
  120. LUASETTER(ElementFormControlInput,maxlength)
  121. LUASETTER(ElementFormControlInput,size)
  122. LUASETTER(ElementFormControlInput,max)
  123. LUASETTER(ElementFormControlInput,min)
  124. LUASETTER(ElementFormControlInput,step)
  125. {NULL,NULL},
  126. };
  127. /*
  128. template<> const char* GetTClassName<ElementFormControlInput>() { return "ElementFormControlInput"; }
  129. template<> RegType<ElementFormControlInput>* GetMethodTable<ElementFormControlInput>() { return ElementFormControlInputMethods; }
  130. template<> luaL_reg* GetAttrTable<ElementFormControlInput>() { return ElementFormControlInputGetters; }
  131. template<> luaL_reg* SetAttrTable<ElementFormControlInput>() { return ElementFormControlInputSetters; }
  132. */
  133. }
  134. }
  135. }