ExtControlBar.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:775k
- abs( (ptMouseCurrent.y - ptMouseStart.y) )
- );
- if( sizeMouseShift.cx >= sizeWaitMouseMove.cx
- || sizeMouseShift.cy >= sizeWaitMouseMove.cy
- )
- {
- bMouseShiftDetected = true;
- break; // start dragging
- }
- PeekMessage( &msg, hWndOwn, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE );
- continue;
- } // if( msg.message == WM_MOUSEMOVE )
- switch( msg.message )
- {
- case WM_CAPTURECHANGED:
- if( ((HWND)msg.lParam) != hWndOwn )
- {
- bEnableStartDragging = false;
- break;
- } // if( ((HWND)msg.lParam) != hWndOwn )
- continue;
- case WM_CANCELMODE:
- case WM_ACTIVATEAPP:
- case WM_CONTEXTMENU:
- bEnableStartDragging = false;
- break;
- default:
- if( ( WM_KEYFIRST <= msg.message
- && msg.message <= WM_KEYLAST
- )
- || ( __EXT_MFC_WM_MOUSEFIRST <= msg.message
- && msg.message <= __EXT_MFC_WM_MOUSELAST
- )
- )
- {
- if( msg.message == WM_KEYDOWN && msg.wParam == VK_CONTROL )
- {
- PeekMessage( &msg, msg.hwnd, msg.message, msg.message, PM_REMOVE );
- continue;
- }
- bEnableStartDragging = false;
- }
- break;
- } // switch( msg.message )
- } // if( msg.hwnd == hWndOwn )
- else
- {
- switch( msg.message )
- {
- case WM_CANCELMODE:
- case WM_ACTIVATEAPP:
- case WM_CONTEXTMENU:
- bEnableStartDragging = false;
- break;
- default:
- if( ( WM_KEYFIRST <= msg.message
- && msg.message <= WM_KEYLAST
- )
- || ( __EXT_MFC_WM_MOUSEFIRST <= msg.message
- && msg.message <= __EXT_MFC_WM_MOUSELAST
- )
- )
- {
- if( msg.message == WM_KEYDOWN && msg.wParam == VK_CONTROL )
- {
- PeekMessage( &msg, msg.hwnd, msg.message, msg.message, PM_REMOVE );
- continue;
- }
- bEnableStartDragging = false;
- }
- break;
- } // switch( msg.message )
- } // else from if( msg.hwnd == hWndOwn )
- } // if( ::IsWindow(hWndOwn) )
- else
- bEnableStartDragging = false;
- if( ! bEnableStartDragging )
- break;
- if( !AfxGetThread()->PumpMessage() )
- {
- PostQuitMessage(0);
- break; // Signal WM_QUIT received
- } // if( !AfxGetThread()->PumpMessage() )
- if( ! ( ::IsWindow(hWndOwn) ) )
- {
- bEnableStartDragging = false;
- break;
- }
- if( CExtControlBar::g_bEnableOnIdleCalls )
- {
- for( LONG nIdleCounter = 0L;
- ::AfxGetThread()->OnIdle(nIdleCounter);
- nIdleCounter ++
- );
- } // if( CExtControlBar::g_bEnableOnIdleCalls )
- if( ! ( ::IsWindow(hWndOwn) ) )
- {
- bEnableStartDragging = false;
- break;
- }
- ::WaitMessage();
- } // wait any mouse movement look
- } // for( ; bEnableStartDragging && (!bMouseShiftDetected); )
- if( ! bMouseShiftDetected )
- bEnableStartDragging = false;
- if( ! bEnableStartDragging )
- {
- if( ::IsWindow(hWndOwn)
- && CExtMouseCaptureSink::GetCapture() == hWndOwn
- )
- CExtMouseCaptureSink::ReleaseCapture();
- m_bDragDetecting = false;
- return;
- } // if( ! bEnableStartDragging )
- } // if( sizeWaitMouseMove.cx > 0 && sizeWaitMouseMove.cy > 0 )
- //ASSERT( CExtMouseCaptureSink::GetCapture() == hWndOwn );
- CExtMouseCaptureSink::SetCapture( hWndOwn );
- _SetCursor( point );
- m_bDragDetecting = false;
- ASSERT( g_DragStateOld.IsEmpty() );
- ASSERT( g_DragStateNew.IsEmpty() );
- g_DragStateOld.ExtBarSrcSet( this );
- g_DragStateNew.ExtBarSrcSet( this );
- g_DragStateNew.SetEmpty( false );
- ASSERT( m_pDockBar != NULL );
- ASSERT( m_pDockContext != NULL );
- _OnControlBarPositionChange_RedockingImpl(
- this,
- __ECBPC_REDOCKING,
- true,
- false
- );
- _Dragging_OnStart();
- /// CExtMouseCaptureSink::SetCapture( GetSafeHwnd() ); // (- v.2.24)
- m_bDragging = true;
- CRect rcGrip = _RectGripGet();
- INT nCyGripper = min( rcGrip.Width(), rcGrip.Height() );
- CPoint ptHelperDragOffsetDefault(
- ( nCyGripper > 2 )
- ? nCyGripper
- : ( ::GetSystemMetrics(SM_CYSMCAPTION) / 2 )
- ,
- ( nCyGripper > 2 )
- ? ( nCyGripper / 2 )
- : ( ::GetSystemMetrics(SM_CYSMCAPTION) / 2 )
- );
- m_ptHelperDragOffsetFloated = ptHelperDragOffsetDefault;
- m_ptHelperDragOffsetDockedH = ptHelperDragOffsetDefault;
- m_ptHelperDragOffsetDockedV = ptHelperDragOffsetDefault;
- if( pointOffset.x != 0 || pointOffset.y != 0 )
- {
- if( IsFloating() )
- m_ptHelperDragOffsetFloated = pointOffset;
- else if( IsDockedHorizontally() )
- m_ptHelperDragOffsetDockedH = pointOffset;
- else
- m_ptHelperDragOffsetDockedV = pointOffset;
- } // if( pointOffset.x != 0 || pointOffset.y != 0 )
- bool bInitialUpdateDraggingState = true;
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- eResizablePanelDockingType_t eResizablePanelDockingType =
- OnQueryDockingType();
- if( (! IsFixedMode() )
- && (! IsFixedDockStyle() )
- )
- {
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- {
- _DraggingUpdateState(
- point,
- CExtPopupMenuWnd::IsKeyPressed(VK_CONTROL) ? true : false
- );
- if( g_DragStateNew.GetCDT() == __ECDT_FLOATED )
- _DraggingApplyState( g_DragStateNew, false );
- bInitialUpdateDraggingState = false;
- ASSERT_VALID( m_pDockSite );
- CExtDynDockMarkerWnd::CreateOuterMarkers(
- m_pDockSite,
- false,
- PmBridge_GetPM()
- );
- // CExtDynDockMarkerWnd::CreateInnerMarkers(
- // m_pDockSite
- // );
- CExtDynDockMarkerWnd::CreateDynamicMarkers(
- m_pDockSite,
- false,
- PmBridge_GetPM()
- );
- } // if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- }
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( bInitialUpdateDraggingState )
- {
- _DraggingUpdateState(
- point,
- CExtPopupMenuWnd::IsKeyPressed(VK_CONTROL) ? true : false
- );
- _OnControlBarPositionChange_RedockingImpl(
- this,
- __ECBPC_REDOCKING,
- false,
- false
- );
- }
- ASSERT( hWndOwn != NULL && ::IsWindow(hWndOwn) );
- ::SetTimer( hWndOwn, __TIMER_ID_DRAGGING_START, 50, NULL );
- while( m_bDragging && ::IsWindow(hWndOwn) )
- {
- ::WaitMessage();
- // Process all the messages in the message queue
- while( ::IsWindow(hWndOwn) && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
- {
- bool bStop = false;
- switch( msg.message )
- {
- case WM_TIMER:
- if( UINT(msg.wParam) == __TIMER_ID_DRAGGING_START )
- {
- PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
- CPoint ptCursor( 0, 0 );
- ::GetCursorPos( &ptCursor );
- ScreenToClient( &ptCursor );
- PostMessage(
- WM_MOUSEMOVE,
- (msg.message == WM_KEYDOWN) ? (VK_CONTROL) : 0L,
- MAKELPARAM( ptCursor.x, ptCursor.y )
- );
- continue;
- } // if( UINT(msg.wParam) == __TIMER_ID_DRAGGING_START )
- break;
- case WM_ACTIVATEAPP:
- case WM_CANCELMODE:
- // case WM_LBUTTONUP:
- case WM_RBUTTONDOWN:
- case WM_NCLBUTTONUP:
- // case WM_NCLBUTTONDOWN:
- case WM_NCRBUTTONUP:
- case WM_NCRBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_MBUTTONUP:
- case WM_NCMBUTTONDOWN:
- case WM_NCMBUTTONUP:
- case WM_CONTEXTMENU:
- bStop = true;
- break;
- case WM_MOUSEMOVE:
- {
- PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE);
- for( ; PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOREMOVE); )
- PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE);
- CPoint pt( (DWORD)msg.lParam );
- if( msg.hwnd != m_hWnd )
- {
- ::ClientToScreen( msg.hwnd, &pt );
- ::ScreenToClient( m_hWnd, &pt );
- }
- if( _OnMouseMoveMsg((UINT)msg.wParam,pt) )
- {
- _OnControlBarPositionChange_RedockingImpl(
- this,
- __ECBPC_REDOCKING,
- false,
- false
- );
- //PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
- continue;
- } // if( pTestBar->_OnMouseMoveMsg((UINT)msg.wParam,pt) )
- }
- default:
- if( WM_KEYFIRST <= msg.message
- && msg.message <= WM_KEYLAST
- )
- {
- if( g_bUpdatingDragState )
- break;
- if( ( msg.message == WM_KEYDOWN
- || msg.message == WM_KEYUP )
- && msg.wParam == VK_CONTROL
- )
- {
- CPoint ptCursor( 0, 0 );
- ::GetCursorPos( &ptCursor );
- if( m_ptDraggingLast == ptCursor )
- m_ptDraggingLast.x --;
- ScreenToClient( &ptCursor );
- PostMessage(
- WM_MOUSEMOVE,
- (msg.message == WM_KEYDOWN) ? (VK_CONTROL) : 0L,
- MAKELPARAM( ptCursor.x, ptCursor.y )
- );
- break;
- }
- bStop = true;
- }
- else
- {
- if( CExtMouseCaptureSink::GetCapture() != GetSafeHwnd() )
- bStop = true;
- else
- {
- if( (!CExtPopupMenuWnd::
- IsKeyPressed(VK_LBUTTON))
- || CExtPopupMenuWnd::
- IsKeyPressed(VK_RBUTTON)
- || CExtPopupMenuWnd::
- IsKeyPressed(VK_MBUTTON)
- )
- bStop = true;
- }
- }
- break;
- } // switch( msg.message )
- if( ! ( ::IsWindow(hWndOwn) ) )
- break;
- if( bStop )
- {
- _DraggingStop( true );
- break;
- }
- if( !AfxGetThread()->PumpMessage() )
- {
- PostQuitMessage(0);
- break; // Signal WM_QUIT received
- } // if( !AfxGetThread()->PumpMessage() )
- } // while( ::IsWindow(hWndOwn) && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
- if( ! ( ::IsWindow(hWndOwn) ) )
- break;
- if( m_bDragging && CExtControlBar::g_bEnableOnIdleCalls )
- {
- for( LONG nIdleCounter = 0L;
- ::AfxGetThread()->OnIdle(nIdleCounter);
- nIdleCounter ++
- );
- }
- } // while( m_bDragging && ::IsWindow(hWndOwn) )
- if( ::IsWindow(hWndOwn) )
- {
- ::KillTimer( hWndOwn, __TIMER_ID_DRAGGING_START );
- _OnControlBarPositionChange_RedockingImpl(
- this,
- __ECBPC_REDOCKING,
- false,
- true
- );
- }
- }
- void CExtControlBar::_DraggingStop( bool bCancel )
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CExtDynDockMarkerWnd::DestroyAllMarkers();
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- ASSERT( !m_bRowRecalcing );
- ASSERT( !m_bRowResizing );
- //ASSERT( m_bDragging );
- if( !m_bDragging )
- return;
- HWND hWndOwn = GetSafeHwnd();
- ASSERT( hWndOwn != NULL );
- ASSERT( ::IsWindow(hWndOwn) );
- m_bDragging = false;
- m_ptDraggingLast.x = m_ptDraggingLast.y = -1;
- bool bEmptyOld = g_DragStateOld.IsEmpty();
- bool bOldEqualNew =
- (g_DragStateOld == g_DragStateNew)
- ? true : false;
-
- // g_DragStateOld.ExtBarDstSet( NULL );
- //HWND hWndDstBar = g_DragStateNew.ExtBarDstGet()->GetSafeHwnd();
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- eResizablePanelDockingType_t eResizablePanelDockingType =
- OnQueryDockingType();
- if( bCancel
- && INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- )
- bCancel = false;
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( !g_DragStateNew.IsEmpty() )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- e_calc_dock_type_t eCDT = g_DragStateNew.GetCDT();
- if( eCDT != __ECDT_TABBED_UPDATE
- && eCDT != __ECDT_TABBED_REINDEX
- && eCDT != __ECDT_TABBED_REINDEX_NHM
- )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtPaintManager::stat_PassPaintMessages();
- g_DragStateNew.DrawState( true );
- _Dragging_OnStop(
- g_DragStateOld,
- g_DragStateNew,
- bCancel
- );
-
- if( !bCancel )
- {
- if( _IsShowContentWhenDragging() )
- {
- if( (!bEmptyOld) && (!bOldEqualNew) )
- _DraggingApplyState( g_DragStateNew, true );
- else
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- _DraggingApplyState( g_DragStateNew, true );
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- }
- } // if( _IsShowContentWhenDragging() )
- else
- {
- /// g_DragStateOld.SetEmpty();
- _DraggingApplyState( g_DragStateNew, true );
- } // else from if( _IsShowContentWhenDragging() )
- } // if( !bCancel )
- }
- // g_DragStateNew.ExtBarDstSet(
- // NULL,
- // ( ::IsWindow(hWndDstBar) ) ? false : true
- // );
- g_DragStateOld.ExtBarDstSet( NULL, true );
- g_DragStateNew.ExtBarDstSet( NULL, true );
- g_DragStateOld.SetEmpty();
- g_DragStateNew.SetEmpty();
- if( ::IsWindow(hWndOwn) )
- {
- ASSERT_VALID( this );
- if( CExtMouseCaptureSink::GetCapture() == GetSafeHwnd() )
- CExtMouseCaptureSink::ReleaseCapture();
- if( IsFloating()
- && ( ! _IsShowContentWhenDragging() )
- )
- RedrawWindow(
- NULL, NULL,
- RDW_INVALIDATE //|RDW_UPDATENOW
- |RDW_ERASE //|RDW_ERASENOW
- |RDW_ALLCHILDREN
- );
- if( bCancel )
- m_pDockSite->DelayRecalcLayout();
- } // if( ::IsWindow(hWndOwn) )
- }
- CExtControlBar::InternalDraggingState_t
- CExtControlBar::g_DragStateOld;
- CExtControlBar::InternalDraggingState_t
- CExtControlBar::g_DragStateNew;
- bool CExtControlBar::g_bUpdatingDragState = false;
- void CExtControlBar::_DraggingUpdateState(
- const CPoint & point,
- bool bForceFloatMode
- )
- {
- if( CExtMouseCaptureSink::GetCapture() != GetSafeHwnd() )
- return;
- if( g_bUpdatingDragState || m_ptDraggingLast == point )
- return;
- // if( !IsFloating() )
- // {
- // bool bHorz = IsDockedHorizontally();
- // if( bHorz
- // && abs(m_ptDraggingLast.y-point.y) < 3
- // && m_ptDraggingLast.x == point.x
- // )
- // return;
- // if( abs(m_ptDraggingLast.x-point.x) < 3
- // && m_ptDraggingLast.y == point.y
- // )
- // return;
- // }
- m_ptDraggingLast = point;
- g_bUpdatingDragState = true;
- ASSERT( !m_bRowRecalcing );
- ASSERT( !m_bRowResizing );
- ASSERT( m_bDragging );
- eResizablePanelDockingType_t eResizablePanelDockingType =
- OnQueryDockingType();
- g_DragStateNew.CalcStateDynamic( point, bForceFloatMode );
- if( g_DragStateNew != g_DragStateOld )
- {
- bool bShowContent = _IsShowContentWhenDragging();
- bool bEmptyOld = g_DragStateOld.IsEmpty();
- bool bEmptyNew = g_DragStateNew.IsEmpty();
- if( ! bEmptyOld )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- e_calc_dock_type_t eCDT = g_DragStateOld.GetCDT();
- if( ! ( (!bEmptyNew)
- && ( eCDT == __ECDT_TABBED_REINDEX
- || eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- && g_DragStateOld.ExtBarDstGet() == g_DragStateNew.ExtBarDstGet()
- )
- )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( eCDT != __ECDT_TABBED_UPDATE
- && eCDT != __ECDT_TABBED_REINDEX
- && eCDT != __ECDT_TABBED_REINDEX_NHM
- )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtPaintManager::stat_PassPaintMessages();
- g_DragStateOld.DrawState( true );
- CExtPaintManager::stat_PassPaintMessages();
- }
- } // if( ! bEmptyOld )
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CFrameWnd * pFrame = g_DragStateOld.ExtBarSrcGet()->m_pDockSite;
- ASSERT_VALID( pFrame );
- POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CControlBar * pBar = (CControlBar *)
- pFrame->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pBar );
- if( pBar->GetSafeHwnd() == NULL
- || ( ! ::IsWindow( pBar->GetSafeHwnd() ) )
- || ( ! pBar->IsVisible() )
- )
- continue;
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST(
- CExtDynTabControlBar,
- pBar
- );
- if( pTabbedBar == NULL )
- continue;
- pTabbedBar->InvalidateSwitcher();
- }
- if( (!bEmptyOld) && (!bEmptyNew) )
- {
- e_calc_dock_type_t eCDT = g_DragStateOld.GetCDT();
- if( ( eCDT == __ECDT_TABBED_UPDATE
- || eCDT == __ECDT_TABBED_REINDEX
- || eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- //&& g_DragStateOld.ExtBarDstGet() != g_DragStateNew.ExtBarDstGet()
- )
- {
- g_DragStateOld.ExtBarDstSet( NULL );
- }
- } // if( (!bEmptyOld) && (!bEmptyNew) )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
-
- if( ! bEmptyNew )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- e_calc_dock_type_t eCDT = g_DragStateNew.GetCDT();
- if( eCDT != __ECDT_TABBED_UPDATE
- && eCDT != __ECDT_TABBED_REINDEX
- && eCDT != __ECDT_TABBED_REINDEX_NHM
- )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtPaintManager::stat_PassPaintMessages();
- g_DragStateNew.DrawState( false );
- }
- if( bShowContent )
- {
- bool bDoApply = true;
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- e_calc_dock_type_t eCDT = g_DragStateNew.GetCDT();
- if( eCDT == __ECDT_TABBED_UPDATE
- || eCDT == __ECDT_TABBED_REINDEX
- || eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- {
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- {
- //if( eCDT != __ECDT_TABBED_REINDEX_NHM )
- bDoApply = false;
- CExtDynDockMarkerWnd::UnHighlightAllMarkers();
- }
- if( eCDT != __ECDT_TABBED_REINDEX_NHM )
- CExtDynDockMarkerWnd::ShowAllMarkers( false );
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && ( ! IsFixedDockStyle() )
- && ( ! IsFixedMode() )
- )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- if( eCDT != __ECDT_2005_BAR_NEW_TAB )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- {
- CExtDynDockMarkerWnd::CreateDynamicMarkers(
- m_pDockSite,
- false,
- PmBridge_GetPM()
- );
- if( ! bForceFloatMode )
- CExtDynDockMarkerWnd::ShowAllMarkers( true );
- } // if( eCDT != __ECDT_2005_BAR_NEW_TAB )
- }
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( bDoApply
- && (! g_DragStateOld.IsEmpty() )
- && g_DragStateOld != g_DragStateNew
- )
- _DraggingApplyState( g_DragStateNew, false );
- } // if( bShowContent )
- g_DragStateOld = g_DragStateNew;
-
- } // if( g_DragStateNew != g_DragStateOld )
- else
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( bForceFloatMode )
- CExtDynDockMarkerWnd::ShowAllMarkers( false );
- else
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- e_calc_dock_type_t eCDT = g_DragStateNew.GetCDT();
- if( eCDT == __ECDT_TABBED_UPDATE
- || eCDT == __ECDT_TABBED_REINDEX
- || eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- {
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- CExtDynDockMarkerWnd::UnHighlightAllMarkers();
- if( eCDT != __ECDT_TABBED_REINDEX_NHM )
- CExtDynDockMarkerWnd::ShowAllMarkers( false );
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && ( ! IsFixedDockStyle() )
- && ( ! IsFixedMode() )
- )
- {
- CExtDynDockMarkerWnd::CreateDynamicMarkers(
- m_pDockSite,
- false,
- PmBridge_GetPM()
- );
- CExtDynDockMarkerWnd::ShowAllMarkers( true );
- }
- } // else from if( bForceFloatMode )
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CExtPaintManager::stat_PassPaintMessages();
- } // else from if( g_DragStateNew != g_DragStateOld )
- MSG msg;
- while( ::PeekMessage( &msg, NULL, WM_TIMER, WM_TIMER, PM_NOREMOVE ) )
- {
- if( ! ::GetMessage( &msg, NULL, WM_TIMER, WM_TIMER ) )
- break;
- ::DispatchMessage( &msg );
- }
- eResizablePanelDockingType;
- if( CExtMouseCaptureSink::GetCapture() != GetSafeHwnd() )
- CExtMouseCaptureSink::SetCapture( GetSafeHwnd() );
- g_bUpdatingDragState = false;
- }
- bool CExtControlBar::NcButtons_HandleClick(
- CExtBarNcAreaButton * pNcAreaButton,
- CPoint point,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- #ifdef _DEBUG
- if( pBarEventSource != NULL )
- {
- ASSERT_VALID( pNcAreaButton );
- }
- if( pBarEventSource != NULL )
- {
- ASSERT_VALID( pBarEventSource );
- }
- #endif // _DEBUG
- pNcAreaButton;
- point;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- void CExtControlBar::NcButtons_PostClick(
- CExtBarNcAreaButton * pNcAreaButton,
- CPoint point,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- #ifdef _DEBUG
- if( pBarEventSource != NULL )
- {
- ASSERT_VALID( pNcAreaButton );
- }
- if( pBarEventSource != NULL )
- {
- ASSERT_VALID( pBarEventSource );
- }
- #endif // _DEBUG
- pNcAreaButton;
- point;
- pBarEventSource;
- pBarActiveInContainer;
- }
- bool CExtControlBar::NcButtons_HandleQueryVisibility(
- bool & bButtonIsVisible,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- bButtonIsVisible;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- bool CExtControlBar::NcButtons_HandleDraw(
- CDC & dc,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- dc;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- bool CExtControlBar::NcButtons_HandleHitTest(
- UINT & nExternalHT,
- CPoint point,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- nExternalHT;
- point;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- bool CExtControlBar::NcButtons_HandleQueryCursor(
- HCURSOR & hExternalCursor,
- CPoint point,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- hExternalCursor;
- point;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- bool CExtControlBar::NcButtons_HandleReposition(
- CExtBarNcAreaButton * pPrevBtn,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pPrevBtn != NULL )
- {
- ASSERT_VALID( pPrevBtn );
- }
- #endif // (defined _DEBUG)
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- pPrevBtn;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- bool CExtControlBar::NcButtons_HandleToolHitTest(
- __EXT_MFC_INT_PTR & hExternalToolHT,
- CPoint point,
- TOOLINFO * pTI,
- CExtBarNcAreaButton * pNcAreaButton,
- CExtControlBar * pBarEventSource,
- CExtControlBar * pBarActiveInContainer
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pNcAreaButton );
- ASSERT_VALID( pBarEventSource );
- #if (defined _DEBUG)
- if( pBarActiveInContainer != NULL )
- {
- ASSERT_VALID( pBarActiveInContainer );
- }
- #endif // (defined _DEBUG)
- hExternalToolHT;
- point;
- pTI;
- pNcAreaButton;
- pBarEventSource;
- pBarActiveInContainer;
- return false;
- }
- void CExtControlBar::OnNcAreaButtonsReinitialize()
- {
- ASSERT_VALID( this );
- INT nCountOfNcButtons = NcButtons_GetCount();
- if( nCountOfNcButtons > 0 )
- return;
- NcButtons_Add( new CExtBarNcAreaButtonClose(this) );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- NcButtons_Add( new CExtBarNcAreaButtonAutoHide(this) );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // NcButtons_Add( new CExtBarNcAreaButtonExpand(this) );
- NcButtons_Add( new CExtBarNcAreaButtonMenu(this) );
- // NcButtons_Add( new CExtBarNcAreaButtonFloatingMaximizeRestore(this) );
- }
- void CExtControlBar::OnNcAreaButtonsReposition()
- {
- ASSERT_VALID( this );
- INT nBtn, nCountOfNcButtons = NcButtons_GetCount();
- CExtBarNcAreaButton * pPrevBtn = NULL;
- for( nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
- {
- CExtBarNcAreaButton * pBtn =
- NcButtons_GetAt( nBtn );
- ASSERT_VALID( pBtn );
- pBtn->OnNcAreaReposition( pPrevBtn );
- if( ! pBtn->OnQueryVisibility() )
- continue;
- pPrevBtn = pBtn;
- } // for( INT nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
- if( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 )
- {
- bool bHaveNcInfo = false;
- CRect rcGrip( 0, 0, 0, 0 );
- for( nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
- {
- CExtBarNcAreaButton * pBtn =
- NcButtons_GetAt( nBtn );
- ASSERT_VALID( pBtn );
- if( ! pBtn->OnQueryVisibility() )
- continue;
- if( ! bHaveNcInfo )
- {
- bool bGripperAtTop = false;
- if( ! pBtn->GetBarNcAreaInfo( &rcGrip, NULL, &bGripperAtTop ) )
- break;
- if( ! bGripperAtTop )
- break;
- bHaveNcInfo = true;
- } // if( ! bHaveNcInfo )
- pBtn->m_rc.OffsetRect(
- rcGrip.left - pBtn->m_rc.left
- + rcGrip.right - pBtn->m_rc.right
- ,
- 0
- );
- } // for( INT nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
- } // if( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 )
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButton
- IMPLEMENT_DYNCREATE( CExtBarNcAreaButton, CObject )
- CExtBarNcAreaButton::CExtBarNcAreaButton(
- CExtControlBar * pBar
- )
- : m_pBar( pBar )
- , m_rc( 0, 0, 0, 0 )
- , m_bHover( false )
- , m_bPushed( false )
- , m_bDisabled( false )
- , m_bPaintingCombinedArea( false )
- {
- ASSERT_VALID( this );
- }
- CExtBarNcAreaButton::~CExtBarNcAreaButton()
- {
- ASSERT_VALID( this );
- }
- void CExtBarNcAreaButton::OnNcDestroy()
- {
- ASSERT_VALID( this );
- delete this;
- }
- bool CExtBarNcAreaButton::IsBarFixedMode() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsFixedMode();
- }
- bool CExtBarNcAreaButton::IsBarVisible() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsVisible() ? true : false;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool CExtBarNcAreaButton::OnQueryDeactivateAutohideSlider() const
- {
- ASSERT_VALID( this );
- return true;
- }
- bool CExtBarNcAreaButton::IsBarAutoHideMode(
- bool * p_bDisplayed, // = NULL
- bool * p_bActive // = NULL
- ) const
- {
- ASSERT_VALID( this );
- if( p_bDisplayed != NULL )
- *p_bDisplayed = false;
- if( p_bActive != NULL )
- *p_bActive = false;
- bool bAutohide = m_pBar->AutoHideModeGet();
- if( !bAutohide )
- return false;
- if( p_bDisplayed != NULL || p_bActive != NULL )
- {
- ASSERT_VALID( m_pBar->m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pBar->m_pDockBar );
- CExtDynAutoHideArea * pWndAutoHideArea =
- ((CExtDockBar*)m_pBar->m_pDockBar)->_GetAutoHideArea();
- ASSERT_VALID( pWndAutoHideArea );
- if( pWndAutoHideArea->m_pWndSlider != NULL )
- {
- ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
- if( pWndAutoHideArea->m_pWndSlider->_GetBar() == m_pBar )
- {
- if( p_bDisplayed != NULL )
- *p_bDisplayed = true;
- if( p_bActive != NULL )
- *p_bActive = pWndAutoHideArea->m_pWndSlider->m_bWndActive;
- }
- }
- }
- return true;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool CExtBarNcAreaButton::IsBarFloated() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsFloating();
- }
- bool CExtBarNcAreaButton::IsBarDocked() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDocked();
- }
- bool CExtBarNcAreaButton::IsBarDockedHorizontally() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedHorizontally();
- }
- bool CExtBarNcAreaButton::IsBarDockedVertically() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedVertically();
- }
- bool CExtBarNcAreaButton::IsBarDockedAtLeft() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedAtLeft();
- }
- bool CExtBarNcAreaButton::IsBarDockedAtRight() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedAtRight();
- }
- bool CExtBarNcAreaButton::IsBarDockedAtTop() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedAtTop();
- }
- bool CExtBarNcAreaButton::IsBarDockedAtBottom() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsDockedAtBottom();
- }
- bool CExtBarNcAreaButton::GetBarNcAreaInfo( // returns false if no nc area on bar
- LPRECT pRectGripper, // = NULL // in window coords
- LPRECT pRectWnd, // = NULL // in screen coords
- bool * pbGripperAtTop, // = NULL
- bool * pbTextOnGripper // = NULL
- ) const
- {
- ASSERT_VALID( this );
- if( pRectGripper != NULL )
- ::SetRectEmpty( pRectGripper );
- if( pRectWnd != NULL )
- ::SetRectEmpty( pRectWnd );
-
- if( IsBarFloated() )
- {
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = false;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = false;
-
- CFrameWnd * pMiniFrame =
- m_pBar->GetDockingFrame();
- if( pRectWnd != NULL )
- pMiniFrame->GetWindowRect( pRectWnd );
- CExtMiniDockFrameWnd * pExtMiniFrame =
- DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pMiniFrame );
- if( pExtMiniFrame == NULL )
- return false;
-
- if( pRectGripper != NULL )
- {
- CRect rcGrip( pExtMiniFrame->m_rcFrameCaption );
- rcGrip.InflateRect( 2, 2, 1, 2 );
- *pRectGripper = rcGrip;
- }
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = true;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = true;
- return true;
- } // if( IsBarFloated() )
- if( pRectWnd != NULL )
- m_pBar->GetWindowRect( pRectWnd );
- if( ! m_pBar->IsFixedMode() )
- {
- CFrameWnd * pParentFrame = m_pBar->GetParentFrame();
- if( pParentFrame != NULL
- && pParentFrame->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd))
- )
- {
- if( m_pBar->_IsSingleVisibleInFloatingPalette() )
- {
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = false;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = false;
-
- if( pRectWnd != NULL )
- pParentFrame->GetWindowRect( pRectWnd );
- CExtMiniDockFrameWnd * pExtMiniFrame =
- STATIC_DOWNCAST( CExtMiniDockFrameWnd, pParentFrame );
-
- if( pRectGripper != NULL )
- {
- CRect rcGrip( pExtMiniFrame->m_rcFrameCaption );
- rcGrip.InflateRect( 2, 2, 1, 2 );
- *pRectGripper = rcGrip;
- }
- if( pbGripperAtTop != NULL )
- *pbGripperAtTop = true;
- if( pbTextOnGripper != NULL )
- *pbTextOnGripper = true;
- return true;
- }
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- else if( pRectWnd != NULL && IsBarAutoHideMode() )
- {
- CExtDynAutoHideArea * pTabs =
- CExtDynAutoHideArea::stat_FindAreaOfBar( m_pBar );
- if( pTabs != NULL )
- {
- CExtDynAutoHideSlider * pSlider =
- pTabs->GetAutoHideSlider();
- ASSERT_VALID( pSlider );
- pSlider->GetWindowRect( pRectWnd );
- } // if( pTabs != NULL )
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- bool bGrip =
- m_pBar->IsBarWithGripper(
- pbGripperAtTop,
- pbTextOnGripper
- );
- if( !bGrip )
- return false;
- if( pRectGripper != NULL )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_pBar->AutoHideModeGet() )
- {
- ASSERT_VALID( m_pBar->m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pBar->m_pDockBar );
- CExtDynAutoHideArea * pAutoHideArea =
- ((CExtDockBar*)m_pBar->m_pDockBar)->_GetAutoHideArea();
- ASSERT_VALID( pAutoHideArea );
- ASSERT_VALID( pAutoHideArea->m_pWndSlider );
- pAutoHideArea->m_pWndSlider->
- CalcInnerNcRects(
- NULL,
- NULL,
- pRectGripper
- );
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- *pRectGripper = m_pBar->_RectGripGet();
- }
- return true;
- }
- bool CExtBarNcAreaButton::IsBarWndActive() const
- {
- ASSERT_VALID( this );
-
- if( IsBarFloated() )
- {
- CFrameWnd * pMiniFrame =
- m_pBar->GetDockingFrame();
- CExtMiniDockFrameWnd * pExtMiniFrame =
- DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pMiniFrame );
- if( pExtMiniFrame == NULL )
- return false;
- HWND hTmpWndFocus = ::GetFocus();
- if( hTmpWndFocus != NULL
- && ( pExtMiniFrame->GetSafeHwnd() == hTmpWndFocus
- || ::IsChild( pExtMiniFrame->GetSafeHwnd(), hTmpWndFocus )
- )
- )
- return true;
- return false;
- } // if( IsBarFloated() )
- return m_pBar->IsBarWindowActive();
- }
- bool CExtBarNcAreaButton::IsBarSingleOnRow() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsSingleOnRow();
- }
- bool CExtBarNcAreaButton::IsBarMinimizedOnRow() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsMinimizedOnRow();
- }
- bool CExtBarNcAreaButton::IsBarMaximizedOnRow() const
- {
- ASSERT_VALID( this );
- return m_pBar->IsMaximizedOnRow();
- }
- bool CExtBarNcAreaButton::IsBarFirstOnRow( bool bExtBar ) const
- {
- ASSERT_VALID( this );
- return m_pBar->_IsFirstBarInRow( bExtBar );
- }
- bool CExtBarNcAreaButton::IsBarLastOnRow( bool bExtBar ) const
- {
- ASSERT_VALID( this );
- return m_pBar->_IsLastBarInRow( bExtBar );
- }
- CFrameWnd * CExtBarNcAreaButton::GetDockingFrame()
- {
- ASSERT_VALID( this );
- return m_pBar->_GetDockingFrameImpl();
- }
- void CExtBarNcAreaButton::OnNcAreaReposition(
- CExtBarNcAreaButton * pPrevBtn
- )
- {
- ASSERT_VALID( this );
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleReposition(
- pPrevBtn,
- this,
- pBar,
- NULL
- )
- )
- return;
- //m_bHover = m_bPushed = false;
- bool bGripperAtTop = false;
- CRect rcCaption;
- if( ! GetBarNcAreaInfo( &rcCaption, NULL, &bGripperAtTop ) )
- return;
- m_rc = rcCaption;
- const int _nGapToBordersH = 2;
- const int _nGapToBordersV = 3;
- const int _nGapBetweenButtons = 3;
- if( bGripperAtTop )
- {
- if( ! GetBar()->PmBridge_GetPM()->Bar_LayoutNcAreaButton(
- m_rc,
- rcCaption,
- this,
- pPrevBtn,
- this
- )
- )
- {
- m_rc.DeflateRect(
- _nGapToBordersH,
- _nGapToBordersV + 1,
- _nGapToBordersH,
- _nGapToBordersV
- );
- m_rc.left = m_rc.right - m_rc.Height();
- m_rc.OffsetRect( -1, 0 );
- if( pPrevBtn != NULL )
- {
- const CRect & rcPrev = *pPrevBtn;
- m_rc.OffsetRect(
- rcPrev.left - m_rc.right -
- _nGapBetweenButtons,
- 0
- );
- } // if( pPrevBtn != NULL )
- }
- } // if( bGripperAtTop )
- else
- {
- m_rc.DeflateRect(
- _nGapToBordersV,
- _nGapToBordersH
- );
- m_rc.bottom = m_rc.top + m_rc.Width();
- m_rc.OffsetRect( 0, 1 );
- if( pPrevBtn != NULL )
- {
- const CRect & rcPrev = *pPrevBtn;
- m_rc.OffsetRect(
- 0,
- - rcPrev.top + m_rc.bottom +
- _nGapBetweenButtons
- );
- } // if( pPrevBtn != NULL )
- } // else from if( bGripperAtTop )
- }
- bool CExtBarNcAreaButton::OnQueryVisibility() const
- {
- ASSERT_VALID( this );
- bool bButtonIsVisible = true;
- CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryVisibility(
- bButtonIsVisible,
- const_cast < CExtBarNcAreaButton * > ( this ),
- pBar,
- NULL
- )
- )
- return bButtonIsVisible;
- if( ! IsBarVisible() )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bool bDisplayed = false;
- if( IsBarAutoHideMode( &bDisplayed ) )
- {
- if( bDisplayed )
- return true;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- return false;
- }
- CRect rcGrip;
- if( ! GetBarNcAreaInfo( &rcGrip ) )
- return false;
- if( rcGrip.IsRectEmpty() )
- return false;
- return true;
- }
- void CExtBarNcAreaButton::NcDrawDefault(
- CDC & dc,
- int nDockBtnGlyptT
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- bool bMenuTracking =
- CExtPopupMenuWnd::IsMenuTracking() ? true : false;
- //bool bDrawActive = IsBarWndActive();
- // if( !bDrawActive )
- // IsBarAutoHideMode( NULL, &bDrawActive );
- bool bDrawActive = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( !IsBarAutoHideMode( NULL, &bDrawActive ) )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bDrawActive = IsBarWndActive();
- if( GetBar()->IsKindOf(RUNTIME_CLASS(CExtToolControlBar)) )
- bDrawActive = false;
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA _pdcbd(
- this,
- m_rc,
- (CExtPaintManager::e_docking_caption_button_t)nDockBtnGlyptT,
- (!m_bDisabled) && m_bHover && (!bMenuTracking) && (!m_bPaintingCombinedArea),
- (!m_bDisabled) && m_bPushed && (!bMenuTracking) && (!m_bPaintingCombinedArea),
- (!m_bDisabled),
- (!IsBarFixedMode()) || m_bPaintingCombinedArea,
- bDrawActive,
- IsBarFloated()
- );
- GetBar()->PmBridge_GetPM()->PaintDockingCaptionButton( dc, _pdcbd );
- }
- void CExtBarNcAreaButton::OnNcAreaDraw( CDC & dc )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleDraw(
- dc,
- this,
- pBar,
- NULL
- )
- )
- return;
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- dc.FillSolidRect( &m_rc, RGB(255,128,128) );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- dc;
- #endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- UINT CExtBarNcAreaButton::OnNcAreaHitTest( CPoint point )
- {
- ASSERT_VALID( this );
- UINT nExternalHT = HTNOWHERE;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleHitTest(
- nExternalHT,
- point,
- this,
- pBar,
- NULL
- )
- )
- return nExternalHT;
- if( m_rc.PtInRect( point ) )
- {
- m_bPushed =
- (
- CExtPopupMenuWnd::IsKeyPressed( VK_LBUTTON )
- && !CExtPopupMenuWnd::IsKeyPressed( VK_MBUTTON )
- && !CExtPopupMenuWnd::IsKeyPressed( VK_RBUTTON )
- )
- ? true : false;
- m_bHover = true;
- return HTNOWHERE;
- }
- m_bHover = m_bPushed = false;
- return HTCLIENT; // not inside nc-button
- }
- HCURSOR CExtBarNcAreaButton::OnNcAreaQueryCursor( CPoint point )
- {
- ASSERT_VALID( this );
- HCURSOR hExternalCursor = NULL;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryCursor(
- hExternalCursor,
- point,
- this,
- pBar,
- NULL
- )
- )
- return hExternalCursor;
- if( m_rc.PtInRect( point ) )
- return g_hCursorArrow;
- return NULL; // not inside nc-button
- }
- bool CExtBarNcAreaButton::OnNcAreaClicked( CPoint point )
- {
- ASSERT_VALID( this );
- CExtControlBar * pExtBar = GetBar();
- ASSERT_VALID( pExtBar );
- HWND hWndBar = pExtBar->GetSafeHwnd();
- if( pExtBar->NcButtons_HandleClick( this, point, pExtBar, NULL ) )
- return true;
- ASSERT_VALID( pExtBar );
- if( m_rc.PtInRect( point ) )
- return true;
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pExtBar->NcButtons_PostClick( this, point, pExtBar, NULL );
- return false; // continue asking nc-buttons
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButton::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
- __EXT_MFC_INT_PTR hExternalToolHT = -1;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleToolHitTest(
- hExternalToolHT,
- point,
- pTI,
- this,
- pBar,
- NULL
- )
- )
- return hExternalToolHT;
- point; // should be in button area
- pTI;
- return -1;
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButton::DoDefaultReflectForToolHitTest(
- TOOLINFO * pTI,
- UINT nIdResourceTooltipText,
- __EXT_MFC_SAFE_LPCTSTR sTooltipTextDefault
- )
- {
- ASSERT_VALID( this );
- ASSERT( sTooltipTextDefault != NULL );
- CExtLocalResourceHelper _LRH;
- CExtSafeString sTooltipText;
- if( ! g_ResourceManager->LoadString( sTooltipText, nIdResourceTooltipText ) )
- sTooltipText = sTooltipTextDefault;
-
- return
- DoDefaultReflectForToolHitTest(
- pTI,
- sTooltipText
- );
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButton::DoDefaultReflectForToolHitTest(
- TOOLINFO * pTI,
- __EXT_MFC_SAFE_LPCTSTR sTooltipText
- )
- {
- ASSERT_VALID( this );
- ASSERT( sTooltipText != NULL );
- CPoint point;
- if( ::GetCursorPos( &point ) )
- {
- __EXT_MFC_INT_PTR hExternalToolHT = -1;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleToolHitTest(
- hExternalToolHT,
- point,
- pTI,
- this,
- pBar,
- NULL
- )
- )
- return hExternalToolHT;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarAutoHideMode()
- && GetBar()->OnAdvancedPopupMenuTipWndGet() == NULL
- )
- return 0;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pTI != NULL )
- {
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- CPoint ptDevOffset( 0, 0 );
- if( pBar->IsFloating() )
- {
- CRect rcBarWnd, rcBarClient;
- CFrameWnd * pFrame = pBar->GetParentFrame();
- ASSERT_VALID( pFrame );
- pFrame->GetWindowRect( &rcBarWnd );
- pFrame->GetClientRect( &rcBarClient );
- pFrame->ClientToScreen( &rcBarClient );
- ptDevOffset =
- rcBarClient.TopLeft()
- - rcBarWnd.TopLeft();
- } // if( pBar->IsFloating() )
- else
- {
- CRect rcBarWnd, rcBarClient;
- pBar->GetWindowRect( &rcBarWnd );
- pBar->GetClientRect( &rcBarClient );
- pBar->ClientToScreen( &rcBarClient );
- ptDevOffset =
- rcBarClient.TopLeft()
- - rcBarWnd.TopLeft();
- } // else from if( pBar->IsFloating() )
- CRect rcArea = *this;
- rcArea.OffsetRect( -ptDevOffset );
-
- ::CopyRect(
- &(pTI->rect),
- &rcArea
- );
- __EXT_MFC_INT_PTR nCmdID = (__EXT_MFC_INT_PTR)pBar->GetDlgCtrlID();
-
- pTI->uId = (UINT)nCmdID;
- pTI->hwnd = pBar->GetSafeHwnd();
- pTI->lpszText = (LPTSTR)
- ::calloc(
- _tcslen(sTooltipText) + 1,
- sizeof(TCHAR)
- );
- if( pTI->lpszText != NULL )
- __EXT_MFC_STRCPY(
- pTI->lpszText,
- _tcslen(sTooltipText) + 1,
- sTooltipText
- );
- else
- pTI->lpszText = LPSTR_TEXTCALLBACK;
- return nCmdID;
- } // if( pTI != NULL )
-
- return -1;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButtonFloatingMaximizeRestore
- //
- //IMPLEMENT_DYNCREATE( CExtBarNcAreaButtonFloatingMaximizeRestore, CExtBarNcAreaButton )
- //
- //CExtBarNcAreaButtonFloatingMaximizeRestore::CExtBarNcAreaButtonFloatingMaximizeRestore(
- // CExtControlBar * pBar
- // )
- // : CExtBarNcAreaButton( pBar )
- //{
- //}
- //
- //bool CExtBarNcAreaButtonFloatingMaximizeRestore::OnQueryVisibility() const
- //{
- // ASSERT_VALID( this );
- //bool bButtonIsVisible = true;
- //CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- // ASSERT_VALID( pBar );
- // if( pBar->NcButtons_HandleQueryVisibility(
- // bButtonIsVisible,
- // const_cast < CExtBarNcAreaButton * > ( this ),
- // pBar,
- // NULL
- // )
- // )
- // return bButtonIsVisible;
- //
- // if( ! CExtBarNcAreaButton::OnQueryVisibility() )
- // return false;
- // if( IsBarFixedMode() || (! IsBarFloated() ) )
- // return false;
- //#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // if( IsBarAutoHideMode() )
- // return false;
- //#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // return true;
- //}
- //
- //void CExtBarNcAreaButtonFloatingMaximizeRestore::OnNcAreaDraw( CDC & dc )
- //{
- // ASSERT_VALID( this );
- // ASSERT( dc.GetSafeHdc() != NULL );
- // ASSERT( OnQueryVisibility() );
- // if( m_rc.IsRectEmpty() )
- // return;
- //
- //CExtControlBar * pBar = GetBar();
- // ASSERT_VALID( pBar );
- // if( pBar->NcButtons_HandleDraw(
- // dc,
- // this,
- // pBar,
- // NULL
- // )
- // )
- // return;
- //
- //#if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- //
- // dc.FillSolidRect( &m_rc, RGB(128,0,128) );
- //
- //#else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- //
- // m_bDisabled = false;
- // if( IsBarFixedMode() || (! IsBarFloated() ) )
- // m_bDisabled = true;
- //#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // else if( IsBarAutoHideMode() )
- // m_bDisabled = true;
- //#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- //
- //bool bBarIsInFloatingMaximizedState = IsBarInFloatingMaximizedState();
- // NcDrawDefault(
- // dc,
- // bBarIsInFloatingMaximizedState
- // ? CExtPaintManager::__DCBT_TREE_MINUS
- // : CExtPaintManager::__DCBT_TREE_PLUS
- // );
- //
- //#endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- //}
- //
- //UINT CExtBarNcAreaButtonFloatingMaximizeRestore::OnNcAreaHitTest( CPoint point )
- //{
- // ASSERT_VALID( this );
- //
- //UINT nExternalHT = HTNOWHERE;
- //CExtControlBar * pBar = GetBar();
- // ASSERT_VALID( pBar );
- // if( pBar->NcButtons_HandleHitTest(
- // nExternalHT,
- // point,
- // this,
- // pBar,
- // NULL
- // )
- // )
- // return nExternalHT;
- //
- //UINT nHT = CExtBarNcAreaButton::OnNcAreaHitTest( point );
- // if( nHT == HTCLIENT )
- // return HTCLIENT; // not inside nc-button
- //
- // if( IsBarFixedMode() || (! IsBarFloated() ) )
- // return HTCLIENT;
- //#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // if( IsBarAutoHideMode() )
- // return HTCLIENT;
- //#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- //
- // return HTMAXBUTTON;
- //}
- //
- //bool CExtBarNcAreaButtonFloatingMaximizeRestore::OnNcAreaClicked( CPoint point )
- //{
- // ASSERT_VALID( this );
- // if( ! m_rc.PtInRect( point ) )
- // return false; // continue asking nc-buttons
- //
- // m_bHover = m_bPushed = false;
- //CExtControlBar * pBar = GetBar();
- // ASSERT_VALID( pBar );
- //HWND hWndBar = pBar->GetSafeHwnd();
- // if( pBar->NcButtons_HandleClick( this, point, pBar, NULL ) )
- // return true;
- // ASSERT_VALID( pBar );
- //
- // if( IsBarFixedMode() || (! IsBarFloated() ) )
- // return false;
- //#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // if( IsBarAutoHideMode() )
- // {
- // if( hWndBar != NULL
- // && ::IsWindow( hWndBar )
- // )
- // pBar->NcButtons_PostClick( this, point, pBar, NULL );
- // return false;
- // }
- //#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- //
- //CFrameWnd * pFrameWnd = pBar->GetParentFrame();
- // ASSERT_VALID( pFrameWnd );
- // ASSERT_KINDOF( CMiniFrameWnd, pFrameWnd );
- //bool bBarIsInFloatingMaximizedState = IsBarInFloatingMaximizedState();
- // pFrameWnd->ShowWindow(
- // bBarIsInFloatingMaximizedState ? SW_RESTORE : SW_MAXIMIZE
- // );
- // pFrameWnd->SetWindowPos(
- // NULL, 0, 0, 0, 0,
- // SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE
- // |SWP_NOZORDER|SWP_NOOWNERZORDER
- // |SWP_FRAMECHANGED
- // );
- //CRect rcFrameClient, rcFrameWnd;
- // pFrameWnd->GetClientRect( &rcFrameClient );
- // pFrameWnd->GetWindowRect( &rcFrameWnd );
- //CSize sizeFrameClient = rcFrameClient.Size();
- // pBar->SetInitDesiredPosFloating( rcFrameWnd.TopLeft() );
- // pBar->SetInitDesiredSizeFloating( sizeFrameClient );
- // pBar->m_pDockContext->m_sizeLast = sizeFrameClient;
- // pBar->m_pDockContext->m_ptMRUFloatPos = rcFrameWnd.TopLeft();
- // pFrameWnd->RecalcLayout();
- // pBar->OnRepositionSingleChild( sizeFrameClient.cx, sizeFrameClient.cy, true );
- //
- // if( hWndBar != NULL
- // && ::IsWindow( hWndBar )
- // )
- // pBar->NcButtons_PostClick( this, point, pBar, NULL );
- // return true;
- //}
- //
- //__EXT_MFC_INT_PTR CExtBarNcAreaButtonFloatingMaximizeRestore::OnToolHitTest(
- // CPoint point,
- // TOOLINFO * pTI
- // )
- //{
- // ASSERT_VALID( this );
- //
- // point; // should be in button area
- //
- //bool bBarIsInFloatingMaximizedState = IsBarInFloatingMaximizedState();
- // return
- // DoDefaultReflectForToolHitTest(
- // pTI,
- // bBarIsInFloatingMaximizedState ? _T("Maximize") : _T("Restore")
- // );
- //}
- //
- //bool CExtBarNcAreaButtonFloatingMaximizeRestore::stat_IsBarInFloatingMaximizedState(
- // const CExtControlBar * pBar
- // )
- //{
- // if( pBar->GetSafeHwnd() == NULL )
- // return false;
- // if( ! pBar->IsFloating() )
- // return false;
- //CFrameWnd * pFrameWnd = pBar->GetParentFrame();
- // ASSERT_VALID( pFrameWnd );
- // ASSERT_KINDOF( CMiniFrameWnd, pFrameWnd );
- //WINDOWPLACEMENT _wp;
- // ::memset( &_wp, 0, sizeof(WINDOWPLACEMENT) );
- // _wp.length = sizeof(WINDOWPLACEMENT);
- // pFrameWnd->GetWindowPlacement( &_wp );
- //bool bBarIsInFloatingMaximizedState = ( _wp.showCmd == SW_SHOWMAXIMIZED ) ? true : false;
- // return bBarIsInFloatingMaximizedState;
- //}
- //
- //bool CExtBarNcAreaButtonFloatingMaximizeRestore::IsBarInFloatingMaximizedState() const
- //{
- // ASSERT_VALID( this );
- //bool bBarIsInFloatingMaximizedState = stat_IsBarInFloatingMaximizedState( GetBar() );
- // return bBarIsInFloatingMaximizedState;
- //}
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButtonExpand
- IMPLEMENT_DYNCREATE( CExtBarNcAreaButtonExpand, CExtBarNcAreaButton )
- CExtBarNcAreaButtonExpand::CExtBarNcAreaButtonExpand(
- CExtControlBar * pBar
- )
- : CExtBarNcAreaButton( pBar )
- {
- }
- bool CExtBarNcAreaButtonExpand::OnQueryVisibility() const
- {
- ASSERT_VALID( this );
- bool bButtonIsVisible = true;
- CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryVisibility(
- bButtonIsVisible,
- const_cast < CExtBarNcAreaButtonExpand * > ( this ),
- pBar,
- NULL
- )
- )
- return bButtonIsVisible;
- if( ! CExtBarNcAreaButton::OnQueryVisibility() )
- return false;
- if( ! pBar->_RowRecalcingIsEnabled( GetBar() ) )
- return false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarAutoHideMode() )
- return false;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarFixedMode() || IsBarFloated() )
- return false;
- return true;
- }
- void CExtBarNcAreaButtonExpand::OnNcAreaDraw( CDC & dc )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleDraw(
- dc,
- this,
- pBar,
- NULL
- )
- )
- return;
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- dc.FillSolidRect( &m_rc, RGB(128,255,128) );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_bDisabled = IsBarAutoHideMode();
- if( !m_bDisabled )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_bDisabled =
- IsBarSingleOnRow()
- ;
- bool bMax = IsBarMaximizedOnRow();
- bool bHorz = IsBarDockedHorizontally();
- NcDrawDefault(
- dc,
- bHorz
- ? ( bMax
- ? CExtPaintManager::__DCBT_ARROW_RIGHT
- : CExtPaintManager::__DCBT_ARROW_LEFT
- )
- : ( bMax
- ? CExtPaintManager::__DCBT_ARROW_DOWN
- : CExtPaintManager::__DCBT_ARROW_UP
- )
- );
- #endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- UINT CExtBarNcAreaButtonExpand::OnNcAreaHitTest( CPoint point )
- {
- ASSERT_VALID( this );
- UINT nExternalHT = HTNOWHERE;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleHitTest(
- nExternalHT,
- point,
- this,
- pBar,
- NULL
- )
- )
- return nExternalHT;
- UINT nHT = CExtBarNcAreaButton::OnNcAreaHitTest( point );
- if( nHT == HTCLIENT )
- return HTCLIENT; // not inside nc-button
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarAutoHideMode() )
- return HTCLIENT;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarSingleOnRow() )
- return HTCLIENT;
- // if( IsBarMaximizedOnRow() )
- return HTMINBUTTON;
- // return HTMAXBUTTON;
- }
- bool CExtBarNcAreaButtonExpand::OnNcAreaClicked( CPoint point )
- {
- ASSERT_VALID( this );
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- HWND hWndBar = pBar->GetSafeHwnd();
- if( pBar->NcButtons_HandleClick( this, point, pBar, NULL ) )
- return true;
- ASSERT_VALID( pBar );
- if( ! m_rc.PtInRect( point ) )
- return false; // continue asking nc-buttons
- // 2.25 fix
- m_bHover = m_bPushed = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarAutoHideMode() )
- {
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsBarSingleOnRow() )
- {
- if( ! IsBarWndActive() )
- {
- if( CExtControlBar::stat_QueryFocusChangingEnabled( pBar, pBar->m_hWnd ) )
- pBar->SetFocus();
- }
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- }
- if( IsBarMaximizedOnRow() )
- pBar->MinimizeOnRow();
- else
- {
- pBar->MaximizeOnRow();
- if( CExtControlBar::stat_QueryFocusChangingEnabled( pBar, pBar->m_hWnd ) )
- pBar->SetFocus();
- }
-
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButtonExpand::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
-
- point; // should be in button area
- bool bBarMaximizedOnRow = IsBarMaximizedOnRow();
- return
- DoDefaultReflectForToolHitTest(
- pTI,
- bBarMaximizedOnRow ? IDS_CBNCAREA_CONTRACT : IDS_CBNCAREA_EXPAND,
- bBarMaximizedOnRow ? _T("Contract") : _T("Expand")
- );
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButtonClose
- IMPLEMENT_DYNCREATE( CExtBarNcAreaButtonClose, CExtBarNcAreaButton )
- CExtBarNcAreaButtonClose::CExtBarNcAreaButtonClose(
- CExtControlBar * pBar
- )
- : CExtBarNcAreaButton( pBar )
- {
- }
- bool CExtBarNcAreaButtonClose::OnQueryVisibility() const
- {
- ASSERT_VALID( this );
- bool bButtonIsVisible = true;
- CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryVisibility(
- bButtonIsVisible,
- const_cast < CExtBarNcAreaButtonClose * > ( this ),
- pBar,
- NULL
- )
- )
- return bButtonIsVisible;
- if( ! CExtBarNcAreaButton::OnQueryVisibility() )
- return false;
- if( ! pBar->_ClosingIsEnabled( GetBar() ) )
- return false;
- if( ! IsBarFixedMode() )
- return true;
- return IsBarFloated();
- }
- void CExtBarNcAreaButtonClose::OnNcAreaDraw( CDC & dc )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleDraw(
- dc,
- this,
- pBar,
- NULL
- )
- )
- return;
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- dc.FillSolidRect( &m_rc, RGB(128,128,255) );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- NcDrawDefault(
- dc,
- CExtPaintManager::__DCBT_CLOSE
- );
- #endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- UINT CExtBarNcAreaButtonClose::OnNcAreaHitTest( CPoint point )
- {
- ASSERT_VALID( this );
- UINT nExternalHT = HTNOWHERE;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleHitTest(
- nExternalHT,
- point,
- this,
- pBar,
- NULL
- )
- )
- return nExternalHT;
- UINT nHT = CExtBarNcAreaButton::OnNcAreaHitTest( point );
- if( nHT == HTCLIENT )
- return HTCLIENT; // not inside nc-button
- //return HTCLOSE;
- return HTMINBUTTON;
- }
- bool CExtBarNcAreaButtonClose::OnNcAreaClicked( CPoint point )
- {
- ASSERT_VALID( this );
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- HWND hWndBar = pBar->GetSafeHwnd();
- if( pBar->NcButtons_HandleClick( this, point, pBar, NULL ) )
- return true;
- ASSERT_VALID( pBar );
- if( m_rc.PtInRect(point) )
- {
- m_bHover = m_bPushed = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( ! pBar->IsFixedMode() )
- {
- if( pBar->AutoHideModeGet() )
- {
- pBar->AutoHideModeSet( false, false, true, true );
- pBar->OnShowControlBarChain( false, false );
- }
- else
- {
- CFrameWnd * pFrame = pBar->GetParentFrame();
- ASSERT_VALID( pFrame );
- if( pFrame->IsKindOf( RUNTIME_CLASS(CMiniDockFrameWnd) )
- && (pFrame->GetStyle() & FWS_SNAPTOBARS) != 0
- )
- pFrame->ModifyStyle( FWS_SNAPTOBARS, 0 );
- bool bOnlyOneBar = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bOnlyOneBar =
- pBar->IsCloseOnlyOneBarInTabGroup();
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pBar->OnShowControlBarChain( false, false, bOnlyOneBar );
- }
- }
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- bool bOnlyOneBar = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bOnlyOneBar =
- pBar->IsCloseOnlyOneBarInTabGroup();
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pBar->OnShowControlBarChain( false, false, bOnlyOneBar );
- }
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
-
- }
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false; // continue asking nc-buttons
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButtonClose::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
-
- point; // should be in button area
- return
- DoDefaultReflectForToolHitTest(
- pTI,
- IDS_CBNCAREA_CLOSE,
- _T("Hide")
- );
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButtonAutoHide
- IMPLEMENT_DYNCREATE( CExtBarNcAreaButtonAutoHide, CExtBarNcAreaButton )
- CExtBarNcAreaButtonAutoHide::CExtBarNcAreaButtonAutoHide(
- CExtControlBar * pBar
- )
- : CExtBarNcAreaButton( pBar )
- {
- }
- bool CExtBarNcAreaButtonAutoHide::OnQueryVisibility() const
- {
- ASSERT_VALID( this );
- bool bButtonIsVisible = true;
- CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryVisibility(
- bButtonIsVisible,
- const_cast < CExtBarNcAreaButtonAutoHide * > ( this ),
- pBar,
- NULL
- )
- )
- return bButtonIsVisible;
- if( ! CExtBarNcAreaButton::OnQueryVisibility() )
- return false;
- if( ! pBar->_AutoHidingIsEnabled( GetBar() ) )
- return false;
- if( IsBarFixedMode() )
- return false;
- if( IsBarFloated() )
- return false;
- if( pBar->m_pDockBar == NULL )
- return false;
- CExtDockBar * pDockBar = DYNAMIC_DOWNCAST( CExtDockBar, pBar->m_pDockBar );
- if( pDockBar == NULL )
- return false;
- if( pDockBar->_GetAutoHideArea() == NULL )
- return false;
- CFrameWnd * pFrame = pBar->GetParentFrame();
- ASSERT_VALID( pFrame );
- if( pFrame->IsKindOf( RUNTIME_CLASS( CMiniFrameWnd ) ) )
- return false;
- return true;
- }
- void CExtBarNcAreaButtonAutoHide::OnNcAreaDraw( CDC & dc )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleDraw(
- dc,
- this,
- pBar,
- NULL
- )
- )
- return;
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- dc.FillSolidRect( &m_rc, RGB(255,128,255) );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- NcDrawDefault(
- dc,
- IsBarAutoHideMode()
- ? CExtPaintManager::__DCBT_WND_UNKEEP
- : CExtPaintManager::__DCBT_WND_KEEP
- );
- #endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- UINT CExtBarNcAreaButtonAutoHide::OnNcAreaHitTest( CPoint point )
- {
- ASSERT_VALID( this );
- UINT nExternalHT = HTNOWHERE;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleHitTest(
- nExternalHT,
- point,
- this,
- pBar,
- NULL
- )
- )
- return nExternalHT;
- UINT nHT = CExtBarNcAreaButton::OnNcAreaHitTest( point );
- if( nHT == HTCLIENT )
- return HTCLIENT; // not inside nc-button
- //return HTCLOSE;
- return HTMINBUTTON;
- }
- bool CExtBarNcAreaButtonAutoHide::OnNcAreaClicked( CPoint point )
- {
- ASSERT_VALID( this );
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- HWND hWndBar = pBar->GetSafeHwnd();
- if( pBar->NcButtons_HandleClick( this, point, pBar, NULL ) )
- return true;
- ASSERT_VALID( pBar );
- if( m_rc.PtInRect( point ) )
- {
- m_bPushed = m_bHover = false;
- ASSERT_VALID( pBar->m_pDockBar );
- bool bAutoHideMode = pBar->AutoHideModeGet();
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- {
- pBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- pBar->m_pDockBar->GetParent()
- );
- } // if( pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pBar->AutoHideModeSet( ! bAutoHideMode, false, true, false );
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- } // if( m_rc.PtInRect( point ) )
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false; // continue asking nc-buttons
- }
- void CExtBarNcAreaButtonAutoHide::OnNcAreaReposition(
- CExtBarNcAreaButton * pPrevBtn
- )
- {
- ASSERT_VALID( this );
- CExtControlBar * pExtBar = GetBar();
- ASSERT_VALID( pExtBar );
- bool bAutoHideMode = pExtBar->AutoHideModeGet();
- if( ! bAutoHideMode )
- m_bHover = m_bPushed = false;
- CExtBarNcAreaButton::OnNcAreaReposition( pPrevBtn );
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButtonAutoHide::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
-
- point; // should be in button area
- return
- DoDefaultReflectForToolHitTest(
- pTI,
- IDS_EXTTABWND_BTN_AUTOHIDE,
- _T("Auto Hide")
- );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarNcAreaButtonMenu
- IMPLEMENT_DYNCREATE( CExtBarNcAreaButtonMenu, CExtBarNcAreaButton )
- CExtBarNcAreaButtonMenu::CExtBarNcAreaButtonMenu(
- CExtControlBar * pBar
- )
- : CExtBarNcAreaButton( pBar )
- {
- }
- bool CExtBarNcAreaButtonMenu::OnQueryVisibility() const
- {
- ASSERT_VALID( this );
- bool bButtonIsVisible = true;
- CExtControlBar * pBar = const_cast < CExtControlBar * > ( GetBar() );
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleQueryVisibility(
- bButtonIsVisible,
- const_cast < CExtBarNcAreaButtonMenu * > ( this ),
- pBar,
- NULL
- )
- )
- return bButtonIsVisible;
- if( ! CExtBarNcAreaButton::OnQueryVisibility() )
- return false;
- if( ! pBar->_NcMenuButtonIsEnabled( GetBar() ) )
- return false;
- if( ( ! IsBarFixedMode() ) || ( ! IsBarFloated() ) )
- return false;
- return true;
- }
- void CExtBarNcAreaButtonMenu::OnNcAreaDraw( CDC & dc )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( OnQueryVisibility() );
- if( m_rc.IsRectEmpty() )
- return;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleDraw(
- dc,
- this,
- pBar,
- NULL
- )
- )
- return;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = pBar->NotifiedCustomizeSiteGet();
- if( pSite != NULL
- && pSite->IsCustomizeMode()
- )
- m_bHover = m_bPushed = false;
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- #if (defined __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__)
- dc.FillSolidRect( &m_rc, RGB(255,255,128) );
- #else // __DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- NcDrawDefault(
- dc,
- CExtPaintManager::__DCBT_ARROW_DOWN
- );
- #endif // !__DEBUG_PAINTING_AREAS_EXTRESIZABLEBAR__
- }
- UINT CExtBarNcAreaButtonMenu::OnNcAreaHitTest( CPoint point )
- {
- ASSERT_VALID( this );
- UINT nExternalHT = HTNOWHERE;
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->NcButtons_HandleHitTest(
- nExternalHT,
- point,
- this,
- pBar,
- NULL
- )
- )
- return nExternalHT;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = GetBar()->NotifiedCustomizeSiteGet();
- if( pSite != NULL
- && pSite->IsCustomizeMode()
- )
- return HTCLIENT;
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- UINT nHT = CExtBarNcAreaButton::OnNcAreaHitTest( point );
- if( nHT == HTCLIENT )
- return HTCLIENT; // not inside nc-button
- return HTMINBUTTON;
- }
- bool CExtBarNcAreaButtonMenu::OnNcAreaClicked( CPoint point )
- {
- ASSERT_VALID( this );
- CExtControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- HWND hWndBar = pBar->GetSafeHwnd();
- if( pBar->NcButtons_HandleClick( this, point, pBar, NULL ) )
- return true;
- ASSERT_VALID( pBar );
- // 2.25 fix
- m_bHover = m_bPushed = false;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = pBar->NotifiedCustomizeSiteGet();
- if( pSite != NULL
- && pSite->IsCustomizeMode()
- )
- {
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( CExtControlBar::FindHelpMode( pBar ) )
- {
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- }
- if( ! m_rc.PtInRect( point ) )
- {
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false; // continue asking nc-buttons
- }
- CFrameWnd * pFrame = GetDockingFrame();
- ASSERT_VALID( pFrame );
- HWND hWndTrack = pFrame->GetSafeHwnd();
- ASSERT(
- hWndTrack != NULL
- && ::IsWindow( hWndTrack )
- );
- CExtPopupMenuWnd * pPopup =
- CExtPopupMenuWnd::InstantiatePopupMenu(
- pBar->GetSafeHwnd(),
- RUNTIME_CLASS(CExtPopupMenuWnd),
- this
- );
- if( ! pPopup->CreatePopupMenu( hWndTrack ) )
- {
- ASSERT( FALSE );
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false;
- }
- CExtControlBar::POPUP_MENU_EVENT_DATA _pmed(
- CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CONTROLBAR_NCBTNMENU_TOP,
- pPopup,
- pBar,
- CPoint( -1, -1 ),
- WM_NCLBUTTONDOWN,
- this
- );
- if( ! _pmed.NotifyTarget( false ) )
- {
- CExtLocalResourceHelper _LRH;
- CExtSafeString sShowHidePanels;
- if( ! g_ResourceManager->LoadString( sShowHidePanels, IDS_SHOW_HIDE_PANELS ) )
- sShowHidePanels = _T("&Show/hide panels");
- VERIFY(
- pPopup->ItemInsert(
- (UINT)CExtPopupMenuWnd::TYPE_POPUP,
- -1,
- sShowHidePanels
- )
- );
- CExtPopupMenuWnd::MENUITEMDATA & mi = pPopup->ItemGetInfo( pPopup->ItemGetCount() - 1 );
- mi.SetChildCombine();
- mi.SetToolButton();
- CExtPopupMenuWnd * pPopupBars = mi.GetPopup();
- ASSERT( pPopupBars != NULL );
- if( ! CExtDockBar::_ConstructDockSiteControlBarPopupMenu(
- pFrame,
- pPopupBars,
- CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CONTROLBAR_NCBTNMENU_BARS,
- pBar,
- WM_NCLBUTTONDOWN,
- this
- )
- )
- {
- VERIFY(
- pPopup->ItemRemove(
- pPopup->ItemGetCount() - 1
- )
- );
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( pBar->IsKindOf( RUNTIME_CLASS(CExtToolControlBar) )
- && ((CExtToolControlBar*)pBar)->m_bCustomizationAllowed
- && ((CExtToolControlBar*)pBar)->GetCustomizeSite() != NULL
- )
- { // if customization allowed
- VERIFY(
- CExtDockBar::_AppendAddRemoveButtonsCustomizeMenu(
- pPopup,
- m_pBar
- )
- );
- } // if customization allowed
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- } // if( ! _pmed.NotifyTarget( false ) )
- _pmed.NotifyTarget( true );
- if( pPopup->ItemGetCount() == 0 )
- {
- delete pPopup;
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false;
- }
- CRect rcBarWnd;
- VERIFY( GetBarNcAreaInfo( NULL, &rcBarWnd ) );
- CRect rcBtnScreen( m_rc );
- rcBtnScreen.OffsetRect( rcBarWnd.TopLeft() );
- rcBtnScreen.InflateRect( 1, 1 );
- CPoint ptCursor = rcBtnScreen.CenterPoint();
- if( CExtControlBar::stat_QueryFocusChangingEnabled( pBar, hWndTrack ) )
- ::SetFocus( hWndTrack );
- if( ! pPopup->TrackPopupMenu(
- TPMX_TOPALIGN|TPMX_COMBINE_DEFAULT|TPMX_OWNERDRAW_FIXED,
- ptCursor.x, ptCursor.y,
- &rcBtnScreen,
- this,
- _CbPaintCombinedContent,
- NULL,
- true
- )
- )
- {
- //delete pPopup;
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return false;
- }
-
- if( hWndBar != NULL
- && ::IsWindow( hWndBar )
- )
- pBar->NcButtons_PostClick( this, point, pBar, NULL );
- return true;
- }
- __EXT_MFC_INT_PTR CExtBarNcAreaButtonMenu::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
-
- point; // should be in button area
- return
- DoDefaultReflectForToolHitTest(
- pTI,
- IDS_CBNCAREA_MENU,
- _T("Options")
- );
- }
- void CExtBarNcAreaButtonMenu::_CbPaintCombinedContent(
- LPVOID pCookie,
- CDC & dc,
- const CWnd & refWndMenu,
- const CRect & rcExcludeArea, // in screen coords
- int eCombineAlign // CExtPopupMenuWnd::e_combine_align_t values
- )
- {
- pCookie;
- dc;
- refWndMenu;
- rcExcludeArea;
- eCombineAlign;
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( refWndMenu.GetSafeHwnd() != NULL );
- CExtBarNcAreaButtonMenu * pBtn = (CExtBarNcAreaButtonMenu *)pCookie;
- ASSERT( pBtn != NULL );
- ASSERT_VALID( pBtn );
- ASSERT( pBtn->IsKindOf(RUNTIME_CLASS(CExtBarNcAreaButtonMenu)) );
- ASSERT( eCombineAlign != CExtPopupMenuWnd::__CMBA_NONE );
- if( rcExcludeArea.IsRectEmpty() )
- return;
- CRect rcBarWnd;
- VERIFY( pBtn->GetBarNcAreaInfo( NULL, &rcBarWnd ) );
- CRect rcExcludeAreaX;
- refWndMenu.GetClientRect( &rcExcludeAreaX );
- refWndMenu.ClientToScreen( &rcExcludeAreaX );
- CPoint ptOffset =
- rcBarWnd.TopLeft()
- - rcExcludeAreaX.TopLeft()
- ;
- CPoint ptViewportOrg = dc.GetViewportOrg();
- dc.SetViewportOrg( ptOffset );
- pBtn->m_bPaintingCombinedArea = true;
- pBtn->OnNcAreaDraw( dc );
- pBtn->m_bPaintingCombinedArea = false;
- dc.SetViewportOrg( ptViewportOrg );
- }
- LRESULT CExtControlBar::OnSizeParent(WPARAM wParam, LPARAM lParam)
- {
- wParam;
- if( !m_bReflectParentSizing )
- return (LRESULT)0;
- // if( CExtControlBar::g_bUpdatingDragState )
- // return 0;
- AFX_SIZEPARENTPARAMS * lpLayout =
- (AFX_SIZEPARENTPARAMS *) lParam;
- ASSERT( lpLayout != NULL );
- DWORD dwStyle = RecalcDelayShow( lpLayout );
- if( ( (dwStyle&WS_VISIBLE) != 0 )
- && ( (dwStyle&CBRS_ALIGN_ANY) != 0 )
- )
- {
- CRect rect = lpLayout->rect;
- CSize sizeAvail = rect.Size();
- DWORD dwMode = lpLayout->bStretch ? LM_STRETCH : 0;
- if( ( (m_dwStyle&CBRS_SIZE_DYNAMIC) != 0 )
- && ( (m_dwStyle&CBRS_FLOATING ) != 0 )
- )
- dwMode |= LM_HORZ|LM_MRUWIDTH;
- else if( (dwStyle&CBRS_ORIENT_HORZ) != 0 )
- dwMode |= LM_HORZ|LM_HORZDOCK;
- else
- dwMode |= LM_VERTDOCK;
- CSize size = CalcDynamicLayout( -1, dwMode );
- size.cx = min( size.cx, sizeAvail.cx );
- size.cy = min( size.cy, sizeAvail.cy );
- if( (dwStyle&CBRS_ORIENT_HORZ) != 0 )
- {
- lpLayout->sizeTotal.cy += size.cy;
- lpLayout->sizeTotal.cx = max( lpLayout->sizeTotal.cx, size.cx );
- if( (dwStyle&CBRS_ALIGN_TOP) != 0 )
- lpLayout->rect.top += size.cy;
- else if( (dwStyle&CBRS_ALIGN_BOTTOM) != 0 )
- {
- rect.top = rect.bottom - size.cy;
- lpLayout->rect.bottom -= size.cy;
- }
- }
- else if( (dwStyle&CBRS_ORIENT_VERT) != 0 )
- {
- lpLayout->sizeTotal.cx += size.cx;
- lpLayout->sizeTotal.cy = max( lpLayout->sizeTotal.cy, size.cy );
- HWND hWndParent = ::GetParent( m_hWnd );
- ASSERT( hWndParent != NULL && ::IsWindow(hWndParent) );
- __EXT_MFC_ULONG_PTR dwStyleEx = ::__EXT_MFC_GetWindowLong( hWndParent, GWL_EXSTYLE );
- bool bParentRTL =
- ( (m_pDockBar != NULL)
- && ( (dwStyleEx&WS_EX_LAYOUTRTL) != 0 )
- )
- ? true : false;
- if( bParentRTL )
- {
- if( (dwStyle&CBRS_ALIGN_RIGHT) != 0 )
- lpLayout->rect.left += size.cx;
- else if( (dwStyle&CBRS_ALIGN_LEFT) != 0 )
- {
- rect.left = rect.right - size.cx;
- lpLayout->rect.right -= size.cx;
- }
- } // if( bParentRTL )
- else
- {
- if( (dwStyle&CBRS_ALIGN_LEFT) != 0 )
- lpLayout->rect.left += size.cx;
- else if( (dwStyle&CBRS_ALIGN_RIGHT) != 0 )
- {
- rect.left = rect.right - size.cx;
- lpLayout->rect.right -= size.cx;
- }
- } // else from if( bParentRTL )
- }
- #ifdef _DEBUG
- else
- {
- ASSERT(FALSE);
- }
- #endif // _DEBUG
- rect.right = rect.left + size.cx;
- rect.bottom = rect.top + size.cy;
- if( lpLayout->hDWP != NULL )
- AfxRepositionWindow( lpLayout, m_hWnd, &rect );
- }
- return 0L;
- }
- CExtControlBar * CExtControlBar::InternalDraggingState_t::ExtBarDstSet(
- CExtControlBar * pExtBarDst, // = NULL
- bool bNoCheckOnShutdown // = false
- )
- {
- bNoCheckOnShutdown;
- ASSERT( this != NULL );
- // ASSERT_VALID( this );
- CExtControlBar * pExtBarDstOld = m_pExtBarDst;
- m_pExtBarDst = pExtBarDst;
- // ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( (!bNoCheckOnShutdown)
- && pExtBarDstOld != NULL
- && pExtBarDstOld != m_pExtBarDst )
- {
- CExtDynTabControlBar * pTabbedBar =
- DYNAMIC_DOWNCAST(
- CExtDynTabControlBar,
- pExtBarDstOld
- );
- if( pTabbedBar != NULL )
- pTabbedBar->RemoveTemporaryItems( false );
- } // if( pExtBarDstOld != NULL && pExtBarDstOld != m_pExtBarDst )
- m_nTabReindex = 0;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- return pExtBarDstOld;
- }
- void CExtControlBar::InternalDraggingState_t::_AssignFromOther(
- const CExtControlBar::InternalDraggingState_t & other
- )
- {
- ASSERT( this != NULL );
- ASSERT_VALID( (&other) );
- if( m_pExtBarDst != NULL
- && m_pExtBarDst != other.m_pExtBarDst
- )
- {
- ExtBarDstSet( other.m_pExtBarDst );
- } // if( m_pExtBarDst ....
- m_bEmpty = other.m_bEmpty;
- m_bDeepHalfSplit = other.m_bDeepHalfSplit;
- m_eCDT = other.m_eCDT;
- m_eCFR = other.m_eCFR;
- m_nCircleNo = other.m_nCircleNo;
- m_rcTrack = other.m_rcTrack;
- m_pExtBarSrc = other.m_pExtBarSrc;
- m_pExtBarDst = other.m_pExtBarDst;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_nTabReindex = other.m_nTabReindex;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT_VALID( this );
- }
- void CExtControlBar::InternalDraggingState_t::SetEmpty(
- bool bEmpty // = true
- )
- {
- // ASSERT_VALID( this );
- ASSERT( this != NULL );
- m_eCFR = __ECFR_NO_RESIZING;
- if( bEmpty )
- ExtBarDstSet( NULL );
-
- m_bEmpty = bEmpty;
- if( m_bEmpty )
- {
- m_rcTrack.SetRectEmpty();
- // m_pExtBarDst = NULL;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- m_nTabReindex = 0;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- void CExtControlBar::InternalDraggingState_t::ReindexPosCalc( CPoint ptCursor )
- {
- ASSERT_VALID( this );
- ASSERT( !IsEmpty() );
- ASSERT(
- m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- );
- ASSERT_VALID( m_pExtBarDst );
- CExtDynTabControlBar * pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pExtBarDst
- );
- m_nTabReindex = pTabbedBar->ReindexPosCalc( ptCursor );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- void CExtControlBar::InternalDraggingState_t::DrawState( bool bErasingPrevious )
- {
- ASSERT_VALID( this );
- ASSERT( ! IsEmpty() );
- ASSERT_VALID( m_pExtBarSrc );
- ASSERT_VALID( m_pExtBarSrc->m_pDockSite );
- ASSERT_VALID( m_pExtBarSrc->m_pDockBar );
- if( m_eCDT == __ECDT_OWN_AREA )
- return;
- if( m_pExtBarSrc->IsFixedMode() )
- return;
-
- CExtControlBar::eResizablePanelDockingType_t eResizablePanelDockingType =
- m_pExtBarSrc->OnQueryDockingType();
- if( m_pExtBarSrc->_IsShowContentWhenDragging() )
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) < INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- return;
- } // if( m_pExtBarSrc->_IsShowContentWhenDragging() )
- else
- {
- if( m_rcTrack.IsRectEmpty() )
- return;
- } // else from if( m_pExtBarSrc->_IsShowContentWhenDragging() )
- eResizablePanelDockingType;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( ( m_eCDT == __ECDT_TABBED_UPDATE
- || m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- && m_pExtBarDst != NULL
- )
- {
- ASSERT_VALID( m_pExtBarDst );
- ASSERT_VALID( m_pExtBarDst->m_pDockSite );
- ASSERT_VALID( m_pExtBarDst->m_pDockBar );
- ASSERT( ! m_pExtBarDst->IsFixedMode() );
- ASSERT_KINDOF( CExtControlBar, m_pExtBarSrc );
- ASSERT_KINDOF( CExtDynTabControlBar, m_pExtBarDst );
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && m_pExtBarSrc->IsFloating()
- )
- m_pExtBarSrc->GetParentFrame()->ShowWindow( SW_HIDE );
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( m_eCDT == __ECDT_TABBED_REINDEX
- || m_eCDT == __ECDT_TABBED_REINDEX_NHM
- )
- ((CExtDynTabControlBar*)m_pExtBarDst) ->
- RemoveTemporaryItems( false );
- ((CExtDynTabControlBar*)m_pExtBarDst) ->
- InsertTemporaryItemsFrom(
- m_pExtBarSrc,
- ReindexPosGet(),
- false
- );
- return;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- {
- if( m_pExtBarSrc->IsFloating() )
- m_pExtBarSrc->GetParentFrame()->ShowWindow( SW_SHOWNOACTIVATE );
- return;
- } // if( INT(eResizablePanelDockingType) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005) )
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- CRect rcTrackerOuter( m_rcTrack ), rcDockingFrame, rcDockBarWnd;
- m_pExtBarSrc->m_pDockSite->GetWindowRect( &rcDockingFrame );
- if( m_pExtBarDst != NULL )
- {
- ASSERT_VALID( m_pExtBarDst );
- ASSERT_VALID( m_pExtBarDst->m_pDockSite );
- ASSERT_VALID( m_pExtBarDst->m_pDockBar );
- ASSERT( !m_pExtBarDst->IsFixedMode() );
- m_pExtBarDst->m_pDockBar->GetWindowRect( &rcDockBarWnd );
- if( rcDockBarWnd.IsRectEmpty() )
- return;
- if( rcTrackerOuter.left < rcDockBarWnd.left )
- rcTrackerOuter.left = rcDockBarWnd.left;
- if( rcTrackerOuter.top < rcDockBarWnd.top )
- rcTrackerOuter.top = rcDockBarWnd.top;
- if( rcTrackerOuter.right > rcDockBarWnd.right )
- rcTrackerOuter.right = rcDockBarWnd.right;
- if( rcTrackerOuter.bottom > rcDockBarWnd.bottom )
- rcTrackerOuter.bottom = rcDockBarWnd.bottom;
- if( rcTrackerOuter.IsRectEmpty() )
- return;
- } // if( m_pExtBarDst != NULL )
- rcTrackerOuter.OffsetRect( -rcDockingFrame.TopLeft() );
- INT nTrackerBorderH = ::GetSystemMetrics( SM_CXSIZEFRAME );
- INT nTrackerMinWidth = nTrackerBorderH*2+1;
- if( rcTrackerOuter.Width() < nTrackerMinWidth )
- return;
- INT nTrackerBorderV = ::GetSystemMetrics( SM_CYSIZEFRAME );
- INT nTrackerMinHeight = nTrackerBorderV*2+1;
- if( rcTrackerOuter.Height() < nTrackerMinHeight )
- return;
- CWnd * pWndDrawTracker = NULL;
- if( m_pExtBarDst != NULL
- || m_eCDT == __ECDT_DOCKBAR_INNER_TOP
- || m_eCDT == __ECDT_DOCKBAR_INNER_BOTTOM
- || m_eCDT == __ECDT_DOCKBAR_INNER_LEFT
- || m_eCDT == __ECDT_DOCKBAR_INNER_RIGHT
- || m_eCDT == __ECDT_CIRCLE1_OUTER_TOP
- || m_eCDT == __ECDT_CIRCLE1_OUTER_BOTTOM
- || m_eCDT == __ECDT_CIRCLE1_OUTER_LEFT
- || m_eCDT == __ECDT_CIRCLE1_OUTER_RIGHT
- )
- {
- if( m_pExtBarDst != NULL )
- {
- pWndDrawTracker = m_pExtBarDst->GetDockingFrame();
- if( m_pExtBarSrc->m_pDockSite != pWndDrawTracker )
- {
- rcTrackerOuter.OffsetRect( rcDockingFrame.TopLeft() );
- CRect rc;
- pWndDrawTracker->GetClientRect( &rc );
- pWndDrawTracker->ClientToScreen( &rc );
- rcTrackerOuter.OffsetRect( -rc.TopLeft() );
- rcTrackerOuter.OffsetRect(-1,-1);
- ::ClientToScreen( pWndDrawTracker->m_hWnd, ((LPPOINT)(&rcTrackerOuter)+0) );
- ::ClientToScreen( pWndDrawTracker->m_hWnd, ((LPPOINT)(&rcTrackerOuter)+1) );
- pWndDrawTracker = CWnd::GetDesktopWindow();
- } // if( m_pExtBarSrc->m_pDockSite != pWndDrawTracker )
- }
- else
- pWndDrawTracker = m_pExtBarSrc->m_pDockSite;
- } // if( m_pExtBarDst != NULL )
- else
- pWndDrawTracker = CWnd::GetDesktopWindow();
- ASSERT( pWndDrawTracker != NULL );
- ASSERT( pWndDrawTracker->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( pWndDrawTracker->GetSafeHwnd() ) );
- CDC * pDcDrawTracker =
- pWndDrawTracker->GetDCEx( NULL, __DOCKSITE_DCX_FLAGS );
- ASSERT_VALID( pDcDrawTracker );
- ASSERT( pDcDrawTracker->GetSafeHdc() != NULL );
- DWORD dwOldLayout = pDcDrawTracker->SetLayout( LAYOUT_LTR );
- if( pDcDrawTracker->RectVisible(&rcTrackerOuter) )
- {
- MsgDrawTrackedAreaData_t _MsgDrawTrackedAreaData(
- *m_pExtBarSrc,
- *pDcDrawTracker,
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- (m_eCDT == __ECDT_TABBED_NEW)
- ? __EDTAT_TAB_FRAME
- :
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- __EDTAT_RECTANGULAR_FRAME
- ,
- rcTrackerOuter,
- bErasingPrevious
- );
- _MsgDrawTrackedAreaData.NotifyOrDrawDefault();
- } // if( pDcDrawTracker->RectVisible(&rcTrackerOuter) )
- pDcDrawTracker->SetLayout( dwOldLayout );
- pWndDrawTracker->ReleaseDC( pDcDrawTracker );
- }
- CExtControlBar::OuterItemData_t::OuterItemData_t()
- : m_nBarID( AFX_IDW_DOCKBAR_FLOAT )
- , m_ptFloatHelper( 0, 0 )
- , m_sizeDockedH( 200, 200 )
- , m_sizeDockedV( 200, 200 )
- , m_sizeFloated( 200, 200 )
- , m_bFloating( false )
- , m_bVisible( false )
- {
- ASSERT( m_AffixmentData.IsEmpty() );
- }
- CExtControlBar::OuterItemData_t::OuterItemData_t(
- const CExtControlBar::OuterItemData_t & other
- )
- {
- m_nBarID = other.m_nBarID;
- m_ptFloatHelper = other.m_ptFloatHelper;
- m_sizeDockedH = other.m_sizeDockedH;
- m_sizeDockedV = other.m_sizeDockedV;
- m_sizeFloated = other.m_sizeFloated;
- m_AffixmentData = other.m_AffixmentData;
- m_bFloating = other.m_bFloating;
- m_bVisible = other.m_bVisible;
- }
- CExtControlBar::OuterItemData_t &
- CExtControlBar::OuterItemData_t::operator = (
- const CExtControlBar::OuterItemData_t & other
- )
- {
- m_nBarID = other.m_nBarID;
- m_ptFloatHelper = other.m_ptFloatHelper;
- m_sizeDockedH = other.m_sizeDockedH;
- m_sizeDockedV = other.m_sizeDockedV;
- m_sizeFloated = other.m_sizeFloated;
- m_AffixmentData = other.m_AffixmentData;
- m_bFloating = other.m_bFloating;
- m_bVisible = other.m_bVisible;
- return (*this);
- }
- void CExtControlBar::OuterItemData_t::Serialize( CArchive & ar )
- {
- DWORD dwHelperFlags = 0;
- if( ar.IsStoring() )
- {
- if( m_bFloating )
- dwHelperFlags |= 0x01;
- if( m_bVisible )
- dwHelperFlags |= 0x02;
- ar << dwHelperFlags;
- ar << DWORD(m_nBarID);
- ar << m_ptFloatHelper;
- ar << m_sizeDockedH;
- ar << m_sizeDockedV;
- ar << m_sizeFloated;
- } // if( ar.IsStoring() )
- else
- {
- m_nBarID = 0;
- m_ptFloatHelper.x = m_ptFloatHelper.y = 0;
- m_sizeDockedH.cx = m_sizeDockedH.cy
- = m_sizeDockedV.cx = m_sizeDockedV.cy
- = m_sizeFloated.cx = m_sizeFloated.cy
- = 0;
- m_AffixmentData.Empty();
- ar >> dwHelperFlags;
- m_bFloating = m_bVisible = false;
- if( (dwHelperFlags & 0x01) != 0 )
- m_bFloating = true;
- if( (dwHelperFlags & 0x02) != 0 )
- m_bVisible = true;
- DWORD dwTmp;
- ar >> dwTmp;
- m_nBarID = UINT(dwTmp);
- ar >> m_ptFloatHelper;
- ar >> m_sizeDockedH;
- ar >> m_sizeDockedV;
- ar >> m_sizeFloated;
- } // else from if( ar.IsStoring() )
- m_AffixmentData.Serialize( ar );
- }
- CExtControlBar::InternalBarRepositionData_t::InternalBarRepositionData_t(
- CControlBar * pBar, // = NULL
- bool bSetAdvData // = false
- )
- : m_pBar( NULL )
- , m_rcSrc( 0, 0, 0, 0 )
- , m_rcDst( 0, 0, 0, 0 )
- , m_nSpaceAvailByBar( 0 )
- , m_nSpaceAvailBySideBefore( 0 )
- , m_nSpaceAvailBySideAfter( 0 )
- {
- if( pBar != NULL )
- SetBar( pBar, bSetAdvData );
- }
- CExtControlBar::InternalBarRepositionData_t::InternalBarRepositionData_t(
- const InternalBarRepositionData_t & other
- )
- {
- _AssignFromOther( other );
- }
- void CExtControlBar::InternalBarRepositionData_t::_AssignFromOther(
- const CExtControlBar::InternalBarRepositionData_t & other
- )
- {
- m_pBar = other.m_pBar;
- m_rcSrc = other.m_rcSrc;
- m_rcDst = other.m_rcDst;
- m_nSpaceAvailByBar = other.m_nSpaceAvailByBar;
- m_nSpaceAvailBySideBefore = other.m_nSpaceAvailBySideBefore;
- m_nSpaceAvailBySideAfter = other.m_nSpaceAvailBySideAfter;
- }
- void CExtControlBar::InternalBarRepositionData_t::SetBar(
- CControlBar * pBar,
- bool bSetAdvData // = false
- )
- {
- ASSERT_VALID( pBar );
- m_pBar = pBar;
- m_pBar->GetWindowRect( m_rcSrc );
- m_rcDst = m_rcSrc;
- m_nSpaceAvailByBar = 0;
- m_nSpaceAvailBySideBefore = 0;
- m_nSpaceAvailBySideAfter = 0;
- if( !bSetAdvData )
- return;
- CExtControlBar * pExtBar = GetExtBarFixed();
- if( pExtBar == NULL )
- return;
- if( pExtBar->IsFloating() )
- return;
- bool bHorz = pExtBar->IsDockedHorizontally();
- CRect rcClient;
- pExtBar->GetClientRect( &rcClient );
- m_nSpaceAvailByBar = bHorz
- ? m_rcSrc.Width() - rcClient.Width()
- : m_rcSrc.Height() - rcClient.Height();
- ASSERT( m_nSpaceAvailByBar > 0 );
- // pExtBar->ClientToScreen( &rcClient );
- //CRect rcResetFixedSize(
- // m_rcSrc.TopLeft(),
- // bHorz ? pExtBar->m_sizeDockedH : pExtBar->m_sizeDockedV
- // );
- // rcResetFixedSize.left += rcClient.left - m_rcSrc.left;
- // rcResetFixedSize.top += rcClient.top - m_rcSrc.top;
- // rcResetFixedSize.right += m_rcSrc.right - rcClient.right;
- // rcResetFixedSize.bottom += m_rcSrc.bottom - rcClient.bottom;
- // m_rcSrc = rcResetFixedSize;
- ASSERT_VALID( pExtBar->m_pDockBar );
- ASSERT( pExtBar->m_pDockBar->IsWindowVisible() );
- CRect wrDockBar;
- pExtBar->m_pDockBar->GetWindowRect( &wrDockBar );
- CControlBar * pBarPrev =
- pExtBar->_GetNextControlBarInRow( pExtBar, false );
- while( !pBarPrev->IsVisible() )
- {
- CControlBar * pLastBar2 =
- _GetNextControlBarInRow( pBarPrev, false );
- if( pLastBar2 == NULL )
- break;
- pBarPrev = pLastBar2;
- }
- if( pBarPrev != NULL )
- {
- CRect wrPrevBar;
- pBarPrev->GetWindowRect( &wrPrevBar );
- INT m_nSpaceAvailBySideBefore = bHorz
- ? m_rcSrc.left - wrPrevBar.right
- : m_rcSrc.top - wrPrevBar.bottom;
- ASSERT( m_nSpaceAvailBySideBefore >= 0 );
- } // if( pBarPrev != NULL )
- else
- {
- INT m_nSpaceAvailBySideBefore = bHorz
- ? m_rcSrc.left - wrDockBar.left
- : m_rcSrc.top - wrDockBar.top;
- ASSERT( m_nSpaceAvailBySideBefore >= 0 );
- } // else from if( pBarPrev != NULL )
- CControlBar * pBarNext =
- pExtBar->_GetNextControlBarInRow( pExtBar, true );
- while( !pBarNext->IsVisible() )
- {
- CControlBar * pLastBar2 =
- _GetNextControlBarInRow( pBarNext, true );
- if( pLastBar2 == NULL )
- break;
- pBarNext = pLastBar2;
- }
- if( pBarNext != NULL )
- {
- CRect wrNextBar;
- pBarNext->GetWindowRect( &wrNextBar );
- INT m_nSpaceAvailBySideAfter = bHorz
- ? m_rcSrc.left - wrNextBar.right
- : m_rcSrc.top - wrNextBar.bottom;
- ASSERT( m_nSpaceAvailBySideAfter >= 0 );
- } // if( pBarNext != NULL )
- else
- {
- INT m_nSpaceAvailBySideBefore = bHorz
- ? wrDockBar.right - m_rcSrc.right
- : wrDockBar.bottom - m_rcSrc.bottom;
- ASSERT( m_nSpaceAvailBySideBefore >= 0 );
- } // else from if( pBarNext != NULL )
- }
- CExtControlBar * CExtControlBar::InternalBarRepositionData_t::GetExtBar()
- {
- if( m_pBar == NULL )
- return NULL;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, m_pBar );
- return pExtBar;
- }
- CExtControlBar * CExtControlBar::InternalBarRepositionData_t::GetExtBarFixed()
- {
- CExtControlBar * pExtBar = GetExtBar();
- if( pExtBar == NULL )
- return NULL;
- if( pExtBar->IsFixedMode() )
- return NULL;
- return pExtBar;
- }
- void CExtControlBar::InternalDraggingState_t::_DoFixed_FloatingAdjustment(
- CPoint ptTrack // in screen coords
- )
- {
- ASSERT_VALID( m_pExtBarSrc );
- g_DragStateOld.SetCFR( __ECFR_NO_RESIZING );
- CRect rcGrip = m_pExtBarSrc->_RectGripGet();
- INT nCyGripper = min( rcGrip.Width(), rcGrip.Height() );
- CSize sizeOffset( nCyGripper, nCyGripper/2 );
- bool bAlreadyFloat = m_pExtBarSrc->IsFloating();
- if( !bAlreadyFloat )
- {
- m_pExtBarSrc->m_ptFloatHelper =
- ptTrack - sizeOffset;
- if( ((CExtMouseCaptureSink *)m_pExtBarSrc)->GetCapture() != m_pExtBarSrc->GetSafeHwnd() )
- ((CExtMouseCaptureSink *)m_pExtBarSrc)->SetCapture( m_pExtBarSrc->GetSafeHwnd() );
- m_pExtBarSrc->FloatControlBar();
- ASSERT( m_pExtBarSrc->m_pDockContext != NULL );
- m_pExtBarSrc->m_pDockContext->m_ptMRUFloatPos =
- m_pExtBarSrc->m_ptFloatHelper;
- if( ((CExtMouseCaptureSink *)m_pExtBarSrc)->GetCapture() != m_pExtBarSrc->GetSafeHwnd() )
- ((CExtMouseCaptureSink *)m_pExtBarSrc)->SetCapture( m_pExtBarSrc->GetSafeHwnd() );
- return;
- } // if( !bAlreadyFloat )
- CFrameWnd * pFloatingFrame = m_pExtBarSrc->GetParentFrame();
- ASSERT_VALID( pFloatingFrame );
- ASSERT_KINDOF( CMiniDockFrameWnd, pFloatingFrame );
- CRect wrFloatingFrame;
- pFloatingFrame->GetWindowRect( &wrFloatingFrame );
- wrFloatingFrame.OffsetRect(
- -wrFloatingFrame.TopLeft() + (ptTrack-sizeOffset)
- );
- wrFloatingFrame.OffsetRect(
- - m_pExtBarSrc->m_ptHelperDragOffsetFloated
- );
- //
- //CExtPaintManager::monitor_parms_t _mp;
- // CExtPaintManager::stat_GetMonitorParms( _mp, m_pExtBarSrc );
- // if( wrFloatingFrame.top < _mp.m_rcWorkArea.top )
- // wrFloatingFrame.OffsetRect(
- // 0,
- // _mp.m_rcWorkArea.top - wrFloatingFrame.top
- // );
- // if( wrFloatingFrame.left < _mp.m_rcWorkArea.left )
- // wrFloatingFrame.OffsetRect(
- // _mp.m_rcWorkArea.left - wrFloatingFrame.left,
- // 0
- // );
- // if( wrFloatingFrame.top + afxData.cyBorder2*2 + nCyGripper > _mp.m_rcWorkArea.bottom )
- // wrFloatingFrame.OffsetRect(
- // 0,
- // _mp.m_rcWorkArea.bottom - (wrFloatingFrame.top + afxData.cyBorder2*2 + nCyGripper)
- // );
- // if( ptTrack.x > _mp.m_rcWorkArea.right )
- // wrFloatingFrame.OffsetRect(
- // _mp.m_rcWorkArea.right - ptTrack.x,
- // 0
- // );
- pFloatingFrame->MoveWindow( &wrFloatingFrame );
- if( !m_pExtBarSrc->_IsDockSiteCustomizeMode() )
- pFloatingFrame->BringWindowToTop();
- pFloatingFrame->DelayRecalcLayout();
- ASSERT( m_pExtBarSrc->m_pDockContext != NULL );
- m_pExtBarSrc->m_pDockContext->m_ptMRUFloatPos =
- wrFloatingFrame.TopLeft();
-
- if( ((CExtMouseCaptureSink *)m_pExtBarSrc)->GetCapture() != m_pExtBarSrc->GetSafeHwnd() )
- ((CExtMouseCaptureSink *)m_pExtBarSrc)->SetCapture( m_pExtBarSrc->GetSafeHwnd() );
- }
- bool CExtControlBar::InternalDraggingState_t::_DoFixed_OuterDockerAdjustment(
- CPoint ptTrack, // in screen coords
- CExtDockOuterBar * pOuterDocker
- )
- {
- ASSERT_VALID( m_pExtBarSrc );
- ASSERT_VALID( m_pExtBarSrc->m_pDockSite );
- ASSERT_VALID( pOuterDocker );
- g_DragStateOld.SetCFR( __ECFR_NO_RESIZING );
- if( ( pOuterDocker->m_dwStyle
- & m_pExtBarSrc->m_dwDockStyle
- & CBRS_ALIGN_ANY
- ) == 0
- )
- return false;
- CRect rcGrip = m_pExtBarSrc->_RectGripGet();
- INT nCyGripper = min( rcGrip.Width(), rcGrip.Height() );
- CSize sizeOffset( nCyGripper, nCyGripper/2 );
- UINT nDockBarID = pOuterDocker->GetDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- BOOL bHorzDockBar =
- ( nDockBarID == AFX_IDW_DOCKBAR_TOP
- || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM )
- ? TRUE : FALSE;
- if( bHorzDockBar )
- {
- sizeOffset.cx = m_pExtBarSrc->m_ptHelperDragOffsetDockedH.x;
- sizeOffset.cy = m_pExtBarSrc->m_ptHelperDragOffsetDockedH.y;
- }
- else
- {
- sizeOffset.cx = m_pExtBarSrc->m_ptHelperDragOffsetDockedV.x;
- sizeOffset.cy = m_pExtBarSrc->m_ptHelperDragOffsetDockedV.y;
- }
- if( pOuterDocker != m_pExtBarSrc->m_pDockBar )
- {
- CSize sizeDocked =
- m_pExtBarSrc->CalcFixedLayout(
- FALSE,
- bHorzDockBar
- );
- ASSERT_VALID( m_pExtBarSrc->m_pDockBar );
- CRect rcInsert( ptTrack - sizeOffset, sizeDocked );
- m_pExtBarSrc->_AffixmentSafeClearOuter();
- pOuterDocker->DockControlBar(
- m_pExtBarSrc,
- rcInsert,
- true
- );
- if( m_pExtBarSrc->_IsDockSiteCustomizeMode()
- && (!m_pExtBarSrc->IsSingleOnRow())
- )
- m_pExtBarSrc->MakeSingleOnRow();
- m_pExtBarSrc->_AffixmentRecalcOuter();
- m_pExtBarSrc->m_pDockSite->RecalcLayout();
- return true;
- } // if( pOuterDocker != m_pExtBarSrc->m_pDockBar )
- bool bSwap = false;
- CRect rcAllRow;
- MfcControlBarVector_t vRow;
- m_pExtBarSrc->_GetRowBars(
- vRow,
- &rcAllRow,
- NULL,
- NULL,
- &bSwap
- );
- ASSERT( vRow.GetSize() > 0 );
- int nMoveUpDownDirection = 0;
- int nAdjustPixelsLT = 0, nAdjustPixelsRB = 0;
- if( nDockBarID == AFX_IDW_DOCKBAR_RIGHT
- || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- )
- nAdjustPixelsRB = -2;
- else
- nAdjustPixelsLT = 2;
- CRect rcUpDownAnalyze( rcAllRow );
- if( bHorzDockBar )
- {
- rcUpDownAnalyze.InflateRect( 0, 1 );
- if( ptTrack.y <= (rcUpDownAnalyze.top + nAdjustPixelsLT)
- || ptTrack.y >= (rcUpDownAnalyze.bottom + nAdjustPixelsRB)
- )
- {
- if( ptTrack.y <= (rcUpDownAnalyze.top + nAdjustPixelsLT) )
- nMoveUpDownDirection = -1;
- else
- nMoveUpDownDirection = 1;
- }
- } // if( bHorzDockBar )
- else
- {
- rcUpDownAnalyze.InflateRect( 1, 0 );
- if( ptTrack.x <= (rcUpDownAnalyze.left + nAdjustPixelsLT)
- || ptTrack.x >= (rcUpDownAnalyze.right + nAdjustPixelsRB)
- )
- {
- if( ptTrack.x <= (rcUpDownAnalyze.left + nAdjustPixelsLT) )
- nMoveUpDownDirection = -1;
- else
- nMoveUpDownDirection = 1;
- }
- } // else from if( bHorzDockBar )
- if( nMoveUpDownDirection != 0 )
- {
- if( vRow.GetSize() != 1 )
- {
- m_pExtBarSrc->_AffixmentSafeClearOuter();
- pOuterDocker->_NewRowDockControlBar(
- m_pExtBarSrc,
- m_pExtBarSrc,
- (nMoveUpDownDirection < 0) ? true : false
- );
- m_pExtBarSrc->_AffixmentRecalcOuter();
- m_pExtBarSrc->_AffixmentRecalcOuter();
- _DoFixed_StaticMinimalDockSiteRecalc(
- m_pExtBarSrc->m_pDockSite,
- pOuterDocker
- );
- return true;
- } // if( vRow.GetSize() != 1 )
- bool bSwapXtra = false;
- CRect rcAllRow2;
- MfcControlBarVector_t vRow2;
- m_pExtBarSrc->_GetNextRowBars(
- (nMoveUpDownDirection < 0) ? false : true,
- vRow2,
- &rcAllRow2,
- NULL,
- NULL,
- &bSwapXtra
- );
- if( bSwapXtra && (!bSwap) && vRow2.GetSize() > 0 )
- {
- CRect rcOuterDockerClient;
- pOuterDocker->GetClientRect( &rcOuterDockerClient );
- int nOuterDockerExtent = bHorzDockBar
- ? rcOuterDockerClient.Width()
- : rcOuterDockerClient.Height()
- ;
- CSize sizeDragMin = m_pExtBarSrc->_CalcDesiredMinOuterSize( bHorzDockBar );
- int nExtentDragMin = bHorzDockBar
- ? sizeDragMin.cx
- : sizeDragMin.cy
- ;
- int nExtentOtherOuterMin = 0;
- for( int nBar = 0; nBar < vRow2.GetSize(); nBar++ )
- {
- CControlBar * pOtherBar = vRow2[nBar];
- ASSERT_VALID( pOtherBar );
- ASSERT_KINDOF( CControlBar, pOtherBar );
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pOtherBar );
- CRect rcBarWnd;
- pOtherBar->GetWindowRect( &rcBarWnd );
- nExtentOtherOuterMin += bHorzDockBar
- ? rcBarWnd.Width()
- : rcBarWnd.Height()
- ;
- if( pExtBar != NULL
- && pExtBar->IsFixedMode()
- && (! pExtBar->_GetFullRowMode() )
- )
- {
- CRect rcBarClient;
- pOtherBar->GetClientRect( &rcBarClient );
- CSize sizeOtherOuterMin = pExtBar->_CalcDesiredMinOuterSize( bHorzDockBar );
- nExtentOtherOuterMin += bHorzDockBar
- ? (sizeOtherOuterMin.cx - rcBarClient.Width())
- : (sizeOtherOuterMin.cy - rcBarClient.Height())
- ;
- }
- } // for( int nBar = 0; nBar < vRow2.GetSize(); nBar++ )
- if( (nExtentDragMin + nExtentOtherOuterMin) < nOuterDockerExtent )
- bSwapXtra = false;
- } // if( bSwapXtra && (!bSwap) && vRow2.GetSize() > 0 )
-
- if( m_pExtBarSrc->_IsDockSiteCustomizeMode()
- && m_pExtBarSrc->IsSingleOnRow()
- )
- bSwap = true;
- if( bSwap || bSwapXtra )
- {
- if( vRow2.GetSize() > 0 )
- {
- CRect wrDockBar;
- pOuterDocker->GetWindowRect( &wrDockBar );
- CRect rcAnalyze( rcAllRow2 );
- if( bHorzDockBar )
- {
- rcAnalyze.left = wrDockBar.left;
- rcAnalyze.right = wrDockBar.right;
- } // if( bHorzDockBar )
- else
- {
- rcAnalyze.top = wrDockBar.top;
- rcAnalyze.bottom = wrDockBar.bottom;
- } // else from if( bHorzDockBar )
- if( nMoveUpDownDirection < 0 )
- {
- rcAnalyze.OffsetRect(
- bHorzDockBar ? 0 : (rcAllRow.right - rcAllRow2.right),
- bHorzDockBar ? (rcAllRow.bottom - rcAllRow2.bottom) : 0
- );
- } // if( nMoveUpDownDirection < 0 )
- else
- {
- rcAnalyze.OffsetRect(
- bHorzDockBar ? 0 : (rcAllRow2.right - rcAllRow.right),
- bHorzDockBar ? (rcAllRow2.bottom - rcAllRow.bottom) : 0
- );
- } // else from if( nMoveUpDownDirection < 0 )
- if( !rcAnalyze.PtInRect(ptTrack) )
- {
- _DoFixed_StaticOuterRowSwap(
- vRow2[0],
- vRow[0]
- );
- _DoFixed_StaticMinimalDockSiteRecalc(
- m_pExtBarSrc->m_pDockSite,
- pOuterDocker
- );
- return true;
- } // if( !rcAnalyze.PtInRect(ptTrack) )
- } // if( vRow2.GetSize() > 0 )
- } // if( bSwap || bSwapXtra )
- else
- {
- ASSERT( !bSwap );
- ASSERT( !bSwapXtra );
- if( vRow2.GetSize() != 0 )
- {
- // do redock to existing row
- CRect rcBar;
- m_pExtBarSrc->GetWindowRect( &rcBar );
- pOuterDocker->ScreenToClient( &rcBar );
- int nOffsetInRowActual = bHorzDockBar
- ? rcBar.left
- : rcBar.top
- ;
- CPoint ptShifted( ptTrack - sizeOffset );
- pOuterDocker->ScreenToClient( &ptShifted );
- int nOffsetInRowDesired = bHorzDockBar
- ? ptShifted.x
- : ptShifted.y
- ;
- int nShiftDesired = nOffsetInRowDesired - nOffsetInRowActual;
-
- //m_pExtBarSrc->_AffixmentSafeClearOuter();
- if( pOuterDocker->_ReDockToNewRow(
- m_pExtBarSrc,
- vRow2,
- nShiftDesired
- )
- )
- { // if redock to new row is successful
- m_pExtBarSrc->_AffixmentRecalcOuter();
- _DoFixed_StaticMinimalDockSiteRecalc(
- m_pExtBarSrc->m_pDockSite,
- pOuterDocker
- );
- return true;
- } // if redock to new row is successful
-
- // if redock to new row is failed
- if( vRow2.GetSize() > 0 )
- { // try swapping - 2nd attempt
- CRect wrDockBar;
- pOuterDocker->GetWindowRect( &wrDockBar );
- CRect rcAnalyze( rcAllRow2 );
- if( bHorzDockBar )
- {
- rcAnalyze.left = wrDockBar.left;
- rcAnalyze.right = wrDockBar.right;
- } // if( bHorzDockBar )
- else
- {
- rcAnalyze.top = wrDockBar.top;
- rcAnalyze.bottom = wrDockBar.bottom;
- } // else from if( bHorzDockBar )
- if( nMoveUpDownDirection < 0 )
- {
- rcAnalyze.OffsetRect(
- bHorzDockBar ? 0 : (rcAllRow.right - rcAllRow2.right),
- bHorzDockBar ? (rcAllRow.bottom - rcAllRow2.bottom) : 0
- );
- } // if( nMoveUpDownDirection < 0 )
- else
- {
- rcAnalyze.OffsetRect(
- bHorzDockBar ? 0 : (rcAllRow2.right - rcAllRow.right),
- bHorzDockBar ? (rcAllRow2.bottom - rcAllRow.bottom) : 0
- );
- } // else from if( nMoveUpDownDirection < 0 )
- if( !rcAnalyze.PtInRect(ptTrack) )
- {
- m_pExtBarSrc->_AffixmentRecalcOuter();
- _DoFixed_StaticOuterRowSwap(
- vRow2[0],
- vRow[0]
- );
- _DoFixed_StaticMinimalDockSiteRecalc(
- m_pExtBarSrc->m_pDockSite,
- pOuterDocker
- );
- return true;
- } // if( !rcAnalyze.PtInRect(ptTrack) )
- } // try swapping - 2nd attempt
- } // if( vRow2.GetSize() != 0 )
- } // else from if( bSwap || bSwapXtra )
- } // if( nMoveUpDownDirection != 0 )
- // if( bSwap )
- // return true;
- // do slide
- CRect rcBar;
- m_pExtBarSrc->GetWindowRect( &rcBar );
- pOuterDocker->ScreenToClient( &rcBar );
- int nOffsetInRowActual = bHorzDockBar
- ? rcBar.left
- : rcBar.top
- ;
- CPoint ptShifted( ptTrack - sizeOffset );
- pOuterDocker->ScreenToClient( &ptShifted );
- int nOffsetInRowDesired = bHorzDockBar
- ? ptShifted.x
- : ptShifted.y
- ;
- int nShiftDesired = nOffsetInRowDesired - nOffsetInRowActual;
- BOOL bLayoutQueryOld = pOuterDocker->m_bLayoutQuery;
- CRect rectLayoutOld( pOuterDocker->m_rectLayout );
- pOuterDocker->m_bLayoutQuery = FALSE;
- pOuterDocker->GetWindowRect( &pOuterDocker->m_rectLayout );
- pOuterDocker->m_rectLayout.OffsetRect(
- - pOuterDocker->m_rectLayout.TopLeft()
- );
- bool bInplaceResizing = false;
- // if( m_pExtBarSrc->IsFixedMode() ) // (+ v.2.22)
- if( m_pExtBarSrc->IsFixedDockStyle() ) // (+ v.2.22)
- {
- InternalAffixmentData * pAffixmentData =
- m_pExtBarSrc->_AffixmentGetOuter();
- if( pAffixmentData != NULL )
- {
- if( (! pAffixmentData->IsEmpty() )
- && (! m_pExtBarSrc->_GetFullRowMode() )
- )
- {
- bool bInitialRecalcAffixment = false;
- if( (pAffixmentData->m_dwAffixmentFlags & InternalAffixmentData::__EAFF_FIXED_MODE_INITIAL_RECALC) != 0 )
- bInitialRecalcAffixment = true;
- else
- {
- CRect rcOuterDocker;
- pOuterDocker->GetClientRect( &rcOuterDocker );
- ASSERT( rcOuterDocker.left == 0 && rcOuterDocker.top == 0 );
- if( (bHorzDockBar && pAffixmentData->m_rcAffixment.Width() >= rcOuterDocker.right)
- || (bHorzDockBar && pAffixmentData->m_rcAffixment.Height() >= rcOuterDocker.bottom)
- )
- bInitialRecalcAffixment = true;
- } // else from if( (pAffixmentData->m_dwAffixmentFlags & InternalAffixmentData::__EAFF_FIXED_MODE_INITIAL_RECALC) != 0 )
- if( bInitialRecalcAffixment )
- {
- pAffixmentData->Empty(); // initial recalc
- pAffixmentData->m_dwAffixmentFlags &=
- ~(InternalAffixmentData::__EAFF_FIXED_MODE_INITIAL_RECALC);
- } // bInitialRecalcAffixment
- }
- if( pAffixmentData->IsEmpty() )
- pOuterDocker->_AffixmentBringToTop( m_pExtBarSrc );
- } // if( pAffixmentData != NULL )
- } // if( m_pExtBarSrc->IsFixedMode() ) // (+ v.2.22)
- pOuterDocker->_RedockInRow(
- m_pExtBarSrc,
- nShiftDesired,
- &bInplaceResizing
- );
- pOuterDocker->m_bLayoutQuery = bLayoutQueryOld;
- pOuterDocker->m_rectLayout = rectLayoutOld;
- if( bInplaceResizing )
- {
- g_DragStateOld.SetCFR(
- bHorzDockBar ? __ECFR_HORZ : __ECFR_VERT
- );
- } // if( bInplaceResizing )
- CExtPaintManager::stat_PassPaintMessages();
- return true;
- }
- void CExtControlBar::InternalDraggingState_t::_DoFixed_StaticMinimalDockSiteRecalc(
- CFrameWnd * pDockSite,
- CExtDockOuterBar * pOuterDocker
- )
- {
- ASSERT_VALID( pDockSite );
- ASSERT_VALID( pOuterDocker );
- ASSERT( pOuterDocker->GetParent() == pDockSite );
- pOuterDocker->Invalidate();
- if( (pOuterDocker->GetStyle() & WS_VISIBLE) == 0 )
- {
- pDockSite->RecalcLayout();
- return;
- }
- UINT nDockBarID = pOuterDocker->GetDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- BOOL bHorzDockBar =
- ( nDockBarID == AFX_IDW_DOCKBAR_TOP
- || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM )
- ? TRUE : FALSE;
- BOOL bLayoutQueryOld = pOuterDocker->m_bLayoutQuery;
- CRect rectLayoutOld( pOuterDocker->m_rectLayout );
- CRect rcDockerWnd;
- pOuterDocker->GetWindowRect( &rcDockerWnd );
- CSize sizeDockBarBefore = rcDockerWnd.Size();
- pOuterDocker->m_rectLayout = rcDockerWnd;
- pOuterDocker->m_rectLayout.OffsetRect(
- - pOuterDocker->m_rectLayout.TopLeft()
- );
- pOuterDocker->m_bLayoutQuery = TRUE;
- CSize sizeDockBarAfter =
- pOuterDocker->CalcFixedLayout( FALSE, bHorzDockBar );
- bool bSizesAreEqual = false;
- if( bHorzDockBar )
- {
- if( sizeDockBarAfter.cy == sizeDockBarBefore.cy )
- bSizesAreEqual = true;
- } // if( bHorzDockBar )
- else
- {
- if( sizeDockBarAfter.cx == sizeDockBarBefore.cx )
- bSizesAreEqual = true;
- } // else from if( bHorzDockBar )
- if( bSizesAreEqual )
- {
- pOuterDocker->m_bLayoutQuery = FALSE;
- pOuterDocker->CalcFixedLayout( FALSE, bHorzDockBar );
- }
- pOuterDocker->m_bLayoutQuery = bLayoutQueryOld;
- pOuterDocker->m_rectLayout = rectLayoutOld;
- if( !bSizesAreEqual )
- pDockSite->RecalcLayout();
- CExtPaintManager::stat_PassPaintMessages();
- }
- void CExtControlBar::InternalDraggingState_t::_DoFixed_StaticOuterRowSwap(
- CControlBar * pBar1,
- CControlBar * pBar2
- )
- {
- ASSERT_VALID( pBar1 );
- ASSERT_VALID( pBar2 );
- ASSERT_VALID( pBar1->m_pDockBar );
- ASSERT_VALID( pBar2->m_pDockBar );
- ASSERT_VALID( pBar1->m_pDockSite );
- ASSERT_VALID( pBar2->m_pDockSite );
- ASSERT( pBar1->m_pDockBar == pBar2->m_pDockBar );
- ASSERT( pBar1->m_pDockSite == pBar2->m_pDockSite );
- ASSERT( pBar1 != pBar2 );
- CDockBar * pDockBar = pBar1->m_pDockBar;
- int nPos1 = pDockBar->FindBar( pBar1 );
- int nPos2 = pDockBar->FindBar( pBar2 );
- ASSERT( nPos1 != nPos2 );
- bool bWalkUp = (nPos1 < nPos2) ? true : false;
- pDockBar->Invalidate();
- pBar1->Invalidate();
- pBar2->Invalidate();
- ASSERT( pDockBar->m_arrBars[0] == NULL );
- MfcControlBarVector_t vPush;
- int nPosRemovedStart = nPos1, nPosRemovedEnd = nPos1;
- int nPos = 0;
- for( nPos = nPos1; nPos > 0; nPos-- )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars[nPos];
- if( pBar == NULL )
- break;
- vPush.InsertAt( 0, pBar );
- nPosRemovedStart = nPos;
- }
- int nCount = (int)pDockBar->m_arrBars.GetSize();
- for( nPos = nPos1+1; nPos < nCount; nPos++ )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars[nPos];
- if( pBar == NULL )
- break;
- vPush.Add( pBar );
- nPosRemovedEnd = nPos;
- }
- if( nPosRemovedEnd < nCount-1 )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars[nPosRemovedEnd+1];
- if( pBar == NULL )
- nPosRemovedEnd++;
- }
- int nCountToRemove = nPosRemovedEnd - nPosRemovedStart + 1;
- pDockBar->m_arrBars.RemoveAt( nPosRemovedStart, nCountToRemove );
- nPos2 = pDockBar->FindBar( pBar2 );
- nCount = (int)pDockBar->m_arrBars.GetSize();
- if( bWalkUp )
- {
- for( ; nPos2 < nCount; nPos2++ )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars[nPos2];
- if( pBar == NULL )
- {
- nPos2++;
- break;
- }
- if( nPos2 == nCount-1 )
- {
- pDockBar->m_arrBars.Add( (CControlBar *)NULL );
- nPos2++;
- break;
- }
- }
- } // if( bWalkUp )
- else
- {
- ASSERT( nPos2 > 0 );
- for( ; nPos2 > 0; nPos2-- )
- {
- CControlBar * pBar = (CControlBar *)pDockBar->m_arrBars[nPos2];
- if( pBar == NULL )
- {
- nPos2++;
- break;
- }
- }
- if( nPos2 == 0 )
- nPos2++;
- } // else from if( bWalkUp )
- nCount = (int)vPush.GetSize();
- for( nPos = 0; nPos < nCount; nPos++, nPos2++ )
- pDockBar->m_arrBars.InsertAt( nPos2, vPush[nPos] );
- pDockBar->m_arrBars.InsertAt( nPos2, (CControlBar *)NULL );
- ASSERT_VALID( pDockBar );
- }
- void CExtControlBar::InternalDraggingState_t::_DoFixed_BasicAdjustment(
- CPoint ptTrack, // in screen coords
- bool bForceFloatMode
- )
- {
- ASSERT_VALID( this );
- ASSERT( !IsEmpty() );
- ASSERT_VALID( m_pExtBarSrc );
- ASSERT( m_pExtBarSrc->IsFixedDockStyle() );
-
- ASSERT( m_pExtBarSrc->_IsShowContentWhenDragging() );
-
- TrackRectSetEmpty();
- BOOL bForceFloat =
- ( bForceFloatMode ||
- CExtPopupMenuWnd::IsKeyPressed(VK_CONTROL)
- ) ? TRUE : FALSE;
- if( bForceFloat )
- {
- _DoFixed_FloatingAdjustment( ptTrack );
- return;
- }
- CFrameWnd * pFrame = m_pExtBarSrc->_GetDockingFrameImpl();
- ASSERT_VALID( pFrame );
- CRect wrFrame;
- pFrame->GetWindowRect( &wrFrame );
- wrFrame.InflateRect( afxData.cxBorder2, afxData.cyBorder2 );
- if( ! wrFrame.PtInRect( ptTrack ) )
- {
- _DoFixed_FloatingAdjustment( ptTrack );
- return;
- }
- struct
- {
- UINT m_nDockBarID;
- bool m_bForceFirstReview:1, m_bVisible:1, m_bForceExclude:1;
- RECT m_rcDockBarAnalyze;
- CExtDockOuterBar * m_pOuterDocker;
- } arrDockBarAnalyze[4] =
- {
- { AFX_IDW_DOCKBAR_TOP, false, false, false, {0,0,0,0}, NULL },
- { AFX_IDW_DOCKBAR_BOTTOM, false, false, false, {0,0,0,0}, NULL },
- { AFX_IDW_DOCKBAR_LEFT, false, false, false, {0,0,0,0}, NULL },
- { AFX_IDW_DOCKBAR_RIGHT, false, false, false, {0,0,0,0}, NULL },
- };
- UINT nOwnDockBarID = m_pExtBarSrc->GetSafeDockBarDlgCtrlID();
- int nIdxForceFirstReview = -1;
- int nDockBarIdx = 0;
- for( nDockBarIdx = 0; nDockBarIdx < 4; nDockBarIdx++ )
- {
- if( nOwnDockBarID == arrDockBarAnalyze[nDockBarIdx].m_nDockBarID )
- {
- ASSERT( nIdxForceFirstReview < 0 );
- nIdxForceFirstReview = nDockBarIdx;
- arrDockBarAnalyze[nDockBarIdx].m_bForceFirstReview = true;
- }
- arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker =
- STATIC_DOWNCAST(
- CExtDockOuterBar,
- pFrame->GetControlBar(
- arrDockBarAnalyze[nDockBarIdx].m_nDockBarID
- )
- );
- ASSERT_VALID( arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker );
- // const int nRdpExtraInnerDx = 6; // (- v.2.24)
- // const int nRdpExtraInnerDy = 6; // (- v.2.24)
- // const int nRdpExtraOuterDx = nRdpExtraInnerDx*2; // (- v.2.24)
- // const int nRdpExtraOuterDy = nRdpExtraInnerDy*2; // (- v.2.24)
- const int nRdpExtraInnerDx = 12; // (+ v.2.24)
- const int nRdpExtraInnerDy = 12; // (+ v.2.24)
- const int nRdpExtraOuterDx = ::MulDiv( nRdpExtraInnerDx, 3, 2 ); // (+ v.2.24)
- const int nRdpExtraOuterDy = ::MulDiv( nRdpExtraInnerDy, 3, 2 ); // (+ v.2.24)
- arrDockBarAnalyze[nDockBarIdx].m_bVisible =
- (arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker->GetStyle() & WS_VISIBLE)
- ? true : false;
- if( arrDockBarAnalyze[nDockBarIdx].m_bVisible )
- {
- arrDockBarAnalyze[nDockBarIdx].m_pOuterDocker->GetWindowRect(
- &( arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze )
- );
- } // if( arrDockBarAnalyze[nDockBarIdx].m_bVisible )
- else
- {
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze = wrFrame;
- switch( arrDockBarAnalyze[nDockBarIdx].m_nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.bottom =
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.top;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.top =
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.bottom;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.right =
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.left;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.left =
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.right;
- break;
- #ifdef _DEBUG
- default:
- {
- ASSERT( FALSE );
- }
- break;
- #endif // _DEBUG
- } // switch( arrDockBarAnalyze[nDockBarIdx].m_nDockBarID )
- } // else from if( arrDockBarAnalyze[nDockBarIdx].m_bVisible )
- switch( arrDockBarAnalyze[nDockBarIdx].m_nDockBarID )
- {
- case AFX_IDW_DOCKBAR_TOP:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.bottom +=
- nRdpExtraInnerDy;
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.top =
- wrFrame.top;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.top -=
- nRdpExtraInnerDy;
- arrDockBarAnalyze[nDockBarIdx].m_rcDockBarAnalyze.bottom =