Text.pkg 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. $#include "Text.h"
  2. enum TextEffect
  3. {
  4. TE_NONE = 0,
  5. TE_SHADOW,
  6. TE_STROKE
  7. };
  8. class Text : public UIElement
  9. {
  10. Text(Context* context);
  11. virtual ~Text();
  12. bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
  13. bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
  14. void SetText(const String text);
  15. void SetTextAlignment(HorizontalAlignment align);
  16. void SetRowSpacing(float spacing);
  17. void SetWordwrap(bool enable);
  18. void SetSelection(unsigned start, unsigned length = M_MAX_UNSIGNED);
  19. void ClearSelection();
  20. void SetSelectionColor(const Color& color);
  21. void SetHoverColor(const Color& color);
  22. void SetTextEffect(TextEffect textEffect);
  23. void SetEffectColor(const Color& effectColor);
  24. Font* GetFont() const;
  25. int GetFontSize() const;
  26. const String GetText() const;
  27. HorizontalAlignment GetTextAlignment() const;
  28. float GetRowSpacing() const;
  29. bool GetWordwrap() const;
  30. unsigned GetSelectionStart() const;
  31. unsigned GetSelectionLength() const;
  32. const Color& GetSelectionColor() const;
  33. const Color& GetHoverColor() const;
  34. TextEffect GetTextEffect() const;
  35. const Color& GetEffectColor() const;
  36. int GetRowHeight() const;
  37. unsigned GetNumRows() const;
  38. const PODVector<int>& GetRowWidths() const;
  39. const PODVector<IntVector2>& GetCharPositions() const;
  40. const PODVector<IntVector2>& GetCharSizes() const;
  41. void SetEffectDepthBias(float bias);
  42. float GetEffectDepthBias() const;
  43. void SetFontAttr(ResourceRef value);
  44. ResourceRef GetFontAttr() const;
  45. tolua_property__get_set Font* font;
  46. tolua_readonly tolua_property__get_set int fontSize;
  47. tolua_property__get_set String& text;
  48. tolua_property__get_set HorizontalAlignment textAlignment;
  49. tolua_property__get_set float rowSpacing;
  50. tolua_property__get_set bool wordwrap;
  51. tolua_readonly tolua_property__get_set unsigned selectionStart;
  52. tolua_readonly tolua_property__get_set unsigned selectionLength;
  53. tolua_property__get_set Color& selectionColor;
  54. tolua_property__get_set Color& hoverColor;
  55. tolua_property__get_set TextEffect textEffect;
  56. tolua_property__get_set Color& effectColor;
  57. tolua_readonly tolua_property__get_set int rowHeight;
  58. tolua_readonly tolua_property__get_set unsigned numRows;
  59. tolua_property__get_set ResourceRef fontAttr;
  60. };