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


C++ CControlUI类代码示例

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


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

示例1: EstimateSize

SIZE CMenuUI::EstimateSize(SIZE szAvailable)
{
	int cxFixed = 0;
    int cyFixed = 0;
    for( int it = 0; it < GetCount(); it++ ) {
        CControlUI* pControl = static_cast<CControlUI*>(GetItemAt(it));
        if( !pControl->IsVisible() ) continue;
        SIZE sz = pControl->EstimateSize(szAvailable);
        cyFixed += sz.cy;
		if( cxFixed < sz.cx )
			cxFixed = sz.cx;
    }
    return CDuiSize(cxFixed, cyFixed);
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:14,代码来源:UIMenu.cpp

示例2: GetItemAt

bool CGroupsUI::RemoveAt(int iIndex)
{
	CControlUI* pControl = GetItemAt(iIndex);
	if (!pControl)
		return false;

	if (_tcsicmp(pControl->GetClass(), _T("ListContainerElementUI")) != 0)
		return false;

	if (reinterpret_cast<Node*>(static_cast<CListContainerElementUI*>(pControl->GetInterface(_T("ListContainerElement")))->GetTag()) == NULL)
		return CListUI::RemoveAt(iIndex);
	else
		return RemoveNode(reinterpret_cast<Node*>(static_cast<CListContainerElementUI*>(pControl->GetInterface(_T("ListContainerElement")))->GetTag()));
}
开发者ID:obabywawa,项目名称:UPIM,代码行数:14,代码来源:UIGroups.cpp

示例3: if

void CTileLayoutUI::SetPos(RECT rc)
{
   m_rcItem = rc;
   // Adjust for inset
   rc.left += m_rcInset.left;
   rc.top += m_rcInset.top;
   rc.right -= m_rcInset.right;
   rc.bottom -= m_rcInset.bottom;
   if( m_hwndScroll != NULL ) rc.right -= m_pManager->GetSystemMetrics().cxvscroll;
   // Position the elements
   int cxWidth = (rc.right - rc.left) / m_nColumns;
   int cyHeight = 0;
   int iCount = 0;
   POINT ptTile = { rc.left, rc.top - m_iScrollPos };
   for( int it1 = 0; it1 < m_items.GetSize(); it1++ ) {
      CControlUI* pControl = static_cast<CControlUI*>(m_items[it1]);
      if( !pControl->IsVisible() ) continue;
      // Determine size
      RECT rcTile = { ptTile.x, ptTile.y, ptTile.x + cxWidth, ptTile.y };
      // Adjust with element padding
      if( (iCount % m_nColumns) == 0 ) rcTile.right -= m_iPadding / 2;
      else if( (iCount % m_nColumns) == m_nColumns - 1 ) rcTile.left += m_iPadding / 2;
      else ::InflateRect(&rcTile, -(m_iPadding / 2), 0);
      // If this panel expands vertically
      if( m_cxyFixed.cy == 0) {
         SIZE szAvailable = { rcTile.right - rcTile.left, 9999 };
         int iIndex = iCount;
         for( int it2 = it1; it2 < m_items.GetSize(); it2++ ) {
            SIZE szTile = static_cast<CControlUI*>(m_items[it2])->EstimateSize(szAvailable);
            cyHeight = MAX(cyHeight, szTile.cy);
            if( (++iIndex % m_nColumns) == 0) break;
         }
      }
      // Set position
      rcTile.bottom = rcTile.top + cyHeight;
      pControl->SetPos(rcTile);
      // Move along...
      if( (++iCount % m_nColumns) == 0 ) {
         ptTile.x = rc.left;
         ptTile.y += cyHeight + m_iPadding;
         cyHeight = 0;
      }
      else {
         ptTile.x += cxWidth;
      }
      m_cyNeeded = rcTile.bottom - (rc.top - m_iScrollPos);
   }
   // Process the scrollbar
   ProcessScrollbar(rc, m_cyNeeded);
}
开发者ID:SongYafei,项目名称:directui,代码行数:50,代码来源:UIContainer.cpp

示例4: GET_X_LPARAM

LRESULT CRichListWnd::OnMouseHover(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
	CControlUI* pHover = m_PaintManager.FindControl(pt);
	if( pHover == NULL ) return 0;
	/*演示悬停在下载列表的图标上时,动态变换下载图标状态显示*/
	if(pHover->GetName() == _T("down_ico"))
	{
		MessageBox(NULL, _T("鼠标在某控件例如按钮上悬停后,对目标控件操作,这里改变了状态图标大小"), _T("DUILIB DEMO"), MB_OK);
		((CButtonUI *)pHover)->ApplyAttributeList(
			_T("normalimage=\"file='downlist_pause.png' dest='15,9,32,26'\""));                
	}
	return 0;
}
开发者ID:fftyjw,项目名称:cdui,代码行数:14,代码来源:RichListWnd.cpp

示例5: HashKey

	CControlUI* CContainerUI::FindControl(LPCTSTR name)
	{
		UINT hash = HashKey(name);
		if(hash == m_name) return static_cast<CControlUI*>(this);
		else{
			for(int i=0; i<m_items.GetSize(); i++){
				CControlUI* pControl = static_cast<CControlUI*>(m_items[i]);
				CControlUI* pSubControl = NULL;
				pSubControl = pControl->FindControl(name);
				if(pSubControl)
					return pSubControl;
			}
		}
		return NULL;
	}
开发者ID:asdlei00,项目名称:sdklayout,代码行数:15,代码来源:UIContainer.cpp

示例6: SetVisible

	void CContainerUI::SetVisible( bool bVisible /*= true*/, bool bDispalyed /*= true*/ )
	{
		m_bVisible = bVisible;
		m_bDisplayed = bDispalyed;

		m_bEnableUpdate = false;

		for(int i=0; i<m_items.GetSize(); i++){
			CControlUI* pControl = static_cast<CControlUI*>(m_items[i]);
			pControl->SetVisibleByParent(bVisible, bDispalyed);
		}

		m_bEnableUpdate = true;
		NeedParentUpdate();
	}
开发者ID:asdlei00,项目名称:sdklayout,代码行数:15,代码来源:UIContainer.cpp

示例7: EstimateSize

	SIZE CMenuElementUI::EstimateSize(SIZE szAvailable)
	{
		SIZE cXY = {0};
		for( int it = 0; it < GetCount(); it++ ) {
			CControlUI* pControl = static_cast<CControlUI*>(GetItemAt(it));
			if( !pControl->IsVisible() ) continue;
			SIZE sz = pControl->EstimateSize(szAvailable);
			cXY.cy += sz.cy;
			if( cXY.cx < sz.cx )
				cXY.cx = sz.cx;
		}
		if(cXY.cy == 0) {
			TListInfoUI* pInfo = m_pOwner->GetListInfo();

			DWORD iTextColor = pInfo->dwTextColor;
			if( (m_uButtonState & UISTATE_HOT) != 0 ) {
				iTextColor = pInfo->dwHotTextColor;
			}
			if( IsSelected() ) {
				iTextColor = pInfo->dwSelectedTextColor;
			}
			if( !IsEnabled() ) {
				iTextColor = pInfo->dwDisabledTextColor;
			}
			CDuiString sText = GetText();

			RECT rcText = { 0, 0, MAX(szAvailable.cx, m_cxyFixed.cx), 9999 };
			rcText.left += pInfo->rcTextPadding.left;
			rcText.right -= pInfo->rcTextPadding.right;
			if( pInfo->bShowHtml ) {   
				int nLinks = 0;
				CRenderEngine::DrawHtmlText(m_pManager->GetPaintDC(), m_pManager, rcText, sText, iTextColor, NULL, NULL, nLinks, DT_CALCRECT | pInfo->uTextStyle);
			}
			else {
				CRenderEngine::DrawText(m_pManager->GetPaintDC(), m_pManager, rcText, sText, iTextColor, pInfo->nFont, DT_CALCRECT | pInfo->uTextStyle);
			}
			cXY.cx = rcText.right - rcText.left + pInfo->rcTextPadding.left + pInfo->rcTextPadding.right + 20;
			cXY.cy = rcText.bottom - rcText.top + pInfo->rcTextPadding.top + pInfo->rcTextPadding.bottom;
		}

		if( m_cxyFixed.cy != 0 ) cXY.cy = m_cxyFixed.cy;
		if ( cXY.cx < m_cxyFixed.cx )
			cXY.cx =  m_cxyFixed.cx;

		m_cxyFixed.cy = cXY.cy;
		m_cxyFixed.cx = cXY.cx;
		return cXY;
	}
开发者ID:Crawping,项目名称:IocpServerClient_Side,代码行数:48,代码来源:UIMenu.cpp

示例8: ResizeMenu

	void CMenuWnd::ResizeMenu()
	{
		CControlUI* pRoot = m_pm.GetRoot();

#if defined(WIN32) && !defined(UNDER_CE)
		MONITORINFO oMonitor = {}; 
		oMonitor.cbSize = sizeof(oMonitor);
		::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTOPRIMARY), &oMonitor);
		CDuiRect rcWork = oMonitor.rcWork;
