当前位置: 首页>>代码示例>>C++>>正文


C++ CContainerUI::GetCount方法代码示例

本文整理汇总了C++中CContainerUI::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CContainerUI::GetCount方法的具体用法?C++ CContainerUI::GetCount怎么用?C++ CContainerUI::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContainerUI的用法示例。


在下文中一共展示了CContainerUI::GetCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PasteUI

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();
	}
}
开发者ID:the7day,项目名称:py-ui4win,代码行数:42,代码来源:UIDesignerView.cpp

示例2: Notify

void MainFrame::Notify(TNotifyUI& msg)
{
	if (_tcsicmp(msg.sType, kWindowInit) == 0)
	{
		OnPrepare(msg);
	}
	else if (_tcsicmp(msg.sType, kClick) == 0)
	{
		if (_tcsicmp(msg.pSender->GetName(), kCloseButtonControlName) == 0 || _tcsicmp(msg.pSender->GetName(), kCancelButtonControlName) == 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(), _T("select_all_btn")) == 0)
		{
			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if (pDriver != NULL)
					pDriver->Selected(true);
			}
		}
		else if (_tcsicmp(msg.pSender->GetName(), _T("uninstall_btn")) == 0)
		{
			vector<tString> deleted_printer_driver;
			DWORD dwError = 0;
			TCHAR szBuf[MAX_PATH] = {0};

			CContainerUI* pDriverList = static_cast<CContainerUI*>(paint_manager_.FindControl(_T("driver_list")));
			for (int i = 0; (pDriverList != NULL) && (i < pDriverList->GetCount()); ++i)
			{
				COptionUI* pDriver = static_cast<COptionUI*>(pDriverList->GetItemAt(i)->GetInterface(_T("Option")));
				if ((pDriver != NULL) && pDriver->IsSelected())
				{
					// 涉及到的API: DeletePrinter DeletePrinterDriver
					HANDLE hPrinter = NULL;
					_stprintf_s(szBuf, MAX_PATH - 1, pDriver->GetText().GetData());
					PRINTER_DEFAULTS PrtDefault = {NULL, NULL, PRINTER_ALL_ACCESS};
					OpenPrinter(szBuf, &hPrinter, &PrtDefault);
					if (hPrinter != NULL)
					{
						DWORD dwNeeded = 0;
						GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
						LPBYTE lpBuffer = (LPBYTE)malloc(dwNeeded);
						if (lpBuffer != NULL)
						{
							GetPrinter(hPrinter, 2, lpBuffer, dwNeeded, &dwNeeded);

							DeletePrinter(hPrinter);

							dwError = GetLastError();

							vector<tString>::const_iterator citer = find(deleted_printer_driver.begin(), deleted_printer_driver.end(), ((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							if (citer == deleted_printer_driver.end())
							{
								deleted_printer_driver.push_back(((PRINTER_INFO_2*)lpBuffer)->pDriverName);
							}

							ClosePrinter(hPrinter);
							free(lpBuffer);
						}
					}
				}
			}
			for (vector<tString>::const_iterator citer = deleted_printer_driver.begin(); citer != deleted_printer_driver.end(); ++citer)
			{
				_stprintf_s(szBuf, MAX_PATH - 1, citer->c_str());
				DeletePrinterDriver(NULL, NULL, szBuf);
//.........这里部分代码省略.........
开发者ID:corytodd,项目名称:WindowsPrinterDriver,代码行数:101,代码来源:main_frame.cpp

示例3: Notify

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());
		}
	}
}	
开发者ID:claire1021,项目名称:IPMP_CallService,代码行数:70,代码来源:MainDlg.cpp


注:本文中的CContainerUI::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。