本文整理汇总了C++中CDuiObject类的典型用法代码示例。如果您正苦于以下问题:C++ CDuiObject类的具体用法?C++ CDuiObject怎么用?C++ CDuiObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDuiObject类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParent
// 获取父对话框
CDlgBase* CControlBase::GetParentDialog(BOOL bEnablePopup)
{
CDuiObject* pParentObj = GetParent();
while((pParentObj != NULL) && (!pParentObj->IsClass("dlg")))
{
if(pParentObj->IsClass("popup"))
{
if(!bEnablePopup) // 如果不允许Popup窗口的控件获取父对话框,则直接返回空
{
return NULL;
}
pParentObj = ((CDlgPopup*)pParentObj)->GetParent();
}else
{
pParentObj = ((CControlBase*)pParentObj)->GetParent();
}
}
if((pParentObj != NULL) && pParentObj->IsClass("dlg"))
{
return (CDlgBase*)pParentObj;
}
return NULL;
}
示例2: GetDuiHandler
// 调用DUI事件处理对象
LRESULT CControlBase::CallDuiHandler(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CDuiHandler* pDuiHandler = GetDuiHandler();
if(pDuiHandler != NULL)
{
return pDuiHandler->OnDuiMessage(GetID(), GetName(), uMsg, wParam, lParam);
}
CDuiObject* pParentObj = GetParent();
while(pParentObj != NULL)
{
CDuiHandler* pDuiHandler = pParentObj->GetDuiHandler();
if(pDuiHandler != NULL)
{
return pDuiHandler->OnDuiMessage(GetID(), GetName(), uMsg, wParam, lParam);
}
if(pParentObj->IsClass("popup"))
{
pParentObj = ((CDlgPopup*)pParentObj)->GetParent();
}else
if(pParentObj->IsClass("dlg")) // 如果是对话框,暂时终结,不再找父窗口
{
pParentObj = ((CDlgBase*)pParentObj)->GetParent();
}else
{
pParentObj = ((CControlBase*)pParentObj)->GetParent();
}
}
// 如果未找到事件处理对象,则通过DuiSystem调用所有注册的事件处理对象进行处理
return DuiSystem::Instance()->CallDuiHandler(GetID(), GetName(), uMsg, wParam, lParam);
}
示例3: GetParent
CPopupList::~CPopupList(void)
{
// 释放图片资源
if(m_pImageHead != NULL)
{
delete m_pImageHead;
m_pImageHead = NULL;
}
if(m_pImageClose != NULL)
{
delete m_pImageClose;
m_pImageClose = NULL;
}
for(int i = 0; i < (int)m_vecItem.size(); i++)
{
EditListItem &editListItem = m_vecItem.at(i);
if(editListItem.pImage != NULL)
{
delete editListItem.pImage;
editListItem.pImage = NULL;
}
}
// 判断如果父控件是combo的话,将combo中的指针设置为空
CDuiObject* pParent = GetParent();
if(pParent->IsClass(CDuiComboBox::GetClassName()))
{
((CDuiComboBox*)pParent)->m_pPopupList = NULL;
}
}
示例4: GetParent
// 根据控件名创建控件实例
CControlBase* CDuiTabCtrl::_CreateControlByName(LPCTSTR lpszName)
{
// 如果已经设置了窗口句柄,使用窗口句柄创建控件
HWND hWnd = m_hWnd;
if(hWnd != NULL)
{
return DuiSystem::CreateControlByName(lpszName, hWnd, this);
}
// 查找父对话框的窗口句柄,通过父对话框句柄创建控件
CDuiObject* pParentObj = GetParent();
while((pParentObj != NULL) && (!pParentObj->IsClass(_T("dlg"))) && (!pParentObj->IsClass(_T("popup"))))
{
pParentObj = ((CControlBase*)pParentObj)->GetParent();
}
if((pParentObj != NULL) && pParentObj->IsClass(_T("dlg")))
{
return DuiSystem::CreateControlByName(lpszName, ((CDlgBase*)pParentObj)->GetSafeHwnd(), this);
}else
if((pParentObj != NULL) && pParentObj->IsClass(_T("popup")))
{
return DuiSystem::CreateControlByName(lpszName, ((CDlgPopup*)pParentObj)->GetSafeHwnd(), this);
}
return NULL;
}
示例5: GetParentMenu
// 重载窗口去激活时候的关闭窗口操作
BOOL CDuiMenu::OnNcCloseWindow()
{
// 如果有父菜单,将父菜单窗口关闭
CDuiMenu* pParentMenu = GetParentMenu();
if(pParentMenu && !pParentMenu->IsAutoClose())
{
// 如果鼠标在父菜单窗口中,则不关闭父窗口
CMenuItem* pHoverItem = pParentMenu->GetHoverMenuItem();
if(pHoverItem == NULL)
{
pParentMenu->SetAutoClose(TRUE);
pParentMenu->SetForegroundWindow();
pParentMenu->PostMessage(WM_LBUTTONDOWN, 0, 0);
}
}
// 如果父对象是菜单项,则将菜单项中的弹出菜单指针设置为空
CDuiObject* pParent = GetParent();
if((pParent != NULL) && (pParent->IsClass(CMenuItem::GetClassName())))
{
((CMenuItem*)pParent)->SetPopupMenu(NULL);
}
// 关闭自身
m_pParentDuiObject = NULL;
CloseWindow();
return TRUE;
}
示例6: GetParent
// 获取父控件的插件宿主窗口功能接口(如果是在插件中)
IDuiHostWnd* CControlBase::GetParentIDuiHostWnd()
{
CDuiObject* pParentObj = GetParent();
while(pParentObj != NULL)
{
if(pParentObj->IsClass(_T("div")) && (((CDuiPanel*)pParentObj)->GetIDuiHostWnd() != NULL))
{
return ((CDuiPanel*)pParentObj)->GetIDuiHostWnd();
}
pParentObj = ((CControlBase*)pParentObj)->GetParent();
}
return NULL;
}
示例7: GetParent
// 根据控件名创建控件实例
CControlBase* CDuiTabCtrl::_CreateControlByName(LPCTSTR lpszName)
{
HWND hWnd = NULL;
CDuiObject* pParentObj = GetParent();
while((pParentObj != NULL) && (!pParentObj->IsClass(_T("dlg"))))
{
pParentObj = ((CControlBase*)pParentObj)->GetParent();
}
if((pParentObj != NULL) && pParentObj->IsClass(_T("dlg")))
{
return DuiSystem::CreateControlByName(lpszName, ((CDlgBase*)pParentObj)->GetSafeHwnd(), this);
}
return NULL;
}
示例8: GetParent
// 刷新父控件下面所有同一个组的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: GetParent
// 发送通知消息给父控件
BOOL CDlgPopup::SendMessageToParent(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CDuiObject* pParentObj = GetParent();
if(pParentObj == NULL)
{
return FALSE;
}
if(pParentObj->IsClass(_T("dlg")))
{
return ((CDlgBase*)pParentObj)->OnMessage(GetID(), uMsg, wParam, lParam);
}else
if(pParentObj->IsClass(_T("popup")))
{
return ((CDlgPopup*)pParentObj)->OnMessage(GetID(), uMsg, wParam, lParam);
}else
{
return ((CControlBase*)pParentObj)->OnMessage(GetID(), uMsg, wParam, lParam);
}
return FALSE;
}
示例10: while
// 从XML设置位置信息属性
HRESULT CControlBase::OnAttributePosChange(const CStringA& strValue, BOOL bLoading)
{
if (strValue.IsEmpty()) return E_FAIL;
m_strPos = strValue;
DUIDLG_POSITION dlgpos;
dlgpos.nCount=0;
LPCSTR pszValue=strValue;
while(dlgpos.nCount<4 && pszValue)
{
pszValue=ParsePosition(pszValue,dlgpos.Item[dlgpos.nCount++]);
}
if (2 == dlgpos.nCount || 4 == dlgpos.nCount)
{
if(4 == dlgpos.nCount)
{
CRect rectParent = CRect(0,0,0,0);
CDuiObject* pParent = GetParent();
if(pParent)
{
rectParent = pParent->GetRect();
}
CRect rect;
rect.left = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
rect.top = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
rect.right = PositionItem2Value(dlgpos.Right, rectParent.left, rectParent.right);
rect.bottom = PositionItem2Value(dlgpos.Bottom, rectParent.top, rectParent.bottom);
SetRect(rect);
}
else if(2 == dlgpos.nCount)
{
//m_uPositionType = (m_uPositionType & ~SizeX_Mask) | SizeX_FitContent;
//m_uPositionType = (m_uPositionType & ~SizeY_Mask) | SizeY_FitContent;
CRect rectParent = CRect(0,0,0,0);
CDuiObject* pParent = GetParent();
if(pParent)
{
rectParent = pParent->GetRect();
}
CRect rect;
rect.left = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
rect.top = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
if(m_nWidth != 0)
{
rect.right = rect.left + m_nWidth;
}else
{
rect.right = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
}
if(m_nHeight != 0)
{
rect.bottom = rect.top + m_nHeight;
}else
{
rect.bottom = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
}
SetRect(rect);
}
}
else
dlgpos.nCount = 0;
return bLoading?S_FALSE:S_OK;
}