Text.pkg 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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();
  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. };
  61. ${
  62. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
  63. static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
  64. {
  65. return ToluaNewObject<Text>(tolua_S);
  66. }
  67. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
  68. static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
  69. {
  70. return ToluaNewObjectGC<Text>(tolua_S);
  71. }
  72. $}