Exemplo n.º 1
0
void CExtMiniDockFrameWnd::_AnalyzeButtonsHover(CPoint point)
{
CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		pExtBar->NcButtons_HitTest( point );
		return;
	}
CRect rcClient, rcBar;
	GetClientRect( &rcClient );
	ClientToScreen( &rcClient );
	GetWindowRect( &rcBar );
	rcClient.OffsetRect( -rcBar.TopLeft() );
	rcBar.OffsetRect (-rcBar.TopLeft() );
	ScreenToClient( &point );
	point.y -= rcBar.top - rcClient.top;
bool bBtnHideBarHover = false;
	if( m_rcBtnHideBar.PtInRect(point) )
		bBtnHideBarHover = true;
	if(	m_bBtnHideBar != bBtnHideBarHover )
	{
		m_bBtnHideBar = bBtnHideBarHover;
		SendMessage( WM_NCPAINT );
	}
	if( m_bBtnHideBar || bBtnHideBarHover )
		SetTimer(2,20,NULL);
	else
		KillTimer(2);
}
Exemplo n.º 2
0
UINT CExtMiniDockFrameWnd::OnNcHitTest(CPoint point) 
{
UINT nHit = CMiniDockFrameWnd::OnNcHitTest(point);
CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		UINT nHT = pExtBar->NcButtons_HitTest( point );
		if( nHT != HTCLIENT )
		{
			pExtBar->m_bNcAreaBtnTracking = true;
			return nHT;
		}
		ASSERT_VALID( pExtBar );
		if( pExtBar->m_bFixedMode )
		{
			switch( nHit )
			{
			case HTTOPLEFT:
			case HTTOPRIGHT:
				nHit = HTTOP;
			break;
			case HTBOTTOMLEFT:
			case HTBOTTOMRIGHT:
				nHit = HTBOTTOM;
			break;
			} // switch( nHit )
		} // if( pExtBar->m_bFixedMode )
	} // if( pExtBar != NULL )
	return nHit;
}
Exemplo n.º 3
0
void CExtMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy) 
{
//	if( _ResizingIsInProgress() )
//		return;

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


DWORD dwStyle = GetStyle();
CSize sizeFrame =
		(dwStyle & WS_THICKFRAME)
			?	CSize(
					GetSystemMetrics(SM_CXSIZEFRAME),
					GetSystemMetrics(SM_CYSIZEFRAME)
					)
			:	CSize(
					GetSystemMetrics(SM_CXFIXEDFRAME),
					GetSystemMetrics(SM_CYFIXEDFRAME)
		);
CRect rcFrameCaption;
	GetWindowRect( &rcFrameCaption );
	rcFrameCaption -= rcFrameCaption.TopLeft();
	rcFrameCaption.left  += sizeFrame.cx;
	rcFrameCaption.right -= sizeFrame.cx;
	rcFrameCaption.top   += sizeFrame.cy;
	rcFrameCaption.bottom =
		rcFrameCaption.top
		+ ::GetSystemMetrics(SM_CYSMCAPTION)
		- ::GetSystemMetrics(SM_CYSMSIZE);
	rcFrameCaption.bottom =
		rcFrameCaption.top
		+ ::GetSystemMetrics(SM_CYSMSIZE);
	m_rcFrameCaption = rcFrameCaption;

int nDummyMetric = ::GetSystemMetrics(SM_CXSMSIZE) - 1;
int nRight =
		m_rcFrameCaption.right - nDummyMetric - 1;
	m_rcBtnHideBar.SetRect(
		nRight,
		m_rcFrameCaption.top + 2,
		nRight + nDummyMetric - 2,
		m_rcFrameCaption.bottom - 2
		);

CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		pExtBar->OnNcAreaButtonsReinitialize();
		pExtBar->OnNcAreaButtonsReposition();
	} // if( pExtBar != NULL )

	RedrawWindow(
		NULL,
		NULL,
		RDW_FRAME|RDW_INVALIDATE|RDW_ERASE
			|RDW_UPDATENOW|RDW_ALLCHILDREN
		);
}
Exemplo n.º 4
0
void CExtMiniDockFrameWnd::_ResizingEnd()
{
	m_ptLastResizing.x = m_ptLastResizing.y = -1;
	//ASSERT( m_nResizingMode != HTNOWHERE );
	if( m_nResizingMode == HTNOWHERE )
		return;
	if( CExtMouseCaptureSink::GetCapture() == GetSafeHwnd() )
		CExtMouseCaptureSink::ReleaseCapture();
CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );
	if( !pExtBar->IsFixedMode() )
		ModifyStyle( 0, __REMOVED_NONFIXMODE_STYLES );
	m_nResizingMode = HTNOWHERE;
}
Exemplo n.º 5
0
void CExtMiniDockFrameWnd::OnNcLButtonUp(UINT nHitTest, CPoint point)
{
	if( _ResizingIsInProgress() )
	{
		_ResizingEnd();
		return;
	}
	
	if( CExtControlBar::_DraggingGetBar() != NULL )
		return;

CRect rcBarWnd;
	GetWindowRect( &rcBarWnd );
CPoint ptDevOffset = -rcBarWnd.TopLeft();
CPoint ptWnd( point + ptDevOffset );

CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL && pExtBar->m_bNcAreaBtnTracking )
	{
		INT nCountOfNcButtons = pExtBar->NcButtons_GetCount();
		for( INT nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
		{
			CExtBarNcAreaButton * pBtn =
				pExtBar->NcButtons_GetAt( nBtn );
			if( !pBtn->OnQueryVisibility() )
				continue;
			if( pBtn->OnNcAreaClicked( ptWnd ) )
				return;
		} // for( INT nBtn = 0; nBtn < nCountOfNcButtons; nBtn++ )
		return;
	} // if( pExtBar != NULL && pExtBar->m_bNcAreaBtnTracking )

	if( m_rcBtnHideBar.PtInRect( ptWnd ) )
	{
		CControlBar * pBar =
			GetControlBar();
		if( pBar == NULL )
			return;
		ASSERT_VALID( pBar );
		GetParentFrame()->
			ShowControlBar(
				pBar,
				FALSE,
				FALSE
				);
		return;
	}

	CMiniDockFrameWnd::OnNcLButtonUp(nHitTest, point);
}
Exemplo n.º 6
0
int CMainFrame::DoCloseWnd(CExtControlBar &Box)//заданное ќкно, которое требуетс¤ закрыть
{
	CWnd *pWnd=GetFocus();
	if(pWnd)
	{
		CWnd *pParent=pWnd->GetParent();
		if(pParent==&Box)//если текущее окно - заданное ќкно, то не закрываем
		{
			CMDIChildWnd* pView=MDIGetActive();
			if(pView)
			{
				MDIActivate(pView);
				pView->SetFocus();
				return 0;
			}
		}
		//иначе, если открыто заданное ќкно - закрываем
		if(Box.IsVisible())
		{
			ShowControlBar(&Box,0,1);	
			return 1;
		}
	}
	return -1;
}
Exemplo n.º 7
0
void CExtMiniDockFrameWnd::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) 
{
	CMiniDockFrameWnd::OnWindowPosChanged(lpwndpos);
	if(		_ResizingIsInProgress()
		||	g_bOnWndPosChgProcessing
		||	(lpwndpos->flags & SWP_NOMOVE) != 0
		)
		return;
CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar == NULL || !pExtBar->IsFloating() )
		return;
CRect rcWnd;
	GetWindowRect( &rcWnd );

