guiTextEditCtrl_ScriptBinding.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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(GuiTextEditCtrl, GuiControl)
  23. /*! Gets the current position of the text cursor in the control.
  24. @return The current position of the text cursor in the control, where 0 is at the beginning of the line, 1 is after the first letter, and so on.
  25. */
  26. ConsoleMethodWithDocs(GuiTextEditCtrl, getCursorPos, ConsoleInt, 2, 2, "()")
  27. {
  28. return(object->getIbeamPosition());
  29. }
  30. /*! Sets the current position of the text cursor in the control.
  31. @param newPos The new position to place the cursor at, where 0 is at the beginning of the line, 1 is after the first letter, and so on.
  32. @return No return value.
  33. */
  34. ConsoleMethodWithDocs(GuiTextEditCtrl, setCursorPos, ConsoleVoid, 3, 3, "( newPos )")
  35. {
  36. object->setIbeamPosition(dAtoi(argv[2]));
  37. }
  38. /*! Selects all the text in the control.
  39. @return No return value.
  40. */
  41. ConsoleMethodWithDocs(GuiTextEditCtrl, selectAllText, ConsoleVoid, 2, 2, "()")
  42. {
  43. object->selectAllText();
  44. }
  45. /*! Calls the validation function for the control. This is depreciated. Please use validate() instead.
  46. @return No return value.
  47. */
  48. ConsoleMethodWithDocs(GuiTextEditCtrl, forceValidateText, ConsoleBool, 2, 2, "()")
  49. {
  50. Con::warnf("GuiTextEditCtrl::forceValidateText() is depreciated. Please use GuiTextEditCtrl::validate() instead.");
  51. return object->validate();
  52. }
  53. /*! Calls the validation function for the control.
  54. @return No return value.
  55. */
  56. ConsoleMethodWithDocs(GuiTextEditCtrl, validate, ConsoleBool, 2, 2, "()")
  57. {
  58. return object->validate();
  59. }
  60. /*! Sets the returnCausesTab flag. If true, the pressing enter will attempt to tab to the next control. False will keep the focus in this control.
  61. @param setting True to turn on the flag. False otherwise.
  62. @return No return value
  63. */
  64. ConsoleMethodWithDocs(GuiTextEditCtrl, setReturnCausesTab, ConsoleVoid, 3, 3, (setting))
  65. {
  66. object->setReturnCausesTab(dAtob(argv[2]));
  67. }
  68. /*! Returns if the returnCausesTab flag is on.
  69. @return Returns the state of the returnCausesTab flag.
  70. */
  71. ConsoleMethodWithDocs(GuiTextEditCtrl, getReturnCausesTab, ConsoleBool, 2, 2, ())
  72. {
  73. return object->getReturnCausesTab();
  74. }
  75. /*! Sets the sinkAllKeyEvents flag.
  76. @param setting True to turn on the flag. False otherwise.
  77. @return No return value
  78. */
  79. ConsoleMethodWithDocs(GuiTextEditCtrl, setSinkAllKeyEvents, ConsoleVoid, 3, 3, (setting))
  80. {
  81. object->setSinkAllKeyEvents(dAtob(argv[2]));
  82. }
  83. /*! Returns if the sinkAllKeyEvents flag is on.
  84. @return Returns the state of the sinkAllKeyEvents flag.
  85. */
  86. ConsoleMethodWithDocs(GuiTextEditCtrl, getSinkAllKeyEvents, ConsoleBool, 2, 2, ())
  87. {
  88. return object->getSinkAllKeyEvents();
  89. }
  90. /*! Sets the password flag.
  91. @param setting True to turn on the flag. False otherwise.
  92. @return No return value
  93. */
  94. ConsoleMethodWithDocs(GuiTextEditCtrl, setIsPassword, ConsoleVoid, 3, 3, (setting))
  95. {
  96. object->setIsPassword(dAtob(argv[2]));
  97. }
  98. /*! Returns if the password flag is on.
  99. @return Returns the state of the password flag.
  100. */
  101. ConsoleMethodWithDocs(GuiTextEditCtrl, getIsPassword, ConsoleBool, 2, 2, ())
  102. {
  103. return object->getIsPassword();
  104. }
  105. /*! Sets the maxLength which is the max number of characters that can be entered in the text edit box.
  106. @param max An integer value between 1 and 1024.
  107. @return No return value
  108. */
  109. ConsoleMethodWithDocs(GuiTextEditCtrl, setMaxLength, ConsoleVoid, 3, 3, (max))
  110. {
  111. object->setMaxLength(dAtoi(argv[2]));
  112. }
  113. /*! Returns if the current maxLength.
  114. @return Returns the maxLength.
  115. */
  116. ConsoleMethodWithDocs(GuiTextEditCtrl, getMaxLength, ConsoleBool, 2, 2, ())
  117. {
  118. return object->getMaxLength();
  119. }
  120. /*! Sets the InputMode. Possible values include AllText, Decimal, Number, Alpha, and AlphaNumeric.
  121. @param mode The InputMode to use.
  122. @return No return value.
  123. */
  124. ConsoleMethodWithDocs(GuiTextEditCtrl, setInputMode, ConsoleVoid, 3, 3, (mode))
  125. {
  126. // Fetch body type.
  127. const GuiTextEditCtrl::InputMode mode = GuiTextEditCtrl::getInputModeEnum(argv[2]);
  128. // Set body type.
  129. object->setInputMode(mode);
  130. }
  131. /*! Gets the text edit InputMode.
  132. @return The InputMode.
  133. */
  134. ConsoleMethodWithDocs(GuiTextEditCtrl, getInputMode, ConsoleString, 2, 2, ())
  135. {
  136. return GuiTextEditCtrl::getInputModeDescription(object->getInputMode());
  137. }
  138. ConsoleMethodGroupEndWithDocs(GuiTextEditCtrl)