ElementFormControlSelect.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * This source file is part of libRocket, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://www.librocket.com
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. *
  26. */
  27. #ifndef ROCKETCORELUAELEMENTFORMCONTROLSELECT_H
  28. #define ROCKETCORELUAELEMENTFORMCONTROLSELECT_H
  29. /*
  30. This defines the ElementFormControlSelect type in the Lua global namespace, for this documentation will be
  31. named EFCSelect
  32. It has one extra method than the Python api, which is GetOption
  33. //methods
  34. int EFCSelect:Add(string rml, string value, [int before]) --where 'before' is optional, and is an index
  35. noreturn EFCSelect:Remove(int index)
  36. {"element"=Element,"value"=string} EFCSelect:GetOption(int index) --this is a more efficient way to get an option if you know the index beforehand
  37. //getters
  38. {[int index]={"element"=Element,"value"=string}} EFCSelect.options --used to access options as a Lua table. Comparatively expensive operation, use GetOption when
  39. --you only need one option and you know the index
  40. int EFCSelect.selection
  41. //setter
  42. EFCSelect.selection = int
  43. */
  44. #include <Rocket/Core/Lua/lua.hpp>
  45. #include <Rocket/Core/Lua/LuaType.h>
  46. #include <Rocket/Controls/ElementFormControlSelect.h>
  47. using Rocket::Controls::ElementFormControlSelect;
  48. namespace Rocket {
  49. namespace Core {
  50. namespace Lua {
  51. //inherits from ElementFormControl which inherits from Element
  52. template<> void LuaType<ElementFormControlSelect>::extra_init(lua_State* L, int metatable_index);
  53. template<> bool LuaType<ElementFormControlSelect>::is_reference_counted();
  54. //methods
  55. int ElementFormControlSelectAdd(lua_State* L, ElementFormControlSelect* obj);
  56. int ElementFormControlSelectRemove(lua_State* L, ElementFormControlSelect* obj);
  57. int ElementFormControlSelectGetOption(lua_State* L, ElementFormControlSelect* obj);
  58. //getters
  59. int ElementFormControlSelectGetAttroptions(lua_State* L);
  60. int ElementFormControlSelectGetAttrselection(lua_State* L);
  61. //setter
  62. int ElementFormControlSelectSetAttrselection(lua_State* L);
  63. RegType<ElementFormControlSelect> ElementFormControlSelectMethods[];
  64. luaL_reg ElementFormControlSelectGetters[];
  65. luaL_reg ElementFormControlSelectSetters[];
  66. /*
  67. template<> const char* GetTClassName<ElementFormControlSelect>();
  68. template<> RegType<ElementFormControlSelect>* GetMethodTable<ElementFormControlSelect>();
  69. template<> luaL_reg* GetAttrTable<ElementFormControlSelect>();
  70. template<> luaL_reg* SetAttrTable<ElementFormControlSelect>();
  71. */
  72. }
  73. }
  74. }
  75. #endif