LineEdit.pkg 2.2 KB

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