ExtControlBar.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:775k
- // {
- // if( (*ppFoundBar) != NULL )
- // return false;
- // (*ppFoundBar) = pBar;
- // continue;
- // } // if( pExtBar == NULL )
- CExtDynControlBar * pDynBar = DYNAMIC_DOWNCAST( CExtDynControlBar, pBar );
- if( pDynBar == NULL )
- {
- if( (*ppFoundBar) != NULL )
- return false;
- (*ppFoundBar) = pExtBar;
- continue;
- } // if( pDynBar == NULL )
- if( pDynBar->m_pWndDynDocker == NULL
- || pDynBar->m_pWndDynDocker->GetSafeHwnd() == NULL
- )
- continue;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pTabbedBar = DYNAMIC_DOWNCAST( CExtDynTabControlBar, pDynBar );
- if( pTabbedBar != NULL )
- {
- LONG nSel = pTabbedBar->GetSwitcherSelection();
- if( nSel < 0 )
- continue;
- CExtControlBar * pSetInTabsBar = pTabbedBar->GetBarAt( nSel, true );
- if( pSetInTabsBar == NULL )
- continue;
- ASSERT_VALID( pSetInTabsBar );
- ASSERT( pSetInTabsBar->GetSafeHwnd() != NULL );
- if( (*ppFoundBar) != NULL )
- return false;
- (*ppFoundBar) = pSetInTabsBar;
- continue;
- } // if( pTabbedBar != NULL )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtControlBar * pFoundBar2 = NULL;
- if( stat_FindSingleVisbleBarNested( pDynBar->m_pWndDynDocker, &pFoundBar2 ) )
- {
- if( (*ppFoundBar) != NULL )
- return false;
- (*ppFoundBar) = pFoundBar2;
- continue;
- }
- } // for( nIndex = 0; nIndex < nCount; nIndex++ )
- if( (*ppFoundBar) != NULL )
- return true;
- return false;
- }
- bool CExtControlBar::FlashCaption_DoPaintNC(
- CDC & dc,
- LPVOID pPGD
- )
- {
- ASSERT_VALID( this );
- ASSERT( GetSafeHwnd() != NULL );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pPGD != NULL );
- dc;
- pPGD;
- // if( ! bFlashCaptionHighlightedState )
- // return false;
- //CExtPaintManager::PAINTGRIPPERDATA & _pgd = *( (CExtPaintManager::PAINTGRIPPERDATA *) pPGD );
- // NcButtons_Paint( *pDC );
- // return true;
- return false;
- }
- void CExtControlBar::FlashCaption_OnRepaint()
- {
- ASSERT_VALID( this );
- ASSERT( GetSafeHwnd() != NULL );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( AutoHideModeGet())
- {
- CFrameWnd * pFrame = GetParentFrame();
- ASSERT_VALID( pFrame );
- ASSERT( pFrame->GetSafeHwnd() != NULL );
- ASSERT( ! pFrame->IsKindOf( RUNTIME_CLASS( CExtMiniDockFrameWnd ) ) );
- CExtDynAutoHideArea * pDAHA = NULL;
- CWnd * pWnd = pFrame->GetWindow( GW_CHILD );
- for( ; pWnd != NULL; pWnd = pWnd->GetWindow( GW_HWNDNEXT ) )
- {
- CExtDynAutoHideArea * pDAHA2 = DYNAMIC_DOWNCAST( CExtDynAutoHideArea, pWnd );
- if( pDAHA2 == NULL )
- continue;
- LONG nIndex = pDAHA2->FindControlBar( this );
- if( nIndex < 0 )
- continue;
- pDAHA = pDAHA2;
- break;
- }
- if( pDAHA->IsWindowVisible() )
- pDAHA->Invalidate();
- CExtDynAutoHideSlider * pDAHS = pDAHA->GetAutoHideSlider();
- if( pDAHS != NULL
- && pDAHS->_GetBar() == this
- && pDAHS->IsWindowVisible()
- )
- pDAHS->SendMessage( WM_NCPAINT );
- return;
- } // if( AutoHideModeGet())
- CExtDynTabControlBar * pTabbedBar = _GetNearestTabbedContainer();
- if( pTabbedBar != NULL )
- {
- ASSERT_VALID( pTabbedBar );
- ASSERT( pTabbedBar->GetSafeHwnd() != NULL );
- if( pTabbedBar->IsWindowVisible() )
- pTabbedBar->SendMessage( WM_NCPAINT );
- pTabbedBar->InvalidateSwitcher();
- } // if( pTabbedBar != NULL )
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- if( IsWindowVisible() )
- SendMessage( WM_NCPAINT );
- } // else from if( pTabbedBar != NULL )
- CFrameWnd * pFrame = GetParentFrame();
- ASSERT_VALID( pFrame );
- ASSERT( pFrame->GetSafeHwnd() != NULL );
- if( pFrame->IsKindOf( RUNTIME_CLASS( CExtMiniDockFrameWnd ) )
- && pFrame->IsWindowVisible()
- )
- pFrame->SendMessage( WM_NCPAINT );
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- else
- {
- bool bVisibleState = false;
- CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, this );
- if( pBar != NULL
- && pBar->BarStateGet( &bVisibleState ) == CExtDynamicControlBar::__EDBS_DOCUMENT
- )
- {
- if( bVisibleState )
- {
- CExtDynamicBarSite * pDBS = pBar->GetBarSite();
- if( pDBS != NULL )
- {
- switch( pDBS->GetDetectedUiType() )
- {
- case CExtDynamicBarSite::__EDUIT_MDI_WITH_TABS:
- {
- CExtTabWnd * pWndMdiTabs = pDBS->GetMdiTabs();
- if( pWndMdiTabs != NULL )
- {
- pWndMdiTabs->Invalidate();
- pWndMdiTabs->UpdateWindow();
- }
- }
- break;
- case CExtDynamicBarSite::__EDUIT_SDI_TAB_PAGE_CONTAINER:
- {
- CExtTabPageContainerWnd * pWndTPC = pDBS->GetTabPageContainer();
- if( pWndTPC != NULL )
- {
- CExtTabWnd * pWndTabs = pWndTPC->GetSafeTabWindow();
- if( pWndTabs != NULL )
- {
- pWndTabs->Invalidate();
- pWndTabs->UpdateWindow();
- }
- }
- }
- break;
- }
- }
- }
- }
- }
- #endif // __EXT_MFC_NO_TABMDI_CTRL
- #endif // __EXT_MFC_NO_DYNAMIC_BAR_SITE
- }
- void CExtControlBar::FlashCaption_OnTimer()
- {
- ASSERT_VALID( this );
- ASSERT( GetSafeHwnd() != NULL );
- ASSERT( m_nFlashCaptionCounter >= 0 );
- if( m_bFlashCaptionHighlightedState )
- {
- m_bFlashCaptionHighlightedState = false;
- FlashCaption_OnRepaint();
- m_nFlashCaptionCounter --;
- if( m_nFlashCaptionCounter <= 0 )
- KillTimer( m_nFlashCaptionTimerID );
- } // if( m_bFlashCaptionHighlightedState )
- else
- {
- m_bFlashCaptionHighlightedState = true;
- FlashCaption_OnRepaint();
- }
- }
- bool CExtControlBar::FlashCaptionIsInProgress(
- bool * p_bFlashCaptionHighlightedState // = NULL
- ) const
- {
- ASSERT_VALID( this );
- if( p_bFlashCaptionHighlightedState != NULL )
- (*p_bFlashCaptionHighlightedState) = false;
- if( GetSafeHwnd() == NULL )
- return false;
- if( m_nFlashCaptionCounter == 0 )
- return false;
- if( p_bFlashCaptionHighlightedState != NULL )
- (*p_bFlashCaptionHighlightedState) = m_bFlashCaptionHighlightedState;
- return true;
- }
- bool CExtControlBar::FlashCaption(
- INT nFlashCount, // = -1 // negative value cancels current flashing
- INT nStepMilliseconds, // = 250
- COLORREF clrFlashText, // = RGB(255,255,255),
- COLORREF clrFlashBackground // = RGB(255,0,0)
- )
- {
- ASSERT_VALID( this );
- if( GetSafeHwnd() == NULL )
- return false;
- m_bFlashCaptionHighlightedState = false;
- if( nFlashCount <= 0 || nStepMilliseconds <= 0 )
- {
- m_nFlashCaptionCounter = 0;
- FlashCaption_OnTimer();
- return true;
- }
- m_clrFlashCaptionText = clrFlashText;
- m_clrFlashCaptionBackground = clrFlashBackground;
- m_nFlashCaptionCounter = nFlashCount;
- m_nFlashCaptionStepMilliseconds = nStepMilliseconds;
- SetTimer( UINT(m_nFlashCaptionTimerID), UINT(m_nFlashCaptionStepMilliseconds), NULL );
- return true;
- }
- bool CExtControlBar::FindHelpMode(
- CWnd * pWndStartSearch
- )
- {
- ASSERT_VALID( pWndStartSearch );
- ASSERT( pWndStartSearch->GetSafeHwnd() != NULL && ::IsWindow(pWndStartSearch->GetSafeHwnd()) );
- CFrameWnd * pFrame = DYNAMIC_DOWNCAST( CFrameWnd, pWndStartSearch );
- if( pFrame == NULL )
- pFrame = pWndStartSearch->GetParentFrame();
- for( ; pFrame != NULL;
- pFrame = pFrame->GetParentFrame()
- )
- {
- if( pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- continue;
- if( pFrame->m_bHelpMode )
- return true;
- }
- return false;
- }
- bool CExtControlBar::FindPrintPreviewMode(
- CFrameWnd * pFrame
- )
- {
- //ASSERT_VALID( pFrame );
- CView * pView = pFrame->GetActiveView();
- if( pView != NULL
- && pView->IsKindOf( RUNTIME_CLASS(CPreviewView) )
- )
- return true;
- return false;
- }
- bool CExtControlBar::IsDockSiteInPrintPreviewMode()
- {
- ASSERT_VALID( this );
- if( m_pDockSite == NULL
- || m_bPresubclassDialogMode
- )
- return false;
- return FindPrintPreviewMode( m_pDockSite );
- }
- void CExtControlBar::DelayShow( BOOL bShow )
- {
- ASSERT_VALID( this );
- m_bDelayShowInvoked = true;
- m_bDelayShowFlag = bShow ? true : false;
- CExtDynControlBar * pDynContainer = _GetNearestDynamicContainer();
- if( pDynContainer != NULL )
- {
- pDynContainer->m_bDelayShowInvoked = true;
- pDynContainer->m_bDelayShowFlag = m_bDelayShowFlag;
- }
- CMiniDockFrameWnd * pMiniFrame =
- DYNAMIC_DOWNCAST( CMiniDockFrameWnd, GetParentFrame() );
- if( IsFloating()
- && (! IsVisible() )
- && (! IsFixedMode() )
- )
- {
- if( pMiniFrame != NULL )
- {
- ASSERT_VALID( pMiniFrame );
- pMiniFrame->ModifyStyle( 0, FWS_SNAPTOBARS );
- }
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- else
- if( m_bAutoHideMode )
- bShow = FALSE;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pMiniFrame != NULL && bShow && m_pDockBar->GetSafeHwnd() != NULL )
- {
- CControlBar::DelayShow( bShow );
- CControlBar * pParentBar = DYNAMIC_DOWNCAST( CControlBar, m_pDockBar->GetParent() );
- if( pParentBar != NULL )
- pParentBar->DelayShow( bShow );
- else
- {
- pMiniFrame->RecalcLayout();
- pMiniFrame->ShowWindow( SW_SHOWNA );
- }
- return;
- }
- CControlBar::DelayShow( bShow );
- }
- void CExtControlBar::_UpdateVisibilityInChain()
- {
- LONG nDelayedRowUpdateMetric = m_nDelayedRowUpdateMetric;
- m_nDelayedRowUpdateMetric = 0;
- if( m_pDockBar == NULL && (!m_bPresubclassDialogMode) )
- return; // on destruction
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_bAutoHideMode )
- return;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( _DraggingGetBar() != NULL )
- return;
- if( _GetBarToggleFloatingState() != NULL )
- return;
- if( IsFixedMode() || IsFixedDockStyle()
- || m_pDockSite == NULL
- || m_pDockBar == NULL
- || IsDockSiteInPrintPreviewMode()
- // || ( m_pDockBar->GetSafeHwnd() != NULL
- // && ::IsWindow( m_pDockBar->GetSafeHwnd() )
- // && (!m_pDockBar->IsVisible())
- // )
- )
- return;
- ASSERT_VALID( m_pDockSite );
- if( m_bUpdatingChain )
- return;
- m_bUpdatingChain = true;
- m_nDelayedRowUpdateMetric = nDelayedRowUpdateMetric;
- _UpdateVisibilityInRow();
- BOOL bVisible = IsVisible();
- CExtDockDynBar * pDynDocker = DYNAMIC_DOWNCAST( CExtDockDynBar, m_pDockBar );
- if( pDynDocker != NULL )
- { // update parent dynamic docker with new visiblity options
- ASSERT_KINDOF( CExtDockDynBar, pDynDocker );
- CExtDynControlBar * pDynBar =
- STATIC_DOWNCAST(
- CExtDynControlBar,
- pDynDocker->GetParent()
- );
- ASSERT_VALID( pDynBar );
- // if( pDynBar->m_bUpdatingChain )
- // return;
-
- if( bVisible )
- {
- if( ! pDynBar->IsVisible() )
- m_pDockSite->ShowControlBar( pDynBar, TRUE, TRUE );
- // pDynDocker->OnDynamicLayoutUpdate();
- } // if( bVisible )
- else
- {
- INT nDockedVisibleCount = pDynDocker->GetDockedVisibleCount();
- if( nDockedVisibleCount == 0 )
- {
- if( pDynBar->IsVisible() )
- m_pDockSite->ShowControlBar( pDynBar, FALSE, TRUE );
- } // if( nDockedVisibleCount == 0 )
- } // else from if( bVisible )
- } // update parent dynamic docker with new visiblity options
- if( ! bVisible )
- { // if( ! bVisible ) - update child invisibility options
- if( IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- {
- CExtDockDynBar * pInnerDynDocker =
- ((CExtDynControlBar *) this)->m_pWndDynDocker;
- if( pInnerDynDocker != NULL )
- {
- //pInnerDynDocker->ShowAll( FALSE );
- for( INT nPos = 0; nPos < pInnerDynDocker->m_arrBars.GetSize(); nPos++ )
- {
- CControlBar * pBar = pInnerDynDocker->GetDockedControlBar( nPos );
- if( pBar == NULL )
- continue;
- CExtDynControlBar * pDynBar =
- DYNAMIC_DOWNCAST( CExtDynControlBar, pBar );
- if( pDynBar == NULL )
- continue;
- //pDynBar->m_bUpdatingChain = true;
- pDynBar->DelayShow( FALSE );
- //pDynBar->SetWindowPos(
- // NULL, 0, 0, 0, 0,
- // SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE
- // |SWP_NOACTIVATE
- // |SWP_HIDEWINDOW
- // |SWP_NOSENDCHANGING
- // );
- //pDynBar->m_bUpdatingChain = false;
- } // for( INT nPos = 0; nPos < pInnerDynDocker->m_arrBars.GetSize(); nPos++ )
- } // if( pInnerDynDocker != NULL )
- }
- } // if( ! bVisible ) - update child invisibility options
- CFrameWnd * pParentFrame = GetParentFrame();
- ASSERT_VALID( pParentFrame );
- if( pParentFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- pParentFrame->RecalcLayout();
- m_bUpdatingChain = false;
- }
- void CExtControlBar::_UpdateVisibilityInRow()
- {
- if( m_pDockBar == NULL && (!m_bPresubclassDialogMode) )
- return; // on destruction
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( m_bAutoHideMode )
- return;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( IsFixedMode() || IsFixedDockStyle()
- || m_pDockSite == NULL
- || m_pDockBar == NULL
- )
- return;
- ASSERT_VALID( m_pDockSite );
- // if( IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- // return;
- CExtDynControlBar * pDynBar =
- DYNAMIC_DOWNCAST( CExtDynControlBar, this );
- if( pDynBar != NULL
- && (! pDynBar->_IsDelayedVisibilityUpdateEnabled() )
- )
- return;
- ASSERT_VALID( m_pDockBar );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pTabbedBar = NULL;
- if( m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- {
- pTabbedBar =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pDockBar->GetParent()
- );
- ASSERT_VALID( pTabbedBar );
- pTabbedBar->UpdateBarVisibility( this );
- } // if( m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- BOOL bVisible = IsVisible();
- // recalc desired size in row after ShowWindow(SW_SHOW)
- UINT nDockBarID = GetSafeDockBarDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nDockBarID );
- if( nDockBarID == AFX_IDW_DOCKBAR_FLOAT )
- return;
- ASSERT_DOCKBAR_DLGCTRLID_DOCKED( nDockBarID );
- bool bHorz =
- ( nDockBarID == AFX_IDW_DOCKBAR_TOP
- || nDockBarID == AFX_IDW_DOCKBAR_BOTTOM
- ) ? true : false;
- if( !bVisible )
- {
- m_nDelayedRowUpdateMetric = bHorz
- ? m_sizeDockedH.cx
- : m_sizeDockedV.cy
- ;
- return;
- }
- if( m_nDelayedRowUpdateMetric == 0 )
- return;
- long nDelayedRowUpdateMetric = m_nDelayedRowUpdateMetric;
- m_nDelayedRowUpdateMetric = 0;
- ExtControlBarVector_t vRow;
- _GetRowExtBars( vRow );
- INT nCountInRow = (INT)vRow.GetSize();
- ASSERT( nCountInRow > 0 );
- if( nCountInRow == 1 )
- return;
- for( INT nBar = 0; nBar < nCountInRow; )
- {
- CExtControlBar * pBar = vRow[ nBar ];
- ASSERT_VALID( pBar );
- BOOL bBarIsVisible = pBar->IsVisible();
- bool bFixedBar = pBar->IsFixedMode();
- if( pBar == this
- || (!bBarIsVisible)
- || bFixedBar
- )
- {
- nCountInRow--;
- vRow.RemoveAt( nBar );
- continue;
- }
- LONG nRealBarExtent = bHorz
- ? pBar->m_sizeDockedH.cx
- : pBar->m_sizeDockedV.cy
- ;
- LONG nMinBarExtent = bHorz
- ? pBar->_CalcDesiredMinHW()
- : pBar->_CalcDesiredMinVH()
- ;
- if( nRealBarExtent <= nMinBarExtent )
- {
- nCountInRow--;
- vRow.RemoveAt( nBar );
- continue;
- }
- nBar ++;
- } // for( INT nBar = 0; nBar < nCountInRow; )
- if( nCountInRow == 0 )
- return;
- LONG nExtentDesizred = nDelayedRowUpdateMetric;
- for( ; nExtentDesizred > 0 && nCountInRow > 0; )
- {
- for( INT nBar = 0; nBar < nCountInRow; )
- {
- CExtControlBar * pBar = vRow[ nBar ];
- ASSERT_VALID( pBar );
- LONG & nRealBarExtentRef = bHorz
- ? pBar->m_sizeDockedH.cx
- : pBar->m_sizeDockedV.cy
- ;
- LONG nMinBarExtent = bHorz
- ? pBar->_CalcDesiredMinHW()
- : pBar->_CalcDesiredMinVH()
- ;
- ASSERT( nRealBarExtentRef > nMinBarExtent );
- nRealBarExtentRef --;
- nExtentDesizred --;
- if( nExtentDesizred == 0 )
- break;
- if( nRealBarExtentRef == nMinBarExtent )
- {
- nCountInRow--;
- vRow.RemoveAt( nBar );
- continue;
- }
- nBar ++;
- } // for( nBar = 0; nBar < nCountInRow; )
- } // for( ; nExtentDesizred > 0 && nCountInRow > 0; )
- }
- bool CExtControlBar::g_bControlBarClassRegistered = false;
- bool CExtControlBar::RegisterControlBarClass()
- {
- if( g_bControlBarClassRegistered )
- return true;
- WNDCLASS _wndClassInfo;
- HINSTANCE hInst = ::AfxGetInstanceHandle();
- if( ! ::GetClassInfo( hInst, __EXT_CONTROLBAR_CLASS_NAME, &_wndClassInfo ) )
- {
- _wndClassInfo.style = CS_GLOBALCLASS|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW;
- _wndClassInfo.lpfnWndProc = ::DefWindowProc;
- _wndClassInfo.cbClsExtra = _wndClassInfo.cbWndExtra = 0;
- _wndClassInfo.hInstance = hInst;
- _wndClassInfo.hIcon = NULL;
- _wndClassInfo.hCursor = ::LoadCursor( NULL, IDC_ARROW );
- ASSERT( _wndClassInfo.hCursor != NULL );
- _wndClassInfo.hbrBackground = NULL;
- _wndClassInfo.lpszMenuName = NULL;
- _wndClassInfo.lpszClassName = __EXT_CONTROLBAR_CLASS_NAME;
- if( !::AfxRegisterClass( &_wndClassInfo ) )
- {
- ASSERT( FALSE );
- //AfxThrowResourceException();
- return false;
- }
- }
- g_bControlBarClassRegistered = true;
- return true;
- }
- BOOL CExtControlBar::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( ( !RegisterControlBarClass() )
- || ( !CControlBar::PreCreateWindow(cs) )
- )
- {
- ASSERT( FALSE );
- return FALSE;
- }
-
- cs.lpszClass = __EXT_CONTROLBAR_CLASS_NAME;
- return TRUE;
- }
- void CExtControlBar::PreSubclassWindow()
- {
- CControlBar::PreSubclassWindow();
- // emulate for enabling update in user non-frame mode
- m_bInCustomModeUpdateCmdUI = false;
- if( ! m_bPresubclassDialogMode )
- { // if m_bPresubclassDialogMode was not set manually
- HWND hWndParent = ::GetParent( m_hWnd );
- if( hWndParent != NULL )
- {
- CWnd * pWndParent = CWnd::FromHandlePermanent( hWndParent );
- if( pWndParent != NULL )
- {
- if( ( ! pWndParent->IsKindOf(RUNTIME_CLASS(CControlBar)) )
- && ( ! pWndParent->IsKindOf(RUNTIME_CLASS(CFrameWnd)) )
- )
- {
- // non-frame mode
- // may be we are inside dialog
- __EXT_MFC_ULONG_PTR dwWndStyle = ::__EXT_MFC_GetWindowLong( m_hWnd, GWL_STYLE );
- m_dwStyle = DWORD(dwWndStyle & CBRS_ALL);
- m_bPresubclassDialogMode = true;
- }
- } // if( pWndParent != NULL )
- } // if( hWndParent != NULL )
- } // if m_bPresubclassDialogMode was not set manually
- if( m_dwStyle & CBRS_TOOLTIPS )
- EnableToolTips();
- if( ( (CWnd::GetExStyle()&(WS_EX_LAYOUTRTL|WS_EX_RTLREADING)) != 0 ) )
- {
- CWnd::ModifyStyleEx(
- WS_EX_LAYOUTRTL|WS_EX_RTLREADING,
- 0,
- SWP_FRAMECHANGED
- );
- ASSERT( (CWnd::GetExStyle()&(WS_EX_LAYOUTRTL|WS_EX_RTLREADING)) == 0 );
- } // if( ( (CWnd::GetExStyle()&(WS_EX_LAYOUTRTL|WS_EX_RTLREADING)) != 0 ) )
- AnimationSite_Init( false );
- }
- #define ID_TIMER_WAIT 0xE000 // timer while waiting to show status
- #define ID_TIMER_CHECK 0xE001 // timer to check for removal of status
- BOOL CExtControlBar::PreTranslateMessage(MSG* pMsg)
- {
- // CControlBar::PreTranslateMessage(MSG* pMsg)
- ASSERT_VALID(this);
- ASSERT(m_hWnd != NULL);
- // allow tooltip messages to be filtered
- if( CWnd::PreTranslateMessage(pMsg) )
- return TRUE;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CWnd * pWndParent = GetParent();
- if( pWndParent->GetSafeHwnd() != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS(CExtDockDynBar) )
- && pWndParent->PreTranslateMessage(pMsg)
- )
- return TRUE;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
-
- if( (m_nFlags&WF_OLECTLCONTAINER) != NULL
- && WM_KEYFIRST <= pMsg->message
- && pMsg->message <= WM_KEYLAST
- )
- { // analyze OLE keyboard message translation
- HWND hWndFocus = ::GetFocus();
- if( hWndFocus != NULL
- && ::IsChild( m_hWnd, hWndFocus )
- )
- { // if focus is inside
- HWND hWndOwn = m_hWnd;
- HWND hWnd = hWndFocus;
- for( ; hWnd != NULL && hWnd != hWndOwn; hWnd = ::GetParent(hWnd) )
- {
- if( ! ::IsWindow(hWndOwn) )
- return FALSE;
- CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- if( pWnd == NULL )
- continue;
- LPUNKNOWN pUnknown = pWnd->GetControlUnknown();
- if( pUnknown != NULL )
- {
- if( pWnd->PreTranslateMessage( pMsg ) )
- return TRUE;
- IOleInPlaceActiveObject * pOleInPlaceActiveObject = NULL;
- HRESULT hr =
- pUnknown->QueryInterface(
- __uuidof(IOleInPlaceActiveObject),
- (LPVOID*)(&pOleInPlaceActiveObject)
- );
- if( hr == S_OK )
- {
- ASSERT( pOleInPlaceActiveObject != NULL );
- hr =
- pOleInPlaceActiveObject->TranslateAccelerator(
- pMsg
- );
- pOleInPlaceActiveObject->Release();
- if( hr == S_OK )
- return TRUE;
- } // if( hr == S_OK )
- } // if( pUnknown != NULL )
- } // for( ; hWnd != NULL && hWnd != hWndOwn; hWnd = ::GetParent(hWnd) )
- } // if focus is inside
- } // analyze OLE keyboard message translation
- CWnd * pOwner = GetOwner();
- #if _MFC_VER < 0x700
- UINT message = pMsg->message;
- // handle CBRS_FLYBY style (status bar flyby help)
- if( ( ( m_dwStyle & CBRS_FLYBY)
- || message == WM_LBUTTONDOWN
- || message == WM_LBUTTONUP
- )
- &&
- ( ( message >= __EXT_MFC_WM_MOUSEFIRST
- && message <= __EXT_MFC_WM_MOUSELAST
- ) ||
- ( message >= WM_NCMOUSEFIRST
- && message <= WM_NCMOUSELAST
- )
- )
- &&
- ( (! CExtToolControlBar::g_bMenuTracking
- || CExtPopupMenuWnd::IsMenuTracking()
- )
- )
- )
- {
- //#if _MFC_VER < 0x700
- _AFX_THREAD_STATE * pThreadState =
- ::AfxGetThreadState();
- //#else
- // AFX_MODULE_THREAD_STATE * pThreadState =
- // //::AfxGetModuleThreadState();
- // //AfxGetModuleState()->m_thread.GetData();
- // ::AfxGetThreadState()->m_pModuleState->m_thread.GetData();
- //#endif
- // gather information about current mouse position
- CPoint point = pMsg->pt;
- ScreenToClient( &point );
- TOOLINFO _ti;
- ::memset( &_ti, 0, sizeof(TOOLINFO) );
- _ti.cbSize = sizeof(AFX_OLDTOOLINFO);
- __EXT_MFC_INT_PTR nHit = OnToolHitTest( point, &_ti );
- if( _ti.lpszText != NULL
- && _ti.lpszText != LPSTR_TEXTCALLBACK
- )
- free( _ti.lpszText );
- BOOL bNotButton =
- message == WM_LBUTTONDOWN && (_ti.uFlags & TTF_NOTBUTTON);
- if (message != WM_LBUTTONDOWN && GetKeyState(VK_LBUTTON) < 0)
- nHit = pThreadState->m_nLastStatus;
- // update state of status bar
- if (nHit < 0 || bNotButton)
- {
- if (GetKeyState(VK_LBUTTON) >= 0 || bNotButton)
- {
- SetStatusText(-1);
- KillTimer(ID_TIMER_CHECK);
- }
- }
- else
- {
- if (message == WM_LBUTTONUP)
- {
- SetStatusText(-1);
- ResetTimer(ID_TIMER_CHECK, 200);
- }
- else
- {
- if ((m_nStateFlags & statusSet) || GetKeyState(VK_LBUTTON) < 0)
- SetStatusText(nHit);
- else if (nHit != pThreadState->m_nLastStatus)
- ResetTimer(ID_TIMER_WAIT, 300);
- }
- }
- pThreadState->m_nLastStatus = nHit;
- }
- #endif
- // don't translate dialog messages when in Shift+F1 help mode
- CFrameWnd* pFrameWnd = GetTopLevelFrame();
- if( pFrameWnd != NULL && pFrameWnd->m_bHelpMode )
- return FALSE;
- if( ! m_bPresubclassDialogMode )
- {
- // since 'IsDialogMessage' will eat frame window accelerators,
- // we call all frame windows' PreTranslateMessage first
- while( pOwner != NULL )
- {
- HWND hWndOwner = pOwner->GetSafeHwnd();
- ASSERT( hWndOwner != NULL );
- if( !::IsWindow(hWndOwner) )
- break;
- if( CWnd::FromHandlePermanent(hWndOwner) == NULL )
- break;
- // allow owner & frames to translate before IsDialogMessage does
- if (pOwner->PreTranslateMessage(pMsg))
- return TRUE;
- // try parent frames until there are no parent frames
- pOwner = pOwner->GetParentFrame();
- }
-
- // HWND hWndChild = ::GetWindow( m_hWnd, GW_CHILD );
- // if( hWndChild != NULL
- // && pMsg->hwnd != NULL
- // && WM_KEYFIRST <= pMsg->message
- // && pMsg->message <= WM_KEYLAST
- // && ::IsChild( hWndChild, pMsg->hwnd )
- // )
- // {
- // ::TranslateMessage( pMsg );
- // ::DispatchMessage( pMsg );
- // return TRUE;
- // }
- } // if( !m_bPresubclassDialogMode )
- return FALSE;
- // // filter both messages to dialog and from children
- // return PreTranslateInput(pMsg);
- }
- __EXT_MFC_INT_PTR CExtControlBar::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- ) const
- {
- ASSERT_VALID( this );
- if( CExtToolControlBar::g_bMenuTracking
- || CExtPopupMenuWnd::IsMenuTracking()
- || OnAdvancedPopupMenuTipWndGet() != NULL
- || m_bSuspendTips
- )
- return -1;
- CPoint ptScreen( point );
- ClientToScreen( &ptScreen );
- CExtBarNcAreaButton * pBtn = NULL;
- ( const_cast < CExtControlBar * > ( this ) ) ->
- NcButtons_HitTest( ptScreen, &pBtn );
- if( pBtn != NULL )
- {
- ASSERT_VALID( pBtn );
- return pBtn->OnToolHitTest( point, pTI );
- }
- return -1; //CControlBar::OnToolHitTest( point, pTI );
- }
- CExtPopupMenuTipWnd * CExtControlBar::OnAdvancedPopupMenuTipWndGet(
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- if( ! g_bUseAdvancedToolTips )
- return NULL;
- if( m_bSuspendTips )
- return NULL;
- if( ( ( ( const_cast < CExtControlBar * > ( this ) ) -> GetBarStyle() ) & CBRS_TOOLTIPS ) == 0 )
- return NULL;
- return (&( CExtPopupMenuSite::g_DefPopupMenuSite.GetTip() ));
- }
- void CExtControlBar::OnAdvancedPopupMenuTipWndDisplay(
- CExtPopupMenuTipWnd & _ATTW,
- const RECT & rcExcludeArea,
- __EXT_MFC_SAFE_LPCTSTR strTipText,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( strTipText != NULL && _tcslen( strTipText ) > 0 );
- pHelperSrc;
- lParam;
- if( IsFixedMode()
- && IsFixedDockStyle()
- && ( ( m_pDockSite != NULL
- && GetSafeDockBarDlgCtrlID() == AFX_IDW_DOCKBAR_BOTTOM
- )
- || ( ( ( const_cast < CExtControlBar * > ( this ) ) -> GetBarStyle() ) & CBRS_ALIGN_BOTTOM ) != 0
- )
- )
- _ATTW.SetTipStyle( CExtPopupMenuTipWnd::__ETS_INV_RECTANGLE_NO_ICON );
- else
- _ATTW.SetTipStyle( CExtPopupMenuTipWnd::__ETS_RECTANGLE_NO_ICON );
- _ATTW.SetText( strTipText );
- _ATTW.Show( (CWnd*)this, rcExcludeArea );
- }
- HWND CExtControlBar::FindHwndNotSafeForMutualPaint(
- CWnd * pWndStartSearch
- )
- {
- ASSERT_VALID( pWndStartSearch );
- if( ( pWndStartSearch->GetStyle() & WS_VISIBLE ) == 0 )
- return NULL;
- CFrameWnd * pFrame = DockSiteFromWnd( pWndStartSearch );
- if( pFrame != NULL )
- {
- ASSERT_VALID( pFrame );
- if( ( pFrame->GetStyle() & WS_VISIBLE ) == 0 )
- return NULL;
- //#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- // for( HWND hWnd =
- // ::GetWindow(
- // pFrame->GetSafeHwnd(),
- // GW_CHILD
- // );
- // hWnd != NULL;
- // hWnd =
- // ::GetWindow(
- // hWnd,
- // GW_HWNDNEXT
- // )
- // )
- // {
- // CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
- // if( pWnd == NULL )
- // continue;
- // CExtDynAutoHideSlider * pSlider =
- // DYNAMIC_DOWNCAST( CExtDynAutoHideSlider, pWnd );
- // if( pSlider != NULL )
- // {
- // if( (pSlider->GetStyle() & WS_VISIBLE) == 0 )
- // break;
- // if( pSlider->m_nResizingMode != HTCLIENT )
- // return hWnd;
- // }
- // }
- //#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- } // if( pFrame != NULL )
- HWND hWndRetVal = NULL;
- //CSingleLock _slCsCB( &g_csCB );
- // _slCsCB.Lock();
- CExtControlBar * pBar = _DraggingGetBar();
- if( pBar != NULL )
- {
- if( pBar->_IsShowContentWhenDragging() )
- {
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- if( (! pBar->IsFixedMode() )
- && (! pBar->IsFixedDockStyle() )
- && INT(pBar->OnQueryDockingType()) >= INT(__RESIZABLE_DOCKING_TYPE_STUDIO_2005)
- && ( ! g_PaintManager.m_bLayeredHighlighting2005 )
- )
- {
- POINT ptCursor;
- if( ::GetCursorPos( &ptCursor ) )
- {
- HWND hWndFromPoint = ::WindowFromPoint( ptCursor );
- if( hWndFromPoint != NULL )
- {
- ASSERT( ::IsWindow(hWndFromPoint) );
- CWnd * pWnd = CWnd::FromHandlePermanent( hWndFromPoint );
- if( pWnd != NULL )
- {
- CExtDynDockMarkerWnd * pDockMarkerWnd =
- DYNAMIC_DOWNCAST( CExtDynDockMarkerWnd, pWnd );
- if( pDockMarkerWnd != NULL )
- hWndRetVal = pBar->GetSafeHwnd();
- } // if( pWnd != NULL )
- } // if( hWndFromPoint != NULL )
- } // if( ::GetCursorPos( &ptCursor ) )
- }
- #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
- } // if( pBar->_IsShowContentWhenDragging() )
- else
- hWndRetVal = pBar->GetSafeHwnd();
- } // if( pBar != NULL )
- else
- {
- int nCountOfBars = (int)g_AllBars.GetSize();
- for( int nBar = 0; nBar < nCountOfBars; nBar++ )
- {
- pBar = g_AllBars[nBar];
- ASSERT_KINDOF( CExtControlBar, pBar );
- if( pBar->GetSafeHwnd() == NULL )
- continue;
- if( pBar->m_bRowRecalcing
- && ( !pBar->_IsShowContentWhenRowRecalcing() )
- )
- {
- hWndRetVal = pBar->GetSafeHwnd();
- break;
- }
- if( pBar->m_bRowResizing
- && ( !pBar->_IsShowContentWhenRowResizing() )
- )
- {
- hWndRetVal = pBar->GetSafeHwnd();
- break;
- }
- } // for( int nBar = 0; nBar < nCountOfBars; nBar++ )
- } // else from if( pBar != NULL )
- // _slCsCB.Unlock();
- return hWndRetVal;
- }
- CFrameWnd * CExtControlBar::DockSiteFromWnd(
- CWnd * pWndStartSearch
- )
- {
- ASSERT_VALID( pWndStartSearch );
- CFrameWnd * pFrame =
- DYNAMIC_DOWNCAST(
- CFrameWnd,
- pWndStartSearch
- );
- if( pFrame != NULL )
- return pFrame;
- pFrame = pWndStartSearch->GetParentFrame();
- if( pFrame == NULL )
- return NULL;
- ASSERT_VALID( pFrame );
- if( ! pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- return pFrame;
- pFrame = pFrame->GetParentFrame();
- if( pFrame == NULL )
- return NULL;
- ASSERT_VALID( pFrame );
- ASSERT( !pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) );
- return pFrame;
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- void CExtControlBar::OnCustomizeModeEnter()
- {
- ASSERT_VALID( this );
- if( IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- return;
- CWnd * pWndChild = GetWindow( GW_CHILD );
- if( pWndChild->GetSafeHwnd() != NULL )
- pWndChild->EnableWindow( FALSE );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- else if( AutoHideModeGet() )
- {
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- CExtDynAutoHideArea * pWndAutoHideArea =
- ((CExtDockBar*)m_pDockBar)->_GetAutoHideArea();
- if( pWndAutoHideArea != NULL
- && pWndAutoHideArea->m_pWndSlider != NULL
- )
- {
- ASSERT_VALID( pWndAutoHideArea );
- ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
- pWndChild = pWndAutoHideArea->m_pWndSlider->GetWindow( GW_CHILD );
- if( pWndChild->GetSafeHwnd() != NULL )
- pWndChild->EnableWindow( FALSE );
- } // if( pWndAutoHideArea != NULL ...
- } // else if( AutoHideModeGet() )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- void CExtControlBar::OnCustomizeModeLeave()
- {
- ASSERT_VALID( this );
- if( IsKindOf(RUNTIME_CLASS(CExtDynControlBar)) )
- return;
- CWnd * pWndChild = GetWindow( GW_CHILD );
- if( pWndChild->GetSafeHwnd() != NULL )
- pWndChild->EnableWindow( TRUE );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- else if( AutoHideModeGet() )
- {
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- CExtDynAutoHideArea * pWndAutoHideArea =
- ((CExtDockBar*)m_pDockBar)->_GetAutoHideArea();
- if( pWndAutoHideArea != NULL
- && pWndAutoHideArea->m_pWndSlider != NULL
- )
- {
- ASSERT_VALID( pWndAutoHideArea );
- ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
- pWndChild = pWndAutoHideArea->m_pWndSlider->GetWindow( GW_CHILD );
- if( pWndChild->GetSafeHwnd() != NULL )
- pWndChild->EnableWindow( TRUE );
- } // if( pWndAutoHideArea != NULL ...
- } // else if( AutoHideModeGet() )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- void CExtControlBar::OnCustomizeListBoxUpdate( CExtCustomizeToolbarsListBox * pWndList )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pWndList );
- if( !m_bVisibleInCustomizeListBox )
- return;
- pWndList->AddBar( this );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- bool CExtControlBar::_IsDockSiteCustomizeMode() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = NotifiedCustomizeSiteGet();
- if( pSite != NULL )
- return pSite->IsCustomizeMode();
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return false;
- }
- void CExtControlBar::_ActivateOnClick()
- {
- ASSERT_VALID( this );
- HWND hWndOwn = GetSafeHwnd();
- if( hWndOwn == NULL
- || (! ::IsWindow( hWndOwn ) )
- )
- return;
- HWND hWndActivate = NULL;
- if( m_bPresubclassDialogMode )
- hWndActivate = ::GetParent( hWndOwn );
- else
- hWndActivate = _GetDockingFrameImpl()->GetSafeHwnd();
- if( hWndActivate == NULL )
- {
- if( stat_QueryFocusChangingEnabled( this, hWndOwn ) )
- ::SetFocus( hWndOwn );
- return;
- }
- CWnd * pWndPermanent =
- CWnd::FromHandlePermanent( hWndActivate );
- if( pWndPermanent != NULL )
- {
- CMDIChildWnd * pWndMDIChild =
- DYNAMIC_DOWNCAST( CMDIChildWnd, pWndPermanent );
- if( pWndMDIChild != NULL )
- {
- CFrameWnd * pWndFrame =
- pWndMDIChild->GetParentFrame();
- if( pWndFrame != NULL )
- {
- CMDIFrameWnd * pWndMDIFrame =
- DYNAMIC_DOWNCAST( CMDIFrameWnd, pWndFrame );
- if( pWndMDIFrame != NULL )
- {
- CMDIChildWnd * pActive =
- pWndMDIFrame->MDIGetActive();
- if( pWndMDIChild != pActive )
- pWndMDIChild->MDIActivate();
- return;
- }
- }
- }
- }
- HWND hWndFocus = ::GetFocus();
- if( hWndFocus == NULL )
- {
- if( stat_QueryFocusChangingEnabled( this, hWndActivate ) )
- ::SetFocus( hWndActivate );
- return;
- }
- if( hWndActivate != hWndFocus
- || (! ::IsChild(hWndActivate, hWndFocus) )
- )
- {
- if( ! OnQueryBarHoverProcessingEnabled() )
- {
- if( stat_QueryFocusChangingEnabled( this, hWndActivate ) )
- ::SetFocus( hWndActivate );
- }
- }
- }
- void CExtControlBar::_OnNcMiniFrameActivate( bool bActive )
- {
- ASSERT_VALID( this );
- bActive;
- }
- CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- QUERY_REPOSITION_CALC_EFFECT_DATA(
- SHORT nFlags,
- CWnd * pWndToReposChilds,
- UINT nIDFirst,
- UINT nIDLast,
- UINT nIDLeftOver,
- LPRECT lpRectParam,
- LPCRECT lpcRectClient,
- bool bStretch
- )
- : m_nFlags( nFlags )
- , m_pWndToReposChilds( pWndToReposChilds )
- , m_nIDFirst( nIDFirst )
- , m_nIDLast( nIDLast )
- , m_nIDLeftOver( nIDLeftOver )
- , m_lpRectParam( lpRectParam )
- , m_lpcRectClient( lpcRectClient )
- , m_bStretch( bStretch )
- {
- ASSERT_VALID( m_pWndToReposChilds );
- ASSERT( m_pWndToReposChilds->GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow( m_pWndToReposChilds->GetSafeHwnd() ) );
- ASSERT( ((int)__PRCF_WND_REPOS_DEFAULT) == ((int)CWnd::reposDefault) );
- ASSERT( ((int)__PRCF_WND_REPOS_QUERY) == ((int)CWnd::reposQuery) );
- ASSERT( ((int)__PRCF_WND_REPOS_EXTRA) == ((int)CWnd::reposExtra) );
- }
- CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- ~QUERY_REPOSITION_CALC_EFFECT_DATA()
- {
- }
- void CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- QueryTypeSet( SHORT nQueryType )
- {
- const SHORT nTest = SHORT(__PRCF_WND_REPOS_MASK);
- nQueryType &= nTest;
- m_nFlags &= ~nTest;
- m_nFlags |= nQueryType;
- }
- SHORT CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- QueryTypeGet() const
- {
- const SHORT nTest = SHORT(__PRCF_WND_REPOS_MASK);
- SHORT nRetVal = SHORT( m_nFlags & nTest );
- return nRetVal;
- }
- bool CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- IsQueryReposDefault() const
- {
- bool bRetVal =
- ( ((int)QueryTypeGet()) == ((int)CWnd::reposDefault) )
- ? true : false;
- return bRetVal;
- }
- bool CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- IsQueryReposQuery() const
- {
- bool bRetVal =
- ( ((int)QueryTypeGet()) == ((int)CWnd::reposQuery) )
- ? true : false;
- return bRetVal;
- }
- bool CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- IsQueryReposExtra() const
- {
- bool bRetVal =
- ( ((int)QueryTypeGet()) == ((int)CWnd::reposExtra) )
- ? true : false;
- return bRetVal;
- }
- CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- operator WPARAM() const
- {
- return ( (WPARAM) this );
- }
- void CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- ExcludeFromCenterSet(
- bool bExclude // = true
- )
- {
- const SHORT nTest = SHORT(__PRCF_EXCLUDE_FROM_CENTER);
- if( bExclude )
- m_nFlags |= nTest;
- else
- m_nFlags &= ~nTest;
- }
- bool CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA::
- ExcludeFromCenterGet() const
- {
- const SHORT nTest = SHORT(__PRCF_EXCLUDE_FROM_CENTER);
- bool bRetVal = ( (m_nFlags&nTest) != 0 ) ? true : false;
- return bRetVal;
- }
- void CExtControlBar::RepositionBarsEx(
- CWnd * pWndToReposChilds,
- UINT nIDFirst,
- UINT nIDLast,
- UINT nIDLeftOver,
- UINT nFlag, // = reposDefault
- LPRECT lpRectParam, // = NULL
- LPCRECT lpRectClient, // = NULL
- BOOL bStretch // = TRUE
- )
- {
- ASSERT_VALID( pWndToReposChilds );
- ASSERT( nFlag == 0 || nFlag == reposQuery || nFlag == reposExtra );
- AFX_SIZEPARENTPARAMS layout;
- HWND hWndLeftOver = NULL;
- layout.bStretch = bStretch;
- layout.sizeTotal.cx = layout.sizeTotal.cy = 0;
- if( lpRectClient != NULL )
- layout.rect = *lpRectClient; // starting rect comes from parameter
- else
- pWndToReposChilds->GetClientRect(
- &layout.rect // starting rect comes from client rect
- );
- ASSERT( layout.rect.left <= layout.rect.right );
- if( nFlag != 1 )
- layout.hDWP = ::BeginDeferWindowPos(8); // reasonable guess
- else
- layout.hDWP = NULL; // not actually doing layout
- for( HWND hWndChild = ::GetTopWindow( pWndToReposChilds->m_hWnd );
- hWndChild != NULL;
- hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT )
- )
- {
- UINT nIDC = _AfxGetDlgCtrlID(hWndChild);
- CWnd * pWnd = CWnd::FromHandlePermanent( hWndChild );
- if( nIDC == nIDLeftOver )
- hWndLeftOver = hWndChild;
- else if( pWnd != NULL )
- {
- QUERY_REPOSITION_CALC_EFFECT_DATA _qrced(
- (SHORT)nFlag,
- pWndToReposChilds,
- nIDFirst,
- nIDLast,
- nIDLeftOver,
- lpRectParam,
- lpRectClient,
- bStretch ? true : false
- );
- pWnd->SendMessage(
- g_nMsgQueryRepositionCalcEffect,
- _qrced,
- 0L
- );
- if( nFlag == 1 && _qrced.ExcludeFromCenterGet() )
- {
- ASSERT( _qrced.IsQueryReposQuery() );
- continue;
- }
- if(
- nIDC >= nIDFirst
- && nIDC <= nIDLast
- )
- ::SendMessage(
- hWndChild,
- WM_SIZEPARENT,
- 0,
- (LPARAM)&layout
- );
- }
- }
- // if just getting the available rectangle, return it now...
- if( nFlag == 1 )
- {
- ASSERT(lpRectParam != NULL);
- if( bStretch )
- ::CopyRect( lpRectParam, &layout.rect );
- else
- {
- lpRectParam->left = lpRectParam->top = 0;
- lpRectParam->right = layout.sizeTotal.cx;
- lpRectParam->bottom = layout.sizeTotal.cy;
- }
- return;
- }
- // the rest is the client size of the left-over pane
- if( nIDLeftOver != 0 && hWndLeftOver != NULL )
- {
- CWnd* pLeftOver = CWnd::FromHandle(hWndLeftOver);
- // allow extra space as specified by lpRectBorder
- if( nFlag == 2 )
- {
- ASSERT(lpRectParam != NULL);
- layout.rect.left += lpRectParam->left;
- layout.rect.top += lpRectParam->top;
- layout.rect.right -= lpRectParam->right;
- layout.rect.bottom -= lpRectParam->bottom;
- }
- // reposition the window
- pLeftOver->CalcWindowRect( &layout.rect );
- AfxRepositionWindow( &layout, hWndLeftOver, &layout.rect );
- }
- // move and resize all the windows at once!
- if( layout.hDWP == NULL
- || !::EndDeferWindowPos( layout.hDWP )
- )
- TRACE0("Warning: DeferWindowPos failed - low system resources.n");
- }
- void CExtControlBar::_PreSyncRowMetrics()
- {
- ASSERT_VALID( this );
- if( IsVisible()
- || IsFloating()
- )
- return;
- //m_nDelayedRowUpdateMetric = 0;
- ExtControlBarVector_t vRow;
- _GetRowExtBars( vRow );
- INT nCount = (INT)vRow.GetSize();
- INT i = 0;
- for( i = 0; i < nCount; )
- {
- CExtControlBar * pBar = vRow[ i ];
- ASSERT_VALID( pBar );
- if( !pBar->IsVisible()
- || pBar->IsFixedMode()
- || pBar->IsFixedDockStyle()
- || pBar == this
- )
- {
- vRow.RemoveAt( i );
- nCount--;
- }
- else
- i++;
- }
- UINT nDockbarID = GetSafeDockBarDlgCtrlID();
- ASSERT_DOCKBAR_DLGCTRLID( nDockbarID );
- bool bHorz =
- (nDockbarID == AFX_IDW_DOCKBAR_TOP || nDockbarID == AFX_IDW_DOCKBAR_BOTTOM)
- ? true : false;
- LONG nOwnMetric = bHorz ? m_sizeDockedH.cx : m_sizeDockedV.cy;
- if( nOwnMetric == 0 )
- {
- nOwnMetric = bHorz ? _CalcDesiredMinHW() : _CalcDesiredMinVH();
- (bHorz ? m_sizeDockedH.cx : m_sizeDockedV.cy) = nOwnMetric;
- }
- LONG & nCrossMetricOwnRef = bHorz ? m_sizeDockedH.cy : m_sizeDockedV.cx;
- LONG nCrossMetricOther = -1;
- for( i = 0; i < nCount && nOwnMetric > 0; )
- {
- CExtControlBar * pBar = vRow[ i ];
- //pBar->m_nDelayedRowUpdateMetric = 0;
- LONG & nRefBarMetric = bHorz ? pBar->m_sizeDockedH.cx : pBar->m_sizeDockedV.cy;
- LONG nBarMinMetric = bHorz ? pBar->_CalcDesiredMinHW() : pBar->_CalcDesiredMinVH();
- if( nCrossMetricOther <= 0 )
- nCrossMetricOther = bHorz ? pBar->m_sizeDockedH.cy : pBar->m_sizeDockedV.cx;
- if( nRefBarMetric <= nBarMinMetric )
- {
- vRow.RemoveAt( i );
- nCount--;
- if( nCount == 0 )
- break;
- continue;
- }
- nRefBarMetric --;
- nOwnMetric --;
- ASSERT( nOwnMetric >= 0 );
- if( nOwnMetric == 0 )
- break;
- i++;
- ASSERT( i <= nCount );
- if( i == nCount )
- i = 0;
- }
- if( nCrossMetricOther > 0 )
- nCrossMetricOwnRef = nCrossMetricOther;
- }
- void CExtControlBar::OnFrameBarCheckCmd(
- bool bResizableCheckmarks // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- ASSERT(ID_VIEW_STATUS_BAR == AFX_IDW_STATUS_BAR);
- ASSERT(ID_VIEW_TOOLBAR == AFX_IDW_TOOLBAR);
- ASSERT(ID_VIEW_REBAR == AFX_IDW_REBAR);
- CFrameWnd * pParentFrame = GetParentFrame();
- // if( bResizableCheckmarks // (- v.2.23)
- // || IsFixedDockStyle()
- // )
- bool bVisible = ((GetStyle() & WS_VISIBLE) != 0) ? true : false;
- if( IsFixedDockStyle()
- || ( bResizableCheckmarks && bVisible ) // (+ v.2.23)
- )
- {
- m_pDockSite->ShowControlBar(
- this,
- bVisible ? FALSE : TRUE,
- FALSE
- );
- // SetTimer( __TIMER_ID_DELAYED_UPDATE, 150, NULL );
- return;
- }
- ASSERT( ! IsFixedDockStyle() );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( AutoHideModeGet() )
- {
- ASSERT_VALID( m_pDockBar );
- ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- CExtDynAutoHideArea * pWndAutoHideArea =
- ((CExtDockBar*)m_pDockBar)->_GetAutoHideArea();
- ASSERT_VALID( pWndAutoHideArea );
- ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
- if( pWndAutoHideArea->m_pWndSlider->m_bActiveState
- && pWndAutoHideArea->m_pWndSlider->_GetBar() == this
- )
- return;
- LONG nIndex = pWndAutoHideArea->FindControlBar( this );
- if( nIndex < 0 )
- {
- ASSERT( FALSE );
- return;
- }
- pWndAutoHideArea->SelectionSet( nIndex, true, true );
- // ASSERT( pWndAutoHideArea->m_pWndSlider->m_bActiveState );
- // ASSERT( pWndAutoHideArea->m_pWndSlider->m_pBar == this );
- // ASSERT( pWndAutoHideArea->m_pWndSlider->GetStyle() & WS_VISIBLE );
- if( stat_QueryFocusChangingEnabled( this, pWndAutoHideArea->m_pWndSlider->m_hWnd ) )
- pWndAutoHideArea->m_pWndSlider->SetFocus();
- // SetTimer( __TIMER_ID_DELAYED_UPDATE, 150, NULL );
- return;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( ! bVisible )
- {
- _DisplayingSet( true );
- m_pDockSite->ShowControlBar( this, TRUE, FALSE );
- CExtMiniDockFrameWnd * pMiniFrame = DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pParentFrame );
- if( pMiniFrame != NULL )
- {
- _UpdateVisibilityInChain();
- pMiniFrame->RecalcLayout();
- }
- } // if( ! bVisible )
- ASSERT_VALID( m_pDockBar );
- // ASSERT_KINDOF( CExtDockBar, m_pDockBar );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( ((CExtDockBar*)m_pDockBar)->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
- {
- CExtDynTabControlBar * pTabbed =
- STATIC_DOWNCAST(
- CExtDynTabControlBar,
- m_pDockBar->GetParent()
- );
- CRect rc;
- pTabbed->GetWindowRect( &rc );
- CSize _size = rc.Size();
- pTabbed->SetInitDesiredSizeFloating( _size );
- pTabbed->SetInitDesiredSizeHorizontal( _size );
- pTabbed->SetInitDesiredSizeVertical( _size );
- pTabbed->m_pDockContext->m_sizeLast = _size;
- pTabbed->SelectControlBar( this );
- pTabbed->_DisplayingSet( true );
- pParentFrame->DelayRecalcLayout();
- if( stat_QueryFocusChangingEnabled( this, m_hWnd ) )
- SetFocus();
- // SetTimer( __TIMER_ID_DELAYED_UPDATE, 150, NULL );
- return;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pParentFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) )
- pParentFrame->BringWindowToTop();
- pParentFrame->DelayRecalcLayout();
- if( stat_QueryFocusChangingEnabled( this, m_hWnd ) )
- SetFocus();
- // SetTimer( __TIMER_ID_DELAYED_UPDATE, 150, NULL );
- }
- void CExtControlBar::OnFrameBarCheckUpdate(
- CCmdUI * pCmdUI,
- bool bResizableCheckmarks // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( m_pDockSite );
- ASSERT(ID_VIEW_STATUS_BAR == AFX_IDW_STATUS_BAR);
- ASSERT(ID_VIEW_TOOLBAR == AFX_IDW_TOOLBAR);
- ASSERT(ID_VIEW_REBAR == AFX_IDW_REBAR);
- BOOL bEnabled = _ClosingIsEnabled( this ) ? TRUE : FALSE;
- pCmdUI->Enable( bEnabled );
- if( bResizableCheckmarks
- || IsFixedDockStyle()
- )
- {
- pCmdUI->SetCheck(
- (GetStyle() & WS_VISIBLE) != 0
- );
- return;
- }
- }
- BOOL CExtControlBar::DoFrameBarCheckCmd(
- CFrameWnd * pFrame,
- UINT nBarID,
- bool bResizableCheckmarks // = false
- )
- {
- ASSERT_VALID( pFrame );
- CControlBar * pBar = pFrame->GetControlBar( nBarID );
- if( pBar != NULL )
- {
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- ((CExtControlBar*)pBar)->
- OnFrameBarCheckCmd( bResizableCheckmarks );
- else
- pFrame->ShowControlBar(
- pBar,
- (pBar->GetStyle() & WS_VISIBLE) == 0,
- FALSE
- );
- return TRUE;
- }
- return FALSE;
- }
- void CExtControlBar::DoFrameBarCheckUpdate(
- CFrameWnd * pFrame,
- CCmdUI * pCmdUI,
- bool bResizableCheckmarks // = false
- )
- {
- ASSERT_VALID( pFrame );
- CControlBar * pBar = pFrame->GetControlBar( pCmdUI->m_nID );
- if( pBar != NULL )
- {
- if( pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
- ((CExtControlBar*)pBar)->
- OnFrameBarCheckUpdate( pCmdUI, bResizableCheckmarks );
- else
- pCmdUI->SetCheck(
- (pBar->GetStyle() & WS_VISIBLE) != 0
- );
- return;
- }
- pCmdUI->ContinueRouting();
- }
- void CExtControlBar::OnSetFocus(CWnd* pOldWnd)
- {
- CControlBar::OnSetFocus(pOldWnd);
- if( IsFixedMode() )
- return;
-
- HWND hWndChild = ::GetWindow( GetSafeHwnd(), GW_CHILD );
- if( hWndChild != NULL )
- {
- if( stat_QueryFocusChangingEnabled( this, hWndChild ) )
- ::SetFocus( hWndChild );
- }
- }
- bool CExtControlBar::OnConstructDockSiteControlBarPopupMenu(
- CExtPopupMenuWnd * pPopup
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( GetSafeHwnd() != NULL );
- ASSERT( ::IsWindow(GetSafeHwnd()) );
- ASSERT_VALID( pPopup );
- if( ! m_bAppearInDockSiteControlBarPopupMenu )
- return false;
- if( g_bLockAllBars )
- return false;
- UINT nBarID = (UINT)GetDlgCtrlID();
- VERIFY( pPopup->ItemInsert( nBarID ) );
-
- return true;
- }
- LRESULT CExtControlBar::OnHelpHitTest(WPARAM wParam, LPARAM lParam)
- {
- HWND hWndCapture = ::GetCapture();
- if( hWndCapture != NULL && hWndCapture == GetSafeHwnd() )
- SendMessage( WM_CANCELMODE );
- LRESULT lResult = DoHelpHitTest( CPoint(DWORD(lParam)) );
- if( lResult == -3L )
- return 0L;
- if( lResult == -2L )
- return -1L;
- if( lResult != -1L )
- return HID_BASE_COMMAND+lResult;
- return CControlBar::OnHelpHitTest(wParam,lParam);
- }
- LRESULT CExtControlBar::DoHelpHitTest( CPoint ptHelpHitTest )
- {
- ASSERT_VALID( this );
- ptHelpHitTest;
- return -1L;
- }
- bool CExtControlBar::g_bUseCmdManagerForSetMessageString = true;
- void CExtControlBar::stat_SetMessageString(
- CWnd * pWnd,
- UINT nCmdID // = AFX_IDS_IDLEMESSAGE
- )
- {
- if( pWnd->GetSafeHwnd() == NULL
- || (! ::IsWindow(pWnd->GetSafeHwnd()) )
- )
- return;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite =
- CExtCustomizeSite::GetCustomizeSite( pWnd->m_hWnd );
- if( pSite != NULL
- && pSite->IsCustomizeMode()
- )
- nCmdID = AFX_IDS_IDLEMESSAGE;
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- CFrameWnd * pFrame = DYNAMIC_DOWNCAST( CFrameWnd, pWnd );
- if( pFrame == NULL && (pWnd->GetStyle() & WS_CHILD) != 0 )
- pFrame = pWnd->GetParentFrame();
- if( pFrame != NULL
- && pFrame->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd))
- )
- pFrame = pFrame->GetParentFrame();
- HWND hWnd =
- pFrame != NULL
- ? pFrame->m_hWnd
- : pWnd->m_hWnd;
- if( g_bUseCmdManagerForSetMessageString
- && nCmdID != AFX_IDS_IDLEMESSAGE
- )
- {
- __EXT_MFC_SAFE_LPCTSTR strProfile = g_CmdManager->ProfileNameFromWnd( pWnd->m_hWnd );
- if( strProfile != NULL )
- {
- CExtCmdItem * pCmdItem = g_CmdManager->CmdGetPtr( strProfile, nCmdID );
- if( pCmdItem != NULL )
- {
- CWnd * pTempBar =
- CWnd::FromHandlePermanent(
- ::GetDlgItem( hWnd, AFX_IDW_STATUS_BAR )
- );
- if( pTempBar != NULL )
- {
- CStatusBar * pStatusBar =
- DYNAMIC_DOWNCAST( CStatusBar, pTempBar );
- if( pStatusBar != NULL )
- {
- int nIdlePaneIndex =
- pStatusBar->CommandToIndex( 0 );
- if( nIdlePaneIndex != -1)
- pStatusBar->SetPaneText(
- nIdlePaneIndex,
- pCmdItem->m_sTipStatus.IsEmpty()
- ? _T("")
- : pCmdItem->m_sTipStatus
- );
- return;
- } // if( pStatusBar != NULL )
- } // if( pTempBar != NULL )
- } // if( pCmdItem != NULL )
- } // if( strProfile != NULL )
- } // if( g_bUseCmdManagerForSetMessageString ...
- ::SendMessage(
- hWnd,
- WM_SETMESSAGESTRING,
- nCmdID, 0
- );
- }
- HWND CExtControlBar::stat_FindMdiClientHWND(
- HWND hWndMdiFrame
- )
- {
- for( HWND hWnd = ::GetWindow( hWndMdiFrame, GW_CHILD );
- hWnd != NULL;
- hWnd = ::GetWindow( hWnd, GW_HWNDNEXT )
- )
- {
- ASSERT( ::IsWindow( hWnd ) );
- TCHAR strClassName[ 512 ];
- ::memset( strClassName, 0, sizeof(strClassName) );
- ::GetClassName( hWnd, strClassName, 512 );
- if( _tcslen( strClassName ) == 0 )
- continue;
- __EXT_MFC_STRLWR( strClassName, 512 );
- //if( _tcscmp( strClassName, _T("mdiclient") ) == 0 )
- if( _tcsstr( strClassName, _T("mdiclient") ) != NULL )
- return hWnd;
- }
- return NULL;
- }
- bool CExtControlBar::stat_AdjustOccCompatibilityTree(
- CWnd * pWndRoot
- )
- {
- if( pWndRoot->GetSafeHwnd() == NULL )
- return false;
- ASSERT_VALID( pWndRoot );
- if( pWndRoot->GetControlUnknown() != NULL )
- return true;
- bool bOccMode = false;
- CWnd * pWnd = pWndRoot->GetWindow( GW_CHILD );
- for( ; pWnd != NULL; pWnd = pWnd->GetWindow(GW_HWNDNEXT) )
- {
- ASSERT_VALID( pWnd );
- if( CWnd::FromHandlePermanent(pWnd->GetSafeHwnd()) == NULL )
- continue;
- bOccMode |= stat_AdjustOccCompatibilityTree( pWnd );
- } // for( ; pWnd != NULL; pWnd = pWnd->GetWindow(GW_HWNDNEXT) )
- if( bOccMode )
- pWndRoot->m_nFlags |= WF_OLECTLCONTAINER;
- else
- pWndRoot->m_nFlags &= ~(WF_OLECTLCONTAINER);
- CFrameWnd * pDockSite = DYNAMIC_DOWNCAST( CFrameWnd, pWndRoot );
- if( pDockSite != NULL
- && pDockSite->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) )
- )
- pDockSite = NULL;
- if( pDockSite != NULL )
- {
- CMap
- < CExtMiniDockFrameWnd *,
- CExtMiniDockFrameWnd *,
- char,
- char
- >
- setMiniFrames;
- POSITION pos = pDockSite->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CControlBar * pControlBar = (CControlBar *)
- pDockSite->m_listControlBars.GetNext( pos );
- if( pControlBar->m_pDockSite == NULL )
- continue;
- ASSERT_VALID( pControlBar );
- ASSERT_KINDOF( CControlBar, pControlBar );
- if( pControlBar->IsDockBar() )
- continue;
- CFrameWnd * pBarParentFrame =
- pControlBar->GetParentFrame();
- ASSERT_VALID( pBarParentFrame );
- if( pBarParentFrame == pDockSite )
- continue;
- CExtMiniDockFrameWnd * pFloatingFrame =
- DYNAMIC_DOWNCAST(
- CExtMiniDockFrameWnd,
- pBarParentFrame
- );
- if( pFloatingFrame == NULL )
- continue;
- setMiniFrames.SetAt( pFloatingFrame, 0 );
- } // for( ; pos != NULL; )
- pos = setMiniFrames.GetStartPosition();
- for( ; pos != NULL; )
- {
- CExtMiniDockFrameWnd * pFloatingFrame = NULL;
- char nDummy;
- setMiniFrames.GetNextAssoc(pos,pFloatingFrame,nDummy);
- stat_AdjustOccCompatibilityTree( pFloatingFrame );
- } // for( ; pos != NULL; )
- }
- return bOccMode;
- }
- void CExtControlBar::stat_RedrawFloatingFrames( CFrameWnd * pDockSite )
- {
- ASSERT_VALID( pDockSite );
- CMap
- < CMiniFrameWnd *,
- CMiniFrameWnd *,
- char,
- char
- >
- setMiniFrames;
- POSITION pos = pDockSite->m_listControlBars.GetHeadPosition();
- for( ; pos != NULL; )
- {
- CControlBar * pControlBar = (CControlBar *)
- pDockSite->m_listControlBars.GetNext( pos );
- if( pControlBar->m_pDockSite == NULL )
- continue;
- ASSERT_VALID( pControlBar );
- ASSERT_KINDOF( CControlBar, pControlBar );
- if( pControlBar->IsDockBar() )
- continue;
- CFrameWnd * pBarParentFrame =
- pControlBar->GetParentFrame();
- ASSERT_VALID( pBarParentFrame );
- if( pBarParentFrame == pDockSite )
- continue;
- CMiniFrameWnd * pFloatingFrame =
- DYNAMIC_DOWNCAST(
- CMiniFrameWnd,
- pBarParentFrame
- );
- if( pFloatingFrame == NULL )
- continue;
- setMiniFrames.SetAt( pFloatingFrame, 0 );
- } // for( ; pos != NULL; )
- pos = setMiniFrames.GetStartPosition();
- for( ; pos != NULL; )
- {
- CMiniFrameWnd * pFloatingFrame = NULL;
- char nDummy;
- setMiniFrames.GetNextAssoc(pos,pFloatingFrame,nDummy);
- pFloatingFrame->RecalcLayout();
- pFloatingFrame->RedrawWindow(
- NULL,
- NULL,
- RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE
- | RDW_FRAME | RDW_ALLCHILDREN
- );
- } // for( ; pos != NULL; )
- }
- void CExtControlBar::stat_RecalcBarMetrics( CFrameWnd * pDockSite )
- {
- ASSERT_VALID( pDockSite );
- for( POSITION pos = pDockSite->m_listControlBars.GetHeadPosition();
- pos != NULL;
- )
- {
- CControlBar * pControlBar = (CControlBar *)
- pDockSite->m_listControlBars.GetNext( pos );
- if( pControlBar->m_pDockSite == NULL )
- continue;
- ASSERT_VALID( pControlBar );
- ASSERT_KINDOF( CControlBar, pControlBar );
- if( pControlBar->IsDockBar() )
- continue;
- CExtControlBar * pExtControlBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pControlBar );
- if( pExtControlBar != NULL
- && pExtControlBar->m_bNoForcedRecalcMetrics
- )
- continue;
- pControlBar->SetWindowPos(
- NULL, 0, 0, 0, 0,
- SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
- //|SWP_NOREDRAW
- |SWP_FRAMECHANGED
- );
- //pControlBar->PostMessage( WM_NCPAINT );
- CExtToolControlBar * pToolBar =
- DYNAMIC_DOWNCAST( CExtToolControlBar, pControlBar );
- if( pToolBar != NULL )
- pToolBar->_RecalcPositionsImpl();
- pControlBar->Invalidate();
- }
- }
- CWnd * CExtControlBar::stat_GetWndForPlacement( CWnd * pWnd )
- {
- ASSERT_VALID( pWnd );
- ASSERT( pWnd->GetSafeHwnd() != NULL && ::IsWindow( pWnd->GetSafeHwnd() ) );
- for( ; true; pWnd = pWnd->GetParent() )
- {
- DWORD dwStyle = pWnd->GetStyle();
- if( (dwStyle&WS_CHILD) == 0 )
- break;
- } // for( ; true; pWnd = pWnd->GetParent() )
- return pWnd;
- }
- bool CExtControlBar::stat_GetWindowPlacement( HWND hWnd, WINDOWPLACEMENT & _wp )
- {
- #if (!defined __EXT_MFC_NO_NC_FRAME )
- return CExtNcFrameImpl::stat_GetWindowPlacement( hWnd, _wp );
- #else
- return ::GetWindowPlacement( hWnd, &_wp ) ? true : false;
- #endif
- }
- bool CExtControlBar::stat_SetWindowPlacement( HWND hWnd, const WINDOWPLACEMENT & _wp )
- {
- #if (!defined __EXT_MFC_NO_NC_FRAME )
- return CExtNcFrameImpl::stat_SetWindowPlacement( hWnd, _wp );
- #else
- return ::SetWindowPlacement( hWnd, &_wp ) ? true : false;
- #endif
- }
- bool CExtControlBar::stat_SaveWindowRect(
- HWND hWnd,
- __EXT_MFC_SAFE_LPCTSTR strSection,
- __EXT_MFC_SAFE_LPCTSTR strEntry
- )
- {
- #if (!defined __EXT_MFC_NO_NC_FRAME )
- return CExtNcFrameImpl::stat_SaveWindowRect( hWnd, strSection, strEntry );
- #else
- if( LPCTSTR( strSection ) == NULL
- || LPCTSTR( strEntry ) == NULL
- || _tcslen( LPCTSTR( strSection ) ) == 0
- || _tcslen( LPCTSTR( strEntry ) ) == 0
- || hWnd == NULL
- || ( ! ::IsWindow( hWnd ) )
- )
- return false;
- CExtSafeString strWP;
- WINDOWPLACEMENT _wp;
- ::memset( &_wp, 0, sizeof(WINDOWPLACEMENT) );
- _wp.length = sizeof(WINDOWPLACEMENT);
- CExtControlBar::stat_GetWindowPlacement( hWnd, _wp );
- RECT & rc = _wp.rcNormalPosition;
- strWP.Format( _T("%d,%d,%d,%d,%d,%d"), rc.left, rc.top, rc.right, rc.bottom, _wp.showCmd, _wp.flags );
- ::AfxGetApp()->WriteProfileString( strSection, strEntry, __EXT_MFC_SAFE_LPCTSTR( strWP ) );
- return true;
- #endif
- }
- bool CExtControlBar::stat_LoadWindowRect(
- HWND hWnd,
- __EXT_MFC_SAFE_LPCTSTR strSection,
- __EXT_MFC_SAFE_LPCTSTR strEntry,
- bool bForceHideWindow // = false
- )
- {
- #if (!defined __EXT_MFC_NO_NC_FRAME )
- return CExtNcFrameImpl::stat_LoadWindowRect( hWnd, strSection, strEntry, bForceHideWindow );
- #else
- if( LPCTSTR( strSection ) == NULL
- || LPCTSTR( strEntry ) == NULL
- || _tcslen( LPCTSTR( strSection ) ) == 0
- || _tcslen( LPCTSTR( strEntry ) ) == 0
- || hWnd == NULL
- || ( ! ::IsWindow( hWnd ) )
- )
- return false;
- CExtSafeString strWP;
- WINDOWPLACEMENT _wp;
- strWP = ::AfxGetApp()->GetProfileString( strSection, strEntry );
- if( strWP.IsEmpty() )
- return false;
- ::memset( &_wp, 0, sizeof(WINDOWPLACEMENT) );
- _wp.length = sizeof(WINDOWPLACEMENT);
- CExtControlBar::stat_GetWindowPlacement( hWnd, _wp );
- RECT & rc = _wp.rcNormalPosition;
- if( __EXT_MFC_STSCANF(
- __EXT_MFC_SAFE_LPCTSTR( strWP ),
- __EXT_MFC_SAFE_LPCTSTR( _T("%d,%d,%d,%d,%d,%d") ),
- &rc.left,
- &rc.top,
- &rc.right,
- &rc.bottom,
- &_wp.showCmd,
- &_wp.flags
- ) == 6
- )
- {
- if( bForceHideWindow )
- _wp.showCmd = SW_HIDE;
- CExtControlBar::stat_SetWindowPlacement( hWnd, _wp );
- }
- ::RedrawWindow( hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW|RDW_ALLCHILDREN|RDW_FRAME );
- return true;
- #endif
- }
- void CExtControlBar::OnContextMenu(CWnd* pWnd, CPoint point)
- {
- ASSERT_VALID( this );
- pWnd;
- ScreenToClient( &point );
- CRect rcClient;
- GetClientRect( &rcClient );
- if( rcClient.PtInRect(point) )
- return;
- OnRButtonUp( 0, point );
- }
- void CExtControlBar::OnTimer(__EXT_MFC_UINT_PTR nIDEvent)
- {
- ASSERT_VALID( this );
- if( nIDEvent == ((__EXT_MFC_UINT_PTR)m_nFlashCaptionTimerID) )
- {
- FlashCaption_OnTimer();
- return;
- }
- CControlBar::OnTimer( nIDEvent );
- }
- CExtControlBar::eResizablePanelDockingType_t
- CExtControlBar::OnQueryDockingType() const
- {
- ASSERT_VALID( this );
- eResizablePanelDockingType_t eResizablePanelDockingType =
- g_eResizablePanelDockingType;
- if( eResizablePanelDockingType == __RESIZABLE_DOCKING_TYPE_BY_THEME )
- eResizablePanelDockingType = (eResizablePanelDockingType_t)
- PmBridge_GetPM()->GetThemeDockingType();
- ASSERT( __RESIZABLE_DOCKING_TYPE_MIN_VALUE <= eResizablePanelDockingType );
- ASSERT( eResizablePanelDockingType <= __RESIZABLE_DOCKING_TYPE_MAX_VALUE );
- return eResizablePanelDockingType;
- }
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- /////////////////////////////////////////////////////////////////////////////
- // CExtDynDockHighlightWnd window
- IMPLEMENT_DYNAMIC( CExtDynDockHighlightWnd, CWnd )
- IMPLEMENT_CExtPmBridge_MEMBERS( CExtDynDockHighlightWnd );
- CExtDynDockHighlightWnd::CExtDynDockHighlightWnd(
- CExtDynDockMarkerWnd * pWndDynDockMarker
- )
- : m_pWndDynDockMarker( pWndDynDockMarker )
- {
- ASSERT_VALID( m_pWndDynDockMarker );
- ASSERT( m_pWndDynDockMarker->GetSafeHwnd() != NULL );
- ASSERT( pWndDynDockMarker->IsStateApplyable() );
- CExtControlBar * pDraggedBar =
- CExtControlBar::_DraggingGetBar();
- if( pDraggedBar == NULL )
- return;
- ASSERT_VALID( pDraggedBar );
- HWND hWndMarkerTarget = pWndDynDockMarker->GetMarkerTargetHWND();
- CRect rcScreen( 0, 0, 0, 0 );
- if( hWndMarkerTarget == NULL )
- {
- if( CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter.GetSize() != 4 )
- {
- ASSERT( FALSE );
- return;
- } // if( CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter.GetSize() != 4 )
- CRect rcTemp;
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter[0]->GetWindowRect( &rcTemp );
- rcScreen.top = rcTemp.top;
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter[1]->GetWindowRect( &rcTemp );
- rcScreen.bottom = rcTemp.bottom;
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter[2]->GetWindowRect( &rcTemp );
- rcScreen.left = rcTemp.left;
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter[3]->GetWindowRect( &rcTemp );
- rcScreen.right = rcTemp.right;
- CRect rcOuterMargins = PmBridge_GetPM()->DockMarker_GetOuterDistance();
- rcScreen.InflateRect( &rcOuterMargins );
- } // if( hWndMarkerTarget == NULL )
- else
- {
- ::GetWindowRect( hWndMarkerTarget, &rcScreen );
- CWnd * pWnd = CWnd::FromHandlePermanent( hWndMarkerTarget );
- if( pWnd == NULL
- || (! pWnd->IsKindOf( RUNTIME_CLASS(CExtControlBar) ) )
- )
- hWndMarkerTarget = NULL;
- } // else from if( hWndMarkerTarget == NULL )
- CExtPaintManager::eDockMarkerType_t eDockMarkerType =
- (CExtPaintManager::eDockMarkerType_t)
- pWndDynDockMarker->GetMarkerType();
- static const CSize _sizeMinMetric( 30, 30 );
- switch( eDockMarkerType )
- {
- case CExtPaintManager::__EDMT_2005_TOP:
- if( hWndMarkerTarget != NULL )
- {
- rcScreen.bottom = rcScreen.top + rcScreen.Height() / 2;
- } // if( hWndMarkerTarget != NULL )
- else
- {
- CSize _size = pDraggedBar->GetSizeDockedHorizontal();
- if( _size.cy <= _sizeMinMetric.cy )
- _size.cy = _sizeMinMetric.cy;
- rcScreen.bottom = rcScreen.top + _size.cy;
- } // else from if( hWndMarkerTarget != NULL )
- break;
- case CExtPaintManager::__EDMT_2005_BOTTOM:
- if( hWndMarkerTarget != NULL )
- {
- rcScreen.top = rcScreen.bottom - rcScreen.Height() / 2;
- } // if( hWndMarkerTarget != NULL )
- else
- {
- CSize _size = pDraggedBar->GetSizeDockedHorizontal();
- if( _size.cy <= _sizeMinMetric.cy )
- _size.cy = _sizeMinMetric.cy;
- rcScreen.top = rcScreen.bottom - _size.cy;
- } // else from if( hWndMarkerTarget != NULL )
- break;
- case CExtPaintManager::__EDMT_2005_LEFT:
- if( hWndMarkerTarget != NULL )
- {
- rcScreen.right = rcScreen.left + rcScreen.Width() / 2;
- } // if( hWndMarkerTarget != NULL )
- else
- {
- CSize _size = pDraggedBar->GetSizeDockedVertical();
- if( _size.cx <= _sizeMinMetric.cx )
- _size.cx = _sizeMinMetric.cx;
- rcScreen.right = rcScreen.left + _size.cx;
- } // else from if( hWndMarkerTarget != NULL )
- break;
- case CExtPaintManager::__EDMT_2005_RIGHT:
- if( hWndMarkerTarget != NULL )
- {
- rcScreen.left = rcScreen.right - rcScreen.Width() / 2;
- } // if( hWndMarkerTarget != NULL )
- else
- {
- CSize _size = pDraggedBar->GetSizeDockedVertical();
- if( _size.cx <= _sizeMinMetric.cx )
- _size.cx = _sizeMinMetric.cx;
- rcScreen.left = rcScreen.right - _size.cx;
- } // else from if( hWndMarkerTarget != NULL )
- break;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case CExtPaintManager::__EDMT_2005_TAB:
- break;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- default:
- {
- ASSERT( FALSE );
- }
- return;
- } // switch( eDockMarkerType )
- RegisterDockHighlightClass();
- if( CExtDynDockMarkerWnd::g_pWndMarkersParent == NULL )
- {
- CExtDynDockMarkerWnd::g_pWndMarkersParent = new CWnd;
- if( ! CExtDynDockMarkerWnd::g_pWndMarkersParent->CreateEx(
- WS_EX_TOPMOST,
- __EXT_DYNDOCKMARKER_CLASS_NAME,
- _T(""),
- WS_POPUP,
- 0,
- 0,
- 0,
- 0,
- ::GetDesktopWindow(),
- (HMENU)NULL,
- 0L
- )
- )
- {
- ASSERT( FALSE );
- delete CExtDynDockMarkerWnd::g_pWndMarkersParent;
- CExtDynDockMarkerWnd::g_pWndMarkersParent = NULL;
- return;
- }
- } // if( CExtDynDockMarkerWnd::g_pWndMarkersParent == NULL )
- BOOL bCreateResult =
- CWnd::CreateEx(
- WS_EX_TOPMOST
- | ( g_PaintManager.m_bLayeredHighlighting2005
- ? __EXT_MFC_WS_EX_LAYERED
- : 0
- )
- ,
- __EXT_DYNDOCKHIGHLIGHTWND_CLASS_NAME,
- _T(""),
- WS_POPUP,
- rcScreen.left,
- rcScreen.top,
- rcScreen.Width(),
- rcScreen.Height(),
- CExtDynDockMarkerWnd::g_pWndMarkersParent->GetSafeHwnd(),
- (HMENU)NULL,
- 0L
- );
- if( ! bCreateResult )
- {
- ASSERT( FALSE );
- return;
- } // if( ! bCreateResult )
- if( g_PaintManager.m_bLayeredHighlighting2005 )
- {
- bool bTabShape = false;
- CRect rcTabMainArea(0,0,0,0), rcTabBottomMiddleArea(0,0,0,0);
- bool bTabsAtTop = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bTabsAtTop = CExtControlBar::g_bTabsAtTop;
-
- if( m_pWndDynDockMarker->GetMarkerType() == CExtPaintManager::__EDMT_2005_TAB )
- {
- CRect rcClient = rcScreen;
- rcClient.OffsetRect( - rcClient.TopLeft() );
- bTabShape = true;
- int nTabHeight = CExtControlBar::g_nTabShapeMaxHeight;
- int nTrackerHeight = rcClient.Height();
- if( nTrackerHeight < (CExtControlBar::g_nTabShapeMaxHeight * 2) )
- nTabHeight = nTrackerHeight / 2;
- rcTabMainArea = rcClient;
- if( bTabsAtTop )
- rcTabMainArea.top += nTabHeight;
- else
- rcTabMainArea.bottom -= nTabHeight;
- ASSERT( rcTabMainArea.bottom > rcTabMainArea.top );
-
- CRect rcTabBottomLeftArea( rcClient );
- rcTabBottomLeftArea.right =
- rcTabBottomLeftArea.left
- + CExtControlBar::g_nTabShapeBottomLeftAreaWidth
- ;
- if( bTabsAtTop )
- rcTabBottomLeftArea.bottom =
- rcTabBottomLeftArea.top + nTabHeight;
- else
- rcTabBottomLeftArea.top =
- rcTabBottomLeftArea.bottom - nTabHeight;
- rcTabBottomMiddleArea = rcTabBottomLeftArea;
- rcTabBottomMiddleArea.OffsetRect(
- rcTabBottomLeftArea.Width(),
- 0
- );
- rcTabBottomMiddleArea.right =
- rcTabBottomMiddleArea.left
- + CExtControlBar::g_nTabShapeBottomMiddleAreaWidth
- ;
- if( rcTabBottomMiddleArea.right > rcClient.right )
- rcTabBottomMiddleArea.right =
- rcTabBottomMiddleArea.left
- + (rcClient.right - rcTabBottomMiddleArea.left) / 2
- ;
-
- CRect rcTabBottomRightArea( rcTabBottomLeftArea );
- rcTabBottomRightArea.right = rcClient.right;
- rcTabBottomRightArea.left = rcTabBottomMiddleArea.right;
- CExtControlBar * pDraggedBar = CExtControlBar::_DraggingGetBar();
- if( pDraggedBar->GetSafeHwnd() != NULL )
- {
- ASSERT_VALID( pDraggedBar );
- ASSERT_VALID( pDraggedBar->m_pDockSite );
- ASSERT( pDraggedBar->m_pDockSite->GetSafeHwnd() != NULL );
- if( (pDraggedBar->m_pDockSite->GetExStyle()&WS_EX_LAYOUTRTL) != 0 )
- {
- rcTabBottomRightArea.left =
- rcTabBottomRightArea.right
- - rcTabBottomLeftArea.Width()
- ;
- rcTabBottomMiddleArea.OffsetRect(
- rcTabBottomRightArea.left
- - rcTabBottomMiddleArea.right
- ,
- 0
- );
- rcTabBottomLeftArea.right =
- rcTabBottomMiddleArea.left
- ;
- } // if( (pDraggedBar->m_pDockSite->GetExStyle()&WS_EX_LAYOUTRTL) != 0 )
- } // if( pDraggedBar->GetSafeHwnd() != NULL )
- } // if( m_pWndDynDockMarker->GetMarkerType() == CExtPaintManager::__EDMT_2005_TAB )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- PmBridge_GetPM()->DockMarker_AdjustHighlightedLayer(
- m_hWnd,
- rcScreen.Width(),
- rcScreen.Height(),
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea
- );
- }
- SetWindowPos(
- CExtDynDockMarkerWnd::g_pWndMarkersParent,
- 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_SHOWWINDOW
- );
- }
- CExtDynDockHighlightWnd::~CExtDynDockHighlightWnd()
- {
- }
- BEGIN_MESSAGE_MAP(CExtDynDockHighlightWnd, CWnd)
- //{{AFX_MSG_MAP(CExtDynDockHighlightWnd)
- ON_WM_NCCALCSIZE()
- ON_WM_MOUSEACTIVATE()
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- bool CExtDynDockHighlightWnd::g_bDockHighlightClassRegistered = false;
- bool CExtDynDockHighlightWnd::RegisterDockHighlightClass()
- {
- if( g_bDockHighlightClassRegistered )
- return true;
- WNDCLASS _wndClassInfo;
- HINSTANCE hInst = ::AfxGetInstanceHandle();
- if( ! ::GetClassInfo( hInst, __EXT_DYNDOCKHIGHLIGHTWND_CLASS_NAME, &_wndClassInfo ) )
- {
- _wndClassInfo.style = CS_GLOBALCLASS; //|CS_DBLCLKS;
- _wndClassInfo.lpfnWndProc = ::DefWindowProc;
- _wndClassInfo.cbClsExtra = _wndClassInfo.cbWndExtra = 0;
- _wndClassInfo.hInstance = hInst;
- _wndClassInfo.hIcon = NULL;
- _wndClassInfo.hCursor = ::LoadCursor( NULL, IDC_ARROW );
- ASSERT( _wndClassInfo.hCursor != NULL );
- _wndClassInfo.hbrBackground = NULL;
- _wndClassInfo.lpszMenuName = NULL;
- _wndClassInfo.lpszClassName = __EXT_DYNDOCKHIGHLIGHTWND_CLASS_NAME;
- if( !::AfxRegisterClass( &_wndClassInfo ) )
- {
- ASSERT( FALSE );
- //AfxThrowResourceException();
- return false;
- }
- }
- g_bDockHighlightClassRegistered = true;
- return true;
- }
- BOOL CExtDynDockHighlightWnd::PreCreateWindow( CREATESTRUCT & cs )
- {
- if( ( !RegisterDockHighlightClass() )
- || ( ! CWnd::PreCreateWindow(cs) )
- )
- {
- ASSERT( FALSE );
- return FALSE;
- }
-
- cs.lpszClass = __EXT_DYNDOCKHIGHLIGHTWND_CLASS_NAME;
- return TRUE;
- }
- void CExtDynDockHighlightWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
- {
- // CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
- bCalcValidRects;
- lpncsp;
- }
- int CExtDynDockHighlightWnd::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
- {
- // return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
- pDesktopWnd;
- nHitTest;
- message;
- return MA_NOACTIVATEANDEAT;
- }
- void CExtDynDockHighlightWnd::OnPaint()
- {
- if( g_PaintManager.m_bLayeredHighlighting2005 )
- {
- Default();
- return;
- } // if( g_PaintManager.m_bLayeredHighlighting2005 )
- CRect rcClient;
- GetClientRect( &rcClient );
- CPaintDC dcPaint( this );
- if( rcClient.IsRectEmpty() )
- return;
- if( m_bmpHighlightSurface.IsEmpty() )
- {
- BITMAPINFOHEADER bih;
- ::memset( &bih, 0, sizeof(BITMAPINFOHEADER) );
- bih.biSize = sizeof(BITMAPINFOHEADER);
- bih.biWidth = rcClient.Width();
- bih.biHeight = rcClient.Height();
- bih.biPlanes = 1;
- bih.biBitCount = 32;
- bih.biCompression = BI_RGB;
- bih.biSizeImage = bih.biWidth * bih.biHeight;
- COLORREF * pSurfaceCB = NULL;
- HBITMAP hDib =
- ::CreateDIBSection(
- dcPaint,
- (LPBITMAPINFO)&bih,
- DIB_RGB_COLORS,
- (void **)&pSurfaceCB,
- NULL,
- NULL
- );
- if( hDib == NULL || pSurfaceCB == NULL )
- {
- ASSERT( FALSE );
- return;
- }
- CDC dcMemory;
- if( ! dcMemory.CreateCompatibleDC( &dcPaint ) )
- {
- ASSERT( FALSE );
- ::DeleteObject( hDib );
- return;
- }
- HGDIOBJ hOldBmp = dcMemory.SelectObject( hDib );
- dcMemory.BitBlt(
- 0,
- 0,
- bih.biWidth,
- bih.biHeight,
- &dcPaint,
- 0,
- 0,
- SRCCOPY
- );
- dcMemory.SelectObject( hOldBmp );
- dcMemory.DeleteDC();
- bool bTabShape = false;
- CRect rcTabMainArea(0,0,0,0), rcTabBottomMiddleArea(0,0,0,0);
- bool bTabsAtTop = false;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bTabsAtTop = CExtControlBar::g_bTabsAtTop;
-
- if( m_pWndDynDockMarker->GetMarkerType() == CExtPaintManager::__EDMT_2005_TAB )
- {
- bTabShape = true;
- int nTabHeight = CExtControlBar::g_nTabShapeMaxHeight;
- int nTrackerHeight = rcClient.Height();
- if( nTrackerHeight < (CExtControlBar::g_nTabShapeMaxHeight * 2) )
- nTabHeight = nTrackerHeight / 2;
- rcTabMainArea = rcClient;
- if( bTabsAtTop )
- rcTabMainArea.top += nTabHeight;
- else
- rcTabMainArea.bottom -= nTabHeight;
- ASSERT( rcTabMainArea.bottom > rcTabMainArea.top );
-
- CRect rcTabBottomLeftArea( rcClient );
- rcTabBottomLeftArea.right =
- rcTabBottomLeftArea.left
- + CExtControlBar::g_nTabShapeBottomLeftAreaWidth
- ;
- if( bTabsAtTop )
- rcTabBottomLeftArea.bottom =
- rcTabBottomLeftArea.top + nTabHeight;
- else
- rcTabBottomLeftArea.top =
- rcTabBottomLeftArea.bottom - nTabHeight;
- rcTabBottomMiddleArea = rcTabBottomLeftArea;
- rcTabBottomMiddleArea.OffsetRect(
- rcTabBottomLeftArea.Width(),
- 0
- );
- rcTabBottomMiddleArea.right =
- rcTabBottomMiddleArea.left
- + CExtControlBar::g_nTabShapeBottomMiddleAreaWidth
- ;
- if( rcTabBottomMiddleArea.right > rcClient.right )
- rcTabBottomMiddleArea.right =
- rcTabBottomMiddleArea.left
- + (rcClient.right - rcTabBottomMiddleArea.left) / 2
- ;
-
- CRect rcTabBottomRightArea( rcTabBottomLeftArea );
- rcTabBottomRightArea.right = rcClient.right;
- rcTabBottomRightArea.left = rcTabBottomMiddleArea.right;
- CExtControlBar * pDraggedBar = CExtControlBar::_DraggingGetBar();
- if( pDraggedBar->GetSafeHwnd() != NULL )
- {
- ASSERT_VALID( pDraggedBar );
- ASSERT_VALID( pDraggedBar->m_pDockSite );
- ASSERT( pDraggedBar->m_pDockSite->GetSafeHwnd() != NULL );
- if( (pDraggedBar->m_pDockSite->GetExStyle()&WS_EX_LAYOUTRTL) != 0 )
- {
- rcTabBottomRightArea.left =
- rcTabBottomRightArea.right
- - rcTabBottomLeftArea.Width()
- ;
- rcTabBottomMiddleArea.OffsetRect(
- rcTabBottomRightArea.left
- - rcTabBottomMiddleArea.right
- ,
- 0
- );
- rcTabBottomLeftArea.right =
- rcTabBottomMiddleArea.left
- ;
- } // if( (pDraggedBar->m_pDockSite->GetExStyle()&WS_EX_LAYOUTRTL) != 0 )
- } // if( pDraggedBar->GetSafeHwnd() != NULL )
- } // if( m_pWndDynDockMarker->GetMarkerType() == CExtPaintManager::__EDMT_2005_TAB )
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
-
- PmBridge_GetPM()->DockMarker_AdjustHighlightedArea(
- pSurfaceCB,
- bih.biWidth,
- bih.biHeight,
- bTabShape,
- bTabsAtTop,
- rcTabMainArea,
- rcTabBottomMiddleArea
- );
- m_bmpHighlightSurface.FromBitmap( hDib );
- ::DeleteObject( hDib );
- } // if( m_bmpHighlightSurface.IsEmpty() )
- ASSERT( ! m_bmpHighlightSurface.IsEmpty() );
- // CDC dcMemory;
- // if( dcMemory.CreateCompatibleDC( &dcPaint ) )
- // {
- // CBitmap * pOldBmp =
- // dcMemory.SelectObject(
- // &m_bmpHighlightSurface
- // );
- // dcPaint.BitBlt(
- // 0,
- // 0,
- // rcClient.Width(),
- // rcClient.Height(),
- // &dcMemory,
- // 0,
- // 0,
- // SRCCOPY
- // );
- // dcMemory.SelectObject( pOldBmp );
- // } // if( dcMemory.CreateCompatibleDC( &dcPaint ) )
- // #ifdef _DEBUG
- // else
- // {
- // ASSERT( FALSE );
- // } // else from if( dcMemory.CreateCompatibleDC( &dcPaint ) )
- // #endif // _DEBUG
- m_bmpHighlightSurface.AlphaBlend(
- dcPaint.m_hDC,
- 0,
- 0,
- rcClient.Width(),
- rcClient.Height()
- );
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtDynDockMarkerWnd window
- #define __DYNDOCKMARKER_TIMER_ID_TEMP 77
- #define __DYNDOCKMARKER_TIMER_ID_ANIMATE 88
- #define __DYNDOCKMARKER_ANIMATION_PERCENT_STEP 25
- IMPLEMENT_DYNAMIC( CExtDynDockMarkerWnd, CWnd )
- IMPLEMENT_CExtPmBridge_MEMBERS( CExtDynDockMarkerWnd );
- CWnd * CExtDynDockMarkerWnd::g_pWndMarkersParent = NULL;
- CExtDynDockMarkerWnd::CExtDynDockMarkerWnd(
- CExtDynDockMarkerWnd * pWndParentMarker,
- HWND hWndMarkerTarget,
- int eMarkerType,
- const CExtBitmap & _bmpIn,
- const CExtBitmap & _bmpOut,
- HRGN hRgn,
- CRect rcScreen,
- const CExtBitmap * _pBmpOuterBk, // = NULL
- int nOffserInnerX, // = 0
- int nOffserInnerY, // = 0
- bool bSparsedMode // = false
- )
- : m_pWndParentMarker( pWndParentMarker )
- , m_hWndMarkerTarget( hWndMarkerTarget )
- , m_hWndLastHoverDepenentMarker( NULL )
- , m_ptOffsetInner( nOffserInnerX, nOffserInnerY )
- , m_bSparsedMode( bSparsedMode )
- , m_bAnimationInProcess( false )
- , m_bAnimationShow( false )
- , m_bDestroyOnAnimationStop( false )
- , m_nOpaquePercent( 100 )
- {
- m_pWndParentMarker;
- m_pWndDockHighlight = NULL;
- // ASSERT( m_hWndMarkerTarget != NULL && ::IsWindow(m_hWndMarkerTarget) );
- m_eMarkerType = eMarkerType;
- ASSERT(
- int(CExtPaintManager::__EDMT_MIN_VALUE) <= m_eMarkerType
- && m_eMarkerType <= int(CExtPaintManager::__EDMT_MAX_VALUE)
- );
- m_eMTS = __EMTS_UNKNOWN;
- ASSERT( ! _bmpIn.IsEmpty() );
- ASSERT( ! _bmpOut.IsEmpty() );
- ASSERT( hRgn != NULL );
- m_bmpIn = _bmpIn;
- m_bmpOut = _bmpOut;
- if( _pBmpOuterBk != NULL )
- // m_bmpOuterBk.Attach( hBmpOuterBk );
- m_bmpOuterBk = (*_pBmpOuterBk);
- m_rgn.Attach( hRgn );
- RegisterDockMarkerClass();
- if( g_pWndMarkersParent == NULL )
- {
- g_pWndMarkersParent = new CWnd;
- if( ! g_pWndMarkersParent->CreateEx(
- WS_EX_TOPMOST,
- __EXT_DYNDOCKMARKER_CLASS_NAME,
- _T(""),
- WS_POPUP,
- 0,
- 0,
- 0,
- 0,
- ::GetDesktopWindow(),
- (HMENU)NULL,
- 0L
- )
- )
- {
- ASSERT( FALSE );
- delete g_pWndMarkersParent;
- g_pWndMarkersParent = NULL;
- return;
- }
- } // if( g_pWndMarkersParent == NULL )
- BOOL bCreateResult =
- CWnd::CreateEx(
- WS_EX_TOPMOST
- | ( g_PaintManager.m_bLayeredHighlighting2005
- ? __EXT_MFC_WS_EX_LAYERED
- : 0
- )
- ,
- __EXT_DYNDOCKMARKER_CLASS_NAME,
- _T(""),
- WS_POPUP,
- rcScreen.left,
- rcScreen.top,
- rcScreen.Width(),
- rcScreen.Height(),
- g_pWndMarkersParent->GetSafeHwnd(),
- (HMENU)NULL,
- 0L
- );
- if( ! bCreateResult )
- {
- ASSERT( FALSE );
- return;
- } // if( ! bCreateResult )
- if( g_PaintManager.m_bLayeredHighlighting2005 )
- g_PaintManager.m_pfnSetLayeredWindowAttributes(
- GetSafeHwnd(),
- 0,
- 255,
- __EXT_MFC_LWA_ALPHA
- );
- ::SetWindowRgn(
- m_hWnd,
- (HRGN)m_rgn.GetSafeHandle(),
- FALSE
- );
- // if( m_pWndParentMarker->GetSafeHwnd() != NULL )
- // SetWindowPos( m_pWndParentMarker, 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
- // if( eMarkerType == INT(CExtPaintManager::__EDMT_2005_GROUP_CENTRAL) )
- // ShowWindow( SW_HIDE );
- SetTimer( __DYNDOCKMARKER_TIMER_ID_TEMP, 50, NULL );
- }
- CExtDynDockMarkerWnd::~CExtDynDockMarkerWnd()
- {
- HighlightMarkerTarget( false );
- }
- BEGIN_MESSAGE_MAP(CExtDynDockMarkerWnd, CWnd)
- //{{AFX_MSG_MAP(CExtDynDockMarkerWnd)
- ON_WM_NCCALCSIZE()
- ON_WM_MOUSEACTIVATE()
- ON_WM_PAINT()
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- ON_MESSAGE( WM_PRINT, OnPrintClient )
- ON_MESSAGE( WM_PRINTCLIENT, OnPrintClient )
- END_MESSAGE_MAP()
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * >
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter;
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * >
- CExtDynDockMarkerWnd::g_arrDockMarkerWndsInner;
- HWND CExtDynDockMarkerWnd::g_hWndLastDynamicTarget = NULL;
- bool CExtDynDockMarkerWnd::HighlightMarkerTarget(
- bool bHighlight // = true
- )
- {
- ASSERT_VALID( this );
- if( GetSafeHwnd() != NULL
- && ( GetExStyle() & __EXT_MFC_WS_EX_LAYERED ) != 0
- && g_PaintManager.m_bLayeredHighlighting2005
- )
- g_PaintManager.m_pfnSetLayeredWindowAttributes(
- GetSafeHwnd(),
- 0,
- g_PaintManager->DockMarker_GetAlpha( bHighlight, this ),
- __EXT_MFC_LWA_ALPHA
- );
- if( bHighlight )
- {
- if( m_pWndDockHighlight != NULL )
- HighlightMarkerTarget( false );
- UnHighlightMarkersExcluding( this );
- m_pWndDockHighlight =
- new CExtDynDockHighlightWnd( this );
- if( m_pWndDockHighlight->GetSafeHwnd() == NULL )
- {
- HighlightMarkerTarget( false );
- ASSERT( FALSE );
- return false;
- } // if( m_pWndDockHighlight->GetSafeHwnd() == NULL )
- return true;
- } // if( bHighlight )
- else
- {
- if( m_pWndDockHighlight != NULL )
- {
- ASSERT_VALID( m_pWndDockHighlight );
- if( m_pWndDockHighlight->GetSafeHwnd() != NULL )
- m_pWndDockHighlight->DestroyWindow();
- delete m_pWndDockHighlight;
- m_pWndDockHighlight = NULL;
- } // if( m_pWndDockHighlight != NULL )
- return true;
- } // else from if( bHighlight )
- }
- CExtControlBar::e_calc_dock_type_t CExtDynDockMarkerWnd::GetCDT()
- {
- ASSERT_VALID( this );
- ASSERT(
- int(CExtPaintManager::__EDMT_MIN_VALUE) <= m_eMarkerType
- && m_eMarkerType <= int(CExtPaintManager::__EDMT_MAX_VALUE)
- );
- CExtControlBar * pBar = NULL;
- if( m_hWndMarkerTarget != NULL )
- {
- CWnd * pWnd = CWnd::FromHandlePermanent( m_hWndMarkerTarget );
- if( pWnd != NULL )
- {
- pBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWnd );
- } // if( pWnd != NULL )
- } // if( m_hWndMarkerTarget != NULL )
- switch( m_eMarkerType )
- {
- case int(CExtPaintManager::__EDMT_2005_TOP):
- return
- ( pBar != NULL )
- ? CExtControlBar::__ECDT_2005_BAR_TOP
- : (
- ( m_hWndMarkerTarget != NULL )
- ? CExtControlBar::__ECDT_2005_INNER_TOP
- : CExtControlBar::__ECDT_2005_OUTER_TOP
- )
- ;
- case int(CExtPaintManager::__EDMT_2005_BOTTOM):
- return
- ( pBar != NULL )
- ? CExtControlBar::__ECDT_2005_BAR_BOTTOM
- : (
- ( m_hWndMarkerTarget != NULL )
- ? CExtControlBar::__ECDT_2005_INNER_BOTTOM
- : CExtControlBar::__ECDT_2005_OUTER_BOTTOM
- )
- ;
- case int(CExtPaintManager::__EDMT_2005_LEFT):
- return
- ( pBar != NULL )
- ? CExtControlBar::__ECDT_2005_BAR_LEFT
- : (
- ( m_hWndMarkerTarget != NULL )
- ? CExtControlBar::__ECDT_2005_INNER_LEFT
- : CExtControlBar::__ECDT_2005_OUTER_LEFT
- )
- ;
- case int(CExtPaintManager::__EDMT_2005_RIGHT):
- return
- ( pBar != NULL )
- ? CExtControlBar::__ECDT_2005_BAR_RIGHT
- : (
- ( m_hWndMarkerTarget != NULL )
- ? CExtControlBar::__ECDT_2005_INNER_RIGHT
- : CExtControlBar::__ECDT_2005_OUTER_RIGHT
- )
- ;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- case int(CExtPaintManager::__EDMT_2005_TAB):
- {
- if( pBar != NULL )
- return CExtControlBar::__ECDT_2005_BAR_NEW_TAB;
- break;
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- } // switch( m_eMarkerType )
- return CExtControlBar::__ECDT_FLOATED;
- }
- int CExtDynDockMarkerWnd::GetMarkerType() const
- {
- ASSERT_VALID( this );
- ASSERT(
- int(CExtPaintManager::__EDMT_MIN_VALUE) <= m_eMarkerType
- && m_eMarkerType <= int(CExtPaintManager::__EDMT_MAX_VALUE)
- );
- return m_eMarkerType;
- }
- HWND CExtDynDockMarkerWnd::GetMarkerTargetHWND() const
- {
- ASSERT_VALID( this );
- //ASSERT( m_hWndMarkerTarget != NULL && ::IsWindow(m_hWndMarkerTarget) );
- return m_hWndMarkerTarget;
- }
- bool CExtDynDockMarkerWnd::IsStateApplyable() const
- {
- ASSERT_VALID( this );
- ASSERT(
- int(CExtPaintManager::__EDMT_MIN_VALUE) <= m_eMarkerType
- && m_eMarkerType <= int(CExtPaintManager::__EDMT_MAX_VALUE)
- );
- if( m_eMarkerType == int(CExtPaintManager::__EDMT_2005_TOP)
- || m_eMarkerType == int(CExtPaintManager::__EDMT_2005_BOTTOM)
- || m_eMarkerType == int(CExtPaintManager::__EDMT_2005_LEFT)
- || m_eMarkerType == int(CExtPaintManager::__EDMT_2005_RIGHT)
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- || m_eMarkerType == int(CExtPaintManager::__EDMT_2005_TAB)
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- )
- return true;
- return false;
- }
- void CExtDynDockMarkerWnd::UnHighlightAllMarkers(
- bool bPassPaintMessages // = true
- )
- {
- UnHighlightMarkersExcluding(
- NULL,
- bPassPaintMessages
- );
- }
- void CExtDynDockMarkerWnd::UnHighlightMarkersExcluding(
- CExtDynDockMarkerWnd * pMarkerExclude,
- bool bPassPaintMessages // = true
- )
- {
- UnHighlightMarkersExcluding( g_arrDockMarkerWndsOuter, pMarkerExclude, false );
- UnHighlightMarkersExcluding( g_arrDockMarkerWndsInner, pMarkerExclude, false );
- if( bPassPaintMessages )
- CExtPaintManager::stat_PassPaintMessages();
- }
- void CExtDynDockMarkerWnd::UnHighlightMarkersExcluding(
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * >
- & arrDockMarkerWnds,
- CExtDynDockMarkerWnd * pMarkerExclude,
- bool bPassPaintMessages // = true
- )
- {
- int nCount = (int)arrDockMarkerWnds.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex++ )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- arrDockMarkerWnds[ nIndex ];
- ASSERT_VALID( pDynDockMarkerWnd );
- ASSERT( pDynDockMarkerWnd->GetSafeHwnd() != NULL );
- if( pDynDockMarkerWnd == pMarkerExclude )
- continue;
- VERIFY( pDynDockMarkerWnd->HighlightMarkerTarget( false ) );
- } // for( int nIndex = 0; nIndex < nCount; nIndex++ )
- if( bPassPaintMessages )
- CExtPaintManager::stat_PassPaintMessages();
- }
- void CExtDynDockMarkerWnd::ShowAllMarkers(
- bool bShow // = true
- )
- {
- ShowMarkers( g_arrDockMarkerWndsOuter, bShow, false );
- ShowMarkers( g_arrDockMarkerWndsInner, bShow, true );
- }
- void CExtDynDockMarkerWnd::DestroyAllMarkers()
- {
- DestroyMarkers( g_arrDockMarkerWndsOuter, false );
- DestroyMarkers( g_arrDockMarkerWndsInner, false );
- if( g_pWndMarkersParent != NULL )
- {
- ASSERT_VALID( g_pWndMarkersParent );
- g_pWndMarkersParent->DestroyWindow();
- delete g_pWndMarkersParent;
- g_pWndMarkersParent = NULL;
- } // if( g_pWndMarkersParent != NULL )
- g_hWndLastDynamicTarget = NULL;
- }
- void CExtDynDockMarkerWnd::DestroyMarkers(
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * >
- & arrDockMarkerWnds,
- bool bAnimate // = true
- )
- {
- ShowMarkers( arrDockMarkerWnds, false, bAnimate );
- int nCount = (int)arrDockMarkerWnds.GetSize();
- for( int nIndex = 0; nIndex < nCount; nIndex++ )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- arrDockMarkerWnds[ nIndex ];
- ASSERT_VALID( pDynDockMarkerWnd );
- if( pDynDockMarkerWnd->GetSafeHwnd() != NULL )
- {
- if( pDynDockMarkerWnd->IsAnimationInProcess() )
- pDynDockMarkerWnd->m_bDestroyOnAnimationStop = true;
- else
- pDynDockMarkerWnd->DestroyWindow();
- }
- } // for( int nIndex = 0; nIndex < nCount; nIndex++ )
- arrDockMarkerWnds.RemoveAll();
- }
- void CExtDynDockMarkerWnd::PostNcDestroy()
- {
- CWnd::PostNcDestroy();
- delete this;
- }
- bool CExtDynDockMarkerWnd::IsAnimationInProcess() const
- {
- ASSERT_VALID( this );
- return m_bAnimationInProcess;
- }
- void CExtDynDockMarkerWnd::AnimationStart(
- bool bShow
- )
- {
- ASSERT_VALID( this );
- AnimationStop();
- bool bNeedToAnimate = false;
- if( (GetStyle()&WS_VISIBLE) == 0 )
- {
- if( bShow )
- {
- bNeedToAnimate = true;
- if( g_PaintManager.m_bIsWin2000orLater
- && g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL
- && CExtPaintManager::stat_GetBPP() > 8
- )
- {
- __EXT_MFC_ULONG_PTR nStyle = ::__EXT_MFC_GetWindowLong( GetSafeHwnd(), GWL_EXSTYLE );
- ::__EXT_MFC_SetWindowLong( GetSafeHwnd(), GWL_EXSTYLE, nStyle | __EXT_MFC_WS_EX_LAYERED );
- m_nOpaquePercent = 0;
- g_PaintManager.m_pfnSetLayeredWindowAttributes(
- GetSafeHwnd(),
- 0,
- BYTE((255 * m_nOpaquePercent) / 100),
- __EXT_MFC_LWA_ALPHA
- );
- ShowWindow( SW_SHOWNOACTIVATE );
- CExtPaintManager::stat_PassPaintMessages();
- }
- } // if( bShow )
- }
- else
- {
- if( !bShow )
- {
- bNeedToAnimate = true;
- if( g_PaintManager.m_bIsWin2000orLater
- && g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL
- && CExtPaintManager::stat_GetBPP() > 8
- )
- {
- __EXT_MFC_ULONG_PTR nStyle = ::__EXT_MFC_GetWindowLong( GetSafeHwnd(), GWL_EXSTYLE );
- ::__EXT_MFC_SetWindowLong( GetSafeHwnd(), GWL_EXSTYLE, nStyle | __EXT_MFC_WS_EX_LAYERED );
- m_nOpaquePercent = 100;
- g_PaintManager.m_pfnSetLayeredWindowAttributes(
- GetSafeHwnd(),
- 0,
- BYTE((255 * m_nOpaquePercent) / 100),
- __EXT_MFC_LWA_ALPHA
- );
- CExtPaintManager::stat_PassPaintMessages();
- }
- } // if( !bShow )
- }
- if( bNeedToAnimate )
- {
- m_bAnimationShow = bShow;
- m_bAnimationInProcess = true;
- m_bDestroyOnAnimationStop = false;
- SetTimer( __DYNDOCKMARKER_TIMER_ID_ANIMATE, 1, NULL );
- OnTimer( __DYNDOCKMARKER_TIMER_ID_ANIMATE );
- }
- }
- void CExtDynDockMarkerWnd::AnimationStop()
- {
- ASSERT_VALID( this );
- KillTimer( __DYNDOCKMARKER_TIMER_ID_ANIMATE );
- if( (GetStyle()&WS_VISIBLE) != 0 )
- {
- if( !m_bAnimationShow )
- ShowWindow( SW_HIDE );
- }
- else
- {
- if( m_bAnimationShow )
- ShowWindow( SW_SHOWNOACTIVATE );
- }
-
- ::RedrawWindow(
- GetSafeHwnd(),
- NULL,
- NULL,
- RDW_INVALIDATE | RDW_UPDATENOW
- );
- m_bAnimationInProcess = false;
- if( m_bDestroyOnAnimationStop )
- DestroyWindow();
- }
- bool CExtDynDockMarkerWnd::ShowMarker(
- bool bShow,
- bool bAnimate // = true
- )
- {
- ASSERT_VALID( this );
- if( g_PaintManager.m_bIsWin2000orLater
- && g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL
- && CExtPaintManager::stat_GetBPP() > 8
- && PmBridge_GetPM()->m_eStyle2005 != CExtPaintManager::__ES2005_BETA1
- && bAnimate
- )
- {
- AnimationStart( bShow );
- }
- else
- {
- if( (GetStyle()&WS_VISIBLE) != 0 )
- {
- if( !bShow )
- ShowWindow( SW_HIDE );
- }
- else
- {
- if( bShow )
- ShowWindow( SW_SHOWNOACTIVATE );
- }
- }
- return true;
- }
- void CExtDynDockMarkerWnd::ShowMarkers(
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * >
- & arrDockMarkerWnds,
- bool bShow, // = true
- bool bAnimate // = true
- )
- {
- static bool bAnimatingInProcess = false;
- int nCount = (int)arrDockMarkerWnds.GetSize();
- if( nCount <= 0 )
- return;
- // if( g_PaintManager.m_bIsWin2000orLater
- // && g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL
- // && CExtPaintManager::stat_GetBPP() > 8
- // && bAnimate
- // && !bAnimatingInProcess
- // )
- // {
- // bool bNeedToAnimate = false;
- //
- // // apply the __EXT_MFC_WS_EX_LAYERED style for all the marker windows
- // int nIndex = 0;
- // for( nIndex = 0; nIndex < nCount; nIndex++ )
- // {
- // CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- // arrDockMarkerWnds[ nIndex ];
- // ASSERT_VALID( pDynDockMarkerWnd );
- // ASSERT( pDynDockMarkerWnd->GetSafeHwnd() != NULL );
- //
- // if( (pDynDockMarkerWnd->GetStyle()&WS_VISIBLE) == 0 )
- // {
- // if( bShow )
- // {
- // bNeedToAnimate = true;
- //
- // LONG nStyle =
- // ::__EXT_MFC_GetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE
- // );
- // ::__EXT_MFC_SetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE,
- // nStyle | __EXT_MFC_WS_EX_LAYERED
- // );
- // g_PaintManager.m_pfnSetLayeredWindowAttributes(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // 0,
- // 0,
- // __EXT_MFC_LWA_ALPHA
- // );
- // pDynDockMarkerWnd->ShowWindow( SW_SHOWNOACTIVATE );
- //
- // } // if( bShow )
- // }
- // else
- // {
- // if( !bShow )
- // {
- // bNeedToAnimate = true;
- //
- // LONG nStyle =
- // ::__EXT_MFC_GetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE
- // );
- // ::__EXT_MFC_SetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE,
- // nStyle | __EXT_MFC_WS_EX_LAYERED
- // );
- // g_PaintManager.m_pfnSetLayeredWindowAttributes(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // 0,
- // 255,
- // __EXT_MFC_LWA_ALPHA
- // );
- // } // if( !bShow )
- // }
- // }
- //
- // if( bNeedToAnimate )
- // {
- // bAnimatingInProcess = true;
- // for( int nPercent = 25; nPercent <= 100; nPercent += 25 )
- // {
- // // Make the marker window nPercent% alpha
- // for( nIndex = 0; nIndex < nCount; nIndex++ )
- // {
- // CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- // arrDockMarkerWnds[ nIndex ];
- // ASSERT_VALID( pDynDockMarkerWnd );
- // ASSERT( pDynDockMarkerWnd->GetSafeHwnd() != NULL );
- //
- // g_PaintManager.m_pfnSetLayeredWindowAttributes(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // 0,
- // BYTE((255 * (bShow ? nPercent : 100 - nPercent)) / 100),
- // __EXT_MFC_LWA_ALPHA
- // );
- // ::RedrawWindow(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // NULL,
- // NULL,
- // RDW_INVALIDATE | RDW_UPDATENOW
- // );
- // }
- // Sleep( 15 );
- // }
- // }
- //
- // // remove the __EXT_MFC_WS_EX_LAYERED style for all the marker windows
- // for( nIndex = 0; nIndex < nCount; nIndex++ )
- // {
- // CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- // arrDockMarkerWnds[ nIndex ];
- // ASSERT_VALID( pDynDockMarkerWnd );
- // ASSERT( pDynDockMarkerWnd->GetSafeHwnd() != NULL );
- //
- // if( (pDynDockMarkerWnd->GetStyle()&WS_VISIBLE) != 0 )
- // {
- // if( !bShow )
- // pDynDockMarkerWnd->ShowWindow( SW_HIDE );
- // }
- // else
- // {
- // if( bShow )
- // pDynDockMarkerWnd->ShowWindow( SW_SHOWNOACTIVATE );
- // }
- //
- // LONG nStyle =
- // ::__EXT_MFC_GetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE
- // );
- // if( (nStyle & __EXT_MFC_WS_EX_LAYERED) != 0 )
- // {
- // ::__EXT_MFC_SetWindowLong(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // GWL_EXSTYLE,
- // nStyle & ~__EXT_MFC_WS_EX_LAYERED
- // );
- // ::RedrawWindow(
- // pDynDockMarkerWnd->GetSafeHwnd(),
- // NULL,
- // NULL,
- // RDW_INVALIDATE | RDW_UPDATENOW
- // );
- // }
- // }
- // bAnimatingInProcess = false;
- // }
- // else
- {
- for( int nIndex = 0; nIndex < nCount; nIndex++ )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- arrDockMarkerWnds[ nIndex ];
- ASSERT_VALID( pDynDockMarkerWnd );
- ASSERT( pDynDockMarkerWnd->GetSafeHwnd() != NULL );
- if( (pDynDockMarkerWnd->GetStyle()&WS_VISIBLE) != 0 )
- {
- if( !bShow )
- //pDynDockMarkerWnd->ShowWindow( SW_HIDE );
- pDynDockMarkerWnd->ShowMarker( false, bAnimate );
- }
- else
- {
- if( bShow )
- //pDynDockMarkerWnd->ShowWindow( SW_SHOWNOACTIVATE );
- pDynDockMarkerWnd->ShowMarker( true, bAnimate );
- }
- } // for( int nIndex = 0; nIndex < nCount; nIndex++ )
- }
- CExtPaintManager::stat_PassPaintMessages();
- }
- void CExtDynDockMarkerWnd::CreateOuterMarkers(
- CFrameWnd * pFrame,
- bool bShow, // = true
- CExtPaintManager * pPM // = NULL
- )
- {
- ASSERT_VALID( pFrame );
- ASSERT_KINDOF( CFrameWnd, pFrame );
- AFX_SIZEPARENTPARAMS layout;
- layout.bStretch = FALSE;
- layout.sizeTotal.cx = layout.sizeTotal.cy = 0;
- pFrame->GetClientRect(
- &layout.rect
- );
- layout.hDWP = NULL;
- //HWND hWndLeftOver = NULL;
- for( HWND hWndChild = ::GetTopWindow( pFrame->m_hWnd );
- hWndChild != NULL;
- hWndChild = ::GetWindow( hWndChild, GW_HWNDNEXT )
- )
- {
- UINT nIDC = _AfxGetDlgCtrlID(hWndChild);
- if( nIDC == AFX_IDW_PANE_FIRST )
- {
- //hWndLeftOver = hWndChild;
- continue;
- }
- CWnd * pWnd =
- CWnd::FromHandlePermanent( hWndChild );
- if( pWnd != NULL )
- {
- CExtDockBar * pExtDockBar =
- DYNAMIC_DOWNCAST(
- CExtDockBar,
- pWnd
- );
- if( pExtDockBar != NULL )
- {
- UINT nCircleNo = pExtDockBar->_GetCircleNo();
- if( nCircleNo >= 1 )
- break;
- } // if( pExtDockBar != NULL )
- CExtControlBar::QUERY_REPOSITION_CALC_EFFECT_DATA _qrced(
- (SHORT)reposQuery,
- pFrame,
- 0,
- 0x0FFFF,
- AFX_IDW_PANE_FIRST,
- &layout.rect,
- &layout.rect,
- false
- );
- pWnd->SendMessage(
- CExtControlBar::g_nMsgQueryRepositionCalcEffect,
- _qrced,
- 0L
- );
- if( _qrced.ExcludeFromCenterGet() )
- {
- ASSERT( _qrced.IsQueryReposQuery() );
- continue;
- }
- } // if( pWnd != NULL )
- ::SendMessage(
- hWndChild,
- WM_SIZEPARENT,
- 0,
- (LPARAM)&layout
- );
- }
- if( pPM == NULL )
- pPM = g_PaintManager.GetPM();
- CRect rcScreen( layout.rect );
- pFrame->ClientToScreen( &rcScreen );
- VERIFY(
- pPM->DockMarker_CreateWnds(
- NULL, //hWndLeftOver
- CExtPaintManager::__EDMT_2005_GROUP_SPARSED,
- rcScreen,
- g_arrDockMarkerWndsOuter,
- ( INT(CExtControlBar::g_eResizablePanelDockingType) < 0 )
- ? ( ( pPM == NULL ) ? g_PaintManager->GetThemeDockingType() : pPM->GetThemeDockingType() )
- : INT(CExtControlBar::g_eResizablePanelDockingType)
- ,
- NULL
- )
- );
- ShowMarkers(
- g_arrDockMarkerWndsOuter,
- bShow,
- false
- );
- }
- //void CExtDynDockMarkerWnd::CreateInnerMarkers(
- // CFrameWnd * pFrame,
- // bool bShow // = true
- // )
- //{
- // ASSERT_VALID( pFrame );
- // ASSERT_KINDOF( CFrameWnd, pFrame );
- //CRect rcScreen;
- // pFrame->GetClientRect( &rcScreen );
- // CExtControlBar::RepositionBarsEx(
- // pFrame,
- // 0,
- // 0x0FFFF,
- // AFX_IDW_PANE_FIRST,
- // CWnd::reposQuery,
- // rcScreen,
- // rcScreen
- // );
- // pFrame->ClientToScreen( &rcScreen );
- // VERIFY(
- // PmBridge_GetPM()->DockMarker_CreateWnds(
- // CExtPaintManager::__EDMT_2005_GROUP_SPARSED,
- // rcScreen,
- // g_arrDockMarkerWndsInner,
- // NULL
- // )
- // );
- // ShowMarkers(
- // g_arrDockMarkerWndsInner,
- // bShow
- // );
- //}
- CExtDynDockMarkerWnd * CExtDynDockMarkerWnd::stat_FindMarker(
- HWND hWndMarkerTarget,
- int eMarkerType,
- bool bSparsedMode
- )
- {
- CTypedPtrArray < CPtrArray, CExtDynDockMarkerWnd * > & _arr =
- bSparsedMode
- ? CExtDynDockMarkerWnd::g_arrDockMarkerWndsOuter
- : CExtDynDockMarkerWnd::g_arrDockMarkerWndsInner
- ;
- int nIndex, nCount = (int)_arr.GetSize();
- for( nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- _arr[ nIndex ];
- ASSERT_VALID( pDynDockMarkerWnd );
- if( pDynDockMarkerWnd->m_eMarkerType == eMarkerType
- && ( ( bSparsedMode && pDynDockMarkerWnd->m_bSparsedMode )
- || ( (!bSparsedMode) && (!pDynDockMarkerWnd->m_bSparsedMode) )
- )
- )
- {
- if( hWndMarkerTarget != NULL )
- {
- if( hWndMarkerTarget != pDynDockMarkerWnd->m_hWndMarkerTarget )
- continue;
- }
- return pDynDockMarkerWnd;
- }
- } // for( nIndex = 0; nIndex < nCount; nIndex ++ )
- return NULL;
- }
- HWND CExtDynDockMarkerWnd::stat_AnalyzeDynBar(
- CExtDynControlBar * pDynBar,
- CPoint ptCursor
- )
- {
- ASSERT_VALID( pDynBar );
- ASSERT_KINDOF( CExtDynControlBar, pDynBar );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT( ! pDynBar->IsKindOf( RUNTIME_CLASS(CExtDynTabControlBar) ) );
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- ASSERT( pDynBar->GetSafeHwnd() != NULL );
- CExtDockDynBar * pWndDynDocker = pDynBar->m_pWndDynDocker;
- ASSERT_VALID( pWndDynDocker );
- ASSERT_KINDOF( CExtDockDynBar, pWndDynDocker );
- ASSERT( pWndDynDocker->GetSafeHwnd() != NULL );
- CExtControlBar * pDraggedBar =
- CExtControlBar::_DraggingGetBar();
- ASSERT_VALID( pDraggedBar );
- ExtControlBarVector_t vBars;
- pWndDynDocker->CalcOrderedVector( vBars );
- int nBarCount = (int)vBars.GetSize();
- for( int nBarIdx = 0; nBarIdx < nBarCount; nBarIdx++ )
- {
- CExtControlBar * pExtBar = vBars[ nBarIdx ];
- ASSERT_VALID( pExtBar );
- ASSERT_KINDOF( CExtControlBar, pExtBar );
- if( pExtBar->IsFixedMode()
- || pExtBar->IsFixedDockStyle()
- )
- continue;
- if( ! pExtBar->IsWindowVisible() )
- continue;
- CRect rcWnd;
- pExtBar->GetWindowRect( &rcWnd );
- if( ! rcWnd.PtInRect(ptCursor) )
- continue;
- HWND hWndDynamicTarget = pExtBar->GetSafeHwnd();
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pDynTabControlBar =
- pExtBar->_GetNearestTabbedContainer();
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- CExtDynControlBar * pDynBar =
- DYNAMIC_DOWNCAST( CExtDynControlBar, pExtBar );
- if( pDynBar != NULL )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pDynTabControlBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, pDynBar );
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- hWndDynamicTarget =
- stat_AnalyzeDynBar(
- pDynBar,
- ptCursor
- );
- if( hWndDynamicTarget == NULL )
- continue;
- return hWndDynamicTarget;
- } // else from if( pDynTabControlBar != NULL )
- } // if( pDynBar != NULL )
- }
- return hWndDynamicTarget;
- } // for( int nBarIdx = 0; nBarIdx < nBarCount; nBarIdx++ )
- return NULL;
- }
- void CExtDynDockMarkerWnd::CreateDynamicMarkers(
- CFrameWnd * pFrame,
- bool bShow, // = true
- CExtPaintManager * pPM // = NULL
- )
- {
- ASSERT_VALID( pFrame );
- ASSERT_KINDOF( CFrameWnd, pFrame );
- if( pPM == NULL )
- pPM = g_PaintManager.GetPM();
- bool bInnerAreaFound = false;
- HWND hWndDynamicTarget = NULL;
- CPoint ptCursor;
- if( ::GetCursorPos( &ptCursor ) )
- {
- CExtControlBar * pDraggedBar =
- CExtControlBar::_DraggingGetBar();
- if( pDraggedBar == NULL )
- return;
- bool bFound = false;
- hWndDynamicTarget = ::WindowFromPoint( ptCursor );
- if( hWndDynamicTarget != NULL )
- {
- CWnd * pWnd =
- CWnd::FromHandlePermanent( hWndDynamicTarget );
- if( pWnd != NULL )
- {
- CExtDynDockMarkerWnd * pDynDockMarkerWnd =
- DYNAMIC_DOWNCAST( CExtDynDockMarkerWnd, pWnd );
- if( pDynDockMarkerWnd != NULL )
- return;
- } // if( pWnd != NULL )
- } // if( hWndDynamicTarget != NULL )
- if( ! bFound )
- {
- for( POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- pos != NULL;
- )
- {
- CControlBar * pBar = (CControlBar *)
- pFrame->m_listControlBars.GetNext( pos );
- ASSERT_VALID( pBar );
- ASSERT_KINDOF( CControlBar, pBar );
- if( pDraggedBar != NULL
- && LPVOID(pDraggedBar) == LPVOID(pBar)
- )
- continue;
- if( pBar->IsDockBar() )
- continue;
- CExtControlBar * pExtBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pBar );
- if( pExtBar == NULL )
- continue;
- if( pExtBar->IsFixedMode()
- || pExtBar->IsFixedDockStyle()
- )
- continue;
- //DWORD dwStyle = pBar->GetStyle();
- //if( (dwStyle&WS_VISIBLE) == 0 )
- // continue;
- if( ! pBar->IsWindowVisible() )
- continue;
- CFrameWnd * pParentFrame =
- pBar->GetParentFrame();
- if( pParentFrame == pFrame )
- continue;
- if( ! pParentFrame->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd)) )
- continue;
- DWORD dwParentFrameStyle = pParentFrame->GetStyle();
- if( (dwParentFrameStyle&WS_VISIBLE) == 0 )
- continue;
- if( pDraggedBar != NULL
- && pDraggedBar->GetParentFrame() == pParentFrame
- )
- continue;
- CRect rcWnd;
- pParentFrame->GetWindowRect( &rcWnd );
- if( ! rcWnd.PtInRect(ptCursor) )
- continue;
- pExtBar->GetWindowRect( &rcWnd );
- if( ! rcWnd.PtInRect(ptCursor) )
- continue;
- hWndDynamicTarget = pExtBar->GetSafeHwnd();
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pDynTabControlBar =
- pExtBar->_GetNearestTabbedContainer();
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- CExtDynControlBar * pDynBar =
- DYNAMIC_DOWNCAST( CExtDynControlBar, pExtBar );
- if( pDynBar != NULL )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pDynTabControlBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, pDynBar );
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- hWndDynamicTarget =
- stat_AnalyzeDynBar(
- pDynBar,
- ptCursor
- );
- if( hWndDynamicTarget == NULL )
- continue;
- bFound = true;
- break;
- } // else from if( pDynTabControlBar != NULL )
- } // if( pDynBar != NULL )
- }
- bFound = true;
- break;
- }
- if( ! bFound )
- {
- for( hWndDynamicTarget = ::GetNextWindow( pFrame->GetSafeHwnd(), GW_CHILD );
- hWndDynamicTarget != NULL;
- hWndDynamicTarget = ::GetNextWindow( hWndDynamicTarget, GW_HWNDNEXT )
- )
- {
- //DWORD dwStyle = (DWORD)
- // ::__EXT_MFC_GetWindowLong( hWndDynamicTarget, GWL_STYLE );
- //if( (dwStyle&WS_VISIBLE) == 0 )
- // continue;
- if( ! ::IsWindowVisible( hWndDynamicTarget ) )
- continue;
- CRect rcWnd;
- ::GetWindowRect( hWndDynamicTarget, &rcWnd );
- if( ! rcWnd.PtInRect(ptCursor) )
- continue;
- UINT nDlgCtrlID = (UINT)
- ::GetDlgCtrlID( hWndDynamicTarget );
- if( nDlgCtrlID == AFX_IDW_PANE_FIRST )
- {
- bFound = bInnerAreaFound = true;
- break;
- } // if( nDlgCtrlID == AFX_IDW_PANE_FIRST )
- CWnd * pWnd =
- CWnd::FromHandlePermanent( hWndDynamicTarget );
- if( pWnd == NULL )
- break;
- if( g_hWndLastDynamicTarget == hWndDynamicTarget )
- {
- bFound = true;
- break;
- }
- CExtDockBar * pDockBar =
- DYNAMIC_DOWNCAST( CExtDockBar, pWnd );
- if( pDockBar == NULL )
- break;
- if( pDockBar->_GetCircleNo() < 1 )
- break;
- for( hWndDynamicTarget = ::GetNextWindow( hWndDynamicTarget, GW_CHILD );
- hWndDynamicTarget != NULL;
- hWndDynamicTarget = ::GetNextWindow( hWndDynamicTarget, GW_HWNDNEXT )
- )
- {
- __EXT_MFC_ULONG_PTR dwStyle = ::__EXT_MFC_GetWindowLong( hWndDynamicTarget, GWL_STYLE );
- if( (dwStyle&WS_VISIBLE) == 0 )
- continue;
- CRect rcWnd;
- ::GetWindowRect( hWndDynamicTarget, &rcWnd );
- if( ! rcWnd.PtInRect(ptCursor) )
- continue;
- CWnd * pWnd =
- CWnd::FromHandlePermanent( hWndDynamicTarget );
- if( pWnd == NULL )
- break;
- if( g_hWndLastDynamicTarget == hWndDynamicTarget )
- {
- bFound = true;
- break;
- }
- CExtControlBar * pBar =
- DYNAMIC_DOWNCAST( CExtControlBar, pWnd );
- if( pBar == NULL )
- continue;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- CExtDynTabControlBar * pDynTabControlBar =
- pBar->_GetNearestTabbedContainer();
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- CExtDynControlBar * pDynBar =
- DYNAMIC_DOWNCAST( CExtDynControlBar, pBar );
- if( pDynBar != NULL )
- {
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- pDynTabControlBar =
- DYNAMIC_DOWNCAST( CExtDynTabControlBar, pDynBar );
- if( pDynTabControlBar != NULL )
- hWndDynamicTarget = pDynTabControlBar->GetSafeHwnd();
- else
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- {
- hWndDynamicTarget =
- stat_AnalyzeDynBar(
- pDynBar,
- ptCursor
- );
- if( hWndDynamicTarget == NULL )
- continue;
- bFound = true;
- break;
- } // else from if( pDynTabControlBar != NULL )
- } // if( pDynBar != NULL )
- }
- bFound = true;
- break;
- }
- break;
- }
- } // if( ! bFound )
- } // if( ! bFound )
- if( ! bFound )
- hWndDynamicTarget = NULL;
- } // if( ::GetCursorPos( &ptCursor ) )
- if( g_hWndLastDynamicTarget != NULL
- && (! ::IsWindow(g_hWndLastDynamicTarget) )
- )
- g_hWndLastDynamicTarget = NULL;
- if( g_hWndLastDynamicTarget == hWndDynamicTarget )
- {
- if( g_hWndLastDynamicTarget == NULL )
- DestroyMarkers( g_arrDockMarkerWndsInner, true );
- return;
- }
- DestroyMarkers( g_arrDockMarkerWndsInner, true );
- if( hWndDynamicTarget != NULL )
- {
- CWnd * pWndPermanent = CWnd::FromHandlePermanent( hWndDynamicTarget );
- if( pWndPermanent != NULL
- && pWndPermanent->IsKindOf( RUNTIME_CLASS(CExtControlBar) )
- && (!( ((CExtControlBar*)pWndPermanent)->IsFixedDockStyle()
- || ((CExtControlBar*)pWndPermanent)->IsFixedMode()
- ))
- )
- {
- CExtControlBar * pBarDst = (CExtControlBar*)
- pWndPermanent;
- CExtControlBar * pBarSrc =
- CExtControlBar::_DraggingGetBar();
- ASSERT_VALID( pBarSrc );
- if( (! pBarSrc->_CanDockToTabbedContainers(pBarDst) )
- || (! pBarDst->_CanDockToTabbedContainers(pBarSrc) )
- )
- {
- if( (! pBarSrc->_CanDockLTRB(pBarDst) )
- || (! pBarDst->_CanDockLTRB(pBarSrc) )
- )
- {
- g_hWndLastDynamicTarget = NULL;
- return;
- }
- bInnerAreaFound = false;
- }
- }
- } // if( hWndDynamicTarget != NULL )
- g_hWndLastDynamicTarget = hWndDynamicTarget;
- if( g_hWndLastDynamicTarget != NULL )
- {
- CRect rcScreen;
- ::GetWindowRect( g_hWndLastDynamicTarget, &rcScreen );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- VERIFY(
- pPM->DockMarker_CreateWnds(
- g_hWndLastDynamicTarget,
- bInnerAreaFound
- ? CExtPaintManager::__EDMT_2005_GROUP_CENTRAL
- : CExtPaintManager::__EDMT_2005_GROUP_TAB
- ,
- rcScreen,
- g_arrDockMarkerWndsInner,
- ( INT(CExtControlBar::g_eResizablePanelDockingType) < 0 )
- ? ( ( pPM == NULL ) ? g_PaintManager->GetThemeDockingType() : pPM->GetThemeDockingType() )
- : INT(CExtControlBar::g_eResizablePanelDockingType)
- ,
- NULL
- )
- );
- #else // (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- VERIFY(
- pPM->DockMarker_CreateWnds(
- g_hWndLastDynamicTarget,
- CExtPaintManager::__EDMT_2005_GROUP_CENTRAL,
- rcScreen,
- g_arrDockMarkerWndsInner,
- ( INT(CExtControlBar::g_eResizablePanelDockingType) < 0 )
- ? ( ( pPM == NULL ) ? g_PaintManager->GetThemeDockingType() : pPM->GetThemeDockingType() )
- : INT(CExtControlBar::g_eResizablePanelDockingType)
- ,
- NULL
- )
- );
- #endif // else from (!defined __EXT_MFC_NO_TAB_CONTROLBARS )
- ShowMarkers(
- g_arrDockMarkerWndsInner,
- bShow,
- true
- );
- } // if( g_hWndLastDynamicTarget != NULL )
- }
- bool CExtDynDockMarkerWnd::g_bDockMarkerClassRegistered = false;
- bool CExtDynDockMarkerWnd::RegisterDockMarkerClass()
- {
- if( g_bDockMarkerClassRegistered )
- return true;
- WNDCLASS _wndClassInfo;
- HINSTANCE hInst = ::AfxGetInstanceHandle();
- if( ! ::GetClassInfo( hInst, __EXT_DYNDOCKMARKER_CLASS_NAME, &_wndClassInfo ) )
- {
- _wndClassInfo.style = CS_GLOBALCLASS; //|CS_DBLCLKS;
- _wndClassInfo.lpfnWndProc = ::DefWindowProc;
- _wndClassInfo.cbClsExtra = _wndClassInfo.cbWndExtra = 0;
- _wndClassInfo.hInstance = hInst;
- _wndClassInfo.hIcon = NULL;
- _wndClassInfo.hCursor = ::LoadCursor( NULL, IDC_ARROW );
- ASSERT( _wndClassInfo.hCursor != NULL );
- _wndClassInfo.hbrBackground = NULL;
- _wndClassInfo.lpszMenuName = NULL;
- _wndClassInfo.lpszClassName = __EXT_DYNDOCKMARKER_CLASS_NAME;
- if( !::AfxRegisterClass( &_wndClassInfo ) )
- {
- ASSERT( FALSE );
- //AfxThrowResourceException();
- return false;
- }
- }
- g_bDockMarkerClassRegistered = true;
- return true;
- }
- BOOL CExtDynDockMarkerWnd::PreCreateWindow( CREATESTRUCT & cs )
- {
- if( ( !RegisterDockMarkerClass() )
- || ( ! CWnd::PreCreateWindow(cs) )
- )
- {
- ASSERT( FALSE );
- return FALSE;
- }
-
- cs.lpszClass = __EXT_DYNDOCKMARKER_CLASS_NAME;
- return TRUE;
- }
- void CExtDynDockMarkerWnd::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
- {
- // CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
- bCalcValidRects;
- lpncsp;
- }
- int CExtDynDockMarkerWnd::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
- {
- // return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
- pDesktopWnd;
- nHitTest;
- message;
- return MA_NOACTIVATEANDEAT;
- }
- void CExtDynDockMarkerWnd::_RenderImpl( CDC * pDC )
- {
- ASSERT_VALID( this );
- ASSERT( pDC != NULL );
- ASSERT( pDC->GetSafeHdc() != NULL );
- CRect rcClient;
- GetClientRect( &rcClient );
- // CDC dcMemory;
- // if( dcMemory.CreateCompatibleDC( pDC ) )
- // {
- if( ! m_bmpOuterBk.IsEmpty() )
- {
- // CBitmap * pOldBmp =
- // dcMemory.SelectObject( &m_bmpOuterBk );
- // pDC->BitBlt(
- // rcClient.left,
- // rcClient.top,
- // rcClient.Width(),
- // rcClient.Height(),
- // &dcMemory,
- // 0,
- // 0,
- // SRCCOPY
- // );
- // dcMemory.SelectObject( pOldBmp );
- m_bmpOuterBk.AlphaBlend(
- pDC->GetSafeHdc(),
- rcClient
- );
- }
- CExtBitmap * pBmpInner =
- (m_eMTS == __EMTS_HOVER)
- ? (&m_bmpIn)
- : (&m_bmpOut)
- ;
- CSize _size = pBmpInner->GetSize();
- ASSERT( _size.cx > 0 && _size.cy > 0 );
- // CBitmap * pOldBmp =
- // dcMemory.SelectObject( pBmpInner );
- // pDC->BitBlt(
- // rcClient.left + m_ptOffsetInner.x,
- // rcClient.top + m_ptOffsetInner.y,
- // bmpDescription.bmWidth,
- // bmpDescription.bmHeight,
- // &dcMemory,
- // 0,
- // 0,
- // SRCCOPY
- // );
- // dcMemory.SelectObject( pOldBmp );
- pBmpInner->AlphaBlend(
- pDC->GetSafeHdc(),
- rcClient.left + m_ptOffsetInner.x,
- rcClient.top + m_ptOffsetInner.y,
- _size.cx,
- _size.cy
- );
- PmBridge_GetPM()->DockMarker_PostRender(
- *pDC,
- rcClient,
- (CExtPaintManager::eDockMarkerType_t)m_eMarkerType,
- ( m_eMTS == __EMTS_HOVER ) ? true : false,
- (CObject *)this
- );
- // } // if( dcMemory.CreateCompatibleDC( &dcPaint ) )
- // #ifdef _DEBUG
- // else
- // {
- // ASSERT( FALSE );
- // } // else from if( dcMemory.CreateCompatibleDC( &dcPaint ) )
- // #endif // _DEBUG
- }
- LRESULT CExtDynDockMarkerWnd::OnPrintClient( WPARAM wParam, LPARAM lParam )
- {
- lParam;
- LRESULT lResult = Default();
- CDC * pDC = CDC::FromHandle( (HDC)wParam );
- _RenderImpl( pDC );
- return lResult;
- }
- void CExtDynDockMarkerWnd::OnPaint()
- {
- CPaintDC dcPaint( this );
- _RenderImpl( &dcPaint );
- }
- void CExtDynDockMarkerWnd::OnTimer(__EXT_MFC_UINT_PTR nIDEvent)
- {
- if( nIDEvent == __DYNDOCKMARKER_TIMER_ID_ANIMATE )
- {
- if( (m_nOpaquePercent <= 0 && !m_bAnimationShow)
- || (m_nOpaquePercent >= 100 && m_bAnimationShow)
- )
- {
- AnimationStop();
- return;
- }
- m_nOpaquePercent +=
- m_bAnimationShow
- ? + __DYNDOCKMARKER_ANIMATION_PERCENT_STEP
- : - __DYNDOCKMARKER_ANIMATION_PERCENT_STEP;
- if( g_PaintManager.m_bIsWin2000orLater
- && g_PaintManager.m_pfnSetLayeredWindowAttributes != NULL
- && CExtPaintManager::stat_GetBPP() > 8
- )
- {
- g_PaintManager.m_pfnSetLayeredWindowAttributes(
- GetSafeHwnd(),
- 0,
- BYTE((g_PaintManager->DockMarker_GetAlpha( false, this ) * m_nOpaquePercent) / 100),
- __EXT_MFC_LWA_ALPHA
- );
- ::RedrawWindow(
- GetSafeHwnd(),
- NULL,
- NULL,
- RDW_INVALIDATE | RDW_UPDATENOW
- );
- }
- return;
- } // if( nIDEvent == __DYNDOCKMARKER_TIMER_ID_ANIMATE )
- else if( nIDEvent == __DYNDOCKMARKER_TIMER_ID_TEMP )
- {
- if( (GetStyle()&WS_VISIBLE) == 0 )
- return;
- if( m_hWndMarkerTarget != NULL )
- {