Text.pkg 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. 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. bool GetAutoLocalizable() const;
  25. void SetAutoLocalizable(bool enable);
  26. Font* GetFont() const;
  27. int GetFontSize() const;
  28. const String GetText() const;
  29. HorizontalAlignment GetTextAlignment() const;
  30. float GetRowSpacing() const;
  31. bool GetWordwrap() const;
  32. unsigned GetSelectionStart() const;
  33. unsigned GetSelectionLength() const;
  34. const Color& GetSelectionColor() const;
  35. const Color& GetHoverColor() const;
  36. TextEffect GetTextEffect() const;
  37. const Color& GetEffectColor() const;
  38. int GetRowHeight() const;
  39. unsigned GetNumRows() const;
  40. unsigned GetNumChars() const;
  41. int GetRowWidth(unsigned index) const;
  42. IntVector2 GetCharPosition(unsigned index);
  43. IntVector2 GetCharSize(unsigned index);
  44. void SetEffectDepthBias(float bias);
  45. float GetEffectDepthBias() const;
  46. tolua_property__get_set Font* font;
  47. tolua_readonly tolua_property__get_set int fontSize;
  48. tolua_property__get_set String text;
  49. tolua_property__get_set HorizontalAlignment textAlignment;
  50. tolua_property__get_set float rowSpacing;
  51. tolua_property__get_set bool wordwrap;
  52. tolua_property__get_set bool autoLocalizable;
  53. tolua_readonly tolua_property__get_set unsigned selectionStart;
  54. tolua_readonly tolua_property__get_set unsigned selectionLength;
  55. tolua_property__get_set Color& selectionColor;
  56. tolua_property__get_set Color& hoverColor;
  57. tolua_property__get_set TextEffect textEffect;
  58. tolua_property__get_set Color& effectColor;
  59. tolua_readonly tolua_property__get_set int rowHeight;
  60. tolua_readonly tolua_property__get_set unsigned numRows;
  61. tolua_readonly tolua_property__get_set unsigned numChars;
  62. };
  63. ${
  64. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
  65. static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
  66. {
  67. return ToluaNewObject<Text>(tolua_S);
  68. }
  69. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
  70. static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
  71. {
  72. return ToluaNewObjectGC<Text>(tolua_S);
  73. }
  74. $}