Text.pkg 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. unsigned GetNumChars() const;
  39. int GetRowWidth(unsigned index) const;
  40. IntVector2 GetCharPosition(unsigned index);
  41. IntVector2 GetCharSize(unsigned index);
  42. void SetEffectDepthBias(float bias);
  43. float GetEffectDepthBias() const;
  44. tolua_property__get_set Font* font;
  45. tolua_readonly tolua_property__get_set int fontSize;
  46. tolua_property__get_set String text;
  47. tolua_property__get_set HorizontalAlignment textAlignment;
  48. tolua_property__get_set float rowSpacing;
  49. tolua_property__get_set bool wordwrap;
  50. tolua_readonly tolua_property__get_set unsigned selectionStart;
  51. tolua_readonly tolua_property__get_set unsigned selectionLength;
  52. tolua_property__get_set Color& selectionColor;
  53. tolua_property__get_set Color& hoverColor;
  54. tolua_property__get_set TextEffect textEffect;
  55. tolua_property__get_set Color& effectColor;
  56. tolua_readonly tolua_property__get_set int rowHeight;
  57. tolua_readonly tolua_property__get_set unsigned numRows;
  58. tolua_readonly tolua_property__get_set unsigned numChars;
  59. };
  60. ${
  61. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00
  62. static int tolua_UILuaAPI_Text_new00(lua_State* tolua_S)
  63. {
  64. return ToluaNewObject<Text>(tolua_S);
  65. }
  66. #define TOLUA_DISABLE_tolua_UILuaAPI_Text_new00_local
  67. static int tolua_UILuaAPI_Text_new00_local(lua_State* tolua_S)
  68. {
  69. return ToluaNewObjectGC<Text>(tolua_S);
  70. }
  71. $}