ColorListItem::ColorListItem(const char* text, uint32 level, bool expanded) : BStringItem(text, level, expanded) { SetFrameColor((rgb_color){0, 0, 0}); SetColor((rgb_color){255, 255, 255}); SetFrameSize(BRect(0, 0, 20, 10)); SetFrameAlignment(B_ALIGN_LEFT); }
void CSkinComboBox::ParseItem(CXmlNode *root ) { if( root == NULL ) return; int nAttributes = root->GetAttributeCount(); LPCTSTR pstrClass = NULL; LPCTSTR pstrName = NULL; LPCTSTR pstrValue = NULL; for( int i = 0; i < nAttributes; i++ ) { pstrClass = root->GetName(); pstrName = root->GetAttributeName(i); pstrValue = root->GetAttributeValue(i); if( _tcscmp(pstrClass, _T("normalimage")) == 0 ) { if( _tcscmp(pstrName, _T("value")) == 0 ) SetBgNormalPic(pstrValue); else if( _tcscmp(pstrName, _T("ninepart")) == 0 ) { LPTSTR pstr = NULL; CRect rc; rc.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rc.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); if (m_lpBgImgN != NULL) m_lpBgImgN->SetNinePart(&rc); } } else if( _tcscmp(pstrClass, _T("hotimage")) == 0 ) { if( _tcscmp(pstrName, _T("value")) == 0 ) SetBgHotPic(pstrValue); else if( _tcscmp(pstrName, _T("ninepart")) == 0 ) { LPTSTR pstr = NULL; CRect rc; rc.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rc.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); if (m_lpBgImgH != NULL) m_lpBgImgH->SetNinePart(&rc); } } else if( _tcscmp(pstrClass, _T("item")) == 0 ) { if( _tcscmp(pstrName, _T("text")) == 0 ) AddString(pstrValue); } else if( _tcscmp(pstrClass, _T("ListBox")) == 0 ) { LPTSTR pstr = NULL; CSkinComboBox_ListBox *pListBox = GetListBoxWnd(); if ( pListBox != NULL && pListBox->GetSafeHwnd() != NULL ) { if( _tcscmp(pstrName, _T("selectimage")) == 0 ) pListBox->SetSelectImage(pstrValue); else if( _tcscmp(pstrName, _T("ninepart")) == 0 ) { CRect rc; rc.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr); rc.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); rc.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr); if (pListBox->m_pSelectImg != NULL) pListBox->m_pSelectImg->SetNinePart(&rc); } } else if( _tcscmp(pstrName, _T("framecolor")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); SetFrameColor( _tcstoul(pstrValue, &pstr, 16)); } } } }