示例#1
0
LRESULT CPanelWnd::OnSetText(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	if ( m_pSkin )
	{
		BOOL bVisible = IsWindowVisible();
		if ( bVisible ) ModifyStyle( WS_VISIBLE, 0 );
		LONG lResult = static_cast< DWORD >( Default() );
		if ( bVisible ) ModifyStyle( 0, WS_VISIBLE );

		if ( m_pSkin ) m_pSkin->OnSetText( this );

		return lResult;
	}
	else if ( m_bPanelMode )
	{
		BOOL bVisible = IsWindowVisible();
		if ( bVisible ) ModifyStyle( WS_VISIBLE, 0 );
		LONG lResult = static_cast< DWORD >( Default() );
		if ( bVisible ) ModifyStyle( 0, WS_VISIBLE );

		CWindowDC dc( this );
		PaintCaption( dc );

		return lResult;
	}
	else
	{
		return Default();
	}
}
示例#2
0
LONG CPanelWnd::OnSetText(WPARAM wParam, LPARAM lParam)
{
	if ( m_pSkin )
	{
		BOOL bVisible = IsWindowVisible();
		if ( bVisible ) ModifyStyle( WS_VISIBLE, 0 );
		LONG lResult = Default();
		if ( bVisible ) ModifyStyle( 0, WS_VISIBLE );

		if ( m_pSkin ) m_pSkin->OnSetText( this );

		return lResult;
	}
	else if ( m_bPanelMode )
	{
		BOOL bVisible = IsWindowVisible();
		if ( bVisible ) ModifyStyle( WS_VISIBLE, 0 );
		LONG lResult = Default();
		if ( bVisible ) ModifyStyle( 0, WS_VISIBLE );

		CWindowDC dc( this );
		PaintCaption( dc );

		return lResult;
	}
	else
	{
		return Default();
	}
}
示例#3
0
//
/// If the tiny caption is not enabled or is iconic, returns esPartial. Otherwise,
/// repaints the caption as an active caption and returns esComplete.
//
TEventStatus
TTinyCaption::DoNCActivate(bool active, bool& evRes)
{
    if (!TCEnabled || IsIconic())
        return esPartial;  // Let default do it's thing

    PaintCaption(active);
    evRes = true;
    return esComplete;
}
示例#4
0
BOOL CPanelWnd::OnNcActivate(BOOL bActive)
{
	if ( m_bPanelMode && ! m_pSkin )
	{
		CWindowDC dc( this );
		PaintCaption( dc );
		return TRUE;
	}

	return CChildWnd::OnNcActivate( bActive );
}
示例#5
0
void CPanelWnd::OnNcPaint()
{
	if ( m_bPanelMode && ! m_pSkin )
	{
		CWindowDC dc( this );
		PaintCaption( dc );
	}
	else
	{
		CChildWnd::OnNcPaint();
	}
}
示例#6
0
/////////////////
// Handle WM_NCPAINT for main window
//
BOOL CCaptionPainter::OnNcPaint(HRGN hRgn)
{
	ASSERT_VALID(m_pParentDlg);
	CWnd& wnd = (CWnd&)*m_pParentDlg;

	m_crcCaption.CalcCaptionRect(wnd, m_nBdrInc, m_nTitleInc);		// caption rectangle in window coords
	CRect rcWin;					// window rect
	wnd.GetWindowRect(&rcWin);	// .. get window rect
	CRect rc = m_crcCaption;
	rc += rcWin.TopLeft();		// convert caption rect to screen coords

	// Don't bother painting if the caption doesn't lie within the region.
	//
	if ((WORD)hRgn > 1 && !::RectInRegion(hRgn, &rc)) 
	{
		Default();					// just do default thing
		return TRUE;						// and quit
	}

	// Exclude caption from update region
	//
	HRGN hRgnCaption = ::CreateRectRgnIndirect(&rc);
	HRGN hRgnNew     = ::CreateRectRgnIndirect(&rc);
	if ((WORD)hRgn > 1) 
	{
		// wParam is a valid region: subtract caption from it
		::CombineRgn(hRgnNew, hRgn, hRgnCaption, RGN_DIFF);
	} else 
	{
		// wParam is not a valid region: create one that's the whole
		// window minus the caption bar
		HRGN hRgnAll = ::CreateRectRgnIndirect(&rcWin);
		CombineRgn(hRgnNew, hRgnAll, hRgnCaption, RGN_DIFF);
		DeleteObject(hRgnAll);
	}

	// Call Windows to do WM_NCPAINT with altered update region
	//
/*	MSG& msg = AfxGetThreadState()->m_lastSentMsg;
	WPARAM savewp = msg.wParam;	// save original wParam
	msg.wParam = (WPARAM)hRgnNew;	// set new region for DefWindowProc
	Default();
	DeleteObject(hRgnCaption);		// clean up
	DeleteObject(hRgnNew);			// ...
	msg.wParam = savewp;				// restore original wParam
*/
	PaintCaption(m_crcCaption);					// Now paint my special caption
	
	return TRUE;
}
示例#7
0
//
/// If the caption bar is not enabled or is iconized, returns esPartial. Otherwise,
/// gets the focus, paints the caption, and returns esPartial, thus indicating that
/// a separate paint function must be called to paint the borders of the caption.
//
TEventStatus
TTinyCaption::DoNCPaint()
{
    if (!TCEnabled || IsIconic())
        return esPartial;  // We don't do anything special for an Icon

    // If we have focus or our children have focus, then we're active
    // Note: We can't rely only on GetFocus here because when we're being
    //       restored from an icon, we're active, but don't yet have focus!
    //
    THandle focus = GetFocus();
    PaintCaption(GetActiveWindow() == GetHandle() || focus == GetHandle() || IsChild(focus));
    return esPartial;       // Caller must call function to paint borders
}
示例#8
0
//////////////////
// Handle WM_SETTEXT for main window
//
BOOL CCaptionPainter::OnSetText(LPCTSTR lpText)
{
	ASSERT_VALID(m_pParentDlg);
	CWnd& wnd = (CWnd&)*m_pParentDlg;

	// Turn WS_VISIBLE style off before calling Windows to
	// set the text, then turn it back on again after.
	//
	DWORD dwStyle = wnd.GetStyle();
	if (dwStyle & WS_VISIBLE)
		SetWindowLong(wnd.m_hWnd, GWL_STYLE, dwStyle & ~ WS_VISIBLE);
	Default();
	if (dwStyle & WS_VISIBLE)
		SetWindowLong(wnd.m_hWnd, GWL_STYLE, dwStyle);

	wnd.SendMessage(WM_NCPAINT);		// paint non-client (frame)
	Invalidate();							// force new bitmap
	PaintCaption(m_crcCaption);
	return TRUE;
}
示例#9
0
BOOL CChildWnd::OnNcActivate(BOOL bActive) 
{
	CWindowDC dc( this );
	PaintCaption( dc );
	return TRUE;
}
示例#10
0
void CChildWnd::OnNcPaint() 
{
	CWindowDC dc( this );
	PaintCaption( dc );
}