UILabel.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. #include "StdAfx.h"
  2. #include "UILabel.h"
  3. namespace DuiLib
  4. {
  5. Color ARGB2Color(DWORD dwColor)
  6. {
  7. return Color(HIBYTE((dwColor)>>16), GetBValue(dwColor), GetGValue(dwColor), GetRValue(dwColor));
  8. }
  9. CLabelUI::CLabelUI() :
  10. m_pWideText(0),
  11. m_uTextStyle(DT_VCENTER),
  12. m_dwTextColor(0),
  13. m_dwDisabledTextColor(0),
  14. m_iFont(-1),
  15. m_bShowHtml(false),
  16. m_EnableEffect(false),
  17. m_bEnableLuminous(false),
  18. m_fLuminousFuzzy(3),
  19. m_gdiplusToken(0),
  20. m_dwTextColor1(-1),
  21. m_dwTextShadowColorA(0xff000000),
  22. m_dwTextShadowColorB(-1),
  23. m_GradientAngle(0),
  24. m_EnabledStroke(false),
  25. m_dwStrokeColor(0),
  26. m_EnabledShadow(false),
  27. m_GradientLength(0)
  28. {
  29. m_ShadowOffset.X = 0.0f;
  30. m_ShadowOffset.Y = 0.0f;
  31. m_ShadowOffset.Width = 0.0f;
  32. m_ShadowOffset.Height = 0.0f;
  33. GdiplusStartup( &m_gdiplusToken,&m_gdiplusStartupInput, NULL);
  34. ::ZeroMemory(&m_rcTextPadding, sizeof(m_rcTextPadding));
  35. }
  36. CLabelUI::~CLabelUI()
  37. {
  38. #ifdef _UNICODE
  39. if( m_pWideText && m_pWideText != m_sText.GetData()) delete[] m_pWideText;
  40. #else
  41. if( m_pWideText ) delete[] m_pWideText;
  42. #endif
  43. GdiplusShutdown( m_gdiplusToken );
  44. }
  45. LPCTSTR CLabelUI::GetClass() const
  46. {
  47. return _T("LabelUI");
  48. }
  49. LPVOID CLabelUI::GetInterface(LPCTSTR pstrName)
  50. {
  51. if( _tcscmp(pstrName, _T("Label")) == 0 ) return static_cast<CLabelUI*>(this);
  52. return CControlUI::GetInterface(pstrName);
  53. }
  54. void CLabelUI::SetText(LPCTSTR pstrText)
  55. {
  56. CControlUI::SetText(pstrText);
  57. if( m_EnableEffect) {
  58. #ifdef _UNICODE
  59. m_pWideText = (LPWSTR)m_sText.GetData();
  60. #else
  61. int iLen = _tcslen(pstrText);
  62. if (m_pWideText) delete[] m_pWideText;
  63. m_pWideText = new WCHAR[iLen + 1];
  64. ::ZeroMemory(m_pWideText, (iLen + 1) * sizeof(WCHAR));
  65. ::MultiByteToWideChar(CP_ACP, 0, pstrText, -1, (LPWSTR)m_pWideText, iLen);
  66. #endif
  67. }
  68. }
  69. void CLabelUI::SetText (LPCSTR pstrText)
  70. {
  71. CControlUI::SetText (pstrText);
  72. if(m_EnableEffect)
  73. {
  74. #ifdef _UNICODE
  75. m_pWideText = (LPWSTR)m_sText.GetData ();
  76. #else
  77. int iLen = _tcslen (pstrText);
  78. if(m_pWideText) delete[] m_pWideText;
  79. m_pWideText = new WCHAR[iLen + 1];
  80. ::ZeroMemory (m_pWideText, (iLen + 1) * sizeof (WCHAR));
  81. ::MultiByteToWideChar (CP_ACP, 0, pstrText, -1, (LPWSTR)m_pWideText, iLen);
  82. #endif
  83. }
  84. }
  85. void CLabelUI::SetTextStyle (UINT uStyle)
  86. {
  87. m_uTextStyle = uStyle;
  88. Invalidate();
  89. }
  90. UINT CLabelUI::GetTextStyle() const
  91. {
  92. return m_uTextStyle;
  93. }
  94. void CLabelUI::SetTextColor(DWORD dwTextColor)
  95. {
  96. m_dwTextColor = dwTextColor;
  97. Invalidate();
  98. }
  99. DWORD CLabelUI::GetTextColor() const
  100. {
  101. return m_dwTextColor;
  102. }
  103. void CLabelUI::SetDisabledTextColor(DWORD dwTextColor)
  104. {
  105. m_dwDisabledTextColor = dwTextColor;
  106. Invalidate();
  107. }
  108. DWORD CLabelUI::GetDisabledTextColor() const
  109. {
  110. return m_dwDisabledTextColor;
  111. }
  112. void CLabelUI::SetFont(int index)
  113. {
  114. m_iFont = index;
  115. Invalidate();
  116. }
  117. int CLabelUI::GetFont() const
  118. {
  119. return m_iFont;
  120. }
  121. RECT CLabelUI::GetTextPadding() const
  122. {
  123. return m_rcTextPadding;
  124. }
  125. void CLabelUI::SetTextPadding(RECT rc)
  126. {
  127. m_rcTextPadding = rc;
  128. Invalidate();
  129. }
  130. bool CLabelUI::IsShowHtml()
  131. {
  132. return m_bShowHtml;
  133. }
  134. void CLabelUI::SetShowHtml(bool bShowHtml)
  135. {
  136. if( m_bShowHtml == bShowHtml ) return;
  137. m_bShowHtml = bShowHtml;
  138. Invalidate();
  139. }
  140. SIZE CLabelUI::EstimateSize(SIZE szAvailable)
  141. {
  142. if( m_cxyFixed.cy == 0 ) return CDuiSize(m_cxyFixed.cx, m_pManager->GetFontInfo(GetFont())->tm.tmHeight + 4);
  143. return CControlUI::EstimateSize(szAvailable);
  144. }
  145. void CLabelUI::DoEvent(TEventUI& event)
  146. {
  147. if( event.Type == UIEVENT_SETFOCUS )
  148. {
  149. m_bFocused = true;
  150. return;
  151. }
  152. if( event.Type == UIEVENT_KILLFOCUS )
  153. {
  154. m_bFocused = false;
  155. return;
  156. }
  157. if( event.Type == UIEVENT_MOUSEENTER )
  158. {
  159. // return;
  160. }
  161. if( event.Type == UIEVENT_MOUSELEAVE )
  162. {
  163. // return;
  164. }
  165. CControlUI::DoEvent(event);
  166. }
  167. void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
  168. {
  169. if( _tcscmp(pstrName, _T("align")) == 0 ) {
  170. if( _tcsstr(pstrValue, _T("left")) != NULL ) {
  171. m_uTextStyle &= ~(DT_CENTER | DT_RIGHT | DT_SINGLELINE);
  172. m_uTextStyle |= DT_LEFT;
  173. }
  174. if( _tcsstr(pstrValue, _T("center")) != NULL ) {
  175. m_uTextStyle &= ~(DT_LEFT | DT_RIGHT );
  176. m_uTextStyle |= DT_CENTER;
  177. }
  178. if( _tcsstr(pstrValue, _T("right")) != NULL ) {
  179. m_uTextStyle &= ~(DT_LEFT | DT_CENTER | DT_SINGLELINE);
  180. m_uTextStyle |= DT_RIGHT;
  181. }
  182. }
  183. else if (_tcscmp(pstrName, _T("valign")) == 0)
  184. {
  185. if (_tcsstr(pstrValue, _T("top")) != NULL) {
  186. m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER);
  187. m_uTextStyle |= (DT_TOP | DT_SINGLELINE);
  188. }
  189. if (_tcsstr(pstrValue, _T("vcenter")) != NULL) {
  190. m_uTextStyle &= ~(DT_TOP | DT_BOTTOM);
  191. m_uTextStyle |= (DT_VCENTER | DT_SINGLELINE);
  192. }
  193. if (_tcsstr(pstrValue, _T("bottom")) != NULL) {
  194. m_uTextStyle &= ~(DT_TOP | DT_VCENTER);
  195. m_uTextStyle |= (DT_BOTTOM | DT_SINGLELINE);
  196. }
  197. }
  198. else if( _tcscmp(pstrName, _T("endellipsis")) == 0 ) {
  199. if( _tcscmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS;
  200. else m_uTextStyle &= ~DT_END_ELLIPSIS;
  201. }
  202. else if( _tcscmp(pstrName, _T("font")) == 0 ) SetFont(_ttoi(pstrValue));
  203. else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) {
  204. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  205. LPTSTR pstr = NULL;
  206. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  207. SetTextColor(clrColor);
  208. }
  209. else if( _tcscmp(pstrName, _T("disabledtextcolor")) == 0 ) {
  210. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  211. LPTSTR pstr = NULL;
  212. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  213. SetDisabledTextColor(clrColor);
  214. }
  215. else if( _tcscmp(pstrName, _T("textpadding")) == 0 ) {
  216. RECT rcTextPadding = { 0 };
  217. LPTSTR pstr = NULL;
  218. rcTextPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
  219. rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
  220. rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
  221. rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
  222. SetTextPadding(rcTextPadding);
  223. }
  224. else if( _tcscmp(pstrName, _T("showhtml")) == 0 ) SetShowHtml(_tcscmp(pstrValue, _T("true")) == 0);
  225. else if( _tcscmp(pstrName, _T("enabledeffect")) == 0 ) SetEnabledEffect(_tcscmp(pstrValue, _T("true")) == 0);
  226. else if( _tcscmp(pstrName, _T("enabledluminous")) == 0 ) SetEnabledLuminous(_tcscmp(pstrValue, _T("true")) == 0);
  227. else if( _tcscmp(pstrName, _T("luminousfuzzy")) == 0 ) SetLuminousFuzzy((float)_tstof(pstrValue));
  228. else if( _tcscmp(pstrName, _T("gradientangle")) == 0 ) SetGradientAngle(_ttoi(pstrValue));
  229. else if( _tcscmp(pstrName, _T("enabledstroke")) == 0 ) SetEnabledStroke(_tcscmp(pstrValue, _T("true")) == 0);
  230. else if( _tcscmp(pstrName, _T("enabledshadow")) == 0 ) SetEnabledShadow(_tcscmp(pstrValue, _T("true")) == 0);
  231. else if( _tcscmp(pstrName, _T("gradientlength")) == 0 ) SetGradientLength(_ttoi(pstrValue));
  232. else if( _tcscmp(pstrName, _T("shadowoffset")) == 0 ){
  233. LPTSTR pstr = NULL;
  234. int offsetx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
  235. int offsety = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
  236. SetShadowOffset(offsetx,offsety);
  237. }
  238. else if( _tcscmp(pstrName, _T("textcolor1")) == 0 ) {
  239. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  240. LPTSTR pstr = NULL;
  241. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  242. SetTextColor1(clrColor);
  243. }
  244. else if( _tcscmp(pstrName, _T("textshadowcolora")) == 0 ) {
  245. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  246. LPTSTR pstr = NULL;
  247. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  248. SetTextShadowColorA(clrColor);
  249. }
  250. else if( _tcscmp(pstrName, _T("textshadowcolorb")) == 0 ) {
  251. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  252. LPTSTR pstr = NULL;
  253. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  254. SetTextShadowColorB(clrColor);
  255. }
  256. else if( _tcscmp(pstrName, _T("strokecolor")) == 0 ) {
  257. if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
  258. LPTSTR pstr = NULL;
  259. DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
  260. SetStrokeColor(clrColor);
  261. }
  262. else CControlUI::SetAttribute(pstrName, pstrValue);
  263. }
  264. void CLabelUI::PaintText(HDC hDC)
  265. {
  266. if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
  267. if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
  268. RECT rc = m_rcItem;
  269. rc.left += m_rcTextPadding.left;
  270. rc.right -= m_rcTextPadding.right;
  271. rc.top += m_rcTextPadding.top;
  272. rc.bottom -= m_rcTextPadding.bottom;
  273. if(!GetEnabledEffect())
  274. {
  275. if( m_sText.IsEmpty() ) return;
  276. int nLinks = 0;
  277. if( IsEnabled() ) {
  278. if( m_bShowHtml )
  279. CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
  280. NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
  281. else
  282. CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
  283. m_iFont, DT_SINGLELINE | m_uTextStyle);
  284. }
  285. else {
  286. if( m_bShowHtml )
  287. CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
  288. NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
  289. else
  290. CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
  291. m_iFont, DT_SINGLELINE | m_uTextStyle);
  292. }
  293. }
  294. else
  295. {
  296. Font nFont(hDC,m_pManager->GetFont(GetFont()));
  297. Graphics nGraphics(hDC);
  298. nGraphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
  299. StringFormat format;
  300. StringAlignment sa = StringAlignment::StringAlignmentNear;
  301. if ((m_uTextStyle & DT_VCENTER) != 0) sa = StringAlignment::StringAlignmentCenter;
  302. else if( (m_uTextStyle & DT_BOTTOM) != 0) sa = StringAlignment::StringAlignmentFar;
  303. format.SetAlignment((StringAlignment)sa);
  304. sa = StringAlignment::StringAlignmentNear;
  305. if ((m_uTextStyle & DT_CENTER) != 0) sa = StringAlignment::StringAlignmentCenter;
  306. else if( (m_uTextStyle & DT_RIGHT) != 0) sa = StringAlignment::StringAlignmentFar;
  307. format.SetLineAlignment((StringAlignment)sa);
  308. RectF nRc((float)rc.left,(float)rc.top,(float)rc.right-rc.left,(float)rc.bottom-rc.top);
  309. RectF nShadowRc = nRc;
  310. nShadowRc.X += m_ShadowOffset.X;
  311. nShadowRc.Y += m_ShadowOffset.Y;
  312. int nGradientLength = GetGradientLength();
  313. if(nGradientLength == 0)
  314. nGradientLength = (rc.bottom-rc.top);
  315. LinearGradientBrush nLineGrBrushA(Point(GetGradientAngle(), 0),Point(0,nGradientLength),ARGB2Color(GetTextShadowColorA()),ARGB2Color(GetTextShadowColorB() == -1?GetTextShadowColorA():GetTextShadowColorB()));
  316. LinearGradientBrush nLineGrBrushB(Point(GetGradientAngle(), 0),Point(0,nGradientLength),ARGB2Color(GetTextColor()),ARGB2Color(GetTextColor1() == -1?GetTextColor():GetTextColor1()));
  317. if (GetEnabledLuminous())
  318. {
  319. // from http://bbs.csdn.net/topics/390346428
  320. int iFuzzyWidth = (int)(nRc.Width/GetLuminousFuzzy());
  321. if (iFuzzyWidth < 1) iFuzzyWidth = 1;
  322. int iFuzzyHeight = (int)(nRc.Height/GetLuminousFuzzy());
  323. if (iFuzzyHeight < 1) iFuzzyHeight = 1;
  324. RectF nTextRc(0.0f, 0.0f, nRc.Width, nRc.Height);
  325. Bitmap Bit1((INT)nRc.Width, (INT)nRc.Height);
  326. Graphics g1(&Bit1);
  327. g1.SetSmoothingMode(SmoothingModeAntiAlias);
  328. g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
  329. g1.SetCompositingQuality(CompositingQualityAssumeLinear);
  330. Bitmap Bit2(iFuzzyWidth, iFuzzyHeight);
  331. Graphics g2(&Bit2);
  332. g2.SetInterpolationMode(InterpolationModeHighQualityBicubic);
  333. g2.SetPixelOffsetMode(PixelOffsetModeNone);
  334. FontFamily ftFamily;
  335. nFont.GetFamily(&ftFamily);
  336. int iLen = wcslen(m_pWideText);
  337. g1.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushB);
  338. g2.DrawImage(&Bit1, 0, 0, (int)iFuzzyWidth, (int)iFuzzyHeight);
  339. g1.Clear(Color(0));
  340. g1.DrawImage(&Bit2, (int)m_ShadowOffset.X, (int)m_ShadowOffset.Y, (int)nRc.Width, (int)nRc.Height);
  341. g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
  342. nGraphics.DrawImage(&Bit1, nRc.X, nRc.Y);
  343. }
  344. if(GetEnabledStroke() && GetStrokeColor() > 0)
  345. {
  346. LinearGradientBrush nLineGrBrushStroke(Point(GetGradientAngle(),0),Point(0,rc.bottom-rc.top+2),ARGB2Color(GetStrokeColor()),ARGB2Color(GetStrokeColor()));
  347. #ifdef _UNICODE
  348. nRc.Offset(-1,0);
  349. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushStroke);
  350. nRc.Offset(2,0);
  351. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushStroke);
  352. nRc.Offset(-1,-1);
  353. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushStroke);
  354. nRc.Offset(0,2);
  355. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushStroke);
  356. nRc.Offset(0,-1);
  357. #else
  358. int iLen = wcslen(m_pWideText);
  359. nRc.Offset(-1,0);
  360. nGraphics.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushStroke);
  361. nRc.Offset(2,0);
  362. nGraphics.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushStroke);
  363. nRc.Offset(-1,-1);
  364. nGraphics.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushStroke);
  365. nRc.Offset(0,2);
  366. nGraphics.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushStroke);
  367. nRc.Offset(0,-1);
  368. #endif
  369. }
  370. #ifdef _UNICODE
  371. if(GetEnabledShadow() && (GetTextShadowColorA() > 0 || GetTextShadowColorB() > 0))
  372. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nShadowRc,&format,&nLineGrBrushA);
  373. nGraphics.DrawString(m_sText,m_sText.GetLength(),&nFont,nRc,&format,&nLineGrBrushB);
  374. #else
  375. int iLen = wcslen(m_pWideText);
  376. if(GetEnabledShadow() && (GetTextShadowColorA() > 0 || GetTextShadowColorB() > 0))
  377. nGraphics.DrawString(m_pWideText,iLen,&nFont,nShadowRc,&format,&nLineGrBrushA);
  378. nGraphics.DrawString(m_pWideText,iLen,&nFont,nRc,&format,&nLineGrBrushB);
  379. #endif
  380. }
  381. }
  382. void CLabelUI::SetShadowOffset( int _offset,int _angle )
  383. {
  384. if(_angle > 180 || _angle < -180) return;
  385. RECT rc = m_rcItem;
  386. if(_angle >= 0 && _angle <= 180) rc.top -= _offset;
  387. else if(_angle > -180 && _angle < 0) rc.top += _offset;
  388. if(_angle > -90 && _angle <= 90) rc.left -= _offset;
  389. else if( _angle > 90 || _angle < -90) rc.left += _offset;
  390. m_ShadowOffset.X = (float)rc.top;
  391. m_ShadowOffset.Y = (float)rc.left;
  392. Invalidate();
  393. }
  394. RectF CLabelUI::GetShadowOffset()
  395. {
  396. return m_ShadowOffset;
  397. }
  398. void CLabelUI::SetEnabledEffect( bool _EnabledEffect )
  399. {
  400. m_EnableEffect = _EnabledEffect;
  401. if (m_EnableEffect) {
  402. #ifdef _UNICODE
  403. m_pWideText = (LPWSTR)m_sText.GetData();
  404. #else
  405. int iLen = m_sText.GetLength();
  406. if (m_pWideText) delete[] m_pWideText;
  407. m_pWideText = new WCHAR[iLen + 1];
  408. ::ZeroMemory(m_pWideText, (iLen + 1) * sizeof(WCHAR));
  409. ::MultiByteToWideChar(CP_ACP, 0, m_sText.GetData(), -1, (LPWSTR)m_pWideText, iLen);
  410. #endif
  411. }
  412. Invalidate();
  413. }
  414. bool CLabelUI::GetEnabledEffect()
  415. {
  416. return m_EnableEffect;
  417. }
  418. void CLabelUI::SetEnabledLuminous(bool bEnableLuminous)
  419. {
  420. m_bEnableLuminous = bEnableLuminous;
  421. Invalidate();
  422. }
  423. bool CLabelUI::GetEnabledLuminous()
  424. {
  425. return m_bEnableLuminous;
  426. }
  427. void CLabelUI::SetLuminousFuzzy(float fFuzzy)
  428. {
  429. if (fFuzzy < 0.0001f) return;
  430. m_fLuminousFuzzy = fFuzzy;
  431. Invalidate();
  432. }
  433. float CLabelUI::GetLuminousFuzzy()
  434. {
  435. return m_fLuminousFuzzy;
  436. }
  437. void CLabelUI::SetTextColor1( DWORD _TextColor1 )
  438. {
  439. m_dwTextColor1 = _TextColor1;
  440. Invalidate();
  441. }
  442. DWORD CLabelUI::GetTextColor1()
  443. {
  444. return m_dwTextColor1;
  445. }
  446. void CLabelUI::SetTextShadowColorA( DWORD _TextShadowColorA )
  447. {
  448. m_dwTextShadowColorA = _TextShadowColorA;
  449. Invalidate();
  450. }
  451. DWORD CLabelUI::GetTextShadowColorA()
  452. {
  453. return m_dwTextShadowColorA;
  454. }
  455. void CLabelUI::SetTextShadowColorB( DWORD _TextShadowColorB )
  456. {
  457. m_dwTextShadowColorB = _TextShadowColorB;
  458. Invalidate();
  459. }
  460. DWORD CLabelUI::GetTextShadowColorB()
  461. {
  462. return m_dwTextShadowColorB;
  463. }
  464. void CLabelUI::SetGradientAngle( int _SetGradientAngle )
  465. {
  466. m_GradientAngle = _SetGradientAngle;
  467. Invalidate();
  468. }
  469. int CLabelUI::GetGradientAngle()
  470. {
  471. return m_GradientAngle;
  472. }
  473. void CLabelUI::SetEnabledStroke( bool _EnabledStroke )
  474. {
  475. m_EnabledStroke = _EnabledStroke;
  476. Invalidate();
  477. }
  478. bool CLabelUI::GetEnabledStroke()
  479. {
  480. return m_EnabledStroke;
  481. }
  482. void CLabelUI::SetStrokeColor( DWORD _StrokeColor )
  483. {
  484. m_dwStrokeColor = _StrokeColor;
  485. Invalidate();
  486. }
  487. DWORD CLabelUI::GetStrokeColor()
  488. {
  489. return m_dwStrokeColor;
  490. }
  491. void CLabelUI::SetEnabledShadow( bool _EnabledShadowe )
  492. {
  493. m_EnabledShadow = _EnabledShadowe;
  494. Invalidate();
  495. }
  496. bool CLabelUI::GetEnabledShadow()
  497. {
  498. return m_EnabledShadow;
  499. }
  500. void CLabelUI::SetGradientLength( int _GradientLength )
  501. {
  502. m_GradientLength = _GradientLength;
  503. Invalidate();
  504. }
  505. int CLabelUI::GetGradientLength()
  506. {
  507. return m_GradientLength;
  508. }
  509. }