Text.pkg 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. $#include "UI/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. bool SetFontSize(int size);
  15. void SetText(const String text);
  16. void SetTextAlignment(HorizontalAlignment align);
  17. void SetRowSpacing(float spacing);
  18. void SetWordwrap(bool enable);
  19. void SetSelection(unsigned start, unsigned length = M_MAX_UNSIGNED);
  20. void ClearSelection();
  21. void SetSelectionColor(const Color& color);
  22. void SetHoverColor(const Color& color);
  23. void SetTextEffect(TextEffect textEffect);
  24. void SetEffectShadowOffset(const IntVector2& offset);
  25. void SetEffectStrokeThickness(int thickness);
  26. void SetEffectRoundStroke(bool roundStroke);
  27. void SetEffectColor(const Color& effectColor);
  28. bool GetAutoLocalizable() const;
  29. void SetAutoLocalizable(bool enable);
  30. Font* GetFont() const;
  31. int GetFontSize() const;
  32. const String GetText() const;
  33. HorizontalAlignment GetTextAlignment() const;
  34. float GetRowSpacing() const;
  35. bool GetWordwrap() const;
  36. unsigned GetSelectionStart() const;
  37. unsigned GetSelectionLength() const;
  38. const Color& GetSelectionColor() const;
  39. const Color& GetHoverColor() const;
  40. TextEffect GetTextEffect() const;
  41. const IntVector2& GetEffectShadowOffset() const;
  42. int GetEffectStrokeThickness() const;
  43. bool GetEffectRoundStroke() const;
  44. const Color& GetEffectColor() const;
  45. int GetRowHeight() const;
  46. unsigned GetNumRows() const;
  47. unsigned GetNumChars() const;
  48. int GetRowWidth(unsigned index) const;
  49. IntVector2 GetCharPosition(unsigned index);
  50. IntVector2 GetCharSize(unsigned index);
  51. void SetEffectDepthBias(float bias);
  52. float GetEffectDepthBias() const;
  53. tolua_property__get_set Font* font;
  54. tolua_property__get_set int fontSize;
  55. tolua_property__get_set String text;
  56. tolua_property__get_set HorizontalAlignment textAlignment;
  57. tolua_property__get_set float rowSpacing;
  58. tolua_property__get_set bool wordwrap;
  59. tolua_property__get_set bool autoLocalizable;
  60. tolua_readonly tolua_property__get_set unsigned selectionStart;
  61. tolua_readonly tolua_property__get_set unsigned selectionLength;
  62. tolua_property__get_set Color& selectionColor;
  63. tolua_property__get_set Color& hoverColor;
  64. tolua_property__get_set TextEffect textEffect;
  65. tolua_property__get_set IntVector2& effectShadowOffset;
  66. tolua_property__get_set int effectStrokeThickness;
  67. tolua_property__get_set bool effectRoundStroke;
  68. tolua_property__get_set Color& effectColor;
  69. tolua_readonly tolua_property__get_set int rowHeight;
  70. tolua_readonly tolua_property__get_set unsigned numRows;
  71. tolua_readonly tolua_property__get_set unsigned numChars;
  72. };
  73. ${
  74. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
  75. static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
  76. {
  77. return ToluaNewObject<Text>(tolua_S);
  78. }
  79. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
  80. static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
  81. {
  82. return ToluaNewObjectGC<Text>(tolua_S);
  83. }
  84. $}