ExtControlBar.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:775k
- {
- InternalDockStateBar * pState =
- m_arrBarStates[i];
- ASSERT_VALID( pState );
- pState->StateSet( m_pDockSite, NULL );
- } // for( i = 0; i < nCount; i++ )
- ((InternalFriendlyFrameWnd*)m_pDockSite)->m_bInRecalcLayout = FALSE;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- nCount = (INT)m_arrAutoHideOrder.GetSize();
- for( i = 0; i < nCount; i++ )
- {
- UINT nBarID = m_arrAutoHideOrder[ i ];
- CExtControlBar * pBar =
- DYNAMIC_DOWNCAST(
- CExtControlBar,
- m_pDockSite->GetControlBar( nBarID )
- );
- //KJ TELESTE:
- if( pBar == NULL )
- return;
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CExtControlBar, pBar );
- ASSERT( !pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) );
- ASSERT( !pBar->IsFixedMode() );
- ASSERT( !pBar->AutoHideModeGet() );
- ASSERT( !pBar->IsFloating() );
- ASSERT( !pBar->GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) );
- pBar->AutoHideModeSet( true, false, false, true );
- ASSERT_KINDOF( CExtDockBar, pBar->m_pDockBar );
- CWnd * pWndParent = pBar->m_pDockBar;
- for( ; true ; )
- {
- ASSERT_VALID( pWndParent );
- if( pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
- {
- if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- {
- ASSERT( pWndParent->GetParent() == m_pDockSite );
- break;
- } // if( ! pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockDynBar)) )
- } // if( pWndParent->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
- pWndParent = pWndParent->GetParent();
- } // for( ; true ; )
- ASSERT_KINDOF( CExtDockBar, pWndParent );
- ASSERT( ((CExtDockBar*)pWndParent)->_GetCircleNo() > 0 );
- UINT nTopDockBarID = pWndParent->GetDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nTopDockBarID );
- CExtDockBar * pOuterDocker =
- STATIC_DOWNCAST(
- CExtDockBar,
- m_pDockSite->GetControlBar( nTopDockBarID )
- );
- ASSERT_VALID( pOuterDocker );
- ASSERT( UINT(pOuterDocker->GetDlgCtrlID()) == nTopDockBarID );
-
- CExtDynAutoHideArea * pAutoHideArea =
- pOuterDocker->_GetAutoHideArea();
- ASSERT_VALID( pAutoHideArea );
- ASSERT( UINT(pAutoHideArea->GetDlgCtrlID()) == nTopDockBarID );
- LONG nPos = pAutoHideArea->FindControlBar( pBar );
- ASSERT( nPos >= 0 );
-
- CExtTabWnd::TAB_ITEM_INFO * pTII =
- pAutoHideArea->ItemGet( nPos );
- pTII->ModifyItemStyle( 0, __ETWI_IN_GROUP_ACTIVE );
- } // for( i = 0; i < nCount; i++ )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- } // if( m_bSerializeResizableBarsState )
- //if( m_bSerializeFixedBarsState )
- ((InternalFriendlyFrameWnd *)m_pDockSite)->SetOuterDockState(
- *m_pOuterState,
- m_arrOuterProps,
- m_bSerializeFixedBarsState,
- m_bSerializeResizableBarsState
- );
- if( m_bSerializeResizableBarsState )
- {
- nCount = (INT)m_arrBarStates.GetSize();
- for( i = 0; i< nCount; i++ )
- {
- InternalDockStateBar * pState =
- m_arrBarStates[i];
- ASSERT_VALID( pState );
- pState->PreSyncAttributes( m_pDockSite, NULL );
- }
- #ifdef _DEBUG
- for( pos =
- m_pDockSite->m_listControlBars.GetHeadPosition();
- pos != NULL;
- )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockSite->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pBar );
- CExtDockBar * pExtDocker =
- DYNAMIC_DOWNCAST( CExtDockBar, pBar );
- if( pExtDocker != NULL )
- {
- ASSERT( !pExtDocker->m_bLockedOptimize );
- }
- }
- #endif // _DEBUG
- } // if( m_bSerializeResizableBarsState )
- m_pDockSite->RecalcLayout();
- if( m_bSerializeResizableBarsState )
- {
- nCount = (INT)m_arrBarStates.GetSize();
- for( i = 0; i < nCount; i++ )
- {
- InternalDockStateBar * pState =
- m_arrBarStates[i];
- ASSERT_VALID( pState );
- pState->PostSyncAttributes( m_pDockSite, NULL );
- if( pState->m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING )
- {
- ASSERT_VALID( pState->m_pHelperBar );
- CExtMiniDockFrameWnd * pMiniFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pState->m_pHelperBar->GetParentFrame()
- );
- pState->m_pHelperBar->_RecalcNcArea();
- pState->m_pHelperBar->OnRepositionSingleChild();
- pMiniFrame->RecalcLayout();
- }
- }
- } // if( m_bSerializeResizableBarsState )
- for( pos =
- m_pDockSite->m_listControlBars.GetHeadPosition();
- pos != NULL;
- )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockSite->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pBar );
- if( pBar->IsDockBar() )
- continue;
- if( (!pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)))
- || pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
- )
- continue;
- if( !((CExtControlBar *)pBar)->IsFixedMode() )
- continue;
- ((CExtControlBar *)pBar)->_RecalcNcArea();
- if( !pBar->IsFloating() )
- continue;
- ASSERT_KINDOF(
- CMiniDockFrameWnd,
- pBar->GetParentFrame()
- );
- ((CExtControlBar *)pBar)->_RecalcLayoutImpl();
- }
- // m_pDockSite->SendMessageToDescendants(
- // WM_IDLEUPDATECMDUI,
- // (WPARAM)TRUE,
- // 0
- // );
- // m_pDockSite->SendMessageToDescendants(
- // WM_IDLEUPDATECMDUI,
- // (WPARAM)TRUE,
- // 0,
- // TRUE,
- // TRUE
- // );
- m_pDockSite->SendMessage(
- WM_SETMESSAGESTRING,
- AFX_IDS_IDLEMESSAGE
- );
- }
- CExtControlBar::InternalDockStateBar::InternalDockStateBar()
- {
- InitMembers();
- }
- CExtControlBar::InternalDockStateBar::~InternalDockStateBar()
- {
- Clear();
- }
- void CExtControlBar::InternalDockStateBar::Serialize( CArchive & ar )
- {
- ASSERT_VALID( this );
- INT i, nCount;
- if( ar.IsStoring() )
- {
- ar << DWORD(m_nBarID);
- ar << DWORD(m_nDockBarID);
- ar << DWORD(m_nCircleNo);
- ar << DWORD(m_nMRUWidth);
- ar << m_dwBarFlags;
- ar << m_dwDockStateFlags;
- ar << m_dwMRUFloatStyle;
- ar << m_ptFloatPos;
- ar << m_ptMRUFloatPos;
- ar << m_rcMRUDockPos;
- ar << m_rcFloatingFrame;
- ar << m_dwFloatingFrameCreateStyle;
- ar << DWORD(m_nDelayedRowUpdateMetric);
- ar << m_rcBar;
- ar << m_sizeDockedH;
- ar << m_sizeDockedV;
- ar << m_sizeFloated;
- nCount = (INT)m_arrChildStates.GetSize();
- ar << DWORD(nCount);
- for( i = 0; i < nCount; i++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[i];
- ASSERT_VALID( pState );
- pState->Serialize( ar );
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ar << DWORD(m_nAutoHideWidth);
- ar << DWORD(m_nAutoHideHeight);
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- } // if( ar.IsStoring() )
- else
- {
- Clear();
-
- DWORD dwTmp;
- ar >> dwTmp;
- m_nBarID = UINT(dwTmp);
- ar >> dwTmp;
- m_nDockBarID = UINT(dwTmp);
- ar >> dwTmp;
- m_nCircleNo = INT(dwTmp);
- ar >> dwTmp;
- m_nMRUWidth = INT(dwTmp);
- ar >> m_dwBarFlags;
- ar >> m_dwDockStateFlags;
- ar >> m_dwMRUFloatStyle;
- ar >> m_ptFloatPos;
- ar >> m_ptMRUFloatPos;
- ar >> m_rcMRUDockPos;
- ar >> m_rcFloatingFrame;
- ar >> m_dwFloatingFrameCreateStyle;
- ar >> dwTmp;
- m_nDelayedRowUpdateMetric = INT(dwTmp);
- ar >> m_rcBar;
- ar >> m_sizeDockedH;
- ar >> m_sizeDockedV;
- ar >> m_sizeFloated;
- ar >> dwTmp;
- nCount = INT(dwTmp);
- for( i = 0; i < nCount; i++ )
- {
- InternalDockStateBar * pState = new InternalDockStateBar;
- pState->Serialize( ar );
- ASSERT_VALID( pState );
- m_arrChildStates.Add( pState );
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ar >> dwTmp;
- m_nAutoHideWidth = INT(dwTmp);
- ar >> dwTmp;
- m_nAutoHideHeight = INT(dwTmp);
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- } // else from if( ar.IsStoring() )
- }
- void CExtControlBar::InternalDockStateBar::Clear()
- {
- ASSERT_VALID( this );
- InitMembers();
- INT i, nCount;
- nCount = (INT)m_arrChildStates.GetSize();
- for( i = 0; i < nCount; i++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[i];
- ASSERT_VALID( pState );
- pState->Clear();
- delete pState;
- }
- m_arrChildStates.RemoveAll();
- }
- void CExtControlBar::InternalDockStateBar::InitMembers()
- {
- ASSERT( this != NULL );
- m_nBarID = m_nDockBarID = AFX_IDW_DOCKBAR_FLOAT;
- m_nCircleNo = 0;
- m_nMRUWidth = 50;
- m_ptFloatPos.x = m_ptFloatPos.y = 0;
- m_rcMRUDockPos.SetRectEmpty();
- m_rcFloatingFrame.SetRect( 0, 0, 200, 200 );
- m_dwFloatingFrameCreateStyle = WS_CHILD;
- m_nDelayedRowUpdateMetric = 0;
- m_rcBar.SetRect( 0, 0, 200, 200 );
- m_dwMRUFloatStyle = 0;
- m_ptMRUFloatPos.x = m_ptMRUFloatPos.y;
- m_sizeDockedH.cx = m_sizeDockedH.cy = 200;
- m_sizeDockedV.cx = m_sizeDockedV.cy = 200;
- m_sizeFloated.cx = m_sizeFloated.cy = 200;
- m_dwDockStateFlags = 0;
- m_nHelperAciveTabChildIndex = -1;
- m_pHelperBar = NULL;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_nAutoHideWidth = -1;
- m_nAutoHideHeight = -1;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- void CExtControlBar::InternalDockStateBar::StateGet(
- CExtControlBar * pBar,
- CExtControlBar::InternalDockStateBar * pParentState
- )
- {
- pParentState;
- ASSERT_VALID( this );
- ASSERT_VALID( pBar );
- ASSERT( !pBar->IsFixedMode() );
- ASSERT_VALID( pBar->m_pDockBar );
- ASSERT( pBar->m_pDockContext != NULL );
- #ifdef _DEBUG
- if( pBar->IsFloating() )
- {
- ASSERT_KINDOF( CDockBar, pBar->m_pDockBar );
- ASSERT( !pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar)) );
- }
- else
- {
- ASSERT_KINDOF( CExtDockBar, pBar->m_pDockBar );
- }
- #endif // _DEBUG
- Clear();
- m_nBarID = pBar->GetDlgCtrlID();
- m_nDockBarID = pBar->m_pDockBar->GetDlgCtrlID();
- m_nCircleNo = 0;
- if( ! pBar->IsFloating() )
- {
- ASSERT_KINDOF( CExtDockBar, pBar->m_pDockBar );
- m_nCircleNo = ((CExtDockBar *)pBar->m_pDockBar)->_GetCircleNo();
- #ifdef _DEBUG
- CFrameWnd * pParentFrame = pBar->GetParentFrame();
- if( pParentFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- {
- ASSERT_KINDOF( CExtMiniDockFrameWnd, pParentFrame );
- ASSERT( m_nCircleNo == 0 );
- }
- else
- {
- //ASSERT( m_nCircleNo > 0 );
- ASSERT( pParentFrame == pBar->m_pDockSite );
- }
- #endif // _DEBUG
- }
- if( pBar->IsVisible() )
- m_dwDockStateFlags |= __STATE_VISIBLE;
-
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pBar->AutoHideModeGet() )
- {
- CExtDockDynTabBar * pTabbedDocker =
- DYNAMIC_DOWNCAST(
- CExtDockDynTabBar,
- pBar->m_pDockBar
- );
- if( pTabbedDocker == NULL )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- m_dwDockStateFlags |= __STATE_AUTOHIDDEN;
- }
- else
- {
- ASSERT_VALID( pParentState );
- ASSERT_KINDOF( CExtDynTabControlBar, pTabbedDocker->GetParent() );
- pParentState->m_dwDockStateFlags |= __STATE_AUTOHIDDEN;
- } // else from if( pTabbedDocker == NULL )
- } // if( pBar->AutoHideModeGet() )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
-
- m_nMRUWidth = pBar->m_nMRUWidth;
- CRect m_rcBar;
- pBar->GetWindowRect( &m_rcBar );
- pBar->m_pDockBar->ScreenToClient( &m_rcBar );
- m_ptFloatPos = pBar->m_ptFloatHelper;
- m_sizeDockedH = pBar->m_sizeDockedH; // + sizeNcArea;
- m_sizeDockedV = pBar->m_sizeDockedV; // + sizeNcArea;
- m_sizeFloated = pBar->m_sizeFloated;
- m_nDelayedRowUpdateMetric = pBar->m_nDelayedRowUpdateMetric;
- m_rcMRUDockPos = pBar->m_pDockContext->m_rectMRUDockPos;
- m_dwMRUFloatStyle = pBar->m_pDockContext->m_dwMRUFloatStyle;
- m_ptMRUFloatPos = pBar->m_pDockContext->m_ptMRUFloatPos;
- m_dwBarFlags = pBar->m_dwStyle;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_nAutoHideWidth = pBar->AutoHideWidthGet();
- m_nAutoHideHeight = pBar->AutoHideHeightGet();
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- { // if tabbed container
- m_dwDockStateFlags |= InternalDockStateBar::__DOCK_DYNAMIC_TABBED;
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- pBar
- );
-
- CExtDockDynTabBar * pTabbedDocker =
- STATIC_DOWNCAST(
- CExtDockDynTabBar,
- pTabbedBar->m_pWndDynDocker // GetWindow( GW_CHILD )
- );
- ASSERT( pTabbedDocker->m_arrBars.GetSize() > 1 );
- ASSERT( pTabbedDocker->m_arrBars[0] == NULL );
- LONG nSel = -1;
- if( pBar->GetStyle() & WS_VISIBLE )
- nSel = pTabbedBar->GetSwitcherSelection();
- ExtControlBarVector_t vBars;
- pTabbedDocker->CalcOrderedVector( vBars );
- LONG nCount = (LONG)vBars.GetSize();
- //ASSERT( nCount > 1 );
- #ifdef _DEBUG
- INT nRealDockedCount = pTabbedDocker->GetDockedCount();
- ASSERT( nCount == nRealDockedCount );
- #endif // _DEBUG
- for( LONG nBar = 0; nBar < nCount; nBar++ )
- {
- CExtControlBar * pChildBar = vBars[ nBar ];
- ASSERT_VALID( pChildBar );
- ASSERT_KINDOF( CExtControlBar, pChildBar );
- ASSERT( !pChildBar->IsFixedMode() );
- InternalDockStateBar * _idsb =
- new InternalDockStateBar;
- _idsb->StateGet( pChildBar, this );
- _idsb->m_dwDockStateFlags |= InternalDockStateBar::__STATE_DYNAMIC_CHILD;
- _idsb->m_dwDockStateFlags |= InternalDockStateBar::__STATE_TAB_CHILD;
- if( nSel == nBar )
- _idsb->m_dwDockStateFlags |= InternalDockStateBar::__STATE_TAB_ACTIVE;
- m_arrChildStates.Add( _idsb );
- }
- ASSERT( m_arrChildStates.GetSize() == nRealDockedCount );
- if( pBar->IsFloating() )
- {
- m_dwDockStateFlags |= InternalDockStateBar::__STATE_FLOATING;
- CExtMiniDockFrameWnd * pMiniFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pBar->GetParentFrame()
- );
- pMiniFrame->GetWindowRect( &m_rcFloatingFrame );
- m_dwFloatingFrameCreateStyle = pMiniFrame->GetStyle();
- }
- } // if tabbed container
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- { // if dynamic half-split container
- m_dwDockStateFlags |= InternalDockStateBar::__DOCK_DYNAMIC_HALF_SPLIT;
-
- CExtDockDynBar * pDynDocker =
- STATIC_DOWNCAST(
- CExtDockDynBar,
- pBar->GetWindow( GW_CHILD )
- );
- INT nCount = (INT)pDynDocker->m_arrBars.GetSize();
- ASSERT( nCount > 1 );
- ASSERT( pDynDocker->m_arrBars[0] == NULL );
- bool bNewRow = false;
- for( INT nBar = 1; nBar < nCount; nBar++ )
- {
- CExtControlBar * pChildBar = (CExtControlBar *)
- pDynDocker->m_arrBars[nBar];
- if( pChildBar == NULL )
- {
- bNewRow = true;
- continue;
- }
- if( __PLACEHODLER_BAR_PTR(pChildBar) )
- continue;
- ASSERT_KINDOF( CExtControlBar, pChildBar );
- ASSERT( !pChildBar->IsFixedMode() );
- // if( pChildBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- // {
- // if( ((CExtDynControlBar*)pChildBar)->m_pWndDynDocker->GetDockedCount() == 0 )
- // continue;
- // }
- InternalDockStateBar * _idsb =
- new InternalDockStateBar;
- _idsb->StateGet( pChildBar, this );
- if( bNewRow )
- _idsb->m_dwDockStateFlags |= InternalDockStateBar::__STATE_NEW_ROW;
- _idsb->m_dwDockStateFlags |= InternalDockStateBar::__STATE_DYNAMIC_CHILD;
- m_arrChildStates.Add( _idsb );
- bNewRow = false;
- }
- #ifdef _DEBUG
- INT nRealDockedCount = pDynDocker->GetDockedCount();
- ASSERT( nRealDockedCount > 0 );
- ASSERT( m_arrChildStates.GetSize() == nRealDockedCount );
- #endif // _DEBUG
- if( pBar->IsFloating() )
- {
- m_dwDockStateFlags |= InternalDockStateBar::__STATE_FLOATING;
- CExtMiniDockFrameWnd * pMiniFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pBar->GetParentFrame()
- );
- pMiniFrame->GetWindowRect( &m_rcFloatingFrame );
- m_dwFloatingFrameCreateStyle = pMiniFrame->GetStyle();
- }
- } // if dynamic half-split container
- else
- { // if bar at side
- m_dwDockStateFlags |= InternalDockStateBar::__DOCK_AT_SIDE;
- ASSERT( !pBar->IsFloating() );
- } // if bar at side
- }
- void CExtControlBar::InternalDockStateBar::StateSet(
- CFrameWnd * pDockSite,
- CExtControlBar::InternalDockStateBar * pParentState
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pDockSite );
- m_pHelperBar = NULL;
- switch( (m_dwDockStateFlags & __DOCK_AT_MASK) )
- {
- case __DOCK_AT_NOWHERE:
- break; // case __DOCK_AT_NOWHERE
- case __DOCK_AT_SIDE:
- {
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( m_nDockBarID );
- ASSERT( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) == 0 );
-
- m_pHelperBar = (CExtControlBar *)
- pDockSite->GetControlBar( m_nBarID );
- if( m_pHelperBar == NULL )
- {
- //KJ TELESTE ::AfxThrowUserException();
- return; //KJ TELESTE: Should return.
- }
- ASSERT_VALID( m_pHelperBar );
- ASSERT_KINDOF( CExtControlBar, m_pHelperBar );
- ASSERT( !m_pHelperBar->IsFixedMode() );
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- {
- ASSERT_VALID( pParentState );
- ASSERT_VALID( pParentState->m_pHelperBar );
- ASSERT_KINDOF( CExtDynControlBar, pParentState->m_pHelperBar );
- CExtDockDynBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockDynBar,
- ( STATIC_DOWNCAST(
- CExtDynControlBar,
- pParentState->m_pHelperBar
- )
- )->m_pWndDynDocker
- );
- pDockBar->_LockSequenceOptimization( true );
-
- m_pHelperBar->m_bUpdatingChain = true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_TAB_CHILD) != 0 )
- {
- ASSERT_KINDOF( CExtDynTabControlBar, pParentState->m_pHelperBar );
- ((CExtDynTabControlBar*)pParentState->m_pHelperBar)
- -> InsertBar(
- m_pHelperBar,
- -1,
- false
- );
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_TAB_CHILD) != 0 )
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- pDockBar->DockControlBar( m_pHelperBar );
- } // else from if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_TAB_CHILD) != 0 )
-
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
-
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- else
- {
- ASSERT( m_nCircleNo > 0 );
- ASSERT_VALID( m_pHelperBar->m_pDockBar );
- ASSERT( m_pHelperBar->m_pDockContext != NULL );
- ASSERT_KINDOF( CExtDockBar, m_pHelperBar->m_pDockBar );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- pDockSite->GetControlBar( m_nDockBarID )
- );
- pDockBar =
- pDockBar->_GetBarByCircleNo( m_nCircleNo );
- pDockBar->_LockSequenceOptimization( true );
- pDockBar->DockControlBar( m_pHelperBar );
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // else from if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- }
- break; // case __DOCK_AT_SIDE
- case __DOCK_DYNAMIC_HALF_SPLIT:
- {
- m_pHelperBar = new CExtDynControlBar;
- DWORD dwDynStyle =
- WS_CHILD
- | (m_dwDockStateFlags & CBRS_ALIGN_ANY)
- ;
- dwDynStyle |= CBRS_BORDER_ANY;
- dwDynStyle &= ~( CBRS_FLOATING | CBRS_GRIPPER );
- dwDynStyle |= CBRS_TOOLTIPS;
- m_pHelperBar->SetInitDesiredSizeHorizontal( m_sizeDockedH );
- m_pHelperBar->SetInitDesiredSizeVertical( m_sizeDockedV );
- m_pHelperBar->SetInitDesiredSizeFloating( m_sizeFloated );
- if( ! m_pHelperBar->Create(
- NULL,
- pDockSite, // pParentFrame
- m_nBarID,
- dwDynStyle
- )
- )
- {
- ASSERT( FALSE );
- return;
- }
- ASSERT( ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker != NULL );
- ASSERT( ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow(((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->GetSafeHwnd()) );
- m_pHelperBar->m_pDockSite = pDockSite;
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_pDockSite = pDockSite;
- m_pHelperBar->m_hWndOwner = pDockSite->GetSafeHwnd();
- m_pHelperBar->EnableDocking( CBRS_ALIGN_ANY );
- ASSERT( m_pHelperBar->m_pDockContext != NULL );
- ASSERT( m_pHelperBar->m_pDockContext->m_pDockSite == pDockSite );
- ASSERT_VALID( m_pHelperBar );
- if( pDockSite->m_listControlBars.Find(m_pHelperBar) == NULL )
- pDockSite->m_listControlBars.AddTail( m_pHelperBar );
- m_pHelperBar->OnNcAreaButtonsReinitialize();
- CFrameWnd * pParentFrame = pDockSite;
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pMiniFrame =
- m_pHelperBar->OnCreateFloatingFrame(
- m_dwFloatingFrameCreateStyle
- );
- pParentFrame = pMiniFrame;
- CRect rcFrameAdjusted =
- CExtPaintManager::stat_AlignWndRectToMonitor(
- m_rcFloatingFrame
- );
- pMiniFrame->ModifyStyle( FWS_SNAPTOBARS, 0 );
- pMiniFrame->MoveWindow( &rcFrameAdjusted, FALSE );
- pMiniFrame->DelayRecalcLayout();
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pMiniFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pParentFrame
- );
- CDockBar * pFloatingDocker =
- STATIC_DOWNCAST(
- CDockBar,
- pMiniFrame->GetWindow(GW_CHILD)
- );
- ASSERT( !pFloatingDocker->IsKindOf(RUNTIME_CLASS(CExtDockBar)) );
- ASSERT( pFloatingDocker->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT );
- m_pHelperBar->SetParent( pFloatingDocker );
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- {
- POSITION posToRemove =
- pDockSite->m_listControlBars.Find(
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker
- );
- if( posToRemove != NULL )
- {
- pDockSite->m_listControlBars.RemoveAt( posToRemove );
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified = true;
- } // if( posToRemove != NULL )
- } // if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CDockBar * pDockBar =
- STATIC_DOWNCAST(
- CDockBar,
- pParentFrame->GetWindow( GW_CHILD )
- );
- ASSERT_KINDOF( CDockBar, pDockBar );
- ASSERT( !pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar)) );
- ASSERT( pDockBar->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT );
- ((CExtDockBar*)pDockBar)->DockControlBar( m_pHelperBar );
- ASSERT( pDockBar->IsFloating() );
- ASSERT( m_pHelperBar->IsFloating() );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- else if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- {
- ASSERT_VALID( pParentState );
- ASSERT_VALID( pParentState->m_pHelperBar );
- ASSERT_KINDOF( CExtDynControlBar, m_pHelperBar );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- ( STATIC_DOWNCAST(
- CExtDynControlBar,
- pParentState->m_pHelperBar
- )
- )->m_pWndDynDocker
- );
- pDockBar->_LockSequenceOptimization( true );
- pDockBar->DockControlBar( m_pHelperBar );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
-
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // else if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- else
- {
- ASSERT( m_nCircleNo > 0 );
- ASSERT( m_pHelperBar->m_pDockContext != NULL );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- pDockSite->GetControlBar( m_nDockBarID )
- );
- pDockBar =
- pDockBar->_GetBarByCircleNo( m_nCircleNo );
- pDockBar->_LockSequenceOptimization( true );
-
- pDockBar->DockControlBar( m_pHelperBar );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
-
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // else from if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- INT nCount = (INT)m_arrChildStates.GetSize();
- for( INT nBar = 0; nBar < nCount; nBar ++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[nBar];
- ASSERT_VALID( pState );
- pState->StateSet( pDockSite, this );
- }
-
- #ifdef _DEBUG
- INT nRealDockedCount =
- ((CExtDynControlBar *)m_pHelperBar)
- -> m_pWndDynDocker
- -> GetDockedCount();
- ASSERT( nRealDockedCount == nCount );
- #endif // _DEBUG
- }
- break; // case __DOCK_DYNAMIC_HALF_SPLIT
-
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- case __DOCK_DYNAMIC_TABBED:
- {
- m_pHelperBar = NULL;
- pDockSite->SendMessage(
- g_nMsgCreateTabbedBar,
- WPARAM( &m_pHelperBar )
- );
- #ifdef _DEBUG
- if( m_pHelperBar != NULL )
- {
- ASSERT_VALID( m_pHelperBar );
- ASSERT_KINDOF( CExtDynTabControlBar, m_pHelperBar );
- } // if( m_pHelperBar != NULL )
- #endif // _DEBUG
- if( m_pHelperBar == NULL )
- m_pHelperBar = new CExtDynTabControlBar;
- DWORD dwDynStyle =
- WS_CHILD
- | (m_dwDockStateFlags & CBRS_ALIGN_ANY)
- ;
- dwDynStyle |= CBRS_BORDER_ANY;
- dwDynStyle &= ~( CBRS_FLOATING | CBRS_GRIPPER );
- dwDynStyle |= CBRS_TOOLTIPS;
- m_pHelperBar->SetInitDesiredSizeHorizontal( m_sizeDockedH );
- m_pHelperBar->SetInitDesiredSizeVertical( m_sizeDockedV );
- m_pHelperBar->SetInitDesiredSizeFloating( m_sizeFloated );
- if( ! m_pHelperBar->Create(
- NULL,
- pDockSite, // pParentFrame
- m_nBarID,
- dwDynStyle
- )
- )
- {
- ASSERT( FALSE );
- return;
- }
- ASSERT( ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker != NULL );
- ASSERT( ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow(((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->GetSafeHwnd()) );
- m_pHelperBar->m_pDockSite = pDockSite;
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_pDockSite = pDockSite;
- m_pHelperBar->m_hWndOwner = pDockSite->GetSafeHwnd();
- m_pHelperBar->EnableDocking( CBRS_ALIGN_ANY );
- ASSERT( m_pHelperBar->m_pDockContext != NULL );
- ASSERT( m_pHelperBar->m_pDockContext->m_pDockSite == pDockSite );
- ASSERT_VALID( m_pHelperBar );
- if( pDockSite->m_listControlBars.Find(m_pHelperBar) == NULL )
- pDockSite->m_listControlBars.AddTail( m_pHelperBar );
- m_pHelperBar->OnNcAreaButtonsReinitialize();
- CFrameWnd * pParentFrame = pDockSite;
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pMiniFrame =
- m_pHelperBar->OnCreateFloatingFrame(
- m_dwFloatingFrameCreateStyle
- );
- CRect rcFrameAdjusted =
- CExtPaintManager::stat_AlignWndRectToMonitor(
- m_rcFloatingFrame
- );
- pMiniFrame->ModifyStyle( FWS_SNAPTOBARS, 0 );
- pMiniFrame->MoveWindow( &rcFrameAdjusted, FALSE );
- pMiniFrame->DelayRecalcLayout();
- pParentFrame = pMiniFrame;
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pMiniFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pParentFrame
- );
- CDockBar * pFloatingDocker =
- STATIC_DOWNCAST(
- CDockBar,
- pMiniFrame->GetWindow(GW_CHILD)
- );
- ASSERT( !pFloatingDocker->IsKindOf(RUNTIME_CLASS(CExtDockBar)) );
- ASSERT( pFloatingDocker->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT );
- m_pHelperBar->SetParent( pFloatingDocker );
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- {
- POSITION posToRemove =
- pDockSite->m_listControlBars.Find(
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker
- );
- if( posToRemove != NULL )
- {
- pDockSite->m_listControlBars.RemoveAt( posToRemove );
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified = true;
- } // if( posToRemove != NULL )
- } // if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CDockBar * pDockBar =
- STATIC_DOWNCAST(
- CDockBar,
- pParentFrame->GetWindow( GW_CHILD )
- );
- ASSERT_KINDOF( CDockBar, pDockBar );
- ASSERT( !pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar)) );
- ASSERT( pDockBar->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT );
- ((CExtDockBar*)pDockBar)->DockControlBar( m_pHelperBar );
- ASSERT( pDockBar->IsFloating() );
- ASSERT( m_pHelperBar->IsFloating() );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
- } // if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- else if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- {
- ASSERT_VALID( pParentState );
- ASSERT_VALID( pParentState->m_pHelperBar );
- ASSERT_KINDOF( CExtDynControlBar, m_pHelperBar );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- ( STATIC_DOWNCAST(
- CExtDynControlBar,
- pParentState->m_pHelperBar
- )
- )->m_pWndDynDocker
- );
- pDockBar->_LockSequenceOptimization( true );
-
- pDockBar->DockControlBar( m_pHelperBar );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
-
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // else if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- else
- {
- ASSERT( m_nCircleNo > 0 );
- ASSERT( m_pHelperBar->m_pDockContext != NULL );
- CExtDockBar * pDockBar =
- STATIC_DOWNCAST(
- CExtDockBar,
- pDockSite->GetControlBar( m_nDockBarID )
- );
- pDockBar =
- pDockBar->_GetBarByCircleNo( m_nCircleNo );
- pDockBar->_LockSequenceOptimization( true );
-
- pDockBar->DockControlBar( m_pHelperBar );
-
- m_pHelperBar->m_bUpdatingChain = true;
- m_pHelperBar->MoveWindow( &m_rcBar, FALSE );
- m_pHelperBar->m_bUpdatingChain = false;
-
- pDockBar->_LockSequenceOptimization( false );
- INT nBarPos =
- pDockBar->FindBar( m_pHelperBar );
- ASSERT( nBarPos >= 1 );
- if( nBarPos > 1 )
- {
- if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- {
- if( pDockBar->m_arrBars[nBarPos-1] != NULL )
- pDockBar->m_arrBars.InsertAt(
- nBarPos,
- (CControlBar *)NULL
- );
- } // if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- else
- {
- if( pDockBar->m_arrBars[nBarPos-1] == NULL )
- pDockBar->m_arrBars.RemoveAt( nBarPos-1 );
- } // else from if( (m_dwDockStateFlags & __STATE_NEW_ROW) != 0 )
- } // if( nBarPos > 1 )
- } // else from if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_DYNAMIC_CHILD) != 0 )
- INT nCount = (INT)m_arrChildStates.GetSize();
- //ASSERT( nCount > 1 );
- m_nHelperAciveTabChildIndex = -1;
- for( INT nBar = 0; nBar < nCount; nBar ++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[nBar];
- ASSERT_VALID( pState );
- if( (pState->m_dwDockStateFlags & InternalDockStateBar::__STATE_TAB_ACTIVE) != 0 )
- {
- if( (pState->m_dwDockStateFlags & InternalDockStateBar::__STATE_VISIBLE) != 0 )
- {
- ASSERT( m_nHelperAciveTabChildIndex == -1 );
- m_nHelperAciveTabChildIndex = nBar;
- }
- }
- pState->StateSet( pDockSite, this );
- }
- #ifdef _DEBUG
- INT nRealDockedCount =
- ((CExtDynTabControlBar *)m_pHelperBar)
- -> m_pWndDynDocker
- -> GetDockedCount();
- ASSERT( nRealDockedCount == nCount );
- #endif // _DEBUG
- }
- break; // case __DOCK_DYNAMIC_TABBED
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( (m_dwDockStateFlags & __DOCK_AT_MASK) )
- ASSERT_VALID( m_pHelperBar );
- //bool bBarWndVisible = ( ( m_pHelperBar->GetStyle() & WS_VISIBLE ) != 0 ) ? true : false;
- // if( (m_dwDockStateFlags & __STATE_VISIBLE) != 0 )
- // {
- // if( !bBarWndVisible )
- // pDockSite->ShowControlBar( m_pHelperBar, TRUE, TRUE );
- // } // if( (m_dwDockStateFlags & __STATE_VISIBLE) != 0 )
- // else
- // {
- // if( bBarWndVisible )
- // pDockSite->ShowControlBar( m_pHelperBar, FALSE, TRUE );
- // } // else from if( (m_dwDockStateFlags & __STATE_VISIBLE) != 0 )
- pDockSite->ShowControlBar(
- m_pHelperBar,
- (m_dwDockStateFlags & __STATE_VISIBLE) ? TRUE : FALSE,
- TRUE
- );
- CExtMiniDockFrameWnd * pMiniFrame =
- DYNAMIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- m_pHelperBar->GetParentFrame()
- );
- if( pMiniFrame != NULL )
- {
- ASSERT_VALID( pMiniFrame );
- INT nCount = (INT)pMiniFrame->m_listControlBars.GetCount();
- if( nCount != 0 )
- {
- ASSERT( nCount == 1 );
- pMiniFrame->m_listControlBars.RemoveAll();
- }
- CRect rcFrameInitial;
- pMiniFrame->GetWindowRect( &rcFrameInitial );
- CRect rcFrameAdjusted =
- CExtPaintManager::stat_AlignWndRectToMonitor(
- rcFrameInitial
- );
- if( rcFrameAdjusted != rcFrameInitial )
- {
- pMiniFrame->MoveWindow( &rcFrameAdjusted, FALSE );
- pMiniFrame->DelayRecalcLayout();
- } // if( rcFrameAdjusted != rcFrameInitial )
- } // if( pMiniFrame != NULL )
- m_pHelperBar->m_dwStyle = m_dwBarFlags;
- m_pHelperBar->m_ptFloatHelper = m_ptFloatPos;
- m_pHelperBar->m_sizeDockedH = m_sizeDockedH;
- m_pHelperBar->m_sizeDockedV = m_sizeDockedV;
- m_pHelperBar->m_sizeFloated = m_sizeFloated;
- m_pHelperBar->m_nDelayedRowUpdateMetric = m_nDelayedRowUpdateMetric;
- m_pHelperBar->m_nMRUWidth = m_nMRUWidth;
- m_pHelperBar->m_pDockContext->m_rectMRUDockPos = m_rcMRUDockPos;
- m_pHelperBar->m_pDockContext->m_dwMRUFloatStyle = m_dwMRUFloatStyle;
- m_pHelperBar->m_pDockContext->m_ptMRUFloatPos = m_ptMRUFloatPos;
- // if( m_dwDockStateFlags & __STATE_AUTOHIDDEN
- // && !m_pHelperBar->AutoHideModeGet()
- // )
- // {
- // VERIFY(
- // m_pHelperBar->AutoHideModeSet(
- // true,
- // false,
- // false,
- // false
- // )
- // );
- // }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_pHelperBar->AutoHideWidthSet( m_nAutoHideWidth );
- m_pHelperBar->AutoHideHeightSet( m_nAutoHideHeight );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- void CExtControlBar::InternalDockStateBar::PreSyncAttributes(
- CFrameWnd * pDockSite,
- CExtControlBar::InternalDockStateBar * pParentState
- )
- {
- //KJ TELESTE ASSERT_VALID( this );
- //KJ TELESTE ASSERT_VALID( m_pHelperBar );
- pParentState;
- //KJ TELESTE: Should be checked.
- if( m_pHelperBar == NULL )
- return;
- m_pHelperBar->m_ptFloatHelper = m_ptFloatPos;
- m_pHelperBar->m_sizeDockedH = m_sizeDockedH;
- m_pHelperBar->m_sizeDockedV = m_sizeDockedV;
- m_pHelperBar->m_sizeFloated = m_sizeFloated;
- m_pHelperBar->m_nDelayedRowUpdateMetric = m_nDelayedRowUpdateMetric;
- m_pHelperBar->m_nMRUWidth = m_nMRUWidth;
- m_pHelperBar->m_pDockContext->m_rectMRUDockPos = m_rcMRUDockPos;
- m_pHelperBar->m_pDockContext->m_dwMRUFloatStyle = m_dwMRUFloatStyle;
- m_pHelperBar->m_pDockContext->m_ptMRUFloatPos = m_ptMRUFloatPos;
- INT nCount = (INT)m_arrChildStates.GetSize();
- for( INT nBar = 0; nBar < nCount; nBar++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[nBar];
- ASSERT_VALID( pState );
- pState->PreSyncAttributes( pDockSite, this );
- }
- }
- void CExtControlBar::InternalDockStateBar::PostSyncAttributes(
- CFrameWnd * pDockSite,
- CExtControlBar::InternalDockStateBar * pParentState
- )
- {
- //KJ TELESTE ASSERT_VALID( this );
- //KJ TELESTE ASSERT_VALID( m_pHelperBar );
- pParentState;
- //KJ TELESTE:
- if( m_pHelperBar == NULL )
- return;
- bool bWalkChild = false;
- switch( (m_dwDockStateFlags & __DOCK_AT_MASK) )
- {
- case __DOCK_AT_NOWHERE:
- {
- }
- break; // case __DOCK_AT_NOWHERE
- case __DOCK_AT_SIDE:
- {
- }
- break; // case __DOCK_AT_SIDE
- case __DOCK_DYNAMIC_HALF_SPLIT:
- {
- bWalkChild = true;
- ASSERT_KINDOF( CExtDynControlBar, m_pHelperBar );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT( !m_pHelperBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- {
- POSITION posToRemove =
- pDockSite->m_listControlBars.Find(
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker
- );
- if( posToRemove != NULL )
- {
- pDockSite->m_listControlBars.RemoveAt( posToRemove );
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified = true;
- } // if( posToRemove != NULL )
- } // if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pParentFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- m_pHelperBar->GetParentFrame()
- );
- pParentFrame->RecalcLayout();
- }
- #ifdef _DEBUG
- INT nChildsCount = (INT)m_arrChildStates.GetSize();
- INT nRealDockedCount =
- ((CExtDynControlBar *)m_pHelperBar)
- -> m_pWndDynDocker
- -> GetDockedCount();
- ASSERT( nRealDockedCount == nChildsCount );
- #endif // _DEBUG
- }
- break; // case __DOCK_DYNAMIC_HALF_SPLIT
-
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- case __DOCK_DYNAMIC_TABBED:
- {
- bWalkChild = true;
- ASSERT_KINDOF( CExtDynTabControlBar, m_pHelperBar );
- if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- {
- POSITION posToRemove =
- pDockSite->m_listControlBars.Find(
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker
- );
- if( posToRemove != NULL )
- {
- pDockSite->m_listControlBars.RemoveAt( posToRemove );
- ((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified = true;
- } // if( posToRemove != NULL )
- } // if( !((CExtDynControlBar *)m_pHelperBar)->m_pWndDynDocker->m_bHelperDockSiteModified )
- if( (m_dwDockStateFlags & InternalDockStateBar::__STATE_FLOATING) != 0 )
- {
- CExtMiniDockFrameWnd * pParentFrame =
- STATIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- m_pHelperBar->GetParentFrame()
- );
- pParentFrame->RecalcLayout();
- }
- if( m_nHelperAciveTabChildIndex >= 0 )
- {
- //ASSERT( m_pHelperBar->GetStyle() & WS_VISIBLE );
- if( (m_pHelperBar->GetStyle() & WS_VISIBLE) == 0 )
- m_pHelperBar->ShowWindow( SW_SHOWNA );
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pHelperBar
- );
- LONG nSel =
- pTabbedBar->GetSwitcherSelection();
- if( nSel != m_nHelperAciveTabChildIndex
- && m_nHelperAciveTabChildIndex >= 0
- && pTabbedBar->GetBarAt(m_nHelperAciveTabChildIndex,true)->IsVisible()
- )
- pTabbedBar->SetSwitcherSelection(
- m_nHelperAciveTabChildIndex,
- true,
- true
- );
- }
-
- #ifdef _DEBUG
- INT nChildsCount = (INT)m_arrChildStates.GetSize();
- INT nRealDockedCount =
- ((CExtDynTabControlBar *)m_pHelperBar)
- -> m_pWndDynDocker
- -> GetDockedCount();
- ASSERT( nRealDockedCount == nChildsCount );
- #endif // _DEBUG
- }
- break; // case __DOCK_DYNAMIC_TABBED
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( (m_dwDockStateFlags & __DOCK_AT_MASK) )
- if( bWalkChild )
- {
- INT nCount = (INT)m_arrChildStates.GetSize();
- ASSERT( nCount > 0 );
- for( INT nBar = 0; nBar < nCount; nBar++ )
- {
- InternalDockStateBar * pState = m_arrChildStates[nBar];
- ASSERT_VALID( pState );
- pState->PostSyncAttributes( pDockSite, this );
- }
- }
- //KJ TELESTE: Should be checked.
- if( m_pHelperBar == NULL )
- return;
- m_pHelperBar->m_ptFloatHelper = m_ptFloatPos;
- m_pHelperBar->m_sizeDockedH = m_sizeDockedH;
- m_pHelperBar->m_sizeDockedV = m_sizeDockedV;
- m_pHelperBar->m_sizeFloated = m_sizeFloated;
- m_pHelperBar->m_nDelayedRowUpdateMetric = m_nDelayedRowUpdateMetric;
- m_pHelperBar->m_nMRUWidth = m_nMRUWidth;
- m_pHelperBar->m_pDockContext->m_rectMRUDockPos = m_rcMRUDockPos;
- m_pHelperBar->m_pDockContext->m_dwMRUFloatStyle = m_dwMRUFloatStyle;
- m_pHelperBar->m_pDockContext->m_ptMRUFloatPos = m_ptMRUFloatPos;
- }
- CTypedPtrMap < CMapPtrToWord, CFrameWnd *, WORD > CExtControlBar::g_mapSF;
- bool CExtControlBar::ProfileBarStateFramePush(
- CFrameWnd * pFrame,
- bool bIsLoading
- )
- {
- ASSERT_VALID( pFrame );
- WORD wLoadingFlagValue = 0;
- if( g_mapSF.Lookup( pFrame, wLoadingFlagValue ) )
- return false;
- wLoadingFlagValue = bIsLoading ? WORD(1) : WORD(0);
- g_mapSF.SetAt( pFrame, wLoadingFlagValue );
- return true;
- }
- bool CExtControlBar::ProfileBarStateFramePop(
- CFrameWnd * pFrame
- )
- {
- ASSERT_VALID( pFrame );
- WORD wLoadingFlagValue = 0;
- if( ! g_mapSF.Lookup( pFrame, wLoadingFlagValue ) )
- return false;
- g_mapSF.RemoveKey( pFrame );
- return true;
- }
- bool CExtControlBar::ProfileBarStateIsSerializing(
- CFrameWnd * pFrame,
- bool * p_bIsLoading // = NULL
- )
- {
- if( pFrame == NULL )
- return false;
- if( pFrame->GetSafeHwnd() == NULL )
- return false;
- ASSERT_VALID( pFrame );
- WORD wLoadingFlagValue = 0;
- if( ! g_mapSF.Lookup( pFrame, wLoadingFlagValue ) )
- return false;
- if( p_bIsLoading != NULL )
- (*p_bIsLoading) =
- ( wLoadingFlagValue != 0 )
- ? true : false;
- return true;
- }
- void CExtControlBar::OnExtBarStateSerializationComplete(
- bool bStore
- )
- {
- ASSERT_VALID( this );
- bStore;
- }
- bool CExtControlBar::ProfileBarStateSerialize(
- CArchive & ar,
- CFrameWnd * pFrame,
- LPWINDOWPLACEMENT pFrameWp, // = NULL // need serialize frame's WP
- bool bSerializeFixedBarsState, // = true,
- bool bSerializeResizableBarsState, // = true
- bool bEnableThrowExceptions // = false
- )
- {
- ASSERT_VALID( pFrame );
- ASSERT( pFrame->m_hWnd != NULL );
- ASSERT( ::IsWindow( pFrame->m_hWnd ) );
- if( ! ProfileBarStateFramePush(
- pFrame,
- ar.IsLoading() ? true : false
- )
- )
- {
- if( bEnableThrowExceptions )
- ::AfxThrowUserException();
- return false;
- }
- bool bRetVal = false;
- DWORD dwGeneralFlags = 0;
- DWORD dwReserved = 0L;
- try
- {
- try
- {
- InternalDockStateSite state(
- pFrame,
- bSerializeFixedBarsState,
- bSerializeResizableBarsState
- );
- if( ar.IsStoring() )
- {
- if( bSerializeFixedBarsState )
- dwGeneralFlags |= 0x00000001;
- if( bSerializeResizableBarsState )
- dwGeneralFlags |= 0x00000002;
- ar << dwGeneralFlags;
- ar << dwReserved;
- ar << dwReserved;
- ar << dwReserved;
- ar << dwReserved;
- ((InternalFriendlyFrameWnd *)pFrame)->
- GetDockState(
- state
- );
- if( state.m_wp.showCmd == SW_SHOWMINIMIZED )
- {
- if( ( state.m_wp.flags & WPF_RESTORETOMAXIMIZED ) != 0 )
- state.m_wp.showCmd = SW_MAXIMIZE;
- else
- state.m_wp.showCmd = SW_NORMAL;
- } // if( state.m_wp.showCmd == SW_SHOWMINIMIZED )
- state.Serialize( ar );
- CExtControlBar::stat_SetMessageString( pFrame );
- } // if( ar.IsStoring() )
- else
- {
- DWORD dwTmp = 0;
- if( bSerializeFixedBarsState )
- dwTmp |= 0x00000001;
- if( bSerializeResizableBarsState )
- dwTmp |= 0x00000002;
- ar >> dwGeneralFlags;
- if( dwGeneralFlags != dwTmp )
- {
- if( bEnableThrowExceptions )
- ::AfxThrowUserException();
- VERIFY( ProfileBarStateFramePop( pFrame ) );
- return false;
- }
- ar >> dwReserved;
- ar >> dwReserved;
- ar >> dwReserved;
- ar >> dwReserved;
- // win xp fix - begin
- WINDOWPLACEMENT _wpf;
- ::memset( &_wpf, 0, sizeof(WINDOWPLACEMENT) );
- _wpf.length = sizeof(WINDOWPLACEMENT);
- CWnd * pWndPlacement = stat_GetWndForPlacement( pFrame );
- ASSERT_VALID( pWndPlacement );
- //if( pWndPlacement->GetWindowPlacement(&_wpf) )
- if( CExtControlBar::stat_GetWindowPlacement( pWndPlacement->m_hWnd, _wpf ) )
- {
- _wpf.ptMinPosition.x = _wpf.ptMinPosition.y = 0;
- _wpf.ptMaxPosition.x = _wpf.ptMaxPosition.y = 0;
- _wpf.showCmd =
- (pWndPlacement->GetStyle() & WS_VISIBLE)
- ? SW_SHOWNA
- : SW_HIDE;
- //pWndPlacement->SetWindowPlacement(&_wpf);
- CExtControlBar::stat_SetWindowPlacement( pWndPlacement->m_hWnd, _wpf );
- }
- // win xp fix - end
- bool bPresetWP =
- ( pFrameWp != NULL ) ? true : false;
- state.Serialize( ar );
- ((InternalFriendlyFrameWnd *)pFrame)->SetDockState(
- state,
- bPresetWP
- );
- } // else from if( ar.IsStoring() )
- if( pFrameWp != NULL )
- __EXT_MFC_MEMCPY(
- pFrameWp,
- sizeof(WINDOWPLACEMENT),
- &state.m_wp,
- sizeof(WINDOWPLACEMENT)
- );
- bool bStore = ar.IsStoring() ? true : false;
- POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CControlBar * pBar = (CControlBar *)
- pFrame->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CControlBar, pBar );
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST(
- CExtControlBar,
- pBar
- );
- if( pExtBar != NULL )
- {
- if( ( pExtBar->IsFixedMode() )
- || ( pExtBar->IsFixedDockStyle() )
- )
- {
- if( ! bSerializeFixedBarsState )
- continue;
- } // if( pExtBar->IsFixedMode() )
- else
- {
- if( ! bSerializeResizableBarsState )
- continue;
- } // else from if( pExtBar->IsFixedMode() )
- pExtBar->OnExtBarStateSerializationComplete(
- bStore
- );
- } // if( pExtBar != NULL )
- } // for( ; pos != NULL; )
- // almost OK
- bRetVal = true;
- } // try
- catch( CException * pXept )
- {
- if( bEnableThrowExceptions )
- throw;
- pXept->Delete();
- //ASSERT( FALSE );
- } // catch( CException * pXept )
- catch( ... )
- {
- //ASSERT( FALSE );
- if( bEnableThrowExceptions )
- throw;
- } // catch( ... )
- //ASSERT( bRetVal );
- } // try
- catch( ... )
- {
- ASSERT( ! bRetVal );
- if( ! bEnableThrowExceptions )
- {
- VERIFY( ProfileBarStateFramePop( pFrame ) );
- }
- } // catch( ... )
- //ASSERT( bRetVal );
- dwGeneralFlags;
- dwReserved;
- if( ar.IsLoading() )
- CExtControlBar::stat_AdjustOccCompatibilityTree( pFrame );
- VERIFY( ProfileBarStateFramePop( pFrame ) );
- return bRetVal;
- }
- LRESULT CExtControlBar::OnSetText(WPARAM wParam, LPARAM lParam)
- {
- wParam;
- LRESULT lResult = CWnd::Default();
- if( IsFloating() )
- {
- CFrameWnd * pFrame = GetParentFrame();
- if( pFrame != NULL
- && pFrame->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd))
- )
- {
- m_pDockBar->SetWindowText( (LPTSTR) lParam );
- pFrame->SetWindowText( (LPTSTR) lParam );
- pFrame->DelayRecalcLayout();
- pFrame->SendMessage( WM_NCPAINT );
- }
- }
- bool bTextOnGripper = false;
- if( IsBarWithGripper( NULL, &bTextOnGripper ) )
- {
- if( bTextOnGripper )
- SendMessage( WM_NCPAINT );
- }
- return lResult;
- }
- static void stat_AddUnique(
- ExtControlBarVector_t & vBars,
- CExtControlBar * pBar
- )
- {
- ASSERT( pBar != NULL );
- INT nCount = (INT)vBars.GetSize();
- for( INT nBar = 0; nBar < nCount; nBar++ )
- {
- CExtControlBar * pAddedBar = vBars[ nBar ];
- ASSERT( pAddedBar != NULL );
- if( pAddedBar == pBar )
- return;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pBar->m_pDockBar != NULL )
- {
- if( pBar->m_pDockBar->IsKindOf( RUNTIME_CLASS(CExtDockDynTabBar) ) )
- {
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- pBar->m_pDockBar->GetParent()
- );
- stat_AddUnique( vBars, pTabbedBar );
- return;
- }
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- vBars.Add( pBar );
- }
- void CExtControlBar::_GetFrameControlBars(
- CControlBar * pBarExcludeSubTree,
- CFrameWnd * pFrame,
- ExtControlBarVector_t & vBars,
- DWORD dwCallOpt, // = ((DWORD)__GFECB_ALL_NONRESTRICT)
- CPoint ptRestrict // = CPoint( -1000, -1000 )
- )
- {
- ASSERT( pFrame != NULL );
- ASSERT( pFrame->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( pFrame->GetSafeHwnd() ) );
- ASSERT_VALID( pFrame );
- vBars.RemoveAll();
- if( ( dwCallOpt &
- ( DWORD(__GFECB_FIXED) | DWORD(__GFECB_NONFIXED) )
- ) == 0
- )
- return; // empty query
- if( ( dwCallOpt &
- ( DWORD(__GFECB_BAR_VISIBLE) | DWORD(__GFECB_BAR_INVISIBLE) )
- ) == 0
- )
- return; // empty query
- if( ( dwCallOpt &
- ( DWORD(__GFECB_WND_VISIBLE) | DWORD(__GFECB_WND_INVISIBLE) )
- ) == 0
- )
- return; // empty query
- //CSingleLock _slCsCB( &g_csCB );
- // _slCsCB.Lock();
- int nAllBarsCount = (int)g_AllBars.GetSize();
- for( INT nBar = 0; nBar < nAllBarsCount; nBar++ )
- {
- CExtControlBar * pBar = g_AllBars[nBar];
- ASSERT_KINDOF( CExtControlBar, pBar );
- if( pBar->GetSafeHwnd() == NULL )
- continue;
- if( !(::IsWindow(pBar->GetSafeHwnd())) )
- continue;
- if( pBarExcludeSubTree != NULL
- && ( pBar == pBarExcludeSubTree
- || ::IsChild( pBarExcludeSubTree->m_hWnd, pBar->m_hWnd )
- )
- )
- {
- continue;
- }
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- && ( !pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- //&& pBarExcludeSubTree == NULL
- )
- continue;
- if( pBar->m_bPresubclassDialogMode )
- continue;
- CFrameWnd * pBarFrame =
- _GetDockingFrameImpl( pBar );
- ASSERT( pBarFrame != NULL );
- ASSERT( pBarFrame->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( pBarFrame->GetSafeHwnd() ) );
- ASSERT_VALID( pBarFrame );
- if( pBarFrame != pFrame )
- continue;
- if( dwCallOpt == ((DWORD)__GFECB_ALL_NONRESTRICT) )
- {
- //stat_AddUnique( vBars, pBar );
- vBars.Add( pBar );
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_FIXED)) == 0 )
- {
- if( pBar->IsFixedMode() )
- continue;
- }
- if( !pBar->IsFixedMode() )
- {
- if( (dwCallOpt&((DWORD)__GFECB_NONFIXED)) == 0 )
- continue;
- bool bMinOnRow = pBar->IsMinimizedOnRow();
- if( (dwCallOpt&((DWORD)__GFECB_NONFIXED_MIN)) == 0 )
- {
- if( bMinOnRow )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_NONFIXED_NONMIN)) == 0 )
- {
- if( !bMinOnRow )
- continue;
- }
- }
- if( pBar->IsVisible() )
- {
- if( (dwCallOpt&((DWORD)__GFECB_BAR_VISIBLE)) == 0 )
- continue;
- }
- else
- {
- if( (dwCallOpt&((DWORD)__GFECB_BAR_INVISIBLE)) == 0 )
- continue;
- }
- if( pBar->IsWindowVisible() )
- {
- if( (dwCallOpt&((DWORD)__GFECB_WND_VISIBLE)) == 0 )
- continue;
- }
- else
- {
- if( (dwCallOpt&((DWORD)__GFECB_WND_INVISIBLE)) == 0 )
- continue;
- }
- if( pBar->IsFloating() )
- {
- if( (dwCallOpt&((DWORD)__GFECB_FLOATED)) == 0 )
- continue;
- } // if( pBar->IsFloating() )
- else
- {
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED)) == 0 )
- continue;
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED)) !=
- ((DWORD)__GFECB_DOCKED)
- )
- { // if not all docked bars
- UINT nDockBarID = pBar->GetSafeDockBarDlgCtrlID();
- switch( nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED_TOP)) == 0 )
- continue;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED_BOTTOM)) == 0 )
- continue;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED_LEFT)) == 0 )
- continue;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- if( (dwCallOpt&((DWORD)__GFECB_DOCKED_RIGHT)) == 0 )
- continue;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( nDockBarID )
- } // if not all docked bars
- } // else from if( pBar->IsFloating() )
- // restriction by point
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_ALL)) != 0 )
- { // if restriction by point
- CRect rcWnd;
- CWnd * pWndNcTest = pBar;
- if( pBar->IsFloating() )
- {
- pWndNcTest = pBar->GetDockingFrame();
- ASSERT( pWndNcTest != NULL );
- ASSERT( pWndNcTest->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( pWndNcTest->GetSafeHwnd() ) );
- ASSERT_VALID( pWndNcTest );
- ASSERT_KINDOF( CMiniDockFrameWnd, pWndNcTest );
- }
- pWndNcTest->GetWindowRect( &rcWnd );
- BOOL bInsideWndArea =
- rcWnd.PtInRect( ptRestrict );
- if( !bInsideWndArea )
- continue;
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_ONLY_WND)) != 0 )
- {
- stat_AddUnique( vBars, pBar );
- //continue;
- // _slCsCB.Unlock();
- return;
- }
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_NCGRIP)) != 0 )
- {
- CRect rcGrip = pBar->_RectGripGet();
- if( rcGrip.IsRectEmpty() )
- continue;
- CPoint ptWnd( ptRestrict );
- ptWnd -= rcWnd.TopLeft();
- if( ! rcGrip.PtInRect(ptWnd) )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_CLIENT)) != 0 )
- {
- CRect rcClient;
- pBar->GetClientRect( &rcClient );
- pBar->ClientToScreen( &rcClient );
- if( ! rcClient.PtInRect( ptRestrict ) )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_NC)) != 0 )
- { // if any nc hit test restriction
- UINT nHitTest = (UINT)
- pWndNcTest->SendMessage(
- WM_NCHITTEST,
- WPARAM(0),
- MAKELPARAM(ptRestrict.x,ptRestrict.y)
- );
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTLEFT)) != 0 )
- {
- if( nHitTest != HTLEFT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTRIGHT)) != 0 )
- {
- if( nHitTest != HTRIGHT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTTOP)) != 0 )
- {
- if( nHitTest != HTTOP )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTBOTTOM)) != 0 )
- {
- if( nHitTest != HTBOTTOM )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTTOPLEFT)) != 0 )
- {
- if( nHitTest != HTTOPLEFT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTTOPRIGHT)) != 0 )
- {
- if( nHitTest != HTTOPRIGHT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTBOTTOMLEFT)) != 0 )
- {
- if( nHitTest != HTBOTTOMLEFT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTBOTTOMRIGHT)) != 0 )
- {
- if( nHitTest != HTBOTTOMRIGHT )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTNOWHERE)) != 0 )
- {
- if( nHitTest != HTNOWHERE )
- continue;
- }
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTSYSMENU)) != 0 )
- {
- if( nHitTest != HTSYSMENU )
- continue;
- }
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTGROWBOX)) != 0 )
- {
- if( nHitTest != HTGROWBOX )
- continue;
- }
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTMINBUTTON)) != 0 )
- {
- if( nHitTest != HTMINBUTTON )
- continue;
- }
-
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTMAXBUTTON)) != 0 )
- {
- if( nHitTest != HTMAXBUTTON )
- continue;
- }
- if( (dwCallOpt&((DWORD)__GFECB_BYPT_HTCLIENT)) != 0 )
- {
- if( nHitTest != HTCLIENT )
- continue;
- }
-
- } // if any nc hit test restriction
- } // if restriction by point
- stat_AddUnique( vBars, pBar );
- } // for( INT nBar = 0; nBar < nAllBarsCount; nBar++ )
- // _slCsCB.Unlock();
- }
- void CExtControlBar::_GetFrameControlBars(
- bool bExcludeOwnSubtree,
- ExtControlBarVector_t & vBars,
- DWORD dwCallOpt, // = ((DWORD)__GFECB_ALL_NONRESTRICT)
- CPoint ptRestrict // = CPoint( -1000, -1000 )
- ) const
- {
- CFrameWnd * pFrame = _GetDockingFrameImpl();
- _GetFrameControlBars(
- bExcludeOwnSubtree ? ((CExtControlBar*)this) : NULL,
- pFrame,
- vBars,
- dwCallOpt,
- ptRestrict
- );
- // if( bExcludeOwnSubtree )
- // {
- // int nCount = vBars.GetSize();
- // for( int i = 0; i < nCount; )
- // {
- // CExtControlBar * pBar = vBars[ i ];
- // if( pBar == this
- // || ::IsChild( m_hWnd, pBar->m_hWnd )
- // )
- // {
- // vBars.RemoveAt( i );
- // nCount --;
- // continue;
- // }
- // i++;
- // } // for( int i = 0; i < nCount; )
- // } // if( bExcludeOwnSubtree )
- }
- CControlBar * CExtControlBar::_GetNextControlBarInRow(
- CControlBar * pBar,
- bool bNext, // = true // next or previous
- bool bExtBar, // = false
- bool bNonFixed // = false
- )
- {
- ASSERT( pBar != NULL );
- ASSERT( pBar->GetSafeHwnd() != NULL );
- ASSERT_VALID( pBar );
- ASSERT( !pBar->IsFloating() );
- ASSERT_VALID( pBar->m_pDockBar );
- INT nPos = pBar->m_pDockBar->FindBar( pBar );
- ASSERT( nPos >= 0 );
- if( nPos == 0 && !bNext )
- return NULL; // first in first row
- INT nCountOfSideBars = (INT)pBar->m_pDockBar->m_arrBars.GetSize();
- ASSERT( nPos < nCountOfSideBars );
- if( nPos == (nCountOfSideBars-1) && bNext )
- return NULL; // last in last row
- if( bNext )
- {
- for( nPos++; nPos < nCountOfSideBars; nPos++ )
- {
- CControlBar * pExamineBar = (CControlBar *)
- pBar->m_pDockBar->m_arrBars[ nPos ];
- ASSERT( pExamineBar != pBar );
- if( pExamineBar == NULL )
- return NULL; // row separator
- if( __PLACEHODLER_BAR_PTR(pExamineBar) )
- continue;
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- continue;
- if( bNonFixed )
- {
- if( ((CExtControlBar *)pBar)->IsFixedMode() )
- continue;
- }
- }
- return pExamineBar;
- } // for( nPos++; nPos < nCountOfSideBars; nPos++ )
- } // if( bNext )
- else
- {
- for( nPos--; nPos >= 0; nPos-- )
- {
- CControlBar * pExamineBar = (CControlBar *)
- pBar->m_pDockBar->m_arrBars[ nPos ];
- ASSERT( pExamineBar != pBar );
- if( pExamineBar == NULL )
- return NULL; // row separator
- if( __PLACEHODLER_BAR_PTR(pExamineBar) )
- continue;
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- continue;
- if( bNonFixed )
- {
- if( ((CExtControlBar *)pBar)->IsFixedMode() )
- continue;
- }
- }
- return pExamineBar;
- } // for( nPos--; nPos >= 0; nPos-- )
- } // else from if( bNext )
- return NULL;
- }
- CControlBar * CExtControlBar::_GetFirstControlBarInRow(
- CControlBar * pBar,
- bool bNext, // = false // last or first
- bool bExtBar, // = false
- bool bNonFixed // = false
- )
- {
- ASSERT( pBar != NULL );
- ASSERT( pBar->GetSafeHwnd() != NULL );
- ASSERT_VALID( pBar );
- ASSERT( !pBar->IsFloating() );
- ASSERT_VALID( pBar->m_pDockBar );
- INT nPos = pBar->m_pDockBar->FindBar( pBar );
- ASSERT( nPos > 0 );
- if( nPos == 1 && !bNext )
- {
- // first in first row
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- {
- CControlBar * pBar2 =
- _GetNextControlBarInRow(
- pBar,true,bExtBar,bNonFixed );
- return ( pBar2 == NULL ) ? pBar : pBar2;
- }
- if( bNonFixed
- && ((CExtControlBar *)pBar)->IsFixedMode()
- )
- {
- CControlBar * pBar2 =
- _GetNextControlBarInRow(
- pBar,true,bExtBar,bNonFixed );
- return ( pBar2 == NULL ) ? pBar : pBar2;
- }
- }
- return pBar;
- } // if( nPos == 1 && !bNext )
- INT nCountOfSideBars = (INT)pBar->m_pDockBar->m_arrBars.GetSize();
- ASSERT( nPos <= nCountOfSideBars );
- if( nPos == (nCountOfSideBars-1) && bNext )
- {
- // last in last row
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- {
- CControlBar * pBar2 =
- _GetNextControlBarInRow(
- pBar,false,bExtBar,bNonFixed );
- return ( pBar2 == NULL ) ? pBar : pBar2;
- }
- if( bNonFixed
- && ((CExtControlBar *)pBar)->IsFixedMode()
- )
- {
- CControlBar * pBar2 =
- _GetNextControlBarInRow(
- pBar,false,bExtBar,bNonFixed );
- return ( pBar2 == NULL ) ? pBar : pBar2;
- }
- }
- return pBar;
- }
- CControlBar * pPrevBar = pBar;
- if( bNext )
- {
- for( nPos++; nPos < nCountOfSideBars; nPos++ )
- {
- CControlBar * pExamineBar = (CControlBar *)
- pBar->m_pDockBar->m_arrBars[ nPos ];
- ASSERT( pExamineBar != pBar );
- if( pExamineBar == NULL )
- return pPrevBar; // row separator
- if( __PLACEHODLER_BAR_PTR(pExamineBar) )
- continue;
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- continue;
- if( bNonFixed )
- {
- if( ((CExtControlBar *)pBar)->IsFixedMode() )
- continue;
- }
- }
- pPrevBar = pExamineBar;
- } // for( nPos++; nPos < nCountOfSideBars; nPos++ )
- } // if( bNext )
- else
- {
- for( nPos--; nPos >= 0; nPos-- )
- {
- CControlBar * pExamineBar = (CControlBar *)
- pBar->m_pDockBar->m_arrBars[ nPos ];
- ASSERT( pExamineBar != pBar );
- if( pExamineBar == NULL )
- return pPrevBar; // row separator
- if( __PLACEHODLER_BAR_PTR(pExamineBar) )
- continue;
- if( bExtBar )
- {
- if( !pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- continue;
- if( bNonFixed )
- {
- if( ((CExtControlBar *)pBar)->IsFixedMode() )
- continue;
- }
- }
- pPrevBar = pExamineBar;
- } // for( nPos--; nPos >= 0; nPos-- )
- } // else from if( bNext )
- return pPrevBar;
- }
- void CExtControlBar::_GetNextRowBars(
- bool bNextRow,
- MfcControlBarVector_t & vBars,
- CRect * pRcAllBars, // = NULL
- INT * p_nOwnPos, // = NULL
- bool * p_bRowMaxSized, // = NULL // row with resizable bars?
- bool * p_bRowFullSized // = NULL // row with menu-like bar?
- ) const
- {
- ASSERT_VALID( this );
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_nOwnPos != NULL )
- *p_nOwnPos = -1;
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- vBars.RemoveAll();
- if( m_pDockBar == NULL )
- return;
- ASSERT_VALID( m_pDockBar );
- INT nOwnIdx = m_pDockBar->FindBar( (CControlBar *)this );
- ASSERT( nOwnIdx >= 0 );
- if( nOwnIdx < 0 )
- return;
- if( p_nOwnPos != NULL )
- *p_nOwnPos = nOwnIdx;
- INT nTotalDockCount = (INT)m_pDockBar->m_arrBars.GetSize();
- INT nFirstToReview = -1;
- INT nIncrement = bNextRow ? 1 : -1;
- INT nBar = 0;
- for( nBar = nOwnIdx+nIncrement; true; nBar += nIncrement )
- {
- if( nBar == 0 || nBar == nTotalDockCount )
- return;
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- if( pBar == NULL )
- {
- nFirstToReview = nBar + nIncrement;
- if( nFirstToReview >= nTotalDockCount )
- return;
- break;
- }
- #ifdef _DEBUG
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CControlBar, pBar );
- #endif // _DEBUG
- } // for( nBar = nOwnIdx+nIncrement; true; nBar += nIncrement )
-
- if( nFirstToReview <= 0 )
- return;
- // ASSERT( 0 < nFirstToReview && nFirstToReview < nTotalDockCount );
- ASSERT( 0 <= nFirstToReview && nFirstToReview < nTotalDockCount );
- INT nBarWidth = 0;
- bool bHorz = IsDockedHorizontally();
- for( nBar = nFirstToReview; true; nBar += nIncrement )
- {
- if( nBar < 0 || nBar >= nTotalDockCount )
- break;
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- if( pBar == NULL )
- {
- if( vBars.GetSize() == 0 )
- {
- nBarWidth = 0;
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- continue; // skip invisible or placeholder's row
- }
- break;
- }
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CControlBar, pBar );
- ASSERT( pBar != (CControlBar *)this );
- if( !pBar->IsVisible() )
- continue;
-
- if( pRcAllBars != NULL )
- {
- if( vBars.GetSize() == 0 )
- pBar->GetWindowRect( pRcAllBars );
- else
- {
- CRect rcWndBar;
- pBar->GetWindowRect( &rcWndBar );
- pRcAllBars->left =
- min( pRcAllBars->left, rcWndBar.left );
- pRcAllBars->top =
- min( pRcAllBars->top, rcWndBar.top );
- pRcAllBars->right =
- max( pRcAllBars->right, rcWndBar.right );
- pRcAllBars->bottom =
- max( pRcAllBars->bottom, rcWndBar.bottom );
- }
- } // if( pRcAllBars != NULL )
- if( (p_bRowMaxSized != NULL || p_bRowFullSized != NULL)
- && pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- )
- {
- if( p_bRowMaxSized != NULL
- && ( ! (*p_bRowMaxSized) )
- && !((CExtControlBar*)pBar)->IsFixedMode()
- )
- *p_bRowMaxSized = true;
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- && pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- && ((CExtControlBar *)pBar)->_GetFullRowMode()
- )
- *p_bRowFullSized = true;
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- CRect rcBarWnd;
- pBar->GetWindowRect( &rcBarWnd );
- nBarWidth +=
- bHorz ? rcBarWnd.Width() : rcBarWnd.Height();
- }
- }
- vBars.Add( pBar );
- } // for( nBar = nFirstToReview; true; nBar += nIncrement )
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- ASSERT_VALID( m_pDockBar );
- CRect rcDockBarWnd;
- m_pDockBar->GetWindowRect( &rcDockBarWnd );
- INT nDockBarWidth = bHorz ? rcDockBarWnd.Width() : rcDockBarWnd.Height();
- nDockBarWidth --;
- if( nBarWidth >= nDockBarWidth )
- *p_bRowFullSized = true;
- }
- }
- void CExtControlBar::_GetRowBars(
- MfcControlBarVector_t & vBars,
- CRect * pRcAllBars, // = NULL
- INT * p_nOwnPos, // = NULL
- bool * p_bRowMaxSized, // = NULL // row with resizable bars?
- bool * p_bRowFullSized // = NULL // row with menu-like bar?
- ) const
- {
- ASSERT_VALID( this );
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_nOwnPos != NULL )
- *p_nOwnPos = -1;
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- vBars.RemoveAll();
- bool bEmptyRowCalc = true;
- if( m_pDockBar == NULL )
- return;
- ASSERT_VALID( m_pDockBar );
- INT nBarWidth = 0;
- bool bHorz = IsDockedHorizontally();
- INT nTotalDockCount = (INT)m_pDockBar->m_arrBars.GetSize();
- bool bThisFound = false;
- for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- if( pBar == NULL )
- {
- if( bThisFound )
- break;
- vBars.RemoveAll();
- bEmptyRowCalc = true;
- nBarWidth = 0;
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- continue;
- }
- if( __PLACEHODLER_BAR_PTR( pBar ) )
- continue;
- ASSERT_KINDOF( CControlBar, pBar );
-
- if( pBar == (CControlBar *)this )
- {
- bThisFound = true;
- if( p_nOwnPos != NULL )
- *p_nOwnPos = (INT)vBars.GetSize();
- }
- if( !pBar->IsVisible() )
- continue;
-
- if( pRcAllBars != NULL )
- {
- if( bEmptyRowCalc )
- {
- bEmptyRowCalc = false;
- pBar->GetWindowRect( pRcAllBars );
- } // if( bEmptyRowCalc )
- else
- {
- CRect rcWndBar;
- pBar->GetWindowRect( &rcWndBar );
- pRcAllBars->left =
- min( pRcAllBars->left, rcWndBar.left );
- pRcAllBars->top =
- min( pRcAllBars->top, rcWndBar.top );
- pRcAllBars->right =
- max( pRcAllBars->right, rcWndBar.right );
- pRcAllBars->bottom =
- max( pRcAllBars->bottom, rcWndBar.bottom );
- } // else from if( bEmptyRowCalc )
- } // if( pRcAllBars != NULL )
- if( (p_bRowMaxSized != NULL || p_bRowFullSized != NULL)
- && pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- )
- {
- if( p_bRowMaxSized != NULL
- && ( ! (*p_bRowMaxSized) )
- && !((CExtControlBar*)pBar)->IsFixedMode()
- )
- *p_bRowMaxSized = true;
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- && pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- && ((CExtControlBar *)pBar)->_GetFullRowMode()
- )
- *p_bRowFullSized = true;
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- CRect rcBarWnd;
- pBar->GetWindowRect( &rcBarWnd );
- nBarWidth +=
- bHorz ? rcBarWnd.Width() : rcBarWnd.Height();
- }
- }
- vBars.Add( pBar );
- } // for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- ASSERT_VALID( m_pDockBar );
- CRect rcDockBarWnd;
- m_pDockBar->GetWindowRect( &rcDockBarWnd );
- INT nDockBarWidth = bHorz ? rcDockBarWnd.Width() : rcDockBarWnd.Height();
- nDockBarWidth --;
- if( nBarWidth >= nDockBarWidth )
- *p_bRowFullSized = true;
- }
- #ifdef _DEBUG
- if( p_nOwnPos != NULL )
- {
- INT nCount = (INT)vBars.GetSize();
- ASSERT( nCount > 0 );
- ASSERT( 0 <= (*p_nOwnPos) && (*p_nOwnPos) < nCount );
- for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- pBar;
- }
- }
- #endif // _DEBUG
- }
- void CExtControlBar::_GetRowExtBars(
- ExtControlBarVector_t & vBars,
- bool bNonFixedOnly, // = true
- CRect * pRcAllBars, // = NULL
- INT * p_nOwnPos, // = NULL
- bool * p_bRowMaxSized, // = NULL // row with resizable bars?
- bool * p_bRowFullSized // = NULL // row with menu-like bar?
- ) const
- {
- ASSERT_VALID( this );
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_nOwnPos != NULL )
- *p_nOwnPos = -1;
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- vBars.RemoveAll();
- bool bEmptyRowCalc = true;
- if( m_pDockBar == NULL )
- return;
- ASSERT_VALID( m_pDockBar );
- INT nBarWidth = 0;
- bool bHorz = IsDockedHorizontally();
- INT nTotalDockCount = (INT)m_pDockBar->m_arrBars.GetSize();
- bool bThisFound = false;
- for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- if( pBar == NULL )
- {
- if( bThisFound )
- break;
- vBars.RemoveAll();
- bEmptyRowCalc = true;
- nBarWidth = 0;
- if( pRcAllBars != NULL )
- pRcAllBars->SetRect( 0, 0, 0, 0 );
- if( p_bRowMaxSized != NULL )
- *p_bRowMaxSized = false;
- if( p_bRowFullSized != NULL )
- *p_bRowFullSized = false;
- continue;
- }
- if( __PLACEHODLER_BAR_PTR( pBar ) )
- continue;
- ASSERT_KINDOF( CControlBar, pBar );
- if( pBar == (CControlBar *)this )
- {
- bThisFound = true;
- if( p_nOwnPos != NULL )
- *p_nOwnPos = (INT)vBars.GetSize();
- }
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- {
- if( ( !((CExtControlBar *)pBar)->IsFixedMode() )
- || (! bNonFixedOnly )
- )
- vBars.Add( (CExtControlBar *)pBar );
-
- if( p_bRowMaxSized != NULL || p_bRowFullSized != NULL )
- {
- if( p_bRowMaxSized != NULL
- && ( ! (*p_bRowMaxSized) )
- && !((CExtControlBar*)pBar)->IsFixedMode()
- )
- *p_bRowMaxSized = true;
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- && pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- && ((CExtControlBar *)pBar)->_GetFullRowMode()
- )
- *p_bRowFullSized = true;
- }
- }
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- CRect rcBarWnd;
- pBar->GetWindowRect( &rcBarWnd );
- nBarWidth +=
- bHorz ? rcBarWnd.Width() : rcBarWnd.Height();
- }
- if( pRcAllBars != NULL )
- {
- if( bEmptyRowCalc )
- {
- bEmptyRowCalc = false;
- pBar->GetWindowRect( pRcAllBars );
- } // if( bEmptyRowCalc )
- else
- {
- CRect rcWndBar;
- pBar->GetWindowRect( &rcWndBar );
- pRcAllBars->left =
- min( pRcAllBars->left, rcWndBar.left );
- pRcAllBars->top =
- min( pRcAllBars->top, rcWndBar.top );
- pRcAllBars->right =
- max( pRcAllBars->right, rcWndBar.right );
- pRcAllBars->bottom =
- max( pRcAllBars->bottom, rcWndBar.bottom );
- } // if( bEmptyRowCalc )
- } // if( pRcAllBars != NULL )
- } // for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- if( p_bRowFullSized != NULL
- && ( ! (*p_bRowFullSized) )
- )
- {
- ASSERT_VALID( m_pDockBar );
- CRect rcDockBarWnd;
- m_pDockBar->GetWindowRect( &rcDockBarWnd );
- INT nDockBarWidth = bHorz ? rcDockBarWnd.Width() : rcDockBarWnd.Height();
- nDockBarWidth --;
- if( nBarWidth >= nDockBarWidth )
- *p_bRowFullSized = true;
- }
- #ifdef _DEBUG
- if( p_nOwnPos != NULL )
- {
- INT nCount = (INT)vBars.GetSize();
- ASSERT( nCount > 0 );
- ASSERT( 0 <= (*p_nOwnPos) && (*p_nOwnPos) < nCount );
- }
- #endif // _DEBUG
- }
- bool CExtControlBar::_IsFirstBarInRow( bool bExtBar ) const
- {
- if( m_pDockBar == NULL )
- return false;
- ASSERT_VALID( m_pDockBar );
- INT nRowCount = 0;
- INT nTotalDockCount = (INT)m_pDockBar->m_arrBars.GetSize();
- for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBar ];
- if( pBar == NULL )
- {
- nRowCount = 0;
- continue;
- }
- if( __PLACEHODLER_BAR_PTR( pBar ) )
- continue;
- ASSERT_KINDOF( CControlBar, pBar );
- if( bExtBar )
- {
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar == NULL )
- return false;
- if( pExtBar->IsFixedMode() )
- return false;
- }
- if( pBar == (CControlBar *)this )
- {
- return (nRowCount == 0) ? true : false;
- }
- nRowCount++;
- } // for( INT nBar = 0; nBar < nTotalDockCount; nBar++ )
- ASSERT( FALSE );
- return false;
- }
- bool CExtControlBar::_IsLastBarInRow( bool bExtBar ) const
- {
- ASSERT( !IsFloating() );
- if( bExtBar )
- {
- ExtControlBarVector_t vBars;
- _GetRowExtBars( vBars );
- INT nCountOfBars = (INT)vBars.GetSize();
- ASSERT( nCountOfBars > 0 );
- if( vBars[nCountOfBars-1] == (CExtControlBar *)this )
- return true;
- return false;
- }
- MfcControlBarVector_t vBars;
- _GetRowBars( vBars );
- INT nCountOfBars = (INT)vBars.GetSize();
- ASSERT( nCountOfBars > 0 );
- if( vBars[nCountOfBars-1] == (CControlBar *)this )
- return true;
- return false;
- }
- CFrameWnd * CExtControlBar::_GetDockingFrameImpl(
- CControlBar * pBar
- )
- {
- ASSERT_VALID( pBar );
- ASSERT( pBar->GetSafeHwnd() != NULL );
- if( pBar->m_pDockSite != NULL )
- {
- ASSERT_VALID( pBar->m_pDockSite );
- ASSERT( pBar->m_pDockSite->GetSafeHwnd() != NULL );
- ASSERT_KINDOF( CFrameWnd, pBar->m_pDockSite );
- return pBar->m_pDockSite;
- }
- CFrameWnd * pFrame = pBar->GetParentFrame();
- if( pFrame == NULL )
- return NULL;
- ASSERT_VALID( pFrame );
- ASSERT_KINDOF( CFrameWnd, pFrame );
- if( pFrame->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)) )
- {
- pFrame = pFrame->GetParentFrame();
- ASSERT_VALID( pFrame );
- ASSERT( !pFrame->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)) );
- }
- return pFrame;
- }
- CFrameWnd * CExtControlBar::_GetDockingFrameImpl() const
- {
- return _GetDockingFrameImpl( (CControlBar *)this );
- }
- UINT CExtControlBar::GetSafeDockBarDlgCtrlID() const
- {
- ASSERT_VALID( this );
- ASSERT( GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( GetSafeHwnd() ) );
- CWnd * pParentWnd =
- (m_pDockBar != NULL) ? m_pDockBar : GetParent();
- if( pParentWnd->GetSafeHwnd() == NULL
- || !::IsWindow( pParentWnd->GetSafeHwnd() )
- || !pParentWnd->IsKindOf( RUNTIME_CLASS(CDockBar) )
- )
- return AFX_IDW_DOCKBAR_FLOAT; // IDC_STATIC
- UINT nDlgCtrlID = pParentWnd->GetDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nDlgCtrlID );
- return nDlgCtrlID;
- }
- bool CExtControlBar::IsDockedAtTop() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & CBRS_TOP) ? true : false;
- return GetSafeDockBarDlgCtrlID() == AFX_IDW_DOCKBAR_TOP;
- }
- bool CExtControlBar::IsDockedAtBottom() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & CBRS_BOTTOM) ? true : false;
- return GetSafeDockBarDlgCtrlID() == AFX_IDW_DOCKBAR_BOTTOM;
- }
- bool CExtControlBar::IsDockedAtLeft() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & CBRS_LEFT) ? true : false;
- return GetSafeDockBarDlgCtrlID() == AFX_IDW_DOCKBAR_LEFT;
- }
- bool CExtControlBar::IsDockedAtRight() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & CBRS_RIGHT) ? true : false;
- return GetSafeDockBarDlgCtrlID() == AFX_IDW_DOCKBAR_RIGHT;
- }
- bool CExtControlBar::IsDockedHorizontally() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & (CBRS_TOP|CBRS_BOTTOM)) ? true : false;
- UINT nDockBarDlgCtrlID = GetSafeDockBarDlgCtrlID();
- return nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_TOP
- || nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_BOTTOM;
- }
- bool CExtControlBar::IsDockedVertically() const
- {
- if( m_pDockSite == NULL )
- return (m_dwStyle & (CBRS_LEFT|CBRS_RIGHT)) ? true : false;
- UINT nDockBarDlgCtrlID = GetSafeDockBarDlgCtrlID();
- return nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_LEFT
- || nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_RIGHT;
- }
- bool CExtControlBar::IsDocked() const
- {
- if( m_pDockSite == NULL )
- return true;
- UINT nDockBarDlgCtrlID = GetSafeDockBarDlgCtrlID();
- return nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_TOP
- || nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_BOTTOM
- || nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_LEFT
- || nDockBarDlgCtrlID == AFX_IDW_DOCKBAR_RIGHT;
- }
- bool CExtControlBar::IsFloating() const
- {
- if( !IsDocked() )
- {
- if( GetParentFrame() != NULL )
- return true;
- }
- return false;
- }
- bool CExtControlBar::_IsSingleVisibleInFloatingPalette()
- {
- if( m_pDockSite == NULL
- || !IsVisible()
- || IsFixedMode()
- // || m_bUpdatingChain
- )
- return false;
- CFrameWnd * pFrame = GetParentFrame();
- if( pFrame == NULL )
- return false;
- if( !pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- return false;
- ASSERT_KINDOF( CExtMiniDockFrameWnd, pFrame );
- ASSERT( m_pDockSite != pFrame );
- POSITION pos = m_pDockSite->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CExtControlBar * pBar =
- DYNAMIC_DOWNCAST(
- CExtControlBar,
- ((CControlBar *)(m_pDockSite->m_listControlBars.GetNext(pos)))
- );
- if( pBar == NULL
- || pBar == this
- || pBar->m_pDockSite == NULL
- || pBar->m_pDockBar == NULL
- || pBar->IsFixedMode()
- || ( pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- && !pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar))
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- )
- || pBar->GetParentFrame() != pFrame
- )
- continue;
- HWND hWndDockBar = pBar->m_pDockBar->GetSafeHwnd();
- if( hWndDockBar == NULL // by Guillaume Provost advice
- || (! ::IsWindow(hWndDockBar) )
- )
- continue;
- ASSERT( pBar->m_pDockBar != NULL );
- if(
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar))
- ||
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- !pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar))
- )
- continue;
- if( pBar->IsVisible() )
- return false;
- }
- return true;
- }
- bool CExtControlBar::IsBarWithGripper(
- bool * pbGripperAtTop, // = NULL
- bool * pbTextOnGripper // = NULL
- ) const
- {
- ASSERT_VALID( this );
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = false;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = false;
- if( ! ::IsWindow(GetSafeHwnd()) )
- return false;
- if( (m_dwStyle & CBRS_GRIPPER) == 0
- || IsFloating()
- )
- return false;
- CFrameWnd * pParentFrame = GetParentFrame();
- if( pParentFrame != NULL
- && pParentFrame->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd))
- )
- {
- if( ((CExtControlBar *)this)->_IsSingleVisibleInFloatingPalette() )
- return false;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_pDockBar != NULL
- && !AutoHideModeGet()
- )
- {
- if( m_pDockBar->IsKindOf( RUNTIME_CLASS(CExtDockDynTabBar) ) )
- {
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = false;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = false;
- return false;
- }
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pbGripperAtTop != NULL
- && ( m_bGripperStaticallyAtTop || IsDockedVertically() )
- )
- *pbGripperAtTop = true;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = true;
- return true;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool CExtControlBar::IsCloseOnlyOneBarInTabGroup() const
- {
- ASSERT_VALID( this );
- return g_bCloseOnlyOneBarInTabGroup;
- }
- int CExtControlBar::OnReflectTabOleDragDrop(
- COleDropTarget * pOleDropTarget
- )
- {
- ASSERT_VALID( this );
- pOleDropTarget;
- return g_nTabDrarDropSelectionDelay;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- void CExtControlBar::OnShowControlBarChain(
- bool bShow,
- bool bDelay,
- bool bOnlyOneBar // = false
- )
- {
- ASSERT_VALID( this );
- bOnlyOneBar;
- CFrameWnd * pFrame = _GetDockingFrameImpl();
- ASSERT_VALID( pFrame );
- pFrame->ShowControlBar(
- this,
- bShow ? TRUE : FALSE,
- bDelay ? TRUE : FALSE
- );
- }
- CSize CExtControlBar::CalcFixedLayout(
- BOOL bStretch,
- BOOL bHorz
- )
- {
- bStretch;
- return _CalcDesiredLayout( bHorz );
- }
- CSize CExtControlBar::CalcDynamicLayout(
- int nLength,
- DWORD nMode
- )
- {
- // MSDN for LM_HORZDOCK and LM_VERTDOCK: ... return
- // horizontal/vertical docked dimensions ...
- if( ((nMode & (LM_HORZDOCK | LM_VERTDOCK)) == 0)
- || IsFloating()
- )
- { // if going to floated state or already floated
-
- if( nLength > 0 )
- {
- // MSDN for nLength: ... The requested dimension of the
- // control bar, either horizontal or vertical,
- // depending on dwMode ...
- // MSDN for LM_LENGTHY: ... Set if nLength indicates
- // height (Y-direction) instead of width.
- if( nMode & LM_LENGTHY )
- m_sizeFloated.cy = nLength;
- else
- m_sizeFloated.cx = nLength;
- } // if( nLength > 0 )
- // MSDN for LM_MRUWIDTH: ... Most Recently Used Dynamic Width.
- // Ignores nLength parameter and uses the remembered most
- // recently used width.
- // MSDN for LM_COMMIT: ... Resets LM_MRUWIDTH to current
- // width of floating control bar.
- if( nMode & ( LM_MRUWIDTH | LM_COMMIT ) )
- return m_sizeFloated;
- return _CalcDesiredLayout( nMode & LM_HORZ );
- } // if going to floated state or already floated
- if( nLength >= 0 )
- return _CalcDesiredLayout( nMode & LM_HORZ );
- ASSERT_VALID( m_pDockBar );
- if( ((CExtDockBar *)m_pDockBar)->m_bLayoutQuery )
- return _CalcDesiredLayout( nMode & LM_HORZ );
- ASSERT_VALID( m_pDockBar );
- INT nCalcExtentMax =
- ((FriendlyDockBarHack*)m_pDockBar)->
- GetCalcExtentMax( nMode & LM_HORZ );
- ASSERT( nCalcExtentMax >= 0 );
- if( nCalcExtentMax == 0 )
- return _CalcDesiredLayout( nMode & LM_HORZ );
- INT nCalcExtentDiff = 0;
- INT nCalcExtentMin =
- (nMode & LM_HORZ) ? afxData.cyBorder2 : afxData.cxBorder2;
- INT nCalcExtentReal = 0, nMaxWidth = 0;
- INT nCountOfBarsAtSide = (INT)m_pDockBar->m_arrBars.GetSize();
- ASSERT( nCountOfBarsAtSide > 0 );
- INT nThisIdx = -1, nReviewStart = -1, nReviewStop = -1;
- INT nCountInRowReal = 0, nCountExtBarsInRowReal = 0;
- INT nCountOfMinSizedBars = 0;
- INT nBarAtSide = 0;
- for( nBarAtSide = 0; nBarAtSide < nCountOfBarsAtSide ; nBarAtSide++ )
- {
- CControlBar * pBar = (CControlBar *)
- m_pDockBar->m_arrBars[ nBarAtSide ];
- if( pBar == NULL )
- {
- if( nThisIdx >= 0 )
- {
- nReviewStop = nBarAtSide - 1;
- break;
- }
- nCountInRowReal = 0;
- nCountExtBarsInRowReal = 0;
- nMaxWidth = 0;
- nReviewStop = -1;
- nReviewStart = nBarAtSide + 1;
- continue;
- } // if( pBar == NULL )
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow(pBar->GetSafeHwnd())
- );
- if( !pBar->IsVisible() )
- continue;
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- );
- if( pBar == this )
- {
- if( nCountExtBarsInRowReal > 0 )
- //goto __Align_Mutually_Row__;
- return _CalcDesiredLayout( nMode & LM_HORZ );
- nThisIdx = nBarAtSide;
- //nReviewStart = nThisIdx;
- }
- CRect rcBarWnd;
- pBar->GetWindowRect( &rcBarWnd );
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar!=NULL && pExtBar->IsFixedMode() )
- pExtBar = NULL;
- // INT nCalcExtentStep =
- // (nMode & LM_HORZ) ? rcBarWnd.Width() : rcBarWnd.Height();
- if( pExtBar != NULL )
- {
- nCountExtBarsInRowReal++;
- nMaxWidth =
- max(
- nMaxWidth,
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH.cy
- : pExtBar->m_sizeDockedV.cx
- );
- } // if( pExtBar != NULL )
- nCountInRowReal++;
- } // for( nBarAtSide = 0; nBarAtSide < nCountOfBarsAtSide ; nBarAtSide++ )
- ASSERT( nReviewStart <= nReviewStop );
- ASSERT( nReviewStart <= nThisIdx && nThisIdx <= nReviewStop );
- if( nCountInRowReal == 1 )
- {
- if( nMode & LM_HORZ )
- m_sizeDockedH.cx =
- max( _CalcDesiredMinHW(), nCalcExtentMax );
- else
- m_sizeDockedV.cy =
- max( _CalcDesiredMinVH(), nCalcExtentMax );
- goto __Align_Mutually_Row__;
- }
- for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- {
- CControlBar * pBar = (CControlBar*)
- m_pDockBar->m_arrBars[ nBarAtSide ];
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow(pBar->GetSafeHwnd())
- );
- if( !pBar->IsVisible() )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar!=NULL && pExtBar->IsFixedMode() )
- pExtBar = NULL;
- INT nCalcExtentBar = 0;
- if( pExtBar == NULL )
- {
- CRect rcBar;
- pBar->GetWindowRect( &rcBar );
- nCalcExtentBar =
- (nMode & LM_HORZ) ?
- rcBar.Width() : rcBar.Height();
- } // if( pExtBar == NULL )
- else
- {
- nCalcExtentBar =
- (nMode & LM_HORZ)
- ? pExtBar->_CalcDesiredMinHW()
- : pExtBar->_CalcDesiredMinVH()
- ;
- LONG & ref_nCalcExtentBar =
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH.cx
- : pExtBar->m_sizeDockedV.cy
- ;
- if( ref_nCalcExtentBar < nCalcExtentBar )
- ref_nCalcExtentBar = nCalcExtentBar;
- }
- nCalcExtentMin += nCalcExtentBar;
- if( nCalcExtentMin <= nCalcExtentMax )
- {
- if( pExtBar == NULL )
- {
- nCalcExtentMax -= nCalcExtentBar;
- continue;
- }
- nCalcExtentReal +=
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH.cx
- : pExtBar->m_sizeDockedV.cy ;
- continue;
- } // if( nCalcExtentMin <= nCalcExtentMax )
-
- if( nBarAtSide < nThisIdx )
- {
- ASSERT( pBar != this );
- ((FriendlyDockBarHack*)m_pDockBar)->
- _InsertRowSplitter( nBarAtSide + 1 );
- return _CalcDesiredLayout( nMode & LM_HORZ );
- }
- if( nBarAtSide == nThisIdx )
- {
- ASSERT( pBar == this );
- if( nMode & LM_HORZ )
- m_sizeDockedH.cx =
- max( _CalcDesiredMinHW(), nCalcExtentMax );
- else
- m_sizeDockedV.cy =
- max( _CalcDesiredMinVH(), nCalcExtentMax );
- break;
- }
- ASSERT( pBar != this );
- ((FriendlyDockBarHack*)m_pDockBar)->
- _InsertRowSplitter( nBarAtSide );
- nReviewStop = nBarAtSide - 1;
- ASSERT( nReviewStart <= nReviewStop );
- ASSERT( nReviewStart <= nThisIdx && nThisIdx <= nReviewStop );
- break;
- } // for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- nCountOfMinSizedBars = 0;
- for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- {
- CControlBar * pBar = (CControlBar*)
- m_pDockBar->m_arrBars[ nBarAtSide ];
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow(pBar->GetSafeHwnd())
- );
- if( !pBar->IsVisible() )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar!=NULL && pExtBar->IsFixedMode() )
- pExtBar = NULL;
- if( pExtBar == NULL )
- continue;
- LONG nMinMetric =
- (nMode & LM_HORZ)
- ? pExtBar->_CalcDesiredMinHW()
- : pExtBar->_CalcDesiredMinVH()
- ;
- LONG nCalcExtentBar =
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH.cx
- : pExtBar->m_sizeDockedV.cy
- ;
- ASSERT( nCalcExtentBar >= nMinMetric );
- //
- if( nMinMetric == nCalcExtentBar )
- nCountOfMinSizedBars++;
- } // for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- ASSERT( nCountOfMinSizedBars <= nCountExtBarsInRowReal );
- nCalcExtentDiff = nCalcExtentMax - nCalcExtentReal;
- if( nCountOfMinSizedBars != nCountExtBarsInRowReal )
- {
- // INT nCalcStep =
- // nCalcExtentDiff /
- // (nCountExtBarsInRowReal - nCountOfMinSizedBars);
- INT nCalcStep = (nCalcExtentDiff > 0) ? 1 : -1;
- INT nPass = 0;
- INT nPassMax = abs(nCalcExtentDiff)*2;
- for( nBarAtSide = nReviewStart;
- // nBarAtSide < nReviewStop &&
- nCalcExtentDiff != 0
- && nCountOfMinSizedBars != nCountExtBarsInRowReal
- && nPass < nPassMax
- ;
- )
- {
- ASSERT( nBarAtSide <= nReviewStop+1 );
- if( nBarAtSide == nReviewStop+1 )
- {
- nPass++;
- nBarAtSide = nReviewStart;
- }
-
- CControlBar * pBar = (CControlBar*)
- m_pDockBar->m_arrBars[ nBarAtSide ];
- if( pBar == NULL )
- {
- nBarAtSide++;
- continue;
- }
- if( __PLACEHODLER_BAR_PTR(pBar) )
- {
- nBarAtSide++;
- continue;
- }
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow(pBar->GetSafeHwnd())
- );
- if( !pBar->IsVisible() )
- {
- nBarAtSide++;
- continue;
- }
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar == NULL
- || pExtBar->IsFixedMode()
- )
- {
- nBarAtSide++;
- continue;
- }
- if( nMode & LM_HORZ )
- pExtBar->m_sizeDockedH.cy = nMaxWidth;
- else
- pExtBar->m_sizeDockedV.cx = nMaxWidth;
-
- ASSERT( nCalcExtentDiff != 0 );
- LONG nMinMetric =
- (nMode & LM_HORZ)
- ? pExtBar->_CalcDesiredMinHW()
- : pExtBar->_CalcDesiredMinVH()
- ;
- LONG & ref_nCalcExtentBar =
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH.cx
- : pExtBar->m_sizeDockedV.cy
- ;
- ASSERT( ref_nCalcExtentBar >= nMinMetric );
- if( ref_nCalcExtentBar == nMinMetric )
- {
- nBarAtSide++;
- continue;
- }
- ASSERT( ref_nCalcExtentBar > nMinMetric );
- ref_nCalcExtentBar += nCalcStep;
- nCalcExtentDiff -= nCalcStep;
- if( ref_nCalcExtentBar == nMinMetric )
- nCountOfMinSizedBars++;
-
- ASSERT( ref_nCalcExtentBar >= nMinMetric );
- nBarAtSide++;
- } // for( nBarAtSide = nReviewStart; ...
- ASSERT( nCalcExtentDiff == 0 || nPass == nPassMax );
- } // if( nCountOfMinSizedBars != nCountExtBarsInRowReal )
- else
- {
- CExtControlBar * pLastBar = (CExtControlBar *)
- _GetFirstControlBarInRow(
- this, true, true, true
- );
- ASSERT( pLastBar != NULL );
- while( !pLastBar->IsVisible() )
- {
- CExtControlBar * pLastBar2 = (CExtControlBar *)
- _GetNextControlBarInRow(
- pLastBar, false, true, true
- );
- if( pLastBar2 == NULL )
- break;
- pLastBar = pLastBar2;
- }
- ASSERT( pLastBar != NULL );
- LONG & ref_nCalcExtentBar =
- (nMode & LM_HORZ) ?
- pLastBar->m_sizeDockedH.cx : pLastBar->m_sizeDockedV.cy;
- ref_nCalcExtentBar += nCalcExtentDiff;
- nCalcExtentReal = nCalcExtentMax;
- } // else from if( nCountOfMinSizedBars != nCountExtBarsInRowReal )
- __Align_Mutually_Row__:
- ASSERT_VALID( m_pDockBar );
- // if( ((CExtDockBar *)m_pDockBar)->m_bLayoutQuery )
- // return _CalcDesiredLayout( nMode & LM_HORZ );
- //bool bAtTop = IsDockedAtTop();
- CRect rcWndDockBar;
- m_pDockBar->GetWindowRect( &rcWndDockBar );
- CPoint ptDevOffset = -rcWndDockBar.TopLeft();
- INT nCalcBarOffset = 0;
- INT nHdwpCount = nReviewStop - nReviewStart + 1;
- ASSERT( nHdwpCount > 0 );
- HANDLE hDWP = ::BeginDeferWindowPos( nHdwpCount );
- ASSERT( hDWP != NULL );
- static const UINT nDwpFlags =
- SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE
- //|SWP_NOSENDCHANGING|SWP_NOREDRAW
- ;
- for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- {
- CControlBar * pBar = (CControlBar*)
- m_pDockBar->m_arrBars[ nBarAtSide ];
- if( __PLACEHODLER_BAR_PTR(pBar) )
- continue;
- ASSERT_VALID( pBar );
- ASSERT(
- pBar->GetSafeHwnd() != NULL
- && ::IsWindow(pBar->GetSafeHwnd())
- );
- if( !pBar->IsVisible() )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar != NULL && pExtBar->IsFixedMode() )
- pExtBar = NULL;
- CRect rcWndBarOrg;
- pBar->GetWindowRect( &rcWndBarOrg );
- CRect rcWndBar( rcWndBarOrg );
- rcWndBar.OffsetRect( ptDevOffset );
-
- if( pExtBar != NULL )
- rcWndBar =
- CRect(
- rcWndBar.TopLeft(),
- (nMode & LM_HORZ)
- ? pExtBar->m_sizeDockedH
- : pExtBar->m_sizeDockedV
- );
- INT nBarRealOffset =
- (nMode & LM_HORZ) ? rcWndBar.left : rcWndBar.top;
- if( nBarRealOffset != nCalcBarOffset )
- {
- if( !(nMode & LM_HORZ) )
- rcWndBar.OffsetRect(
- 0,
- nCalcBarOffset - rcWndBar.top
- );
- // else if( bAtTop )
- // rcWndBar.OffsetRect(
- // nCalcBarOffset - rcWndBar.left,
- // -2
- // );
- else
- rcWndBar.OffsetRect(
- nCalcBarOffset - rcWndBar.left,
- 0
- );
-
- } // if( nBarRealOffset != nCalcBarOffset )
-
- if( rcWndBar != rcWndBarOrg )
- {
- hDWP = ::DeferWindowPos(
- hDWP,
- pBar->GetSafeHwnd(),
- NULL,
- rcWndBar.left, rcWndBar.top,
- rcWndBar.Width(), rcWndBar.Height(),
- nDwpFlags
- );
- ASSERT( hDWP != NULL );
- } // if( rcWndBar != rcWndBarOrg )
-
- nCalcBarOffset += (nMode & LM_HORZ)
- ? rcWndBar.Width() : rcWndBar.Height();
- } // for( nBarAtSide = nReviewStart; nBarAtSide <= nReviewStop; nBarAtSide++ )
- VERIFY( ::EndDeferWindowPos( hDWP ) );
- return _CalcDesiredLayout( nMode & LM_HORZ );
- }
- bool CExtControlBar::_GetFullRowMode() const
- {
- ASSERT_VALID( this );
- return false;
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * CExtControlBar::NotifiedCustomizeSiteGet() const
- {
- ASSERT_VALID( this );
- if( m_pNotifiedCustomizeSite == LPVOID(1) )
- return NULL;
- if( m_pNotifiedCustomizeSite != NULL )
- return m_pNotifiedCustomizeSite;
- HWND hWndOwn = GetSafeHwnd();
- if( hWndOwn == NULL )
- return NULL;
- m_pNotifiedCustomizeSite =
- CExtCustomizeSite::GetCustomizeSite( hWndOwn );
- if( m_pNotifiedCustomizeSite == NULL )
- {
- m_pNotifiedCustomizeSite = (CExtCustomizeSite*) LPVOID(1);
- return NULL;
- }
- return m_pNotifiedCustomizeSite;
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- bool CExtControlBar::_DisplayingGet() const
- {
- ASSERT_VALID( this );
- return m_bDisplaying;
- }
- void CExtControlBar::_DisplayingSet( bool bDisplaying )
- {
- ASSERT_VALID( this );
- m_bDisplaying = bDisplaying;
- }
- void CExtControlBar::AnimationSite_OnProgressShutdownTimer( UINT nTimerID )
- {
- ASSERT_VALID( this);
- CExtAnimationSite::AnimationSite_OnProgressShutdownTimer( nTimerID );
- }
- HWND CExtControlBar::AnimationSite_GetSafeHWND() const
- {
- __PROF_UIS_MANAGE_STATE;
- HWND hWnd = GetSafeHwnd();
- return hWnd;
- }
- INT CExtControlBar::_CalcDesiredMinHW() const
- {
- ASSERT_VALID( this );
- CRect rcRowRecalcUp = _RectRowRecalcUpGet();
- INT nCalcVal = m_nMinHW + rcRowRecalcUp.Width();
- if( m_bGripperStaticallyAtTop )
- nCalcVal = max( nCalcVal, 10 );
- return nCalcVal;
- }
- INT CExtControlBar::_CalcDesiredMinVH() const
- {
- ASSERT_VALID( this );
- CRect rcRowRecalcUp = _RectRowRecalcUpGet();
- INT nCalcVal = m_nMinVH + rcRowRecalcUp.Height();
- return nCalcVal;
- }
- CSize CExtControlBar::_CalcDesiredMinOuterSize( BOOL bHorz ) const
- {
- ASSERT_VALID( this );
- bHorz;
- return CSize( _CalcDesiredMinHW(), _CalcDesiredMinVH() );
- }
- CSize CExtControlBar::_CalcDesiredMinFloatedSize() const
- {
- ASSERT_VALID( this );
- // for non-fixed size bars only
- return CSize( 80, 60 );
- }
- CSize CExtControlBar::_CalcDesiredLayout(
- BOOL bHorz,
- BOOL bForceFullRow // = FALSE
- )
- {
- ASSERT_VALID( this );
- if( IsFloating() )
- return m_sizeFloated;
- if( bHorz )
- {
- if( bForceFullRow )
- return CSize( MAXSHORT, m_sizeDockedH.cy );
- CSize sizeMin( _CalcDesiredMinHW(), _CalcDesiredMinVH() );
- if( m_sizeDockedH.cx < sizeMin.cx )
- m_sizeDockedH.cx = sizeMin.cx;
- if( m_sizeDockedH.cy < sizeMin.cy )
- m_sizeDockedH.cy = sizeMin.cy;
- return m_sizeDockedH;
- } // if( bHorz )
- else
- {
- if( bForceFullRow )
- return CSize( m_sizeDockedH.cx, MAXSHORT );
- CSize sizeMin( _CalcDesiredMinHW(), _CalcDesiredMinVH() );
- if( m_sizeDockedV.cx < sizeMin.cx )
- m_sizeDockedV.cx = sizeMin.cx;
- if( m_sizeDockedV.cy < sizeMin.cy )
- m_sizeDockedV.cy = sizeMin.cy;
- return m_sizeDockedV;
- } // else from if( bHorz )
- }
- CExtControlBar::InternalAffixmentData *
- CExtControlBar::_AffixmentGetOuter()
- {
- ASSERT_VALID( this );
- return NULL;
- }
- void CExtControlBar::_AffixmentSetOuter(
- CExtControlBar::InternalAffixmentData * pAffixmentData
- )
- {
- ASSERT_VALID( this );
- ASSERT( pAffixmentData != NULL );
- pAffixmentData;
- }
- CExtControlBar::InternalAffixmentData *
- CExtControlBar::_AffixmentGetOuter(
- CControlBar * pBar
- )
- {
- ASSERT_VALID( pBar );
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar == NULL )
- return NULL;
- return pExtBar->_AffixmentGetOuter();
- }
- int CExtControlBar::_AffixmentCompareOuter(
- CControlBar * pBar1,
- CControlBar * pBar2
- )
- {
- ASSERT_VALID( pBar1 );
- ASSERT_VALID( pBar2 );
- InternalAffixmentData * pAffixmentData1 =
- _AffixmentGetOuter( pBar1 );
- InternalAffixmentData * pAffixmentData2 =
- _AffixmentGetOuter( pBar2 );
- if( pAffixmentData1 != NULL )
- {
- if( pAffixmentData2 != NULL )
- return pAffixmentData1->CompareAffixment( *pAffixmentData2 );
- } // if( pAffixmentData1 != NULL )
- else
- {
- if( pAffixmentData2 != NULL )
- return -1;
- } // else from if( pAffixmentData1 != NULL )
- return 0;
- }
- void CExtControlBar::_AffixmentRecalcOuter()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- ASSERT_VALID( m_pDockSite );
- ASSERT( !IsFloating() );
- ASSERT( GetParentFrame() == m_pDockSite );
- ASSERT( (! GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) ) );
- ASSERT( GetSafeDockBarDlgCtrlID() != AFX_IDW_DOCKBAR_FLOAT );
- InternalAffixmentData * pAffixmentData =
- _AffixmentGetOuter();
- if( pAffixmentData == NULL )
- return;
- CExtDockOuterBar * pDockBar =
- DYNAMIC_DOWNCAST(CExtDockOuterBar, m_pDockBar );
- if( pDockBar == NULL )
- return;
- pDockBar->_AffixmentBringToTop( this );
- }
- void CExtControlBar::_AffixmentSafeClearOuter()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- InternalAffixmentData * pAffixmentData =
- _AffixmentGetOuter();
- if( pAffixmentData == NULL )
- return;
- pAffixmentData->Empty();
- }
- bool CExtControlBar::_AffixmentIsAlignedHW() const
- {
- ASSERT_VALID( this );
- return false;
- }
- void CExtControlBar::DoPaint( CDC * pDC )
- {
- if( m_bReposSingleChildMode
- && (! IsFixedMode() )
- )
- {
- CWnd * pWnd = GetWindow( GW_CHILD );
- if( pWnd != NULL
- && (pWnd->GetStyle()&WS_VISIBLE) != 0
- )
- {
- CRect rcClient, rcChild;
- GetClientRect( &rcClient );
- pWnd->GetWindowRect( &rcChild );
- ScreenToClient( &rcChild );
- if( rcClient == rcChild )
- return;
- }
- }
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- // CControlBar::DoPaint( pDC );
- ASSERT( pDC->GetSafeHdc() != NULL );
- CRect rcBarClient;
- GetClientRect( &rcBarClient );
- pDC->FillSolidRect( &rcBarClient, PmBridge_GetPM()->GetColor( COLOR_INFOBK, this ) );
- CRect rcDummy( rcBarClient );
- rcDummy.DeflateRect( 4, 4 );
- pDC->DrawFocusRect( &rcDummy );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- ASSERT( pDC->GetSafeHdc() != NULL );
- CRect rcClient;
- GetClientRect( &rcClient );
- if( rcClient.IsRectEmpty()
- || (! pDC->RectVisible( &rcClient ) )
- )
- return;
- CExtPaintManager::stat_ExcludeChildAreas(
- *pDC,
- *this
- );
- CExtMemoryDC dc(
- pDC,
- &rcClient
- );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( dc.GetSafeHdc() != NULL )
- pDC = &dc;
- DoEraseBk( pDC );
- PmBridge_GetPM()->OnPaintSessionComplete( this );
- #endif // ! __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- void CExtControlBar::DoEraseBk( CDC * pDC )
- {
- ASSERT_VALID( this );
- ASSERT( pDC->GetSafeHdc() != NULL );
- CRect rcClient;
- GetClientRect( &rcClient );
- PmBridge_GetPM()->PaintControlBarClientArea( *pDC, rcClient, this );
- }
- BOOL CExtControlBar::DoCustomModePreTranslateMessage(
- CWnd * pWndPretranslateSrc,
- MSG * pMsg
- )
- {
- ASSERT( pWndPretranslateSrc != NULL );
- ASSERT( pMsg != NULL );
- HWND hWndPretranslateSrc = pWndPretranslateSrc->GetSafeHwnd();
- if( hWndPretranslateSrc == NULL
- || ( ! ::IsWindow(hWndPretranslateSrc) )
- )
- return FALSE;
- for( HWND hWndChild = ::GetWindow( hWndPretranslateSrc, GW_CHILD );
- hWndChild != NULL && ::IsWindow( hWndPretranslateSrc );
- hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT )
- )
- {
- CWnd * pWndChild = CWnd::FromHandlePermanent( hWndChild );
- if( pWndChild == NULL )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWndChild );
- if( pExtBar == NULL )
- continue;
- if( pExtBar->PreTranslateMessage(pMsg) )
- return TRUE;
- }
- return FALSE;
- }
- void CExtControlBar::DoCustomModeUpdateControlBars(
- CWnd * pWndParentTarget,
- BOOL bDisableIfNoHndler // = TRUE
- )
- {
- ASSERT_VALID( pWndParentTarget );
- HWND hWndUpdateTarget = pWndParentTarget->GetSafeHwnd();
- if( hWndUpdateTarget == NULL )
- return;
- ASSERT( ::IsWindow( hWndUpdateTarget ) );
- for( HWND hWndChild = ::GetWindow( hWndUpdateTarget, GW_CHILD );
- hWndChild != NULL && ::IsWindow( hWndUpdateTarget );
- hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT )
- )
- {
- CWnd * pWndChild = CWnd::FromHandlePermanent( hWndChild );
- if( pWndChild == NULL )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWndChild );
- if( pExtBar == NULL )
- continue;
- pExtBar->DoCustomModeUpdateCmdUI(
- bDisableIfNoHndler
- );
- }
- }
- bool CExtControlBar::DoCustomModeUpdateCmdUI(
- BOOL bDisableIfNoHndler // = TRUE
- )
- {
- ASSERT_VALID( this );
- if( m_bInCustomModeUpdateCmdUI )
- return true;
- HWND hWndOwn = GetSafeHwnd();
- if( hWndOwn == NULL
- || ( ! ::IsWindow( hWndOwn ) )
- )
- return false;
- m_bInCustomModeUpdateCmdUI = true;
- CFrameWnd * pWndUpdateTarget = NULL;
-
- if( ! m_bPresubclassDialogMode )
- {
- pWndUpdateTarget = _GetDockingFrameImpl();
- ASSERT_VALID( pWndUpdateTarget );
- ASSERT_KINDOF( CFrameWnd, pWndUpdateTarget );
- }
-
- OnUpdateCmdUI(
- pWndUpdateTarget,
- bDisableIfNoHndler
- );
-
- m_bInCustomModeUpdateCmdUI = false;
- return true;
- }
- LRESULT CExtControlBar::OnIdleUpdateCmdUI( WPARAM wParam, LPARAM )
- {
- if( CExtControlBar::_DraggingGetBar() != NULL )
- return 0L;
- if( CExtControlBar::ProfileBarStateIsSerializing( m_pDockSite ) )
- return 0L;
- BOOL bVis = GetStyle() & WS_VISIBLE;
- UINT swpFlags = 0;
- if( ( m_nStateFlags & delayHide ) && bVis )
- swpFlags = SWP_HIDEWINDOW;
- else if( ( m_nStateFlags & delayShow ) && ( ! bVis ) )
- swpFlags = SWP_SHOWWINDOW;
- m_nStateFlags &= ~(delayShow|delayHide);
- if( swpFlags != 0 )
- {
- SetWindowPos(
- NULL, 0, 0, 0, 0,
- swpFlags|
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE
- );
- }
- if( m_bUseInvisibleCmdUI
- || ( ( GetStyle() & WS_VISIBLE ) != 0
- && ( m_pDockBar == NULL
- || ( m_pDockBar->GetStyle() & WS_VISIBLE ) != 0
- )
- )
- )
- {
- CFrameWnd * pTarget = (CFrameWnd*)GetOwner();
- if( pTarget == NULL || ( ! pTarget->IsFrameWnd() ) )
- pTarget = GetParentFrame();
- if( pTarget != NULL )
- OnUpdateCmdUI( pTarget, (BOOL)wParam );
- }
- return 0L;
- }
- void CExtControlBar::OnInitialUpdate()
- {
- OnIdleUpdateCmdUI( TRUE, 0L );
- }
- void CExtControlBar::OnUpdateCmdUI(
- CFrameWnd * pTarget,
- BOOL bDisableIfNoHndler
- )
- {
- if( m_bPresubclassDialogMode
- || m_bDragging || m_bRowRecalcing || m_bRowResizing
- || (CExtControlBar::_DraggingGetBar() != NULL)
- )
- return;
- pTarget;
- bDisableIfNoHndler;
- if( ( GetStyle() & WS_VISIBLE ) == 0
- && ( ! m_bUseInvisibleCmdUI )
- )
- return;
- CPoint ptScreen;
- if( ! ::GetCursorPos( &ptScreen ) )
- return;
- bool bNeedRepaint = false;
- UINT nHT = NcButtons_HitTest( ptScreen );
- if( nHT == HTCLIENT )
- {
- if( m_bNcAreaBtnTracking )
- bNeedRepaint = true;
- m_bNcAreaBtnTracking = false;
- if( ( ! CExtPopupMenuWnd::IsKeyPressed( VK_LBUTTON ) )
- && GetSafeHwnd() != NULL
- && ::GetCapture() == m_hWnd
- )
- ::ReleaseCapture();
- } // if( nHT == HTCLIENT )
- else
- {
- if( ! m_bNcAreaBtnTracking )
- bNeedRepaint = true;
- m_bNcAreaBtnTracking = true;
- } // else from if( nHT == HTCLIENT )
- HWND hTmpWndFocus = ::GetFocus();
- bool bWindowActiveOldVal = m_bWindowActive;
- m_bWindowActive =
- ( hTmpWndFocus != NULL
- && ( GetSafeHwnd() == hTmpWndFocus
- || ::IsChild( GetSafeHwnd(), hTmpWndFocus )
- )
- );
- if( bWindowActiveOldVal != m_bWindowActive )
- bNeedRepaint = true;
- if( bNeedRepaint )
- {
- SendMessage( WM_NCPAINT );
- GetParent()->SendMessage( WM_NCPAINT );
- if( IsVisible() )
- {
- CFrameWnd * pFrame = GetParentFrame();
- if( pFrame->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) ) )
- pFrame->SendMessage( WM_NCPAINT );
- }
- }
- }
- bool CExtControlBar::IsBarWindowActive() const
- {
- ASSERT_VALID( this );
- return m_bWindowActive;
- }
- void CExtControlBar::_RecalcNcArea()
- {
- if( !IsVisible() )
- return;
- SetWindowPos(
- NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE
- |SWP_NOZORDER|SWP_NOOWNERZORDER
- |SWP_NOREPOSITION
- |SWP_FRAMECHANGED
- );
- }
- void CExtControlBar::_RecalcLayoutImpl()
- {
- if( ! m_bReflectParentSizing )
- return;
- if( m_bPresubclassDialogMode )
- return;
- CWnd * pWndParent = GetParentFrame();
- if( pWndParent == NULL
- || pWndParent->GetSafeHwnd() == NULL
- )
- return;
- WINDOWPLACEMENT _wp;
- ZeroMemory( &_wp, sizeof(WINDOWPLACEMENT) );
- _wp.length = sizeof(WINDOWPLACEMENT);
- InternalFriendlyFrameWnd * pFrame = (InternalFriendlyFrameWnd *)
- ( DYNAMIC_DOWNCAST( CFrameWnd, pWndParent ) );
- if( pFrame == NULL
- || pFrame->IsInRecalcLayout()
- )
- return;
- CWnd * pWndPlacement = stat_GetWndForPlacement( pWndParent );
- ASSERT_VALID( pWndPlacement );
- // pWndPlacement->GetWindowPlacement( &_wp );
- CExtControlBar::stat_GetWindowPlacement( pWndPlacement->m_hWnd, _wp );
- if( _wp.showCmd == SW_SHOWMINIMIZED )
- {
- //pFrame->DelayRecalcLayout();
- return;
- }
- if( IsFixedMode()
- && IsFloating()
- && (! CExtControlBar::ProfileBarStateIsSerializing( pFrame ) )
- && (pFrame->GetStyle()&WS_VISIBLE) != 0
- )
- pFrame->RecalcLayout();
- else
- pFrame->DelayRecalcLayout();
- }
- void CExtControlBar::OnGetBarCaptionText(
- CExtControlBar::e_bar_caption_text_t eBCT,
- CExtSafeString & strCaptionText
- ) const
- {
- ASSERT_VALID( this );
- eBCT;
- strCaptionText.Empty();
- if( GetSafeHwnd() == NULL )
- return;
- int nTextLen = GetWindowTextLength();
- if( nTextLen > 0 )
- {
- GetWindowText( strCaptionText.GetBuffer( nTextLen+2 ), nTextLen+1 );
- strCaptionText.ReleaseBuffer();
- } // if( nTextLen > 0 )
- // switch( eBCT )
- // {
- // case __EBCT_SINGLE_CAPTION_DOCKED:
- // strCaptionText += _T(" (1d)");
- // break;
- // case __EBCT_SINGLE_CAPTION_FLOATING:
- // strCaptionText += _T(" (1f)");
- // break;
- // case __EBCT_TAB_GROUP_CAPTION_DOCKED:
- // strCaptionText += _T(" (td)");
- // break;
- // case __EBCT_TAB_GROUP_CAPTION_FLOATING:
- // strCaptionText += _T(" (tf)");
- // break;
- // case __EBCT_TAB_ITEM_CAPTION:
- // strCaptionText += _T(" (ti)");
- // break;
- // case __EBCT_AUTOHIDE_ITEM_CAPTION:
- // strCaptionText += _T(" (ai)");
- // break;
- // case __EBCT_AUTOHIDE_SLIDER_CAPTION:
- // strCaptionText += _T(" (ac)");
- // break;
- // default:
- // {
- // ASSERT( FALSE );
- // }
- // break;
- // } // switch( eBCT )
- }
- void CExtControlBar::PostNcDestroy()
- {
- if( m_bHelperSuppressDestruction )
- return;
- CControlBar::PostNcDestroy();
- }
- BOOL CExtControlBar::DestroyWindow()
- {
- AnimationSite_Done();
- if( m_hWnd == NULL )
- {
- // if( m_bHelperSuppressDestruction )
- // delete this;
- return TRUE;
- }
- return CControlBar::DestroyWindow();
- }
- LRESULT CExtControlBar::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
- {
- switch( message )
- {
- case WM_NCMOUSEMOVE:
- {
- if( ! OnQueryBarHoverProcessingEnabled() )
- return 0;
- CExtPopupMenuTipWnd * pATTW =
- OnAdvancedPopupMenuTipWndGet();
- if( pATTW == NULL )
- return 0;
- CPoint ptScreen;
- if( ! ::GetCursorPos(&ptScreen) )
- return 0;
- CExtBarNcAreaButton * pBtn = NULL;
- NcButtons_HitTest( ptScreen, &pBtn );
- if( pBtn != NULL )
- {
- ASSERT_VALID( pBtn );
- TOOLINFO _ti;
- ::memset( &_ti, 0, sizeof(AFX_OLDTOOLINFO) );
- _ti.cbSize = sizeof( TOOLINFO );
- _ti.hinst = ::AfxGetInstanceHandle();
- if( pBtn->OnToolHitTest( ptScreen, &_ti ) > 0 )
- {
- if( _ti.lpszText != NULL
- && _ti.lpszText != LPSTR_TEXTCALLBACK
- && _tcslen( _ti.lpszText ) > 0
- )