void CFrameWnd::Notify( TNotifyUI& msg ) { if( msg.sType == _T("click") ) { if( msg.pSender->GetName() == _T("btnMenu") ) { POINT pt = {msg.ptMouse.x, msg.ptMouse.y}; CMenuWnd *pMenu = new CMenuWnd(_T("Menu/menu.xml")); pMenu->Init(*this, pt); pMenu->ShowWindow(TRUE); } } else if(msg.sType == _T("selectchanged")) { CDuiString strName = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabTest"))); if(strName == _T("OptionDemo1")) pControl->SelectItem(0); else if(strName == _T("OptionDemo2")) pControl->SelectItem(1); else if(strName == _T("OptionDemo3")) pControl->SelectItem(2); } __super::Notify(msg); }
void CZiMainFrame::OnSelectTab(TNotifyUI & msg) { CTabLayoutUI * pTabs = DuiControl(CTabLayoutUI, _T("Tabs")); if(!pTabs) return ; if(msg.pSender->GetName() == _T("FriendBtn")) { if(pTabs->GetCurSel() != 0) { pTabs->SelectItem(0); //UpdateFriendsList(); } return; } if(msg.pSender->GetName() == _T("GroupBtn")) { if(pTabs->GetCurSel() != 1) { pTabs->SelectItem(1); //UpdateGroupsList(); } return; } }
void CTradeCtrl::OnSelectChanged( TNotifyUI &msg ) { CDuiString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pThisWnd->m_PaintManager.FindControl(_T("MarketSwitch"))); static COptionUI* pLastButton = NULL; static CAbstractUI* pLastTab = NULL; CAbstractUI* pUI = NULL; for (int idx=0; idx<m_pThisWnd->m_TabContainer.GetSize(); ++idx) { if (name == m_pThisWnd->m_TabContainer[idx]) { pUI = (CAbstractUI*)m_pThisWnd->m_TabContainer.Find(name); } } if (pUI == NULL) return; if (pLastTab != NULL && pUI != pLastTab && !pLastTab->CanChange()) { if (pLastButton) pLastButton->Selected(true); //::MessageBox(NULL, _T(""), _T(""), MB_OK); return; } if (pUI && pUI!=pLastTab) { pUI->RefreshWnd(); pControl->SelectItem(pUI->GetIndex()); pLastTab = pUI; pLastButton = static_cast<COptionUI*>(m_pThisWnd->m_PaintManager.FindControl(msg.pSender->GetName())); } }
void CButtonUI::BindTriggerTabSel( int _SetSelectIndex /*= -1*/ ) { LPCTSTR pstrName = GetBindTabLayoutName(); if(pstrName == NULL || (GetBindTabLayoutIndex() < 0 && _SetSelectIndex < 0)) return; CTabLayoutUI* pTabLayout = static_cast<CTabLayoutUI*>(GetManager()->FindControl(pstrName)); if(!pTabLayout) return; pTabLayout->SelectItem(_SetSelectIndex >=0?_SetSelectIndex:GetBindTabLayoutIndex()); }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } #if defined(UI_BUILD_FOR_WIN32) && !defined(UI_BUILD_FOR_WINCE) else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } #else else if( msg.pSender == m_pMinBtn ) { ::ShowWindow(*this, SW_MINIMIZE); return; } else if( msg.pSender == m_pMaxBtn ) { ::ShowWindow(*this, SW_MAXIMIZE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(true); return; } else if( msg.pSender == m_pRestoreBtn ) { ::ShowWindow(*this, SW_RESTORE); CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("maxbtn"))); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(m_pm.FindControl(_T("restorebtn"))); if( pControl ) pControl->SetVisible(false); return; } #endif } else if(msg.sType==_T("setfocus")) { CStdString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch"))); if(name==_T("examine")) pControl->SelectItem(0); else if(name==_T("trojan")) pControl->SelectItem(1); else if(name==_T("plugins")) pControl->SelectItem(2); else if(name==_T("vulnerability")) pControl->SelectItem(3); else if(name==_T("rubbish")) pControl->SelectItem(4); else if(name==_T("cleanup")) pControl->SelectItem(5); else if(name==_T("fix")) pControl->SelectItem(6); else if(name==_T("tool")) pControl->SelectItem(7); } }
void CCloud::SwitchDialog(int nIndex) { CTabLayoutUI* pTable = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabPage"))); ASSERT(pTable != NULL); if (nIndex != pTable->GetCurSel()) { pTable->SelectItem(m_nIndex); m_nIndex = nIndex; } }
void CButtonUI::BindTriggerTabSel( int _SetSelectIndex /*= -1*/ ) { if(GetBindTabLayoutName().IsEmpty() || (GetBindTabLayoutIndex() < 0 && _SetSelectIndex < 0)) return; CTabLayoutUI* pTabLayout = static_cast<CTabLayoutUI*>(GetManager()->FindControl(GetBindTabLayoutName())); if(!pTabLayout) return; pTabLayout->SelectItem(_SetSelectIndex >=0?_SetSelectIndex:GetBindTabLayoutIndex()); }
void CMainWnd::Notify( TNotifyUI &msg ) { if(msg.sType.CompareNoCase(DUI_MSGTYPE_SCROLL) == 0) { CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)msg.pSender; CString sName = msg.pSender->GetName(); int nPage = (int)msg.wParam; CString sTabPanel = sName; int nIdx = sTabPanel.Find(_T("@")); if(nIdx == -1) return; CString sType = sTabPanel.Mid(nIdx + 1); if(nPage < 1) nPage = 1; if(nPage > 200) nPage = 200; int nScrollPos = (nPage - 1) * pTabPanel->GetVerticalScrollBar()->GetLineSize(); SIZE szSize = {0, nScrollPos}; pTabPanel->SetScrollPos(szSize, false); m_Data.LoadBizhi(sType, nPage, 10); } else if(msg.sType.CompareNoCase(DUI_MSGTYPE_SELECTCHANGED) == 0) { COptionUI* pTabBtn = (COptionUI*)msg.pSender; CTabLayoutUI* pTabLayout = (CTabLayoutUI*)m_PaintManager.FindControl(_T("wp_tablayout")); CString sName = pTabBtn->GetName(); if(sName == _T("wp_tabbtn") && pTabLayout) { CString sType = pTabBtn->GetUserData(); CString sTabPanel; sTabPanel.Format(_T("wp_tabpanel@%s"), sType); CVerticalLayoutUI* pTabPanel = (CVerticalLayoutUI*)m_PaintManager.FindControl(sTabPanel); if(pTabPanel == NULL) { m_Data.LoadBizhi(sType, 1, 10); } else { pTabLayout->SelectItem(pTabPanel); } } } else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPFAV) == 0) { MessageBox(NULL, _T("收藏成功"), _T("百度壁纸 - 提示"), MB_OK); } else if(msg.sType.CompareNoCase(DUI_MSGTYPE_CLICK_WPSET) == 0) { CWPButton* pWPBtn = (CWPButton*)msg.pSender; pWPBtn->SetWP(); } return WindowImplBase::Notify(msg); }
void CMainDialog::OnSelChanged( CControlUI* pSender ) { CTabLayoutUI* pTabTest = static_cast <CTabLayoutUI*>(m_pm.FindControl(_T ("tabTest"))); if (pTabTest == NULL) { return; } CDuiString strSelName = pSender->GetName(); if (strSelName == _T ("tabButton")) { pTabTest->SelectItem(0); } else if (strSelName == _T ("tabEdit")) { pTabTest->SelectItem(1); } else if (strSelName == _T ("tabTree")) { pTabTest->SelectItem(2); } else if (strSelName == _T ("tabList")) { pTabTest->SelectItem(3); } else if (strSelName == _T ("tabMenu")) { pTabTest->SelectItem(4); } else if (strSelName == _T ("tabActivex")) { pTabTest->SelectItem(5); } else if (strSelName == _T ("tabCombobox")) { pTabTest->SelectItem(6); } }
void CZiMainFrame::OnItemChat(TNotifyUI & msg) { // CTabLayoutUI * pTabs = DuiControl(CTabLayoutUI, _T("Tabs")); if(!pTabs) return ; CBaseItemListUI * pItemListUi = DuiControl(CBaseItemListUI, GetCurListName(pTabs->GetCurSel())); if(pItemListUi && ( pItemListUi->GetItemIndex(msg.pSender) != -1) && ( ::_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)) { CNodeList * pNode = (CNodeList *)msg.pSender->GetTag(); CreateChatDailog(pNode); } }
void MainFrame::OnItemActivate(TNotifyUI& msg) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kMainTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(m_PaintManager.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName); if (!pFriendsList->CanExpand(node) && (background != NULL)) { FriendListItemInfo friend_info; for (std::vector<FriendListItemInfo>::const_iterator citer = friends_.begin(); citer != friends_.end(); ++citer) { if (_tcsicmp(citer->id, node->data().value) == 0) { friend_info = *citer; break; } } TCHAR szBuf[MAX_PATH] = { 0 }; if (_tcslen(background->GetBkImage()) > 0) { _stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_); } ChatDialog* pChatDialog = new ChatDialog(szBuf, background->GetBkColor(), myself_info_, friend_info); if (pChatDialog == NULL) return; pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0); skin_changed_observer_.AddReceiver(pChatDialog); pChatDialog->CenterWindow(); ::ShowWindow(*pChatDialog, SW_SHOW); } } } } } }
void MainFrame::OnSelectChange(TNotifyUI& msg) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kMainTabControlName)); if (_tcsicmp(msg.pSender->GetName(), kFriendButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 0) { pTabControl->SelectItem(0); UpdateFriendsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kGroupButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 1) { pTabControl->SelectItem(1); UpdateGroupsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kMicroBlogButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 2) { pTabControl->SelectItem(2); UpdateRecentlyList(); } } }
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; }
void CZiMainFrame::OnSelectItemList(TNotifyUI & msg) { // 仅仅支持左键点击. if(msg.wParam != UIEVENT_BUTTONDOWN) return; CTabLayoutUI * pTabs = DuiControl(CTabLayoutUI, _T("Tabs")); if(!pTabs) return ; CBaseItemListUI * pItemListUi = DuiControl(CBaseItemListUI, GetCurListName(pTabs->GetCurSel())); if(pItemListUi && ( pItemListUi->GetItemIndex(msg.pSender) != -1) && ( ::_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0)) { CNodeList * pNode = (CNodeList *)msg.pSender->GetTag(); if(pItemListUi->CanExpand(pNode)) // 能否展开. { pItemListUi->SetChildVisible(pNode, !pNode->GetNodeData().bIsChildVisible); } } }
void MainFrame::OnItemClick(TNotifyUI& msg) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kMainTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(m_PaintManager.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pFriendsList->CanExpand(node)) { pFriendsList->SetChildVisible(node, !node->data().child_visible_); } } } } else if (pTabControl->GetCurSel() == 1) { CGroupsUI* pGroupsList = static_cast<CGroupsUI*>(m_PaintManager.FindControl(kGroupsListControlName)); if ((pGroupsList != NULL) && pGroupsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pGroupsList->CanExpand(node)) { pGroupsList->SetChildVisible(node, !node->data().child_visible_); } } } } } }
LRESULT CZiMainFrame::OnNcHitTest(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); ::ScreenToClient(*this, &pt); RECT rcClient; ::GetClientRect(*this, &rcClient); CControlUI* pControl = DuiControl(CControlUI, pt); if(pControl && _tcsicmp(pControl->GetClass(), _T("ButtonUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("OptionUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("TextUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("CheckBoxUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("ListUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("ComboUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("LabelUI")) != 0 && _tcsicmp(pControl->GetClass(), _T("EditUI")) != 0) { // 判断是否是好友列表框中. CTabLayoutUI * pTabs = DuiControl(CTabLayoutUI, _T("Tabs")); Assert(pTabs); const RECT & rcSize = pTabs->GetPos(); if(pt.x > rcSize.left && pt.x < rcSize.right && pt.y > rcSize.top && pt.y < rcSize.bottom) { return HTCLIENT; } //if(pControl) ::OutputDebugStringW(pControl->GetClass()); return HTCAPTION; } return HTCLIENT; }
void Notify(TNotifyUI& msg) { if( msg.sType == _T("windowinit") ) OnPrepare(); else if( msg.sType == _T("click") ) { if( msg.pSender == m_pCloseBtn ) { PostQuitMessage(0); return; } else if( msg.pSender == m_pMinBtn ) { SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; } else if( msg.pSender == m_pMaxBtn ) { SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; } else if( msg.pSender == m_pRestoreBtn ) { SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; } } else if(msg.sType==_T("selectchanged")) { CDuiString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch"))); if(name==_T("examine")) pControl->SelectItem(0); else if(name==_T("trojan")) pControl->SelectItem(1); else if(name==_T("plugins")) pControl->SelectItem(2); else if(name==_T("vulnerability")) pControl->SelectItem(3); else if(name==_T("rubbish")) pControl->SelectItem(4); else if(name==_T("cleanup")) pControl->SelectItem(5); else if(name==_T("fix")) pControl->SelectItem(6); else if(name==_T("tool")) pControl->SelectItem(7); } }
void CDuilib3dFrame::Notify(TNotifyUI& msg) { CStdString strName = msg.pSender->GetName(); if(msg.sType == _T("windowinit")) { } else if (msg.sType == _T("click")) { if (strName == _T("closebtn")) { //Close(); m_cls.Create(m_hWnd,230,false,SW_MINIMIZE,CCloseAnimation::STYLE_CLOSE_ICON); } else if (strName == _T("scanbtn")) { CControlUI* pControl = m_PaintManager.FindControl(_T("testanibtn")); RECT rc = pControl->GetPos(); rc.right = rc.left+64; rc.bottom = rc.top+64; POINT ptCenter = {rc.left+32,rc.top+32}; POINT ptTrans = {-120,100}; CAnimJobUI anim(0,500,ptCenter,ptTrans,1.0f,1.0f); anim.SetTextureFromFile(_T("../bin/skin/texture.png")); m_PaintManager.AddAnimJob(anim); } else if (strName == _T("common") || strName == _T("mumaoption") || strName == _T("shaduoption") || strName == _T("wangdunoption") || strName == _T("fdhoption") || strName == _T("rjgjoption")) { RECT rc = msg.pSender->GetPos(); POINT ptStartCenter = {rc.left+(rc.right-rc.left)/2,rc.top+(rc.bottom-rc.top)/2}; POINT ptTrans = {200,0}; CAnimJobUI anim(0,500,ptStartCenter,ptTrans,1.0f,1.0f,false,false,rc,rc); anim.SetSpeedType(SPEED_LINEAR); m_PaintManager.AddAnimJob(anim); } else if (strName == _T("testanibtn")) { } } else if(msg.sType==_T("selectchanged")) { CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("switch"))); RECT rcSrc = pControl->GetPos(); RECT rcClip = {rcSrc.left+1,rcSrc.top+1,rcSrc.right-1,rcSrc.bottom};; long rcWidth = rcClip.right - rcClip.left; long rcHeight = rcClip.bottom - rcClip.top; CStdString stdString[8] = {_T("examine"),_T("trojan"),_T("plugins"),_T("vulnerability"),_T("rubbish"),_T("cleanup"),_T("fix"),_T("tool")}; POINT ptStartCenter = {rcClip.left+rcWidth/2,rcClip.top+rcHeight/2}; POINT ptTrans = {-rcWidth,0}; for (int i=0;i<8;++i) { if (strName == stdString[i]) { CAnimJobUI anim(0,500,ptStartCenter,ptTrans,1.0f,1.0f,true,true,rcClip,rcClip); m_PaintManager.AddAnimJob(anim); pControl->SelectItem(i); ptStartCenter.x += rcWidth; CAnimJobUI animTmp(0,500,ptStartCenter,ptTrans,1.0f,1.0f,true,true,rcClip,rcClip,WM_USER+1,pControl); if (m_PaintManager.AddAnimJob(animTmp)) { pControl->SetVisible(false); } } } } else if (msg.sType == _T("tabselect")) { } }
void ColorSkinWindow::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("click")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { if (_tcsstr(msg.pSender->GetName(), _T("colour_")) != 0) { CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderRControlName)); CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderGControlName)); CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderBControlName)); if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL)) { DWORD dwColor = msg.pSender->GetBkColor(); AdjustColorSliderR->SetValue(static_cast<BYTE>(GetRValue(dwColor))); AdjustColorSliderG->SetValue(static_cast<BYTE>(GetGValue(dwColor))); AdjustColorSliderB->SetValue(static_cast<BYTE>(GetBValue(dwColor))); main_frame_->SetBkColor(dwColor); } } } else if (pTabControl->GetCurSel() == 1) {} } } else if (_tcsicmp(msg.sType, _T("valuechanged")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderRControlName)); CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderGControlName)); CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(kAdjustColorSliderBControlName)); if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL)) { if ((_tcsicmp(msg.pSender->GetName(), kAdjustColorSliderRControlName) == 0) || (_tcsicmp(msg.pSender->GetName(), kAdjustColorSliderGControlName) == 0) || (_tcsicmp(msg.pSender->GetName(), kAdjustColorSliderBControlName) == 0)) { BYTE red = AdjustColorSliderR->GetValue(); BYTE green = AdjustColorSliderG->GetValue(); BYTE blue = AdjustColorSliderB->GetValue(); COLORREF crColor = RGB(red, green, blue); TCHAR szBuf[MAX_PATH] = {0}; #if defined(UNDER_CE) _stprintf(szBuf, _T("FF%02X%02X%02X"), GetRValue(crColor), GetGValue(crColor), GetBValue(crColor)); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("FF%02X%02X%02X"), GetRValue(crColor), GetGValue(crColor), GetBValue(crColor)); #endif LPTSTR pstr = NULL; DWORD dwColor = _tcstoul(szBuf, &pstr, 16); main_frame_->SetBkColor(dwColor); } } } else if (pTabControl->GetCurSel() == 1) {} } } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(kTabControlName)); if (_tcsicmp(msg.pSender->GetName(), kAdjustColorControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 0) { pTabControl->SelectItem(0); } } else if (_tcsicmp(msg.pSender->GetName(), kAdjustBkControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 1) { pTabControl->SelectItem(1); } } } }
void imsdkDemoLogin::Notify(TNotifyUI& msg) { if (msg.sType == _T("click")) { if (msg.pSender == m_pCloseBtn) { PostQuitMessage(0); return; } if (msg.pSender == m_pLoginBtn) { CEditUI* pEditServer = static_cast<CEditUI*>(m_pm.FindControl(_T("editServer"))); CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("editAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("editPassword"))); std::string server = getString(pEditServer->GetText().GetData()); std::string account = getString(pEditAccount->GetText().GetData()); std::string password = getString(pEditPassword->GetText().GetData()); gClientDemo.login(server, account, password, std::bind(&imsdkDemoLogin::onLoginCb, this, std::placeholders::_1)); //Close(7); } if (msg.pSender == m_pSignCodeBtn) { CEditUI* pEditServer = static_cast<CEditUI*>(m_pm.FindControl(_T("signServer"))); CEditUI* pEditPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("signPhone"))); std::string server = getString(pEditServer->GetText().GetData()); std::string phone = getString(pEditPhone->GetText().GetData()); gClientDemo.getRegCode(server, phone); m_secGetSignCode = 30; m_pSignCodeBtn->SetEnabled(false); std::string strText = std::to_string(m_secGetSignCode) + "s后重试"; auto strT = getWString(strText.c_str()); m_pSignCodeBtn->SetText(strT.c_str()); ::SetTimer(GetHWND(), 7, 1000, NULL); } if (msg.pSender == m_pSignUpBtn) { CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("signAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("signPassword"))); CEditUI* pEditSignCode = static_cast<CEditUI*>(m_pm.FindControl(_T("signCode"))); std::string account = getString(pEditAccount->GetText().GetData()); std::string password = getString(pEditPassword->GetText().GetData()); std::string signcode = getString(pEditSignCode->GetText().GetData()); gClientDemo.reg(account, password, signcode); } } else if (msg.sType == _T("selectchanged")) { CDuiString name = msg.pSender->GetName(); CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("login"))); if (name == _T("optLogin")){ CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("editAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("editPassword"))); pEditAccount->SetText(_T("手机号")); pEditPassword->SetText(_T("密码")); pControl->SelectItem(0); } else if (name == _T("optSignUp")) { CEditUI* pEditPhone = static_cast<CEditUI*>(m_pm.FindControl(_T("signPhone"))); CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("signAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("signPassword"))); CEditUI* pEditSignCode = static_cast<CEditUI*>(m_pm.FindControl(_T("signCode"))); pEditPhone->SetText(_T("手机号")); pEditAccount->SetText(_T("用户名")); pEditPassword->SetText(_T("密码")); pEditSignCode->SetText(_T("验证码")); pControl->SelectItem(1); } } else if (msg.sType == _T("return")) { // Enter键注册、登录 CTabLayoutUI* pTab = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("login"))); if (0 == pTab->GetCurSel()){ // CEditUI* pEditServer = static_cast<CEditUI*>(m_pm.FindControl(_T("editServer"))); CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("editAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("editPassword"))); if (pEditPassword->IsFocused()) { std::string server = getString(pEditServer->GetText().GetData()); std::string account = getString(pEditAccount->GetText().GetData()); std::string password = getString(pEditPassword->GetText().GetData()); gClientDemo.login(server, account, password, std::bind(&imsdkDemoLogin::onLoginCb, this, std::placeholders::_1)); } if (pEditAccount->IsFocused()) { pEditPassword->SetFocus(); } } else { CEditUI* pEditAccount = static_cast<CEditUI*>(m_pm.FindControl(_T("signAccount"))); CEditUI* pEditPassword = static_cast<CEditUI*>(m_pm.FindControl(_T("signPassword"))); CEditUI* pEditSignCode = static_cast<CEditUI*>(m_pm.FindControl(_T("signCode"))); std::string account = getString(pEditAccount->GetText().GetData()); std::string password = getString(pEditPassword->GetText().GetData()); std::string signcode = getString(pEditSignCode->GetText().GetData()); gClientDemo.reg(account, password, signcode); } } }
void MainFrame::Notify(TNotifyUI& msg) { if (_tcsicmp(msg.sType, _T("windowinit")) == 0) { OnPrepare(msg); } else if (_tcsicmp(msg.sType, _T("killfocus")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kSignatureControlName) == 0) { msg.pSender->SetVisible(false); CControlUI* signature_tip = paint_manager_.FindControl(kSignatureTipsControlName); if (signature_tip != NULL) { CRichEditUI* signature = static_cast<CRichEditUI*>(msg.pSender); if (signature != NULL) signature_tip->SetText(signature->GetText()); signature_tip->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kSearchEditControlName) == 0) { msg.pSender->SetVisible(false); CControlUI* search_tip = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSearchEditTipControlName)); if (search_tip != NULL) { CRichEditUI* search_edit = static_cast<CRichEditUI*>(msg.pSender); if (search_edit != NULL) search_tip->SetText(search_edit->GetText()); search_tip->SetVisible(true); } } } else if (_tcsicmp(msg.sType, _T("click")) == 0) { if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0) { OnExit(msg); } else if (_tcsicmp(msg.pSender->GetName(), kMinButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_MINIMIZE); #else SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kMaxButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_MAXIMIZE); CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(false); pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName)); if( pControl ) pControl->SetVisible(true); #else SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kRestoreButtonControlName) == 0) { #if defined(UNDER_CE) ::ShowWindow(m_hWnd, SW_RESTORE); CControlUI* pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kMaxButtonControlName)); if( pControl ) pControl->SetVisible(true); pControl = static_cast<CControlUI*>(paint_manager_.FindControl(kRestoreButtonControlName)); if( pControl ) pControl->SetVisible(false); #else SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); #endif } else if (_tcsicmp(msg.pSender->GetName(), kHideLeftMainPannelControlName) == 0) { CControlUI* left_main_pannel = paint_manager_.FindControl(kLeftMainPannelControlName); CControlUI* hide_left_main_pannel = paint_manager_.FindControl(kHideLeftMainPannelControlName); CControlUI* show_left_main_pannel = paint_manager_.FindControl(kShowLeftMainPannelControlName); if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL)) { hide_left_main_pannel->SetVisible(false); left_main_pannel->SetVisible(false); show_left_main_pannel->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kShowLeftMainPannelControlName) == 0) { CControlUI* left_main_pannel = paint_manager_.FindControl(kLeftMainPannelControlName); CControlUI* hide_left_main_pannel = paint_manager_.FindControl(kHideLeftMainPannelControlName); CControlUI* show_left_main_pannel = paint_manager_.FindControl(kShowLeftMainPannelControlName); if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL)) { hide_left_main_pannel->SetVisible(true); left_main_pannel->SetVisible(true); show_left_main_pannel->SetVisible(false); } } else if (_tcsicmp(msg.pSender->GetName(), kSignatureTipsControlName) == 0) { msg.pSender->SetVisible(false); CRichEditUI* signature = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSignatureControlName)); if (signature != NULL) { signature->SetText(msg.pSender->GetText()); signature->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kSearchEditTipControlName) == 0) { msg.pSender->SetVisible(false); CRichEditUI* search_edit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kSearchEditControlName)); if (search_edit != NULL) { search_edit->SetText(msg.pSender->GetText()); search_edit->SetVisible(true); } } else if (_tcsicmp(msg.pSender->GetName(), kChangeBkSkinControlName) == 0) { CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (background != NULL) { TCHAR szBuf[MAX_PATH] = {0}; ++bk_image_index_; if (kBackgroundSkinImageCount < bk_image_index_) bk_image_index_ = 0; #if defined(UNDER_WINCE) _stprintf(szBuf, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_); #endif background->SetBkImage(szBuf); SkinChangedParam param; CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (background != NULL) { param.bkcolor = background->GetBkColor(); if (_tcslen(background->GetBkImage()) > 0) { #if defined(UNDER_WINCE) _stprintf(szBuf, _T("bg%d.png"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_); #endif } param.bgimage = szBuf; } skin_changed_observer_.Broadcast(param); } } else if (_tcsicmp(msg.pSender->GetName(), kChangeColorSkinControlName) == 0) { CDuiRect rcWindow; GetWindowRect(m_hWnd, &rcWindow); rcWindow.top = rcWindow.top + msg.pSender->GetPos().bottom; new ColorSkinWindow(this, rcWindow); } } else if (_tcsicmp(msg.sType, _T("timer")) == 0) { return OnTimer(msg); } else if (_tcsicmp(msg.sType, _T("selectchanged")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (_tcsicmp(msg.pSender->GetName(), kFriendButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 0) { pTabControl->SelectItem(0); UpdateFriendsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kGroupButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 1) { pTabControl->SelectItem(1); UpdateGroupsList(); } } else if (_tcsicmp(msg.pSender->GetName(), kMicroBlogButtonControlName) == 0) { if (pTabControl && pTabControl->GetCurSel() != 2) { pTabControl->SelectItem(2); UpdateMicroBlogList(); } } } else if (_tcsicmp(msg.sType, _T("itemactivate")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(paint_manager_.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); CControlUI* background = paint_manager_.FindControl(kBackgroundControlName); if (!pFriendsList->CanExpand(node) && (background != NULL)) { FriendListItemInfo friend_info; for (std::vector<FriendListItemInfo>::const_iterator citer = friends_.begin(); citer != friends_.end(); ++citer) { if (_tcsicmp(citer->id.c_str(), node->data().value.c_str()) == 0) { friend_info = *citer; break; } } TCHAR szBuf[MAX_PATH] = {0}; if (_tcslen(background->GetBkImage()) > 0) { #if defined(UNDER_WINCE) _stprintf(szBuf, _T("bg%d.png"), bk_image_index_); #else _stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_); #endif } ChatDialog* pChatDialog = new ChatDialog(szBuf, background->GetBkColor(), myself_info_, friend_info); if( pChatDialog == NULL ) return; #if defined(WIN32) && !defined(UNDER_CE) pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0); #else pChatDialog->Create(NULL, _T("ChatDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, NULL, 0, 0, 0, 0); #endif skin_changed_observer_.AddReceiver(pChatDialog); pChatDialog->CenterWindow(); ::ShowWindow(*pChatDialog, SW_SHOW); } } } } } } else if (_tcsicmp(msg.sType, _T("itemclick")) == 0) { CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(paint_manager_.FindControl(kTabControlName)); if (pTabControl != NULL) { if (pTabControl->GetCurSel() == 0) { CFriendsUI* pFriendsList = static_cast<CFriendsUI*>(paint_manager_.FindControl(kFriendsListControlName)); if ((pFriendsList != NULL) && pFriendsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pFriendsList->CanExpand(node)) { pFriendsList->SetChildVisible(node, !node->data().child_visible_); } } } } else if (pTabControl->GetCurSel() == 1) { CGroupsUI* pGroupsList = static_cast<CGroupsUI*>(paint_manager_.FindControl(kGroupsListControlName)); if ((pGroupsList != NULL) && pGroupsList->GetItemIndex(msg.pSender) != -1) { if (_tcsicmp(msg.pSender->GetClass(), _T("ListContainerElementUI")) == 0) { Node* node = (Node*)msg.pSender->GetTag(); if (pGroupsList->CanExpand(node)) { pGroupsList->SetChildVisible(node, !node->data().child_visible_); } } } } } } }
int ShowMsgBox(HWND hwnd, LPCTSTR lpszText, LPCTSTR lpszCaption, UINT nType) { if(!IsWindow()) { // this->Create(hwnd,lpszCaption,UI_WNDSTYLE_DIALOG,UI_WNDSTYLE_EX_DIALOG); this->Create(hwnd,lpszCaption,UI_WNDSTYLE_DIALOG,0); } CenterWindow(); CTextUI* pTitle = static_cast<CTextUI*>(GetPaintMgr()->FindControl(_T("title"))); CTextUI* pMsg = static_cast<CTextUI*>(GetPaintMgr()->FindControl(_T("msg"))); CButtonUI* pCancelBtn = static_cast<CButtonUI*>(GetPaintMgr()->FindControl(_T("cancel"))); CButtonUI* pOkBtn = static_cast<CButtonUI*>(GetPaintMgr()->FindControl(_T("yes"))); CTabLayoutUI* pTable = static_cast<CTabLayoutUI*>(GetPaintMgr()->FindControl(_T("icon"))); CCheckBoxUI* pCheckBox= static_cast<CCheckBoxUI*>(GetPaintMgr()->FindControl(_T("checkbox"))); ASSERT(pTitle); ASSERT(pMsg); ASSERT(pCancelBtn); ASSERT(pOkBtn); ASSERT(pTable); ASSERT(pCheckBox); if(pTitle) pTitle->SetText((lpszCaption ? lpszCaption : _T(""))); if(pMsg) pMsg->SetText((lpszText ? lpszText : _T(""))); if(pCancelBtn) pCancelBtn->SetFocus(); if(pTable) { if(nType & MBT_INFO) pTable->SelectItem(0); else if(nType & MBT_OK) pTable->SelectItem(1); else if(nType & MBT_WARN) pTable->SelectItem(2); } const bool isShowCancel = (pCancelBtn && ((nType & MBBT_CANCEL) > 0)); const bool isShowOk = (pOkBtn && ((nType & MBBT_OK) > 0)); const bool isShowCheckBox = (pCheckBox &&((nType & MBBT_CHECKBOX) > 0)); const bool isShake = ((nType & MBT_SHAKE) > 0); _bShakeWindow = isShake; pCancelBtn->SetVisible(isShowCancel); pOkBtn->SetVisible(isShowOk); pCheckBox->SetVisible((/*isShowOk && */isShowCheckBox)); if(!isShowCancel && isShowOk) { pCancelBtn->SetVisible(true); pOkBtn->SetVisible(false); pCancelBtn->SetName(pOkBtn->GetName()); pCancelBtn->SetText(pOkBtn->GetText()); pCancelBtn->SetToolTip(pOkBtn->GetToolTip()); pCancelBtn->SetFocus(); } return ShowModal(); }
void CDuiFrameWnd::Notify( TNotifyUI& msg ) { if (msg.sType == DUI_MSGTYPE_SELECTCHANGED) { CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist"))); if(pTree && -1 != pTree->GetItemIndex(msg.pSender) && U_TAG_PLAYLIST == msg.pSender->GetTag()) { m_iPlaylistIndex = pTree->GetItemIndex(msg.pSender); Play(m_cPlayList.GetPlaylist(GetPlaylistIndex(m_iPlaylistIndex)).szFileName); //(static_cast<CTreeNodeUI*> (msg.pSender))->GetItemText(); } } else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED) { CDuiString strName = msg.pSender->GetName(); CTabLayoutUI* pTab = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabCaption"))); std::vector<CDuiString> vctString; vctString.push_back(_T("tabPlay")); vctString.push_back(_T("tabLib")); vctString.push_back(_T("tabFind")); vctString.push_back(_T("tabMine")); vctString.push_back(_T("tabCloud")); std::vector<CDuiString>::iterator it = std::find(vctString.begin(), vctString.end(), strName); if (vctString.end() != it) { int iIndex = it - vctString.begin(); pTab->SelectItem(iIndex); // 加载网页 // 由于加载网页会耗很多内存,所以这里选择动态加载 if (iIndex > 0) { std::vector<CDuiString> vctName, vctURL; CActiveXUI* pActiveXUI; vctName.push_back(_T("ActiveXLib")); vctName.push_back(_T("ActiveXFind")); vctName.push_back(_T("ActiveXMine")); vctName.push_back(_T("ActiveXCloud")); vctURL.push_back(_T("http://pianku.xmp.kankan.com/moviestore_index.html")); vctURL.push_back(_T("http://search.xmp.kankan.com/index4xmp.shtml")); vctURL.push_back(_T("http://pianku.xmp.kankan.com/xmpguess/host.html")); vctURL.push_back(_T("http://vod.xunlei.com/page/xmp/home/home.html?init=1")); iIndex--; pActiveXUI = static_cast<CActiveXUI*>(m_PaintManager.FindControl(vctName[iIndex])); if(pActiveXUI) { IWebBrowser2* pWebBrowser = NULL; pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser); if(pWebBrowser) { _bstr_t bstrTmp; BSTR bstr; pWebBrowser->get_LocationURL(&bstr); bstrTmp.Attach(bstr); if (! bstrTmp.length()) { pWebBrowser->Navigate(_bstr_t(vctURL[iIndex]), NULL,NULL,NULL,NULL); pWebBrowser->Release(); } } } } } } else if(msg.sType == DUI_MSGTYPE_ITEMCLICK) { CDuiString strName = msg.pSender->GetName(); if (strName == _T("menuSequence")) { m_emPlayMode = EM_PLAY_MODE_SEQUENCE; } else if (strName == _T("menuRandom")) { m_emPlayMode = EM_PLAY_MODE_RANDOM; } else if (strName == _T("menuSingleCircle")) { m_emPlayMode = EM_PLAY_MODE_SINGLE_CIRCLE; } } else if( msg.sType == DUI_MSGTYPE_DBCLICK ) { if (IsInStaticControl(msg.pSender)) { // 这里会传进来很多次双击消息,所以只获取祖先控件的消息 if (! msg.pSender->GetParent()) { FullScreen(! m_bFullScreenMode); } } } __super::Notify(msg); }
void CMainDlg::Notify(TNotifyUI& msg) { //throw std::exception("The method or operation is not implemented."); //单击事件 if(msg.sType == DUI_MSGTYPE_CLICK) { //点击关闭按钮 if(msg.pSender->GetName() == _T("sys_close_btn")) //退出 Close(0); //点击添加按钮 else if(msg.pSender->GetName() == _T("add_option")) { //新建一个option按钮 CDialogBuilder builder; COptionUI * p = static_cast<COptionUI *>(builder.Create(_T("option.xml"),0,NULL,&m_pm)); if(NULL == p) return; CContainerUI * pContainer = static_cast<CContainerUI *>(m_pm.FindControl(_T("main_option_layout"))); int nCount = pContainer->GetCount(); static int i = 1; CDuiString str1; str1.Format(_T("新增按钮%d"), i); p->SetText(str1); pContainer->AddAt(p, nCount - 1); CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab"))); if(NULL != pTab) { CDuiString str2; str2.Format(_T("新增界面%d"), i); //增加一个界面,这里可以像上边option一样使用xml创建 CButtonUI * pButton = new CButtonUI; pButton->SetTextColor(0xffffffff); pButton->SetText(str2); pTab->Add(pButton); p->SetTag(pTab->GetCount() - 1); } i++; } } //切换选项卡按钮时根据不同的按钮,选中不同的界面 else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED) { if(msg.pSender->GetName() == _T("option_1")) { CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab"))); if(NULL != pTab) { CControlUI * pControl = pTab->FindSubControl(_T("tab_01")); if(NULL != pControl) pTab->SelectItem(pControl); } } else if(msg.pSender->GetName() == _T("option_2")) { CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab"))); if(NULL != pTab) { CControlUI * pControl = pTab->FindSubControl(_T("tab_02")); if(NULL != pControl) pTab->SelectItem(pControl); } } else if(msg.pSender->GetName() == _T("option")) { CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab"))); pTab->SelectItem(msg.pSender->GetTag()); } } }