Exemplo n.º 1
0
BOOL ChatDialog::Receive(SkinChangedParam param)
{
	bgimage_ = param.bgimage;
	bkcolor_ = param.bkcolor;
	CControlUI* background = paint_manager_.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
		if (!param.bgimage.empty())
		{
			TCHAR szBuf[MAX_PATH] = {0};
#if defined(UNDER_WINCE)
			_stprintf(szBuf, _T("file='%s' corner='600,200,1,1'"), param.bgimage.c_str());
#else
			_stprintf_s(szBuf, MAX_PATH - 1, _T("file='%s' corner='600,200,1,1'"), param.bgimage.c_str());
#endif
			background->SetBkImage(szBuf);
		}
		else
			background->SetBkImage(_T(""));

		background->SetBkColor(param.bkcolor);
	}

	return TRUE;
}
Exemplo n.º 2
0
 BOOL CLoginWindow::Receive(SkinChangedParam param)
 {
	 try
	 {
		 if(!IsWindow()) return FALSE;
		 sLog("CLoginWindow::Receive");
		 CDuiString bgimage_ = param.bgimage;
		 DWORD bkcolor_ = param.bkcolor;
		 CControlUI* background = GetPaintMgr()->GetRoot();
		 if (background != NULL&&0!=bgimage_.Compare(background->GetBkImage()))
		 {
			 if (!param.bgimage.IsEmpty())
			 {
				 CDuiString sBkImage = bgimage_;

				 background->SetBkImage(sBkImage);
			 }
			 else
				 background->SetBkImage(_T(""));

			 background->SetBkColor(param.bkcolor);
		 }

		 return TRUE;
	 }
	 catch (...)
	 {
		 sLogError("CLoginWindow::Receive");
		 throw _T("CLoginWindow::Receive");
		 return FALSE;
	 }	
 }