int nSmallCaptionDY = ::GetSystemMetrics( SM_CYSMCAPTION );
CExtPaintManager::monitor_parms_t _mp;
	CExtPaintManager::stat_GetMonitorParms( _mp, this );
	ASSERT( !g_bOnWndPosChgProcessing );
	if( rcWnd.top < _mp.m_rcWorkArea.top )
	{
		rcWnd.top = _mp.m_rcWorkArea.top;
		g_bOnWndPosChgProcessing = true;
	}
	else if( rcWnd.top + nSmallCaptionDY > _mp.m_rcWorkArea.bottom )
	{
		rcWnd.top =
			max(
			_mp.m_rcWorkArea.top, 
			_mp.m_rcWorkArea.bottom
				- nSmallCaptionDY
			);
		g_bOnWndPosChgProcessing = true;
	}
	if( !g_bOnWndPosChgProcessing )
		return;
	SetWindowPos(
		NULL,
		rcWnd.left, rcWnd.top, -1, -1,
		SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE
		);

	pExtBar->OnNcAreaButtonsReposition();
	PostMessage( WM_NCPAINT );
	CExtPaintManager::stat_PassPaintMessages();
	g_bOnWndPosChgProcessing = false;
}
Exemplo n.º 8
0
BOOL CExtMiniDockFrameWnd::OnNcActivate(BOOL bActive) 
{
BOOL rc = CMiniDockFrameWnd::OnNcActivate(bActive);
	SendMessage( WM_NCPAINT );
	if( bActive )
	{
		CExtControlBar * pExtBar =
			GetControlBarExt();
		if( pExtBar != NULL )
			pExtBar->RedrawWindow(
				NULL,
				NULL,
				RDW_INVALIDATE|RDW_UPDATENOW
					|RDW_ERASE|RDW_ALLCHILDREN
				);
	} // if( bActive )
	return rc;
}
Exemplo n.º 9
0
void CExtMiniDockFrameWnd::OnNcRButtonDown(UINT nHitTest, CPoint point)
{
	if( _ResizingIsInProgress() )
	{
		_ResizingEnd();
		return;
	}
	if( nHitTest == HTCAPTION )
	{
		CExtControlBar * pExtBar =
			GetControlBarExt();
		if( pExtBar != NULL )
		{
			pExtBar->_ContextMenuTrack();
			return;
		} // if( pExtBar != NULL )
	} // if( nHitTest == HTCAPTION )
	CMiniDockFrameWnd::OnNcRButtonDown(nHitTest,point);
}
Exemplo n.º 10
0
bool CExtMiniDockFrameWnd::_GetSingleVisibleCaptionText( CExtSafeString & sCaption )
{
	sCaption = _T("");
CFrameWnd * pDockSite = GetParentFrame();
	if( pDockSite == NULL )
		return false;
	ASSERT( !pDockSite->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)) );
POSITION pos = pDockSite->m_listControlBars.GetHeadPosition();
	for( ; pos != NULL; )
	{
		CExtControlBar * pBar =
			DYNAMIC_DOWNCAST(
				CExtControlBar,
				((CControlBar *)(pDockSite->m_listControlBars.GetNext(pos)))
				);
		if(		pBar == NULL
			||	pBar->m_pDockSite == NULL
			||	pBar->IsFixedMode()
			||	(	pBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
					&& !pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar))
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
				)
			||	pBar->GetParentFrame() != this
			||	pBar->IsFloating()
			||	!pBar->IsVisible()
			)
			continue;
		ASSERT( pBar->m_pDockBar != NULL );
		if(
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
			pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar))
			||
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
			!pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar))
			)
			continue;
		if( ! pBar->_IsSingleVisibleInFloatingPalette() )
			return false;
		pBar->OnGetBarCaptionText(
			CExtControlBar::__EBCT_SINGLE_CAPTION_FLOATING,
			sCaption
			);
		return sCaption.IsEmpty() ? false : true;
	}
	return false;
}
Exemplo n.º 11
0
void CExtMiniDockFrameWnd::OnNcLButtonDblClk(UINT nHitTest, CPoint point) 
{
	if( nHitTest == HTCAPTION )
	{
		CRect rcWnd;
		GetWindowRect( &rcWnd );
		CPoint ptTestBtnHideBar( point - rcWnd.TopLeft() );
		if( m_rcBtnHideBar.PtInRect(ptTestBtnHideBar) )
			return;
	} // if( nHitTest == HTCAPTION )

CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		ASSERT_VALID( pExtBar );
		pExtBar->ToggleDocking();
		return;
	}

	CMiniDockFrameWnd::OnNcLButtonDblClk(nHitTest, point);
}
Exemplo n.º 12
0
void CExtMiniDockFrameWnd::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) 
{
	CMiniDockFrameWnd::OnWindowPosChanged(lpwndpos);
	if(		_ResizingIsInProgress()
		||	g_bOnWndPosChgProcessing
		||	(lpwndpos->flags & SWP_NOMOVE) != 0
		)
		return;
CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar == NULL || !pExtBar->IsFloating() )
		return;
CRect rcWnd;
	GetWindowRect( &rcWnd );
