本文整理汇总了C++中CControlBase::GetControlID方法的典型用法代码示例。如果您正苦于以下问题:C++ CControlBase::GetControlID方法的具体用法?C++ CControlBase::GetControlID怎么用?C++ CControlBase::GetControlID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControlBase
的用法示例。
在下文中一共展示了CControlBase::GetControlID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetControlRect
void CDuiText::SetControlRect(CRect rc)
{
m_rc = rc;
CRect rcTemp;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
UINT uControlID = pControlBase->GetControlID();
if((SCROLL_V == uControlID) && m_bScrollV)
{
rcTemp = m_rc;
rcTemp.left = rcTemp.right - m_nScrollWidth;
}else
if(LISTBK_AREA == uControlID)
{
rcTemp = m_rc;
rcTemp.right -= m_nScrollWidth;
}else
{
continue;
}
pControlBase->SetRect(rcTemp);
}
}
}
示例2: SetControlRect
void CScrollV::SetControlRect(CRect rc)
{
m_rc = rc;
SetRange();
CRect rcTemp;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
pControlBase->SetVisible(m_bShowScroll);
UINT uControlID = pControlBase->GetControlID();
if (BT_UP == uControlID)
{
rcTemp = m_rc;
rcTemp.bottom = m_rc.top + 20;
}
else if(BT_DOWN == uControlID)
{
rcTemp = m_rc;
rcTemp.top = m_rc.bottom - 20;
}
else
{
continue;
}
pControlBase->SetRect(rcTemp);
}
}
}
示例3:
// 获取子控件对象
CControlBase *CControlBase::GetControl(UINT uControlID)
{
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
if (pControlBase->GetControlID() == uControlID)
{
return pControlBase;
}else
{
// 查找子控件
CControlBase * pSubControl = pControlBase->GetControl(uControlID);
if(pSubControl != NULL)
{
return pSubControl;
}
}
}
}
for (size_t i = 0; i < m_vecArea.size(); i++)
{
CControlBase * pControlBase = m_vecArea.at(i);
if (pControlBase)
{
if (pControlBase->GetControlID() == uControlID)
{
return pControlBase;
}else
{
// 查找子控件
CControlBase * pSubControl = pControlBase->GetControl(uControlID);
if(pSubControl != NULL)
{
return pSubControl;
}
}
}
}
return NULL;
}
示例4: SetControlRect
// 设置控件的位置
void CDuiPanel::SetControlRect(CRect rc)
{
m_rc = rc;
if(m_pDuiPluginObject)
{
m_pDuiPluginObject->SetRect(rc);
}
CRect rcTemp;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
UINT uControlID = pControlBase->GetControlID();
if(SCROLL_V == uControlID)
{
rcTemp = m_rc;
rcTemp.left = rcTemp.right - m_nScrollWidth;
}else
if(SCROLL_H == uControlID)
{
rcTemp = m_rc;
rcTemp.top = rcTemp.bottom - m_nScrollWidth;
}else
{
rcTemp = pControlBase->GetRect();
if(rcTemp.bottom > m_nVirtualHeight)
{
// 刷新Panel的虚拟高度
m_nVirtualHeight = rcTemp.bottom - m_rc.top;
}
if(rcTemp.right > m_nVirtualWidth)
{
// 刷新Panel的虚拟宽度
m_nVirtualWidth = rcTemp.right - m_rc.left;
}
continue;
}
pControlBase->SetRect(rcTemp);
}
}
// 需要的总高度大于显示区高度才会显示滚动条
m_pControScrollV->SetVisible(m_nVirtualHeight > m_rc.Height());
((CDuiScrollVertical*)m_pControScrollV)->SetScrollMaxRange(m_nVirtualHeight);
// 需要的总宽度大于显示区宽度才会显示垂直滚动条
m_pControScrollH->SetVisible(m_nVirtualWidth > m_rc.Width());
((CDuiScrollHorizontal*)m_pControScrollH)->SetScrollMaxRange(m_nVirtualWidth);
}
示例5: OnMessage
LRESULT CDlgPopup::OnMessage(UINT uID, UINT Msg, WPARAM wParam, LPARAM lParam)
{
// 遍历每个控件,看哪个控件是此ID,则进行事件的处理
CControlBase * pThisControlBase = NULL;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && (pControlBase->GetControlID() == uID))
{
pThisControlBase = pControlBase;
pControlBase->OnMessage(uID, Msg, wParam, lParam);
}
}
return 0;
}
示例6: SetControlRect
void CDuiListCtrl::SetControlRect(CRect rc)
{
m_rc = rc;
CRect rcTemp;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
UINT uControlID = pControlBase->GetControlID();
if(SCROLL_V == uControlID)
{
rcTemp = m_rc;
rcTemp.left = rcTemp.right - m_nScrollWidth;
}else
if(LISTBK_AREA == uControlID)
{
rcTemp = m_rc;
rcTemp.right -= m_nScrollWidth;
}else
{
continue;
}
pControlBase->SetRect(rcTemp);
}
}
// 重新计算所有行的位置
int nXPos = 0;
int nYPos = 0;
for(size_t i = 0; i < m_vecRowInfo.size(); i++)
{
ListRowInfo &rowInfoTemp = m_vecRowInfo.at(i);
int nItemWidth = m_rc.Width() - m_nScrollWidth;
rowInfoTemp.rcRow.SetRect(nXPos, nYPos, nXPos + nItemWidth, nYPos + m_nRowHeight);
nYPos += m_nRowHeight;
}
// 需要的总高度大于显示区高度才会显示滚动条
m_pControScrollV->SetVisible(((int)m_vecRowInfo.size() * m_nRowHeight) > m_rc.Height());
((CScrollV*)m_pControScrollV)->SetScrollMaxRange((int)m_vecRowInfo.size() * m_nRowHeight);
}
示例7: SetControlRect
void CDuiGridCtrl::SetControlRect(CRect rc)
{
int nTotalColumnWidth = GetTotalColumnWidth();
m_rc = rc;
CRect rcTemp;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
UINT uControlID = pControlBase->GetControlID();
if(SCROLL_V == uControlID)
{
rcTemp = m_rc;
rcTemp.top += m_nHeaderHeight;
rcTemp.left = rcTemp.right - m_nScrollWidth;
}else
if((SCROLL_H == uControlID) && (nTotalColumnWidth > m_rc.Width()))
{
rcTemp = m_rc;
rcTemp.top = rcTemp.bottom - m_nScrollWidth;
rcTemp.right = rcTemp.right - m_nScrollWidth;
}else
if(LISTBK_AREA == uControlID)
{
rcTemp = m_rc;
rcTemp.top += m_nHeaderHeight;
rcTemp.right -= m_nScrollWidth;
}else
{
continue;
}
pControlBase->SetRect(rcTemp);
}
}
// 计算横向滚动条
CalcColumnsPos();
// 重新计算所有行的位置
CalcRowsPos();
}
示例8: OnMessage
// 消息处理
LRESULT CDuiPanel::OnMessage(UINT uID, UINT Msg, WPARAM wParam, LPARAM lParam)
{
// 遍历每个控件,看哪个控件是此ID,则进行事件的处理
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase && (pControlBase->GetControlID() == uID))
{
return pControlBase->OnMessage(uID, Msg, wParam, lParam);
}
}
if(m_pDuiPluginObject)
{
return m_pDuiPluginObject->OnMessage(uID, Msg, wParam, lParam);
}
// 如果事件未处理,则调用父类的消息函数,最终会送给各事件处理对象进行处理
return __super::OnMessage(uID, Msg, wParam, lParam);
}
示例9: OnMouseMove
// 鼠标移动事件处理
BOOL CControlBase::OnMouseMove(UINT nFlags, CPoint point)
{
if(!m_bIsVisible || !m_bRresponse) return false;
// 保存原始的鼠标位置,并进行位置变换
CPoint oldPoint = point;
OnMousePointChange(point);
BOOL bRresponse = false;
if(m_pControl)
{
CPoint pt = point;
// 如果是控件内置滚动条子控件,则不进行位置变换,因为滚动条位置是不需要变换的
UINT uControlID = m_pControl->GetControlID();
if((SCROLL_V == uControlID) || (SCROLL_H == uControlID))
{
pt = oldPoint;
}
if((m_pControl->PtInRect(pt) && m_pControl->OnCheckMouseResponse(nFlags, pt)) || m_bMouseDown)
{
if(m_pControl->OnMouseMove(nFlags, pt))
{
return true;
}
return false;
}
}
CControlBase * pOldControl = m_pControl;
m_pControl = NULL;
if(!m_strTooltip.IsEmpty() && PtInRect(point) && OnCheckMouseResponse(nFlags, point))
{
// 如果当前控件有Tooltip,并且当前Tooltip设置的是其他控件,则设置Tooltip
if(GetTooltipCtrlID() != GetID())
{
SetTooltip(this, m_strTooltip, m_rc, FALSE, m_nTipWidth);
SetTooltipCtrlID(GetID());
}
}
// 调用控件的设置鼠标光标函数
OnControlSetCursor(nFlags, point);
// 调用控件的鼠标移动函数
bRresponse = OnControlMouseMove(nFlags, point);
// 发送鼠标移动的DUI消息
if(m_bDuiMsgMouseMove)
{
if(PtInRect(point))
{
// 发送鼠标在控件范围内移动的消息
SendMessage(MSG_MOUSE_MOVE, (WPARAM)nFlags, (LPARAM)(&point));
m_bMouseLeave = FALSE;
}else
{
if(!m_bMouseLeave)
{
// 发送鼠标离开控件的消息(离开之后仅发送一次离开消息)
SendMessage(MSG_MOUSE_LEAVE, (WPARAM)nFlags, (LPARAM)(&point));
m_bMouseLeave = TRUE;
}
}
}
if(!m_bMouseDown)
{
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl.at(i);
if (pControlBase)
{
CPoint pt = point;
// 如果是控件内置滚动条子控件,则不进行位置变换,因为滚动条位置是不需要变换的
UINT uControlID = pControlBase->GetControlID();
if((SCROLL_V == uControlID) || (SCROLL_H == uControlID))
{
pt = oldPoint;
}
if(pControlBase->OnMouseMove(nFlags, pt))
{
if(pControlBase->PtInRect(pt))
{
m_pControl = pControlBase;
}
bRresponse = true;
}
}
}
if (pOldControl)
{
bRresponse = true;
}
if (m_pControl)
{
//.........这里部分代码省略.........
示例10: SetMenuPoint
// 设置菜单项位置
void CDuiMenu::SetMenuPoint()
{
int nXPos = 2;
int nYPos = (m_nTopHeight != 0) ? m_nTopHeight : 2;
CRect rc;
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl[i];
if(pControlBase == NULL)
{
continue;
}
if(pControlBase->IsClass(CMenuItem::GetClassName())) // 如果是MenuItem类型控件
{
CMenuItem* pMenuItem = (CMenuItem*)pControlBase;
pMenuItem->SetFrameWidth(m_nFrameWidth);
if(!pMenuItem->GetVisible())
{
// 菜单项不可见
rc.SetRect(0,0,0,0);
}else
if(pMenuItem->IsSeparator())
{
// 分隔线
rc.SetRect(m_nLeft + 1, nYPos + 1, m_nWidth - 1, nYPos + 2);
nYPos += 4;
}else
{
// 普通菜单项
rc.SetRect(nXPos, nYPos, m_nWidth - 2, nYPos + m_nHeight);
nYPos += m_nHeight;
// 设置菜单项的鼠标移动时候的背景
if(m_pImageRowHover != NULL)
{
pMenuItem->m_pImageHover = m_pImageRowHover;
pMenuItem->m_sizeHover = m_sizeRowHover;
}else
{
pMenuItem->m_clrHover = m_clrRowHover; // 设置菜单项的背景色
}
// 设置菜单项的弹出菜单箭头图片
if(m_pImagePopupArrow != NULL)
{
pMenuItem->m_pImagePopupArrow = m_pImagePopupArrow;
pMenuItem->m_sizePopupArrow = m_sizePopupArrow;
}
}
SetControlRect(pControlBase, rc);
}else
if(-1 == pControlBase->GetControlID())
{
rc.SetRect(m_nLeft + 4, nYPos + 1, m_nWidth - 9, nYPos + 2);
nYPos += 4;
SetControlRect(pControlBase, rc);
}
}
nYPos += ((m_nBottomHeight != 0) ? m_nBottomHeight : 2);
SetWindowPos(NULL, 0, 0, m_nWidth, nYPos, SWP_NOMOVE);
SetRect(CRect(0, 0, m_nWidth, nYPos)); // 设置菜单窗口的大小
// 设置非菜单项控件的位置(必须在高度计算出来之后设置)
for (size_t i = 0; i < m_vecControl.size(); i++)
{
CControlBase * pControlBase = m_vecControl[i];
if(pControlBase == NULL)
{
continue;
}
if(pControlBase->IsClass(CMenuItem::GetClassName()))
{
continue;
}else
if(-1 == pControlBase->GetControlID())
{
continue;
}else
{
pControlBase->OnAttributePosChange(pControlBase->GetPosStr(), FALSE);
}
}
InvalidateRect(NULL);
}