Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Ulrich Heinicke
|
Jun 2, 2010 - 2:59 PM
|
HI, the mditab is to small to show the full icon, see picture: At the top left postion are some pixel missing. How can i stretch the tab to show all pixel? Thanks Ulrich
|
|
Ulrich Heinicke
|
Jun 3, 2010 - 1:17 PM
|
Hi, using the whidbey-tab there is the same error.
|
|
Technical Support
|
Jun 3, 2010 - 10:22 AM
|
Thank you for reporting us this issue. To fix it, please update the source code for the following method:
void CExtTabOneNoteWnd::stat_OnTabWndDrawItemOneNoteImpl(
CExtTabOneNoteWnd * pWndTabs,
CDC & dc,
CRect & rcTabItemsArea,
LONG nItemIndex,
TAB_ITEM_INFO * pTii,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon,
COLORREF clrForceTabText, // = COLORREF(-1L)
COLORREF clrForceTabBk1, // = COLORREF(-1L)
COLORREF clrForceTabBk2 // = COLORREF(-1L)
)
{
ASSERT_VALID( pWndTabs );
ASSERT_VALID( pTii );
ASSERT( dc.GetSafeHdc() != NULL );
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
pWndTabs;
rcTabItemsArea;
CExtCmdIcon * pIconTabItemCloseButton = pWndTabs->OnTabWndQueryItemCloseButtonShape( pTii );
CExtCmdIcon::e_paint_type_t ePaintStateITICB = (CExtCmdIcon::e_paint_type_t) pWndTabs->OnTabWndQueryItemCloseButtonPaintState( pTii );
CRect rcTabItemCloseButton( 0, 0, 0, 0 );
if( pIconTabItemCloseButton != NULL )
rcTabItemCloseButton = pTii->CloseButtonRectGet();
bool bEnabled = pTii->EnabledGet();
bool bHover = ( (!pWndTabs->_IsDND()) && pWndTabs->m_nHoverTrackingHitTest == nItemIndex ) ? true : false;
if( (pTii->GetItemStyle() & __ETWI_CENTERED_TEXT) != 0 )
bCenteredText = true;
bool bInGroupFirst = false;
if( bGroupedMode )
{
TAB_ITEM_INFO * pTiiStart = pTii->GetInGroupFirst();
ASSERT_VALID( pTiiStart );
bInGroupFirst = ( nItemIndex == pWndTabs->ItemGetIndexOf( pTiiStart ) );
}
bool bFirstVisible = true;
CExtTabWnd::TAB_ITEM_INFO * pTiiWalk = pTii->GetPrev();
for( ; pTiiWalk != NULL; pTiiWalk = pTiiWalk->GetPrev() )
{
if( pTiiWalk->VisibleGet() )
{
bFirstVisible = false;
break;
}
}
bool bFirstItem =
( bFirstVisible // nItemIndex == 0
|| ( bInGroupFirst
&& nItemIndex != pWndTabs->SelectionGet()
)
);
CRect rcItem( rcEntireItem );
CRect rcItemRgn( rcItem );
POINT arrPointsBorders[11] =
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 },
};
POINT arrPointsInnerArea[10] =
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 },
};
POINT arrPointsClipArea[13] =
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 },
};
if( bHorz )
{
if( bTopLeft )
{
rcItemRgn.InflateRect( nItemIndex == 0 ? 0 : -1, 0, 1, 0 );
arrPointsBorders[0] = CPoint( rcItemRgn.right, rcItemRgn.bottom );
arrPointsBorders[1] = CPoint( rcItemRgn.right, rcItemRgn.top + 2 );
arrPointsBorders[2] = CPoint( rcItemRgn.right - 2, rcItemRgn.top );
arrPointsBorders[3] = CPoint( rcItemRgn.left + 5, rcItemRgn.top );
arrPointsBorders[4] = CPoint( rcItemRgn.left + 4, rcItemRgn.top + 1 );
arrPointsBorders[5] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 1 );
arrPointsBorders[6] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 2 );
arrPointsBorders[7] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 2 );
arrPointsBorders[8] = CPoint( rcItemRgn.left, rcItemRgn.top + 3 );
if( bSelected || bFirstItem )
{
arrPointsBorders[9] = CPoint( rcItemRgn.left - 15, rcItemRgn.bottom - 1 );
arrPointsBorders[10] = CPoint( rcItemRgn.left - 16, rcItemRgn.bottom - 1 );
}
else
{
arrPointsBorders[9]= CPoint( rcItemRgn.left, rcItemRgn.bottom - 1 );
arrPointsBorders[10]= arrPointsBorders[9];
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
arrPointsBorders[i].x += 16;
arrPointsInnerArea[0] = CPoint( rcItemRgn.right - 1, rcItemRgn.bottom );
arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 1, rcItemRgn.top + 2 );
arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 1 );
arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 5, rcItemRgn.top + 1 );
arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 4, rcItemRgn.top + 2 );
arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 2 );
arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 3 );
arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 3 );
arrPointsInnerArea[8] = CPoint( rcItemRgn.left, rcItemRgn.top + 4 );
if( bSelected || bFirstItem )
arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 14, rcItemRgn.bottom - 1 );
else
arrPointsInnerArea[9] = CPoint( rcItemRgn.left, rcItemRgn.bottom - 1 );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
arrPointsInnerArea[i].x += 16;
arrPointsClipArea[0] = CPoint( rcItemRgn.right - 2, rcItemRgn.bottom );
arrPointsClipArea[1] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 2 );
arrPointsClipArea[2] = CPoint( rcItemRgn.left + 5, rcItemRgn.top + 2 );
arrPointsClipArea[3] = CPoint( rcItemRgn.left + 4, rcItemRgn.top + 3 );
arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 3 );
arrPointsClipArea[5] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 4 );
arrPointsClipArea[6] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 4 );
arrPointsClipArea[7] = CPoint( rcItemRgn.left, rcItemRgn.top + 5 );
if( bSelected || bFirstItem )
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left - 14, rcItemRgn.bottom );
arrPointsClipArea[9] = CPoint( rcItemRgn.left - 16, rcItemRgn.bottom );
arrPointsClipArea[10]= CPoint( rcItemRgn.left - 16, rcItemRgn.bottom );
arrPointsClipArea[11]= CPoint( rcItemRgn.right, rcItemRgn.bottom );
if( bSelected )
{
arrPointsClipArea[10].y++;
arrPointsClipArea[11].y++;
}
}
else
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left, rcItemRgn.bottom );
arrPointsClipArea[11]= CPoint( rcItemRgn.right - 2, rcItemRgn.bottom );
arrPointsClipArea[10] = arrPointsClipArea[9] = arrPointsClipArea[8];
}
arrPointsClipArea[12] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 1 );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 2 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
arrPointsClipArea[i].x += 16;
} // if( bTopLeft )
else
{
rcItemRgn.InflateRect( nItemIndex == 0 ? 0 : -1, 0, 0, 0 );
arrPointsBorders[0] = CPoint( rcItemRgn.right, rcItemRgn.top );
arrPointsBorders[1] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 3 );
arrPointsBorders[2] = CPoint( rcItemRgn.right - 3, rcItemRgn.bottom );
arrPointsBorders[3] = CPoint( rcItemRgn.left + 5, rcItemRgn.bottom );
arrPointsBorders[4] = CPoint( rcItemRgn.left + 4, rcItemRgn.bottom - 1 );
arrPointsBorders[5] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom - 1 );
arrPointsBorders[6] = CPoint( rcItemRgn.left + 2, rcItemRgn.bottom - 2 );
arrPointsBorders[7] = CPoint( rcItemRgn.left + 1, rcItemRgn.bottom - 2 );
arrPointsBorders[8] = CPoint( rcItemRgn.left - 1, rcItemRgn.bottom - 4 );
if( bSelected || bFirstItem )
{
arrPointsBorders[9] = CPoint( rcItemRgn.left - 16, rcItemRgn.top + 1 );
arrPointsBorders[10] = CPoint( rcItemRgn.left - 17, rcItemRgn.top + 1 );
}
else
{
arrPointsBorders[9]= CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
arrPointsBorders[10]= arrPointsBorders[9];
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
arrPointsBorders[i].x += 16;
arrPointsInnerArea[0] = CPoint( rcItemRgn.right - 1, rcItemRgn.top );
arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 1, rcItemRgn.bottom - 3 );
arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 3, rcItemRgn.bottom - 1 );
arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 5, rcItemRgn.bottom - 1 );
arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 4, rcItemRgn.bottom - 2 );
arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom - 2 );
arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 2, rcItemRgn.bottom - 3 );
arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 1, rcItemRgn.bottom - 3 );
arrPointsInnerArea[8] = CPoint( rcItemRgn.left - 1, rcItemRgn.bottom - 5 );
if( bSelected || bFirstItem )
arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 14, rcItemRgn.top + 1 );
else
arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
arrPointsInnerArea[i].x += 16;
arrPointsClipArea[0] = CPoint( rcItemRgn.right - 2, rcItemRgn.top );
arrPointsClipArea[1] = CPoint( rcItemRgn.right - 2, rcItemRgn.bottom - 2 );
arrPointsClipArea[2] = CPoint( rcItemRgn.left + 5, rcItemRgn.bottom - 2 );
arrPointsClipArea[3] = CPoint( rcItemRgn.left + 4, rcItemRgn.bottom - 3 );
arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom - 3 );
arrPointsClipArea[5] = CPoint( rcItemRgn.left + 2, rcItemRgn.bottom - 4 );
arrPointsClipArea[6] = CPoint( rcItemRgn.left + 1, rcItemRgn.bottom - 4 );
arrPointsClipArea[7] = CPoint( rcItemRgn.left - 1, rcItemRgn.bottom - 6 );
if( bSelected || bFirstItem )
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left - 15, rcItemRgn.top );
arrPointsClipArea[9] = CPoint( rcItemRgn.left - 16, rcItemRgn.top + 1 );
arrPointsClipArea[10]= CPoint( rcItemRgn.left - 16, rcItemRgn.top + 1 );
arrPointsClipArea[11]= CPoint( rcItemRgn.right, rcItemRgn.top + 1 );
if( bSelected )
{
arrPointsClipArea[10].y -= 1;
arrPointsClipArea[11].y -= 1;
}
}
else
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
arrPointsClipArea[11]= CPoint( rcItemRgn.right, rcItemRgn.top + 1 );
arrPointsClipArea[10] = arrPointsClipArea[9] = arrPointsClipArea[8];
}
arrPointsClipArea[12] = CPoint( rcItemRgn.right, rcItemRgn.top + 1 );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 2 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
arrPointsClipArea[i].x += 16;
} // else if( bTopLeft )
} // if( bHorz )
else
{
if( bTopLeft )
{
rcItemRgn.InflateRect( 0, nItemIndex == 0 ? 0 : -1, 0, 1 );
arrPointsBorders[0] = CPoint( rcItemRgn.right, rcItemRgn.bottom );
arrPointsBorders[1] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom );
arrPointsBorders[2] = CPoint( rcItemRgn.left, rcItemRgn.bottom - 3 );
arrPointsBorders[3] = CPoint( rcItemRgn.left, rcItemRgn.top + 5 );
arrPointsBorders[4] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 4 );
arrPointsBorders[5] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 3 );
arrPointsBorders[6] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 2 );
arrPointsBorders[7] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 1 );
arrPointsBorders[8] = CPoint( rcItemRgn.left + 3, rcItemRgn.top );
if( bSelected || bFirstItem )
{
arrPointsBorders[9] = CPoint( rcItemRgn.right - 1, rcItemRgn.top - 16 );
arrPointsBorders[10] = CPoint( rcItemRgn.right - 1, rcItemRgn.top - 17 );
}
else
{
arrPointsBorders[9] = CPoint( rcItemRgn.left + 3, rcItemRgn.top );
arrPointsBorders[10]= CPoint( rcItemRgn.right, rcItemRgn.top );
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
arrPointsBorders[i].y += 16;
arrPointsInnerArea[0] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 1 );
arrPointsInnerArea[1] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom - 1 );
arrPointsInnerArea[2] = CPoint( rcItemRgn.left + 1, rcItemRgn.bottom - 3 );
arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 1, rcItemRgn.top + 5 );
arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 4 );
arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 3);
arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 2 );
arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 1 );
arrPointsInnerArea[8] = CPoint( rcItemRgn.left + 4, rcItemRgn.top );
if( bSelected || bFirstItem )
arrPointsInnerArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top - 15 );
else
arrPointsInnerArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
arrPointsInnerArea[i].y += 16;
arrPointsClipArea[0] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 2 );
arrPointsClipArea[1] = CPoint( rcItemRgn.left + 3, rcItemRgn.bottom - 2 );
arrPointsClipArea[2] = CPoint( rcItemRgn.left + 2, rcItemRgn.bottom - 3 );
arrPointsClipArea[3] = CPoint( rcItemRgn.left + 2, rcItemRgn.top + 5 );
arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 4 );
arrPointsClipArea[5] = CPoint( rcItemRgn.left + 3, rcItemRgn.top + 3);
arrPointsClipArea[6] = CPoint( rcItemRgn.left + 4, rcItemRgn.top + 2 );
arrPointsClipArea[7] = CPoint( rcItemRgn.left + 4, rcItemRgn.top + 1 );
if( bSelected || bFirstItem )
{
arrPointsClipArea[8] = CPoint( rcItemRgn.right, rcItemRgn.top - 15 );
arrPointsClipArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top - 16 );
arrPointsClipArea[10]= CPoint( rcItemRgn.right, rcItemRgn.top - 16 );
arrPointsClipArea[11]= CPoint( rcItemRgn.right - 1, rcItemRgn.bottom );
if( bSelected )
{
arrPointsClipArea[10].x += 1;
arrPointsClipArea[11].x += 1;
}
arrPointsClipArea[12]= arrPointsClipArea[11];
}
else
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left + 5, rcItemRgn.top );
arrPointsClipArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top );
arrPointsClipArea[10]= CPoint( rcItemRgn.right, rcItemRgn.bottom );
arrPointsClipArea[12]=
arrPointsClipArea[11] =
arrPointsClipArea[10];
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
arrPointsClipArea[i].y += 16;
} // if( bTopLeft )
else
{
//rcItemRgn.InflateRect( 0, nItemIndex == 0 ? 0 : -1, 0, 0 );
arrPointsBorders[0] = CPoint( rcItemRgn.left, rcItemRgn.bottom );
arrPointsBorders[1] = CPoint( rcItemRgn.right - 3, rcItemRgn.bottom );
arrPointsBorders[2] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 3 );
arrPointsBorders[3] = CPoint( rcItemRgn.right, rcItemRgn.top + 5 );
arrPointsBorders[4] = CPoint( rcItemRgn.right - 1, rcItemRgn.top + 4 );
arrPointsBorders[5] = CPoint( rcItemRgn.right - 1, rcItemRgn.top + 3 );
arrPointsBorders[6] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 2 );
arrPointsBorders[7] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 1 );
arrPointsBorders[8] = CPoint( rcItemRgn.right - 3, rcItemRgn.top );
if( bSelected || bFirstItem )
{
arrPointsBorders[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top - 16 );
arrPointsBorders[10]= CPoint( rcItemRgn.left + 1, rcItemRgn.top - 17 );
}
else
{
arrPointsBorders[9] = CPoint( rcItemRgn.right - 3, rcItemRgn.top );
arrPointsBorders[10]= CPoint( rcItemRgn.left, rcItemRgn.top );
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
arrPointsBorders[i].y += 16;
arrPointsInnerArea[0] = CPoint( rcItemRgn.left, rcItemRgn.bottom - 1 );
arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 3, rcItemRgn.bottom - 1 );
arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 1, rcItemRgn.bottom - 3 );
arrPointsInnerArea[3] = CPoint( rcItemRgn.right - 1, rcItemRgn.top + 5 );
arrPointsInnerArea[4] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 4 );
arrPointsInnerArea[5] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 3);
arrPointsInnerArea[6] = CPoint( rcItemRgn.right - 3, rcItemRgn.top + 2 );
arrPointsInnerArea[7] = CPoint( rcItemRgn.right - 3, rcItemRgn.top + 1 );
arrPointsInnerArea[8] = CPoint( rcItemRgn.right - 4, rcItemRgn.top );
if( bSelected || bFirstItem )
arrPointsInnerArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top - 15 );
else
arrPointsInnerArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top );
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
arrPointsInnerArea[i].y += 16;
arrPointsClipArea[0] = CPoint( rcItemRgn.left + 1, rcItemRgn.bottom - 2 );
arrPointsClipArea[1] = CPoint( rcItemRgn.right - 3, rcItemRgn.bottom - 2 );
arrPointsClipArea[2] = CPoint( rcItemRgn.right - 2, rcItemRgn.bottom - 3 );
arrPointsClipArea[3] = CPoint( rcItemRgn.right - 2, rcItemRgn.top + 5 );
arrPointsClipArea[4] = CPoint( rcItemRgn.right - 3, rcItemRgn.top + 4 );
arrPointsClipArea[5] = CPoint( rcItemRgn.right - 3, rcItemRgn.top + 3);
arrPointsClipArea[6] = CPoint( rcItemRgn.right - 4, rcItemRgn.top + 2 );
arrPointsClipArea[7] = CPoint( rcItemRgn.right - 4, rcItemRgn.top + 1 );
if( bSelected || bFirstItem )
{
arrPointsClipArea[8] = CPoint( rcItemRgn.left + 1, rcItemRgn.top - 14 );
arrPointsClipArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top - 15 );
arrPointsClipArea[10]= CPoint( rcItemRgn.left + 1, rcItemRgn.top - 15 );
arrPointsClipArea[11]= CPoint( rcItemRgn.left + 1, rcItemRgn.bottom );
if( bSelected )
{
arrPointsClipArea[10].x -= 1;
arrPointsClipArea[11].x -= 1;
}
arrPointsClipArea[12]= arrPointsClipArea[11];
}
else
{
arrPointsClipArea[8] = CPoint( rcItemRgn.right - 5, rcItemRgn.top );
arrPointsClipArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top );
arrPointsClipArea[10]= CPoint( rcItemRgn.left + 1, rcItemRgn.bottom );
arrPointsClipArea[12]=
arrPointsClipArea[11] =
arrPointsClipArea[10];
}
if( bFirstVisible /*nItemIndex == 0*/ )
for( int i = 3 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
arrPointsClipArea[i].y += 16;
} // else if( bTopLeft )
} // else if( bHorz )
COLORREF clrBorderLight = (COLORREF)(-1L);
COLORREF clrBorderDark = (COLORREF)(-1L);
COLORREF clrBkLight = (COLORREF)(-1L);
COLORREF clrBkDark = (COLORREF)(-1L);
COLORREF clrText = (COLORREF)(-1L);
pWndTabs->OnTabWndQueryItemColors(
nItemIndex,
bSelected,
bHover,
bEnabled,
&clrBorderLight,
&clrBorderDark,
&clrBkLight,
&clrBkDark,
&clrText
);
if( clrForceTabText != COLORREF(-1L) )
clrText = clrForceTabText;
if( clrForceTabBk1 != COLORREF(-1L) )
clrBkLight = clrForceTabBk1;
if( clrForceTabBk2 != COLORREF(-1L) )
clrBkDark = clrForceTabBk2;
// draw item border
CBrush brushBorders( clrBorderDark );
CBrush brushBordersInnerArea( clrBorderLight );
CRgn rgnBorders, rgnBordersInnerArea, rgnClipArea;
VERIFY( rgnBorders.CreatePolygonRgn( arrPointsBorders, 11, ALTERNATE ) );
VERIFY( rgnBordersInnerArea.CreatePolygonRgn( arrPointsInnerArea, 10, ALTERNATE ) );
VERIFY( rgnClipArea.CreatePolygonRgn( arrPointsClipArea, 13, ALTERNATE ) );
dc.FrameRgn( &rgnBorders, &brushBorders, 1, 1 );
dc.FrameRgn( &rgnBordersInnerArea, &brushBordersInnerArea, 1, 1 );
// fill item background
CRect rcFill( rcItemRgn );
rcFill.InflateRect(
bHorz ? 20 : 0,
bHorz ? 0 : 20,
bHorz ? 20 : 0,
bHorz ? 0 : 20
);
if( bTopLeft )
rcFill.InflateRect(
0,
0,
bHorz ? 0 : 1,
bHorz ? 1 : 0
);
dc.SelectClipRgn( &rgnClipArea, RGN_AND );
if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
{
CExtPaintManager::stat_PaintGradientRect(
dc,
&rcFill,
bHorz
? ( bTopLeft ? clrBkDark : clrBkLight )
: ( bTopLeft ? clrBkLight : clrBkDark ),
bHorz
? ( bTopLeft ? clrBkLight : clrBkDark )
: ( bTopLeft ? clrBkDark : clrBkLight ),
bHorz
);
} // if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
else
{
dc.FillSolidRect(
&rcFill,
bSelected
? pWndTabs->PmBridge_GetPM()->GetColor( COLOR_WINDOW, pWndTabs )
: pWndTabs->PmBridge_GetPM()->GetColor( COLOR_3DFACE, pWndTabs )
);
} // else from if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
rcItem.DeflateRect(
bHorz
? __EXTTAB_ONENOTE_INDENT_LEFT
: ( bTopLeft ? __EXTTAB_ONENOTE_INDENT_TOP * 2 : __EXTTAB_ONENOTE_INDENT_BOTTOM ),
bHorz
? ( bTopLeft ? __EXTTAB_ONENOTE_INDENT_TOP : 0 )
: __EXTTAB_ONENOTE_INDENT_LEFT,
bHorz
? __EXTTAB_ONENOTE_INDENT_RIGHT
: 0,
bHorz
? 0
: __EXTTAB_ONENOTE_INDENT_RIGHT
);
// first item indent
if( bFirstVisible /*nItemIndex == 0*/ )
rcItem.DeflateRect(
bHorz ? 16 : 0,
(!bHorz) ? 16 : 0,
0,
0
);
bool bDrawIcon =
( pIcon != NULL
&& (!pIcon->IsEmpty())
&& (pWndTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0
) ? true : false;
// if tab has no icons - increase left indent
if( (!bDrawIcon) && (pWndTabs->GetTabWndStyle()&__ETWS_CENTERED_TEXT) == 0 )
rcItem.DeflateRect(
bHorz ? 4 : 0,
0,
0,
0
);
CSize _sizeIcon( 0, 0 );
if( bDrawIcon )
{
_sizeIcon = pIcon->GetSize();
ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
}
CRect rcItemForIcon( rcItem );
if( bDrawIcon
&& _sizeIcon.cx > 0
&& _sizeIcon.cy > 0
)
{
rcItemForIcon.right = rcItemForIcon.left + _sizeIcon.cx;
rcItemForIcon.bottom = rcItemForIcon.top + _sizeIcon.cy;
rcItemForIcon.OffsetRect(
bHorz ? 0 : ((rcItem.Width() - _sizeIcon.cx) / 2),
bHorz ? ((rcItem.Height() - _sizeIcon.cy) / 2) : 0
);
if( rcItemForIcon.left < rcItem.left )
rcItemForIcon.left = rcItem.left;
if( rcItemForIcon.right > rcItem.right )
rcItemForIcon.right = rcItem.right;
if( rcItemForIcon.top < rcItem.top )
rcItemForIcon.top = rcItem.top;
if( rcItemForIcon.bottom > rcItem.bottom )
rcItemForIcon.bottom = rcItem.bottom;
}
CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
CRect rcText(
rcItem.left
+ ( bHorz
? (_sizeIcon.cx + ( ( _sizeIcon.cx > 0 ) ? 2*__EXTTAB_MARGIN_ICON2TEXT_X : 0 ) )
: 0
),
rcItem.top
+ ( bHorz
? 0
: ( _sizeIcon.cy + ( ( _sizeIcon.cy > 0 ) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0 ) )
),
rcItem.right,
rcItem.bottom
);
if( ! bHorz )
{
if( pIconTabItemCloseButton != NULL )
rcText.bottom = min( rcText.bottom, rcTabItemCloseButton.top );
int nWidth0 = rcText.Width();
int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
if( nWidth1 > nWidth0 )
{
if( bInvertedVerticalMode )
{
rcText.left = rcText.right - nWidth1;
} // if( bInvertedVerticalMode )
else
{
rcText.right = rcText.left + nWidth1;
} // else from if( bInvertedVerticalMode )
} // if( nWidth1 > nWidth0 )
} // if( !bHorz )
else
{
if( pIconTabItemCloseButton != NULL )
rcText.right = min( rcText.right, rcTabItemCloseButton.left );
}
bool bDrawText = ( ( ! sItemText.IsEmpty() ) && rcText.Width() > 6 && rcText.Height() > 6 ) ? true : false;
INT nIconAlignment = CExtPaintManager::__ALIGN_HORIZ_LEFT | CExtPaintManager::__ALIGN_VERT_TOP;
if( ( ! bDrawText) && ( ! ( bGroupedMode && ( ! bInGroupActive ) ) ) )
{
if( bCenteredText )
{
nIconAlignment = CExtPaintManager::__ALIGN_HORIZ_CENTER|CExtPaintManager::__ALIGN_VERT_CENTER;
rcItemForIcon = rcItem;
}
else
rcItemForIcon.OffsetRect(
bHorz ? ( rcItem.Width() - _sizeIcon.cx ) / 2 : 0,
bHorz ? 0 : ( rcItem.Height() - _sizeIcon.cy ) / 2
);
}
if( bDrawIcon )
{
if( ( bHorz && rcItemForIcon.Width() >= _sizeIcon.cx )
|| ( ( ! bHorz ) && rcItemForIcon.Height() >= _sizeIcon.cy )
)
{
rcItemForIcon.OffsetRect(
bHorz ? 4 : 0,
bHorz ? 0 : 4
);
pWndTabs->PmBridge_GetPM()->PaintIcon(
dc,
bHorz,
pIcon,
rcItemForIcon,
false,
bEnabled,
false,
nIconAlignment
);
}
}
if( bDrawText )
{ // if we have sense to paint text on tab item
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
bool bNoPrefix = ( ( pWndTabs->GetTabWndStyleEx() & __ETWS_EX_NO_PREFIX ) != 0 ) ? true : false;
COLORREF clrOldText = dc.SetTextColor( clrText );
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
CFont * pOldFont = dc.SelectObject( pFont );
if( ! bHorz )
{
if( bCenteredText )
rcText.OffsetRect(
0,
( rcText.Height() - sizeTextMeasured.cx ) / 2
);
int nTextLength = sItemText.GetLength();
int nAmpIndex = bNoPrefix ? (-1) : int( sItemText.Find( _T(’&’) ) );
CExtSafeString sBtn;
if( nAmpIndex < 0 || bNoPrefix )
sBtn = sItemText;
else
sBtn = sItemText.Left( nAmpIndex ) + sItemText.Right( nTextLength - ( nAmpIndex + 1 ) );
if( ! bNoPrefix )
{
static TCHAR stat_strDummyAmpSeq[] = _T("\001\001");
sBtn.Replace( _T("&&"), stat_strDummyAmpSeq );
sBtn.Remove( _T(’&’) );
sBtn.Replace( stat_strDummyAmpSeq, _T("&") );
}
LOGFONT lf;
::memset( &lf, 0, sizeof(LOGFONT) );
pFont->GetLogFont(&lf);
int _cyHorzFont = abs(lf.lfHeight);
int _cyTextMargin = (rcText.Width() - _cyHorzFont) / 2;
CPoint
ptLineFrom(0,0),
ptLineTo(0,0);
if( nAmpIndex >= 0 && ( ! bNoPrefix ) )
{
ptLineFrom =
CPoint(
__ExtMfc_CXTEXTMARGIN + _cyTextMargin,
__ExtMfc_CYTEXTMARGIN + CExtPaintManager::stat_CalcTextWidth( dc, *pFont, sBtn.Left( nAmpIndex ) )
);
ptLineTo =
CPoint(
__ExtMfc_CXTEXTMARGIN + _cyTextMargin,
__ExtMfc_CYTEXTMARGIN + CExtPaintManager::stat_CalcTextWidth( dc, *pFont, sBtn.Left( nAmpIndex + 1 ) )
);
int nXOffsPlus = rcText.Width() - CExtPaintManager::stat_CalcTextDimension( dc, *pFont, sBtn ).Height();
nXOffsPlus /= 2;
nXOffsPlus -= 4;
ptLineFrom.x += nXOffsPlus;
ptLineTo.x += nXOffsPlus;
} // if( nAmpIndex >= 0 )
CRect rcString =
CRect(
CPoint(
rcText.right - _cyTextMargin + __ExtMfc_CXTEXTMARGIN,
rcText.top + __ExtMfc_CYTEXTMARGIN
),
rcText.Size() //m_sizeHorz
);
rcString.DeflateRect( 2, 2 );
if( bInvertedVerticalMode )
{
rcString.OffsetRect( 0, -2 );
CSize ptFix( -rcString.Width() + 1, 0 );
ptLineFrom.x += sizeTextMeasured.cy - 2;
ptLineFrom.y = - ptLineFrom.y + sizeTextMeasured.cx - 4;
ptLineTo.x += sizeTextMeasured.cy - 2;
ptLineTo.y = - ptLineTo.y + sizeTextMeasured.cx - 4;
ptLineFrom += rcString.TopLeft() + ptFix;
ptLineTo += rcString.TopLeft() + ptFix;
rcString.OffsetRect( - sizeTextMeasured.cy + 3, sizeTextMeasured.cx - 3 );
}
else
{
rcString.OffsetRect( -2, 0 );
CSize ptFix( -rcString.Width() + 1, 0 );
ptLineFrom += rcString.TopLeft() + ptFix;
ptLineTo += rcString.TopLeft() + ptFix;
}
dc.DrawText(
sBtn,
sBtn.GetLength(),
rcString,
DT_SINGLELINE | DT_NOCLIP | ( bNoPrefix ? (DT_NOPREFIX) : 0 )
);
if( nAmpIndex >= 0 )
{
CPen pen(
PS_SOLID,
0,
dc.GetTextColor()
);
CPen * pOldPen = dc.SelectObject( &pen );
dc.MoveTo( ptLineFrom );
dc.LineTo( ptLineTo );
dc.SelectObject( pOldPen );
} // if( nAmpIndex >= 0 )
} // if( !bHorz )
else
{
UINT nFormat =
DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS;
if( bCenteredText )
nFormat |= DT_CENTER;
else
nFormat |= DT_LEFT;
if( bNoPrefix )
nFormat |= DT_NOPREFIX;
dc.DrawText(
sItemText,
sItemText.GetLength(),
rcText,
nFormat
);
}
dc.SelectObject( pOldFont );
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrOldText );
} // if we have sense to paint text on tab item
if( pIconTabItemCloseButton != NULL )
{
ASSERT( ! pIconTabItemCloseButton->IsEmpty() );
if( dc.RectVisible( &rcTabItemCloseButton ) )
{
CRect _rcTabItemCloseButton = rcTabItemCloseButton;
if( bHorz )
{
if( bTopLeft )
_rcTabItemCloseButton.OffsetRect( 0, 1 );
}
else
{
if( bTopLeft )
_rcTabItemCloseButton.OffsetRect( 1, 0 );
}
pIconTabItemCloseButton->Paint(
g_PaintManager.GetPM(),
dc.m_hDC,
_rcTabItemCloseButton,
ePaintStateITICB
);
}
} // if( pIconTabItemCloseButton != NULL )
dc.SelectClipRgn( NULL );
}
|
|