CRect rcDesktop;
	::SystemParametersInfo( SPI_GETWORKAREA, 0, &rcDesktop, 0 );
	ASSERT( !g_bOnWndPosChgProcessing );
	if( rcWnd.top < rcDesktop.top )
	{
		rcWnd.top = rcDesktop.top;
		g_bOnWndPosChgProcessing = true;
	}
	else if( rcWnd.top + ::GetSystemMetrics(SM_CYSMCAPTION) > rcDesktop.bottom )
	{
		rcWnd.top =
			max(
			rcDesktop.top, 
			rcDesktop.bottom
				- ::GetSystemMetrics(SM_CYSMCAPTION)
			);
		g_bOnWndPosChgProcessing = true;
	}
	if( !g_bOnWndPosChgProcessing )
		return;
	SetWindowPos(
		NULL,
		rcWnd.left, rcWnd.top, -1, -1,
		SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE
		);
	g_bOnWndPosChgProcessing = false;
}
Exemplo n.º 13
0
void CExtMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy) 
{
//	if( _ResizingIsInProgress() )
//		return;

	ASSERT( cx >= 0 && cy >= 0 );
CExtPaintManager::monitor_parms_t _mp;
	CExtPaintManager::stat_GetMonitorParms( _mp, this );
	if(		cx > _mp.m_rcWorkArea.Width()
		||	cy > _mp.m_rcWorkArea.Height()
		)
	{
		CRect rcWnd;
		GetWindowRect( &rcWnd );
		rcWnd.right =
			rcWnd.left
			+ ( min( cx, _mp.m_rcWorkArea.Width() ) )
			;
		rcWnd.bottom =
			rcWnd.top
			+ ( min( cy, _mp.m_rcWorkArea.Height() ) )
			;
		MoveWindow( &rcWnd );
		return;
	}

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


int nWinResizingFrameDX = ::GetSystemMetrics( SM_CXSIZEFRAME );
int nWinResizingFrameDY = ::GetSystemMetrics( SM_CYSIZEFRAME );
int nSmallCaptionDY = ::GetSystemMetrics( SM_CYSMCAPTION );
CRect rcFrameCaption;
	GetWindowRect( &rcFrameCaption );
	rcFrameCaption -= rcFrameCaption.TopLeft();
	rcFrameCaption.left  += nWinResizingFrameDX;
	rcFrameCaption.right -= nWinResizingFrameDX;
	rcFrameCaption.top   += nWinResizingFrameDY;
	rcFrameCaption.bottom =
		rcFrameCaption.top
		+ nSmallCaptionDY
		- ::GetSystemMetrics( SM_CYSMSIZE );
	rcFrameCaption.bottom =
		rcFrameCaption.top
		+ ::GetSystemMetrics( SM_CYSMSIZE );
	m_rcFrameCaption = rcFrameCaption;

int nDummyMetric = ::GetSystemMetrics( SM_CXSMSIZE ) - 1;
int nRight =
		m_rcFrameCaption.right - nDummyMetric - 1;
	m_rcBtnHideBar.SetRect(
		nRight,
		m_rcFrameCaption.top + 2,
		nRight + nDummyMetric - 2,
		m_rcFrameCaption.bottom - 2
		);

CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		pExtBar->OnNcAreaButtonsReinitialize();
		pExtBar->OnNcAreaButtonsReposition();
	} // if( pExtBar != NULL )

	if( !_ResizingIsInProgress() )
		RedrawWindow(
			NULL,
			NULL,
			RDW_FRAME|RDW_INVALIDATE|RDW_ERASE
				|RDW_UPDATENOW|RDW_ALLCHILDREN
			);
	CExtPaintManager::stat_PassPaintMessages();
}
Exemplo n.º 14
0
UINT CExtMiniDockFrameWnd::OnNcHitTest(CPoint point) 
{
	if( GetStyle() & MFS_MOVEFRAME )
		ModifyStyle( MFS_MOVEFRAME, 0 );
//UINT nHit = CMiniDockFrameWnd::OnNcHitTest(point);
CRect rcBar;
	GetWindowRect( &rcBar );
	if( !rcBar.PtInRect( point ) )
		return HTNOWHERE;
UINT nHit = HTCLIENT;
int nWinResizingFrameDX = ::GetSystemMetrics( SM_CXSIZEFRAME );
int nWinResizingFrameDY = ::GetSystemMetrics( SM_CYSIZEFRAME );
int nSmallCaptionDY = ::GetSystemMetrics( SM_CYSMCAPTION );
CRect rcTest(
		rcBar.left,
		rcBar.top,
		rcBar.right,
		rcBar.top + nWinResizingFrameDY
		);
	if( rcTest.PtInRect( point ) )
		nHit = HTTOP;
	else
	{
		rcTest.SetRect(
			rcBar.left,
			rcBar.bottom - nWinResizingFrameDY,
			rcBar.right,
			rcBar.bottom
			);
		if( rcTest.PtInRect( point ) )
			nHit = HTBOTTOM;
		else
		{
			rcTest.SetRect(
				rcBar.left,
				rcBar.top,
				rcBar.left + nWinResizingFrameDX,
				rcBar.bottom
				);
			if( rcTest.PtInRect( point ) )
				nHit = HTLEFT;
			else
			{
				rcTest.SetRect(
					rcBar.right - nWinResizingFrameDX,
					rcBar.top,
					rcBar.right,
					rcBar.bottom
					);
				if( rcTest.PtInRect( point ) )
					nHit = HTRIGHT;
				else
				{
					rcTest.SetRect(
						rcBar.left,
						rcBar.top + nWinResizingFrameDY,
						rcBar.right,
						rcBar.top + nWinResizingFrameDY + nSmallCaptionDY
						);
					if( rcTest.PtInRect( point ) )
						nHit = HTCAPTION;
				}
			}
		}
	}
	switch( nHit )
	{
	case HTTOP:
	{
		rcTest.SetRect(
			rcBar.left,
			rcBar.top,
			rcBar.left + nSmallCaptionDY,
			rcBar.top + nWinResizingFrameDY
			);
		if( rcTest.PtInRect(point) )
			nHit = HTTOPLEFT;
		else
		{
			rcTest.SetRect(
				rcBar.right - nWinResizingFrameDY,
				rcBar.top,
				rcBar.right,
				rcBar.top + nWinResizingFrameDY
				);
			if( rcTest.PtInRect(point) )
				nHit = HTTOPRIGHT;
		}
	}
	break;
	case HTBOTTOM:
	{
		rcTest.SetRect(
			rcBar.left,
			rcBar.bottom - nWinResizingFrameDY,
			rcBar.left + nSmallCaptionDY,
			rcBar.bottom
			);
		if( rcTest.PtInRect(point) )
			nHit = HTBOTTOMLEFT;
		else
		{
			rcTest.SetRect(
				rcBar.right - nWinResizingFrameDY,
				rcBar.bottom - nWinResizingFrameDY,
				rcBar.right,
				rcBar.bottom
				);
			if( rcTest.PtInRect(point) )
				nHit = HTBOTTOMRIGHT;
		}
	}
	break;
	case HTLEFT:
	{
		rcTest.SetRect(
			rcBar.left,
			rcBar.top,
			rcBar.left + nWinResizingFrameDX,
			rcBar.top + nSmallCaptionDY
			);
		if( rcTest.PtInRect(point) )
			nHit = HTTOPLEFT;
		else
		{
			rcTest.SetRect(
				rcBar.left,
				rcBar.bottom - nSmallCaptionDY,
				rcBar.left + nWinResizingFrameDX,
				rcBar.bottom
				);
			if( rcTest.PtInRect(point) )
				nHit = HTBOTTOMLEFT;
		}
	}
	break;
	case HTRIGHT:
	{
		rcTest.SetRect(
			rcBar.right - nWinResizingFrameDX,
			rcBar.top,
			rcBar.right,
			rcBar.top + nSmallCaptionDY
			);
		if( rcTest.PtInRect(point) )
			nHit = HTTOPRIGHT;
		else
		{
			rcTest.SetRect(
				rcBar.right - nWinResizingFrameDX,
				rcBar.bottom - nSmallCaptionDY,
				rcBar.right,
				rcBar.bottom
				);
			if( rcTest.PtInRect(point) )
				nHit = HTBOTTOMRIGHT;
		}
	}
	break;
	} // switch( nHit )

bool bNcRepaint = false;
CExtControlBar * pExtBar = GetControlBarExt();
	if( pExtBar != NULL )
	{
		ASSERT_VALID( pExtBar );
		UINT nHT = pExtBar->NcButtons_HitTest( point );
		if( nHT != HTCLIENT )
		{
			pExtBar->m_bNcAreaBtnTracking = true;
			if( pExtBar->_IsDockSiteCustomizeMode() )
				SetTimer( 4, 20, NULL );
			return nHT;
		}
		else
		{
			bNcRepaint = true;
			pExtBar->m_bNcAreaBtnTracking = false;
		}
		if( pExtBar->IsFixedMode() )
		{
			bool bPaletteMode = false;
			CExtToolControlBar * pToolBar =
				DYNAMIC_DOWNCAST(
					CExtToolControlBar,
					pExtBar
					);
			if( pToolBar != NULL )
			{
				ASSERT_VALID( pToolBar );
				bPaletteMode = pToolBar->m_bPaletteMode;
			} // if( pToolBar != NULL )
			switch( nHit )
			{
			case HTTOP:
			case HTBOTTOM:
			case HTLEFT:
			case HTRIGHT:
				if( bPaletteMode )
					nHit = HTCAPTION;
			break;
			case HTTOPLEFT:
			case HTTOPRIGHT:
				nHit = bPaletteMode ? HTCAPTION : HTTOP;
			break;
			case HTBOTTOMLEFT:
			case HTBOTTOMRIGHT:
				nHit = bPaletteMode ? HTCAPTION : HTBOTTOM;
			break;
			} // switch( nHit )
		} // if( pExtBar->IsFixedMode() )
	} // if( pExtBar != NULL )
	if( bNcRepaint )
		SendMessage( WM_NCPAINT );
	return nHit;
}
Exemplo n.º 15
0
void CExtMiniDockFrameWnd::OnTimer( UINT nIDEvent )
{
CExtControlBar * pExtBar = GetControlBarExt();
	if( nIDEvent == 1 )
	{
		if( pExtBar == NULL )
			return;
		KillTimer( 1 );
		pExtBar->OnNcAreaButtonsReposition();
//		SetWindowPos(
//			NULL,
//			0, 0, 0, 0,
//			SWP_NOREDRAW|SWP_NOSIZE
//				|SWP_NOMOVE|SWP_NOACTIVATE
//				|SWP_NOZORDER|SWP_NOOWNERZORDER 
//				|SWP_FRAMECHANGED
//			);
		return;
	}
	if( nIDEvent == 2 )
	{
		_AnalyzeButtonsHover();
		return;
	}
	if( nIDEvent == 3 )
	{
		if(		pExtBar == NULL
			//|| _ResizingIsInProgress()
			)
			return;
		KillTimer( 3 );
		RecalcLayout();
		pExtBar->OnNcAreaButtonsReposition();
		SendMessage( WM_NCPAINT );
		return;
	}
	if( nIDEvent == 4 )
	{
		if( pExtBar != NULL )
		{
			ASSERT_VALID( pExtBar );
			CPoint point;
			if( ! ::GetCursorPos(&point) )
				return;
			UINT nHT = pExtBar->NcButtons_HitTest( point );
			if( nHT == HTCLIENT )
			{
				PostMessage( WM_NCPAINT );
				pExtBar->m_bNcAreaBtnTracking = false;
			}
		}
		if( !pExtBar->m_bNcAreaBtnTracking )
			KillTimer( 4 );
		return;
	}

	if( pExtBar == NULL )
		return;
	ASSERT_VALID( pExtBar );
	if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
	{
		if( _ResizingIsInProgress() )
			return;
		CPoint pt;
		if( ! ::GetCursorPos( &pt ) )
			return;
		CWnd * pTempWnd = WindowFromPoint( pt );
		int IsMouseInsideTheWindow =
			IsChild( pTempWnd ) || pTempWnd->m_hWnd == m_hWnd;

		if(	IsMouseInsideTheWindow
			|| IsChild(GetFocus())  
			|| (CExtMouseCaptureSink::GetCapture() && pExtBar->m_hWnd == CExtMouseCaptureSink::GetCapture()) 
			|| CExtPopupMenuWnd::IsMenuTracking()
			) 
		{

			if(	IsMouseInsideTheWindow 
				&& !CExtPopupMenuWnd::IsMenuTracking()
				&& IsWindowEnabled()
				&& GetFocus()
				) 
				BringWindowToTop();
		}
	} // if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
}
Exemplo n.º 16
0
void CExtMiniDockFrameWnd::_ResizingUpdateState(
	const CPoint & point
	)
{
	if(		g_bInResizingUpdateState
		||	m_ptLastResizing == point
		)
		return;
	m_ptLastResizing = point;
	g_bInResizingUpdateState = true;

CPoint _pt( point );
	ASSERT( m_nResizingMode != HTNOWHERE );
CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );

	//BringWindowToTop();
