Пример #1
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 )

}
Пример #2
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 );
}