ElementFormControlTextArea.cpp 3.2 KB

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