CRect rcClient, rcClientOrg, rcWnd, rcWndOrg;
	GetClientRect( &rcClient );
	GetWindowRect( &rcWnd );
	rcClientOrg = rcClient;
	rcWndOrg = rcWnd;
CSize sizeDiff =
		rcWnd.Size() - rcClient.Size();
	ASSERT( sizeDiff.cx >= 0 && sizeDiff.cy >= 0 );
CSize sizeNcDiff( sizeDiff );

int nCalcMinHW = pExtBar->_CalcDesiredMinHW();
int nCalcMinVH = pExtBar->_CalcDesiredMinVH();
	if( sizeDiff.cx < nCalcMinHW )
		sizeDiff.cx = nCalcMinHW;
	if( sizeDiff.cy < nCalcMinVH )
		sizeDiff.cy = nCalcMinVH;

UINT nHit = m_nResizingMode;
bool	bLeft = false, bTop = false, bHorz = false,
		bInvTop = false, bInvLeft = false;
CPoint ptOffsetWnd( 0, 0 );
	if( pExtBar->IsFixedMode() )
	{
		switch( nHit )
		{
		case HTTOPLEFT:
		case HTTOPRIGHT:
			nHit = HTTOP;
		break;
		case HTBOTTOMLEFT:
		case HTBOTTOMRIGHT:
			nHit = HTBOTTOM;
		break;
		} // switch( nHit )
		switch( nHit )
		{
		case HTTOP:
			_pt.y =
				rcWndOrg.bottom
				+ rcWndOrg.top - _pt.y;
			nHit = HTBOTTOM;
			bInvLeft = true;
			bInvTop = true;
		break;
		case HTLEFT:
			_pt.x =
				rcWndOrg.right
				+ rcWndOrg.left - _pt.x;
			nHit = HTRIGHT;
			bInvLeft = true;
			bInvTop = true;
		break;
		} // switch( nHit )
	} // if( pExtBar->IsFixedMode() )
	if( bInvLeft || bInvTop || (!pExtBar->IsFixedMode()) )
	{
		CRect rcWnd( rcWndOrg );
		ScreenToClient( & rcWnd );
		if( bInvLeft || (!pExtBar->IsFixedMode()) )
			ptOffsetWnd.x =
				abs( rcWnd.left - rcClientOrg.left );
		if( bInvTop || (!pExtBar->IsFixedMode()) )
			ptOffsetWnd.y =
				abs( rcWnd.top - rcClientOrg.top );
	} // if( bInvLeft || bInvTop )

	switch( nHit )
	{
	case HTLEFT:
		bHorz = true;
		rcWnd.left = min( _pt.x, rcWnd.right );
		bLeft = true;
	break;
	case HTRIGHT:
		bHorz = true;
		rcWnd.right = max( _pt.x, rcWnd.left );
	break;
	case HTTOP:
		rcWnd.top = min( _pt.y, rcWnd.bottom );
		bTop = true;
	break;
	case HTTOPLEFT:
		rcWnd.left = min( _pt.x, rcWnd.right );
		rcWnd.top = min( _pt.y, rcWnd.bottom );
		bLeft = true;
		bTop = true;
	break;
	case HTTOPRIGHT:
		rcWnd.right = max( _pt.x, rcWnd.left );
		rcWnd.top = min( _pt.y, rcWnd.bottom );
		bTop = true;
	break;
	case HTBOTTOM:
		rcWnd.bottom = max( _pt.y, rcWnd.top );
	break;
	case HTBOTTOMLEFT:
		rcWnd.left = min( _pt.x, rcWnd.right );
		rcWnd.bottom = max( _pt.y, rcWnd.top );
		bLeft = true;
	break;
	case HTBOTTOMRIGHT:
		rcWnd.right = max( _pt.x, rcWnd.left );
		rcWnd.bottom = max( _pt.y, rcWnd.top );
	break;
	default:
		ASSERT( FALSE );
		g_bInResizingUpdateState = false;
		return;
	} // switch( nHit )

	if( rcWnd.Width() < sizeDiff.cx )
		rcWnd.right = rcWnd.left + sizeDiff.cx;
	if( rcWnd.Height() < sizeDiff.cy )
		rcWnd.bottom = rcWnd.top + sizeDiff.cy;
	if( rcWnd.right > rcWndOrg.right
		&& bLeft
		)
		rcWnd.OffsetRect(
			rcWndOrg.right - rcWnd.right,
			0
			);
	if( rcWnd.bottom > rcWndOrg.bottom
		&& bTop
		)
		rcWnd.OffsetRect(
			0,
			rcWndOrg.bottom - rcWnd.bottom
			);
	rcClient.SetRect(
		rcWnd.left - (rcClient.left-rcWndOrg.left),
		rcWnd.top - (rcClient.top-rcWndOrg.top),
		rcWnd.right - (rcClient.right-rcWndOrg.right),
		rcWnd.bottom - (rcClient.bottom-rcWndOrg.bottom)
		);

	if( !pExtBar->IsFixedMode() )
	{
		ASSERT( (GetStyle() & __REMOVED_NONFIXMODE_STYLES) == 0 );
		CSize _sizeMinFloated =
			pExtBar->_CalcDesiredMinFloatedSize();
		CSize _size = rcWnd.Size();
		if( _size.cx < _sizeMinFloated.cx )
			_size.cx = _sizeMinFloated.cx;
		if( _size.cy < _sizeMinFloated.cy )
			_size.cy = _sizeMinFloated.cy;
		CExtPaintManager::monitor_parms_t _mp;
		CExtPaintManager::stat_GetMonitorParms( _mp, this );
		CSize _sizeMaxFloated = _mp.m_rcWorkArea.Size();
		if( _size.cx > _sizeMaxFloated.cx )
			_size.cx = _sizeMaxFloated.cx;
		if( _size.cy > _sizeMaxFloated.cy )
			_size.cy = _sizeMaxFloated.cy;
		CRect rcWndValidated( rcWnd.TopLeft(), _size );
		pExtBar->m_sizeFloated = _size - ptOffsetWnd;
		MoveWindow( &rcWndValidated );
		SetTimer( 3, 1, NULL );
		g_bInResizingUpdateState = false;
		return;
	} // if( !pExtBar->IsFixedMode() )

