本文整理汇总了C++中CDockBar类的典型用法代码示例。如果您正苦于以下问题:C++ CDockBar类的具体用法?C++ CDockBar怎么用?C++ CDockBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDockBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
DWORD CFrameWnd::CanDock( CRect rect, DWORD dwDockStyle, CDockBar **ppDockBar )
/*****************************************************************************/
{
POSITION position = m_listControlBars.GetHeadPosition();
while( position != NULL ) {
CControlBar *pControlBar = (CControlBar *)m_listControlBars.GetNext( position );
ASSERT( pControlBar != NULL );
if( pControlBar->IsDockBar() && (pControlBar->GetBarStyle() & dwDockStyle) ) {
CDockBar *pDockBar = (CDockBar *)pControlBar;
ASSERT( pDockBar->IsKindOf( RUNTIME_CLASS( CDockBar ) ) );
if( !pDockBar->m_bFloating ||
(pDockBar->GetBarStyle() & CBRS_FLOAT_MULTI) ) {
CRect rectBar;
pDockBar->GetWindowRect( &rectBar );
RECT rectJunk;
if( rectBar.left == rectBar.right ) {
rectBar.right++;
}
if( rectBar.top == rectBar.bottom ) {
rectBar.bottom++;
}
if( ::IntersectRect( &rectJunk, &rect, &rectBar ) ) {
if( ppDockBar != NULL ) {
*ppDockBar = pDockBar;
}
return( pDockBar->GetBarStyle() & dwDockStyle );
}
}
}
}
return( 0L );
}
示例2: ASSERT
void CDockContext::ToggleDocking()
{
if (m_pBar->IsFloating())
{
// Dock it only if is allowed to be docked
if (m_pBar->m_dwDockStyle & CBRS_ALIGN_ANY)
{
ASSERT((m_uMRUDockID >= AFX_IDW_DOCKBAR_TOP &&
m_uMRUDockID <= AFX_IDW_DOCKBAR_BOTTOM) ||
m_uMRUDockID == 0);
CRect rect = m_rectMRUDockPos;
CDockBar* pDockBar = NULL;
if (m_uMRUDockID != 0)
{
pDockBar = (CDockBar*)m_pDockSite->GetControlBar(m_uMRUDockID);
pDockBar->ClientToScreen(&rect);
}
// dock it at the specified position, RecalcLayout will snap
m_pDockSite->ReDockControlBar(m_pBar, pDockBar, &rect);
m_pDockSite->RecalcLayout();
}
}
else
{
CPoint ptFloat = m_ptMRUFloatPos;
if (ptFloat.x < 0 || ptFloat.y < 0)
{
ptFloat = m_rectMRUDockPos.TopLeft();
m_pBar->GetParent()->ClientToScreen(&ptFloat);
}
m_pDockSite->FloatControlBar(m_pBar, ptFloat, m_dwMRUFloatStyle);
}
}
示例3: UNUSED_ALWAYS
void CFrameWnd::ShowControlBar( CControlBar *pBar, BOOL bShow, BOOL bDelay )
/**************************************************************************/
{
UNUSED_ALWAYS( bDelay );
ASSERT( pBar != NULL );
if( bShow ) {
pBar->ShowWindow( SW_SHOW );
} else {
pBar->ShowWindow( SW_HIDE );
}
if( pBar->IsFloating() ) {
CDockBar *pDockBar = pBar->m_pDockBar;
ASSERT( pDockBar != NULL );
CFrameWnd *pFrame = pDockBar->GetParentFrame();
ASSERT( pFrame != NULL );
if( !bShow && pDockBar->GetDockedVisibleCount() == 0 ) {
pFrame->ShowWindow( SW_HIDE );
} else if( bShow && pDockBar->GetDockedVisibleCount() == 1 ) {
pFrame->ShowWindow( SW_SHOW );
pFrame->UpdateWindow();
}
}
RecalcLayout();
}
示例4: ASSERT
// dock bars will be created in the order specified by dwMRCDockBarMap
// this also controls which gets priority during layout
// this order can be changed by calling EnableDocking repetitively
// with the exact order of priority
//------------------------------------------------------------------------------
void CMRCFrameWndSizeDock::EnableDocking(DWORD dwDockStyle, CRuntimeClass *pFloatingClass)
// This is over-ridden primarily because we need to insert our own CDockBar class
// to handle the recalc layout, and this is the place they are created.
//------------------------------------------------------------------------------
{
// must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
m_pFloatingFrameClass = pFloatingClass; // protected member
for (int i = 0; i < 4; i++)
{
if (dwMRCDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) // protected
{
CDockBar* pDock = (CDockBar*)GetControlBar(dwMRCDockBarMap[i][0]);
if (pDock == NULL)
{
pDock = new CSizeDockBar;
if (!pDock->Create(this,
WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
dwMRCDockBarMap[i][1], dwMRCDockBarMap[i][0]))
{
AfxThrowResourceException();
}
}
}
}
}
示例5: ASSERT_VALID
void CGuiDocBarExten::BarsDocking(CFrameWnd * pFrame, DWORD dwDockStyle)
{
ASSERT_VALID(pFrame);
// must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
pFrame->EnableDocking(dwDockStyle);
for (int i = 0; i < 4; i++) {
if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) {
CDockBar* pDock = (CDockBar*)pFrame->GetControlBar(dwDockBarMap[i][0]);
if( pDock == 0 || ! pDock->IsKindOf(RUNTIME_CLASS(CGuiDocBarExten)) ) {
BOOL bNeedDelete = ! pDock->m_bAutoDelete;
pDock->m_pDockSite->RemoveControlBar(pDock);
pDock->m_pDockSite = 0;
pDock->DestroyWindow();
if( bNeedDelete )
delete pDock;
pDock = 0;
}
if( pDock == 0 ) {
pDock = new CGuiDocBarExten;
ASSERT_VALID(pDock);
if ((!pDock) || (!pDock->Create(pFrame,
WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE |
dwDockBarMap[i][1], dwDockBarMap[i][0]))) {
AfxThrowResourceException();
}
}
}
}
}
示例6: while
DWORD CFrameWnd::CanDock(CRect rect, DWORD dwDockStyle, CDockBar** ppDockBar)
{
// dwDockStyle -- allowable styles of bar
// don't allow to dock to floating unless multi is specified
dwDockStyle &= CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI;
if (ppDockBar != NULL)
*ppDockBar = NULL;
POSITION pos = m_listControlBars.GetHeadPosition();
while (pos != NULL)
{
CDockBar* pDockBar = (CDockBar*)m_listControlBars.GetNext(pos);
if (pDockBar->IsDockBar() && pDockBar->IsWindowVisible() &&
(pDockBar->m_dwStyle & dwDockStyle & CBRS_ALIGN_ANY) &&
(!pDockBar->m_bFloating ||
(dwDockStyle & pDockBar->m_dwStyle & CBRS_FLOAT_MULTI)))
{
CRect rectBar;
pDockBar->GetWindowRect(&rectBar);
if (rectBar.Width() == 0)
rectBar.right++;
if (rectBar.Height() == 0)
rectBar.bottom++;
if (rectBar.IntersectRect(rectBar, rect))
{
if (ppDockBar != NULL)
*ppDockBar = pDockBar;
return pDockBar->m_dwStyle & dwDockStyle;
}
}
}
return 0;
}
示例7: DrawFocusRect
void CDockContext::EndDrag()
/**************************/
{
DrawFocusRect( TRUE );
if( m_dwOverDockStyle != 0L && !m_bForceFrame ) {
CDockBar *pDockBar = GetDockBar( m_dwOverDockStyle );
ASSERT( pDockBar != NULL );
if( ((m_dwOverDockStyle & CBRS_ORIENT_HORZ) && !m_bFlip) ||
((m_dwOverDockStyle & CBRS_ORIENT_VERT) && m_bFlip) ) {
pDockBar->DockControlBar( m_pBar, &m_rectDragHorz );
} else {
pDockBar->DockControlBar( m_pBar, &m_rectDragVert );
}
m_dwOverDockStyle = 0L;
m_uMRUDockID = pDockBar->GetDlgCtrlID();
m_pBar->GetWindowRect( &m_rectMRUDockPos );
} else {
ASSERT( m_pDockSite != NULL );
if( ((m_dwStyle & CBRS_ORIENT_HORZ) && !m_bFlip) ||
((m_dwStyle & CBRS_ORIENT_VERT) && m_bFlip) ) {
m_pDockSite->FloatControlBar( m_pBar, m_rectFrameDragHorz.TopLeft(),
CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI) );
m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft();
} else {
m_pDockSite->FloatControlBar( m_pBar, m_rectFrameDragVert.TopLeft(),
CBRS_ALIGN_LEFT | (m_dwDockStyle & CBRS_FLOAT_MULTI) );
m_ptMRUFloatPos = m_rectFrameDragVert.TopLeft();
}
}
delete m_pDC;
m_pDC = NULL;
m_bDragging = FALSE;
}
示例8: GetParentDockBar
void CLogo::SetPosition()
{
if(!::IsWindow(m_hWnd))
return;
CDockBar* pTopDockBar = GetParentDockBar();
if(!pTopDockBar)
return;
CRect TopDockBarRect;
pTopDockBar->GetClientRect(TopDockBarRect);
CRect LogoRect;
GetWindowRect(LogoRect);
pTopDockBar->ScreenToClient(LogoRect);
int nLeft = TopDockBarRect.right-LogoRect.Width()-::GetSystemMetrics(SM_CXEDGE);
int nTop = TopDockBarRect.top;
if(nLeft != LogoRect.left ||
nTop != LogoRect.top)
SetWindowPos(NULL,
nLeft,
nTop,
0,
0,
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE);
CRect UnionToolbarRect;
for(int nI=0;nI<pTopDockBar->m_arrBars.GetSize();nI++)
{
CWnd* pWnd = static_cast<CWnd*>(pTopDockBar->m_arrBars[nI]);
if(!pWnd ||
!AfxIsValidAddress(pWnd,sizeof(CWnd)) ||
!::IsWindow(*pWnd))
continue;
CRect ToolBarRect;
pWnd->GetWindowRect(&ToolBarRect);
UnionToolbarRect.UnionRect(UnionToolbarRect,ToolBarRect);
}
GetWindowRect(LogoRect);
UnionToolbarRect.IntersectRect(UnionToolbarRect,LogoRect);
if(UnionToolbarRect.IsRectEmpty())
{
if(!IsWindowVisible())
ShowWindow(SW_SHOW);
}
else
{
if(IsWindowVisible())
ShowWindow(SW_HIDE);
}
}
示例9: ForceLayoutAdjust
void ForceLayoutAdjust(CControlBar * pBar)
// if control bar supplied, then set just resize it
{
CDockBar * pDockBar;
ASSERT(pBar != NULL);
pDockBar = pBar->m_pDockBar;
if (pDockBar!= NULL && pDockBar->IsKindOf(RUNTIME_CLASS(CSizeDockBar)))
((CSizeDockBar *)pDockBar)->m_CountBars = 0;
}
示例10: ASSERT
void CFrameWnd::ReDockControlBar(CControlBar* pBar, CDockBar* pDockBar, LPCRECT lpRect)
{
ASSERT(pBar != NULL);
// make sure CControlBar::EnableDocking has been called
ASSERT(pBar->m_pDockContext != NULL);
if (pDockBar == NULL)
{
// Search for the place holder.
// In case we don't find a place holder, find a bar with the correct alignment
// and keep it in pPossibleBar.
CDockBar* pPossibleBar = NULL;
for (int i = 0; i < 4; i++)
{
CDockBar* pTempBar = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
if (pTempBar != NULL)
{
// Is this the same bar we docked with before?
if (pTempBar->FindBar((CControlBar*)_AfxGetDlgCtrlID(pBar->m_hWnd)) > 0)
{
pDockBar = pTempBar;
break;
}
}
if ((dwDockBarMap[i][1] & CBRS_ALIGN_ANY) ==
(pBar->m_dwStyle & CBRS_ALIGN_ANY))
{
pPossibleBar = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
ASSERT(pPossibleBar != NULL);
// assert fails when initial CBRS_ of bar does not
// match available docking sites, as set by EnableDocking()
}
}
// Did we find the place holder?
if (pDockBar == NULL)
pDockBar = pPossibleBar;
}
ASSERT(pDockBar != NULL);
ASSERT(m_listControlBars.Find(pBar) != NULL);
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
// i.e. this control bar should have been created with a different parent initially
pDockBar->ReDockControlBar(pBar, lpRect);
}
示例11: EnableDocking
void CFrameWnd::EnableDocking( DWORD dwDockStyle )
/************************************************/
{
for( int i = 0; i < NUM_DOCKBARS; i++ ) {
DWORD dwBarDockStyle = _DockBarInfo[i][1];
if( dwDockStyle & dwBarDockStyle ) {
CDockBar *pDockBar = (CDockBar *)GetControlBar( _DockBarInfo[i][1] );
if( pDockBar == NULL ) {
pDockBar = new CDockBar;
pDockBar->Create( this, WS_CHILD | WS_VISIBLE | _DockBarInfo[i][1],
_DockBarInfo[i][0] );
}
}
}
}
示例12: ASSERT
void CFrameWnd::DockControlBar( CControlBar *pBar, UINT nDockBarID, LPCRECT lpRect )
/**********************************************************************************/
{
CDockBar *pDockBar = NULL;
if( nDockBarID != 0 ) {
pDockBar = (CDockBar *)GetControlBar( nDockBarID );
if( pDockBar == NULL ) {
// We're trying to dock to a dock bar that doesn't exist, so just don't do
// anything.
return;
}
if( !(pBar->m_dwDockStyle & (pDockBar->m_dwStyle & CBRS_ALIGN_ANY)) ) {
// We don't support docking to a bar of this style, so just don't do
// anything.
return;
}
ASSERT( pDockBar->IsKindOf( RUNTIME_CLASS( CDockBar ) ) );
if( lpRect != NULL ) {
RECT rectJunk;
CRect rectBar;
pDockBar->GetWindowRect( &rectBar );
if( rectBar.left == rectBar.right ) {
rectBar.left--;
rectBar.right++;
}
if( rectBar.top == rectBar.bottom ) {
rectBar.top--;
rectBar.bottom++;
}
if( !::IntersectRect( &rectJunk, &rectBar, lpRect ) ) {
// The rectangle and the dock bar identifier don't coincide, so just
// don't do anything.
return;
}
}
} else if( lpRect != NULL ){
CanDock( *lpRect, pBar->m_dwDockStyle, &pDockBar );
} else {
CanDock( CRect( 0, 0, 32767, 32767 ), pBar->m_dwDockStyle, &pDockBar );
}
if( pDockBar != NULL ) {
ASSERT( pDockBar->IsKindOf( RUNTIME_CLASS( CDockBar ) ) );
pDockBar->DockControlBar( pBar, lpRect );
}
}
示例13: CancelLoop
void CGuiDockContext::EndDrag()
{
CancelLoop();
if (m_dwOverDockStyle != 0)
{
CDockBar* pDockBar = GetDockBar(m_dwOverDockStyle);
ASSERT(pDockBar != NULL);
CRect rect = (m_dwOverDockStyle & CBRS_ORIENT_VERT) ?
m_rectDragVert : m_rectDragHorz;
UINT uID = _AfxGetDlgCtrlID(pDockBar->m_hWnd);
if (uID >= AFX_IDW_DOCKBAR_TOP &&
uID <= AFX_IDW_DOCKBAR_BOTTOM)
{
m_uMRUDockID = uID;
m_rectMRUDockPos = rect;
pDockBar->ScreenToClient(&m_rectMRUDockPos);
}
// dock it at the specified position, RecalcLayout will snap
m_pDockSite->DockControlBar(m_pBar, pDockBar, &rect);
m_pDockSite->RecalcLayout();
}
else if ((m_dwStyle & CBRS_SIZE_DYNAMIC) || (HORZF(m_dwStyle) && !m_bFlip) ||
(VERTF(m_dwStyle) && m_bFlip))
{
m_dwMRUFloatStyle = CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI);
m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft();
m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
}
else // vertical float
{
m_dwMRUFloatStyle = CBRS_ALIGN_LEFT | (m_dwDockStyle & CBRS_FLOAT_MULTI);
m_ptMRUFloatPos = m_rectFrameDragVert.TopLeft();
m_pDockSite->FloatControlBar(m_pBar, m_ptMRUFloatPos, m_dwMRUFloatStyle);
}
}
示例14: while
void CGuiControlBar::OnActiveWindow()
{
POSITION pos = m_pDockSite->m_listControlBars.GetHeadPosition();
while (pos != NULL)
{
CDockBar* pDockBar = (CDockBar*)m_pDockSite->m_listControlBars.GetNext(pos);
if (pDockBar->IsDockBar() && pDockBar->IsWindowVisible() &&
(!pDockBar->m_bFloating ))
{
int nNumBars=(int)pDockBar->m_arrBars.GetSize();
for(int i=0; i< nNumBars;i++)
{
CGuiControlBar* pBar = (CGuiControlBar*) pDockBar->m_arrBars[i];
if (HIWORD(pBar) == NULL) continue;
if (!pBar->IsVisible()) continue;
if (!pBar->IsKindOf(RUNTIME_CLASS(CGuiControlBar))) continue;
if (pBar != this)
{
pBar->m_bOldActive=FALSE;
pBar->m_bActive=FALSE;
pBar->m_bForcepaint=TRUE;
pBar->SendMessage(WM_NCPAINT);
pBar->m_bForcepaint=FALSE;
}
else
{
m_bOldActive=m_bActive;
m_bActive=TRUE;
m_bForcepaint=TRUE;
SendMessage(WM_NCPAINT);
m_bForcepaint=FALSE;
}
}
}
}
}
示例15: CancelDrag
void COXDragDockContext::EndDrag()
{
CancelDrag();
if (m_ptStart == m_ptLast)
return;
m_dwOverDockStyle = m_bForceFrame ? 0 : CanDock();
if (m_dwOverDockStyle != 0)
{
// dockbar we're going to dock at.
CDockBar* pDockBar = GetDockBar();
ASSERT(pDockBar != NULL);
// check the original dockbar - if a valid CSizeDockBar...
// work out the row number.
CDockBar* pOrigDockBar = m_pBar->m_pDockBar;
int nOrigCheckSum = -1;
if (pOrigDockBar != NULL &&
pOrigDockBar->IsKindOf(RUNTIME_CLASS(COXSizeDockBar)))
nOrigCheckSum = ((COXSizeDockBar*)pOrigDockBar)->CheckSumBars();
// Now we're going to actually dock the window.
// Update the appropriate size in the control bar.
if (HORZF(m_dwOverDockStyle))
{
((COXSizeControlBar*)m_pBar)->m_HorzDockSize = m_rectDragDock.Size();
}
else
{
((COXSizeControlBar*)m_pBar)->m_VertDockSize = m_rectDragDock.Size();
}
m_pDockSite->DockControlBar(m_pBar, pDockBar, m_rectDragDock);
// if into a sizeable dockbar (always we be !), then adjust other bars in the same row
// to attempt to maintain size
if (pDockBar->IsKindOf(RUNTIME_CLASS(COXSizeDockBar)))
{
if (pOrigDockBar != pDockBar ||
((COXSizeDockBar*)pDockBar)->CheckSumBars() != nOrigCheckSum)
{
((COXSizeDockBar*)pDockBar)->AdjustForNewBar(m_pBar);
}
// force RecalcLayout below to adjust sizes always for the bar into
// which we have docked - this is needed as if the bar doesn't
// actually changed position in the array, but has changed size
// (because the docking algorithm above guess the size wrong, then
// we need to set it back again.
((COXSizeDockBar*)pDockBar)->m_CountBars = 0;
}
// This RecalcLayout is what will adjust the size.
m_pDockSite->RecalcLayout();
}
else
{
m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft();
m_pDockSite->FloatControlBar(m_pBar, m_rectFrameDragHorz.TopLeft(),
CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI));
m_pBar->SendMessage(WM_OX_APP_AFTERFLOAT_MSG);
// set flag to indicate user has moved the bar - done as a style flag on the window.
CWnd* pFrameWnd = m_pBar->GetParentFrame();
ASSERT(pFrameWnd->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)));
pFrameWnd->ModifyStyle(0, CBRS_MOVED_BY_USER);
}
}