BOOL CALLBACK TBCIAWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { BOOL res = 0; std::map<HWND, WNDPROC>::iterator iter = g_windowInfoMap.find( hwnd ); //DEBUG_INFO("hwnd 0x%x message 0x%x wparam 0x%x lparam 0x%x\n",hwnd,message,wParam,lParam); if( iter != g_windowInfoMap.end() ) { if (message == WM_PAINT) { ShowWindow( hwnd, SW_HIDE ); } else if( message == LVM_SETITEMTEXT ) // TODO 安装细节显示 等找到消息再写 { ; } else if( message == PBM_SETPOS ) { CProgressUI* pProgress = static_cast<CProgressUI*>(g_pFrame->GetPaintManager().FindControl( g_tempParam )); pProgress->SetMaxValue( 30000 ); if( pProgress == NULL ) return 0; pProgress->SetValue( (int)wParam); if( pProgress->GetValue() == 30000 ) { CTabLayoutUI* pTab = NULL; int currentIndex; pTab = static_cast<CTabLayoutUI*>(g_pFrame->GetPaintManager().FindControl( g_installPageTabName )); if( pTab == NULL ) return -1; currentIndex = pTab->GetCurSel(); pTab->SelectItem( currentIndex + 1 ); } } else { res = CallWindowProc( iter->second, hwnd, message, wParam, lParam); } } return res; }
//创建list item BOOL CMainDlg::create_ListItem(tag_Donwload_File_Ini_Data tag_File_Data) { //获取list指针 CListUI *cList_Item = static_cast<CListUI*>(m_pm.FindControl(_T("down_list_tab"))); if(NULL == cList_Item) { return FALSE; } //创建list item节点指针 CListContainerElementUI *new_node = new CListContainerElementUI; new_node->ApplyAttributeList(_T("height=\"60\"")); //创建一个界面布局器 横向布局 高度 60 CVerticalLayoutUI *new_v_lay = new CVerticalLayoutUI; new_v_lay->ApplyAttributeList(_T("height=\"60\"")); ////////////////////////////////////////////////////////////////////////// //创建各种控件 CButtonUI *cBtn_Ico = new CButtonUI; cBtn_Ico->ApplyAttributeList( _T("name=\"ico\" float=\"true\" pos=\"5,10,0,0\" width=\"48\" height=\"38\" tooltip=\"图标..\" bkimage=\"file='exe_file.png'\"") ); CTextUI *cText_file = new CTextUI; cText_file->ApplyAttributeList( _T("name=\"file\" float=\"true\" pos=\"55,15,0,0\" width=\"300\" height=\"20\" tooltip=\"文件名..\" font=\"0\" textcolor=\"#ffffffff\"") ); cText_file->SetText(tag_File_Data.strFileName.c_str()); CTextUI *cText_Print = new CTextUI; cText_Print->ApplyAttributeList( _T("name=\"print\" float=\"true\" pos=\"55,35,0,0\" width=\"300\" height=\"20\" text=\"正在准备下载..\" tooltip=\"进度提示..\" font=\"0\" textcolor=\"#ffddd333\"") ); cText_Print->SetText(tag_File_Data.strDataPrint.c_str()); CTextUI *cText_jdtbk = new CTextUI; cText_jdtbk->ApplyAttributeList( _T("name=\"jdtbk\" float=\"true\" pos=\"300,15,0,0\" width=\"210\" height=\"7\" bkimage=\"file='progress_back.png'\"") ); CProgressUI *cProgress = new CProgressUI; cProgress->ApplyAttributeList( _T("name=\"jdt\" float=\"true\" pos=\"300,15,0,0\" width=\"210\" height=\"7\" foreimage=\"file='progress_fore.png'\"") ); cProgress->SetMaxValue(tag_File_Data.n64FileSize); cProgress->SetMinValue(0); cProgress->SetValue(tag_File_Data.n64ProgRessPos); CButtonUI *cBtn_Stop = new CButtonUI; cBtn_Stop->ApplyAttributeList( _T("name=\"stop\" float=\"true\" pos=\"400,25,0,0\" width=\"30\" height=\"30\" tooltip=\"暂停下载..\" normalimage=\"file='stop.png'\"") ); CButtonUI *cBtn_Down = new CButtonUI; cBtn_Down->ApplyAttributeList( _T("name=\"down\" float=\"true\" pos=\"440,25,0,0\" width=\"30\" height=\"30\" tooltip=\"开始下载..\" normalimage=\"file='go.png'\"") ); CButtonUI *cBtn_Open = new CButtonUI; cBtn_Open->ApplyAttributeList( _T("name=\"open\" float=\"true\" pos=\"480,25,0,0\" width=\"30\" height=\"30\" tooltip=\"打开文件..\" normalimage=\"file='ok.png'\"") ); CButtonUI *cBtn_Dele = new CButtonUI; cBtn_Dele->ApplyAttributeList( _T("name=\"dele\" float=\"true\" pos=\"520,5,0,0\" width=\"20\" height=\"20\" tooltip=\"删除任务..\" normalimage=\"file='close.png'\"") ); ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //将创建好的控件添加到界面布局器中 new_v_lay->Add(cBtn_Ico); new_v_lay->Add(cText_file); new_v_lay->Add(cText_Print); new_v_lay->Add(cText_jdtbk); new_v_lay->Add(cProgress); new_v_lay->Add(cBtn_Stop); new_v_lay->Add(cBtn_Down); new_v_lay->Add(cBtn_Open); new_v_lay->Add(cBtn_Dele); //将界面布局器添加到list item节点中 new_node->Add(new_v_lay); //最后把list节点插入到list中 cList_Item->Add(new_node); _Nv_Download_Ex *Nv_Task_ = new _Nv_Download_Ex; Nv_Task_->m_pList = cList_Item; Nv_Task_->m_pListElement = new_node; Nv_Task_->m_pVerticalLayout = new_v_lay; Nv_Task_->m_pBtnIco = cBtn_Ico; Nv_Task_->m_pTextFile = cText_file; Nv_Task_->m_pTextPrint = cText_Print; Nv_Task_->m_pTextJdtBk = cText_jdtbk; Nv_Task_->m_pProgRess = cProgress; Nv_Task_->m_pBtnStop = cBtn_Stop; Nv_Task_->m_pBtnGo = cBtn_Down; Nv_Task_->m_pBtnOK = cBtn_Open; Nv_Task_->m_pBtnClose = cBtn_Dele; Nv_Task_->get_WndPtr(this); //数据获取 Nv_Task_->m_strUrl = tag_File_Data.strUrl; Nv_Task_->m_strFileSavePath = tag_File_Data.strPath; Nv_Task_->m_bOpenFile = tag_File_Data.bOpenFile; Nv_Task_->m_strCoolie = tag_File_Data.strCoolie; //vector<_Nv_Download_Ex*>::iterator it; //it = m_vt_Nv_Download.begin(); //m_vt_Nv_Download.insert(it, Nv_Task_); m_vt_Nv_Download.push_back(Nv_Task_); return TRUE; }
BOOL CMainDlg::add_ListItem(const char *strUrl, const char *strFilePath, BOOL bOpenMode, _Nv_Download_Ex *pdlg) { //获取list指针 CListUI *cList_Item = static_cast<CListUI*>(m_pm.FindControl(_T("down_list_tab"))); if(NULL == cList_Item) { return FALSE; } pdlg->m_pList = cList_Item; //创建list item节点指针 CListContainerElementUI *new_node = new CListContainerElementUI; new_node->ApplyAttributeList(_T("height=\"60\"")); pdlg->m_pListElement = new_node; //创建一个界面布局器 横向布局 高度 60 CVerticalLayoutUI *new_v_lay = new CVerticalLayoutUI; new_v_lay->ApplyAttributeList(_T("height=\"60\"")); pdlg->m_pVerticalLayout = new_v_lay; ////////////////////////////////////////////////////////////////////////// //创建各种控件 CButtonUI *cBtn_Ico = new CButtonUI; cBtn_Ico->ApplyAttributeList( _T("name=\"ico\" float=\"true\" pos=\"5,10,0,0\" width=\"48\" height=\"38\" tooltip=\"图标..\" bkimage=\"file='exe_file.png'\"") ); pdlg->m_pBtnIco = cBtn_Ico; CTextUI *cText_file = new CTextUI; cText_file->ApplyAttributeList( _T("name=\"file\" float=\"true\" pos=\"55,15,0,0\" width=\"300\" height=\"20\" tooltip=\"文件名..\" font=\"0\" textcolor=\"#ffffffff\"") ); pdlg->m_pTextFile = cText_file; CTextUI *cText_Print = new CTextUI; cText_Print->ApplyAttributeList( _T("name=\"print\" float=\"true\" pos=\"55,35,0,0\" width=\"300\" height=\"20\" text=\"正在准备下载..\" tooltip=\"进度提示..\" font=\"0\" textcolor=\"#ffddd333\"") ); pdlg->m_pTextPrint = cText_Print; CTextUI *cText_jdtbk = new CTextUI; cText_jdtbk->ApplyAttributeList( _T("name=\"jdtbk\" float=\"true\" pos=\"300,15,0,0\" width=\"210\" height=\"7\" bkimage=\"file='progress_back.png'\"") ); pdlg->m_pTextJdtBk = cText_jdtbk; CProgressUI *cProgress = new CProgressUI; cProgress->ApplyAttributeList( _T("name=\"jdt\" float=\"true\" pos=\"300,15,0,0\" width=\"210\" height=\"7\" foreimage=\"file='progress_fore.png'\"") ); pdlg->m_pProgRess = cProgress; cProgress->SetMaxValue(100); cProgress->SetMinValue(0); CButtonUI *cBtn_Stop = new CButtonUI; cBtn_Stop->ApplyAttributeList( _T("name=\"stop\" float=\"true\" pos=\"400,25,0,0\" width=\"30\" height=\"30\" tooltip=\"暂停下载..\" normalimage=\"file='stop.png'\"") ); pdlg->m_pBtnStop = cBtn_Stop; CButtonUI *cBtn_Down = new CButtonUI; cBtn_Down->ApplyAttributeList( _T("name=\"down\" float=\"true\" pos=\"440,25,0,0\" width=\"30\" height=\"30\" tooltip=\"开始下载..\" normalimage=\"file='go.png'\"") ); pdlg->m_pBtnGo = cBtn_Down; CButtonUI *cBtn_Open = new CButtonUI; cBtn_Open->ApplyAttributeList( _T("name=\"open\" float=\"true\" pos=\"480,25,0,0\" width=\"30\" height=\"30\" tooltip=\"打开文件..\" normalimage=\"file='ok.png'\"") ); pdlg->m_pBtnOK = cBtn_Open; CButtonUI *cBtn_Dele = new CButtonUI; cBtn_Dele->ApplyAttributeList( _T("name=\"dele\" float=\"true\" pos=\"520,5,0,0\" width=\"20\" height=\"20\" tooltip=\"删除任务..\" normalimage=\"file='close.png'\"") ); pdlg->m_pBtnClose = cBtn_Dele; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //将创建好的控件添加到界面布局器中 new_v_lay->Add(cBtn_Ico); new_v_lay->Add(cText_file); new_v_lay->Add(cText_Print); new_v_lay->Add(cText_jdtbk); new_v_lay->Add(cProgress); new_v_lay->Add(cBtn_Stop); new_v_lay->Add(cBtn_Down); new_v_lay->Add(cBtn_Open); new_v_lay->Add(cBtn_Dele); //将界面布局器添加到list item节点中 new_node->Add(new_v_lay); //最后把list节点插入到list中 cList_Item->AddAt(new_node,0); return TRUE; }