guiCheckBoxCtrl_ScriptBinding.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. ConsoleMethodGroupBeginWithDocs(GuiCheckBoxCtrl, GuiControl)
  23. /*! Sets the state to on if true or off if false.
  24. @param isStateOn True if the control is on, false if off.
  25. */
  26. ConsoleMethodWithDocs(GuiCheckBoxCtrl, setStateOn, ConsoleVoid, 3, 3, (isStateOn))
  27. {
  28. object->setStateOn(dAtob(argv[2]));
  29. }
  30. /*! Gets the current state of the control.
  31. @return Returns true if on and false if off.
  32. */
  33. ConsoleMethodWithDocs(GuiCheckBoxCtrl, getStateOn, ConsoleBool, 2, 2, ())
  34. {
  35. return object->getStateOn();
  36. }
  37. /*! Sets the amount the button is offset from the top left corner of the control.
  38. @param offset The amount to offset the button.
  39. */
  40. ConsoleMethodWithDocs(GuiCheckBoxCtrl, setBoxOffset, ConsoleVoid, 3, 3, (offset))
  41. {
  42. Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
  43. object->setBoxOffset(kPoint);
  44. }
  45. /*! Sets the size of the button within the control proper.
  46. @param extent The size to render the button.
  47. */
  48. ConsoleMethodWithDocs(GuiCheckBoxCtrl, setBoxExtent, ConsoleVoid, 3, 3, (extent))
  49. {
  50. Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
  51. object->setBoxExtent(kPoint);
  52. }
  53. /*! Sets the amount the text is offset from the top left corner of the control.
  54. @param offset The amount to offset the text.
  55. */
  56. ConsoleMethodWithDocs(GuiCheckBoxCtrl, setTextOffset, ConsoleVoid, 3, 3, (offset))
  57. {
  58. Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
  59. object->setTextOffset(kPoint);
  60. }
  61. /*! Sets the size of the area the text will be rendered in within the control proper.
  62. @param extent The area available to render the text in.
  63. */
  64. ConsoleMethodWithDocs(GuiCheckBoxCtrl, setTextExtent, ConsoleVoid, 3, 3, (extent))
  65. {
  66. Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
  67. object->setTextExtent(kPoint);
  68. }
  69. /*! Get the offset that the button will be rendered from the top left corner of the control.
  70. @return The offset as a string with space-separated integers.
  71. */
  72. ConsoleMethodWithDocs(GuiCheckBoxCtrl, getBoxOffset, ConsoleString, 2, 2, (...))
  73. {
  74. char *retBuffer = Con::getReturnBuffer(64);
  75. const Point2I &ext = object->getBoxOffset();
  76. dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
  77. return retBuffer;
  78. }
  79. /*! Get the area that the button will be rendered to within the control.
  80. @return The width and height of the button as a string with space-separated integers.
  81. */
  82. ConsoleMethodWithDocs(GuiCheckBoxCtrl, getBoxExtent, ConsoleString, 2, 2, (...))
  83. {
  84. char *retBuffer = Con::getReturnBuffer(64);
  85. const Point2I &ext = object->getBoxExtent();
  86. dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
  87. return retBuffer;
  88. }
  89. /*! Get the offset that the text area will be from the top left corner of the control.
  90. @return The offset of the text area as a string with space-separated integers.
  91. */
  92. ConsoleMethodWithDocs(GuiCheckBoxCtrl, getTextOffset, ConsoleString, 2, 2, (...))
  93. {
  94. char *retBuffer = Con::getReturnBuffer(64);
  95. const Point2I &ext = object->getTextOffset();
  96. dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
  97. return retBuffer;
  98. }
  99. /*! Get the area that the text will be rendered to within the control.
  100. @return The width and height of the text area as a string with space-separated integers.
  101. */
  102. ConsoleMethodWithDocs(GuiCheckBoxCtrl, getTextExtent, ConsoleString, 2, 2, (...))
  103. {
  104. char *retBuffer = Con::getReturnBuffer(64);
  105. const Point2I &ext = object->getTextExtent();
  106. dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
  107. return retBuffer;
  108. }