LRESULT CMainFrame::OnMsgUseCustomNcArea( WPARAM wParam, LPARAM lParam )
{
// --note
bool m_bBarsWithCaption = true;
// --
// --note
bool m_bBarCaptionWithText = true;
// --
// --note
bool m_bBarsWithCustomSeparators = true;
// --
ASSERT_VALID( this );
lParam;
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA * pCNAQD =
CExtControlBar::CUSTOM_NC_AREA_QUERY_DATA::FromWPARAM( wParam );
ASSERT( pCNAQD != NULL );
ASSERT_VALID( pCNAQD->m_pBar );
if( pCNAQD->m_pBar->IsFixedMode() )
return 0;
pCNAQD->m_bQueryHandled = true;
//pCNAQD->m_bQueryHandled = false;
if( pCNAQD->m_hDcDraw != NULL )
{ // if rendering query
static const CSize g_sizeGripDot( 2, 2 );
static const CSize g_sizeGripDist( 1, 1 );
static const CSize g_sizeGripShadowOffset( 1, 1 );
COLORREF clrDotShadow =
g_PaintManager->GetColor(
COLOR_WINDOW // _2003CLR_GRIPPER_DOT_LIGHT
);
COLORREF clrDotFace =
g_PaintManager->GetColor(
COLOR_3DSHADOW // _2003CLR_GRIPPER_DOT_DARK
);
int nDot, nDotCount;
CRect rcNcAreaDraw, rcHelper, rcDotFace, rcDotShadow;
pCNAQD->m_pBar->GetWindowRect( &rcNcAreaDraw );
rcNcAreaDraw.OffsetRect( -rcNcAreaDraw.TopLeft() );
CDC * pDC = CDC::FromHandle( pCNAQD->m_hDcDraw );
if( ! g_PaintManager->PaintDockerBkgnd(
false,
*pDC,
pCNAQD->m_pBar
)
)
pDC->FillSolidRect(
&rcNcAreaDraw,
g_PaintManager->GetColor(
CExtPaintManager::CLR_3DFACE_OUT,
pCNAQD->m_pBar
)
);
if( m_bBarsWithCustomSeparators )
{
rcHelper = pCNAQD->m_pBar->_RectRowRecalcGet();
if( ! rcHelper.IsRectEmpty() )
{
if( pCNAQD->m_pBar->IsDockedVertically() )
{
nDotCount =
rcHelper.Width()
/ (g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx);
rcDotFace = rcHelper;
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotFace.OffsetRect(
0,
( rcHelper.Height() - rcDotFace.Height() ) / 2
);
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
rcDotShadow.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
else
{
nDotCount =
rcHelper.Height()
/ (g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy);
rcDotFace = rcHelper;
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotFace.OffsetRect(
( rcHelper.Width() - rcDotFace.Width() ) / 2,
0
);
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
rcDotShadow.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
} // if( ! rcHelper.IsRectEmpty() )
rcHelper = pCNAQD->m_pBar->_RectRowRecalcUpGet();
if( ! rcHelper.IsRectEmpty() )
{
nDotCount =
rcHelper.Width()
/ (g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx);
rcDotFace = rcHelper;
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotFace.OffsetRect(
0,
( rcHelper.Height() - rcDotFace.Height() ) / 2
);
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
rcDotShadow.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
} // if( ! rcHelper.IsRectEmpty() )
rcHelper = pCNAQD->m_pBar->_RectRowResizeGet();
if( ! rcHelper.IsRectEmpty() )
{
if( pCNAQD->m_pBar->IsDockedVertically() )
{
nDotCount =
rcHelper.Height()
/ (g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy);
rcDotFace = rcHelper;
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotFace.OffsetRect(
( rcHelper.Width() - rcDotFace.Width() ) / 2,
0
);
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
rcDotShadow.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
else
{
nDotCount =
rcHelper.Width()
/ (g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx);
rcDotFace = rcHelper;
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotFace.OffsetRect(
0,
( rcHelper.Height() - rcDotFace.Height() ) / 2
);
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
rcDotShadow.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
} // if( ! rcHelper.IsRectEmpty() )
} // if( m_bBarsWithCustomSeparators )
if( m_bBarsWithCaption )
{
bool bFloating = pCNAQD->m_pBar->IsFloating() ? true : false;
bool bGripperAtTop = false;
if( pCNAQD->m_pBar->IsBarWithGripper(&bGripperAtTop) && (! bFloating ) )
{
CRect rcGrip = pCNAQD->m_pBar->_RectGripGet();
bool bHorz = pCNAQD->m_pBar->IsDockedHorizontally();
CRect rcText( rcGrip );
if( bHorz && !bGripperAtTop )
{
rcText.DeflateRect( 0, 2 );
rcText.OffsetRect( -2, 0 );
}
else
rcText.DeflateRect( 2, 0 );
pCNAQD->m_pBar->NcButtons_CalcGripperTextLocation( rcText );
CRgn rgnExclude;
if( rgnExclude.CreateRectRgnIndirect( &rcGrip ) )
pDC->SelectClipRgn( &rgnExclude );
if( m_bBarCaptionWithText )
{
CExtSafeString sCaption;
pCNAQD->m_pBar->OnGetBarCaptionText( CExtControlBar::__EBCT_SINGLE_CAPTION_DOCKED, sCaption );
CExtPaintManager::PAINTGRIPPERDATA _pgd(
this,
rcGrip,
rcText,
pCNAQD->m_pBar->IsBarWindowActive(),
false,
bHorz && !bGripperAtTop,
true,
sCaption.IsEmpty() ? LPCTSTR( NULL ) : sCaption,
( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false
);
g_PaintManager->PaintGripper( *pDC, _pgd );
} // if( m_bBarCaptionWithText )
pCNAQD->m_pBar->NcButtons_Paint( *pDC );
if( ! m_bBarCaptionWithText )
{
rcHelper = rcText;
if( ! rcHelper.IsRectEmpty() )
{
if( bGripperAtTop )
{
nDotCount =
rcHelper.Width()
/ (g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx);
rcDotFace = rcHelper;
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotFace.OffsetRect(
0,
( rcHelper.Height() - rcDotFace.Height() ) / 2
);
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
rcDotShadow.OffsetRect( g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx, 0 );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
else
{
nDotCount =
rcHelper.Height()
/ (g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy);
rcDotFace = rcHelper;
rcDotFace.right = rcDotFace.left + g_sizeGripDot.cx;
rcDotFace.OffsetRect(
( rcHelper.Width() - rcDotFace.Width() ) / 2,
0
);
rcDotFace.bottom = rcDotFace.top + g_sizeGripDot.cy;
rcDotShadow = rcDotFace;
rcDotShadow.OffsetRect( g_sizeGripShadowOffset );
for( nDot = 0; nDot < nDotCount; nDot++ )
{
pDC->FillSolidRect( &rcDotShadow, clrDotShadow );
pDC->FillSolidRect( &rcDotFace, clrDotFace );
rcDotFace.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
rcDotShadow.OffsetRect( 0, g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy );
} // for( nDot = 0; nDot < nDotCount; nDot++ )
}
} // if( ! rcHelper.IsRectEmpty() )
}
pDC->SelectClipRgn( NULL );
} // if( IsBarWithGripper(&bGripperAtTop) && (! bFloating ) )
} // if( m_bBarsWithCaption )
} // if rendering query
else
{ // if metric update query
pCNAQD->m_pBar->_GripperHeightAtTopSet(
m_bBarsWithCaption
? ( ::GetSystemMetrics(SM_CYSMCAPTION) + 1 )
: 0
);
if( m_bBarsWithCustomSeparators )
{
pCNAQD->m_pBar->_SeparatorWidthSet(
6
);
pCNAQD->m_pBar->_SeparatorHeightSet(
6
);
} // if( m_bBarsWithCustomSeparators )
else
{
pCNAQD->m_pBar->_SeparatorWidthSet(
__min( 4, ::GetSystemMetrics(SM_CXSIZEFRAME) )
);
pCNAQD->m_pBar->_SeparatorHeightSet(
__min( 4, ::GetSystemMetrics(SM_CYSIZEFRAME) )
);
} // else from if( m_bBarsWithCustomSeparators )
} // if metric update query
return 0;
}