#else
		CDuiRect rcWork;
		GetWindowRect(m_pOwner->GetManager()->GetPaintWindow(), &rcWork);
#endif
		SIZE szAvailable = { rcWork.right - rcWork.left, rcWork.bottom - rcWork.top };
		szAvailable = pRoot->EstimateSize(szAvailable);
		m_pm.SetInitSize(szAvailable.cx, szAvailable.cy);

		//必须是Menu标签作为xml的根节点
		CMenuUI *pMenuRoot = static_cast<CMenuUI*>(pRoot);
		ASSERT(pMenuRoot);

		SIZE szInit = m_pm.GetInitSize();
		CDuiRect rc;
		CDuiPoint point = m_BasedPoint;
		rc.left = point.x;
		rc.top = point.y;
		rc.right = rc.left + szInit.cx;
		rc.bottom = rc.top + szInit.cy;

		int nWidth = rc.GetWidth();
		int nHeight = rc.GetHeight();

		if (m_dwAlignment & eMenuAlignment_Right)
		{
			rc.right = point.x;
			rc.left = rc.right - nWidth;
		}

		if (m_dwAlignment & eMenuAlignment_Bottom)
		{
			rc.bottom = point.y;
			rc.top = rc.bottom - nHeight;
		}

		SetForegroundWindow(m_hWnd);
		MoveWindow(m_hWnd, rc.left, rc.top, rc.GetWidth(), rc.GetHeight(), FALSE);
		SetWindowPos(m_hWnd, HWND_TOPMOST, rc.left, rc.top, rc.GetWidth(), rc.GetHeight() + pMenuRoot->GetInset().bottom + pMenuRoot->GetInset().top, SWP_SHOWWINDOW);
	}