int nWinResizingFrameDX = ::GetSystemMetrics( SM_CXSIZEFRAME );
int nWinResizingFrameDY = ::GetSystemMetrics( SM_CYSIZEFRAME );
DWORD dwMode = LM_HORZ|LM_COMMIT;
LONG nLendth = 0;
	if( bHorz )	
		nLendth = rcClient.Width();
	else
	{
		dwMode |= LM_LENGTHY;
		nLendth =
			rcClient.Height()
			- nWinResizingFrameDY;
	} // else from if( bHorz )	
CSize _sizeFloatedPrev = pExtBar->m_sizeFloated;
CSize _size =
		pExtBar->CalcDynamicLayout( nLendth, dwMode );
	if( _sizeFloatedPrev == _size )
	{
		g_bInResizingUpdateState = false;
		return;
	}

//	if( _size.cx < _sizeMinFloated.cx )
//		_size.cx = _sizeMinFloated.cx;
//	if( _size.cy < _sizeMinFloated.cy )
//		_size.cy = _sizeMinFloated.cy;

	pExtBar->m_sizeFloated = _size;

	if( bInvTop )
	{
		ASSERT( rcWnd.top == rcWndOrg.top );
		rcWnd.bottom = m_rcWndResizingStart.bottom;
		rcWnd.top =
			rcWnd.bottom - _size.cy - ptOffsetWnd.y;
	}
	if( bInvLeft )
	{
		ASSERT( rcWnd.left == rcWndOrg.left );
		rcWnd.right = m_rcWndResizingStart.right;
		rcWnd.left =
			rcWnd.right - _size.cx - ptOffsetWnd.x;
	}

	ASSERT( pExtBar->m_pDockSite != NULL );
	ASSERT( pExtBar->m_pDockBar != NULL );
	pExtBar->m_ptFloatHelper = rcWnd.TopLeft();

	_size += sizeNcDiff;
	_size.cx -= nWinResizingFrameDX; // (+ v.2.22)
	_size.cy -= nWinResizingFrameDY;
CRect rcToMoveMinFrame(
		pExtBar->m_ptFloatHelper,
		_size
		);

	MoveWindow( &rcToMoveMinFrame);
	SendMessage( WM_NCPAINT );
	RecalcLayout();
	pExtBar->RedrawWindow(
		NULL,
		NULL,
		RDW_INVALIDATE|RDW_UPDATENOW
			|RDW_ERASE|RDW_ERASENOW
			|RDW_ALLCHILDREN
		);
	g_bInResizingUpdateState = false;
}
Exemplo n.º 17
0
void CExtMiniDockFrameWnd::OnNcPaint() 
{
CExtControlBar * pExtBar =
		GetControlBarExt();
bool bExtBar = false;
	if( pExtBar != NULL
		&& !pExtBar->m_bFixedMode
		)
		bExtBar = true;

CRect rcClient, rcBar;
	GetClientRect(rcClient);
	ClientToScreen(rcClient);
	GetWindowRect(rcBar);
	rcClient.OffsetRect(-rcBar.TopLeft());
	rcBar.OffsetRect(-rcBar.TopLeft());

CWindowDC dc( this );
	dc.ExcludeClipRect(rcClient);
CExtMemoryDC dcWin(&dc);

	g_PaintManager->PaintDockingFrame(
		dcWin,
		rcBar,
		rcClient,
		true,
		bExtBar
		);
CString sCaption;
	if( pExtBar != NULL )
		pExtBar->GetWindowText(sCaption);
	if( sCaption.IsEmpty() )
		GetWindowText(sCaption);

CRect rcCapt( m_rcFrameCaption );
CRect rcText( m_rcFrameCaption );
	rcText.right = m_rcBtnHideBar.left;

	if( pExtBar != NULL )
	{
		INT nCountOfNcButtons = pExtBar->NcButtons_GetCount();
		if( nCountOfNcButtons > 0 )
		{
			CExtBarNcAreaButton * pBtn =
				pExtBar->NcButtons_GetAt( nCountOfNcButtons - 1 );
			const CRect & rcBtn = *pBtn;
			rcText.right = rcBtn.left - 2;
			if( rcText.left > rcText.right )
				rcText.left = rcText.right;
		} // if( nCountOfNcButtons > 0 )
	}

bool bActive = false;
HWND hTmpWndFocus = ::GetFocus();
	if( hTmpWndFocus != NULL
		&& (  GetSafeHwnd() == hTmpWndFocus
			  || ::IsChild( GetSafeHwnd(), hTmpWndFocus )
			)
		)
		bActive = true;

	rcText.DeflateRect(2,0);
	g_PaintManager->PaintGripper(
		dcWin,
		rcCapt,
		rcText,
		bActive,
		true,
		false,
		bExtBar,
		sCaption.IsEmpty() ? NULL : (LPCTSTR)sCaption
		);

	if( pExtBar != NULL )
	{
		pExtBar->NcButtons_Paint( dcWin );
	} // if( pExtBar != NULL )
	else
	{
		bool bPushed = false, bEnabled = true;
		g_PaintManager->PaintDockingCaptionButton(
			dcWin,
			m_rcBtnHideBar,
			CExtPaintManager::__DCBT_CLOSE,
			m_bBtnHideBar,
			bPushed,
			bEnabled,
			bExtBar,
			bActive
			);
	} // else from if( pExtBar != NULL )

}
Exemplo n.º 18
0
void CExtMiniDockFrameWnd::_ResizingStart(
	UINT nHitTest,
	const CPoint & point
	)
{
#ifdef _USRDLL
	// If this is a DLL, need to set up MFC state
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
#endif

	ASSERT( m_nResizingMode == HTNOWHERE );
	ASSERT( IsWindowVisible() );

	CExtPopupMenuWnd::CancelMenuTracking();

CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );
	if( ( ! pExtBar->IsShowContentWhenDragging() )
//		|| pExtBar->m_bFixedMode
		)
	{
		m_nResizingMode = HTNOWHERE;
		pExtBar->m_pDockContext->StartResize(nHitTest, point);
		return;
	}

	switch( nHitTest )
	{
	case HTLEFT:
	case HTRIGHT:
	case HTTOP:
	case HTTOPLEFT:
	case HTTOPRIGHT:
	case HTBOTTOM:
	case HTBOTTOMLEFT:
	case HTBOTTOMRIGHT:
		m_nResizingMode = nHitTest;
	break;
	default:
		return;
	} // switch( nHitTest )

