guiProgressCtrl_ScriptBinding.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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(GuiProgressCtrl, GuiControl)
  23. /*! Sets the current progress. The smoothly animate to the given progress over the optional time or previously used time.
  24. @param progress The updated progress of the progress bar as a decimal value between 0 and 1.
  25. @param time The optional time in milliseconds it will take to animate from the progress bar's current position to the updated one.
  26. @return No return value.
  27. */
  28. ConsoleMethodWithDocs(GuiProgressCtrl, setProgress, ConsoleVoid, 3, 4, "( F32 progress, [S32 time] )")
  29. {
  30. if (argc == 3)
  31. {
  32. object->setCurrentProgress(dAtof(argv[2]));
  33. }
  34. else if (argc == 4)
  35. {
  36. object->setCurrentProgress(dAtof(argv[2]), dAtoi(argv[3]));
  37. }
  38. else
  39. {
  40. Con::warnf("GuiProgressCtrl::setProgress() - Wrong number of parameters!");
  41. }
  42. }
  43. /*! Returns the current progress.
  44. @return The progress as a decimal value between 0 and 1.
  45. */
  46. ConsoleMethodWithDocs(GuiProgressCtrl, getProgress, ConsoleFloat, 2, 2, "()")
  47. {
  48. return object->getCurrentProgress();
  49. }
  50. /*! Returns the currently displayed progress. This may be differnt if the animation to the most recently set progress is still running.
  51. @return The displayed progress as a decimal value between 0 and 1.
  52. */
  53. ConsoleMethodWithDocs(GuiProgressCtrl, getDisplayProgress, ConsoleFloat, 2, 2, "()")
  54. {
  55. return object->getDisplayedProgress();
  56. }
  57. /*! Sets the progress bar back to the start.
  58. @return No return value.
  59. */
  60. ConsoleMethodWithDocs(GuiProgressCtrl, resetProgress, ConsoleVoid, 2, 2, "()")
  61. {
  62. return object->resetProgress();
  63. }
  64. /*! Sets the amount of time in milliseconds that it will take to animate each time the progress is updated.
  65. @param time The animation time in milliseconds.
  66. @return No return value.
  67. */
  68. ConsoleMethodWithDocs(GuiProgressCtrl, setAnimationTime, ConsoleVoid, 3, 3, "( S32 time )")
  69. {
  70. if (argc == 3)
  71. {
  72. object->setAnimationLength(dAtoi(argv[2]));
  73. }
  74. else
  75. {
  76. Con::warnf("GuiProgressCtrl::setAnimationTime() - Wrong number of parameters!");
  77. }
  78. }
  79. /*! Gets the time it takes in milliseconds for the progress bar to animate to its set progress.
  80. @return No return value.
  81. */
  82. ConsoleMethodWithDocs(GuiProgressCtrl, getAnimationTime, ConsoleInt, 2, 2, "()")
  83. {
  84. return object->getAnimationLength();
  85. }
  86. ConsoleMethodGroupEndWithDocs(GuiProgressCtrl)