Exemplo n.º 1
0
void CFrameWnd::OnUpdateControlBarMenu( CCmdUI *pCmdUI )
/******************************************************/
{
    CControlBar *pBar = GetControlBar( pCmdUI->m_nID );
    if( pBar != NULL ) {
        pCmdUI->SetCheck( pBar->IsWindowVisible() ? 1 : 0 );
    } else {
        pCmdUI->ContinueRouting();
    }
}
Exemplo n.º 2
0
BOOL CFrameWnd::OnBarCheck( UINT nID )
/************************************/
{
    CControlBar *pBar = GetControlBar( nID );
    if( pBar == NULL ) {
        return( FALSE );
    }
    ShowControlBar( pBar, !pBar->IsWindowVisible(), FALSE );
    return( TRUE );
}
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 );
        }
    }
}