Text.pkg 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. $#include "UI/Text.h"
  2. enum TextEffect
  3. {
  4. TE_NONE = 0,
  5. TE_SHADOW,
  6. TE_STROKE
  7. };
  8. class Text : public UISelectable
  9. {
  10. Text();
  11. virtual ~Text();
  12. bool SetFont(const String fontName, float size = DEFAULT_FONT_SIZE);
  13. bool SetFont(Font* font, float size = DEFAULT_FONT_SIZE);
  14. bool SetFontSize(float 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 SetTextEffect(TextEffect textEffect);
  22. void SetEffectShadowOffset(const IntVector2& offset);
  23. void SetEffectStrokeThickness(int thickness);
  24. void SetEffectRoundStroke(bool roundStroke);
  25. void SetEffectColor(const Color& effectColor);
  26. bool GetAutoLocalizable() const;
  27. void SetAutoLocalizable(bool enable);
  28. Font* GetFont() const;
  29. float GetFontSize() const;
  30. const String GetText() const;
  31. HorizontalAlignment GetTextAlignment() const;
  32. float GetRowSpacing() const;
  33. bool GetWordwrap() const;
  34. unsigned GetSelectionStart() const;
  35. unsigned GetSelectionLength() const;
  36. TextEffect GetTextEffect() const;
  37. const IntVector2& GetEffectShadowOffset() const;
  38. int GetEffectStrokeThickness() const;
  39. bool GetEffectRoundStroke() const;
  40. const Color& GetEffectColor() const;
  41. float GetRowHeight() const;
  42. unsigned GetNumRows() const;
  43. unsigned GetNumChars() const;
  44. float GetRowWidth(unsigned index) const;
  45. Vector2 GetCharPosition(unsigned index);
  46. Vector2 GetCharSize(unsigned index);
  47. void SetEffectDepthBias(float bias);
  48. float GetEffectDepthBias() const;
  49. tolua_property__get_set Font* font;
  50. tolua_property__get_set float fontSize;
  51. tolua_property__get_set String text;
  52. tolua_property__get_set HorizontalAlignment textAlignment;
  53. tolua_property__get_set float rowSpacing;
  54. tolua_property__get_set bool wordwrap;
  55. tolua_property__get_set bool autoLocalizable;
  56. tolua_readonly tolua_property__get_set unsigned selectionStart;
  57. tolua_readonly tolua_property__get_set unsigned selectionLength;
  58. tolua_property__get_set TextEffect textEffect;
  59. tolua_property__get_set IntVector2& effectShadowOffset;
  60. tolua_property__get_set int effectStrokeThickness;
  61. tolua_property__get_set bool effectRoundStroke;
  62. tolua_property__get_set Color& effectColor;
  63. tolua_readonly tolua_property__get_set float rowHeight;
  64. tolua_readonly tolua_property__get_set unsigned numRows;
  65. tolua_readonly tolua_property__get_set unsigned numChars;
  66. };
  67. ${
  68. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
  69. static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
  70. {
  71. return ToluaNewObject<Text>(tolua_S);
  72. }
  73. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
  74. static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
  75. {
  76. return ToluaNewObjectGC<Text>(tolua_S);
  77. }
  78. $}