Exemplo n.º 1
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.º 2
0
void CMsgWnd::SetMsg(LPCTSTR lpstrMsg)
{
    if(lstrlen(lpstrMsg) <= 0) return;

    CControlUI* pControl = static_cast<CControlUI*>(m_PaintManager.FindControl(_T("MessageText")));
    if( pControl ) pControl->SetText(lpstrMsg);
}
Exemplo n.º 3
0
	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) {
		if( uMsg == WM_CREATE ) {     
			paint_manager_.Init(m_hWnd);
			CDialogBuilder builder;
			CControlUI* pRoot = builder.Create(GetDialogResource(), (UINT)0, NULL, &paint_manager_);
			paint_manager_.AttachDialog(pRoot);
			paint_manager_.AddNotifier(this);

			CControlUI *pText = paint_manager_.FindControl(_T("content"));
			if( pText ) pText->SetText(m_sContent);
			CenterWindow();
			return 0;
		}
		else if( uMsg == WM_KEYDOWN ) {
			if( wParam == VK_RETURN ) {
				m_iRetCode = IDOK;
				Close();
				return 0;
			}
			else if( wParam == VK_ESCAPE ) {
				m_iRetCode = IDCANCEL;
				Close();
				return 0;
			}
		}
		LRESULT lRes = 0;
		if( paint_manager_.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
		return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
	}
void UserDetailInfoDialog::OnWindowInitialized(TNotifyUI& msg)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(m_sid, userInfo))
	{
		LOG__(ERR, _T("getUserInfoBySId failed"));
		return;
	}
	CControlUI* name = m_PaintManager.FindControl(_T("name"));
	if (name)
	{
		name->SetText(userInfo.csNickName);
	}
	CControlUI* realName = m_PaintManager.FindControl(_T("realname"));
	if (realName)
	{
		realName->SetText(userInfo.csName);
	}
	CControlUI* sex = m_PaintManager.FindControl(_T("sex"));
	if (sex)
	{
		if (1 == userInfo.gender)
		{
			sex->SetText(_T("小侠"));
		}
		else if (2 == userInfo.gender)
		{
			sex->SetText(_T("小仙"));
		}
		else
			sex->SetText(_T("人妖"));
	}
	CControlUI* department = m_PaintManager.FindControl(_T("department"));
	if (department)
	{
		department->SetText(util::stringToCString(userInfo.department));
	}
	CControlUI* telphone = m_PaintManager.FindControl(_T("telphone"));
	if (telphone)
	{
		telphone->SetText(util::stringToCString(userInfo.telephone));
	}
	CControlUI* mail = m_PaintManager.FindControl(_T("mail"));
	if (mail)
	{
		mail->SetText(util::stringToCString(userInfo.email));
	}
	m_AvatarUI = m_PaintManager.FindControl(_T("Avatar"));
	if (m_AvatarUI)
	{
		m_AvatarUI->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));
		m_AvatarUI->SetToolTip(util::stringToCString(m_sid));
	}
	_refreshAvatar(userInfo.avatarUrl);
}
Exemplo n.º 5
0
UINT  TBCIAMessageBox( HWND hwndParent, LPCTSTR lpTitle, LPCTSTR lpText )
{
	if( g_pMessageBox == NULL )
	{
		g_pMessageBox = new DuiLib::CTBCIAMessageBox();
		if( g_pMessageBox == NULL ) return IDNO;
		g_pMessageBox->SetSkinXMLPath( g_messageBoxLayoutFileName );
		g_pMessageBox->Create( hwndParent, _T(""), UI_WNDSTYLE_FRAME, WS_EX_STATICEDGE | WS_EX_APPWINDOW , 0, 0, 0, 0 );
		g_pMessageBox->CenterWindow();
	}

	CControlUI* pTitleControl = static_cast<CControlUI*>(g_pMessageBox->GetPaintManager().FindControl( g_messageBoxTitleControlName ));
	CControlUI* pTipTextControl = static_cast<CControlUI*>(g_pMessageBox->GetPaintManager().FindControl( g_messageBoxTextControlName ));
	if( pTitleControl != NULL )
		pTitleControl->SetText( lpTitle );
	if( pTipTextControl != NULL )
		pTipTextControl->SetText( lpText );

	if( g_pMessageBox->ShowModal() == -1 )
		return IDYES;

	return IDNO;
}
Exemplo n.º 6
0
 void CLoginWindow::Login(const CString& email,const CString& pwd,bool isMD5,bool isKeepLogin)
 {
	 spUserContextT pContext = theRuntimeState->GetCurrentContext(NULL);
	 spLogonUserInfoT theUser = pContext->GetUser();
	 if(theUser && 0 == theUser->sLogonEmail.CompareNoCase(email))
	 {
		 CControlUI *pCtl = GetPaintMgr()->FindControl(_T("login"));
		 CButtonUI  *pLoginBtn = static_cast<CButtonUI*>(pCtl);
		 assert(pLoginBtn);
		 if(pLoginBtn)
			CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T("Óû§ÒѾ­µÇ¼!!!"));
		 return;
	 }

	 CControlUI *pEmailEdit = GetPaintMgr()->FindControl(_T("email"));
	 if(pEmailEdit)
	 {
		 pEmailEdit->SetText(email);
	 }

	 std::string sUtf8UserName = em_utility::mci::unicode_2_utf8(email);
	 std::string sUtf8Password = em_utility::mci::unicode_2_utf8(pwd);
	 std::string sUtf8PasswordMD5 = (isMD5 ? sUtf8Password : em_utility::md5_checksum::get_md5((const unsigned char*)sUtf8Password.c_str(),(unsigned int)sUtf8Password.length()));

	 m_sUserName    = email;
	 m_sPasswordMd5 = em_utility::mci::utf8_2_CString(sUtf8PasswordMD5.c_str());
	 //m_isKeepLogin  = isKeepLogin;
	 
	 EnableWindow(FALSE);
