示例#1
0
void comboUC::setAttribute(PCWSTR pstrName, PCWSTR pstrValue)
{
	PWSTR pstr = NULL;
	if( _tcscmp(pstrName, L"textpadding") == 0 ) {
		RECT rcTextPadding = { 0 };
		rcTextPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setTextPadding(rcTextPadding);
	}
	else if( _tcscmp(pstrName, L"normalimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setNormalImage(rcCell);
		//setNormalImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"hotimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setHotImage(rcCell);
		//setHotImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"pushedimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setPushedImage(rcCell);
		//SetPushedImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"focusedimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setFocusedImage(rcCell);
		//SetFocusedImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"disabledimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setDisabledImage(rcCell);
		//SetDisabledImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"dropbox") == 0 ) setDropBoxAttributeList(pstrValue);
	// 列表单元格属性
	else if( _tcscmp(pstrName, L"itemfont") == 0 ) setItemFont(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"itemlinecolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemLineColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemshowhtml") == 0 ) setItemShowHtml(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"alternatebk") == 0 ) setAlternateBk(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"itemalign") == 0 ) {
		if( _tcsstr(pstrValue, L"left") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_CENTER | DT_RIGHT);
			m_listInfo.uTextStyle |= DT_LEFT;
		}
		if( _tcsstr(pstrValue, L"center") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_LEFT | DT_RIGHT);
			m_listInfo.uTextStyle |= DT_CENTER;
		}
		if( _tcsstr(pstrValue, L"right") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_LEFT | DT_CENTER);
			m_listInfo.uTextStyle |= DT_RIGHT;
		}
	}
	else if( _tcscmp(pstrName, L"itemendellipsis") == 0 ) {
		if( _tcscmp(pstrValue, L"true") == 0 ) m_listInfo.uTextStyle |= DT_END_ELLIPSIS;
		else m_listInfo.uTextStyle &= ~DT_END_ELLIPSIS;
	}
	else if( _tcscmp(pstrName, L"itemtextpadding") == 0 ) {
		RECT rcPadding = { 0 };
		rcPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setItemTextPadding(rcPadding);
	}
	else if( _tcscmp(pstrName, L"itemtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itembkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemselectedtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemSelectedTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemselectedbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemSelectedBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemhottextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemHotTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemhotbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemHotBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemcuttextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemCutTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemcutbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemCutBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemdisabledtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemDisabledTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemdisabledbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemDisabledBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemimage") == 0 ) setItemImage(pstrValue);
	else if( _tcscmp(pstrName, L"itemnormalimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemNormalImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemselectedimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemSelectedImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemcutedimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemCutedImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemhotimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemHotImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemdisabledimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemDisabledImage(rcCell);
	}
	else containerUC::setAttribute(pstrName, pstrValue);
}
示例#2
0
void comboUC::setFocusedImage(LONG left, LONG top, LONG right, LONG bottom)
{
	assert(m_pImage);
	RECT rc = {left, top, right, bottom};
	setFocusedImage(rc);
}
示例#3
0
void Button::setFocusedImage(const std::string& Path, Vec2f Size)
{
    ImageRefPtr LoadedImage = ImageFileHandler::the()->read(Path.c_str());
    setFocusedImage(LoadedImage, Size);
}