UILabel.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef __UILABEL_H__
  2. #define __UILABEL_H__
  3. #pragma once
  4. #define _USE_GDIPLUS 1
  5. #ifdef _USE_GDIPLUS
  6. #include <GdiPlus.h>
  7. #pragma comment( lib, "GdiPlus.lib" )
  8. // UMU: DO NOT use "using namespace" in .h file
  9. //using namespace Gdiplus;
  10. class DUILIB_API Gdiplus::RectF;
  11. struct DUILIB_API Gdiplus::GdiplusStartupInput;
  12. using Gdiplus::RectF;
  13. using Gdiplus::GdiplusStartupInput;
  14. #endif
  15. namespace DuiLib
  16. {
  17. class DUILIB_API CLabelUI : public CControlUI
  18. {
  19. public:
  20. CLabelUI();
  21. ~CLabelUI();
  22. LPCTSTR GetClass() const;
  23. LPVOID GetInterface(LPCTSTR pstrName);
  24. void SetFixedWidth(int cx);
  25. void SetFixedHeight(int cy);
  26. void SetText(LPCTSTR pstrText);
  27. void SetTextStyle(UINT uStyle);
  28. UINT GetTextStyle() const;
  29. bool IsMultiLine();
  30. void SetMultiLine(bool bMultiLine = true);
  31. void SetTextColor(DWORD dwTextColor);
  32. DWORD GetTextColor() const;
  33. void SetDisabledTextColor(DWORD dwTextColor);
  34. DWORD GetDisabledTextColor() const;
  35. void SetFont(int index);
  36. int GetFont() const;
  37. RECT GetTextPadding() const;
  38. void SetTextPadding(RECT rc);
  39. bool IsShowHtml();
  40. void SetShowHtml(bool bShowHtml = true);
  41. SIZE EstimateSize(SIZE szAvailable);
  42. void DoEvent(TEventUI& event);
  43. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  44. void PaintText(HDC hDC);
  45. #ifdef _USE_GDIPLUS
  46. void SetEnabledEffect(bool _EnabledEffect);
  47. bool GetEnabledEffect();
  48. void SetEnabledLuminous(bool bEnableLuminous);
  49. bool GetEnabledLuminous();
  50. void SetLuminousFuzzy(float fFuzzy);
  51. float GetLuminousFuzzy();
  52. void SetGradientLength(int _GradientLength);
  53. int GetGradientLength();
  54. void SetShadowOffset(int _offset,int _angle);
  55. RectF GetShadowOffset();
  56. void SetTextColor1(DWORD _TextColor1);
  57. DWORD GetTextColor1();
  58. void SetTextShadowColorA(DWORD _TextShadowColorA);
  59. DWORD GetTextShadowColorA();
  60. void SetTextShadowColorB(DWORD _TextShadowColorB);
  61. DWORD GetTextShadowColorB();
  62. void SetStrokeColor(DWORD _StrokeColor);
  63. DWORD GetStrokeColor();
  64. void SetGradientAngle(int _SetGradientAngle);
  65. int GetGradientAngle();
  66. void SetEnabledStroke(bool _EnabledStroke);
  67. bool GetEnabledStroke();
  68. void SetEnabledShadow(bool _EnabledShadowe);
  69. bool GetEnabledShadow();
  70. #endif
  71. protected:
  72. LPWSTR m_pWideText;
  73. DWORD m_dwTextColor;
  74. DWORD m_dwDisabledTextColor;
  75. int m_iFont;
  76. UINT m_uTextStyle;
  77. RECT m_rcTextPadding;
  78. bool m_bShowHtml;
  79. SIZE m_szAvailableLast;
  80. SIZE m_cxyFixedLast;
  81. bool m_bNeedEstimateSize;
  82. float m_fLuminousFuzzy;
  83. int m_GradientLength;
  84. int m_GradientAngle;
  85. bool m_EnableEffect;
  86. bool m_bEnableLuminous;
  87. bool m_EnabledStroke;
  88. bool m_EnabledShadow;
  89. DWORD m_dwTextColor1;
  90. DWORD m_dwTextShadowColorA;
  91. DWORD m_dwTextShadowColorB;
  92. DWORD m_dwStrokeColor;
  93. RectF m_ShadowOffset;
  94. ULONG_PTR m_gdiplusToken;
  95. #ifdef _USE_GDIPLUS
  96. GdiplusStartupInput m_gdiplusStartupInput;
  97. #endif
  98. };
  99. }
  100. #endif // __UILABEL_H__