Example #1
0
void CUIDesignerView::RedoUI(CControlUI* pControl, CControlUI* pParent)
{
	ASSERT(pControl && pParent);
	if(!pControl || !pParent)
		return;

	CContainerUI* pContainer = static_cast<CContainerUI*>(pParent->GetInterface(_T("Container")));
	ExtendedAttributes* pExtended = (ExtendedAttributes*)pContainer->GetTag();
	pContainer->Add(pControl);
	m_MultiTracker.Add(CreateTracker(pControl));
	InitUI(pControl, pExtended->nDepth + 1, TRUE);
	pContainer->SetPos(pContainer->GetPos());
}
Example #2
0
void CUIDesignerView::PasteUI(LPCTSTR xml)
{
	CDialogBuilder builder;
	CControlUI* pRoot=builder.Create(xml, (UINT)0, NULL, m_LayoutManager.GetManager());
	if(pRoot)
	{
		CControlUI* pParent = m_MultiTracker.GetFocused();
		if(pParent->GetInterface(_T("Container")) == NULL)
			pParent = pParent->GetParent();
		if(pParent == NULL)
			pParent = m_LayoutManager.GetForm();

		m_MultiTracker.RemoveAll();
		CContainerUI* pContainer = static_cast<CContainerUI*>(pParent->GetInterface(_T("Container")));
		CContainerUI* pRootContainer = static_cast<CContainerUI*>(pRoot->GetInterface(_T("Container")));
		ExtendedAttributes* pExtended = (ExtendedAttributes*)pContainer->GetTag();
		for(int i=0; i<pRootContainer->GetCount(); i++)
		{
			CControlUI* pControl = pRootContainer->GetItemAt(i);
			if(pControl->IsFloat())
			{
				SIZE sz = pControl->GetFixedXY();
				sz.cx += COPY_OFFSET_XY;
				sz.cy += COPY_OFFSET_XY;
				pControl->SetFixedXY(sz);
			}
			pContainer->Add(pControl);
			m_MultiTracker.Add(CreateTracker(pControl));
			InitUI(pControl, pExtended->nDepth + 1);
		}
		CArray<CControlUI*,CControlUI*> arrSelected;
		m_MultiTracker.GetSelected(arrSelected);
		m_UICommandHistory.Begin(arrSelected, actionAdd);
		m_UICommandHistory.End();

		pContainer->SetPos(pContainer->GetPos());

		pRootContainer->SetAutoDestroy(false);
		delete pRootContainer;
		this->GetDocument()->SetModifiedFlag();
	}
}
void CGroupPackFileDownloadWnd::Notify(TNotifyUI& msg)
{
	if (_tcsicmp(msg.sType, _T("click")) == 0)
	{
		CDuiString strControlName = msg.pSender->GetName();

		//关闭界面
		if (_tcsicmp(msg.pSender->GetName(), "btn_close_downloadwnd") == 0)
		{
// 			if (NULL != m_hMainWnd)
// 			{
// 				::SendMessage(m_hMainWnd, WM_GROUPDOWNLOAD_PACKFILE_CLOSED, 0, 0);
// 			}
// 
// 			Close();
			ShowWindow(false);
		}
		//下载 所有文件
		else if (_tcsicmp(msg.pSender->GetName(), "btn_download_packfiles") == 0)
		{
			if (  IsDownLoading() || m_bDownloaded)
			{
				return;
			}
			
			sPackReadReceipt* pPackReadReceipt = new sPackReadReceipt();
			pPackReadReceipt->strPackID = m_pCurrPackItem->strPackID;
			pPackReadReceipt->strRoomName = m_strRoomID ;
			pPackReadReceipt->strFrom =  CController::Instance()->GetXmppClient()->jid().username();
			pPackReadReceipt->strPackName = m_pCurrPackItem->strPackName;
			pPackReadReceipt->strAttribute = m_pCurrPackItem->strPackProp;

			SYSTEMTIME sysTime;
			::GetLocalTime(&sysTime);
			char* pTime = new char[128];
			sprintf(pTime,"%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1d",sysTime.wYear,sysTime.wMonth,sysTime.wDay,sysTime.wHour,sysTime.wMinute, sysTime.wSecond,sysTime.wMilliseconds,sysTime.wDayOfWeek);

			pPackReadReceipt->strTime = pTime;

			::SendMessage(mainDlg::getInstance()->GetHWND(), WM_GROUPDOWNLOAD_PACKFILE_DOWNLOADED, (WPARAM)pPackReadReceipt, 0);
 			
			OnDownLoadPackFiles();
		}
		//打开文件所在位置
		else if (_tcsicmp(msg.pSender->GetName(), "btn_open_downloaded_packfiles") == 0)
		{
			if (NULL != m_pCurrPackItem)
			{
				tstring strPackDir = CFileHelper::GetPackDir(m_pCurrPackItem->strPackName, m_pCurrPackItem->strPackID);
				if (!strPackDir.empty())
				{
					ShellExecute(NULL, NULL, strPackDir.c_str(), NULL,NULL,SW_SHOWNORMAL);
				}
			}
		}
		//打开,已下载文件
		else if (_tcsicmp(msg.pSender->GetName(), "btn_open_downloaded_file") == 0)
		{
			CContainerUI* pListItem  = static_cast<CContainerUI*>(msg.pSender->GetParent());
			if (NULL != pListItem)
			{
				char* pBuff = (char*)pListItem->GetTag();
				tstring strLocalFullFileName = pBuff;
				if (!strLocalFullFileName.empty())
				{
					ShellExecute(NULL, NULL, strLocalFullFileName.c_str(), NULL,NULL,SW_SHOWNORMAL);
				}
			}
		}
	}
	else if(_tcsicmp(msg.sType, _T("itemclick")) == 0)
	{
		//HandleItemClickEvent(msg);		
	}
	else if (_tcsicmp(msg.sType, _T("itemselect")) == 0)
	{
		
	}
	else if(_tcsicmp(msg.sType, _T("selectchanged")) == 0)
	{
		int bac=100;
	}
}