#ifdef _DEBUG
int nPos = 1;
CControlBar * pDebugDummyBar = NULL;
	while(
		pDebugDummyBar == NULL
		&& nPos < m_wndDockBar.m_arrBars.GetSize()
		)
		pDebugDummyBar =
			reinterpret_cast<CExtDockBar&>
				(m_wndDockBar).
					GetDockedControlBar(nPos++);
	ASSERT(pDebugDummyBar != NULL);
	ASSERT_KINDOF(CExtControlBar, pDebugDummyBar);
	ASSERT(pDebugDummyBar->m_pDockContext != NULL);
	// CBRS_SIZE_DYNAMIC toolbars cannot have the CBRS_FLOAT_MULTI style
	ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0);
#endif // _DEBUG
	
	ASSERT( pExtBar == pDebugDummyBar );
	ASSERT(pExtBar->m_pDockContext != NULL);

	if( !pExtBar->m_bFixedMode )
		ModifyStyle(__REMOVED_NONFIXMODE_STYLES, 0);
	BringWindowToTop();
	SetCapture();
	GetWindowRect( &m_rcWndResizingStart );

	while( m_nResizingMode != HTNOWHERE )
	{
		::WaitMessage();
		MSG msg;
		// Process all the messages in the message queue
		while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
		{
			bool bStop = false;
			switch( msg.message )
			{
			case WM_ACTIVATEAPP:
			case WM_COMMAND:
				bStop = true;
			break;
			default:
				if(	WM_KEYFIRST <= msg.message
					&& msg.message <= WM_KEYLAST
					)
				bStop = true;
			break;
			} // switch( msg.message )
			if( (!bStop) &&
				GetCapture() != this
				)
				bStop = true;
			if( bStop )
			{
				_ResizingEnd();
				return;
			}
			if( !AfxGetApp()->PumpMessage() )
			{
				PostQuitMessage(0);
				return; // Signal WM_QUIT received
			} // if( !AfxGetApp()->PumpMessage() )
		} // while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
		LONG lIdle = 0;
		while( AfxGetApp()->OnIdle(lIdle++) );
	} // while( m_nResizingMode != HTNOWHERE )
}
Exemplo n.º 19
0
void CExtMiniDockFrameWnd::_ResizingUpdateState(
	const CPoint & point
	)
{
CPoint _pt(point);
	ASSERT( m_nResizingMode != HTNOWHERE );
CExtControlBar * pExtBar = GetControlBarExt();
	ASSERT_VALID( pExtBar );

//	BringWindowToTop();
CRect rcClient, rcWnd, rcWndOrg;
	GetClientRect(rcClient);
	GetWindowRect(rcWnd);
	rcWndOrg = rcWnd;
CSize sizeDiff = rcWnd.Size() - rcClient.Size();
	ASSERT( sizeDiff.cx >= 0 && sizeDiff.cy >= 0 );

	if( sizeDiff.cx < pExtBar->_CalcDesiredMinHW() )
		sizeDiff.cx = pExtBar->_CalcDesiredMinHW();
	if( sizeDiff.cy < pExtBar->_CalcDesiredMinVH() )
		sizeDiff.cy = pExtBar->_CalcDesiredMinVH();

UINT nHit = m_nResizingMode;
bool	bLeft=false, bTop=false, bHorz=false,
		bInvTop=false, bInvLeft=false;
CPoint ptOffsetWnd(0,0);
	if( pExtBar->m_bFixedMode )
	{
		switch( nHit )
		{
		case HTTOPLEFT:
		case HTTOPRIGHT:
			nHit = HTTOP;
		break;
		case HTBOTTOMLEFT:
		case HTBOTTOMRIGHT:
			nHit = HTBOTTOM;
		break;
		} // switch( nHit )
		switch( nHit )
		{
		case HTTOP:
//			if( _pt.y > rcWndOrg.bottom )
//				_pt.y = rcWndOrg.bottom;
			_pt.y =
				rcWndOrg.bottom
				+ rcWndOrg.top - _pt.y;
			nHit = HTBOTTOM;
			bInvLeft = true;
			bInvTop = true;
		break;
		case HTLEFT:
//			if( _pt.x > rcWndOrg.right )
//				_pt.x = rcWndOrg.right;
			_pt.x =
				rcWndOrg.right
				+ rcWndOrg.left - _pt.x;
			nHit = HTRIGHT;
			bInvLeft = true;
			bInvTop = true;
		break;
		} // switch( nHit )
	} // if( pExtBar->m_bFixedMode )
	if( bInvLeft || bInvTop || (!pExtBar->m_bFixedMode) )
	{
		CRect rcWnd;
		CRect rcClient;
		GetWindowRect( &rcWnd );
		GetClientRect( &rcClient );
		ScreenToClient( & rcWnd );
		if( bInvLeft || (!pExtBar->m_bFixedMode) )
			ptOffsetWnd.x =
				abs( rcWnd.left - rcClient.left );
		if( bInvTop || (!pExtBar->m_bFixedMode) )
			ptOffsetWnd.y =
				abs( rcWnd.top - rcClient.top );
	} // if( bInvLeft || bInvTop )

	switch( nHit )
	{
	case HTLEFT:
		bHorz = true;
		rcWnd.left = min(_pt.x,rcWnd.right);
		bLeft = true;
	break;
	case HTRIGHT:
		bHorz = true;
		rcWnd.right = max(_pt.x,rcWnd.left);
	break;
	case HTTOP:
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bTop = true;
	break;
	case HTTOPLEFT:
		rcWnd.left = min(_pt.x,rcWnd.right);
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bLeft = true;
		bTop = true;
	break;
	case HTTOPRIGHT:
		rcWnd.right = max(_pt.x,rcWnd.left);
		rcWnd.top = min(_pt.y,rcWnd.bottom);
		bTop = true;
	break;
	case HTBOTTOM:
		rcWnd.bottom = max(_pt.y,rcWnd.top);
	break;
	case HTBOTTOMLEFT:
		rcWnd.left = min(_pt.x,rcWnd.right);
		rcWnd.bottom = max(_pt.y,rcWnd.top);
		bLeft = true;
	break;
	case HTBOTTOMRIGHT:
		rcWnd.right = max(_pt.x,rcWnd.left);
		rcWnd.bottom = max(_pt.y,rcWnd.top);
	break;
	default:
		ASSERT( FALSE );
		return;
	} // switch( nHit )

	if( rcWnd.Width() < sizeDiff.cx )
		rcWnd.right = rcWnd.left + sizeDiff.cx;
	if( rcWnd.Height() < sizeDiff.cy )
		rcWnd.bottom = rcWnd.top + sizeDiff.cy;
	if( rcWnd.right > rcWndOrg.right
		&& bLeft
		)
		rcWnd.OffsetRect(
			rcWndOrg.right - rcWnd.right,
			0
			);
	if( rcWnd.bottom > rcWndOrg.bottom
		&& bTop
		)
		rcWnd.OffsetRect(
			0,
			rcWndOrg.bottom - rcWnd.bottom
			);
//	rcWnd.OffsetRect( ptOffsetWnd );
//	rcWndOrg.OffsetRect( ptOffsetWnd );
	rcClient.SetRect(
		rcWnd.left - (rcClient.left-rcWndOrg.left),
		rcWnd.top - (rcClient.top-rcWndOrg.top),
		rcWnd.right - (rcClient.right-rcWndOrg.right),
		rcWnd.bottom - (rcClient.bottom-rcWndOrg.bottom)
		);
	if( !pExtBar->m_bFixedMode )
	{
		/*
		ASSERT( (GetStyle() & __REMOVED_NONFIXMODE_STYLES) == 0 );
		pExtBar->m_sizeFloat = rcClient.Size();
		MoveWindow( &rcWnd );
		*/

		ASSERT( (GetStyle() & __REMOVED_NONFIXMODE_STYLES) == 0 );
		pExtBar->m_sizeFloated =
			rcWnd.Size()
			-ptOffsetWnd
//			- CSize(
//				afxData.cxBorder2*2,
//				afxData.cyBorder2*2
//				)
			;

		MoveWindow( &rcWnd );
		//ASSERT( pExtBar->m_sizeFloat == rcClient.Size() );
		DelayRecalcLayout();
		SetTimer(3,20,NULL);
		return;
		/*
		CRect rcResultClient;
		pExtBar->GetClientRect( &rcResultClient );
		ASSERT( rcResultClient.Size() == rcClient.Size() );
		*/
	} // if( !pExtBar->m_bFixedMode )
	else
	{
		DWORD dwMode = LM_HORZ|LM_COMMIT;
		LONG nLendth = 0;
		if( bHorz )	
			nLendth = rcClient.Width();
		else
		{
			dwMode |= LM_LENGTHY;
			nLendth = rcClient.Height();
		}
		CSize _size = pExtBar->
			CalcDynamicLayout(
				nLendth, //rcClient.Width(),
				dwMode // LM_HORZ | LM_COMMIT
				);
		pExtBar->m_sizeFloated = _size;
		if( bInvTop )
		{
			ASSERT( rcWnd.top == rcWndOrg.top );
			rcWnd.bottom = m_rcWndResizingStart.bottom;
			rcWnd.top =
				rcWnd.bottom
				- _size.cy // - (_size.cy + sizeDiff.cy)
				- ptOffsetWnd.y
				;
		}
		if( bInvLeft )
		{
			ASSERT( rcWnd.left == rcWndOrg.left );
			rcWnd.right = m_rcWndResizingStart.right;
			rcWnd.left =
				rcWnd.right
				- _size.cx // - (_size.cx + sizeDiff.cx)
				- ptOffsetWnd.x
				;
		}
	} // else from if( !pExtBar->m_bFixedMode )

/*
CSize sizePreCalc = rcClient.Size();
	if( _size != sizePreCalc )
	{
		pExtBar->m_sizeFloat = _size;
		if( bHorz )
			rcWnd.left += _size.cx-sizePreCalc.cx;
		else
			rcWnd.top += _size.cy-sizePreCalc.cy;
	}
*/

	ASSERT( pExtBar->m_pDockSite != NULL );
	ASSERT( pExtBar->m_pDockBar != NULL );
	pExtBar->m_ptFloatHelper = rcWnd.TopLeft();
	pExtBar->m_pDockSite->
		FloatControlBar(
			pExtBar,
			pExtBar->m_ptFloatHelper,
			CBRS_ALIGN_TOP
				| (pExtBar->m_pDockBar->m_dwDockStyle & CBRS_FLOAT_MULTI)
				| CBRS_SIZE_DYNAMIC
			);
	RecalcLayout();
}
Exemplo n.º 20
0
void CExtMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
CExtControlBar * pExtBar = GetControlBarExt();
CPoint p(point);
CRect rcWnd;
	GetWindowRect( &rcWnd );
	p.Offset( -rcWnd.left, -rcWnd.top );
	if( m_rcBtnHideBar.PtInRect( p ) )
		return;
	if( nHitTest == HTCAPTION )
	{
		ActivateTopParent();
		BringWindowToTop();
		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 =
					reinterpret_cast < CExtDockBar & >
						(m_wndDockBar). GetDockedControlBar(nPos++);
			ASSERT(pBar != NULL);
			ASSERT_KINDOF( CControlBar, pBar );
			ASSERT( pBar->m_pDockContext != NULL );
			if( pExtBar == NULL
				|| (!pExtBar->IsShowContentWhenDragging())
				)
			{
				pBar->m_pDockContext->StartDrag(point);
				return;
			}
			int nCyGripper =
				min(
					pExtBar->m_rcGrip.Width(),
					pExtBar->m_rcGrip.Height()
					);
			pExtBar->_DraggingStart(
				point,
				point
					- rcWnd.TopLeft()
					- CPoint( nCyGripper, nCyGripper/2 )
				);
			return;
		}
	}
	else if( nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST )
	{
		ActivateTopParent();
		int nPos = 1;
		CControlBar * pBar = NULL;
		while(
			pBar == NULL
			&& nPos < m_wndDockBar.m_arrBars.GetSize()
			)
			pBar =
				reinterpret_cast < CExtDockBar & >
					(m_wndDockBar).GetDockedControlBar(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(CExtControlBar)) )
			CMiniDockFrameWnd::OnNcLButtonDown( nHitTest, point);
		else
		{
			CExtControlBar * pExtBar =
				(CExtControlBar *)pBar;
			if( !pExtBar->IsShowContentWhenDragging() )
			{
				pBar->m_pDockContext->StartResize(nHitTest,point);
				return;
			}
			ClientToScreen( &point );
			_ResizingStart( nHitTest, point );
		}
		return;
	}
	else if( nHitTest == HTMINBUTTON
		|| nHitTest == HTMAXBUTTON
		|| nHitTest == HTGROWBOX
		)
		return;
	
	CMiniFrameWnd::OnNcLButtonDown( nHitTest, point );
}
Exemplo n.º 21
0
void CExtMiniDockFrameWnd::OnNcRButtonDown(UINT nHitTest, CPoint point)
{
	if( _ResizingIsInProgress() )
	{
		_ResizingEnd();
		return;
	}
	if( nHitTest == HTCAPTION )
	{
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
		CExtCustomizeSite * pSite =
			CExtCustomizeSite::GetCustomizeSite( m_hWnd );
		if(		pSite != NULL
			&&	pSite->IsCustomizeMode()
			)
			return;
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
		if( CExtControlBar::FindHelpMode(this) )
			return;
		CExtControlBar * pExtBar =
			GetControlBarExt();
		if( pExtBar != NULL )
		{
			ASSERT_VALID( pExtBar );
			
			CFrameWnd * pFrame = pExtBar->_GetDockingFrameImpl();
			ASSERT_VALID( pFrame );

			CPoint point;
			if( ! ::GetCursorPos(&point) )
				return;
			HWND hWndTrack = pFrame-> /*pExtBar->GetOwner()->*/ GetSafeHwnd();
			ASSERT( hWndTrack != NULL && ::IsWindow(hWndTrack) );
			CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
			VERIFY( pPopup->CreatePopupMenu(hWndTrack) );
			if(	! CExtDockBar::_ConstructDockSiteControlBarPopupMenu(
					pFrame,
					pPopup,
					CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_MINIFRAME_NC_CTX,
					pExtBar,
					WM_NCRBUTTONDOWN,
					NULL
					)
				)
			{
				delete pPopup;
				return;
			}
			if( pPopup->ItemGetCount() == 0 )
			{
				delete pPopup;
				return;
			}
			//::SetFocus( hWndTrack );
			if( ! pPopup->TrackPopupMenu(
					TPMX_OWNERDRAW_FIXED,
					point.x,
					point.y
					)
				)
			{
				delete pPopup;
			}
			return;
		} // if( pExtBar != NULL )
	} // if( nHitTest == HTCAPTION )
	CMiniDockFrameWnd::OnNcRButtonDown(nHitTest,point);
}
Exemplo n.º 22
0
void CExtMiniDockFrameWnd::OnTimer( UINT nIDEvent )
{
CExtControlBar * pExtBar = GetControlBarExt();
	if( nIDEvent == 1 )
	{
		if( pExtBar == NULL )
			return;
		KillTimer(1);
		SetWindowPos(
			NULL,0,0,0,0,
			SWP_NOMOVE|SWP_NOACTIVATE // |SWP_NOSIZE
				|SWP_NOZORDER|SWP_NOOWNERZORDER 
				|SWP_FRAMECHANGED
			);
		return;
	}
	if( nIDEvent == 2 )
	{
		_AnalyzeButtonsHover();
		return;
	}
	if( nIDEvent == 3 )
	{
		if( pExtBar == NULL
			|| _ResizingIsInProgress()
			)
		return;
		RecalcLayout();
		KillTimer(3);
		return;
	}

	if( pExtBar == NULL )
		return;
	ASSERT_VALID( pExtBar );
	if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
	{
		if( _ResizingIsInProgress() )
			return;
		CPoint pt;
		VERIFY( GetCursorPos( &pt ) );
		CWnd * pTempWnd = WindowFromPoint( pt );
		int IsMouseInsideTheWindow =
			IsChild( pTempWnd ) || pTempWnd->m_hWnd == m_hWnd;

		if(	IsMouseInsideTheWindow
			|| IsChild(GetFocus())  
			|| (GetCapture() && pExtBar->m_hWnd == GetCapture()->m_hWnd) 
			|| CExtPopupMenuWnd::IsMenuTracking()
			) 
		{

			if(	IsMouseInsideTheWindow 
				&& !CExtPopupMenuWnd::IsMenuTracking()
				&& IsWindowEnabled()
				&& GetFocus()
				) 
				BringWindowToTop();
		}
	} // if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
}
Exemplo n.º 23
0
void CExtMiniDockFrameWnd::OnNcPaint() 
{

CExtControlBar * pExtBar =
		GetControlBarExt();
bool bExtBar = false;
	if( pExtBar != NULL
		&& !pExtBar->IsFixedMode()
		)
		bExtBar = true;

CRect rcClient, rcBar;
	GetClientRect(rcClient);
	ClientToScreen(rcClient);
	GetWindowRect(rcBar);
	rcClient.OffsetRect(-rcBar.TopLeft());
	rcBar.OffsetRect(-rcBar.TopLeft());

CWindowDC dcSrc( this );
	dcSrc.ExcludeClipRect( &rcClient );
CExtMemoryDC dcWin( &dcSrc, &rcBar );

CExtPaintManager::PAINTDOCKINGFRAMEDATA _pdfd(
		this,
		rcBar,
		rcClient,
		true,
		bExtBar
		);
	g_PaintManager->PaintDockingFrame( dcWin, _pdfd );
bool bEnableCaptionText = true;
CExtSafeString sCaption;
	if( pExtBar != NULL )
	{
		if( pExtBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
			&& ( !pExtBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar)) )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
			)
			bEnableCaptionText = false;
		else
		{
			pExtBar->OnGetBarCaptionText(
				CExtControlBar::__EBCT_SINGLE_CAPTION_FLOATING,
				sCaption
				);
		}
	}
	if( !bEnableCaptionText )
	{
		if( pExtBar != NULL
			&& pExtBar->IsKindOf(RUNTIME_CLASS(CExtDynControlBar))
			)
			bEnableCaptionText =
				_GetSingleVisibleCaptionText(
					sCaption
					);
	}
	else
		if( bEnableCaptionText && sCaption.IsEmpty() )
		{
			if( pExtBar != NULL )
			{
				pExtBar->OnGetBarCaptionText(
					CExtControlBar::__EBCT_SINGLE_CAPTION_FLOATING,
					sCaption
					);
			} // if( pExtBar != NULL )
			else
			{
				int nTextLen = GetWindowTextLength();
				if( nTextLen > 0 )
				{
					GetWindowText( sCaption.GetBuffer( nTextLen+2 ), nTextLen+1 );
					sCaption.ReleaseBuffer();
				} // if( nTextLen > 0 )
			} // else from if( pExtBar != NULL )
		}

