void CDuiFrameWnd::AddFiles( const std::vector<PlayFileInfo> &vctString, bool bInit ) { COptionUI *pOptionTmp; CVerticalLayoutUI* pLayout = NULL; CDuiString strTmp; TCHAR szName[_MAX_FNAME]; TCHAR szExt[_MAX_EXT]; unsigned i, uWantedCount; pLayout = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("playlist"))); if (! pLayout) { return; } for(i = 0, uWantedCount = 0; i < vctString.size(); i++) { if (IsWantedFile(vctString[i].szFileName)) { _tsplitpath_s(vctString[i].szFileName, NULL, 0, NULL, 0, szName, _MAX_FNAME, szExt, _MAX_EXT); strTmp.Format(_T("%s%s"), szName, szExt); // 文件名 pOptionTmp = new COptionUI; pOptionTmp->SetTextColor(0xFFC8C6CB); pOptionTmp->SetHotTextColor(0xFFC8C6CB); pOptionTmp->SetSelectedTextColor(0xFFC8C6CB); pOptionTmp->SetTag(U_TAG_PLAYLIST); pOptionTmp->SetText(strTmp); pOptionTmp->SetAttribute(_T("height"), _T("22")); pOptionTmp->SetAttribute(_T("inset"), _T("7,0,0,0")); pOptionTmp->SetAttribute(_T("align"), _T("center")); pOptionTmp->SetAttribute(_T("font"),_T("4")); pOptionTmp->SetUserData(vctString[i].szFileName); pOptionTmp->SetName(vctString[i].szFileName); pOptionTmp->SetSelectedImage(_T("file='btn_bk.png'")); pLayout->Add(pOptionTmp); uWantedCount++; if (! bInit) { m_cPlayList.Add(vctString[i]); // 完整路径 } } } Rand(m_queRand, uWantedCount); ShowPlaylist(true); }
void CMainWnd::InitWindow() { // 初始化数据管理器 m_Data.Init(m_hWnd); // 创建分类按钮 CHorizontalLayoutUI* pTabBar = (CHorizontalLayoutUI*)m_PaintManager.FindControl(_T("tabbar")); if(pTabBar) { TABBTN aTypes[] = { {_T("8009|1003|1004|1007|1002|1005|1006|1001|1008"), _T("精选")}, {_T("1003"), _T("风景")}, {_T("1004"), _T("美女")}, {_T("1007"), _T("小清新")}, {_T("1002"), _T("动漫")}, {_T("1005"), _T("萌宠")}, {_T("1006"), _T("明星")}, {_T("1001"), _T("创意")}, {_T("1008"), _T("汽车")}, {_T("8009"), _T("颜色")}, }; COptionUI* pFirst = NULL; for(int i = 0; i < sizeof(aTypes) / sizeof(TABBTN); ++i) { TABBTN Tab = aTypes[i]; COptionUI* pOption = new COptionUI(); pOption->SetName(_T("wp_tabbtn")); pOption->SetText(Tab.sText); pOption->SetUserData(Tab.sType); pOption->SetGroup(_T("tabbar")); pOption->SetFixedHeight(25); pOption->SetFixedWidth(65); pOption->SetHotImage(_T("file='main/224.bmp' corner='4,4,4,4'")); pOption->SetSelectedImage(_T("file='main/224.bmp' corner='4,4,4,4'")); pOption->OnNotify += MakeDelegate(this, &CMainWnd::OnNotify1); pOption->OnNotify += MakeDelegate(this, &CMainWnd::OnNotify2); pTabBar->Add(pOption); if(pFirst == NULL) pFirst = pOption; } if(pFirst != NULL) pFirst->Selected(true); } m_Data.LoadBizhi(_T("8009|1003|1004|1007|1002|1005|1006|1001|1008"), 1, 10); }
//加载常规控件皮肤 void CUseBoardCastWnd::LoadNormalCtrlSkin() { int idx = 0; CStdPtrArray* pCtrls = NULL; //加载所有文本编辑框的皮肤 pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("EditUI")); CEditUI* pEditUI = NULL; do { pEditUI = static_cast<CEditUI*>(pCtrls->GetAt(idx++)); if (pEditUI) { if (pEditUI->GetName() == _T("Edt_ID")) { continue; } pEditUI->SetNormalImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,0,500,22' corner='3,4,2,2'"); pEditUI->SetHotImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,22,500,44' corner='3,4,2,2'"); pEditUI->SetFocusedImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,44,500,66' corner='3,4,2,2'"); pEditUI->SetDisabledImage("file='dialog\\edit.png' dest='0,0,500,30' source='0,66,500,88' corner='3,4,2,2'"); } } while (pEditUI); //加载所有下拉列表框的皮肤 idx = 0; pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("ComboUI")); CComboUI* pComboUI = NULL; do { pComboUI = static_cast<CComboUI*>(pCtrls->GetAt(idx++)); if (pComboUI) { pComboUI->SetNormalImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,0,500,22' corner='5,2,22,0'"); pComboUI->SetHotImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,22,500,44' corner='5,2,22,0'"); pComboUI->SetPushedImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,44,500,66' corner='5,2,22,0'"); pComboUI->SetDisabledImage("file='dialog\\combo.png' dest='0,0,500,30' source='0,66,500,88' corner='5,2,22,0'"); RECT rc = {6,0,0,0}; pComboUI->SetItemTextPadding(rc); // CScrollBarUI* pVScroll = pComboUI->GetVerticalScrollBar(); // if (pVScroll) // { // pVScroll->SetBkNormalImage("file='dialog\\vscrollbar_back.png' dest='0,0,14,100' source='0,0,14,100' corner='0,0,0,0'"); // pVScroll->SetButton1NormalImage("file='dialog\\vscrollbar_up.png' dest='0,0,16,16' source='0,0,16,16' corner='0,0,0,0'"); // } } } while (pComboUI); //加载所有多选框的皮肤 idx = 0; pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("OptionUI")); COptionUI* pOptionUI = NULL; do { pOptionUI = static_cast<COptionUI*>(pCtrls->GetAt(idx++)); if (pOptionUI) { if (lstrlen(pOptionUI->GetGroup()) == 0) //多选框 { pOptionUI->SetNormalImage("file='dialog\\check.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'"); pOptionUI->SetHotImage("file='dialog\\check.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'"); pOptionUI->SetSelectedImage("file='dialog\\check.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'"); RECT rc = {9,0,0,0}; pOptionUI->SetTextPadding(rc); } else //单选框 { pOptionUI->SetNormalImage("file='dialog\\radio.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'"); pOptionUI->SetHotImage("file='dialog\\radio.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'"); pOptionUI->SetSelectedImage("file='dialog\\radio.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'"); RECT rc = {18,0,0,0}; pOptionUI->SetTextPadding(rc); } } } while (pOptionUI); }
//加载常规控件皮肤 void CRightFrame::LoadNormalCtrlSkin() { int idx = 0; CStdPtrArray* pCtrls = NULL; pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("EditUI")); CEditUI* pEditUI = NULL; RECT rcText = {4,1,4,0}; do { pEditUI = static_cast<CEditUI*>(pCtrls->GetAt(idx++)); if (pEditUI) { if (pEditUI->GetName() == _T("Talk_Edt_Inp")) { continue; } if (!pEditUI->IsReadOnly()) { pEditUI->SetNormalImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,0,500,22' corner='3,4,2,2'"); pEditUI->SetHotImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,22,500,44' corner='3,4,2,2'"); pEditUI->SetFocusedImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,44,500,66' corner='3,4,2,2'"); pEditUI->SetDisabledImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'"); } else { pEditUI->SetNormalImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'"); pEditUI->SetHotImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'"); pEditUI->SetFocusedImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'"); pEditUI->SetDisabledImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'"); } pEditUI->SetTextPadding(rcText); } } while (pEditUI); idx = 0; pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("ComboUI")); CComboUI* pComboUI = NULL; RECT rc = {6,0,30,0}; do { pComboUI = static_cast<CComboUI*>(pCtrls->GetAt(idx++)); if (pComboUI) { pComboUI->SetNormalImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,0,500,22' corner='5,0,22,0'"); pComboUI->SetHotImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,22,500,44' corner='5,0,22,0'"); pComboUI->SetPushedImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,44,500,66' corner='5,0,22,0'"); pComboUI->SetDisabledImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,66,500,88' corner='5,0,22,0'"); pComboUI->EnableScrollBar(true,false); pComboUI->SetItemTextPadding(rc); } } while (pComboUI); //加载所有多选框/单选框的皮肤 idx = 0; pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("OptionUI")); COptionUI* pOptionUI = NULL; do { pOptionUI = static_cast<COptionUI*>(pCtrls->GetAt(idx++)); if (pOptionUI) { if (lstrlen(pOptionUI->GetGroup()) == 0) //多选框 { pOptionUI->SetNormalImage("file='dialog\\check.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'"); pOptionUI->SetHotImage("file='dialog\\check.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'"); pOptionUI->SetSelectedImage("file='dialog\\check.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'"); RECT rc = {9,0,0,0}; pOptionUI->SetTextPadding(rc); } else //单选框 { pOptionUI->SetNormalImage("file='dialog\\radio.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'"); pOptionUI->SetHotImage("file='dialog\\radio.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'"); pOptionUI->SetSelectedImage("file='dialog\\radio.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'"); RECT rc = {18,0,0,0}; pOptionUI->SetTextPadding(rc); } } } while (pOptionUI); }