Exemplo n.º 1
0
DWORD CFrameWnd::CanDock( CRect rect, DWORD dwDockStyle, CDockBar **ppDockBar )
/*****************************************************************************/
{
    POSITION position = m_listControlBars.GetHeadPosition();
    while( position != NULL ) {
        CControlBar *pControlBar = (CControlBar *)m_listControlBars.GetNext( position );
        ASSERT( pControlBar != NULL );
        if( pControlBar->IsDockBar() && (pControlBar->GetBarStyle() & dwDockStyle) ) {
            CDockBar *pDockBar = (CDockBar *)pControlBar;
            ASSERT( pDockBar->IsKindOf( RUNTIME_CLASS( CDockBar ) ) );

            if( !pDockBar->m_bFloating ||
                (pDockBar->GetBarStyle() & CBRS_FLOAT_MULTI) ) {
                CRect rectBar;
                pDockBar->GetWindowRect( &rectBar );
                
                RECT rectJunk;
                if( rectBar.left == rectBar.right ) {
                    rectBar.right++;
                }
                if( rectBar.top == rectBar.bottom ) {
                    rectBar.bottom++;
                }
                if( ::IntersectRect( &rectJunk, &rect, &rectBar ) ) {
                    if( ppDockBar != NULL ) {
                        *ppDockBar = pDockBar;
                    }
                    return( pDockBar->GetBarStyle() & dwDockStyle );
                }
            }
        }
    }
    return( 0L );
}
Exemplo n.º 2
0
//-----------------------------------------------------------------
void CMRCFrameWndSizeDock::GetFloatingBars(CObArray & arrWnd)
// Appends the floating bars, visible bars to an array
//-----------------------------------------------------------------
{
	CPtrList & listControlBars = m_listControlBars;
	
	POSITION pos = listControlBars.GetHeadPosition();
	while (pos != NULL)
	{
		CControlBar* pBar = (CControlBar*)listControlBars.GetNext(pos);
		ASSERT(pBar != NULL);
		if (!pBar->IsDockBar() && pBar->IsFloating() && pBar->IsVisible()) 	// not a dockbar and floating....
		{
			ASSERT(pBar->m_pDockBar != NULL);
			CWnd * pFloatFrame = ((CWnd *)pBar->m_pDockBar)->GetParent(); 
			ASSERT(pBar != NULL);
			arrWnd.Add(pFloatFrame);
		}
	}
}
Exemplo n.º 3
0
void CFrameWnd::OnSetPreviewMode( BOOL bPreview, CPrintPreviewState *pState )
/***************************************************************************/
{
    ASSERT( pState != NULL );
    
    DWORD       dwSaveStates = 0L;
    POSITION    position = m_listControlBars.GetHeadPosition();
    while( position != NULL ) {
        CControlBar *pBar = (CControlBar *)m_listControlBars.GetNext( position );
        ASSERT( pBar != NULL );
        ASSERT( pBar->IsKindOf( RUNTIME_CLASS( CControlBar ) ) );

        DWORD dwID = pBar->GetDlgCtrlID();
        if( dwID >= AFX_IDW_CONTROLBAR_FIRST && dwID < AFX_IDW_CONTROLBAR_FIRST + 32 ) {
            DWORD dwThisState = AFX_CONTROLBAR_MASK( dwID );
            if( pBar->IsWindowVisible() ) {
                dwSaveStates |= dwThisState;
            }
            if( !(pBar->IsDockBar() && pBar->GetDlgCtrlID() == AFX_IDW_DOCKBAR_FLOAT) ) {
                ShowControlBar( pBar, pState->dwStates & dwThisState, TRUE );
            }
        }
    }
    pState->dwStates = dwSaveStates;
    
    if( bPreview ) {
        m_lpfnCloseProc = pState->lpfnCloseProc;
        
        pState->hMenu = ::GetMenu( m_hWnd );
        ::SetMenu( m_hWnd, NULL );
        pState->hAccelTable = m_hAccelTable;
        m_hAccelTable = NULL;
        LoadAccelTable( MAKEINTRESOURCE( AFX_IDR_PREVIEW_ACCEL ) );

        HWND hWndPane = ::GetDlgItem( m_hWnd, pState->nIDMainPane );
        if( hWndPane != NULL ) {
            ::ShowWindow( hWndPane, SW_HIDE );
        }
        hWndPane = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_FIRST );
        if( hWndPane != NULL ) {
            ::SetWindowLong( hWndPane, GWL_ID, AFX_IDW_PANE_SAVE );
        }
    } else {
        m_lpfnCloseProc = NULL;
        
        if( pState->hMenu != NULL ) {
            ::SetMenu( m_hWnd, pState->hMenu );
            pState->hMenu = NULL;
        }
        if( pState->hAccelTable != NULL ) {
            m_hAccelTable = pState->hAccelTable;
            pState->hAccelTable = NULL;
        }

        HWND hWndPane = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_SAVE );
        if( hWndPane != NULL ) {
            ::SetWindowLong( hWndPane, GWL_ID, AFX_IDW_PANE_FIRST );
        }
        hWndPane = ::GetDlgItem( m_hWnd, pState->nIDMainPane );
        if( hWndPane != NULL ) {
            ::ShowWindow( hWndPane, SW_SHOW );
        }
    }
}