guiButtonCtrl_ScriptBinding.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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(GuiButtonCtrl, GuiControl)
  23. /*! Sets the easing that should be used to change the fill color to the highlight color. Time in milliseconds can optionally be provided.
  24. @param EaseFunction Name of the selected easing function to use. Defaults to Linear (none).
  25. @param EaseTime Optional length of time in milliseconds that it takes to change.
  26. @return No return value.
  27. */
  28. ConsoleMethodWithDocs(GuiButtonCtrl, setFillColorHLEase, ConsoleVoid, 3, 4, (EaseFunction, [EaseTime]))
  29. {
  30. if (argc >= 4)
  31. {
  32. object->mEaseTimeFillColorHL = dAtoi(argv[3]);
  33. }
  34. EasingFunction f = Linear;
  35. for (U32 i = 0; i < (sizeof(easingEnums) / sizeof(EnumTable::Enums)); i++)
  36. {
  37. if (dStricmp(easingEnums[i].label, argv[2]) == 0)
  38. f = (EasingFunction)easingEnums[i].index;
  39. }
  40. object->mEaseFillColorHL = f;
  41. }
  42. /*! Sets the easing that should be used to change the fill color to the selected color. Time in milliseconds can optionally be provided.
  43. @param EaseFunction Name of the selected easing function to use. Defaults to Linear (none).
  44. @param EaseTime Optional length of time in milliseconds that it takes to change.
  45. @return No return value.
  46. */
  47. ConsoleMethodWithDocs(GuiButtonCtrl, setFillColorSLEase, ConsoleVoid, 3, 4, (EaseFunction, [EaseTime]))
  48. {
  49. if (argc >= 4)
  50. {
  51. object->mEaseTimeFillColorSL = dAtoi(argv[3]);
  52. }
  53. EasingFunction f = Linear;
  54. for (U32 i = 0; i < (sizeof(easingEnums) / sizeof(EnumTable::Enums)); i++)
  55. {
  56. if (dStricmp(easingEnums[i].label, argv[2]) == 0)
  57. f = (EasingFunction)easingEnums[i].index;
  58. }
  59. object->mEaseFillColorSL = f;
  60. }
  61. /*! Gets the name of the current easing function used to change the fill color to the highlight color.
  62. @return Name of the current easing function.
  63. */
  64. ConsoleMethodWithDocs(GuiButtonCtrl, getFillColorHLEaseFunction, ConsoleString, 2, 2, ())
  65. {
  66. return object->getEasingFunctionDescription(object->mEaseFillColorHL);
  67. }
  68. /*! Gets the name of the current easing function used to change the fill color to the select color.
  69. @return Name of the current easing function.
  70. */
  71. ConsoleMethodWithDocs(GuiButtonCtrl, getFillColorSLEaseFunction, ConsoleString, 2, 2, ())
  72. {
  73. return object->getEasingFunctionDescription(object->mEaseFillColorSL);
  74. }
  75. /*! Gets the amount of time in milliseconds that it takes to change fill color to the highlight color.
  76. @return Time in milliseconds.
  77. */
  78. ConsoleMethodWithDocs(GuiButtonCtrl, getFillColorHLEaseTime, ConsoleInt, 2, 2, ())
  79. {
  80. return object->mEaseTimeFillColorHL;
  81. }
  82. /*! Gets the amount of time in milliseconds that it takes to change fill color to the selected color.
  83. @return Time in milliseconds.
  84. */
  85. ConsoleMethodWithDocs(GuiButtonCtrl, getFillColorSLEaseTime, ConsoleInt, 2, 2, ())
  86. {
  87. return object->mEaseTimeFillColorSL;
  88. }
  89. ConsoleMethodGroupEndWithDocs(GuiButtonCtrl)