Exemplo n.º 3
0
NSDUILIB_API void  SetControlData(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
	TCHAR controlName[MAX_PATH];
	TCHAR controlData[MAX_PATH];
	TCHAR dataType[MAX_PATH];

	EXDLL_INIT();

	ZeroMemory(controlName, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(controlData, MAX_PATH*sizeof(TCHAR));
	ZeroMemory(dataType, MAX_PATH*sizeof(TCHAR));

	popstring( controlName,sizeof(controlName));
	popstring( controlData,sizeof(controlData));
	popstring( dataType,sizeof(dataType));

	CControlUI* pControl = static_cast<CControlUI*>(g_pFrame->GetPaintManager().FindControl( controlName ));
	if( pControl == NULL )
		return;

	if( _tcsicmp( dataType, _T("text") ) == 0 )
	{
		if( _tcsicmp( controlData, _T("error")) == 0 || _tcsicmp( controlData, _T("")) == 0 )
			pControl->SetText( pControl->GetText() );
		else
			pControl->SetText( controlData );
	}
	else if( _tcsicmp( dataType, _T("bkimage") ) == 0 )
	{
		if( _tcsicmp( controlData, _T("error")) == 0 || _tcsicmp( controlData, _T("")) == 0 )
			pControl->SetBkImage( pControl->GetBkImage());
		else
			pControl->SetBkImage( controlData );
	}
	else if( _tcsicmp( dataType, _T("link") ) == 0 )
	{
		g_controlLinkInfoMap[controlName] = controlData;
	}
	else if( _tcsicmp( dataType, _T("enable") ) == 0 )
	{
		if( _tcsicmp( controlData, _T("true")) == 0 )
			pControl->SetEnabled( true );
		else if( _tcsicmp( controlData, _T("false")) == 0 )
			pControl->SetEnabled( false );
	}
	else if( _tcsicmp( dataType, _T("visible") ) == 0 )
	{
		if( _tcsicmp( controlData, _T("true")) == 0 )
			pControl->SetVisible( true );
		else if( _tcsicmp( controlData, _T("false")) == 0 )
			pControl->SetVisible( false );
	}
}
Exemplo n.º 4
0
void CMainFrame::OnPrepare(TNotifyUI& msg)
{
	CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
		TCHAR szBuf[MAX_PATH] = {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);
	}
	
	UpdateFriendsList();

	UpdateGroupsList();

	UpdateMicroBlogList();

	CDuiRect rcWindow;
	GetWindowRect(m_hWnd, &rcWindow);
	rcWindow.top = rcWindow.top + msg.pSender->GetPos().bottom;
	ColorSkinWindow* pcs=new ColorSkinWindow((CMainFrame *)this, rcWindow);
}
Exemplo n.º 5
0
void loginUI::ShowQRCodePicture()
{
	CControlUI* pUI = GetQRCodeUI();
	std::wstring wCodePath = Path::GetCurrentPath();
	wCodePath += L"wxCode.jpg";
	pUI->SetBkImage(wCodePath.c_str());
}
Exemplo n.º 6
0
    void CDuiFrameWnd::InitWindow()
{
    CControlUI *btn = m_PaintManager.FindControl(_T("dangerous_HorizontalLayoutUI9"));
    btn->SetVisible(false);
    btn = m_PaintManager.FindControl(_T("window_VerticalLayout"));
    btn->SetBkImage(_T("skin_1.png"));
//    CControlUI *btn = m_PaintManager.FindControl(_T("danerous2_HorizontalLayoutUI10"));

}
Exemplo n.º 7
0
void CMessageDialog::SetBkImage(CDuiString strBkImage)
{
	CControlUI* background = m_pm.FindControl(kWndBackGround);
	if (background != NULL)
	{
		TCHAR szBuf[MAX_PATH] = {0};
		_stprintf_s(szBuf, MAX_PATH - 1, _T("file='%s' source='0,0,1000,30'"), strBkImage.GetData());
		background->SetBkImage(szBuf);
	}
}
Exemplo n.º 8
0
void CAbout::SetBkColor(DWORD dwBackColor)
{
	CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
		background->SetBkImage(_T(""));
		background->SetBkColor(dwBackColor);
		background->NeedUpdate();
	}
}
Exemplo n.º 9
0
void CMessageDialog::SetBkColor(DWORD dwBackColor)
{
	CControlUI* background = m_pm.FindControl(kWndBackGround);
	if (background != NULL)
	{
		background->SetBkImage(_T(""));
		background->SetBkColor(dwBackColor);
		background->NeedUpdate();
	}

}
Exemplo n.º 10
0
void CAbout::SetBkImage(LPCTSTR szImageName)
{

	CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
	if (background != NULL)
	{

		background->SetBkImage(szImageName);

	}
}
Exemplo n.º 11
0
void MainFrame::SetBkColor(DWORD dwBackColor)
{
	CControlUI* background = paint_manager_.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
		background->SetBkImage(_T(""));
		background->SetBkColor(dwBackColor);
		background->NeedUpdate();

		SkinChangedParam param;
		param.bkcolor = background->GetBkColor();
		param.bgimage = background->GetBkImage();
		skin_changed_observer_.Broadcast(param);
	}
}
void CreateDiscussionGrpDialog::_updateSearchResultList(IN const std::vector<std::string>& nameList)
{
	if (nameList.empty())
	{
		return;
	}
	for (std::string sid : nameList)
	{
		module::UserInfoEntity userInfo;
		if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
		{
			LOG__(ERR, _T("can't find the userInfo:%s"), util::stringToCString(sid));
			return;
		}
		CDialogBuilder dlgBuilder;
		CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("CreateDiscussionGrpDialog\\ListGroupMembersItem.xml"), (UINT)0, NULL, &m_PaintManager);
		if (!pListElement)
		{
			LOG__(ERR, _T("群item创建失败"));
			return;
		}
		pListElement->SetName(_T("SearchResultItem"));
		CControlUI* pLogo = static_cast<CControlUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
		if (!pLogo)
		{
			return;
		}
		pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

		CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
		if (!pNameLable)
		{
			return;
		}
		pNameLable->SetText(userInfo.getRealName());

		CButtonUI* pRemoveBtn = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("removebtn")));
		if (pRemoveBtn)
		{
			pRemoveBtn->SetVisible(false);
		}

		pListElement->SetUserData(util::stringToCString(userInfo.sId));

		m_pListSearchResult->Add(pListElement);
	}
}
Exemplo n.º 13
0
void MainFrame::OnPrepare(TNotifyUI& msg)
{
	CControlUI* background = paint_manager_.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
		TCHAR szBuf[MAX_PATH] = {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);
	}

	UpdateFriendsList();

	UpdateGroupsList();

	UpdateMicroBlogList();
}
Exemplo n.º 14
0
void ChatDialog::OnPrepare(TNotifyUI& msg)
{
	TCHAR szBuf[MAX_PATH] = {0};

	CControlUI* background = paint_manager_.FindControl(kBackgroundControlName);
	if (background != NULL)
	{
#if defined(UNDER_WINCE)
		_stprintf(szBuf, _T("file='%s' corner='600,200,1,1'"), bgimage_.c_str());
#else
		_stprintf_s(szBuf, MAX_PATH - 1, _T("file='%s' corner='600,200,1,1'"), bgimage_.c_str());
#endif
		background->SetBkImage(szBuf);
		background->SetBkColor(bkcolor_);
	}

	CButtonUI* log_button = static_cast<CButtonUI*>(paint_manager_.FindControl(kLogoButtonControlName));
	if (log_button != NULL)
	{
#if defined(UNDER_WINCE)
		_stprintf(szBuf, _T("%s"), friend_.logo.c_str());
#else
		_stprintf_s(szBuf, MAX_PATH - 1, _T("%s"), friend_.logo.c_str());
#endif
		log_button->SetNormalImage(szBuf);
	}

	CControlUI* nick_name = paint_manager_.FindControl(kNickNameControlName);
	if (nick_name != NULL)
		nick_name->SetText(friend_.nick_name.c_str());

	CControlUI* desciption = paint_manager_.FindControl(kDescriptionControlName);
	if (desciption != NULL)
		desciption->SetText(friend_.description.c_str());

	CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName));
	if (pFontbar != NULL)
		pFontbar->SetVisible(!pFontbar->IsVisible());
}
Exemplo n.º 15
0
void CMonitoringUI::ShowMonitInfoList()
{
	CDialogBuilder builder;
	CListContainerElementUI* SubList = (CListContainerElementUI*)(builder.Create(_T("xml//RegInfoList.xml"), (UINT)0, NULL, &m_PaintManager));
	CListUI* pList = dynamic_cast<CListUI*>(m_PaintManager.FindControl(_T("Refer_InfoList")));
	pList->Add(SubList);
	CControlUI* photoUI = dynamic_cast<CControlUI*>(m_PaintManager.FindSubControlByClass(SubList, DUI_CTR_CONTROL));
	CLabelUI* lab_ID = dynamic_cast<CLabelUI*>(m_PaintManager.FindSubControlByClass(SubList, DUI_CTR_LABEL, 1));
	CLabelUI* lab_similarity = dynamic_cast<CLabelUI*>(m_PaintManager.FindSubControlByClass(SubList, DUI_CTR_LABEL, 3));
	CLabelUI* lab_time = dynamic_cast<CLabelUI*>(m_PaintManager.FindSubControlByClass(SubList, DUI_CTR_LABEL, 5));

	std::string strName = std::string(_T("file = 'bmp/test")) + std::to_string(m_nBmp) + std::string(".bmp'");
	photoUI->SetBkImage(strName.c_str());
	lab_ID->SetText(std::to_string(m_testID).c_str());
	lab_similarity->SetText("76%");
	lab_time->SetText("2016-7-29 17:12:55");

	if (m_testID % 3 == 0)
	{
		SubList->SetBkColor(0xFFFFDDDD);
	}
	m_testID++;
}
Exemplo n.º 16
0
void MainFrame::OnClick(TNotifyUI& msg)
{
	WindowImplBase::OnClick(msg);
	if (_tcsicmp(msg.pSender->GetName(), kHideLeftMainPannelControlName) == 0)
	{
		CControlUI* left_main_pannel = m_PaintManager.FindControl(kLeftMainPannelControlName);
		CControlUI* hide_left_main_pannel = m_PaintManager.FindControl(kHideLeftMainPannelControlName);
		CControlUI* show_left_main_pannel = m_PaintManager.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 = m_PaintManager.FindControl(kLeftMainPannelControlName);
		CControlUI* hide_left_main_pannel = m_PaintManager.FindControl(kHideLeftMainPannelControlName);
		CControlUI* show_left_main_pannel = m_PaintManager.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);
		CEditUI* signature = static_cast<CEditUI*>(m_PaintManager.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);
		CEditUI* search_edit = static_cast<CEditUI*>(m_PaintManager.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 = m_PaintManager.FindControl(kBackgroundControlName);
		if (background != NULL)
		{
			TCHAR szBuf[MAX_PATH] = { 0 };
			++bk_image_index_;
			if (kBackgroundSkinImageCount < bk_image_index_)
				bk_image_index_ = 0;

			_stprintf_s(szBuf, MAX_PATH - 1, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_);

			background->SetBkImage(szBuf);

			SkinChangedParam param;
			CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
			if (background != NULL)
			{
				param.bkcolor = background->GetBkColor();
				if (_tcslen(background->GetBkImage()) > 0)
				{
					_stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_);
				}

				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 (0 == _tcsicmp(msg.pSender->GetName(), _T("phone")))
	{
		logic::GetLogic()->asynNotifyObserver(module::KEY_LOGIN_USERID,10);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQpalycenter")))
	{
		logic::GetLogic()->removeObserver(this);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("MainMenu")))
	{
		CMenuWnd* pMenu = new CMenuWnd(m_hWnd);
		DuiLib::CPoint point = msg.ptMouse;
		ClientToScreen(m_hWnd, &point);
		STRINGorID xml(_T("menutest.xml"));
		pMenu->Init(NULL, xml, _T("xml"), point);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("ToolsBtn")))//设置按钮
	{
		MakeGroupWnd* pFrame = new MakeGroupWnd();
		if (pFrame == NULL) return;
		pFrame->Create(NULL, _T("MakeGroupWnd"), UI_WNDSTYLE_FRAME, WS_EX_STATICEDGE | WS_EX_APPWINDOW, 0, 0, 600, 800);
		pFrame->CenterWindow();
		pFrame->ShowWindow(true);

	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQSafeBtn")))//安全中心
	{
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("messageCenterBtn")))//消息中心
	{
		FloatWnd* pFloatWnd = new FloatWnd();
		if (pFloatWnd == NULL) return;
		pFloatWnd->Create(m_hWnd, _T("FloatWnd"), UI_WNDSTYLE_FRAME|WS_THICKFRAME,  WS_EX_TOOLWINDOW | WS_EX_TOPMOST| WS_EX_STATICEDGE, 0, 0, 0, 0);
		//pFloatWnd->ShowWindow(true);
		pFloatWnd->BringToTop();
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QzoneBtn")))
	{

	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQTradeCenterBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("paipaiBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("PaiPaiChongzhiBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("addBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("friend_circleBtn")))
	{
		LoginWnd* pLoginWnd = new LoginWnd();
		if (pLoginWnd == NULL) return;
		pLoginWnd->Create(NULL, _T("LoginWnd"), /*WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS*/UI_WNDSTYLE_FRAME | WS_POPUP, 0/*WS_EX_LAYERED*/, 0, 0, 0, 0);
		pLoginWnd->CenterWindow();
		pLoginWnd->ShowWindow(true); 
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("mailBtn")))
	{
		MainDialog* pMainDialog = new MainDialog();
		if (pMainDialog == NULL) return;
		pMainDialog->Create(NULL, _T("MainDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, 0, 0, 0, 0, 0);
		pMainDialog->CenterWindow();
		pMainDialog->ShowWindow(true);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("XiaoYouBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("sosoBtn")))
	{
		int n = 0;
		n++;
	}
}
Exemplo n.º 17
0
	void DuiLib::CRecentCallContactUI::AddItem( recentCallContactItem *item, int indx/*=-1*/ )
	{
		CListContainerElementUI *pListElement = NULL;
		if (!m_DlgBuilder.GetMarkup()->IsValid())
		{
			pListElement = static_cast<CListContainerElementUI*>(m_DlgBuilder.Create(_T("Call\\recent_call_contacts_list_item.xml"),
				(UINT)0, NULL, m_pPaintManager));
		}
		else
		{
			pListElement = static_cast<CListContainerElementUI*>(m_DlgBuilder.Create((UINT)0, m_pPaintManager));
		}
		if (pListElement == NULL)
			return;

		CControlUI* pBtnLogo = static_cast<CControlUI*>(m_pPaintManager->FindSubControlByName(pListElement, kLogoControl));
		if (pBtnLogo != NULL)
		{			
			pBtnLogo->SetBkImage(item->m_strLogo);			
		}

		CLabelUI *pLblNickName = static_cast<CLabelUI*>(m_pPaintManager->FindSubControlByName(pListElement, kNickNameLabel));
		if (pLblNickName != NULL)
		{			
			pLblNickName->SetText(item->m_strNickName);
		}

		CLabelUI *pOrgNameLabel = static_cast<CLabelUI*>(m_pPaintManager->FindSubControlByName(pListElement, kOrgNameLabel));
		if (pOrgNameLabel != NULL)
		{			
			pOrgNameLabel->SetText(item->m_strOrgName);
		}

		CControlUI *pDialIndicate = static_cast<CControlUI*>(m_pPaintManager->FindSubControlByName(pListElement, "dialIndicateLogo"));
		if (pDialIndicate != NULL)
		{			
			CDuiString strImg;
			strImg.Format("Call\\call%d.png", item->dialIndicate);
			pDialIndicate->SetBkImage(strImg);
		}
			

		pListElement->SetTag(item->nItemID);
		pListElement->SetFixedHeight(kContactListItemNormalHeight);

		CButtonUI* pBtnVoiceCall= static_cast<CButtonUI*>(m_pPaintManager->FindSubControlByName(pListElement, kVoiceCallBtnName));
		CButtonUI* pBtnVedioCall= static_cast<CButtonUI*>(m_pPaintManager->FindSubControlByName(pListElement, kVedioCallBtnName));
		if (NULL != pBtnVoiceCall)  pBtnVoiceCall->SetTag(item->nItemID);
		if (NULL != pBtnVedioCall)  pBtnVedioCall->SetTag(item->nItemID);


		if (-1 == indx)
		{
			if (!CListUI::Add(pListElement))
			{
				delete pListElement;
			}
		}
		else if(indx >= 0)
		{
			if (!CListUI::AddAt(pListElement,indx))
			{
				delete pListElement;
			}
		}		

	}
void CreateDiscussionGrpDialog::_AddToGroupMemberList(std::string sid)
{
	if (sid.empty())
	{
		return;
	}
	//确认没有重复的项
	for (int n = 0; n < m_pListGroupMembers->GetCount();n++)
	{
		CControlUI* pItem = m_pListGroupMembers->GetItemAt(n);
		if (pItem)
		{
			CString strId = pItem->GetUserData();
			if (!strId.IsEmpty())
			{
				std::string sId = util::cStringToString(strId);
				if (sId == sid)
				{
					return;
				}
			}
		}
	}
	//插入ITEM
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
	{
		LOG__(DEBG, _T("can't find the userInfo:%s"), util::stringToCString(sid));
		return;
	}
	CDialogBuilder dlgBuilder;
	CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("CreateDiscussionGrpDialog\\ListGroupMembersItem.xml"), (UINT)0, NULL, &m_PaintManager);
	if (!pListElement)
	{
		LOG__(ERR, _T("群item创建失败"));
		return;
	}
	CControlUI* pLogo = static_cast<CControlUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
	if (!pLogo)
	{
		return;
	}
	pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

	CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
	if (!pNameLable)
	{
		return;
	}
	pNameLable->SetText(userInfo.getRealName());

	CButtonUI* pRemoveBtn = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("removebtn")));
	if (pRemoveBtn)
	{
		//点击删除按钮的时候根据这个来判断是哪个项
		pRemoveBtn->SetTag(UINT_PTR(pListElement));
	}

	if (module::getSysConfigModule()->userID() == userInfo.sId)//自己不能删除
	{
		pRemoveBtn->SetVisible(false);
	}
	
	pListElement->SetUserData(util::stringToCString(userInfo.sId));

	m_pListGroupMembers->Add(pListElement);

}
Exemplo n.º 19
0
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_);
						}
					}
				}
			}

		}
	}
}
Exemplo n.º 20
0
//列表选中的用户消息,显示在上方板块
void CRightFrame::ShowUserInfo(UserItemStruct* pUser)
{
	if (!pUser)
	{
		return;
	}

	m_pShowUser = pUser;

	CLoveSendClassInExe* pGameFrame = (CLoveSendClassInExe*)m_pRoom;
	pGameFrame->m_dwCurrentUserID = pUser->GameUserInfo.dwUserID;

	bool bSecret = false;
	if ((pGameFrame->m_pGameInfo->dwRoomRule & GRR_NOTCHEAT && pUser->GameUserInfo.dwUserID != pGameFrame->GetMeUserInfo()->dwUserID) || pGameFrame->m_pGameInfo->dwRoomRule & GRR_CONTEST)
	{
		bSecret = true;
	}

	CLabelUI* pLabCtrl = NULL;
	CControlUI* pCtnCtrl = NULL;
	char szBuffer[128];



	//用户ID
	if ((pGameFrame->m_pGameInfo->dwRoomRule & GRR_NOTCHEAT && pUser->GameUserInfo.dwUserID != pGameFrame->GetMeUserInfo()->dwUserID))
	{
		_stprintf(szBuffer,"玩家");
	}
	else
	{
		//用户名
		_stprintf(szBuffer,"%s", pUser->GameUserInfo.nickName);
	}

	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_Name"));
	pLabCtrl->SetText(szBuffer);

	//用户ID
	if ((pGameFrame->m_pGameInfo->dwRoomRule & GRR_NOTCHEAT && pUser->GameUserInfo.dwUserID != pGameFrame->GetMeUserInfo()->dwUserID))
	{
		_stprintf(szBuffer,"???");
	}
	else
	{
		_stprintf(szBuffer,"%d",pUser->GameUserInfo.dwUserID);
	}
	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_ID"));
	pLabCtrl->SetText(szBuffer);

	//积分
	if (bSecret)
	{
		_stprintf(szBuffer,"???");
	}
	else
	{
		int dwPoint = pUser->GameUserInfo.dwPoint;
		_stprintf(szBuffer,"%d",dwPoint - GetNormalOrderBasePoint(dwPoint));
	}
	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_Points"));
	pLabCtrl->SetText(szBuffer);

	//金币
	if (bSecret)
	{
		_stprintf(szBuffer,"???");
	}
	else
	{
		::GlbGetNumString(szBuffer,pUser->GameUserInfo.i64Money,Glb().m_nPowerOfGold,Glb().m_bUseSpace,Glb().m_strSpaceChar);
	}
	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_Coints"));
	pLabCtrl->SetText(szBuffer);

	//魅力
	if (bSecret)
	{
		_stprintf(szBuffer,"???");
	}
	else
	{
		_stprintf(szBuffer,"%d",pUser->GameUserInfo.dwFascination);
	}
	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_Glamour"));
	pLabCtrl->SetText(szBuffer);

	//魅力等级
	_stprintf(szBuffer,"%s",bSecret?"???":GetCharmGrade(pUser->GameUserInfo.dwFascination));
	pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl("Lab_Info_Level"));
	pLabCtrl->SetText(szBuffer);

	//logo
	pCtnCtrl = m_pm.FindControl("Img_Info_logo");
	GetUserLogoFile(pUser,szBuffer);
	pCtnCtrl->SetBkImage(szBuffer);

	return;
}