CRect rcCapt( m_rcFrameCaption );
CRect rcText( m_rcFrameCaption );
	rcText.right = m_rcBtnHideBar.left;

	if( pExtBar != NULL )
		pExtBar->NcButtons_CalcGripperTextLocation( rcText );

bool bActive = false;
HWND hTmpWndFocus = ::GetFocus();
	if( hTmpWndFocus != NULL
		&& (  GetSafeHwnd() == hTmpWndFocus
			  || ::IsChild( GetSafeHwnd(), hTmpWndFocus )
			)
		)
		bActive = true;

	rcText.DeflateRect(2,0);
CExtPaintManager::PAINTGRIPPERDATA _pgd(
		this,
		rcCapt,
		rcText,
		bActive,
		true,
		false,
		bExtBar,
		sCaption.IsEmpty() ? LPCTSTR( NULL ) : sCaption
		);
	g_PaintManager->PaintGripper( dcWin, _pgd );

	if( pExtBar != NULL )
	{
		pExtBar->NcButtons_Paint( dcWin );
	} // if( pExtBar != NULL )
	else
	{
		CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA _pdcbd(
			this,
			m_rcBtnHideBar,
			CExtPaintManager::__DCBT_CLOSE,
			m_bBtnHideBar,
			false,
			true,
			bExtBar,
			bActive,
			true
			);
		g_PaintManager->PaintDockingCaptionButton( dcWin, _pdcbd );
	} // else from if( pExtBar != NULL )

	g_PaintManager->OnPaintSessionComplete( this );
}
Exemplo n.º 24
0
void CExtDockBar::_ContextMenuBuild(
	CFrameWnd * pFrame,
	CExtPopupMenuWnd * pPopup
	)
{
	ASSERT_VALID( pFrame );
	ASSERT( pPopup != NULL );
ExtControlBarVector_t vBars;
	CExtControlBar::_GetFrameControlBars(
		pFrame,
		vBars
		);
bool bOleInplaceItemActivated =
	CExtControlBar::IsOleIpObjActive( pFrame );

int nBarsCount = vBars.GetSize();
CExtControlBar * pPrevBar = NULL;
	for( int i=0; i<nBarsCount; i++ )
	{
		CExtControlBar * pBar = vBars[i];
		ASSERT_VALID( pBar );
		if( pBar->GetSafeHwnd() == NULL )
			continue;
		// do not include temporary hidden bars
		if( pBar->m_nStateFlags &
				(CControlBar::delayHide | CControlBar::tempHide)
			)
			continue;
		// do not include some bars when OLE inplace object active
		if( bOleInplaceItemActivated &&
				(pBar->m_dwStyle & CBRS_HIDE_INPLACE)
			)
			continue;

		// do not include bars without caption
		CString sBarText;
		pBar->GetWindowText( sBarText );
		if( sBarText.IsEmpty() )
		{
			ASSERT( FALSE );
			continue;
		}

		if( pPrevBar != NULL
			&&
			pPrevBar->m_bFixedMode != pBar->m_bFixedMode
			)
		{
			VERIFY(
				pPopup->ItemInsert(
					CExtPopupMenuWnd::TYPE_SEPARATOR
					)
				);
		}
		pPrevBar = pBar;


		int nBarID = pBar->GetDlgCtrlID();
		ASSERT( CExtCmdManager::IsCommand(nBarID) );
		
		CExtCmdManager::cmd_t cmd;
		cmd.m_nCmdID = nBarID;
		cmd.m_sMenuText = sBarText;
		cmd.TipsLoad();
		g_CmdManager->CmdSetup(
			g_CmdManager->ProfileNameFromWnd( pFrame->GetSafeHwnd() ),
			cmd
			);

		VERIFY(
			pPopup->ItemInsert(
				nBarID
				)
			);
	} // for( int i=0; i<nBarsCount; i++ )
}