本文整理汇总了C++中CDlgBase类的典型用法代码示例。如果您正苦于以下问题:C++ CDlgBase类的具体用法?C++ CDlgBase怎么用?C++ CDlgBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDlgBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParentDialog
// 设置Tooltip
void CControlBase::SetTooltip(CControlBase* pControl, CString strTooltip, CRect rect, BOOL bControlWidth, int nTipWidth)
{
// 如果找到了父对话框,则调用对话框的设置Tooltip函数
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->SetTooltip(pControl, strTooltip, rect, bControlWidth, nTipWidth);
return;
}
// 如果找到父Popup窗口,则调用Popup窗口的设置Tooltip函数
// 如果找到插件HostWnd,则调用插件HostWnd接口的设置Tooltip函数
IDuiHostWnd* pIDuiHostWnd = GetParentIDuiHostWnd();
if(pIDuiHostWnd)
{
int _nTipWidth = nTipWidth;
if(bControlWidth)
{
_nTipWidth = pControl->GetRect().Width();
}
pIDuiHostWnd->SetTooltip(pControl->GetID(), strTooltip, rect, _nTipWidth);
return;
}
}
示例2: GetParentDialog
// 从XML设置plugin属性,加载界面插件文件动态库
HRESULT CDuiPanel::OnAttributePlugin(const CString& strValue, BOOL bLoading)
{
if (strValue.IsEmpty()) return E_FAIL;
HINSTANCE hPluginHandle = NULL;
LPVOID pPluginObj = NULL;
//if(DuiSystem::Instance()->LoadPluginFile(strValue, CEncodingUtil::AnsiToUnicode(IID_IDuiPluginPanel), hPluginHandle, pPluginObj))
if(DuiSystem::Instance()->LoadPluginFile(strValue, IID_IDuiPluginPanel, hPluginHandle, pPluginObj))
{
m_strPluginFile = strValue;
m_hPluginHandle = hPluginHandle;
m_pDuiPluginObject = (IDuiPluginPanel*)pPluginObj;
// 初始化界面插件
UINT nIDTemplate = 0;
HWND hWnd = NULL;
CDlgBase* pParentDlg = GetParentDialog();
if(pParentDlg != NULL)
{
nIDTemplate = pParentDlg->GetIDTemplate();
hWnd = pParentDlg->GetSafeHwnd();
}
//m_pDuiPluginObject->OnInit(nIDTemplate, hWnd, CEncodingUtil::UnicodeToAnsi(GetName()), m_rc);
m_pDuiPluginObject->OnInit(nIDTemplate, hWnd, GetName(), m_rc, &m_xDuiPanel);
}
return bLoading?S_FALSE:S_OK;
}
示例3: GetParentDialog
// 清除指定的子控件
BOOL CControlBase::RemoveControl(CControlBase* pControl)
{
vector<CControlBase*>::iterator it;
for(it=m_vecControl.begin();it!=m_vecControl.end();++it)
{
CControlBase* pControlBase = *it;
if (pControlBase == pControl)
{
// 如果是焦点控件,则需要先将焦点设置为空
if(IsFocusControl())
{
CDlgBase* pDlg = GetParentDialog(FALSE);
if(pDlg)
{
pDlg->SetFocusControlPtr(NULL);
}
}
m_vecControl.erase(it);
delete pControlBase;
return TRUE;
}
}
return FALSE;
}
示例4: GetParentDialog
// 设置当前焦点控件
void CDuiWkeView::SetCurrentFocusControl(BOOL bFocus)
{
CDlgBase* pDlg = GetParentDialog(FALSE);
if(pDlg)
{
pDlg->SetFocusControl(bFocus ? this : NULL);
}
}
示例5: OnMousePointChange
// 鼠标左键按下事件处理
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: GetParentDialog
// 清除Tooltip
void CDuiTabCtrl::ClearTabTooltip()
{
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->ClearTooltip();
m_nTipItem = -1;
}
}
示例7: GetParentDialog
// 判断当前是否在主线程
void CControlBase::TestMainThread()
{
// 调用所在对话框的测试函数
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->TestMainThread();
}
}
示例8: GetParentDialog
// 清除Tooltip
void CDuiListCtrl::ClearRowTooltip()
{
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->ClearTooltip();
m_nTipRow = -1;
m_nTipVirtualTop = 0;
}
}
示例9: GetParentDialog
// 清除Tooltip
void CDuiGridCtrl::ClearGridTooltip()
{
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->ClearTooltip();
m_nTipRow = -1;
m_nTipItem = -1;
m_nTipVirtualTop = 0;
}
}
示例10: GetParentDialog
// 清空Combo下拉项
void CDuiComboBox::ClearItems()
{
m_vecItem.clear();
// 关闭popuplist窗口
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
m_buttonState = enBSNormal;
m_EditState = enBSNormal;
InvalidateRect(GetRect());
pDlg->CloseDlgPopup();
m_pPopupList = NULL;
}
}
示例11: 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;
}
示例12: OnMousePointChange
// 鼠标左键事件处理
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;
}
示例13: GetParentDialog
// 清除Tooltip
void CDuiGridCtrl::ClearGridTooltip()
{
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->ClearTooltip();
m_nTipRow = -1;
m_nTipItem = -1;
m_nTipVirtualTop = 0;
return;
}
IDuiHostWnd* pIDuiHostWnd = GetParentIDuiHostWnd();
if(pIDuiHostWnd)
{
pIDuiHostWnd->ClearTooltip();
m_nTipRow = -1;
m_nTipItem = -1;
m_nTipVirtualTop = 0;
return;
}
}
示例14: GetRect
// 消息处理
LRESULT CDuiComboBox::OnMessage(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if((BUTTOM == wParam) && (BUTTOM_DOWN == lParam) && (m_pPopupList == NULL)) // 鼠标点击了编辑框的下拉按钮
{
CPopupList *pPopupList = new CPopupList;
m_pPopupList = pPopupList;
pPopupList->SetParent(this); // 将PopupList的父控件指向combobox
pPopupList->SetWidth(m_nWidth);
if(m_nResourceIDHeadBitmap != 0)
{
pPopupList->SetHeadBitmap(m_nResourceIDHeadBitmap);
}else
if(!m_strImageHeadBitmap.IsEmpty())
{
pPopupList->SetHeadBitmap(m_strImageHeadBitmap);
}
if(m_nResourceIDDeleteBitmap != 0)
{
pPopupList->SetCloseBitmap(m_nResourceIDDeleteBitmap);
}else
if(!m_strImageDeleteBitmap.IsEmpty())
{
pPopupList->SetCloseBitmap(m_strImageDeleteBitmap);
}
CRect rcClient = GetRect();
rcClient.top = rcClient.bottom;
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->OpenDlgPopup(pPopupList, rcClient, GetID());
}
// 必须窗口创建之后才能加载内容
for (size_t i = 0; i < m_vecItem.size(); i++)
{
ComboListItem* pItem = &(m_vecItem.at(i));
pPopupList->AddItem(pItem->strName, pItem->strDesc, pItem->strValue,
pItem->nResourceID, pItem->strImageFile);
}
if(!m_strXmlFile.IsEmpty())
{
pPopupList->LoadXmlFile(m_strXmlFile);
}
// 设置选择的项
SetComboValue(m_strComboValue);
}else
if((SELECT_ITEM == wParam) && m_pPopupList) // 下拉框选择
{
CString strName;
m_pPopupList->GetItemName(lParam, strName);
m_pPopupList->GetItemValue(lParam, m_strComboValue);
SetTitle(strName);
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
m_buttonState = enBSNormal;
m_EditState = enBSNormal;
InvalidateRect(GetRect());
pDlg->CloseDlgPopup();
m_pPopupList = NULL;
}
}else
if((DELETE_ITEM == wParam) && m_pPopupList) // 删除下拉框列表项
{
// 如果设置了删除按钮图片,才可以进行删除
if(!m_strImageDeleteBitmap.IsEmpty() || (m_nResourceIDDeleteBitmap != 0))
{
m_pPopupList->DeleteItem(lParam);
}
}
return __super::OnMessage(uID, uMsg, wParam, lParam);
}
示例15: GetName
// 消息处理
LRESULT CControlBase::OnMessage(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if(m_bTaskMsg)
{
// 如果设置了任务方式发消息的属性,则添加一个任务消息
CString strControlName = GetName();
CString strAction = GetAction();
CDlgBase* pParentDlg = GetParentDialog();
DuiSystem::Instance()->AddDuiActionTask(uID, uMsg, wParam, lParam, strControlName, strAction, pParentDlg);
return 0;
}
if(m_strAction.Find(_T("dlg:")) == 0) // 动作:打开一个对话框,有内存泄漏,改为通过DuiSystem创建和管理
{
if(uMsg == BUTTOM_UP) // 鼠标放开事件才处理
{
CString strXmlFile = m_strAction;
strXmlFile.Delete(0, 4);
DuiSystem::ShowDuiDialog(strXmlFile, GetParentDialog());
}
}else
if(m_strAction.Find(_T("popup:")) == 0) // 动作:打开一个Popup对话框
{
if(uMsg == BUTTOM_UP) // 鼠标放开事件才处理
{
/*UINT nIDTemplate = 0;
CDlgBase* pParentDlg = GetParentDialog();
if(pParentDlg != NULL)
{
nIDTemplate = pParentDlg->GetIDTemplate();
}
CDlgPopup* pPopup = new CDlgPopup;
pPopup->SetParent(this);
CString strXmlFile = m_strAction;
strXmlFile.Delete(0, 6);
pPopup->SetXmlFile(_T("xml:") +strXmlFile );
CRect rc = pControlBase->GetRect();
rc.OffsetRect(-95, rc.Height());
ClientToScreen(&rc);
pPopup->Create(this, rc, WM_SKIN);
pPopup->ShowWindow(SW_SHOW);*/
}
}else
if(m_strAction.Find(_T("menu:")) == 0) // 动作:打开一个菜单
{
CDuiMenu *pDuiMenu = new CDuiMenu( DuiSystem::GetDefaultFont(), 12); // 可以考虑改为通过DuiSystem创建和管理
pDuiMenu->SetParent(this);
CPoint point;
CRect rc = GetRect();
point.SetPoint(rc.left + rc.Width() / 2, rc.bottom);
CDlgBase* pParentDlg = GetParentDialog();
if(pParentDlg != NULL)
{
pParentDlg->ClientToScreen(&point);
}
CString strXmlFile = m_strAction;
strXmlFile.Delete(0, 5);
pDuiMenu->LoadXmlFile(strXmlFile, pParentDlg, point, WM_DUI_MENU);
pDuiMenu->ShowWindow(SW_SHOW);
}else
if(m_strAction.Find(_T("link:")) == 0) // 动作:打开一个页面链接
{
if(uMsg == BUTTOM_UP) // 鼠标放开事件才处理
{
CString strLink = m_strAction;
strLink.Delete(0, 5);
if(!strLink.IsEmpty())
{
ShellExecute(NULL, TEXT("open"), strLink, NULL,NULL,SW_NORMAL);
}
}
}else
if(m_strAction.Find(_T("run:")) == 0) // 动作:执行一个进程
{
if(uMsg == BUTTOM_UP) // 鼠标放开事件才处理
{
CString strProcess = m_strAction;
strProcess.Delete(0, 4);
strProcess.MakeLower();
if(!strProcess.IsEmpty())
{
strProcess.MakeLower();
BOOL bForceAdmin = FALSE;
if(strProcess.Find(_T("[email protected]")) == 0)
{
bForceAdmin = TRUE;
strProcess.Delete(0, 6);
}
BOOL bWaitProcess = FALSE;
if(strProcess.Find(_T("&")) == (strProcess.GetLength()-1))
{
bWaitProcess = TRUE;
strProcess.Delete(strProcess.GetLength()-1, 1);
}
if(strProcess.Find(_T(".exe")) == -1)
{
strProcess = DuiSystem::Instance()->GetString(CEncodingUtil::UnicodeToAnsi(strProcess));
}
if(strProcess.Find(_T("{platpath}")) == 0)
//.........这里部分代码省略.........