开发者ID:Crawping,项目名称:IocpServerClient_Side,代码行数:48,代码来源:UIMenu.cpp

示例9: _T

void RedisConfigUI::DoApplyData()
{
	CEditUI exampleEditUI;
	CComboUI exampleComboUI;

	RedisClient::TDicConfig::const_iterator it = m_dicConfig.begin();
	RedisClient::TDicConfig::const_iterator itend = m_dicConfig.end();
	RedisClient::TDicConfig config;
	for ( ; it!=itend; ++it)
	{
		CDuiString name = _T("redisconfig_");
		CDuiString key = CharacterSet::ANSIToUnicode(it->first).c_str();	
		name.Append(key);
		CControlUI* pCtl = GetPaintMgr()->FindControl(name);

		string val ;
		if (pCtl->GetClass() == exampleEditUI.GetClass())
		{
			CEditUI* pEdit = static_cast<CEditUI*> (pCtl);
			val = CharacterSet::UnicodeToANSI(pEdit->GetText().GetData());
		}
		else if (pCtl->GetClass() == exampleComboUI.GetClass())
		{
			CComboUI* pCombo = static_cast<CComboUI*> (pCtl);
			int idx = pCombo->GetCurSel();
			if (it->first == "loglevel")
			{
				if (idx == 0) val = "debug";
				else if (idx == 1) val = "verbose";
				else if (idx == 2) val = "notice";
				else if (idx == 3) val = "warning";
			}
			else 
			{
				if (idx == 0) val = "yes";
				else if (idx == 1) val = "no";
			}
		}
		if (val != it->second)
		{
			config.insert(std::make_pair(it->first, val));
		}
	}
	if (SetConfig(config) && GetConfig())
	{
		DoFillData();
	}
}
开发者ID:PsyduckMans,项目名称:RedisStudio,代码行数:48,代码来源:RedisConfigUI.cpp

示例10: GetPaintMgr

 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);

 }
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:48,代码来源:LoginWindow.cpp

示例11: Notify

