-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUILabel.cpp
More file actions
82 lines (65 loc) · 2.25 KB
/
UILabel.cpp
File metadata and controls
82 lines (65 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "StdAfx.h"
#include "UILabel.h"
/////////////////////////////////////////////////////////////////////////////////////
//
//
CLabelPanelUI::CLabelPanelUI() : m_cxWidth(0), m_uTextStyle(DT_VCENTER)
{
}
LPCTSTR CLabelPanelUI::GetClass() const
{
return _T("LabelPanelUI");
}
void CLabelPanelUI::SetText(LPCTSTR pstrText)
{
// Automatic assignment of keyboard shortcut
if( _tcschr(pstrText, '&') != NULL ) m_chShortcut = *(_tcschr(pstrText, '&') + 1);
CControlUI::SetText(pstrText);
}
void CLabelPanelUI::SetWidth(int cx)
{
m_cxWidth = cx;
UpdateLayout();
}
void CLabelPanelUI::SetTextStyle(UINT uStyle)
{
m_uTextStyle = uStyle;
Invalidate();
}
void CLabelPanelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
if( _tcscmp(pstrName, _T("align")) == 0 ) {
if( _tcsstr(pstrValue, _T("center")) != NULL ) m_uTextStyle |= DT_CENTER;
if( _tcsstr(pstrValue, _T("right")) != NULL ) m_uTextStyle |= DT_RIGHT;
}
else if( _tcscmp(pstrName, _T("width")) == 0 ) SetWidth(_ttoi(pstrValue));
else CControlUI::SetAttribute(pstrName, pstrValue);
}
SIZE CLabelPanelUI::EstimateSize(SIZE /*szAvailable*/)
{
return CSize(m_cxWidth, m_pManager->GetThemeFontInfo(UIFONT_NORMAL).tmHeight + 4);
}
void CLabelPanelUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
RECT rcText = m_rcItem;
int nLinks = 0;
CBlueRenderEngineUI::DoPaintPrettyText(hDC, m_pManager, rcText, m_sText, UICOLOR_EDIT_TEXT_NORMAL, UICOLOR__INVALID, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
}
/////////////////////////////////////////////////////////////////////////////////////
//
//
LPCTSTR CGreyTextHeaderUI::GetClass() const
{
return _T("GreyTextHeaderUI");
}
SIZE CGreyTextHeaderUI::EstimateSize(SIZE /*szAvailable*/)
{
return CSize(0, 12 + m_pManager->GetThemeFontInfo(UIFONT_BOLD).tmHeight + 12);
}
void CGreyTextHeaderUI::DoPaint(HDC hDC, const RECT& /*rcPaint*/)
{
COLORREF clrDarkText = m_pManager->GetThemeColor(UICOLOR_DIALOG_TEXT_DARK);
RECT rcLine = { m_rcItem.left, m_rcItem.bottom - 6, m_rcItem.right, m_rcItem.bottom - 5 };
CBlueRenderEngineUI::DoFillRect(hDC, m_pManager, rcLine, UICOLOR_DIALOG_TEXT_DARK);
CBlueRenderEngineUI::DoPaintQuickText(hDC, m_pManager, m_rcItem, m_sText, UICOLOR_DIALOG_TEXT_DARK, UIFONT_BOLD, DT_SINGLELINE);
}