//	 theWebServiceMgr->AsynSendRequest(m_hWnd,url::Requester::MakeLogin2(sUtf8UserName,sUtf8PasswordMD5));
//  	 CurlData* pData = new CurlData;
//  	 pData->SetURL("http://localhost/YMusic/login.php");
// 	 pData->n_type = url::WSRT_LOGIN;
// 	std::string sparam;
// 	sparam = "email=";
// 	sparam += sUtf8UserName;
// 	sparam += "&";
// 	sparam += "password=";
// 	sparam += sUtf8PasswordMD5;
// 	pData->SetData(sparam.c_str());

//	HttpManagerProto::Instance()->DoHttpPost(pData);
// 	CHttpThread* pthread = new CHttpThread(pData,m_hWnd,WM_WEB_SERVICE);
// 	pthread->Start();

	 CHttpCenter::Instance()->MakeLogin(sUtf8UserName,sUtf8PasswordMD5);

 }
Exemplo n.º 7
0
//   BOOL ViCbSetText(VApiHandle hWnd, LPCTSTR pstrName)
SQInteger ViCbSetText(HSQUIRRELVM v)
{
	SQInteger      nargs         = sq_gettop(v);
	SQInteger      Handle        = 0;
	CControlUI*    pCtrl         = NULL;
	LPCTSTR        pstrName      = NULL;
	if (!v || 2 + 1 != nargs) {goto _Exit_;}
	if (OT_INTEGER != sq_gettype(v, 2)) {goto _Exit_;}
	if (OT_STRING != sq_gettype(v, 3)) {goto _Exit_;}
	
	sq_getinteger(v, 2, &Handle);
	sq_getstring(v, 3, &pstrName);
	pCtrl = QiHwHandleToCtrl(Handle);
	if (!pCtrl) {goto _Exit_;}
	pCtrl->SetText(pstrName);
	
_Exit_:
	sq_pushbool(v, TRUE);
	return 1;
}
Exemplo n.º 8
0
void CMainDialog::OnKillFocus( CControlUI* pSender )
{
	if (pSender->GetName() == _T ("editSearch")) {
		CControlUI* pbtnTip = static_cast <CControlUI*> (m_pm.FindControl(_T ("btnTip")));
		CEditUI* peditSearch = static_cast <CEditUI*> (m_pm.FindControl(_T ("editSearch")));

		if (pbtnTip && peditSearch) {
			CDuiString strText = peditSearch->GetText();
			if (strText.IsEmpty()) {
				strText = "請輸入查找條件";
				pbtnTip->SetAttribute(_T("textcolor"), _T("#00A0A0A4"));
			} else {
				pbtnTip->SetAttribute(_T("textcolor"), _T("#FF000000"));
			}
			
			pbtnTip->SetText(strText);
			pbtnTip->SetVisible(true);
		}
	}
}
Exemplo n.º 9
0
void ChatDialog::OnPrepare(TNotifyUI& msg)
{
	TCHAR szBuf[MAX_PATH] = {0};

	CControlUI* background = GetPaintMgr()->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_.GetData());