void CColorPicker::Notify(TNotifyUI& msg)
{
	if (_tcsicmp(msg.sType, _T("click")) == 0)
	{
		CControlUI* pOne = static_cast<CControlUI*>(paint_manager_.FindControl(msg.ptMouse));
		if (_tcsicmp(pOne->GetClass(), _T("ButtonUI")) == 0)
		{
			DWORD nColor = pOne->GetBkColor();
			CVerticalLayoutUI* pColorContiner = static_cast<CVerticalLayoutUI*>(paint_manager_.FindControl(_T("color")));
			pColorContiner->SetBkColor(nColor);
			UpdateWindow(m_hWnd);
			Sleep(500);
			chat_dialog_->SetTextColor(nColor);
		}
	}
}
开发者ID:hxf829,项目名称:duilibtest,代码行数:16,代码来源:ColorPicker.cpp

示例12: DoPaint

void CContainerUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
   RECT rcTemp = { 0 };
   if( !::IntersectRect(&rcTemp, &rcPaint, &m_rcItem) ) return;

   CRenderClip clip;
   CBlueRenderEngineUI::GenerateClip(hDC, m_rcItem, clip);

   for( int it = 0; it < m_items.GetSize(); it++ ) {
      CControlUI* pControl = static_cast<CControlUI*>(m_items[it]);
      if( !pControl->IsVisible() ) continue;
      if( !::IntersectRect(&rcTemp, &rcPaint, &pControl->GetPos()) ) continue;
      if( !::IntersectRect(&rcTemp, &m_rcItem, &pControl->GetPos()) ) continue;
      pControl->DoPaint(hDC, rcPaint);
   }
}
开发者ID:0buffer,项目名称:DirectUI,代码行数:16,代码来源:UIContainer.cpp

示例13: GET_X_LPARAM

LRESULT CRichListWnd::OnMouseWheel( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	// 解决ie控件收不到滚动消息的问题
	POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
	::ScreenToClient(m_PaintManager.GetPaintWindow(), &pt);
	CControlUI* pControl = static_cast<CControlUI*>(m_PaintManager.FindControl(_T("ie")));
	if( pControl && pControl->IsVisible() ) {
		RECT rc = pControl->GetPos();
		if( ::PtInRect(&rc, pt) ) {
			return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
		}
	}

	bHandled = FALSE;
	return 0;
}
开发者ID:Fluray,项目名称:duilib,代码行数:16,代码来源:RichListWnd.cpp

示例14: GET_X_LPARAM

LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    if (m_bFrameWnd) {
        bHandled = FALSE;
        return 0;
    }

    POINT pt;
    pt.x = GET_X_LPARAM(lParam);
    pt.y = GET_Y_LPARAM(lParam);
    ::ScreenToClient(*this, &pt);

    RECT rcClient;
    ::GetClientRect(*this, &rcClient);

    if( !::IsZoomed(*this) )
    {
        RECT rcSizeBox = m_PaintManager.GetSizeBox();
        if( pt.y < rcClient.top + rcSizeBox.top )
        {
            if( pt.x < rcClient.left + rcSizeBox.left ) return HTTOPLEFT;
            if( pt.x > rcClient.right - rcSizeBox.right ) return HTTOPRIGHT;
            return HTTOP;
        }
        else if( pt.y > rcClient.bottom - rcSizeBox.bottom )
        {
            if( pt.x < rcClient.left + rcSizeBox.left ) return HTBOTTOMLEFT;
            if( pt.x > rcClient.right - rcSizeBox.right ) return HTBOTTOMRIGHT;
            return HTBOTTOM;
        }

        if( pt.x < rcClient.left + rcSizeBox.left ) return HTLEFT;
        if( pt.x > rcClient.right - rcSizeBox.right ) return HTRIGHT;
    }

    RECT rcCaption = m_PaintManager.GetCaptionRect();
    if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
            && pt.y >= rcCaption.top && pt.y < rcCaption.bottom ) {
        CControlUI* pControl = static_cast<CControlUI*>(m_PaintManager.FindControl(pt));
        if( pControl && _tcsicmp(pControl->GetClass(), CButtonUI::GetClassStatic()) != 0 &&
                _tcsicmp(pControl->GetClass(), COptionUI::GetClassStatic()) != 0 &&
                _tcsicmp(pControl->GetClass(), CTextUI::GetClassStatic()) != 0 )
            return HTCAPTION;
    }

    return HTCLIENT;
}
开发者ID:zyh329,项目名称:duilib,代码行数:47,代码来源:WinImplBase.cpp

示例15: LOG__

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);
	}
}
开发者ID:hlyces,项目名称:teamtalk_TT,代码行数:47,代码来源:CreateDiscussionGrpDialog.cpp


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