MCPcopy Create free account
hub / github.com/cinience/RedisStudio / SetAttribute

Method SetAttribute

DuiLib/Control/UILabel.cpp:179–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177 }
178
179 void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
180 {
181 if( _tcscmp(pstrName, _T("align")) == 0 ) {
182 if( _tcsstr(pstrValue, _T("left")) != NULL ) {
183 m_uTextStyle &= ~(DT_CENTER | DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
184 m_uTextStyle |= DT_LEFT;
185 }
186 if( _tcsstr(pstrValue, _T("center")) != NULL ) {
187 m_uTextStyle &= ~(DT_LEFT | DT_RIGHT );
188 m_uTextStyle |= DT_CENTER;
189 }
190 if( _tcsstr(pstrValue, _T("right")) != NULL ) {
191 m_uTextStyle &= ~(DT_LEFT | DT_CENTER | DT_VCENTER | DT_SINGLELINE);
192 m_uTextStyle |= DT_RIGHT;
193 }
194 if( _tcsstr(pstrValue, _T("top")) != NULL ) {
195 m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER | DT_VCENTER);
196 m_uTextStyle |= (DT_TOP | DT_SINGLELINE);
197 }
198 if( _tcsstr(pstrValue, _T("vcenter")) != NULL ) {
199 m_uTextStyle &= ~(DT_TOP | DT_BOTTOM );
200 m_uTextStyle |= (DT_CENTER | DT_VCENTER | DT_SINGLELINE);
201 }
202 if( _tcsstr(pstrValue, _T("bottom")) != NULL ) {
203 m_uTextStyle &= ~(DT_TOP | DT_VCENTER | DT_VCENTER);
204 m_uTextStyle |= (DT_BOTTOM | DT_SINGLELINE);
205 }
206 }
207 else if( _tcscmp(pstrName, _T("endellipsis")) == 0 ) {
208 if( _tcscmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS;
209 else m_uTextStyle &= ~DT_END_ELLIPSIS;
210 }
211 else if( _tcscmp(pstrName, _T("font")) == 0 ) SetFont(_ttoi(pstrValue));
212 else if( _tcscmp(pstrName, _T("textcolor")) == 0 ) {
213 if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
214 LPTSTR pstr = NULL;
215 DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
216 SetTextColor(clrColor);
217 }
218 else if( _tcscmp(pstrName, _T("disabledtextcolor")) == 0 ) {
219 if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
220 LPTSTR pstr = NULL;
221 DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
222 SetDisabledTextColor(clrColor);
223 }
224 else if( _tcscmp(pstrName, _T("textpadding")) == 0 ) {
225 RECT rcTextPadding = { 0 };
226 LPTSTR pstr = NULL;
227 rcTextPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
228 rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
229 rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
230 rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
231 SetTextPadding(rcTextPadding);
232 }
233 else if( _tcscmp(pstrName, _T("showhtml")) == 0 ) SetShowHtml(_tcscmp(pstrValue, _T("true")) == 0);
234
235 else if( _tcscmp(pstrName, _T("enabledeffect")) == 0 ) SetEnabledEffect(_tcscmp(pstrValue, _T("true")) == 0);
236 else if( _tcscmp(pstrName, _T("rhaa")) == 0 ) SetTextRenderingHintAntiAlias(_ttoi(pstrValue));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected