本文整理汇总了C++中CDockBar::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CDockBar::GetParent方法的具体用法?C++ CDockBar::GetParent怎么用?C++ CDockBar::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDockBar
的用法示例。
在下文中一共展示了CDockBar::GetParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FloatControlBar
void CFrameWnd::FloatControlBar(CControlBar* pBar, CPoint point, DWORD dwStyle)
{
ASSERT(pBar != NULL);
// if the bar is already floating and the dock bar only contains this
// bar and same orientation then move the window rather than recreating
// the frame
if (pBar->m_pDockSite != NULL && pBar->m_pDockBar != NULL)
{
CDockBar* pDockBar = pBar->m_pDockBar;
ASSERT_KINDOF(CDockBar, pDockBar);
if (pDockBar->m_bFloating && pDockBar->GetDockedCount() == 1 &&
(dwStyle & pDockBar->m_dwStyle & CBRS_ALIGN_ANY) != 0)
{
CMiniDockFrameWnd* pDockFrame =
(CMiniDockFrameWnd*)pDockBar->GetParent();
ASSERT(pDockFrame != NULL);
ASSERT_KINDOF(CMiniDockFrameWnd, pDockFrame);
pDockFrame->SetWindowPos(NULL, point.x, point.y, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
pDockFrame->RecalcLayout(TRUE);
pDockFrame->UpdateWindow();
return;
}
}
if (pBar->m_dwStyle & CBRS_SIZE_DYNAMIC)
{
dwStyle |= CBRS_SIZE_DYNAMIC;
if (dwStyle & CBRS_ORIENT_VERT)
{
dwStyle &= ~CBRS_ALIGN_ANY;
dwStyle |= CBRS_ALIGN_TOP;
}
}
CMiniDockFrameWnd* pDockFrame = CreateFloatingFrame(dwStyle);
ASSERT(pDockFrame != NULL);
pDockFrame->SetWindowPos(NULL, point.x, point.y, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
if (pDockFrame->m_hWndOwner == NULL)
pDockFrame->m_hWndOwner = pBar->m_hWnd;
CDockBar* pDockBar = (CDockBar*)pDockFrame->GetDlgItem(AFX_IDW_DOCKBAR_FLOAT);
ASSERT(pDockBar != NULL);
ASSERT_KINDOF(CDockBar, pDockBar);
ASSERT(pBar->m_pDockSite == this);
// if this assertion occurred it is because the parent of pBar was not
// initially this CFrameWnd when pBar's OnCreate was called
// (this control bar should have been created with a different
// parent initially)
pDockBar->DockControlBar(pBar);
pDockFrame->RecalcLayout(TRUE);
if (GetWindowLong(pBar->m_hWnd, GWL_STYLE) & WS_VISIBLE)
{
pDockFrame->ShowWindow(SW_SHOWNA);
pDockFrame->UpdateWindow();
}
}
示例2: FloatControlBarInMDIChild
//-----------------------------------------------------------------------------------------------------
void CMRCMDIFrameWndSizeDock::FloatControlBarInMDIChild(CControlBar* pBar, CPoint point, DWORD dwStyle)
// float a control bar in an MDI Child window
// pBar = bar to float
// point = position in screen co-ordinates
//-----------------------------------------------------------------------------------------------------
{
ASSERT(pBar != NULL);
// point is in screen co-ords - map to client
::ScreenToClient(m_hWndMDIClient, &point);
// clip to client MDI client rectangle - ensures it's going to be visible
CRect rcMDIClient;
::GetClientRect(m_hWndMDIClient, &rcMDIClient);
point.x = min (point.x, rcMDIClient.right - 32);
point.x = max (point.x, rcMDIClient.left);
point.y = min (point.y, rcMDIClient.bottom - 20);
point.y = max (point.y, rcMDIClient.top);
// If the bar is already floating in an MDI child, then just move it
// MFC has a similar optimization for CMiniDockFrameWnd
if (pBar->m_pDockSite != NULL && pBar->m_pDockBar != NULL)
{
CDockBar* pDockBar = pBar->m_pDockBar;
ASSERT(pDockBar->IsKindOf(RUNTIME_CLASS(CDockBar)));
CFrameWnd* pDockFrame = (CFrameWnd*)pDockBar->GetParent();
ASSERT(pDockFrame != NULL);
ASSERT(pDockFrame->IsKindOf(RUNTIME_CLASS(CFrameWnd)));
if (pDockFrame->IsKindOf(RUNTIME_CLASS(CMRCMDIFloatWnd)))
{
// already a floating as an MDI child, so just move it.
if (pDockBar->m_bFloating && pDockBar->GetDockedCount() == 1 &&
(dwStyle & pDockBar->m_dwStyle & CBRS_ALIGN_ANY) != 0)
{
pDockFrame->SetWindowPos(NULL, point.x, point.y, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
return;
}
}
}
// Create a CMRCMDIFloatWnd, and dock the bar into it.
CMRCMDIFloatWnd * pDockFrame = (CMRCMDIFloatWnd *)(RUNTIME_CLASS(CMRCMDIFloatWnd))->CreateObject();
ASSERT(pDockFrame != NULL);
if (!pDockFrame->Create(this, dwStyle))
AfxThrowResourceException();
pDockFrame->SetWindowPos(NULL, point.x, point.y, 0, 0,
SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
if (pDockFrame->m_hWndOwner == NULL)
pDockFrame->m_hWndOwner = pBar->m_hWnd;
// Gets the dockbar created by the CMRCMDIFloatWnd
CDockBar* pDockBar = (CDockBar*)pDockFrame->GetDlgItem(AFX_IDW_DOCKBAR_FLOAT);
ASSERT(pDockBar != NULL);
ASSERT(pDockBar->IsKindOf(RUNTIME_CLASS(CDockBar)));
ASSERT(pBar->m_pDockSite == this);
// if this assertion occurred it is because the parent of pBar was not
// initially this CFrameWnd when pBar's OnCreate was called
// (this control bar should have been created with a different
// parent initially)
pDockBar->DockControlBar(pBar);
pDockFrame->RecalcLayout();
pDockFrame->ShowWindow(SW_SHOWNA);
pDockFrame->UpdateWindow();
}