📄 bcgpoledocipframewnd.cpp
字号:
break;
case WA_INACTIVE:
m_Impl.DeactivateMenu ();
break;
}
if (nState == WA_INACTIVE)
{
if (CBCGPPopupMenu::GetActiveMenu () != NULL)
{
CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE);
}
if (g_pTopLevelFrame == this)
{
CFrameWnd* pTopLevelFrame = DYNAMIC_DOWNCAST (CFrameWnd,
CWnd::FromHandlePermanent (m_hwndLastTopLevelFrame));
BCGCBProSetTopLevelFrame (pTopLevelFrame);
}
}
else
{
m_hwndLastTopLevelFrame = g_pTopLevelFrame->GetSafeHwnd ();
g_pTopLevelFrame = this;
}
}
//***************************************************************************************
void CBCGPOleDocIPFrameWnd::OnClose()
{
m_Impl.OnCloseFrame();
COleDocIPFrameWnd::OnClose();
}
//***************************************************************************************
void CBCGPOleDocIPFrameWnd::OnDestroy()
{
if (CBCGPPopupMenu::GetActiveMenu () != NULL)
{
CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE);
}
if (g_pTopLevelFrame == this)
{
CFrameWnd* pTopLevelFrame = DYNAMIC_DOWNCAST (CFrameWnd,
CWnd::FromHandlePermanent (m_hwndLastTopLevelFrame));
g_pTopLevelFrame = pTopLevelFrame;
}
m_Impl.DeactivateMenu ();
if (m_hAccelTable != NULL)
{
::DestroyAcceleratorTable (m_hAccelTable);
m_hAccelTable = NULL;
}
m_dockManager.m_bEnableAdjustLayout = FALSE;
CList<HWND, HWND> lstChildren;
CWnd* pNextWnd = GetTopWindow ();
while (pNextWnd != NULL)
{
lstChildren.AddTail (pNextWnd->m_hWnd);
pNextWnd = pNextWnd->GetNextWindow ();
}
for (POSITION pos = lstChildren.GetHeadPosition (); pos != NULL;)
{
HWND hwndNext = lstChildren.GetNext (pos);
if (IsWindow (hwndNext) && ::GetParent (hwndNext) == m_hWnd)
{
::DestroyWindow (hwndNext);
}
}
COleDocIPFrameWnd::OnDestroy();
}
//*****************************************************************************
//******************* dockmanager layer ***************************************
//*****************************************************************************
void CBCGPOleDocIPFrameWnd::AddDockBar ()
{
ASSERT_VALID (this);
}
//*****************************************************************************
BOOL CBCGPOleDocIPFrameWnd::AddControlBar (CBCGPBaseControlBar* pControlBar, BOOL bTail)
{
ASSERT_VALID (this);
return m_dockManager.AddControlBar (pControlBar, bTail);
}
//*****************************************************************************
BOOL CBCGPOleDocIPFrameWnd::InsertControlBar (CBCGPBaseControlBar* pControlBar,
CBCGPBaseControlBar* pTarget, BOOL bAfter)
{
ASSERT_VALID (this);
return m_dockManager.InsertControlBar (pControlBar, pTarget, bAfter);
}
//*****************************************************************************
void CBCGPOleDocIPFrameWnd::RemoveControlBarFromDockManager (CBCGPBaseControlBar* pControlBar,
BOOL bDestroy, BOOL bAdjustLayout,
BOOL bAutoHide)
{
ASSERT_VALID (this);
m_dockManager.RemoveControlBarFromDockManager (pControlBar, bDestroy, bAdjustLayout, bAutoHide);
}
//*****************************************************************************
void CBCGPOleDocIPFrameWnd::DockControlBar (CBCGPBaseControlBar* pBar, UINT nDockBarID,
LPCRECT lpRect)
{
ASSERT_VALID (this);
m_dockManager.DockControlBar (pBar, nDockBarID, lpRect);
}
//*****************************************************************************
CBCGPBaseControlBar* CBCGPOleDocIPFrameWnd::ControlBarFromPoint (CPoint point,
int nSensitivity, bool bExactBar,
CRuntimeClass* pRTCBarType) const
{
ASSERT_VALID (this);
return m_dockManager.ControlBarFromPoint (point, nSensitivity, bExactBar,
pRTCBarType);
}
//*****************************************************************************
CBCGPBaseControlBar* CBCGPOleDocIPFrameWnd::ControlBarFromPoint (CPoint point,
int nSensitivity, DWORD& dwAlignment,
CRuntimeClass* pRTCBarType) const
{
ASSERT_VALID (this);
return m_dockManager.ControlBarFromPoint (point, nSensitivity, dwAlignment,
pRTCBarType);
}
//*****************************************************************************
BOOL CBCGPOleDocIPFrameWnd::IsPointNearDockBar (CPoint point, DWORD& dwBarAlignment,
BOOL& bOuterEdge) const
{
ASSERT_VALID (this);
return m_dockManager.IsPointNearDockBar (point, dwBarAlignment, bOuterEdge);
}
//*****************************************************************************
void CBCGPOleDocIPFrameWnd::AdjustDockingLayout (HDWP hdwp)
{
ASSERT_VALID (this);
CWnd* pChildWnd = GetWindow (GW_CHILD);
while (pChildWnd != NULL)
{
ASSERT_VALID (pChildWnd);
if (!pChildWnd->IsKindOf (RUNTIME_CLASS (CBCGPBaseControlBar)))
{
break;
}
pChildWnd = GetWindow (GW_HWNDNEXT);
}
m_dockManager.AdjustDockingLayout (hdwp);
}
//*****************************************************************************
BOOL CBCGPOleDocIPFrameWnd::OnMoveMiniFrame (CWnd* pFrame)
{
ASSERT_VALID (this);
return m_dockManager.OnMoveMiniFrame (pFrame);
}
//****************************************************************************************
BOOL CBCGPOleDocIPFrameWnd::EnableDocking (DWORD dwDockStyle)
{
return m_dockManager.EnableDocking (dwDockStyle);
}
//****************************************************************************************
BOOL CBCGPOleDocIPFrameWnd::EnableAutoHideBars (DWORD dwDockStyle)
{
return m_dockManager.EnableAutoHideBars (dwDockStyle);
}
//****************************************************************************************
BOOL CBCGPOleDocIPFrameWnd::PreCreateWindow(CREATESTRUCT& cs)
{
m_Impl.SetDockManager (&m_dockManager);
return COleIPFrameWnd::PreCreateWindow(cs);
}
//****************************************************************************************
CBCGPBaseControlBar* CBCGPOleDocIPFrameWnd::GetControlBar (UINT nID)
{
ASSERT_VALID (this);
CBCGPBaseControlBar* pBar = m_dockManager.FindBarByID (nID, TRUE);
return pBar;
}
//****************************************************************************************
void CBCGPOleDocIPFrameWnd::ShowControlBar (CBCGPBaseControlBar* pBar, BOOL bShow, BOOL bDelay, BOOL bActivate)
{
ASSERT_VALID (this);
ASSERT_VALID (pBar);
pBar->ShowControlBar (bShow, bDelay, bActivate);
}
//*************************************************************************************
void CBCGPOleDocIPFrameWnd::OnUpdateControlBarMenu(CCmdUI* pCmdUI)
{
CBCGPBaseControlBar* pBar = GetControlBar(pCmdUI->m_nID);
if (pBar != NULL)
{
pCmdUI->SetCheck((pBar->GetStyle() & WS_VISIBLE) != 0);
return;
}
pCmdUI->ContinueRouting();
}
//*************************************************************************************
BOOL CBCGPOleDocIPFrameWnd::OnBarCheck(UINT nID)
{
ASSERT_VALID (this);
CBCGPBaseControlBar* pBar = GetControlBar(nID);
if (pBar != NULL)
{
ShowControlBar(pBar, (pBar->GetStyle() & WS_VISIBLE) == 0, FALSE, FALSE);
return TRUE;
}
return FALSE;
}
//*************************************************************************************
BOOL CBCGPOleDocIPFrameWnd::DockControlBarLeftOf (CBCGPControlBar* pBar, CBCGPControlBar* pLeftOf)
{
return m_dockManager.DockControlBarLeftOf (pBar, pLeftOf);
}
//*************************************************************************************
void CBCGPOleDocIPFrameWnd::OnSetPreviewMode(BOOL bPreview, CPrintPreviewState* pState)
{
ASSERT_VALID (this);
m_dockManager.SetPrintPreviewMode (bPreview, pState);
DWORD dwSavedState = pState->dwStates;
COleIPFrameWnd::OnSetPreviewMode(bPreview, pState);
pState->dwStates = dwSavedState;
RecalcLayout ();
}
//*************************************************************************************
void CBCGPOleDocIPFrameWnd::RecalcLayout (BOOL bNotify)
{
COleDocIPFrameWnd::RecalcLayout (bNotify);
if (m_bInRecalcLayout)
return;
m_bInRecalcLayout = TRUE;
m_dockManager.RecalcLayout (bNotify);
CView* pView = GetActiveView ();
if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView)) &&
m_dockManager.IsPrintPreviewValid ())
{
CRect rectClient = m_dockManager.GetClientAreaBounds ();
pView->SetWindowPos (NULL, rectClient.left, rectClient.top,
rectClient.Width (), rectClient.Height (),
SWP_NOZORDER | SWP_NOACTIVATE);
}
m_bInRecalcLayout = FALSE;
}
//********************************************************************************
LRESULT CBCGPOleDocIPFrameWnd::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM)
{
COleDocIPFrameWnd::OnIdleUpdateCmdUI();
m_dockManager.SendMessageToMiniFrames (WM_IDLEUPDATECMDUI);
CBCGPOleCntrFrameWnd* pFrame = DYNAMIC_DOWNCAST (CBCGPOleCntrFrameWnd, m_pMainFrame);
if (pFrame!= NULL)
{
pFrame->OnIdleUpdateCmdUI();
}
return 0L;
}
//********************************************************************************
BOOL CBCGPOleDocIPFrameWnd::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc)
{
// Remove this if you use pWndDoc
UNREFERENCED_PARAMETER(pWndDoc);
CBCGPOleCntrFrameWnd* pNewFrame = DYNAMIC_DOWNCAST (CBCGPOleCntrFrameWnd,
pWndFrame);
if (pNewFrame == NULL)
{
ASSERT (m_pMainFrame == pWndFrame);
pNewFrame = new CBCGPOleCntrFrameWnd (this);
ASSERT_VALID (pNewFrame);
HWND hwndFrame = m_pMainFrame->Detach ();
delete m_pMainFrame;
m_pMainFrame = pNewFrame;
m_pMainFrame->Attach (hwndFrame);
pNewFrame->CreateDockManager ();
}
return TRUE;
}
//********************************************************************************
BOOL CBCGPOleDocIPFrameWnd::OnShowControlBars (BOOL bShow)
{
ASSERT_VALID (this);
BOOL bResult = m_dockManager.ShowControlBars (bShow);
AdjustDockingLayout ();
return bResult;
}
CBCGPOleCntrFrameWnd* CBCGPOleDocIPFrameWnd::GetContainerFrameWindow()
{
CBCGPOleCntrFrameWnd* pNewFrame = DYNAMIC_DOWNCAST (CBCGPOleCntrFrameWnd, m_pMainFrame);
ASSERT_VALID (pNewFrame);
return pNewFrame;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -