Text.pkg 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. $#include "Text.h"
  2. class Text : public UIElement
  3. {
  4. public:
  5. // Methods:
  6. Text(Context* context);
  7. virtual ~Text();
  8. bool SetFont(const String& fontName, int size = DEFAULT_FONT_SIZE);
  9. bool SetFont(const String& fontName);
  10. bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
  11. bool SetFont(Font* font);
  12. void SetText(const String& text);
  13. void SetTextAlignment(HorizontalAlignment align);
  14. void SetRowSpacing(float spacing);
  15. void SetWordwrap(bool enable);
  16. void SetSelection(unsigned start, unsigned length = M_MAX_UNSIGNED);
  17. void SetSelection(unsigned start);
  18. void ClearSelection();
  19. void SetSelectionColor(const Color& color);
  20. void SetHoverColor(const Color& color);
  21. Font* GetFont() const;
  22. int GetFontSize() const;
  23. const String& GetText() const;
  24. HorizontalAlignment GetTextAlignment() const;
  25. float GetRowSpacing() const;
  26. bool GetWordwrap() const;
  27. unsigned GetSelectionStart() const;
  28. unsigned GetSelectionLength() const;
  29. const Color& GetSelectionColor() const;
  30. const Color& GetHoverColor() const;
  31. int GetRowHeight() const;
  32. unsigned GetNumRows() const;
  33. // Properties:
  34. tolua_property__get_set Font* font;
  35. tolua_readonly tolua_property__get_set int fontSize;
  36. tolua_property__get_set String& text;
  37. tolua_property__get_set HorizontalAlignment textAlignment;
  38. tolua_property__get_set float rowSpacing;
  39. tolua_property__get_set bool wordwrap;
  40. tolua_readonly tolua_property__get_set unsigned selectionStart;
  41. tolua_readonly tolua_property__get_set unsigned selectionLength;
  42. tolua_property__get_set Color& selectionColor;
  43. tolua_property__get_set Color& hoverColor;
  44. tolua_readonly tolua_property__get_set int rowHeight;
  45. tolua_readonly tolua_property__get_set unsigned numRows;
  46. };