#endif

		//background->SetBkImage(szBuf);
		//background->SetBkColor(bkcolor_);
	}

	CButtonUI* log_button = static_cast<CButtonUI*>(GetPaintMgr()->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_.m_callName);
// #endif
// 		log_button->SetNormalImage(szBuf);
// 	}

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

	CControlUI* desciption = GetPaintMgr()->FindControl(kDescriptionControlName);
	if (desciption != NULL)
		desciption->SetText(friend_.m_callName);

// 	CContainerUI* pFontbar = static_cast<CContainerUI*>(GetPaintMgr()->FindControl(kFontbarControlName));
// 	if (pFontbar != NULL)
// 		pFontbar->SetVisible(!pFontbar->IsVisible());
}
Exemplo n.º 10
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);
#endif
		log_button->SetNormalImage(szBuf);
	}

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

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

	CContainerUI* pFontbar = static_cast<CContainerUI*>(paint_manager_.FindControl(kFontbarControlName));
	if (pFontbar != NULL)
		pFontbar->SetVisible(!pFontbar->IsVisible());
}
Exemplo n.º 11
0
//根据PackID,获取文件列表,检查本地是否已经存在了。
bool CGroupPackFileDownloadWnd::Initialize(sPackItem* pPackItem)
{
	if (NULL == pPackItem)
	{
		return false;
	}

	//新建cache数据包的数据信息
	m_pCurrPackItem = new sPackItem;
	m_pCurrPackItem->listFile = pPackItem->listFile;
	m_pCurrPackItem->strPackID = pPackItem->strPackID;
	m_pCurrPackItem->strPackName = pPackItem->strPackName;
	m_pCurrPackItem->strPackProp = pPackItem->strPackProp;
	m_pCurrPackItem->strPackSender = pPackItem->strPackSender;
	m_pCurrPackItem->strPackSize = pPackItem->strPackSize;
	m_pCurrPackItem->strPackTime = pPackItem->strPackTime;

	//初始化标题栏
	CControlUI* pPackTitle = static_cast<CControlUI*>(m_pPaintManager->FindControl("label_gc_packname"));
	if (NULL != pPackTitle)
	{
		pPackTitle->SetText(pPackItem->strPackName.c_str());
	}
	
	//初始化文件列表
	if (pPackItem->listFile.size()>0)
	{
		for (list<sPackFileItem>::iterator it = pPackItem->listFile.begin();
			it != pPackItem->listFile.end(); ++it)
		{
			sPackFileItem& onePackFile = *it;
			m_pGroupPackFileList->AddOneItem(onePackFile);


		}
	}
	else
	{
		return false;
	}

	//检查文件是否已经下载了:如果下载了,就cache到m_mapFile2State,并更新UI
	if (pPackItem->listFile.size()>0)
	{
		tstring strPackDir = CFileHelper::GetPackDir(pPackItem->strPackName, pPackItem->strPackID);

		for (list<sPackFileItem>::iterator it = pPackItem->listFile.begin();
			it != pPackItem->listFile.end(); ++it)
		{
			sPackFileItem& oneFile = *it;
			tstring strFullPathName = strPackDir + it->strFileName;

			//先判断有没有这个文件了,如有就直接更新状态 "打开"可用
			bool bExist = PathFileExists(strFullPathName.c_str());
			if (bExist)
			{
				DWORD dwFileSize = _tcstoul(it->strFileSizeAccurate.c_str(), NULL, 10);

				if (getFileSize(strFullPathName) == dwFileSize)
				{
					if (!IsExist(strFullPathName))
					{
						::EnterCriticalSection(&m_csFState);
						m_mapFile2State.insert(make_pair(strFullPathName, enm_DownState_Finish));
						::LeaveCriticalSection(&m_csFState);

						//设置进度条为完成了。//说来话长,这个98就表示下载完成了...
						m_pGroupPackFileList->SetProgress(strFullPathName, 98);
					}
				}
			}
		}
	}
	
	


	return true;
}