goo.textinput.luadoc 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. --[[ A box you can input text to. Supports all characters, lowercase and uppercase. Multiline text and caret movement. ]]
  2. module 'goo.textinput'
  3. function goo.textinput:keyReturn()
  4. function goo.textinput:keyBackspace()
  5. function goo.textinput:keyLeft()
  6. function goo.textinput:keyRight()
  7. function goo.textinput:keyUp()
  8. function goo.textinput:keyDown()
  9. --[[ Insert text on the current line at the specified position.
  10. @param text:string the text to insert.
  11. @param pos:number the position to insert it at.
  12. ]]
  13. function goo.textinput:insert( text, pos )
  14. --[[ Remove text on the current line at the specified position.
  15. @param pos:number the position to start removing.
  16. @param length:number the number of character after pos to remove.
  17. ]]
  18. function goo.textinput:remove( pos, length )
  19. --[[ Create a new line
  20. @param line_pos:number the line number to add the newline after.
  21. ]]
  22. function goo.textinput:newline( line_pos )
  23. --[[ Removes a line of text.
  24. @param line_pos:number thr line number to remove.
  25. ]]
  26. function goo.textinput:removeline( line_pos )
  27. --[[ Get the text inside the textinput.
  28. @return string: the text.
  29. ]]
  30. function goo.textinput:getText()
  31. --[[ Sets the text of the box, new lines ignored if not multiline.
  32. @see goo.textinput:setMultiline
  33. ]]
  34. function goo.textinput:setText( text )
  35. --[[ Get the position of the caret on the current line.
  36. <br/>The position is relative to the line it's on.
  37. @return number: the position of the caret, 1 is first character.
  38. @see goo.textinput:getLinePos, goo.textinput:setCaretPos
  39. ]]
  40. function goo.textinput:getCaretPos()
  41. --[[ Set the position of the caret on the current line
  42. @param caretpos:number the position of the caret, 1 is first character
  43. @see goo.textinput:setCaretPos
  44. ]]
  45. function goo.textinput:setCaretPos( caretpos )
  46. --[[ Get the line number the caret is on.
  47. @return number: the line the caret is on, 1 is first line.
  48. @see goo.textinput:setLinePos, goo.textinput:getCaretPos
  49. ]]
  50. function goo.textinput:getLinePos()
  51. --[[ Sets the line position of the caret ]]
  52. function goo.textinput:setLinePos( linepos )
  53. --[[ Get's if the textinput is in multiline mode ]]
  54. function goo.textinput:getMultiline()
  55. --[[ Set the text input's multiline mode.
  56. @param multiline:bool true to allow multiple lines, false to not.
  57. ]]
  58. function goo.textinput:setMultiline( multiline )
  59. --[[ Callback function called when the return key is pressed ]]
  60. function goo.textinput:onKeyReturn()
  61. --[[ Callback function when the key is pressed.
  62. <br/>this will not override the functionality of the text input,
  63. <br/>if you wish to override keypresses use goo.textinput:keypressed() instead.
  64. @param key:string the keyConstant of the key pressed.
  65. @param unicode:number the unicode value of the key pressed.
  66. ]]
  67. function goo.textinput:onKeypressed()