ElementFormControlTextArea.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include "precompiled.h"
  2. #include "ElementFormControlTextArea.h"
  3. #include <Rocket/Controls/ElementFormControl.h>
  4. using Rocket::Controls::ElementFormControl;
  5. namespace Rocket {
  6. namespace Core {
  7. namespace Lua {
  8. //inherits from ElementFormControl which inherits from Element
  9. template<> void LuaType<ElementFormControlTextArea>::extra_init(lua_State* L, int metatable_index)
  10. {
  11. LuaType<ElementFormControl>::extra_init(L,metatable_index);
  12. LuaType<ElementFormControl>::_regfunctions(L,metatable_index,metatable_index-1);
  13. }
  14. //getters
  15. int ElementFormControlTextAreaGetAttrcols(lua_State* L)
  16. {
  17. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  18. LUACHECKOBJ(obj);
  19. lua_pushinteger(L,obj->GetNumColumns());
  20. return 1;
  21. }
  22. int ElementFormControlTextAreaGetAttrmaxlength(lua_State* L)
  23. {
  24. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  25. LUACHECKOBJ(obj);
  26. lua_pushinteger(L,obj->GetMaxLength());
  27. return 1;
  28. }
  29. int ElementFormControlTextAreaGetAttrrows(lua_State* L)
  30. {
  31. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  32. LUACHECKOBJ(obj);
  33. lua_pushinteger(L,obj->GetNumRows());
  34. return 1;
  35. }
  36. int ElementFormControlTextAreaGetAttrwordwrap(lua_State* L)
  37. {
  38. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  39. LUACHECKOBJ(obj);
  40. lua_pushboolean(L,obj->GetWordWrap());
  41. return 1;
  42. }
  43. //setters
  44. int ElementFormControlTextAreaSetAttrcols(lua_State* L)
  45. {
  46. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  47. LUACHECKOBJ(obj);
  48. int cols = luaL_checkint(L,2);
  49. obj->SetNumColumns(cols);
  50. return 0;
  51. }
  52. int ElementFormControlTextAreaSetAttrmaxlength(lua_State* L)
  53. {
  54. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  55. LUACHECKOBJ(obj);
  56. int ml = luaL_checkint(L,2);
  57. obj->SetMaxLength(ml);
  58. return 0;
  59. }
  60. int ElementFormControlTextAreaSetAttrrows(lua_State* L)
  61. {
  62. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  63. LUACHECKOBJ(obj);
  64. int rows = luaL_checkint(L,2);
  65. obj->SetNumRows(rows);
  66. return 0;
  67. }
  68. int ElementFormControlTextAreaSetAttrwordwrap(lua_State* L)
  69. {
  70. ElementFormControlTextArea* obj = LuaType<ElementFormControlTextArea>::check(L,1);
  71. LUACHECKOBJ(obj);
  72. bool ww = CHECK_BOOL(L,2);
  73. obj->SetWordWrap(ww);
  74. return 0;
  75. }
  76. RegType<ElementFormControlTextArea> ElementFormControlTextAreaMethods[] =
  77. {
  78. { NULL, NULL },
  79. };
  80. luaL_reg ElementFormControlTextAreaGetters[] =
  81. {
  82. LUAGETTER(ElementFormControlTextArea,cols)
  83. LUAGETTER(ElementFormControlTextArea,maxlength)
  84. LUAGETTER(ElementFormControlTextArea,rows)
  85. LUAGETTER(ElementFormControlTextArea,wordwrap)
  86. { NULL, NULL },
  87. };
  88. luaL_reg ElementFormControlTextAreaSetters[] =
  89. {
  90. LUASETTER(ElementFormControlTextArea,cols)
  91. LUASETTER(ElementFormControlTextArea,maxlength)
  92. LUASETTER(ElementFormControlTextArea,rows)
  93. LUASETTER(ElementFormControlTextArea,wordwrap)
  94. { NULL, NULL },
  95. };
  96. template<> const char* GetTClassName<ElementFormControlTextArea>() { return "ElementFormControlTextArea"; }
  97. template<> RegType<ElementFormControlTextArea>* GetMethodTable<ElementFormControlTextArea>() { return ElementFormControlTextAreaMethods; }
  98. template<> luaL_reg* GetAttrTable<ElementFormControlTextArea>() { return ElementFormControlTextAreaGetters; }
  99. template<> luaL_reg* SetAttrTable<ElementFormControlTextArea>() { return ElementFormControlTextAreaSetters; }
  100. }
  101. }
  102. }