//*************************************************************************************
void CBCGPFrameWnd::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState)
{
    ASSERT_VALID (this);

    CBCGPFrameWnd* pMainFrame = DYNAMIC_DOWNCAST (CBCGPFrameWnd, BCGCBProGetTopLevelFrame (this));
    if (pMainFrame != NULL)
    {
        pMainFrame->SetPrintPreviewFrame (bPreview ? this : NULL);
    }

    m_dockManager.SetPrintPreviewMode (bPreview, pState);
    DWORD dwSavedState = pState->dwStates;
    CFrameWnd::OnSetPreviewMode (bPreview, pState);
    pState->dwStates = dwSavedState;

    AdjustDockingLayout ();
    RecalcLayout ();

#ifndef BCGP_EXCLUDE_RIBBON
    if (m_Impl.m_pRibbonBar != NULL &&
            m_Impl.m_pRibbonBar->IsReplaceFrameCaption ())
    {
        PostMessage (BCGM_POSTSETPREVIEWFRAME, bPreview);
    }
#endif
}
//*************************************************************************************
BOOL CBCGPFrameWnd::OnShowControlBars (BOOL bShow)
{
    ASSERT_VALID (this);

    BOOL bRibbonWasHidden = FALSE;

#ifndef BCGP_EXCLUDE_RIBBON
    if (bShow &&
            m_Impl.m_pRibbonBar != NULL &&
            (m_Impl.m_pRibbonBar->GetStyle () & WS_VISIBLE) == 0)
    {
        bRibbonWasHidden = TRUE;
    }
#endif

    BOOL bResult = m_dockManager.ShowControlBars (bShow);
    AdjustDockingLayout ();

#ifndef BCGP_EXCLUDE_RIBBON
    if (bShow && bRibbonWasHidden &&
            m_Impl.m_pRibbonBar != NULL &&
            (m_Impl.m_pRibbonBar->GetStyle () & WS_VISIBLE))
    {
        m_Impl.m_pRibbonBar->RedrawWindow(NULL, NULL,
                                          RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN);
    }
#endif

    return bResult;
}
//*****************************************************************************
void CBCGPOleCntrFrameWnd::DockControlBar (CBCGPBaseControlBar* pBar, UINT nDockBarID, 
									LPCRECT lpRect)
{
	ASSERT_VALID (this);
	m_dockManager.DockControlBar (pBar, nDockBarID, lpRect);
	AdjustDockingLayout ();
}
//*****************************************************************************
void CBCGPOleCntrFrameWnd::RemoveControlBarFromDockManager (CBCGPBaseControlBar* pControlBar, BOOL bDestroy,
										 BOOL bAdjustLayout, BOOL bAutoHide, CBCGPBaseControlBar* pBarReplacement)
{
	ASSERT_VALID (this);
	m_dockManager.RemoveControlBarFromDockManager (pControlBar, bDestroy, bAdjustLayout, bAutoHide, pBarReplacement);
	AdjustDockingLayout ();
}
//********************************************************************************
BOOL CBCGPOleDocIPFrameWnd::OnShowControlBars (BOOL bShow)
{
	ASSERT_VALID (this);
	BOOL bResult = m_dockManager.ShowControlBars (bShow);
	AdjustDockingLayout ();
	
	return bResult;
}
//*************************************************************************************
void CBCGPOleCntrFrameWnd::OnSize(UINT nType, int cx, int cy) 
{
	COleCntrFrameWnd::OnSize(nType, cx, cy);
	
	if (nType != SIZE_MINIMIZED)
	{
		AdjustDockingLayout ();
	}
}
//*************************************************************************************
void CBCGPOleCntrFrameWnd::OnSizing(UINT fwSide, LPRECT pRect) 
{
	COleCntrFrameWnd::OnSizing(fwSide, pRect);

	CRect rect;
	GetWindowRect (rect);

	if (rect.Size () != CRect (pRect).Size ())
	{
		AdjustDockingLayout ();	
	}
}
//----------------------------------------------------------------------------------//
void CBCGPAutoHideDockBar::DockControlBar (CBCGPControlBar* pControlBar, BCGP_DOCK_METHOD /*dockMethod*/, 
								    LPCRECT lpRect)
{
	ASSERT_VALID (this);
	ASSERT_VALID (pControlBar);

	BOOL bVertDock = !IsHorizontal ();
	CSize szBarSize = pControlBar->CalcFixedLayout (FALSE, !bVertDock);

	// the control bar doesn't take up all space of the row
	int nRowHeight = bVertDock ? szBarSize.cx + m_nExtraSpace 
							   : szBarSize.cy + m_nExtraSpace;

	if (!m_lstControlBars.Find (pControlBar))
	{
		CBCGPDockBarRow* pRowToDock = NULL;

		if (m_lstDockBarRows.IsEmpty ())
		{
			pRowToDock = AddRow (NULL, nRowHeight);
			if (GetCurrentAlignment () & CBRS_ALIGN_LEFT || 
				GetCurrentAlignment () & CBRS_ALIGN_TOP)
			{
				pRowToDock->SetExtra (m_nExtraSpace, BCGP_ROW_ALIGN_TOP);
			}
			else
			{
				pRowToDock->SetExtra (m_nExtraSpace, BCGP_ROW_ALIGN_BOTTOM);
			}
		}
		else
		{
			pRowToDock = (CBCGPDockBarRow*) m_lstDockBarRows.GetHead ();
		}
		
		ASSERT_VALID (pRowToDock);
		// the bar should be placed on the existing row or new row
		pRowToDock->AddControlBar (pControlBar, BCGP_DM_RECT, lpRect, TRUE);

		ShowWindow (SW_SHOW);

		m_lstControlBars.AddTail (pControlBar);
		AdjustDockingLayout ();
		CRect rectClient;
		GetClientRect (rectClient);
		RepositionBars (rectClient);
		
	}
}
//****************************************************************************************
void CBCGPFrameWnd::OnSize(UINT nType, int cx, int cy)
{
    m_bIsMinimized = (nType == SIZE_MINIMIZED);

    if (m_Impl.m_pRibbonBar || m_Impl.IsOwnerDrawCaption ())
    {
        CRect rectWindow;
        GetWindowRect (rectWindow);

        WINDOWPOS wndpos;
        wndpos.flags = SWP_FRAMECHANGED;
        wndpos.x     = rectWindow.left;
        wndpos.y     = rectWindow.top;
        wndpos.cx    = rectWindow.Width ();
        wndpos.cy    = rectWindow.Height ();

        m_Impl.OnWindowPosChanging (&wndpos);
    }

    m_Impl.UpdateCaption ();
    m_dockManager.OnActivateFrame (!m_bIsMinimized);

    if (!m_bIsMinimized && nType != SIZE_MAXIMIZED && !m_bWasMaximized)
    {
        m_dockManager.m_bSizeFrame = TRUE;
        CFrameWnd::OnSize(nType, cx, cy);
        AdjustDockingLayout ();
        m_dockManager.m_bSizeFrame = FALSE;
        return;
    }

    CFrameWnd::OnSize(nType, cx, cy);

    if (nType == SIZE_MAXIMIZED || (nType == SIZE_RESTORED && m_bWasMaximized))
    {
        RecalcLayout ();
    }

    m_bWasMaximized = (nType == SIZE_MAXIMIZED);
}
//*************************************************************************************
void CBCGPFrameWnd::OnSizing(UINT fwSide, LPRECT pRect)
{
    CFrameWnd::OnSizing(fwSide, pRect);

    AdjustDockingLayout ();
}
Beispiel #11
0
void CBCGPReBar::OnHeightChange(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
	AdjustDockingLayout ();
	*pResult = 0;
}