OAMMINIDOCKFRAMEWND.CPP
上传用户:lvjun8202
上传日期:2013-04-30
资源大小:797k
文件大小:3k
- // OAMMiniDockFrameWnd.cpp : implementation file
- //
- #include "stdafx.h"
- #include "OAMMiniDockFrameWnd.h"
- #include "OAMDockContext.h"
- #include "OAMSizeDockBar.h"
- #include "OAMControlBar.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // COAMMiniDockFrameWnd
- COAMMiniDockFrameWnd::COAMMiniDockFrameWnd()
- {
- // TODO: add construction code here.
- }
- COAMMiniDockFrameWnd::~COAMMiniDockFrameWnd()
- {
- // TODO: add destruction code here.
- }
- IMPLEMENT_DYNCREATE(COAMMiniDockFrameWnd, CMiniDockFrameWnd)
- BEGIN_MESSAGE_MAP(COAMMiniDockFrameWnd, CMiniDockFrameWnd)
- //{{AFX_MSG_MAP(COAMMiniDockFrameWnd)
- ON_WM_NCLBUTTONDOWN()
- ON_WM_NCLBUTTONDBLCLK()
- ON_WM_ERASEBKGND()
- ON_WM_MBUTTONDBLCLK()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // COAMMiniDockFrameWnd message handlers
- void COAMMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
- {
- COAMSizeDockBar *pSizeBar = (COAMSizeDockBar*)&m_wndDockBar;
-
- if (nHitTest == HTCAPTION)
- {
- ActivateTopParent();
- if ((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0)
- {
- int nPos = 1;
- CControlBar* pBar = NULL;
- while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
- pBar = pSizeBar->GetDockedSizeBar(nPos++);
- // ASSERT(pBar != NULL);
- // ASSERT_KINDOF(CControlBar, pBar);
- // ASSERT(pBar->m_pDockContext != NULL);
-
- if (!pBar->IsKindOf(RUNTIME_CLASS(COAMControlBar))) {
- CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
- return;
- }
- ((COAMDockContext *)pBar->m_pDockContext)->StartDragDockBar(point);
- return;
- }
- }
- else if (nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST)
- {
- ActivateTopParent();
- int nPos = 1;
- CControlBar* pBar = NULL;
- while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
- pBar = pSizeBar->GetDockedSizeBar(nPos++);
-
- // ASSERT(pBar != NULL);
- ASSERT_KINDOF(CControlBar, pBar);
- // ASSERT(pBar->m_pDockContext != NULL);
- // ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0);
-
- if (!pBar->IsKindOf(RUNTIME_CLASS(COAMControlBar))) {
- CMiniDockFrameWnd::OnNcLButtonDown(nHitTest,point);
- return;
- }
- pBar->m_pDockContext->StartResize(nHitTest, point);
- return;
- }
- CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
- }
- void COAMMiniDockFrameWnd::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
- {
- if (nHitTest == HTCAPTION)
- {
- ActivateTopParent();
- COAMSizeDockBar * m_pSizeBar = (COAMSizeDockBar *)&m_wndDockBar;
-
- if ((m_pSizeBar->m_dwStyle & CBRS_FLOAT_MULTI) == 0)
- {
- int nPos = 1;
- CControlBar* pBar = NULL;
- while(pBar == NULL && nPos < m_pSizeBar->m_arrBars.GetSize())
- pBar = m_pSizeBar->GetDockedSizeBar(nPos++);
-
- // ASSERT(pBar != NULL);
- ASSERT_KINDOF(CControlBar, pBar);
- // ASSERT(pBar->m_pDockContext != NULL);
- if (pBar->IsKindOf(RUNTIME_CLASS(COAMControlBar)))
- pBar->m_pDockContext->ToggleDocking();
-
- return;
- }
- }
- }