LineEdit.pkg 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $#include "LineEdit.h"
  2. /// Single-line text editor %UI element.
  3. class LineEdit : public BorderImage
  4. {
  5. public:
  6. /// Set text.
  7. void SetText(const String& text);
  8. /// Set cursor position.
  9. void SetCursorPosition(unsigned position);
  10. /// Set cursor blink rate. 0 disables blinking.
  11. void SetCursorBlinkRate(float rate);
  12. /// Set maximum text length. 0 for unlimited.
  13. void SetMaxLength(unsigned length);
  14. /// Set echo character for password entry and such. 0 (default) shows the actual text.
  15. void SetEchoCharacter(unsigned c);
  16. /// Set whether can move cursor with arrows or mouse, default true.
  17. void SetCursorMovable(bool enable);
  18. /// Set whether selections are allowed, default true.
  19. void SetTextSelectable(bool enable);
  20. /// Set whether copy-paste operations are allowed, default true.
  21. void SetTextCopyable(bool enable);
  22. /// Set text selection doubleclick interval in seconds.
  23. void SetDoubleClickInterval(float interval);
  24. /// Return text.
  25. const String& GetText() const { return line_; }
  26. /// Return cursor position.
  27. unsigned GetCursorPosition() const { return cursorPosition_; }
  28. /// Return cursor blink rate.
  29. float GetCursorBlinkRate() const { return cursorBlinkRate_; }
  30. /// Return maximum text length.
  31. unsigned GetMaxLength() const { return maxLength_; }
  32. /// Return echo character.
  33. unsigned GetEchoCharacter() const { return echoCharacter_; }
  34. /// Return whether can move cursor with arrows or mouse.
  35. bool IsCursorMovable() const { return cursorMovable_; }
  36. /// Return whether selections are allowed.
  37. bool IsTextSelectable() const { return textSelectable_; }
  38. /// Return whether copy-paste operations are allowed.
  39. bool IsTextCopyable() const { return textCopyable_; }
  40. /// Return text element.
  41. Text* GetTextElement() const { return text_; }
  42. /// Return cursor element.
  43. BorderImage* GetCursor() const { return cursor_; }
  44. /// Return text selection doubleclick interval in seconds.
  45. float GetDoubleClickInterval() const;
  46. };