guiScrollCtrl_ScriptBinding.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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(GuiScrollCtrl, GuiControl)
  23. /*! Scrolls the content area to the top.
  24. @return No return value.
  25. @sa scrollToBottom
  26. @sa scrollToLeft
  27. @sa scrollToRight
  28. @sa scrollToPosition
  29. */
  30. ConsoleMethodWithDocs(GuiScrollCtrl, scrollToTop, void, 2, 2, "()")
  31. {
  32. object->scrollTo(object->mScrollOffset.x, 0);
  33. }
  34. /*! Scrolls the content area to the bottom.
  35. @return No return value.
  36. @sa scrollToTop
  37. @sa scrollToLeft
  38. @sa scrollToRight
  39. @sa scrollToPosition
  40. */
  41. ConsoleMethod(GuiScrollCtrl, scrollToBottom, void, 2, 2, "()")
  42. {
  43. object->scrollTo(object->mScrollOffset.x, 0x7FFFFFFF);
  44. }
  45. /*! Scrolls the content area to the left.
  46. @return No return value.
  47. @sa scrollToTop
  48. @sa scrollToBottom
  49. @sa scrollToRight
  50. @sa scrollToPosition
  51. */
  52. ConsoleMethodWithDocs(GuiScrollCtrl, scrollToLeft, void, 2, 2, "()")
  53. {
  54. object->scrollTo(0, object->mScrollOffset.y);
  55. }
  56. /*! Scrolls the content area to the right.
  57. @return No return value.
  58. @sa scrollToTop
  59. @sa scrollToBottom
  60. @sa scrollToLeft
  61. @sa scrollToPosition
  62. */
  63. ConsoleMethod(GuiScrollCtrl, scrollToRight, void, 2, 2, "()")
  64. {
  65. object->scrollTo(0x7FFFFFFF, object->mScrollOffset.x);
  66. }
  67. /*! Scrolls the content area to the specified position.
  68. @param x The horizontal target position.
  69. @param y The vertical target position.
  70. @return No return value.
  71. */
  72. ConsoleMethod(GuiScrollCtrl, setScrollPosition, void, 4, 4, "(x, y)")
  73. {
  74. object->scrollTo(dAtoi(argv[2]), dAtoi(argv[3]));
  75. }
  76. /*! Gets the current horizontal scroll position.
  77. @return The position of the content in the horizontal direction.
  78. */
  79. ConsoleMethod(GuiScrollCtrl, getScrollPositionX, S32, 2, 2, "()")
  80. {
  81. return object->mScrollOffset.x;
  82. }
  83. /*! Gets the current vertical scroll position.
  84. @return The position of the content in the vertical direction.
  85. */
  86. ConsoleMethod(GuiScrollCtrl, getScrollPositionY, S32, 2, 2, "()")
  87. {
  88. return object->mScrollOffset.y;
  89. }
  90. /*! Refreshes all the contents of the scroll container.
  91. @return No return value.
  92. */
  93. ConsoleMethod(GuiScrollCtrl, computeSizes, void, 2, 2, "()")
  94. {
  95. object->computeSizes();
  96. }