Example #1
0
// 重载设置控件隐藏状态的函数,需要调用子控件的函数
void CDuiPanel::SetControlHide(BOOL bIsHide)
{
	__super::SetControlHide(bIsHide);

	// 设置每个子控件的原生Windows控件的可见性
	for (size_t i = 0; i < m_vecControl.size(); i++)
	{
		CControlBase * pControlBase = m_vecControl.at(i);
		if (pControlBase)
		{
			if(pControlBase->IsClass(_T("div")) || pControlBase->IsClass(_T("tabctrl")) || pControlBase->IsClass(_T("layout")))
			{
				// 如果子控件是容器类型控件,则调用子控件的设置隐藏函数
				pControlBase->SetControlHide(bIsHide);
			}else
			{
				// 判断子控件当前是否可见,根据可见性设置子控件的原生控件的可见性
				pControlBase->SetControlWndVisible(pControlBase->GetVisible());
			}
		}
	}

	// 如果有插件,则设置插件的显示状态(插件接口暂不支持SetHide函数)
	if(m_pDuiPluginObject)
	{
		m_pDuiPluginObject->SetVisible(!bIsHide);
	}
}