MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / Paint

Method Paint

Source/SizeEditor.cpp:64–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void CSizeEditor::Paint(CDC &dc, CPoint orig) { // // //
65 CFont *pOldFont = dc.SelectObject(&m_Font); // // //
66
67 CRect rect;
68 GetClientRect(rect);
69 rect.MoveToXY(orig);
70
71 COLORREF BUTTON_FACE = GetSysColor(COLOR_BTNFACE);
72 COLORREF BUTTON_HILIGHT = GetSysColor(COLOR_BTNHILIGHT);
73 COLORREF BUTTON_SHADOW = GetSysColor(COLOR_BTNSHADOW);
74
75 // Background
76 dc.FillSolidRect(rect, 0x00);
77 dc.Draw3dRect(rect, BUTTON_SHADOW, BUTTON_HILIGHT);
78
79 if (this == GetFocus()) {
80 CRect focusRect = rect;
81 focusRect.DeflateRect(rect.Height() - 1, 2, rect.Height() - 1, 2);
82 dc.SetBkColor(0xFFFFFF);
83 dc.DrawFocusRect(focusRect);
84 }
85
86 CRect buttonRect;
87
88 // The '-'-button
89 buttonRect = {{rect.left + 2, rect.top + 2}, SIZE {rect.Height() - 4, rect.Height() - 4}};
90 dc.FillSolidRect(buttonRect, BUTTON_FACE);
91 if (m_iButtonPressed == 1)
92 dc.Draw3dRect(buttonRect, BUTTON_SHADOW, BUTTON_HILIGHT);
93 else
94 dc.Draw3dRect(buttonRect, BUTTON_HILIGHT, BUTTON_SHADOW);
95
96 // The '+'-button
97 buttonRect = {{rect.right - rect.Height() + 2, rect.top + 2}, SIZE {rect.Height() - 4, rect.Height() - 4}};
98 dc.FillSolidRect(buttonRect, BUTTON_FACE);
99 if (m_iButtonPressed == 2)
100 dc.Draw3dRect(buttonRect, BUTTON_SHADOW, BUTTON_HILIGHT);
101 else
102 dc.Draw3dRect(buttonRect, BUTTON_HILIGHT, BUTTON_SHADOW);
103
104 // Text
105 dc.SetBkMode(TRANSPARENT);
106 dc.SetTextColor(0xFFFFFF);
107 dc.SetTextAlign(TA_RIGHT);
108 dc.TextOutW(rect.right - rect.Height() - 4, rect.top + 1, FormattedW(L"%i", m_iValue)); // // //
109 dc.SetTextColor(0);
110 dc.SetTextAlign(TA_CENTER);
111 dc.TextOutW(rect.left + rect.Height() / 2, rect.top + 1 + (m_iButtonPressed == 1 ? 1 : 0), L"-");
112 dc.TextOutW(rect.right - rect.Height() / 2, rect.top + 1 + (m_iButtonPressed == 2 ? 1 : 0), L"+");
113
114 dc.SelectObject(pOldFont);
115}
116
117BOOL CSizeEditor::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
118{

Callers 1

OnPaintMethod · 0.45

Calls 1

FormattedWFunction · 0.85

Tested by

no test coverage detected