// MBEmotionsWnd.cpp : implementation file // #include "stdafx.h" #include "mbamui.h" #include "MBGroupInfoWnd.h" #include "MBAMWnd.h" // CMBGroupInfoWnd CMBGroupInfoWnd::CMBGroupInfoWnd() : SHostWnd(_T("LAYOUT:XML_GROUPINFO")) { m_bLayoutInited = FALSE; m_pServerMgr = NULL; m_pUserLogin = NULL; m_pMBAMWnd = NULL; m_strCrowdID = _T(""); m_strCrowdName = _T(""); m_pCrowdDataMgr = NULL; m_pTileVUserItem = NULL; m_pAdapterUserItemTile = NULL; } CMBGroupInfoWnd::~CMBGroupInfoWnd() { } BOOL CMBGroupInfoWnd::OnInitDialog(HWND wndFocus, LPARAM lInitParam) { m_pTileVUserItem = FindChildByName2("tileex_groupuseritem"); if(m_pTileVUserItem) { m_pAdapterUserItemTile = new CMBGroupUserTileAdapter; m_pAdapterUserItemTile->SetDataPtr( NULL ); m_pAdapterUserItemTile->SetAMWndPtr(m_pMBAMWnd); m_pAdapterUserItemTile->SetMBOrgListMgr(m_pServerMgr->GetOrgListMgr()); m_pAdapterUserItemTile->SetServerMgrPtr(m_pServerMgr); //m_pAdapterUserItemTile->SetGroupUserInfoWndtr(m_pGroupUserInfoWnd); m_pTileVUserItem->SetAdapter(m_pAdapterUserItemTile); m_pAdapterUserItemTile->Release(); // ²»»áÕæµÄÊÍ·Å£¬ÈüÆÊýÆ÷¼õÒ» } m_bLayoutInited = TRUE; ShowCrowdInfo(); return TRUE; } int CMBGroupInfoWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { SetMsgHandled(FALSE); return 0; } void CMBGroupInfoWnd::OnSize(UINT nType, SOUI::CSize size) { SetMsgHandled(FALSE); if (!m_bLayoutInited) return; } void CMBGroupInfoWnd::SetServerMgrPtr( CMBServerMgr *pMBServerMgr ) { m_pServerMgr = pMBServerMgr; m_pUserLogin = pMBServerMgr->GetUserLogin(); } void CMBGroupInfoWnd::SetAMWndPtr( CMBAMWnd *pMBAMWnd ) { m_pMBAMWnd = pMBAMWnd; } void CMBGroupInfoWnd::SetCrowdDataMgr( CCrowdDataMgr *pCrowdDataMgr) { m_pCrowdDataMgr = pCrowdDataMgr; } void CMBGroupInfoWnd::SetCrowdItem( CString strID,CString strName ) { if(strID.IsEmpty()) { return; } m_strCrowdID = strID; m_strCrowdName = strName; if(m_bLayoutInited) { ShowCrowdInfo(); } } void CMBGroupInfoWnd::OnClose() { if(m_pMBAMWnd) m_pMBAMWnd->CloseGroupInfoWnd(m_strCrowdID); CSimpleWnd::DestroyWindow(); } void CMBGroupInfoWnd::ShowCrowdInfo() { if(!m_bLayoutInited) { return; } CString strText; CCrowdItem *pItem = NULL; if(m_pCrowdDataMgr) { if ( m_pCrowdDataMgr->LookupCrowdItem(m_strCrowdID,pItem)) { if(pItem ) { SStringT strTitile; if ( pItem->IsDelete()) { SIconButton *pButton = FindChildByName2(_T("btn_crowdchat")); if(pButton) pButton->SetVisible(false); strTitile.Format(_T("ÎÞЧȺ-%s"),pItem->m_strID); } else { strText.Format(_T("%s"),pItem->m_strName); strTitile.Format(L" Ⱥ£¨%s£©ÐÅÏ¢",pItem->m_strName); } CSimpleWnd::SetWindowText(strTitile); SStatic *pTxt = FindChildByName2(_T("text_groupname")); if(pTxt) pTxt->SetWindowText(strText); pTxt = FindChildByName2(_T("text_creator")); if(pTxt) pTxt->SetWindowText(pItem->m_strCreaterName); strText =pItem->m_dtCreate.Format(_T("%Y-%m-%d")); pTxt = FindChildByName2(_T("text_creattdate")); if(pTxt) pTxt->SetWindowText(strText); strText.Format(_T("%dÈË(ÉÏÏÞ%dÈË)"),pItem->m_nUserCount,pItem->m_nScaCount); pTxt = FindChildByName2(_T("text_scale")); if(pTxt) pTxt->SetWindowText(strText); pTxt = FindChildByName2(_T("text_classify")); if(pTxt) pTxt->SetWindowText(CMBAMUIBaseFun::GetCrowdTypeName(pItem->m_nType)); if(CROWD_VERIFY_ASKINVITE == pItem->m_nVerify ) strText = _T("ÐèÒªÑéÖ¤ºó¼ÓÈë"); else if(CROWD_VERIFY_DISINVITE == pItem->m_nVerify ) strText = _T("²»ÔÊÐíÈκÎÈ˼ÓÈë"); else strText = _T("ÔÊÐíÈκÎÈ˼ÓÈë"); pTxt = FindChildByName2(_T("text_validationtype")); if(pTxt) pTxt->SetWindowText(strText); pTxt = FindChildByName2(_T("text_groupdesc")); if(pTxt) pTxt->SetWindowText(pItem->m_strDesc); pTxt = FindChildByName2(_T("text_groupnotice")); if(pTxt) pTxt->SetWindowText(pItem->m_strNotice); m_pAdapterUserItemTile->SetDataPtr( pItem ); m_pAdapterUserItemTile->SetDataChanged(); return; } } } SIconButton *pButton = FindChildByName2(_T("btn_crowdchat")); if(pButton) pButton->SetVisible(false); strText.Format(_T("%s(ÎÞЧȺ)"),m_strCrowdName); SStringT strTitile; strTitile.Format(_T("ÎÞЧȺ-%s"),m_strCrowdName); CSimpleWnd::SetWindowText(strTitile); SStatic *pTxt = FindChildByName2(_T("text_groupname")); if(pTxt) pTxt->SetWindowText(strText); pTxt = FindChildByName2(_T("text_creator")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_creattdate")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_scale")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_classify")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_validationtype")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_groupdesc")); if(pTxt) pTxt->SetWindowText(_T("")); pTxt = FindChildByName2(_T("text_groupnotice")); if(pTxt) pTxt->SetWindowText(_T("")); m_pAdapterUserItemTile->SetDataPtr( NULL ); m_pAdapterUserItemTile->SetDataChanged(); } void CMBGroupInfoWnd::UpdateCrowdUser() { if(!m_bLayoutInited) { return; } m_pAdapterUserItemTile->SetDataChanged(); } void CMBGroupInfoWnd::OnAMCrowdChat() { if(m_pMBAMWnd) m_pMBAMWnd->ShowAMCrowdChat(m_strCrowdID); PostMessage(WM_CLOSE); }