ElementFormControl.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #include "precompiled.h"
  2. #include "ElementFormControl.h"
  3. #include <Rocket/Controls/ElementFormControl.h>
  4. #include <Rocket/Core/Element.h>
  5. using Rocket::Controls::ElementFormControl;
  6. namespace Rocket {
  7. namespace Core {
  8. namespace Lua {
  9. //this will be used to "inherit" from Element
  10. template<> void LuaType<ElementFormControl>::extra_init(lua_State* L, int metatable_index)
  11. {
  12. LuaType<Element>::_regfunctions(L,metatable_index,metatable_index-1);
  13. }
  14. //getters
  15. int ElementFormControlGetAttrdisabled(lua_State* L)
  16. {
  17. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  18. LUACHECKOBJ(efc);
  19. lua_pushboolean(L,efc->IsDisabled());
  20. return 1;
  21. }
  22. int ElementFormControlGetAttrname(lua_State* L)
  23. {
  24. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  25. LUACHECKOBJ(efc);
  26. lua_pushstring(L,efc->GetName().CString());
  27. return 1;
  28. }
  29. int ElementFormControlGetAttrvalue(lua_State* L)
  30. {
  31. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  32. LUACHECKOBJ(efc);
  33. lua_pushstring(L,efc->GetValue().CString());
  34. return 1;
  35. }
  36. //setters
  37. int ElementFormControlSetAttrdisabled(lua_State* L)
  38. {
  39. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  40. LUACHECKOBJ(efc);
  41. efc->SetDisabled(CHECK_BOOL(L,2));
  42. return 0;
  43. }
  44. int ElementFormControlSetAttrname(lua_State* L)
  45. {
  46. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  47. LUACHECKOBJ(efc);
  48. const char* name = luaL_checkstring(L,2);
  49. efc->SetName(name);
  50. return 0;
  51. }
  52. int ElementFormControlSetAttrvalue(lua_State* L)
  53. {
  54. ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
  55. LUACHECKOBJ(efc);
  56. const char* value = luaL_checkstring(L,2);
  57. efc->SetValue(value);
  58. return 0;
  59. }
  60. RegType<ElementFormControl> ElementFormControlMethods[] =
  61. {
  62. { NULL, NULL },
  63. };
  64. luaL_reg ElementFormControlGetters[] =
  65. {
  66. LUAGETTER(ElementFormControl,disabled)
  67. LUAGETTER(ElementFormControl,name)
  68. LUAGETTER(ElementFormControl,value)
  69. { NULL, NULL },
  70. };
  71. luaL_reg ElementFormControlSetters[] =
  72. {
  73. LUASETTER(ElementFormControl,disabled)
  74. LUASETTER(ElementFormControl,name)
  75. LUASETTER(ElementFormControl,value)
  76. { NULL, NULL },
  77. };
  78. template<> const char* GetTClassName<ElementFormControl>() { return "ElementFormControl"; }
  79. template<> RegType<ElementFormControl>* GetMethodTable<ElementFormControl>() { return ElementFormControlMethods; }
  80. template<> luaL_reg* GetAttrTable<ElementFormControl>() { return ElementFormControlGetters; }
  81. template<> luaL_reg* SetAttrTable<ElementFormControl>() { return ElementFormControlSetters; }
  82. }
  83. }
  84. }