本文整理汇总了C++中CControlBase::GetVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CControlBase::GetVisible方法的具体用法?C++ CControlBase::GetVisible怎么用?C++ CControlBase::GetVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControlBase
的用法示例。
在下文中一共展示了CControlBase::GetVisible方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetControlHide
// 重载设置控件隐藏状态的函数,需要调用子控件的函数
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);
}
}
示例2: SetControlVisible
// 重载设置控件可见性的函数,需要调用子控件的函数
void CDuiPanel::SetControlVisible(BOOL bIsVisible)
{
__super::SetControlVisible(bIsVisible);
// 设置每个子控件的原生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->SetControlVisible(bIsVisible);
}else
{
// 判断子控件当前是否可见,根据可见性设置子控件的原生控件的可见性
// 如果是edit控件,暂时不显示原生控件,否则tab页切换时候会有问题
BOOL bVisible = pControlBase->GetVisible();
if(pControlBase->IsClass(CDuiEdit::GetClassName()))
{
bVisible = FALSE;
}
pControlBase->SetControlWndVisible(bVisible);
}
}
}
// 如果有插件,则设置插件的可见性
if(m_pDuiPluginObject)
{
m_pDuiPluginObject->SetVisible(bIsVisible);
}
}
示例3: GetNextFocusableControl
// 获取下一个可以获取焦点的子控件
CControlBase* CDlgPopup::GetNextFocusableControl()
{
BOOL bStartSearch = FALSE;
// 先按照焦点控件查找一次
for (int i = 0; i < (int)m_vecControl.size(); i++)
{
CControlBase* pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->GetVisible() && !pControlBase->GetDisable() && bStartSearch && pControlBase->IsTabStop())
{
return pControlBase;
}else
if (pControlBase && (pControlBase == m_pFocusControl))
{
bStartSearch = TRUE;
}
}
// 再遍历子控件查找
if(m_pFocusControl == NULL)
{
bStartSearch = TRUE;
}
for (int i = 0; i < (int)m_vecControl.size(); i++)
{
CControlBase* pControlBase = m_vecControl.at(i);
if(m_pControl == NULL)
{
m_pControl = pControlBase;
}
if (pControlBase && pControlBase->GetVisible() && !pControlBase->GetDisable() && bStartSearch && pControlBase->IsTabStop())
{
return pControlBase;
}else
if (pControlBase && (pControlBase == m_pControl))
{
// 查找子控件
pControlBase = pControlBase->GetNextFocusableControl(m_pFocusControl);
if(pControlBase != NULL)
{
return pControlBase;
}
//bStartSearch = TRUE;
}
}
return NULL;
}
示例4: GetPrevFocusableControl
// 获取上一个可以获取焦点的子控件
CControlBase* CControlBase::GetPrevFocusableControl(CControlBase* pFocusControl)
{
BOOL bStartSearch = FALSE;
// 先按照焦点控件查找一次
for (int i = m_vecControl.size()-1; i >= 0; i--)
{
CControlBase* pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->GetVisible() && !pControlBase->GetDisable() && bStartSearch && pControlBase->IsTabStop())
{
return pControlBase;
}else
if (pControlBase && (pControlBase == pFocusControl))
{
bStartSearch = TRUE;
}
}
// 再遍历子控件查找
if(m_pControl == NULL)
{
bStartSearch = TRUE;
}
for (int i = m_vecControl.size()-1; i >= 0; i--)
{
CControlBase* pControlBase = m_vecControl.at(i);
if(m_pControl == NULL)
{
m_pControl = pControlBase;
}
if (pControlBase && pControlBase->GetVisible() && !pControlBase->GetDisable() && bStartSearch && pControlBase->IsTabStop())
{
return pControlBase;
}else
if (pControlBase && (pControlBase == m_pControl))
{
// 查找子控件
pControlBase = pControlBase->GetPrevFocusableControl(pFocusControl);
if(pControlBase != NULL)
{
return pControlBase;
}
}
}
return NULL;
}
示例5: OnLButtonDown
// 鼠标左键按下事件处理
BOOL CControlBase::OnLButtonDown(UINT nFlags, CPoint point)
{
if(!m_bIsVisible || !m_bRresponse) return false;
// 保存原始的鼠标位置,并进行位置变换
CPoint oldPoint = point;
OnMousePointChange(point);
m_bMouseDown = m_rc.PtInRect(point);
// 查找鼠标是否在某个内部控件位置,如果是的话就更新当前子控件(按照反向顺序查找,因为定义在后面的控件是优先级更高的)
// 找到第一个符合条件的就结束查找
for (int i = m_vecControl.size()-1; i >= 0; i--)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->PtInRect(point))
{
if(pControlBase->GetVisible() && !pControlBase->GetDisable() && pControlBase->GetRresponse())
{
m_pControl = pControlBase;
break;
}
}
}
if(m_pControl != NULL)
{
// 如果是控件内置滚动条子控件,则不进行位置变换,因为滚动条位置是不需要变换的
UINT uControlID = m_pControl->GetControlID();
if((SCROLL_V == uControlID) || (SCROLL_H == uControlID))
{
point = oldPoint;
}
if(m_pControl->OnLButtonDown(nFlags, point))
{
return true;
}
}
else
{
// 切换对话框中的当前焦点控件(暂不处理Popup窗口的切换)
CDlgBase* pDlg = GetParentDialog(FALSE);
if(pDlg)
{
pDlg->SetFocusControl(this);
}
// 发送鼠标左键按下DUI消息
if(m_bDuiMsgMouseLDown && m_rc.PtInRect(point))
{
SendMessage(MSG_MOUSE_LDOWN, (WPARAM)nFlags, (LPARAM)(&point));
}
return OnControlLButtonDown(nFlags, point);
}
return false;
}
示例6: DrawSubControls
// 画子控件
BOOL CControlBase::DrawSubControls(CDC &dc, CRect rcUpdate)
{
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->GetVisible())
{
pControlBase->Draw(dc, rcUpdate);
}
}
return TRUE;
}
示例7: SetControlWndVisible
// 重载设置控件中windows原生控件可见性的函数,需要调用子控件的函数
void CDuiLayout::SetControlWndVisible(BOOL bIsVisible)
{
__super::SetControlWndVisible(bIsVisible);
// 设置每个子控件的原生Windows控件的可见性
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
// 判断子控件当前是否可见,根据可见性设置子控件的原生控件的可见性
BOOL bVisible = pControlBase->GetVisible();
pControlBase->SetControlWndVisible(bVisible);
}
}
}
示例8: ResetGroupCheck
// 刷新父控件下面所有同一个组的RadioButton控件的状态
BOOL CMenuItem::ResetGroupCheck()
{
CDuiObject* pParentObj = GetParent();
if(pParentObj == NULL)
{
return FALSE;
}
vector<CControlBase*>* pvecControl = NULL;
if(pParentObj->IsClass(_T("dlg")))
{
CDlgBase* pDlg = static_cast<CDlgBase*>(pParentObj);
pvecControl = pDlg->GetControls();
}else
if(pParentObj->IsClass(_T("popup")))
{
CDlgPopup* pDlg = static_cast<CDlgPopup*>(pParentObj);
pvecControl = pDlg->GetControls();
}else
{
CControlBase* pControlBase = static_cast<CControlBase*>(pParentObj);
pvecControl = pControlBase->GetControls();
}
if(pvecControl == NULL)
{
return FALSE;
}
for(int i=0; i<(int)pvecControl->size(); i++)
{
CControlBase* pControlBase = pvecControl->at(i);
if(pControlBase->IsClass(CMenuItem::GetClassName()) && pControlBase->GetVisible() && !pControlBase->GetDisable())
{
CMenuItem* pControl = static_cast<CMenuItem*>(pControlBase);
if((pControl->GetGroupName() == m_strGroupName) && (pControl != this))
{
// 重置控件状态
pControl->SetControlCheck(FALSE);
}
}
}
return TRUE;
}
示例9: GetGroupValue
// 获取所在Radio组选择的控件的值
CString CMenuItem::GetGroupValue()
{
CDuiObject* pParentObj = GetParent();
if(pParentObj == NULL)
{
return _T("");
}
vector<CControlBase*>* pvecControl = NULL;
if(pParentObj->IsClass(_T("dlg")))
{
CDlgBase* pDlg = static_cast<CDlgBase*>(pParentObj);
pvecControl = pDlg->GetControls();
}else
if(pParentObj->IsClass(_T("popup")))
{
CDlgPopup* pDlg = static_cast<CDlgPopup*>(pParentObj);
pvecControl = pDlg->GetControls();
}else
{
CControlBase* pControlBase = static_cast<CControlBase*>(pParentObj);
pvecControl = pControlBase->GetControls();
}
if(pvecControl == NULL)
{
return _T("");
}
for(int i=0; i<(int)pvecControl->size(); i++)
{
CControlBase* pControlBase = pvecControl->at(i);
if(pControlBase->IsClass(CMenuItem::GetClassName()) && pControlBase->GetVisible() && !pControlBase->GetDisable())
{
CMenuItem* pControl = static_cast<CMenuItem*>(pControlBase);
if((pControl->GetGroupName() == m_strGroupName) && pControl->GetCheck())
{
return pControl->GetValue();
}
}
}
return _T("");
}
示例10: OnControlUpdate
LRESULT CDlgPopup::OnControlUpdate(CRect rcUpdate, BOOL bUpdate, CControlBase *pUpdateControlBase)
{
if(pUpdateControlBase == NULL) return 0;
if(bUpdate)
{
pUpdateControlBase->SetUpdate(FALSE);
}
CRect rcAllUpDate = rcUpdate;
if(m_bInit)
{
BOOL bFind = false;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
if(bFind)
{
if (pControlBase->GetVisible() && !(pControlBase->GetRect() & rcUpdate).IsRectEmpty())
{
rcAllUpDate |= pControlBase->GetRect();
pControlBase->SetUpdate(FALSE);
}
}
else if(pControlBase == pUpdateControlBase)
{
bFind = true;
}
}
}
}
if(GetSafeHwnd())
{
InvalidateRect(&rcAllUpDate);
}
return 0L;
};
示例11: OnLButtonDown
// 鼠标左键事件处理
BOOL CControlBase::OnLButtonDown(UINT nFlags, CPoint point)
{
if(!m_bIsVisible || !m_bRresponse) return false;
OnMousePointChange(point);
m_bMouseDown = m_rc.PtInRect(point);
// 查找鼠标是否在某个内部控件位置,如果是的话就更新当前子控件
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->PtInRect(point))
{
if(pControlBase->GetVisible() && !pControlBase->GetDisable() && pControlBase->GetRresponse())
{
m_pControl = pControlBase;
}
}
}
if(m_pControl != NULL)
{
if(m_pControl->OnLButtonDown(nFlags, point))
{
return true;
}
}
else
{
// 切换对话框中的当前焦点控件(暂不处理Popup窗口的切换)
CDlgBase* pDlg = GetParentDialog(FALSE);
if(pDlg)
{
pDlg->SetFocusControl(this);
}
return OnControlLButtonDown(nFlags, point);
}
return false;
}
示例12: GetFocusControl
// 获取当前焦点控件
CControlBase* CControlBase::GetFocusControl(CControlBase* pFocusControl)
{
for (int i = m_vecControl.size()-1; i >= 0; i--)
{
CControlBase* pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->GetVisible() && !pControlBase->GetDisable() && (pControlBase == pFocusControl) && pControlBase->IsTabStop())
{
return pControlBase;
}else
if (pControlBase && (pControlBase == m_pControl))
{
// 查找子控件
pControlBase = pControlBase->GetFocusControl(pFocusControl);
if(pControlBase != NULL)
{
return pControlBase;
}
}
}
return NULL;
}
示例13: OnControlUpdate
// 控件界面刷新
LRESULT CDuiPanel::OnControlUpdate(CRect rcUpdate, BOOL bUpdate, CControlBase *pUpdateControlBase)
{
if(pUpdateControlBase == NULL) return 0;
if(bUpdate)
{
pUpdateControlBase->SetUpdate(FALSE);
}
int nVirtualTop = 0;
if(m_nVirtualHeight > m_rc.Height())
{
// 计算显示位置
CDuiScrollVertical* pScrollV = (CDuiScrollVertical*)m_pControScrollV;
int nCurPos = pScrollV->GetScrollCurrentPos(); // 当前top位置
int nMaxRange = pScrollV->GetScrollMaxRange();
nVirtualTop = (nMaxRange > 0) ? nCurPos*(m_nVirtualHeight-m_rc.Height())/nMaxRange : 0; // 当前显示的是虚拟图片中什么位置开始的图片
}
int nVirtualLeft = 0;
if(m_nVirtualWidth > m_rc.Width())
{
// 计算显示位置
CDuiScrollHorizontal* pScrollH = (CDuiScrollHorizontal*)m_pControScrollH;
int nCurPosH = pScrollH->GetScrollCurrentPos(); // 当前top位置
int nMaxRangeH = pScrollH->GetScrollMaxRange();
nVirtualLeft = (nMaxRangeH > 0) ? nCurPosH*(m_nVirtualLeft-m_rc.Width())/nMaxRangeH : 0; // 当前显示的是虚拟图片中什么位置开始的图片
}
CRect rcAllUpDate = rcUpdate;
if(m_bInit)
{
BOOL bFind = false;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
if(bFind)
{
if (pControlBase->GetVisible() && !(pControlBase->GetRect() & rcUpdate).IsRectEmpty())
{
rcAllUpDate |= pControlBase->GetRect();
pControlBase->SetUpdate(FALSE);
}
}
else if(pControlBase == pUpdateControlBase)
{
bFind = true;
}
}
}
}
// 按照滚动位置修改更新区域
rcAllUpDate.OffsetRect(-nVirtualLeft, -nVirtualTop);
rcAllUpDate |= m_rc;
InvalidateRect(&rcAllUpDate);
return 0L;
};
示例14: DrawSubControls
// 画子控件(支持滚动显示)
BOOL CDuiPanel::DrawSubControls(CDC &dc, CRect rcUpdate)
{
// 如果不需要滚动条,则直接使用父控件的画图方法
if(!m_bEnableScroll || ((m_nVirtualHeight <= m_rc.Height()) && (m_nVirtualWidth <= m_rc.Width())))
{
return __super::DrawSubControls(dc, rcUpdate);
}
BOOL bShowScrollV = m_nVirtualHeight > m_rc.Height();
BOOL bShowScrollH = m_nVirtualWidth > m_rc.Width();
// 计算显示位置
CDuiScrollVertical* pScrollV = (CDuiScrollVertical*)m_pControScrollV;
int nCurPosV = pScrollV->GetScrollCurrentPos(); // 当前top位置
int nMaxRangeV = pScrollV->GetScrollMaxRange();
int nVirtualTop = (nMaxRangeV > 0) ? nCurPosV*(m_nVirtualHeight-m_rc.Height())/nMaxRangeV : 0; // 当前显示的是虚拟图片中什么位置开始的图片
CDuiScrollHorizontal* pScrollH = (CDuiScrollHorizontal*)m_pControScrollH;
int nCurPosH = pScrollH->GetScrollCurrentPos(); // 当前top位置
int nMaxRangeH = pScrollH->GetScrollMaxRange();
int nVirtualLeft = (nMaxRangeH > 0) ? nCurPosH*(m_nVirtualWidth-m_rc.Width())/nMaxRangeH : 0; // 当前显示的是虚拟图片中什么位置开始的图片
// 根据滚动条位置画子控件
// 初始化虚拟显示dc,并复制背景到虚拟显示dc
CBitmap virtualBitmap;
CDC virtualDC;
virtualDC.CreateCompatibleDC(&dc);
virtualBitmap.CreateCompatibleBitmap(&dc,
bShowScrollH ? (m_rc.left + m_nVirtualWidth) : (m_rc.right - (bShowScrollV ? m_nScrollWidth : 0)),
bShowScrollV ? (m_rc.top + m_nVirtualHeight) : (m_rc.bottom - (bShowScrollH ? m_nScrollWidth : 0)) );
CBitmap* pOldVirtualBitmap = virtualDC.SelectObject(&virtualBitmap);
virtualDC.BitBlt(m_rc.left+nVirtualLeft, m_rc.top+nVirtualTop,
m_rc.Width()-(bShowScrollV ? m_nScrollWidth : 0),
m_rc.Height()-(bShowScrollH ? m_nScrollWidth : 0),
&dc, m_rc.left, m_rc.top, SRCCOPY); // 背景复制到虚拟显示dc
// 更新区域按照显示区域调整
rcUpdate.OffsetRect(nVirtualLeft, nVirtualTop);
// 画子控件到虚拟dc
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && pControlBase->GetVisible()
&& (pControlBase != m_pControScrollV) && (pControlBase != m_pControScrollH))
{
// 如果顶部位置发生了变化,需要重画所有子控件,但会造成速度很慢
if(m_nVirtualTop != nVirtualTop)
{
pControlBase->UpdateControl(true);
}
pControlBase->Draw(virtualDC, rcUpdate);
}
}
// 画滚动条,滚动条整个区域都需要更新
m_pControScrollV->Draw(dc, m_pControScrollV->GetRect());
m_pControScrollH->Draw(dc, m_pControScrollH->GetRect());
m_nVirtualTop = nVirtualTop;
m_nVirtualLeft = nVirtualLeft;
// 虚拟显示dc复制到dc(滚动条部分不用复制)
dc.BitBlt(m_rc.left, m_rc.top, m_rc.Width()-(bShowScrollV ? m_nScrollWidth : 0),
m_rc.Height()-(bShowScrollH ? m_nScrollWidth : 0),
&virtualDC, m_rc.left + nVirtualLeft, m_rc.top + nVirtualTop, SRCCOPY);
// 释放虚拟显示dc
virtualDC.SelectObject(pOldVirtualBitmap);
virtualDC.DeleteDC();
virtualBitmap.DeleteObject();
return TRUE;
}