ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
- return;
- }
-
- OnPaintToolBarGradient( dc, rcRowBk, true, (CObject*)pBar );
- }
- void CExtPaintManager::OnSysColorChange()
- {
- ASSERT_VALID( this );
- OnPaintSessionComplete( this );
- SyncSysColors();
- InitTranslatedColors();
- InitHelperBrushes();
- }
- void CExtPaintManager::OnSettingChange(
- UINT uFlags,
- __EXT_MFC_SAFE_LPCTSTR lpszSection
- )
- {
- ASSERT_VALID( this );
- uFlags;
- lpszSection;
- OnPaintSessionComplete( this );
- SyncSysColors();
- InitTranslatedColors();
- InitHelperBrushes();
- }
- void CExtPaintManager::OnDisplayChange(
- INT nDepthBPP,
- CPoint ptSizes
- )
- {
- ASSERT_VALID( this );
- nDepthBPP;
- ptSizes;
- OnPaintSessionComplete( this );
- SyncSysColors();
- InitTranslatedColors();
- InitHelperBrushes();
- }
- void CExtPaintManager::OnThemeChanged(
- WPARAM wParam,
- LPARAM lParam
- )
- {
- ASSERT_VALID( this );
- wParam;
- lParam;
- OnPaintSessionComplete( this );
- SyncSysColors();
- InitTranslatedColors();
- InitHelperBrushes();
- }
- void CExtPaintManager::OnPaintSessionComplete(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- #ifdef __TRACE_PAINT_SESSIONS
- TRACE( " PAINT_SESSION: Completen" );
- #endif // __TRACE_PAINT_SESSIONS
- pHelperSrc;
- lParam;
- }
-
- bool CExtPaintManager::OnStateSerialize(
- CArchive & ar,
- bool bEnableThrowExceptions // = false
- )
- {
- ar;
- bEnableThrowExceptions;
- return true;
- }
- CExtPaintManager::PAINTTOOLBARTEXTFIELDDATA::PAINTTOOLBARTEXTFIELDDATA()
- : m_pHelperSrc( NULL )
- , m_lParam( 0L )
- , m_nDrawTextFlags( DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX )
- , m_sText( _T("") )
- , m_rcButton( 0, 0, 0, 0 )
- , m_rcTextField( 0, 0, 0, 0 )
- , m_bComboField( false )
- , m_bHover( false )
- , m_bPushed( false )
- , m_bEnabled( false )
- {
- }
- CExtPaintManager::PAINTTOOLBARTEXTFIELDDATA::PAINTTOOLBARTEXTFIELDDATA(
- CObject * pHelperSrc,
- __EXT_MFC_SAFE_LPCTSTR sText,
- const RECT & rcButton,
- const RECT & rcTextField,
- bool bComboField,
- bool bHover,
- bool bPushed,
- bool bEnabled
- )
- : m_pHelperSrc( pHelperSrc )
- , m_lParam( 0L )
- , m_nDrawTextFlags( DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX )
- , m_sText( (sText == NULL) ? _T("") : sText )
- , m_rcButton( rcButton )
- , m_rcTextField( rcTextField )
- , m_bComboField( bComboField )
- , m_bHover( bHover )
- , m_bPushed( bPushed )
- , m_bEnabled( bEnabled )
- {
- }
- void CExtPaintManager::PaintToolbarTextField(
- CDC & dc,
- PAINTTOOLBARTEXTFIELDDATA & _ptbtfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- COLORREF clrWindow = GetColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- CRect rcTextField( _ptbtfd.m_rcButton );
- if( !_ptbtfd.m_bEnabled )
- rcTextField.DeflateRect( 1, 1 );
- if( _ptbtfd.m_bComboField )
- {
- if( _ptbtfd.m_bEnabled )
- {
- dc.FillSolidRect( &rcTextField, clrWindow );
- PAINTCOMBOFRAMEDATA _pcfd( _ptbtfd.m_pHelperSrc, rcTextField, _ptbtfd.m_bHover, _ptbtfd.m_bPushed, _ptbtfd.m_bEnabled );
- _pcfd.m_bNoTopOuterBorder = true;
- PaintComboFrame( dc, _pcfd );
- dc.SelectClipRgn( NULL );
- }
- else
- {
- dc.Draw3dRect(
- &rcTextField,
- GetColor( COLOR_WINDOW, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam ),
- GetColor( COLOR_WINDOW, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam )
- );
- INT nDD = GetDropDownButtonWidth( _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- CRect rcBtn( rcTextField );
- rcBtn.left = rcBtn.right - nDD;
- // paint arrow down
- glyph_t* pGlyph = g_DockingCaptionGlyphs[ __DCBT_ARROW_SMALL_DOWN ];
- ASSERT( pGlyph != NULL );
- COLORREF ColorValues[2] = { RGB(0,0,0), ::GetSysColor( COLOR_WINDOWTEXT ) };
- PaintGlyphCentered( dc, rcBtn, *pGlyph, ColorValues );
- }
- } // if( _ptbtfd.m_bComboField )
- else
- {
- if( _ptbtfd.m_bEnabled )
- {
- PAINTCONTROLFRAMEDATA _pcfd( _ptbtfd.m_pHelperSrc, rcTextField, true, _ptbtfd.m_bHover, _ptbtfd.m_bEnabled, false, false );
- PaintControlFrame( dc, _pcfd );
- }
- else
- {
- COLORREF clrBorder = GetColor( COLOR_WINDOW, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- dc.Draw3dRect( &rcTextField, clrBorder, clrBorder );
- }
- } // else from if( _ptbtfd.m_bComboField )
- CRect rcBk( _ptbtfd.m_rcTextField );
- if( ! _ptbtfd.m_bEnabled )
- rcBk.DeflateRect( 0, 1 );
- dc.FillSolidRect( &rcBk, clrWindow );
- if( ! _ptbtfd.m_sText.IsEmpty() )
- {
- COLORREF clrTextOld = dc.SetTextColor( ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOWTEXT : COLOR_GRAYTEXT ) );
- CFont * pFontOld = dc.SelectObject( &m_FontNormal );
- int nBkModeOld = dc.SetBkMode( TRANSPARENT );
- CRect rcText( _ptbtfd.m_rcTextField );
- rcText.left += 5;
- rcText.top += 2;
- bool bRTL = ( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false;
- DWORD dwDtAlignFlags = bRTL ? (DT_RTLREADING|DT_RIGHT) : 0;
- dc.DrawText( _ptbtfd.m_sText, _ptbtfd.m_sText.GetLength(), &rcText, _ptbtfd.m_nDrawTextFlags|dwDtAlignFlags );
- dc.SetBkMode( nBkModeOld );
- dc.SelectObject( pFontOld );
- dc.SetTextColor( clrTextOld );
- } // if( !_ptbtfd.m_sText.IsEmpty() )
- }
- void CExtPaintManagerXP::PaintToolbarTextField(
- CDC & dc,
- PAINTTOOLBARTEXTFIELDDATA & _ptbtfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- COLORREF clrDkBorder = GetColor( XPCLR_HILIGHT_BORDER, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- CRect rcTextFieldOuter( _ptbtfd.m_rcTextField );
- if( _ptbtfd.m_bHover
- || _ptbtfd.m_bPushed
- || (!_ptbtfd.m_bEnabled)
- )
- rcTextFieldOuter.InflateRect( 1, 1 );
- if( _ptbtfd.m_bComboField )
- {
- // paint combo or date field
- INT nDD = GetDropDownButtonWidth( _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- rcTextFieldOuter.right += nDD;
- CRect rcBtn( rcTextFieldOuter );
- rcBtn.left = rcBtn.right - nDD;
- if( (!(_ptbtfd.m_bHover || _ptbtfd.m_bPushed)) && _ptbtfd.m_bEnabled )
- {
- rcBtn.DeflateRect( 3, 1, 1, 1 );
- dc.ExcludeClipRect( &rcBtn );
- }
- dc.FillSolidRect( &rcTextFieldOuter, ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE ) );
- dc.SelectClipRgn( NULL );
- if( _ptbtfd.m_bHover && _ptbtfd.m_bEnabled )
- {
- PAINTPUSHBUTTONDATA _ppbd(
- _ptbtfd.m_pHelperSrc,
- true,
- rcBtn,
- _T(""),
- NULL,
- true,
- _ptbtfd.m_bHover,
- _ptbtfd.m_bPushed,
- false,
- _ptbtfd.m_bEnabled,
- true,
- false,
- false,
- 0
- );
- PaintPushButton( dc, _ppbd );
- dc.Draw3dRect( &rcTextFieldOuter, clrDkBorder, clrDkBorder );
- }
- else
- {
- if( ! _ptbtfd.m_bEnabled )
- {
- COLORREF clrBorder = GetColor( XPCLR_TEXT_FIELD_BORDER_DISABLED, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- dc.Draw3dRect( &rcTextFieldOuter, clrBorder, clrBorder );
- }
- }
- // paint arrow down
- rcBtn.top++;
- if( ! _ptbtfd.m_bEnabled )
- rcBtn.left++;
- glyph_t* pGlyph = g_DockingCaptionGlyphs[ __DCBT_ARROW_SMALL_DOWN ];
- ASSERT( pGlyph != NULL );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- _ptbtfd.m_bEnabled
- ? GetColor( _ptbtfd.m_bPushed ? COLOR_3DDKSHADOW : COLOR_WINDOWTEXT, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam )
- : ::GetSysColor( COLOR_GRAYTEXT )
- };
- PaintGlyphCentered( dc, rcBtn, *pGlyph, ColorValues );
- rcTextFieldOuter.right -= nDD;
- }
- else
- {
- // paint text field
- dc.FillSolidRect( &rcTextFieldOuter, ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE ) );
- if( _ptbtfd.m_bEnabled )
- {
- if( _ptbtfd.m_bHover || _ptbtfd.m_bPushed )
- dc.Draw3dRect( &rcTextFieldOuter, clrDkBorder, clrDkBorder );
- }
- else
- {
- COLORREF clrBorder = GetColor( XPCLR_TEXT_FIELD_BORDER_DISABLED, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- dc.Draw3dRect( &rcTextFieldOuter, clrBorder, clrBorder );
- }
- }
- if( ! _ptbtfd.m_sText.IsEmpty() )
- {
- COLORREF clrTextOld = dc.SetTextColor( ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOWTEXT : COLOR_GRAYTEXT ) );
- CFont * pFontOld = dc.SelectObject( &m_FontNormal );
- int nBkModeOld = dc.SetBkMode( TRANSPARENT );
- CRect rcText( _ptbtfd.m_rcTextField );
- rcText.left += 5;
- rcText.top += 2;
- bool bRTL = ( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false;
- DWORD dwDtAlignFlags = bRTL ? (DT_RTLREADING|DT_RIGHT) : 0;
- dc.DrawText( _ptbtfd.m_sText, _ptbtfd.m_sText.GetLength(), &rcText, _ptbtfd.m_nDrawTextFlags|dwDtAlignFlags );
- dc.SetBkMode( nBkModeOld );
- dc.SelectObject( pFontOld );
- dc.SetTextColor( clrTextOld );
- } // if( !_ptbtfd.m_sText.IsEmpty() )
- }
- COLORREF CExtPaintManager::QueryObjectTextColor(
- CDC & dc,
- bool bEnabled,
- bool bFocused,
- bool bHovered,
- bool bPressed,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- dc; bEnabled; bFocused; bHovered; bPressed; pHelperSrc; lParam;
- return COLORREF(-1L);
- }
- COLORREF CExtPaintManager::GetIconAlphaColor() const
- {
- ASSERT_VALID( this );
- return (COLORREF(-1L)); // no alpha icon effect
- }
- COLORREF CExtPaintManagerXP::GetIconAlphaColor() const
- {
- ASSERT_VALID( this );
- return (COLORREF(-1L)); // no alpha icon effect
- }
- COLORREF CExtPaintManagerOffice2003::GetIconAlphaColor() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaColor();
- COLORREF clrAlpha = ( const_cast < CExtPaintManagerOffice2003 * > ( this ) ) -> GetColor( COLOR_3DFACE, (CObject*)this );
- return clrAlpha;
- }
- COLORREF CExtPaintManagerStudio2005::GetIconAlphaColor() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaColor();
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme == ThemeLunaOlive )
- return RGB(164,164,144);
- else if( eCurrentTheme != ThemeUnknown )
- return RGB(0,0,128);
- return CExtPaintManagerOffice2003::GetIconAlphaColor();
- }
- double CExtPaintManager::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- return 0.0; // no alpha adjustment
- }
- double CExtPaintManagerXP::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- return 0.0; // no alpha adjustment
- }
- double CExtPaintManagerOffice2003::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaAdjustPercent();
- return -0.50;
- }
- double CExtPaintManagerStudio2005::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaAdjustPercent();
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme != ThemeUnknown )
- return -0.70;
- return CExtPaintManagerOffice2003::GetIconAlphaAdjustPercent();
- }
- bool CExtPaintManager::AdjustIcon(
- CExtCmdIcon * pIcon
- )
- {
- ASSERT_VALID( this );
- if( pIcon == NULL )
- {
- ASSERT( FALSE );
- return false;
- }
- if( (pIcon->m_dwFlags&__EXT_ICON_PERSISTENT_BITMAP_DISABLED) == 0 )
- {
- pIcon->m_bmpDisabled.Empty();
- pIcon->m_bmpDisabled = pIcon->m_bmpNormal;
- pIcon->m_bmpDisabled.Make32();
- pIcon->m_bmpDisabled.MakeMono();
- pIcon->m_bmpDisabled.AdjustAlpha( -0.75 );
- return true;
- }
- return false;
- }
- bool CExtPaintManagerXP::AdjustIcon(
- CExtCmdIcon * pIcon
- )
- {
- ASSERT_VALID( this );
- if( pIcon == NULL )
- {
- ASSERT( FALSE );
- return false;
- }
- if( (pIcon->m_dwFlags&__EXT_ICON_PERSISTENT_BITMAP_DISABLED) == 0 )
- {
- pIcon->m_bmpDisabled.Empty();
- pIcon->m_bmpDisabled = pIcon->m_bmpNormal;
- pIcon->m_bmpDisabled.Make32();
- COLORREF clrAccent = GetColor( XPCLR_3DFACE_NORMAL );
- double H = 0.0, S = 0.0, L = 0.0;
- CExtBitmap::stat_RGBtoHSL( clrAccent, &H, &S, &L );
- clrAccent = CExtBitmap::stat_HLStoRGB( H, L, S );
- pIcon->m_bmpDisabled.AlphaColor( RGB(255,255,255), RGB(32,32,32), 0 );
- pIcon->m_bmpDisabled.AdjustHLS( COLORREF(-1L), 0, 0.0, -1.0, -1.0 );
- pIcon->m_bmpDisabled.MakeMono( clrAccent );
- pIcon->m_bmpDisabled.AdjustHLS( COLORREF(-1L), 0, 0.0, 0.5, 0.0 );
- pIcon->m_bmpDisabled.AdjustAlpha( -0.5 );
- return true;
- }
- return false;
- }
- bool CExtPaintManagerOffice2003::AdjustIcon(
- CExtCmdIcon * pIcon
- )
- {
- ASSERT_VALID( this );
- if( pIcon == NULL )
- {
- ASSERT( FALSE );
- return false;
- }
- if( (pIcon->m_dwFlags&__EXT_ICON_PERSISTENT_BITMAP_DISABLED) == 0 )
- {
- pIcon->m_bmpDisabled.Empty();
- pIcon->m_bmpDisabled = pIcon->m_bmpNormal;
- pIcon->m_bmpDisabled.Make32();
- COLORREF clrAlpha = GetIconAlphaColor();
- if( clrAlpha == COLORREF(-1L) )
- {
- pIcon->m_bmpDisabled.MakeMono( GetColor( COLOR_3DFACE ) );
- pIcon->m_bmpDisabled.AdjustAlpha( -0.70 );
- }
- else
- {
- double H = 0.0, S = 0.0, L = 0.0;
- CExtBitmap::stat_RGBtoHSL( clrAlpha, &H, &S, &L );
- S = 0.3;
- clrAlpha = CExtBitmap::stat_HLStoRGB( H, L, S );
- pIcon->m_bmpDisabled.MakeMono( clrAlpha );
- double lfAlphaAdjustPercent = GetIconAlphaAdjustPercent();
- pIcon->m_bmpDisabled.AdjustAlpha( lfAlphaAdjustPercent );
- }
- return true;
- }
- return false;
- }
- CSize CExtPaintManager::GetResizingGriperSize(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc; lParam;
- return CSize( 16, 16 );
- }
- void CExtPaintManager::PaintResizingGripper(
- CDC & dc,
- const RECT & rcGrip,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( rcGrip.left > rcGrip.right
- || rcGrip.top > rcGrip.bottom
- || ( ! dc.RectVisible(&rcGrip) )
- )
- return;
- COLORREF clrLineShadow = GetColor( COLOR_WINDOW, pHelperSrc, lParam );
- COLORREF clrLineFace = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- CPen penLineShadow(PS_SOLID, 1, clrLineShadow);
- CPen penLineFace(PS_SOLID, 1, clrLineFace);
- CPen * pOldPen = NULL;
- CPoint ptTop = CPoint( rcGrip.right, rcGrip.bottom - 3 );
- CPoint ptBottom = CPoint( rcGrip.right - 2, rcGrip.bottom - 1 );
- for( int nLine = 0; nLine < 3; nLine++ )
- {
- pOldPen = dc.SelectObject( &penLineFace );
- dc.MoveTo( ptBottom );
- dc.LineTo( ptTop );
- ptBottom.Offset( -1, 0 );
- ptTop.Offset( 0, -1 );
- dc.MoveTo( ptBottom );
- dc.LineTo( ptTop );
- dc.SelectObject( pOldPen );
- pOldPen = dc.SelectObject( &penLineShadow );
- ptBottom.Offset( -1, 0 );
- ptTop.Offset( 0, -1 );
- dc.MoveTo( ptBottom );
- dc.LineTo( ptTop );
- dc.SelectObject( pOldPen );
-
- ptBottom.Offset( -2, 0 );
- ptTop.Offset( 0, -2 );
- }
- }
- void CExtPaintManagerOffice2003::PaintResizingGripper(
- CDC & dc,
- const RECT & rcGrip,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintResizingGripper( dc, rcGrip, pHelperSrc, lParam );
- return;
- }
- if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8 )
- {
- CExtPaintManagerXP::PaintResizingGripper( dc, rcGrip, pHelperSrc, lParam );
- return;
- }
- COLORREF clrDotShadow = GetColor( _2003CLR_GRIPPER_DOT_LIGHT, pHelperSrc, lParam );
- COLORREF clrDotFace = GetColor( _2003CLR_GRIPPER_DOT_DARK, pHelperSrc, lParam );
- static const CSize g_sizeGripDot( 2, 2 );
- static const CSize g_sizeGripDist( 1, 1 );
- static const CSize g_sizeGripShadowOffset( 1, 1 );
- CRect rcDotFace( CPoint(rcGrip.right, rcGrip.bottom), g_sizeGripDot );
- rcDotFace.OffsetRect( -g_sizeGripDot );
- CRect rcDotShadow( rcDotFace );
- rcDotFace.OffsetRect( -g_sizeGripShadowOffset );
- CRect rcDotFaceSave( rcDotFace );
- CRect rcDotShadowSave( rcDotShadow );
- int nStepH = -(g_sizeGripDot.cx + g_sizeGripDist.cx + g_sizeGripShadowOffset.cx);
- int nStepV = -(g_sizeGripDot.cy + g_sizeGripDist.cy + g_sizeGripShadowOffset.cy);
- int nDot = 0;
- for( nDot = 0; nDot < 3; nDot++ )
- {
- dc.FillSolidRect( &rcDotShadow, clrDotShadow );
- dc.FillSolidRect( &rcDotFace, clrDotFace );
- rcDotFace.OffsetRect( 0, nStepV );
- rcDotShadow.OffsetRect( 0, nStepV );
- } // for( nDot = 0; nDot < nDotCount; nDot++ )
-
- rcDotFace = rcDotFaceSave;
- rcDotShadow = rcDotShadowSave;
- rcDotFace.OffsetRect( nStepH, 0 );
- rcDotShadow.OffsetRect( nStepH, 0 );
- for( nDot = 0; nDot < 2; nDot++ )
- {
- dc.FillSolidRect( &rcDotShadow, clrDotShadow );
- dc.FillSolidRect( &rcDotFace, clrDotFace );
- rcDotFace.OffsetRect( 0, nStepV );
- rcDotShadow.OffsetRect( 0, nStepV );
- } // for( nDot = 0; nDot < 2; nDot++ )
- rcDotFace = rcDotFaceSave;
- rcDotShadow = rcDotShadowSave;
- rcDotFace.OffsetRect( nStepH*2, 0 );
- rcDotShadow.OffsetRect( nStepH*2, 0 );
- dc.FillSolidRect( &rcDotShadow, clrDotShadow );
- dc.FillSolidRect( &rcDotFace, clrDotFace );
- }
- void CExtPaintManagerOffice2007_Impl::PaintResizingGripper(
- CDC & dc,
- const RECT & rcGrip,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintResizingGripper( dc, rcGrip, pHelperSrc, lParam );
- return;
- }
- if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
- || m_bmpResizingGripper.IsEmpty()
- )
- {
- CExtPaintManagerOffice2003::PaintResizingGripper( dc, rcGrip, pHelperSrc, lParam );
- return;
- }
- CRect _rc = rcGrip;
- CSize _size = m_bmpResizingGripper.GetSize();
- _rc.left = _rc.right - _size.cx;
- _rc.top = _rc.bottom - _size.cy;
- int nOldStretchBltMode = ::GetStretchBltMode( dc.m_hDC );
- ::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
- //CExtBitmap _bmp1;
- CExtBitmap * pBmp = &m_bmpResizingGripper;
- // if( dc.GetLayout() == LAYOUT_RTL )
- // {
- // _bmp1 = m_bmpResizingGripper;
- // _bmp1.FlipHorizontal();
- // pBmp = &_bmp1;
- // } // if( dc.GetLayout() == LAYOUT_RTL )
- pBmp->AlphaBlend(
- dc.m_hDC,
- _rc.left,
- _rc.top,
- _rc.Width(),
- _rc.Height(),
- 0,
- 0,
- _size.cx,
- _size.cy
- );
- ::SetStretchBltMode(
- dc.m_hDC,
- nOldStretchBltMode
- );
- }
- void CExtPaintManagerNativeXP::PaintResizingGripper(
- CDC & dc,
- const RECT & rcGrip,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( rcGrip.left > rcGrip.right
- || rcGrip.top > rcGrip.bottom
- || ( ! dc.RectVisible(&rcGrip) )
- )
- return;
- if( (! g_PaintManager.m_UxTheme.IsControlsThemed() )
- || ( pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
- )
- )
- {
- CExtPaintManager::PaintResizingGripper( dc, rcGrip, pHelperSrc, lParam );
- return;
- }
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- ASSERT( pWnd != NULL );
- ASSERT_VALID( pWnd );
- if( g_PaintManager.m_UxTheme.OpenThemeData( pWnd->GetSafeHwnd(), VSCLASS_STATUS ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pWnd->GetSafeHwnd(),
- dc.GetSafeHdc(),
- SP_GRIPPER,
- 0,
- &rcGrip,
- &rcGrip
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- #if (!defined __EXT_MFC_NO_DATE_PICKER)
- void CExtPaintManager::PaintDatePickerPushButton(
- CDC & dc,
- const CRect & rcButton,
- LONG nButtonType, // __EDPWH_BTN_NONE or __EDPWH_BTN_TODAY
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- HFONT hFont,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- lParam;
- ASSERT( strCaption != NULL );
- nButtonType;
- if( ! dc.RectVisible(&rcButton) )
- return;
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- pHelperSrc,
- true, rcButton, strCaption,
- NULL, bFlat, bHover, bPushed,
- false, true,
- bDrawBorder,
- false, false,
- __ALIGN_HORIZ_CENTER | __ALIGN_VERT_CENTER,
- hFont
- );
- PaintPushButton( dc, _ppbd );
- }
- void CExtPaintManager::PaintDatePickerButtonsSeparator(
- CDC & dc,
- const RECT & rcSeparator,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- pHelperSrc;
- lParam;
- if( ! dc.RectVisible(&rcSeparator) )
- return;
- dc.FillSolidRect(
- &rcSeparator,
- ::GetSysColor( COLOR_3DSHADOW )
- );
- }
- void CExtPaintManager::PaintDatePickerClientArea(
- CDC & dc,
- const RECT & rcTotalClient,
- const RECT & rcUsedClient,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible(&rcTotalClient) )
- return;
- bool bTransparent = false;
- CWnd * pWnd = NULL;
- if( pHelperSrc != NULL )
- {
- ASSERT_VALID( pHelperSrc );
- pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- if( pWnd->GetSafeHwnd() != NULL )
- {
- if( GetCb2DbTransparentMode( pWnd ) )
- {
- CExtPaintManager::stat_ExcludeChildAreas(
- dc,
- pWnd->GetSafeHwnd(),
- CExtPaintManager::stat_DefExcludeChildAreaCallback
- );
- if( PaintDockerBkgnd( true, dc, pWnd ) )
- bTransparent = true;
- } // if( GetCb2DbTransparentMode( pWnd ) )
- } // if( pWnd->GetSafeHwnd() != NULL )
- } // if( pHelperSrc != NULL )
- if( ! bTransparent )
- dc.FillSolidRect(
- &rcTotalClient,
- GetColor( CExtPaintManager::CLR_3DFACE_OUT, pHelperSrc, lParam )
- );
- dc.FillSolidRect(
- &rcUsedClient,
- GetColor( COLOR_WINDOW, pHelperSrc, lParam )
- );
- }
- void CExtPaintManager::PaintDatePickerBorder(
- CDC & dc,
- const RECT & rcControl,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible(&rcControl) )
- return;
- COLORREF clrFace = GetColor( COLOR_BTNFACE, pHelperSrc, lParam );
- COLORREF clrShadow = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- COLORREF clrDkShadow = GetColor( COLOR_3DDKSHADOW, pHelperSrc, lParam );
- COLORREF clrLight = RGB(255,255,255);
- CRect rcBorders( rcControl );
- dc.Draw3dRect( rcBorders, clrFace, clrDkShadow );
- rcBorders.DeflateRect(1,1);
- dc.Draw3dRect( rcBorders, clrLight, clrShadow );
- rcBorders.DeflateRect(1,1);
- dc.Draw3dRect( rcBorders, clrFace, clrFace );
- rcBorders.DeflateRect(1,1);
- dc.Draw3dRect( rcBorders, clrShadow, clrLight );
- }
- void CExtPaintManagerXP::PaintDatePickerBorder(
- CDC & dc,
- const RECT & rcControl,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- CExtPaintManager::PaintDatePickerBorder(
- dc,
- rcControl,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerOffice2003::PaintDatePickerBorder(
- CDC & dc,
- const RECT & rcControl,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible(&rcControl) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintDatePickerBorder(
- dc,
- rcControl,
- pHelperSrc,
- lParam
- );
- return;
- }
- CBrush brBorder( GetColor( COLOR_3DSHADOW, pHelperSrc, lParam ) );
- dc.FrameRect( &rcControl, &brBorder );
- }
- void CExtPaintManager::PaintDatePickerHeaderBackground(
- INT nCol,
- INT nRow,
- CDC & dc,
- INT nYear,
- INT nMonth,
- const RECT & rcHeader,
- const RECT & rcHeaderWithoutBorders,
- const RECT & rcHeaderDate,
- const RECT & rcScrollBtnBackward,
- const RECT & rcScrollBtnForward,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- nCol;
- nRow;
- nYear;
- nMonth;
- rcHeaderDate;
- rcScrollBtnBackward;
- rcScrollBtnForward;
- dc.Draw3dRect(
- &rcHeader,
- RGB(255,255,255),
- GetColor( COLOR_3DSHADOW, pHelperSrc, lParam )
- );
- dc.FillSolidRect(
- &rcHeaderWithoutBorders,
- GetColor( CExtPaintManager::CLR_3DFACE_OUT, pHelperSrc, lParam )
- );
- }
- void CExtPaintManagerXP::PaintDatePickerHeaderBackground(
- INT nCol,
- INT nRow,
- CDC & dc,
- INT nYear,
- INT nMonth,
- const RECT & rcHeader,
- const RECT & rcHeaderWithoutBorders,
- const RECT & rcHeaderDate,
- const RECT & rcScrollBtnBackward,
- const RECT & rcScrollBtnForward,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- CExtPaintManager::PaintDatePickerHeaderBackground(
- nCol,
- nRow,
- dc,
- nYear,
- nMonth,
- rcHeader,
- rcHeaderWithoutBorders,
- rcHeaderDate,
- rcScrollBtnBackward,
- rcScrollBtnForward,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerOffice2003::PaintDatePickerHeaderBackground(
- INT nCol,
- INT nRow,
- CDC & dc,
- INT nYear,
- INT nMonth,
- const RECT & rcHeader,
- const RECT & rcHeaderWithoutBorders,
- const RECT & rcHeaderDate,
- const RECT & rcScrollBtnBackward,
- const RECT & rcScrollBtnForward,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintDatePickerHeaderBackground(
- nCol,
- nRow,
- dc,
- nYear,
- nMonth,
- rcHeader,
- rcHeaderWithoutBorders,
- rcHeaderDate,
- rcScrollBtnBackward,
- rcScrollBtnForward,
- pHelperSrc,
- lParam
- );
- return;
- }
-
- dc.FillSolidRect(
- &rcHeaderWithoutBorders,
- GetColor( CExtPaintManager::CLR_3DFACE_OUT, pHelperSrc, lParam )
- );
- }
- #endif // (!defined __EXT_MFC_NO_DATE_PICKER)
- #ifndef __EXT_MFC_NO_UNDO_REDO_POPUP
- void CExtPaintManager::PaintUndoRedoCaption(
- CDC & dc,
- const CRect & rcCaption,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- dc.FillSolidRect(
- &rcCaption,
- GetMenuFrameFillColor( this )
- );
- CRect rcFrame( rcCaption );
- rcFrame.DeflateRect( 3, 3 );
- rcFrame.OffsetRect( 0, 1 );
- dc.Draw3dRect(
- &rcFrame,
- GetColor( COLOR_3DSHADOW, pHelperSrc, lParam ),
- GetColor( COLOR_WINDOW, pHelperSrc, lParam )
- );
- LOGFONT lf = { sizeof(LOGFONT) };
- VERIFY(
- ::SystemParametersInfo(
- SPI_GETICONTITLELOGFONT,
- sizeof(LOGFONT),
- &lf,
- 0 )
- );
- lf.lfWeight = FW_NORMAL;
- CFont font;
- font.CreateFontIndirect(&lf);
-
- CFont * pOldFont = dc.SelectObject( &font );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText =
- dc.SetTextColor( GetColor( COLOR_WINDOWTEXT, pHelperSrc, lParam ) );
- // text metrics
- CExtSafeString sText( strCaption );
- UINT nFormat =
- DT_LEFT
- | DT_TOP
- ;
- if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
- nFormat |= DT_EXPANDTABS;
- CRect rcMeasureText( rcCaption );
- dc.DrawText(
- sText,
- sText.GetLength(),
- rcMeasureText,
- (nFormat|DT_CALCRECT)
- );
- // align text
- CRect rcText(
- rcFrame.left + ( rcFrame.Width() - rcMeasureText.Width() ) / 2,
- rcFrame.top + ( rcFrame.Height() - rcMeasureText.Height() ) / 2,
- rcFrame.right,
- rcFrame.bottom
- );
- dc.DrawText(
- strCaption,
- int(_tcslen(strCaption)),
- &rcText,
- (nFormat|DT_END_ELLIPSIS)
- );
-
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- }
- void CExtPaintManagerXP::PaintUndoRedoCaption(
- CDC & dc,
- const CRect & rcCaption,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- dc.FillSolidRect(
- &rcCaption,
- GetMenuFrameFillColor( this )
- );
- if( strCaption == NULL )
- return;
- LOGFONT lf = { sizeof(LOGFONT) };
- VERIFY(
- ::SystemParametersInfo(
- SPI_GETICONTITLELOGFONT,
- sizeof(LOGFONT),
- &lf,
- 0 )
- );
- lf.lfWeight = FW_NORMAL;
- CFont font;
- font.CreateFontIndirect(&lf);
-
- CFont * pOldFont = dc.SelectObject( &font );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText =
- dc.SetTextColor( GetColor( COLOR_WINDOWTEXT, pHelperSrc, lParam ) );
- // text metrics
- CExtSafeString sText( strCaption );
- UINT nFormat =
- DT_LEFT
- | DT_TOP
- ;
- if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
- nFormat |= DT_EXPANDTABS;
- CRect rcMeasureText( rcCaption );
- dc.DrawText(
- sText,
- sText.GetLength(),
- rcMeasureText,
- (nFormat|DT_CALCRECT)
- );
- // align text
- CRect rcText(
- rcCaption.left + ( rcCaption.Width() - rcMeasureText.Width() ) / 2,
- rcCaption.top + ( rcCaption.Height() - rcMeasureText.Height() ) / 2,
- rcCaption.right,
- rcCaption.bottom
- );
- dc.DrawText(
- strCaption,
- int(_tcslen(strCaption)),
- &rcText,
- (nFormat|DT_END_ELLIPSIS)
- );
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- }
- #endif // __EXT_MFC_NO_UNDO_REDO_POPUP
- #if( !defined __EXT_MFC_NO_SPIN || !defined __EXT_MFC_NO_DURATIONWND )
- CRect CExtPaintManager::Spin_QueryNcAreaMargins(
- bool bSpinAlignRight,
- bool bSpinAlignLeft,
- bool bHasScrolBars
- ) const
- {
- ASSERT_VALID( this );
- CRect rcNcAreaMargins( 0, 0, 0, 0 );
- rcNcAreaMargins.SetRect( 0, 3, 0, 3 );
- if( bSpinAlignRight )
- {
- rcNcAreaMargins.left = bHasScrolBars ? 2 : 0;
- rcNcAreaMargins.right = 3;
- }
- else if( bSpinAlignLeft )
- {
- rcNcAreaMargins.left = 3;
- rcNcAreaMargins.right = bHasScrolBars ? 2 : 0;
- }
- return rcNcAreaMargins;
- }
- CRect CExtPaintManagerNativeXP::Spin_QueryNcAreaMargins(
- bool bSpinAlignRight,
- bool bSpinAlignLeft,
- bool bHasScrolBars
- ) const
- {
- ASSERT_VALID( this );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::Spin_QueryNcAreaMargins(
- bSpinAlignRight,
- bSpinAlignLeft,
- bHasScrolBars
- );
- CRect rcNcAreaMargins( 0, 0, 0, 0 );
- rcNcAreaMargins.SetRect( 0, 1, 0, 1 );
- if( bSpinAlignRight )
- {
- rcNcAreaMargins.left = bHasScrolBars ? 2 : 0;
- rcNcAreaMargins.right = 1;
- }
- else if( bSpinAlignLeft )
- {
- rcNcAreaMargins.left = 1;
- rcNcAreaMargins.right = bHasScrolBars ? 2 : 0;
- }
- return rcNcAreaMargins;
- }
- void CExtPaintManager::PaintSpinButtonArrow(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- CFont font;
- INT nPt = max( 6, ::MulDiv( min( rcButton.Width(), rcButton.Height() ), 2, 3 ) );
- INT nPPI = ::GetDeviceCaps( dc.m_hDC, LOGPIXELSX );
- INT nPointSize = ::MulDiv( nPt * 10, 96, nPPI );
- font.CreatePointFont( nPointSize, _T("Marlett") );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- CFont * pOldFont = dc.SelectObject( &font );
- CString sArrow =
- bHorz
- ? ( bUp ? _T("3") : _T("4") )
- : ( bUp ? _T("5") : _T("6") );
- UINT nFormat = DT_LEFT | DT_TOP | DT_SINGLELINE;
- CRect rcTextDimension( rcButton );
- dc.DrawText(
- sArrow,
- sArrow.GetLength(),
- rcTextDimension,
- (nFormat | DT_CALCRECT)
- );
- CRect rcText( rcButton );
- rcText.OffsetRect(
- ( rcButton.Width() - rcTextDimension.Width() ) / 2,
- ( rcButton.Height() - rcTextDimension.Height() ) / 2
- );
- if( ( rcTextDimension.Width() & 0x01 ) == 0 )
- rcText.left ++;
- if( bPushed )
- rcText.OffsetRect( GetPushedOffset() );
- rcText.right = rcText.left + rcTextDimension.Width();
- rcText.bottom = rcText.top + rcTextDimension.Height();
- if( !bEnabled )
- {
- COLORREF clrTextBk = GetColor( COLOR_WINDOW, pHelperSrc, lParam );
- COLORREF clrTextBkOld = dc.SetTextColor( clrTextBk );
- CRect rcTextBk( rcText );
- rcTextBk.OffsetRect(1,1);
- dc.DrawText(
- sArrow,
- -1,
- rcTextBk,
- nFormat
- );
- dc.SetTextColor( clrTextBkOld );
- }
- COLORREF clrText =
- bEnabled
- ? ( (bHover && bHotTrack) ? RGB(0,0,128) : GetColor( COLOR_BTNTEXT, pHelperSrc, lParam ) )
- : GetColor( CLR_TEXT_DISABLED, pHelperSrc, lParam );
- COLORREF clrTextOld = dc.SetTextColor( clrText );
- dc.DrawText( sArrow, -1, rcText, nFormat );
- dc.SetTextColor( clrTextOld );
- dc.SelectObject( pOldFont );
- dc.SetBkMode( nOldBkMode );
- }
- void CExtPaintManager::PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( !bEnabled )
- bHover = bPushed = false;
- dc.FillSolidRect( &rcButton, GetColor( COLOR_3DFACE, pHelperSrc, lParam ) );
- // Draw border
- if( bPushed )
- {
- if( (!bFlat) || bDrawBorder )
- dc.Draw3dRect(
- rcButton,
- GetColor( CLR_3DSHADOW_IN, pHelperSrc, lParam ),
- GetColor( CLR_3DHILIGHT_IN, pHelperSrc, lParam )
- );
- }
- else
- {
- if( (!bFlat) || (bHover && bDrawBorder) )
- dc.Draw3dRect(
- rcButton,
- GetColor( CLR_3DHILIGHT_OUT, pHelperSrc, lParam ),
- GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam )
- );
- if( (!bFlat) && bHover )
- {
- CRect rcTemp( rcButton );
- dc.Draw3dRect(
- rcTemp,
- GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam ),
- GetColor( CLR_3DDKSHADOW_OUT, pHelperSrc, lParam )
- );
- rcTemp.DeflateRect(1,1);
- dc.Draw3dRect(
- rcTemp,
- GetColor( CLR_3DHILIGHT_OUT, pHelperSrc, lParam ),
- GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam )
- );
- }
- }
- // Draw arrow
- PaintSpinButtonArrow(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerXP::PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( !bEnabled )
- bHover = bPushed = false;
- COLORREF clrBk = GetColor( bFlat ? CLR_3DFACE_OUT : COLOR_3DFACE, pHelperSrc, lParam );
- if( bHover )
- clrBk = GetColor( bPushed ? XPCLR_HILIGHT : CLR_3DFACE_IN, pHelperSrc, lParam );
- else if( bPushed )
- clrBk = GetColor( XPCLR_HILIGHT, pHelperSrc, lParam );
- dc.FillSolidRect( &rcButton, clrBk );
- COLORREF clrDkBorder =
- GetColor(
- ( bHover || bPushed )
- ? XPCLR_HILIGHT_BORDER
- : ( bFlat ? XPCLR_HILIGHT_BORDER : COLOR_3DSHADOW )
- ,
- pHelperSrc,
- lParam
- );
- // Draw border
- if( bPushed )
- {
- if( (!bFlat) || bDrawBorder )
- dc.Draw3dRect( rcButton, clrDkBorder, clrDkBorder );
- }
- else
- {
- if( (!bFlat) || ( bHover && bDrawBorder ) )
- dc.Draw3dRect( rcButton, clrDkBorder, clrDkBorder );
- }
- // Draw arrow
- PaintSpinButtonArrow(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerOffice2003::PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintSpinButton(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bFlat,
- bDrawBorder,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( !bEnabled )
- bHover = bPushed = false;
-
- COLORREF clrBkLeft = COLORREF( -1L );
- COLORREF clrBkRight = COLORREF( -1L );
- if( bHover )
- {
- clrBkLeft = GetColor( bPushed ? _2003CLR_BTN_HP_LEFT : _2003CLR_BTN_HOVER_LEFT, pHelperSrc, lParam );
- clrBkRight = GetColor( bPushed ? _2003CLR_BTN_HP_RIGHT : _2003CLR_BTN_HOVER_RIGHT, pHelperSrc, lParam );
- }
- else if( bPushed )
- {
- clrBkLeft = GetColor( _2003CLR_BTN_PRESSED_LEFT, pHelperSrc, lParam );
- clrBkRight = GetColor( _2003CLR_BTN_PRESSED_RIGHT, pHelperSrc, lParam );
- }
- if( clrBkLeft != COLORREF( -1L )
- && clrBkRight != COLORREF( -1L )
- )
- {
- stat_PaintGradientRect(
- dc,
- rcButton,
- bHorz ? clrBkLeft : clrBkRight,
- bHorz ? clrBkRight : clrBkLeft,
- !bHorz
- );
- }
- else
- {
- dc.FillSolidRect(
- &rcButton,
- GetColor( bFlat ? CLR_3DFACE_OUT : COLOR_3DFACE, pHelperSrc, lParam )
- );
- }
- COLORREF clrDkBorder =
- GetColor(
- ( bHover || bPushed ) ? XPCLR_HILIGHT_BORDER : COLOR_3DSHADOW,
- pHelperSrc,
- lParam
- );
- // Draw border
- if( bPushed )
- {
- if( (!bFlat) || bDrawBorder )
- dc.Draw3dRect( rcButton, clrDkBorder, clrDkBorder );
- }
- else
- {
- if( (!bFlat) || ( bHover && bDrawBorder ) )
- dc.Draw3dRect( rcButton, clrDkBorder, clrDkBorder );
- }
- // Draw arrow
- PaintSpinButtonArrow(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerNativeXP::PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- CExtPaintManager::PaintSpinButton(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bFlat,
- bDrawBorder,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- return;
- } // if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- HWND hWnd = NULL;
- if( pHelperSrc != NULL )
- {
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CWnd ) ) )
- {
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- ASSERT_VALID( pWnd );
- hWnd = pWnd->GetSafeHwnd();
- }
- else if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtBarButton ) ) )
- {
- CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- ASSERT_VALID( pTBB );
- hWnd = pTBB->GetBar()->GetSafeHwnd();
- }
- }
- ASSERT( hWnd != NULL );
- INT nPartID = 0;
- INT nStateID = 0;
- if( bUp )
- {
- if( bHorz )
- {
- nPartID = SPNP_UPHORZ;
- nStateID =
- (!bEnabled)
- ? UPHZS_DISABLED
- : bPushed
- ? UPHZS_PRESSED
- : bHover
- ? UPHZS_HOT
- : UPHZS_NORMAL;
- }
- else
- {
- nPartID = SPNP_UP;
- nStateID =
- (!bEnabled)
- ? UPS_DISABLED
- : bPushed
- ? UPS_PRESSED
- : bHover
- ? UPS_HOT
- : UPS_NORMAL;
- }
- }
- else
- {
- if( bHorz )
- {
- nPartID = SPNP_DOWNHORZ;
- nStateID =
- (!bEnabled)
- ? DNHZS_DISABLED
- : bPushed
- ? DNHZS_PRESSED
- : bHover
- ? DNHZS_HOT
- : DNHZS_NORMAL;
- }
- else
- {
- nPartID = SPNP_DOWN;
- nStateID =
- (!bEnabled)
- ? DNS_DISABLED
- : bPushed
- ? DNS_PRESSED
- : bHover
- ? DNS_HOT
- : DNS_NORMAL;
- }
- }
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_SPIN ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWnd,
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcButton,
- &rcButton
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- void CExtPaintManagerOffice2007_Impl::PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bHorz,
- bool bEnabled,
- bool bFlat,
- bool bDrawBorder,
- bool bPushed,
- bool bHover,
- bool bHotTrack,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintSpinButton(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bFlat,
- bDrawBorder,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- return;
- }
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd;
- _ppbd.m_pHelperSrc = pHelperSrc;
- _ppbd.m_rcClient = rcButton;
- _ppbd.m_bFlat = bFlat;
- _ppbd.m_bDrawBorder = bDrawBorder;
- _ppbd.m_bHover = bHover;
- _ppbd.m_bPushed = bPushed;
- _ppbd.m_bEnabled = bEnabled;
- _ppbd.m_bTransparentBackground = true;
- PaintPushButton( dc, _ppbd );
- // Draw arrow
- PaintSpinButtonArrow(
- dc,
- rcButton,
- bUp,
- bHorz,
- bEnabled,
- bPushed,
- bHover,
- bHotTrack,
- pHelperSrc,
- lParam
- );
- }
- #endif // #if( !defined __EXT_MFC_NO_SPIN || !defined __EXT_MFC_NO_DURATIONWND )
- #ifndef __EXT_MFC_NO_DURATIONWND
- INT CExtPaintManager::Duration_GetSpinButtonWidth(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return 15;
- }
- INT CExtPaintManagerNativeXP::Duration_GetSpinButtonWidth(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::Duration_GetSpinButtonWidth(
- pHelperSrc,
- lParam
- );
- HWND hWnd = NULL;
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- hWnd = pWnd->GetSafeHwnd();
- }
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_SPIN ) != NULL )
- {
- CWindowDC dc( NULL );
- CSize szPart(0,0);
- if( g_PaintManager.m_UxTheme.GetThemePartSize(
- dc.GetSafeHdc(),
- SPNP_UPHORZ,
- 0,
- NULL,
- CExtUxTheme::__EXT_UX_TS_TRUE,
- &szPart
- ) == S_OK
- )
- return szPart.cy;
- }
-
- return 15;
- }
- INT CExtPaintManager::Duration_GetDropDownButtonWidth(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return 15;
- }
- INT CExtPaintManagerNativeXP::Duration_GetDropDownButtonWidth(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::Duration_GetDropDownButtonWidth(
- pHelperSrc,
- lParam
- );
- //HWND hWnd = NULL;
- //CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- // if( pWnd != NULL )
- // {
- // ASSERT_VALID( pWnd );
- // hWnd = pWnd->GetSafeHwnd();
- // }
- //
- // if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_COMBOBOX ) != NULL )
- // {
- // CWindowDC dc( NULL );
- // CSize szPart(0,0);
- // if( g_PaintManager.m_UxTheme.GetThemePartSize(
- // dc.GetSafeHdc(),
- // CP_DROPDOWNBUTTON,
- // CBXS_NORMAL,
- // NULL,
- // CExtUxTheme::__EXT_UX_TS_TRUE,
- // &szPart
- // ) == S_OK
- // )
- // return szPart.cx;
- // }
- //
- // return 15;
- return Duration_GetSpinButtonWidth( pHelperSrc, lParam );
- }
- CRect CExtPaintManager::Duration_GetSpinButtonExtraSpace(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return CRect( 1, 1, 1, 1 );
- }
- CRect CExtPaintManagerNativeXP::Duration_GetSpinButtonExtraSpace(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return CRect( 0, 0, 0, 0 );
- }
- CRect CExtPaintManager::Duration_GetDropDownButtonExtraSpace(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return CRect( 1, 1, 1, 1 );
- }
- CRect CExtPaintManagerNativeXP::Duration_GetDropDownButtonExtraSpace(
- const CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return CRect( 1, 0, 0, 0 );
- }
- void CExtPaintManager::Duration_PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bEnabled,
- bool bPushed,
- bool bHovered,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcButton ) )
- return;
- PaintSpinButton(
- dc,
- rcButton,
- bUp,
- false,
- bEnabled,
- false,
- false,
- bPushed,
- bHovered,
- false,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerNativeXP::Duration_PaintSpinButton(
- CDC & dc,
- const CRect & rcButton,
- bool bUp,
- bool bEnabled,
- bool bPushed,
- bool bHovered,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcButton ) )
- return;
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- CExtPaintManager::Duration_PaintSpinButton(
- dc,
- rcButton,
- bUp,
- bEnabled,
- bPushed,
- bHovered,
- pHelperSrc,
- lParam
- );
- return;
- }
- HWND hWnd = NULL;
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- hWnd = pWnd->GetSafeHwnd();
- }
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_SPIN ) != NULL )
- {
- INT nPartID = 0;
- INT nStateID = 0;
- if( bUp )
- {
- nPartID = SPNP_UP;
- nStateID =
- (!bEnabled)
- ? UPS_DISABLED
- : bPushed
- ? UPS_PRESSED
- : bHovered
- ? UPS_HOT
- : UPS_NORMAL;
- }
- else
- {
- nPartID = SPNP_DOWN;
- nStateID =
- (!bEnabled)
- ? DNS_DISABLED
- : bPushed
- ? DNS_PRESSED
- : bHovered
- ? DNS_HOT
- : DNS_NORMAL;
- }
- CRect rc( rcButton );
- rc.InflateRect( 1, bUp ? 1 : -1 , 1, bUp ? -1 : 1 );
- // drop spin button
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWnd,
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rc,
- &rc
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- void CExtPaintManager::Duration_PaintDropDownButton(
- CDC & dc,
- const CRect & rcButton,
- bool bEnabled,
- bool bPushed,
- bool bHovered,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcButton ) )
- return;
- PaintSpinButton(
- dc,
- rcButton,
- false,
- false,
- bEnabled,
- false,
- false,
- bPushed,
- bHovered,
- false,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerNativeXP::Duration_PaintDropDownButton(
- CDC & dc,
- const CRect & rcButton,
- bool bEnabled,
- bool bPushed,
- bool bHovered,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcButton ) )
- return;
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- CExtPaintManager::Duration_PaintDropDownButton(
- dc,
- rcButton,
- bEnabled,
- bPushed,
- bHovered,
- pHelperSrc,
- lParam
- );
- return;
- }
- HWND hWnd = NULL;
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- hWnd = pWnd->GetSafeHwnd();
- }
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_COMBOBOX ) != NULL )
- {
- INT nStateID =
- (!bEnabled)
- ? CBXS_DISABLED
- : bPushed
- ? CBXS_PRESSED
- : bHovered
- ? CBXS_HOT
- : CBXS_NORMAL;
- CRect rc( rcButton );
- if( ! g_PaintManager.m_bIsWinVistaOrLater )
- rc.InflateRect( 1, 1 );
- // drop down button
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWnd,
- dc.GetSafeHdc(),
- CP_DROPDOWNBUTTON,
- nStateID,
- &rc,
- &rc
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- #endif // __EXT_MFC_NO_DURATIONWND
- #ifndef __EXT_MFC_NO_SLIDER
- bool CExtPaintManager::PaintSliderChannel(
- CDC & dc,
- const CRect & rcChannel,
- bool bHorz,
- bool bEnabled,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- bHorz;
- bEnabled;
- if( ! dc.RectVisible( &rcChannel ) )
- return false;
- dc.FillSolidRect(
- &rcChannel,
- GetColor( CLR_3DFACE_OUT, pHelperSrc, lParam )
- );
- dc.Draw3dRect(
- &rcChannel,
- GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam ),
- GetColor( CLR_3DSHADOW_OUT, pHelperSrc, lParam )
- );
- return true;
- }
- bool CExtPaintManagerNativeXP::PaintSliderChannel(
- CDC & dc,
- const CRect & rcChannel,
- bool bHorz,
- bool bEnabled,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcChannel ) )
- return false;
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::PaintSliderChannel(
- dc,
- rcChannel,
- bHorz,
- bEnabled,
- pHelperSrc,
- lParam
- );
- CWnd * pWnd =
- DYNAMIC_DOWNCAST(
- CWnd,
- pHelperSrc
- );
- ASSERT( pWnd != NULL );
- ASSERT_VALID( pWnd );
- if( g_PaintManager.m_UxTheme.OpenThemeData( pWnd->GetSafeHwnd(), VSCLASS_TRACKBAR ) != NULL )
- {
- INT nPartID =
- bHorz ? TKP_TRACK : TKP_TRACKVERT;
- INT nStateID =
- bHorz ? TKS_NORMAL : TRVS_NORMAL;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pWnd->GetSafeHwnd(),
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcChannel,
- &rcChannel
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- return true;
- }
- return false;
- }
-
- bool CExtPaintManager::PaintSliderThumb(
- CDC & dc,
- const CRect & rcThumb,
- bool bHorz,
- bool bLeft,
- bool bRight,
- bool bEnabled,
- bool bPushed,
- bool bFocused,
- bool bHover,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- lParam;
- bLeft;
- bRight;
- bFocused;
- if( ! dc.RectVisible( &rcThumb ) )
- return false;
- PAINTPUSHBUTTONDATA _ppbd(
- pHelperSrc,
- bHorz,
- rcThumb,
- _T(""),
- NULL, // pIcon
- false, // bFlat
- bHover,
- bPushed,
- false, // bIndeterminate
- bEnabled,
- false, // bDrawBorder
- false, // bDrawFocusRect
- false, // bDefaultPushButton
- 0,
- NULL, // hFont
- false, // bDropDown
- 0,
- false // bTransparentBackground
- );
- PaintPushButton( dc, _ppbd );
- return true;
- }
- bool CExtPaintManagerNativeXP::PaintSliderThumb(
- CDC & dc,
- const CRect & rcThumb,
- bool bHorz,
- bool bLeft,
- bool bRight,
- bool bEnabled,
- bool bPushed,
- bool bFocused,
- bool bHover,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcThumb ) )
- return false;
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::PaintSliderThumb(
- dc,
- rcThumb,
- bHorz,
- bLeft,
- bRight,
- bEnabled,
- bPushed,
- bFocused,
- bHover,
- pHelperSrc,
- lParam
- );
- CWnd * pWnd =
- DYNAMIC_DOWNCAST(
- CWnd,
- pHelperSrc
- );
- ASSERT( pWnd != NULL );
- ASSERT_VALID( pWnd );
- if( g_PaintManager.m_UxTheme.OpenThemeData( pWnd->GetSafeHwnd(), VSCLASS_TRACKBAR ) != NULL )
- {
- INT nPartID =
- bHorz
- ? (bLeft && bRight)
- ? TKP_THUMB
- : bLeft
- ? TKP_THUMBTOP
- : TKP_THUMBBOTTOM
- : (bLeft && bRight)
- ? TKP_THUMBVERT
- : bLeft
- ? TKP_THUMBLEFT
- : TKP_THUMBRIGHT;
- INT nStateID =
- (!bEnabled)
- ? TUS_DISABLED
- : bPushed
- ? TUS_PRESSED
- : bHover
- ? TUS_HOT
- : bFocused
- ? TUS_FOCUSED
- : TUS_NORMAL;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pWnd->GetSafeHwnd(),
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcThumb,
- &rcThumb
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- return true;
- }
- return false;
- }
-
- bool CExtPaintManagerOffice2007_Impl::PaintSliderThumb(
- CDC & dc,
- const CRect & rcThumb,
- bool bHorz,
- bool bLeft,
- bool bRight,
- bool bEnabled,
- bool bPushed,
- bool bFocused,
- bool bHover,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! dc.RectVisible( &rcThumb ) )
- return false;
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::PaintSliderThumb(
- dc,
- rcThumb,
- bHorz,
- bLeft,
- bRight,
- bEnabled,
- bPushed,
- bFocused,
- bHover,
- pHelperSrc,
- lParam
- );
- PAINTPUSHBUTTONDATA _ppbd(
- pHelperSrc,
- bHorz,
- rcThumb,
- _T(""),
- NULL, // pIcon
- false, // bFlat
- bHover,
- bPushed,
- false, // bIndeterminate
- bEnabled,
- false, // bDrawBorder
- false, // bDrawFocusRect
- false, // bDefaultPushButton
- 0,
- NULL, // hFont
- false, // bDropDown
- 0,
- true // bTransparentBackground
- );
- PaintPushButton( dc, _ppbd );
- return true;
- }
- bool CExtPaintManager::PaintSliderTics(
- CDC & dc,
- const CRect & rcClient,
- bool bHorz,
- bool bEnabled,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- bHorz;
- bEnabled;
- pHelperSrc;
- lParam;
- if( ! dc.RectVisible( &rcClient ) )
- return false;
- return false;
- }
- #endif // __EXT_MFC_NO_SLIDER
- bool CExtPaintManager::PaintGroupBoxFrame(
- CDC & dc,
- const RECT & rcBorder,
- COLORREF clrFrame, // = COLORREF(-1L)
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- CWnd * pWnd =
- DYNAMIC_DOWNCAST(
- CWnd,
- pHelperSrc
- );
- ASSERT( pWnd != NULL );
- ASSERT_VALID( pWnd );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- if( clrFrame == COLORREF(-1L) )
- clrFrame = GetColor( CLR_GROUP_BOX_FRAME, pHelperSrc, lParam );
- CRect rcClient( rcBorder );
- dc.Draw3dRect(
- &rcClient,
- clrFrame,
- GetColor( COLOR_WINDOW, pHelperSrc, lParam )
- );
- rcClient.DeflateRect(1,1);
- dc.Draw3dRect(
- &rcClient,
- GetColor( COLOR_WINDOW, pHelperSrc, lParam ),
- clrFrame
- );
- } // if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- else
- {
- if( clrFrame == COLORREF(-1L) )
- {
- if( g_PaintManager.m_UxTheme.OpenThemeData( pWnd->GetSafeHwnd(), VSCLASS_BUTTON ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.DrawThemeBackground(
- dc.GetSafeHdc(),
- BP_GROUPBOX,
- pWnd->IsWindowEnabled()
- ? GBS_NORMAL
- : GBS_DISABLED,
- &rcBorder,
- &rcBorder
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- else
- {
- CBrush * pBrush =
- CBrush::FromHandle( (HBRUSH)::GetStockObject(NULL_BRUSH) );
- CBrush * pOldBrush = dc.SelectObject( pBrush );
- CPen pen;
- pen.CreatePen(
- PS_SOLID,
- 1,
- clrFrame
- );
- CPen * pOldPen = dc.SelectObject( &pen );
- dc.RoundRect(
- &rcBorder,
- CPoint( 10, 10 )
- );
- dc.SelectObject( pOldPen );
- dc.SelectObject( pOldBrush );
- }
- } // else from if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::PaintGroupBoxFrame(
- CDC & dc,
- const RECT & rcBorder,
- COLORREF clrFrame, // = COLORREF(-1L)
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
-
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::PaintGroupBoxFrame(
- dc,
- rcBorder,
- clrFrame,
- pHelperSrc,
- lParam
- );
- if( clrFrame == COLORREF(-1L) )
- clrFrame = GetColor( CLR_GROUP_BOX_FRAME, pHelperSrc, lParam );
- CBrush * pBrush =
- CBrush::FromHandle( (HBRUSH)::GetStockObject(NULL_BRUSH) );
- CBrush * pOldBrush = dc.SelectObject( pBrush );
- CPen pen;
- pen.CreatePen(
- PS_SOLID,
- 1,
- clrFrame
- );
- CPen * pOldPen = dc.SelectObject( &pen );
- dc.RoundRect(
- &rcBorder,
- CPoint( 10, 10 )
- );
- dc.SelectObject( pOldPen );
- dc.SelectObject( pOldBrush );
- return true;
- }
- bool CExtPaintManager::PaintGroupBoxLabel(
- CDC & dc,
- __EXT_MFC_SAFE_LPCTSTR strText,
- COLORREF clrText,
- HFONT hFont,
- DWORD dwDrawTextFlags,
- bool bEnabled,
- const RECT & rcText,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- lParam;
- CWnd * pWnd =
- DYNAMIC_DOWNCAST(
- CWnd,
- pHelperSrc
- );
- ASSERT( pWnd != NULL );
- ASSERT_VALID( pWnd );
- HGDIOBJ hOldFont = NULL;
- if( hFont != NULL )
- hOldFont = ::SelectObject( dc, (HGDIOBJ)hFont );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- if( clrText == COLORREF(-1L) )
- clrText =
- QueryObjectTextColor(
- dc,
- bEnabled,
- false,
- false,
- false,
- pHelperSrc
- );
- if( (! g_PaintManager.m_UxTheme.IsControlsThemed())
- || clrText != COLORREF(-1L)
- )
- {
- if( clrText == COLORREF(-1L) )
- clrText = GetColor( bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, pHelperSrc );
- COLORREF clrOldText = dc.SetTextColor( clrText );
- CRect rc( rcText );
- dc.DrawText(
- LPCTSTR(strText),
- int(_tcslen(strText)),
- rc,
- dwDrawTextFlags
- );
- dc.SetTextColor( clrOldText );
- } // if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- else
- {
- if( g_PaintManager.m_UxTheme.OpenThemeData( pWnd->GetSafeHwnd(), VSCLASS_BUTTON ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.DrawThemeText(
- dc.GetSafeHdc(),
- BP_GROUPBOX,
- bEnabled
- ? GBS_NORMAL
- : GBS_DISABLED,
- LPCTSTR(strText),
- -1,
- dwDrawTextFlags,
- NULL,
- &rcText
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- } // else from if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- dc.SetBkMode( nOldBkMode );
- if( hOldFont != NULL )
- ::SelectObject( dc, hOldFont );
- return false;
- }
- bool CExtPaintManagerOffice2003::OnQueryThemeColors(
- COLORREF *pclrFillHint,
- COLORREF *pclrAccentHint // = NULL
- )
- {
- ASSERT_VALID( this );
- if( OnQueryUseThemeColors() )
- {
- if( pclrFillHint == NULL && pclrAccentHint == NULL )
- return true;
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- if( eCurrentTheme == ThemeLunaRoyale // +2.87
- || eCurrentTheme == ThemeVistaOrLaterUX // +2.87
- || eCurrentTheme == ThemeVistaOrLaterDWM // +2.87
- )
- {
- if( pclrFillHint != NULL )
- (*pclrFillHint) = RGB(131,175,235);
- if( pclrAccentHint != NULL )
- (*pclrAccentHint) = RGB(255,200,91);
- return true;
- }
- if( pclrFillHint != NULL )
- {
- double lfEdgeLightHue, lfEdgeLightSat, lfEdgeLightLum, lfEdgeShadowHue, lfEdgeShadowSat, lfEdgeShadowLum, lfCustFillHue, lfCustFillSat, lfCustFillLum;
- CExtBitmap::stat_RGBtoHSL( g_PaintManager.m_clrUxTaskBandEdgeLightColor, &lfEdgeLightHue, &lfEdgeLightSat, &lfEdgeLightLum );
- CExtBitmap::stat_RGBtoHSL( g_PaintManager.m_clrUxTaskBandEdgeShadowColor, &lfEdgeShadowHue, &lfEdgeShadowSat, &lfEdgeShadowLum );
- CExtBitmap::stat_RGBtoHSL( g_PaintManager.m_clrUxTaskBandFillColorHint, &lfCustFillHue, &lfCustFillSat, &lfCustFillLum );
- (*pclrFillHint) = CExtBitmap::stat_HLStoRGB( lfCustFillHue, (lfEdgeLightLum+lfEdgeShadowLum)/2.0, lfCustFillSat );
- }
- if( pclrAccentHint != NULL )
- (*pclrAccentHint) = CExtBitmap::stat_HLS_Adjust( g_PaintManager.m_clrUxTaskBandAccentColorHint, 0.01, 0.00, 0.00 );
- return true;
- }
- return false;
- }
- bool CExtPaintManagerOffice2003::OnQueryUseThemeColors() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::OnQueryUseThemeColors();
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- bool bUseThemedColors = (
- g_PaintManager.m_UxTheme.IsAppThemed()
- && g_PaintManager.m_bUxValidColorsExtracted
- && ( eCurrentTheme == ThemeLunaRoyale // +2.87
- || eCurrentTheme == ThemeVistaOrLaterUX // +2.87
- || eCurrentTheme == ThemeVistaOrLaterDWM // +2.87
- || eCurrentTheme == ThemeLunaBlue
- || eCurrentTheme == ThemeLunaOlive
- || eCurrentTheme == ThemeLunaSilver
- )
- );
- return bUseThemedColors;
- }
- //////////////////////////////////////////////////////////////////////////
- // CExtPaintManagerStudio2005
- //////////////////////////////////////////////////////////////////////////
- CExtPaintManagerStudio2005::CExtPaintManagerStudio2005()
- {
- }
- CExtPaintManagerStudio2005::~CExtPaintManagerStudio2005()
- {
- }
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- void CExtPaintManagerStudio2005::TabWnd_MeasureItemAreaMargins(
- CExtTabWnd * pTabWnd,
- LONG & nSpaceBefore,
- LONG & nSpaceAfter,
- LONG & nSpaceOver
- )
- {
- ASSERT_VALID( this );
- ASSERT( pTabWnd != NULL && ::IsWindow(pTabWnd->m_hWnd) );
- ASSERT_VALID( pTabWnd );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::TabWnd_MeasureItemAreaMargins(
- pTabWnd,
- nSpaceBefore,
- nSpaceAfter,
- nSpaceOver
- );
- return;
- }
- nSpaceAfter = 2;
- nSpaceOver = 2;
- if( (pTabWnd->GetTabWndStyle() & __ETWS_GROUPED) != 0 )
- nSpaceBefore = 3;
- else
- nSpaceBefore = 0;
- }
- void CExtPaintManagerStudio2005::TabWnd_UpdateItemMeasure(
- CExtTabWnd * pTabWnd,
- CExtTabWnd::TAB_ITEM_INFO * pTii,
- CDC & dcMeasure,
- CSize & sizePreCalc
- )
- {
- ASSERT_VALID( this );
- ASSERT( pTabWnd != NULL && ::IsWindow(pTabWnd->m_hWnd) );
- ASSERT_VALID( pTabWnd );
- ASSERT_VALID( pTii );
- ASSERT( dcMeasure.GetSafeHdc() != NULL );
- ASSERT( pTii->GetTabWnd() == pTabWnd );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::TabWnd_UpdateItemMeasure(
- pTabWnd,
- pTii,
- dcMeasure,
- sizePreCalc
- );
- return;
- }
-
- bool bHorz = pTabWnd->OrientationIsHorizontal();
- LONG nItemIndex = pTii->GetIndexOf();
- switch( m_eStyle2005 )
- {
- case __ES2005_BETA1:
- case __ES2005_RC:
- break;
- case __ES2005_BETA2:
- if( bHorz )
- {
- if( nItemIndex == 0
- || nItemIndex == pTabWnd->ItemGetCount() - 1
- )
- sizePreCalc.cx += 6*2;
- sizePreCalc.cy = 19;//20;
- }
- else
- {
- if( nItemIndex == 0
- || nItemIndex == pTabWnd->ItemGetCount() - 1
- )
- sizePreCalc.cy += 6*2;
- sizePreCalc.cx = 19;//20;
- }
- break;
- default:
- {
- ASSERT( FALSE );
- AfxThrowNotSupportedException();
- }
- } // switch( m_eStyle2005 )
- }
- void CExtPaintManagerStudio2005::TabWnd_AdjustItemCloseButtonRect(
- CRect & rcCloseButton,
- CExtTabWnd * pTabWnd
- )
- {
- ASSERT_VALID( this );
- pTabWnd;
- rcCloseButton.OffsetRect( 1, 0 );
- }
- void CExtPaintManagerNativeXP::TabWnd_UpdateItemMeasure(
- CExtTabWnd * pTabWnd,
- CExtTabWnd::TAB_ITEM_INFO * pTii,
- CDC & dcMeasure,
- CSize & sizePreCalc
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTii );
- ASSERT( dcMeasure.GetSafeHdc() != NULL );
- ASSERT( pTii->GetTabWnd() == pTabWnd );
- bool bGroupedMode =
- (pTabWnd->GetTabWndStyle() & __ETWS_GROUPED) ? true : false;
- if( bGroupedMode
- || (! g_PaintManager.m_UxTheme.IsControlsThemed() )
- )
- {
- CExtPaintManager::TabWnd_UpdateItemMeasure(
- pTabWnd,
- pTii,
- dcMeasure,
- sizePreCalc
- );
- return;
- }
- CSize szPart( 18, 18 );
- if( g_PaintManager.m_UxTheme.OpenThemeData( NULL, VSCLASS_TAB ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.GetThemePartSize(
- dcMeasure.GetSafeHdc(),
- TABP_TABITEM,
- TIS_NORMAL,
- NULL,
- CExtUxTheme::__EXT_UX_TS_TRUE,
- &szPart
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
-
- INT nPartHeight = szPart.cy;
- if( pTabWnd->OrientationIsHorizontal() )
- {
- sizePreCalc.cy = nPartHeight;
- sizePreCalc.cx += 2*2;
- }
- else
- {
- sizePreCalc.cx = nPartHeight;
- sizePreCalc.cy += 2*2;
- }
- }
- void CExtPaintManagerStudio2005::GetThemeAccentTabColors(
- COLORREF * pClrSetectedTabItemText,
- COLORREF * pClrSetectedTabItemFace, // = NULL
- COLORREF * pClrSetectedTabItemBorderLight, // = NULL
- COLORREF * pClrSetectedTabItemBorderDark, // = NULL
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::GetThemeAccentTabColors(
- pClrSetectedTabItemText,
- pClrSetectedTabItemFace,
- pClrSetectedTabItemBorderLight,
- pClrSetectedTabItemBorderDark,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pClrSetectedTabItemText != NULL )
- (*pClrSetectedTabItemText) = GetColor( COLOR_BTNTEXT, pHelperSrc, lParam );
- if( pClrSetectedTabItemFace != NULL )
- (*pClrSetectedTabItemFace) = GetColor( COLOR_3DHILIGHT, pHelperSrc, lParam );
- if( pClrSetectedTabItemBorderLight != NULL )
- (*pClrSetectedTabItemBorderLight) = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- if( pClrSetectedTabItemBorderDark != NULL )
- (*pClrSetectedTabItemBorderDark) = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- }
- void CExtPaintManagerStudio2005::PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- DWORD dwOrientation,
- bool bGroupedMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- return;
- }
- CExtTabWnd * pExtTabWnd = DYNAMIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- bool bFrameBackground = false;
- if( pHelperSrc != NULL
- && pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtTabWnd))
- && ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8
- )
- {
- if( pExtTabWnd != NULL
- && ( pExtTabWnd->m_bReflectParentSizing
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- || pExtTabWnd->_IsMdiTabCtrl()
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- )
- )
- bFrameBackground = true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- else if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtDynTabWnd))
- || pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtDynAutoHideArea))
- )
- bFrameBackground = true;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- if( bFrameBackground )
- {
- CRect rcTabNearMargin( rcTabNearBorderArea ); // prepare tab border margin rect
- switch( dwOrientation )
- {
- case __ETWS_ORIENT_TOP:
- rcTabNearMargin.bottom = rcTabNearMargin.top + 1;
- break;
- case __ETWS_ORIENT_BOTTOM:
- rcTabNearMargin.top = rcTabNearMargin.bottom - 1;
- break;
- case __ETWS_ORIENT_LEFT:
- rcTabNearMargin.right = rcTabNearMargin.left + 1;
- break;
- case __ETWS_ORIENT_RIGHT:
- rcTabNearMargin.left = rcTabNearMargin.right - 1;
- break;
- #ifdef _DEBUG
- default:
- ASSERT( FALSE );
- break;
- #endif // _DEBUG
- } // switch( dwOrientation )
- CWnd * pWnd = STATIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- if( ! PaintDockerBkgnd(
- true,
- dc,
- pWnd
- )
- )
- {
- CWnd * pFrame = pWnd->GetParentFrame();
- if( pFrame == NULL )
- pFrame = pWnd->GetParent();
- ASSERT_VALID( pFrame );
- CRect rcPaintGradient;
- pFrame->GetClientRect( &rcPaintGradient );
- pFrame->ClientToScreen( &rcPaintGradient );
- ((CExtTabWnd*)pHelperSrc)->ScreenToClient( &rcPaintGradient );
- PaintDockerBkgnd(
- true,
- dc,
- rcPaintGradient,
- rcClient
- );
- }
-
- if( ! bGroupedMode )
- {
- COLORREF clrTabNearMargin =
- GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- COLORREF clrTabNearBorderAreaBk =
- (pExtTabWnd->SelectionGet() >= 0)
- ? RGB(252,252,254)
- : GetColor( CLR_3DFACE_OUT, pHelperSrc, lParam );
- // fill tab border area
- dc.FillSolidRect(
- &rcTabNearBorderArea,
- clrTabNearBorderAreaBk
- );
- // paint tab border margin
- dc.FillSolidRect(
- &rcTabNearMargin,
- clrTabNearMargin
- );
- } // if( !bGroupedMode )
- return;
- } // if( bFrameBackground )
- CExtPaintManagerXP::PaintTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- }
- void CExtPaintManagerNativeXP::PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- DWORD dwOrientation,
- bool bGroupedMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( bGroupedMode
- || pHelperSrc == NULL
- || (! g_PaintManager.m_UxTheme.IsControlsThemed() )
- )
- {
- CExtPaintManager::PaintTabClientArea( dc, rcClient, rcTabItemsArea, rcTabNearBorderArea, dwOrientation, bGroupedMode, pHelperSrc, lParam );
- return;
- }
- CWnd * pGenWnd = DYNAMIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- //CExtTabWnd * pWndTabs = NULL;
- if( pGenWnd != NULL )
- {
- ASSERT_VALID( pGenWnd );
- PaintDockerBkgnd( true, dc, pGenWnd );
- // pWndTabs = DYNAMIC_DOWNCAST( CExtTabWnd, pGenWnd );
- }
- CRect rcTabNearMargin( rcTabNearBorderArea ); // prepare tab border margin rect
- switch( dwOrientation )
- {
- case __ETWS_ORIENT_TOP:
- rcTabNearMargin.bottom = rcTabNearMargin.top + 1;
- break;
- case __ETWS_ORIENT_BOTTOM:
- rcTabNearMargin.top = rcTabNearMargin.bottom - 1;
- break;
- case __ETWS_ORIENT_LEFT:
- rcTabNearMargin.right = rcTabNearMargin.left + 1;
- break;
- case __ETWS_ORIENT_RIGHT:
- rcTabNearMargin.left = rcTabNearMargin.right - 1;
- break;
- #ifdef _DEBUG
- default:
- ASSERT( FALSE );
- break;
- #endif // _DEBUG
- } // switch( dwOrientation )
- if( g_PaintManager.m_UxTheme.OpenThemeData( pGenWnd->GetSafeHwnd(), VSCLASS_EDIT ) != NULL )
- {
- COLORREF clrBorder = COLORREF(-1L);
- VERIFY( g_PaintManager.m_UxTheme.GetThemeColor( EP_EDITTEXT, 0, TMT_BORDERCOLOR, &clrBorder ) == S_OK );
- g_PaintManager.m_UxTheme.CloseThemeData();
- dc.FillSolidRect( &rcTabNearMargin, clrBorder );
- }
- }
- void CExtPaintManagerStudio2005::PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- 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,
- CObject * pHelperSrc,
- LPARAM lParam, // = 0L
- COLORREF clrForceText, // = COLORREF(-1L)
- COLORREF clrForceTabBk, // = COLORREF(-1L)
- COLORREF clrForceTabBorderLT, // = COLORREF(-1L)
- COLORREF clrForceTabBorderRB, // = COLORREF(-1L)
- COLORREF clrForceTabSeparator, // = COLORREF(-1L)
- bool bDwmMode // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabItem(
- dc,
- rcTabItemsArea,
- bTopLeft,
- bHorz,
- bSelected,
- bCenteredText,
- bGroupedMode,
- bInGroupActive,
- bInvertedVerticalMode,
- rcEntireItem,
- sizeTextMeasured,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator,
- bDwmMode
- );
- return;
- }
- CExtCmdIcon * pIconTabItemCloseButton = NULL;
- CExtCmdIcon::e_paint_type_t ePaintStateITICB =
- (CExtCmdIcon::e_paint_type_t) CExtCmdIcon::__PAINT_INVISIBLE;
- CRect rcTabItemCloseButton( 0, 0, 0, 0 );
- INT nItemIndex = 1;
- CExtBarButton * pTBB = NULL;
- CExtTabWnd * pTabs = NULL;
- CExtTabWnd::TAB_ITEM_INFO * pTII = NULL;
- bool bNoPrefix = false;
- if( pHelperSrc != NULL )
- {
- pTabs = DYNAMIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- if( pTabs != NULL )
- {
- ASSERT_VALID( pTabs );
- pTII = pTabs->ItemGet( LONG( lParam ) );
- ASSERT( pTII != NULL );
- ASSERT_VALID( pTII );
- nItemIndex = INT(lParam);
- pIconTabItemCloseButton =
- pTabs->OnTabWndQueryItemCloseButtonShape( pTII );
- if( pIconTabItemCloseButton != NULL )
- {
- rcTabItemCloseButton = pTII->CloseButtonRectGet();
- ePaintStateITICB = (CExtCmdIcon::e_paint_type_t)
- pTabs->OnTabWndQueryItemCloseButtonPaintState( pTII );
- } // if( pIconTabItemCloseButton != NULL )
- bNoPrefix = ( ( pTabs->GetTabWndStyleEx() & __ETWS_EX_NO_PREFIX ) != 0 ) ? true : false;
- } // if( pTabs != NULL )
- else
- {
- pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- #ifdef _DEBUG
- if( pTBB != NULL )
- {
- ASSERT_VALID( pTBB );
- } // if( pTBB != NULL )
- #endif // _DEBUG
- } // else from if( pTabs != NULL )
- } // if( pHelperSrc != NULL )
- bool bEnabled = true;
- if( pTII != NULL )
- bEnabled = pTII->EnabledGet();
- else if( pTBB != NULL )
- bEnabled = pTBB->IsEnabled();
- LONG nSelectionIndex = -1;
- if( pTabs != NULL )
- nSelectionIndex = pTabs->SelectionGet();
- bool bDetectedDynTPC = false;
- bDetectedDynTPC;
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- if( pTII != NULL )
- {
- CObject * pObject = pTII->EventProviderGet();
- if( pObject != NULL )
- {
- CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pObject );
- if( pBar != NULL )
- {
- bool bFlashCaptionHighlightedState = false;
- if( pBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
- {
- if( bFlashCaptionHighlightedState )
- {
- clrForceText = pBar->m_clrFlashCaptionText;
- clrForceTabBk = pBar->m_clrFlashCaptionBackground;
- bSelected = true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bDetectedDynTPC = true;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- }
- }
- }
- }
- #endif// (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- COLORREF clrText = clrForceText;
- if( clrText == COLORREF(-1L) )
- clrText = GetColor( bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, pHelperSrc, lParam );
- COLORREF clrTabBorderLT = clrForceTabBorderLT;
- if( clrTabBorderLT == COLORREF(-1L) )
- clrTabBorderLT = GetColor( bGroupedMode ? COLOR_3DSHADOW : COLOR_3DHILIGHT, pHelperSrc, lParam );
- COLORREF clrTabBorderRB = clrForceTabBorderRB;
- if( clrTabBorderRB == COLORREF(-1L) )
- clrTabBorderRB = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- COLORREF clrBkLight = clrForceTabBk;
- if( clrBkLight == COLORREF(-1L) )
- clrBkLight = GetColor( COLOR_3DHILIGHT, this );
- COLORREF clrBkDark = clrForceTabBk;
- if( clrBkDark == COLORREF(-1L) )
- clrBkDark = GetColor( COLOR_3DLIGHT, this );
- bool bInGroupFirst = false;
- bool bInGroupLast = false;
- if( bGroupedMode && pTII != NULL )
- {
- ASSERT( pTabs != NULL );
- CExtTabWnd::TAB_ITEM_INFO * pTiiFirst = pTII->GetInGroupFirst();
- CExtTabWnd::TAB_ITEM_INFO * pTiiLast = pTII->GetInGroupLast();
- ASSERT_VALID( pTiiFirst );
- ASSERT_VALID( pTiiLast );
- bInGroupFirst = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiFirst ) );
- bInGroupLast = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiLast ) );
- }
- bool bFirstItem = false, bLastItem = false;
- if( pTII != NULL )
- {
- ASSERT( pTabs != NULL );
- bFirstItem =
- ( nItemIndex == 0
- || ( bInGroupFirst
- && nItemIndex != nSelectionIndex
- )
- );
- bLastItem =
- ( nItemIndex == pTabs->ItemGetCount() - 1
- || ( bInGroupLast
- && nItemIndex != nSelectionIndex
- )
- );
- }
- CRect rcItem( rcEntireItem );
- if( m_eStyle2005 == __ES2005_BETA2 )
- {
- POINT arrPointsBorders[10] =
- { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
- { 0, 0 }, { 0, 0 },
- };
- POINT arrPointsClipArea[10] =
- { { 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 arrPointsSelectedLine[2] =
- { { 0, 0 }, { 0, 0 },
- };
- if( bHorz )
- {
- if( (bTopLeft && !bGroupedMode) || (!bTopLeft && bGroupedMode) )
- {
- // BORDERS
- // right side
- arrPointsBorders[0] = CPoint( rcItem.right + 6, rcItem.bottom );
- arrPointsBorders[1] = CPoint( rcItem.right, rcItem.top + 6 );
- arrPointsBorders[2] = CPoint( rcItem.right - 5, rcItem.top + 1 );
- arrPointsBorders[3] = CPoint( rcItem.right - 6, rcItem.top + 1 );
- arrPointsBorders[4] = CPoint( rcItem.right - 7, rcItem.top );
- // left side
- arrPointsBorders[5] = CPoint( rcItem.left + 7, rcItem.top );
- arrPointsBorders[6] = CPoint( rcItem.left + 6, rcItem.top + 1 );
- arrPointsBorders[7] = CPoint( rcItem.left + 5, rcItem.top + 1 );
- arrPointsBorders[8] = CPoint( rcItem.left, rcItem.top + 6 );
- arrPointsBorders[9] = CPoint( rcItem.left - 6, rcItem.bottom );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsBorders[0] = CPoint( rcItem.right - 6, rcItem.bottom );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsBorders[9] = CPoint( rcItem.left + 6, rcItem.bottom );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
- arrPointsBorders[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsBorders[i].x -= 6;
- }
- // CLIP REGION
- // right side
- arrPointsClipArea[0] = CPoint( rcItem.right + 5, rcItem.bottom + 1 );
- arrPointsClipArea[1] = CPoint( rcItem.right - 1, rcItem.top + 7 );
- arrPointsClipArea[2] = CPoint( rcItem.right - 4, rcItem.top + 3 );
- arrPointsClipArea[3] = CPoint( rcItem.right - 5, rcItem.top + 3 );
- arrPointsClipArea[4] = CPoint( rcItem.right - 6, rcItem.top + 2 );
- // left side
- arrPointsClipArea[5] = CPoint( rcItem.left + 7, rcItem.top + 2 );
- arrPointsClipArea[6] = CPoint( rcItem.left + 6, rcItem.top + 3 );
- arrPointsClipArea[7] = CPoint( rcItem.left + 5, rcItem.top + 3 );
- arrPointsClipArea[8] = CPoint( rcItem.left + 1, rcItem.top + 7 );
- arrPointsClipArea[9] = CPoint( rcItem.left - 5, rcItem.bottom + 1);
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- {
- arrPointsClipArea[0] = CPoint( rcItem.right - 6, rcItem.bottom );
- arrPointsClipArea[1] = CPoint( rcItem.right - 1, rcItem.top + 7 );
- }
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- {
- arrPointsClipArea[8] = CPoint( rcItem.left + 1, rcItem.top + 7 );
- arrPointsClipArea[9] = CPoint( rcItem.left + 7, rcItem.bottom );
- }
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]); i++ )
- arrPointsClipArea[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsClipArea[i].x -= 6;
- }
- // INNER AREA
- // right side
- arrPointsInnerArea[0] = CPoint( rcItem.right + 5, rcItem.bottom );
- arrPointsInnerArea[1] = CPoint( rcItem.right - 1, rcItem.top + 6 );
- arrPointsInnerArea[2] = CPoint( rcItem.right - 5, rcItem.top + 2 );
- arrPointsInnerArea[3] = CPoint( rcItem.right - 6, rcItem.top + 2 );
- arrPointsInnerArea[4] = CPoint( rcItem.right - 7, rcItem.top + 1 );
- // left side
- arrPointsInnerArea[5] = CPoint( rcItem.left + 7, rcItem.top + 1 );
- arrPointsInnerArea[6] = CPoint( rcItem.left + 6, rcItem.top + 2 );
- arrPointsInnerArea[7] = CPoint( rcItem.left + 5, rcItem.top + 2 );
- arrPointsInnerArea[8] = CPoint( rcItem.left + 1, rcItem.top + 6 );
- arrPointsInnerArea[9] = CPoint( rcItem.left - 5, rcItem.bottom );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsInnerArea[0] = CPoint( rcItem.right - 1, rcItem.top + 7 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsInnerArea[9] = CPoint( rcItem.left + 1, rcItem.top + 7 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
- arrPointsInnerArea[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsInnerArea[i].x -= 6;
- }
- arrPointsSelectedLine[0] = CPoint( arrPointsBorders[0].x, arrPointsBorders[0].y + 1 );
- arrPointsSelectedLine[1] = CPoint( arrPointsBorders[9].x - 1, arrPointsBorders[9].y + 1 );
- }
- else
- {
- // BORDERS
- // right side
- arrPointsBorders[0] = CPoint( rcItem.right + 6, rcItem.top );
- arrPointsBorders[1] = CPoint( rcItem.right, rcItem.bottom - 6 );
- arrPointsBorders[2] = CPoint( rcItem.right - 5, rcItem.bottom - 1 );
- arrPointsBorders[3] = CPoint( rcItem.right - 6, rcItem.bottom - 1 );
- arrPointsBorders[4] = CPoint( rcItem.right - 7, rcItem.bottom );
- // left side
- arrPointsBorders[5] = CPoint( rcItem.left + 7, rcItem.bottom );
- arrPointsBorders[6] = CPoint( rcItem.left + 6, rcItem.bottom - 1 );
- arrPointsBorders[7] = CPoint( rcItem.left + 5, rcItem.bottom - 1 );
- arrPointsBorders[8] = CPoint( rcItem.left, rcItem.bottom - 6 );
- arrPointsBorders[9] = CPoint( rcItem.left - 6, rcItem.top );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsBorders[0] = CPoint( rcItem.right - 6, rcItem.top );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsBorders[9] = CPoint( rcItem.left + 6, rcItem.top );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
- arrPointsBorders[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsBorders[i].x -= 6;
- }
-
- // CLIP REGION
- // right side
- arrPointsClipArea[0] = CPoint( rcItem.right + 5, rcItem.top );
- arrPointsClipArea[1] = CPoint( rcItem.right - 2, rcItem.bottom - 5 );
- arrPointsClipArea[2] = CPoint( rcItem.right - 5, rcItem.bottom - 2 );
- arrPointsClipArea[3] = CPoint( rcItem.right - 6, rcItem.bottom - 2 );
- arrPointsClipArea[4] = CPoint( rcItem.right - 7, rcItem.bottom - 1 );
- // left side
- arrPointsClipArea[5] = CPoint( rcItem.left + 7, rcItem.bottom - 1 );
- arrPointsClipArea[6] = CPoint( rcItem.left + 6, rcItem.bottom - 2 );
- arrPointsClipArea[7] = CPoint( rcItem.left + 5, rcItem.bottom - 2 );
- arrPointsClipArea[8] = CPoint( rcItem.left + 2, rcItem.bottom - 6 );
- arrPointsClipArea[9] = CPoint( rcItem.left - 5, rcItem.top );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- {
- arrPointsClipArea[0] = CPoint( rcItem.right - 6, rcItem.top );
- arrPointsClipArea[1] = CPoint( rcItem.right, rcItem.bottom - 7 );
- }
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- {
- arrPointsClipArea[8] = CPoint( rcItem.left + 1, rcItem.bottom - 7 );
- arrPointsClipArea[9] = CPoint( rcItem.left + 7, rcItem.top );
- }
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]); i++ )
- arrPointsClipArea[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsClipArea[i].x -= 6;
- }
- // INNER AREA
- // right side
- arrPointsInnerArea[0] = CPoint( rcItem.right + 5, rcItem.top );
- arrPointsInnerArea[1] = CPoint( rcItem.right - 1, rcItem.bottom - 6 );
- arrPointsInnerArea[2] = CPoint( rcItem.right - 5, rcItem.bottom - 2 );
- arrPointsInnerArea[3] = CPoint( rcItem.right - 6, rcItem.bottom - 2 );
- arrPointsInnerArea[4] = CPoint( rcItem.right - 7, rcItem.bottom - 1 );
- // left side
- arrPointsInnerArea[5] = CPoint( rcItem.left + 7, rcItem.bottom - 1 );
- arrPointsInnerArea[6] = CPoint( rcItem.left + 6, rcItem.bottom - 2 );
- arrPointsInnerArea[7] = CPoint( rcItem.left + 5, rcItem.bottom - 2 );
- arrPointsInnerArea[8] = CPoint( rcItem.left + 1, rcItem.bottom - 6 );
- arrPointsInnerArea[9] = CPoint( rcItem.left - 5, rcItem.top );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsInnerArea[0] = CPoint( rcItem.right - 1, rcItem.bottom - 7 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsInnerArea[9] = CPoint( rcItem.left + 1, rcItem.bottom - 7 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
- arrPointsInnerArea[i].x += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsInnerArea[i].x -= 6;
- }
-
- arrPointsSelectedLine[0] = CPoint( arrPointsBorders[0].x, arrPointsBorders[0].y - 1 );
- arrPointsSelectedLine[1] = CPoint( arrPointsBorders[9].x - 1, arrPointsBorders[9].y - 1 );
- }
- } // if( bHorz )
- else
- {
- if( (bTopLeft && !bGroupedMode) || (!bTopLeft && bGroupedMode) )
- {
- // BORDERS
- // right side
- arrPointsBorders[0] = CPoint( rcItem.right, rcItem.bottom + 6 );
- arrPointsBorders[1] = CPoint( rcItem.left + 6, rcItem.bottom );
- arrPointsBorders[2] = CPoint( rcItem.left + 1, rcItem.bottom - 5 );
- arrPointsBorders[3] = CPoint( rcItem.left + 1, rcItem.bottom - 6 );
- arrPointsBorders[4] = CPoint( rcItem.left, rcItem.bottom - 7 );
- // left side
- arrPointsBorders[5] = CPoint( rcItem.left, rcItem.top + 7 );
- arrPointsBorders[6] = CPoint( rcItem.left + 1, rcItem.top + 6 );
- arrPointsBorders[7] = CPoint( rcItem.left + 1, rcItem.top + 5 );
- arrPointsBorders[8] = CPoint( rcItem.left + 6, rcItem.top );
- arrPointsBorders[9] = CPoint( rcItem.right, rcItem.top - 6 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsBorders[0] = CPoint( rcItem.right, rcItem.bottom - 6 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsBorders[9] = CPoint( rcItem.right, rcItem.top + 6 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
- arrPointsBorders[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsBorders[i].y -= 6;
- }
- // CLIP REGION
- // right side
- arrPointsClipArea[0] = CPoint( rcItem.right + 1,rcItem.bottom + 5 );
- arrPointsClipArea[1] = CPoint( rcItem.left + 6, rcItem.bottom - 2 );
- arrPointsClipArea[2] = CPoint( rcItem.left + 3, rcItem.bottom - 5 );
- arrPointsClipArea[3] = CPoint( rcItem.left + 3, rcItem.bottom - 6 );
- arrPointsClipArea[4] = CPoint( rcItem.left + 2, rcItem.bottom - 7 );
- // left side
- arrPointsClipArea[5] = CPoint( rcItem.left + 2, rcItem.top + 7 );
- arrPointsClipArea[6] = CPoint( rcItem.left + 3, rcItem.top + 6 );
- arrPointsClipArea[7] = CPoint( rcItem.left + 3, rcItem.top + 5 );
- arrPointsClipArea[8] = CPoint( rcItem.left + 6, rcItem.top + 2 );
- arrPointsClipArea[9] = CPoint( rcItem.right + 1,rcItem.top - 5 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- {
- arrPointsClipArea[0] = CPoint( rcItem.right + 1,rcItem.bottom - 7 );
- arrPointsClipArea[1] = CPoint( rcItem.left + 7, rcItem.bottom - 1 );
- }
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- {
- arrPointsClipArea[8] = CPoint( rcItem.left + 7, rcItem.top + 1 );
- arrPointsClipArea[9] = CPoint( rcItem.right + 1,rcItem.top + 7 );
- }
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]); i++ )
- arrPointsClipArea[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsClipArea[i].y -= 6;
- }
- // INNER AREA
-
- // right side
- arrPointsInnerArea[0] = CPoint( rcItem.right, rcItem.bottom + 5 );
- arrPointsInnerArea[1] = CPoint( rcItem.left + 6, rcItem.bottom - 1 );
- arrPointsInnerArea[2] = CPoint( rcItem.left + 2, rcItem.bottom - 5 );
- arrPointsInnerArea[3] = CPoint( rcItem.left + 2, rcItem.bottom - 6 );
- arrPointsInnerArea[4] = CPoint( rcItem.left + 1, rcItem.bottom - 7 );
- // left side
- arrPointsInnerArea[5] = CPoint( rcItem.left + 1, rcItem.top + 7 );
- arrPointsInnerArea[6] = CPoint( rcItem.left + 2, rcItem.top + 6 );
- arrPointsInnerArea[7] = CPoint( rcItem.left + 2, rcItem.top + 5 );
- arrPointsInnerArea[8] = CPoint( rcItem.left + 6, rcItem.top + 1 );
- arrPointsInnerArea[9] = CPoint( rcItem.right, rcItem.top - 5 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsInnerArea[0] = CPoint( rcItem.right, rcItem.bottom - 5 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsInnerArea[9] = CPoint( rcItem.right, rcItem.top + 7 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
- arrPointsInnerArea[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsInnerArea[i].y -= 6;
- }
-
- arrPointsSelectedLine[0] = CPoint( arrPointsInnerArea[0].x + 1, arrPointsInnerArea[0].y + 1 );
- arrPointsSelectedLine[1] = CPoint( arrPointsInnerArea[9].x + 1, arrPointsInnerArea[9].y - 2 );
- }
- else
- {
- // BORDERS
- // right side
- arrPointsBorders[0] = CPoint( rcItem.left, rcItem.bottom + 6 );
- arrPointsBorders[1] = CPoint( rcItem.right - 6, rcItem.bottom );
- arrPointsBorders[2] = CPoint( rcItem.right - 1, rcItem.bottom - 5 );
- arrPointsBorders[3] = CPoint( rcItem.right - 1, rcItem.bottom - 6 );
- arrPointsBorders[4] = CPoint( rcItem.right, rcItem.bottom - 7 );
- // left side
- arrPointsBorders[5] = CPoint( rcItem.right, rcItem.top + 7 );
- arrPointsBorders[6] = CPoint( rcItem.right - 1, rcItem.top + 6 );
- arrPointsBorders[7] = CPoint( rcItem.right - 1, rcItem.top + 5 );
- arrPointsBorders[8] = CPoint( rcItem.right - 6, rcItem.top );
- arrPointsBorders[9] = CPoint( rcItem.left, rcItem.top - 6 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsBorders[0] = CPoint( rcItem.left, rcItem.bottom - 6 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsBorders[9] = CPoint( rcItem.left, rcItem.top + 6 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
- arrPointsBorders[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsBorders[i].y -= 6;
- }
- // CLIP REGION
- // right side
- arrPointsClipArea[0] = CPoint( rcItem.left - 0, rcItem.bottom + 5 );
- arrPointsClipArea[1] = CPoint( rcItem.right - 5, rcItem.bottom - 2 );
- arrPointsClipArea[2] = CPoint( rcItem.right - 2, rcItem.bottom - 5 );
- arrPointsClipArea[3] = CPoint( rcItem.right - 2, rcItem.bottom - 6 );
- arrPointsClipArea[4] = CPoint( rcItem.right - 1, rcItem.bottom - 7 );
- // left side
- arrPointsClipArea[5] = CPoint( rcItem.right - 1, rcItem.top + 7 );
- arrPointsClipArea[6] = CPoint( rcItem.right - 2, rcItem.top + 6 );
- arrPointsClipArea[7] = CPoint( rcItem.right - 2, rcItem.top + 5 );
- arrPointsClipArea[8] = CPoint( rcItem.right - 5, rcItem.top + 2 );
- arrPointsClipArea[9] = CPoint( rcItem.left - 0, rcItem.top - 5 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- {
- arrPointsClipArea[0] = CPoint( rcItem.left - 0,rcItem.bottom - 7 );
- arrPointsClipArea[1] = CPoint( rcItem.right - 7, rcItem.bottom - 1 );
- }
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- {
- arrPointsClipArea[8] = CPoint( rcItem.right - 7, rcItem.top + 1 );
- arrPointsClipArea[9] = CPoint( rcItem.left - 0,rcItem.top + 7 );
- }
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]); i++ )
- arrPointsClipArea[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsClipArea[i].y -= 6;
- }
- // INNER AREA
-
- // right side
- arrPointsInnerArea[0] = CPoint( rcItem.left, rcItem.bottom + 5 );
- arrPointsInnerArea[1] = CPoint( rcItem.right - 6, rcItem.bottom - 1 );
- arrPointsInnerArea[2] = CPoint( rcItem.right - 2, rcItem.bottom - 5 );
- arrPointsInnerArea[3] = CPoint( rcItem.right - 2, rcItem.bottom - 6 );
- arrPointsInnerArea[4] = CPoint( rcItem.right - 1, rcItem.bottom - 7 );
- // left side
- arrPointsInnerArea[5] = CPoint( rcItem.right - 1, rcItem.top + 7 );
- arrPointsInnerArea[6] = CPoint( rcItem.right - 2, rcItem.top + 6 );
- arrPointsInnerArea[7] = CPoint( rcItem.right - 2, rcItem.top + 5 );
- arrPointsInnerArea[8] = CPoint( rcItem.right - 6, rcItem.top + 1 );
- arrPointsInnerArea[9] = CPoint( rcItem.left, rcItem.top - 5 );
- if( nSelectionIndex > nItemIndex && !bGroupedMode )
- {
- if( !bLastItem )
- arrPointsInnerArea[0] = CPoint( rcItem.left, rcItem.bottom - 5 );
- }
- else if( nSelectionIndex < nItemIndex || bGroupedMode )
- {
- if( !bFirstItem && !bInGroupFirst )
- arrPointsInnerArea[9] = CPoint( rcItem.left, rcItem.top + 7 );
- }
- if( nItemIndex == 0 )
- {
- // first item in tab window
- for( int i = 5; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
- arrPointsInnerArea[i].y += 6;
- }
- else if( pTabs != NULL && nItemIndex == ( pTabs->ItemGetCount() - 1 ) )
- {
- // last item in tab window
- for( int i = 0; i < 5; i++ )
- arrPointsInnerArea[i].y -= 6;
- }
-
- arrPointsSelectedLine[0] = CPoint( arrPointsBorders[0].x - 1, arrPointsBorders[0].y );
- arrPointsSelectedLine[1] = CPoint( arrPointsBorders[9].x - 1, arrPointsBorders[9].y - 1 );
- }
- } // else if( bHorz )
- // draw item borders
- CPen pen( PS_SOLID, 1, clrTabBorderRB );
- CPen * pOldPen = dc.SelectObject( &pen );
- INT nPointsBordersCount = sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]);
- int i = 0;
- for( i = 0; i < nPointsBordersCount - 1; i++ )
- {
- dc.MoveTo( arrPointsBorders[i] );
- dc.LineTo( arrPointsBorders[i + 1] );
- }
- dc.MoveTo( arrPointsBorders[ nPointsBordersCount - 1 ] );
- dc.LineTo( arrPointsBorders[ nPointsBordersCount - 2 ] );
- dc.SelectObject( pOldPen );
- pen.DeleteObject();
- // draw inner item borders
- COLORREF clrInnerDark = GetColor( COLOR_3DFACE, this );
- COLORREF clrInnerLight = RGB(252,252,254);
- if( nItemIndex == nSelectionIndex && !bGroupedMode )
- clrInnerDark = clrInnerLight;
- pen.CreatePen( PS_SOLID, 1, clrInnerDark );
- pOldPen = dc.SelectObject( &pen );
- int nLastDarkPoint = bGroupedMode && bTopLeft ? 5 : 4;
- for( i = 0; i <= nLastDarkPoint; i++ )
- {
- dc.MoveTo( arrPointsInnerArea[i] );
- dc.LineTo( arrPointsInnerArea[i + 1] );
- }
- dc.SelectObject( pOldPen );
- pen.DeleteObject();
-
- pen.CreatePen( PS_SOLID, 1, clrInnerLight );
- pOldPen = dc.SelectObject( &pen );
- int nFirstLightPoint = bGroupedMode && bTopLeft ? 6 : 4;
- for( i = nFirstLightPoint; i <= 8; i++ )
- {
- dc.MoveTo( arrPointsInnerArea[i] );
- dc.LineTo( arrPointsInnerArea[i + 1] );
- }
- dc.SelectObject( pOldPen );
- pen.DeleteObject();
- // selected item
- if( nItemIndex == nSelectionIndex && !bGroupedMode )
- {
- pen.CreatePen( PS_SOLID, 1, RGB(252,252,254) );
- pOldPen = dc.SelectObject( &pen );
- dc.MoveTo( arrPointsSelectedLine[0] );
- dc.LineTo( arrPointsSelectedLine[1] );
- dc.SelectObject( pOldPen );
- pen.DeleteObject();
- }
-
- CRgn rgnClipArea;
- VERIFY( rgnClipArea.CreatePolygonRgn( arrPointsClipArea, 10, ALTERNATE ) );
-
- // fill item background
- CRect rcFill( rcTabItemsArea );
- dc.SelectClipRgn( &rgnClipArea, RGN_AND );
- if( !(nItemIndex == nSelectionIndex && !bGroupedMode)
- && ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8
- )
- {
- COLORREF clr1 =
- bHorz
- ? ( bTopLeft && !bGroupedMode ? clrBkDark : clrBkLight )
- : ( bTopLeft && !bGroupedMode ? clrBkLight : clrBkDark )
- ;
- COLORREF clr2 =
- bHorz
- ? ( bTopLeft && !bGroupedMode ? clrBkLight : clrBkDark )
- : ( bTopLeft && !bGroupedMode ? clrBkDark : clrBkLight )
- ;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clr1 = clr2 = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clr1 = clr2 = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- stat_PaintGradientRect(
- dc,
- &rcFill,
- clr1,
- clr2,
- bHorz
- );
- }
- else
- {
- COLORREF clrFill =
- ( nItemIndex == nSelectionIndex )
- ? RGB(252,252,254)
- : GetColor( COLOR_3DFACE, this )
- ;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrFill = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrFill = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- dc.FillSolidRect( &rcFill, clrFill );
- }
-
- #define __EXTTAB_BETA2_INDENT_TOP 2
- #define __EXTTAB_BETA2_INDENT_BOTTOM 2
- #define __EXTTAB_BETA2_INDENT_LEFT 3
- #define __EXTTAB_BETA2_INDENT_RIGHT 1
- rcItem.DeflateRect(
- bHorz
- ? __EXTTAB_BETA2_INDENT_LEFT
- : __EXTTAB_BETA2_INDENT_TOP,
- bHorz
- ? __EXTTAB_BETA2_INDENT_TOP
- : __EXTTAB_BETA2_INDENT_LEFT,
- bHorz
- ? __EXTTAB_BETA2_INDENT_RIGHT
- : __EXTTAB_BETA2_INDENT_TOP,
- bHorz
- ? __EXTTAB_BETA2_INDENT_BOTTOM
- : __EXTTAB_BETA2_INDENT_RIGHT
- );
-
- // first item indent
- if( nItemIndex == 0 )
- rcItem.DeflateRect(
- bHorz ? 6 : 0,
- !bHorz ? 6 : 0,
- bHorz ? 6 : 0,
- !bHorz ? 6 : 0
- );
- }
- else if( m_eStyle2005 == __ES2005_BETA1
- || m_eStyle2005 == __ES2005_RC
- )
- {
- POINT arrPointsBorders[6] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0} };
- POINT arrPointsInnerArea[6] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0} };
- POINT arrPointsItemsSeparator[2] = { {0,0}, {0,0} };
- if( bHorz )
- {
- bool bNewTopLeft = bGroupedMode ? !bTopLeft : bTopLeft;
- if( bNewTopLeft )
- {
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.bottom - 1 );
- arrPointsBorders[1] = CPoint(rcItem.left, rcItem.top + 2 );
- arrPointsBorders[2] = CPoint(rcItem.left + 2, rcItem.top );
- arrPointsBorders[3] = CPoint(rcItem.right - 2, rcItem.top );
- arrPointsBorders[4] = CPoint(rcItem.right, rcItem.top + 2 );
- arrPointsBorders[5] = CPoint(rcItem.right, rcItem.bottom );
- arrPointsInnerArea[0] = CPoint(rcItem.left + 1, rcItem.bottom + 1 );
- arrPointsInnerArea[1] = CPoint(rcItem.left + 1, rcItem.top + 2 );
- arrPointsInnerArea[2] = CPoint(rcItem.left + 2, rcItem.top + 1 );
- arrPointsInnerArea[3] = CPoint(rcItem.right - 1,rcItem.top + 1 );
- arrPointsInnerArea[4] = CPoint(rcItem.right, rcItem.top + 2 );
- arrPointsInnerArea[5] = CPoint(rcItem.right, rcItem.bottom + 1 );
- arrPointsItemsSeparator[0] = CPoint(rcItem.right, rcItem.top + 3 );
- arrPointsItemsSeparator[1] = CPoint(rcItem.right, rcItem.bottom - 2 );
- } // if( bNewTopLeft )
- else
- {
- rcItem.bottom--;
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.left, rcItem.bottom - 2 );
- arrPointsBorders[2] = CPoint(rcItem.left + 2, rcItem.bottom );
- arrPointsBorders[3] = CPoint(rcItem.right - 2, rcItem.bottom );
- arrPointsBorders[4] = CPoint(rcItem.right, rcItem.bottom - 2 );
- arrPointsBorders[5] = CPoint(rcItem.right, rcItem.top - 1 );
- arrPointsInnerArea[0] = CPoint(rcItem.left + 1, rcItem.top - 1);
- arrPointsInnerArea[1] = CPoint(rcItem.left + 1, rcItem.bottom - 2 );
- arrPointsInnerArea[2] = CPoint(rcItem.left + 2, rcItem.bottom );
- arrPointsInnerArea[3] = CPoint(rcItem.right - 2,rcItem.bottom );
- arrPointsInnerArea[4] = CPoint(rcItem.right, rcItem.bottom - 2 );
- arrPointsInnerArea[5] = CPoint(rcItem.right, rcItem.top - 1 );
-
- arrPointsItemsSeparator[0] = CPoint(rcItem.right, rcItem.bottom - 3 );
- arrPointsItemsSeparator[1] = CPoint(rcItem.right, rcItem.top + 1 );
- }
- }
- else
- {
- bool bNewTopLeft = bGroupedMode ? !bTopLeft : bTopLeft;
- if( bNewTopLeft )
- {
- arrPointsBorders[0] = CPoint(rcItem.right - 1, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.left + 2, rcItem.top );
- arrPointsBorders[2] = CPoint(rcItem.left, rcItem.top + 2 );
- arrPointsBorders[3] = CPoint(rcItem.left, rcItem.bottom - 2 );
- arrPointsBorders[4] = CPoint(rcItem.left + 2, rcItem.bottom );
- arrPointsBorders[5] = CPoint(rcItem.right, rcItem.bottom );
- arrPointsInnerArea[0] = CPoint(rcItem.right + 1,rcItem.top + 1 );
- arrPointsInnerArea[1] = CPoint(rcItem.left + 2, rcItem.top + 1 );
- arrPointsInnerArea[2] = CPoint(rcItem.left + 1, rcItem.top + 2 );
- arrPointsInnerArea[3] = CPoint(rcItem.left + 1, rcItem.bottom - 2 );
- arrPointsInnerArea[4] = CPoint(rcItem.left + 2, rcItem.bottom );
- arrPointsInnerArea[5] = CPoint(rcItem.right + 1,rcItem.bottom );
- arrPointsItemsSeparator[0] = CPoint(rcItem.left + 3, rcItem.bottom );
- arrPointsItemsSeparator[1] = CPoint(rcItem.right - 2, rcItem.bottom );
- } // if( bNewTopLeft )
- else
- {
- rcItem.right--;
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.right - 2, rcItem.top );
- arrPointsBorders[2] = CPoint(rcItem.right, rcItem.top + 2 );
- arrPointsBorders[3] = CPoint(rcItem.right, rcItem.bottom - 2 );
- arrPointsBorders[4] = CPoint(rcItem.right - 2, rcItem.bottom );
- arrPointsBorders[5] = CPoint(rcItem.left - 1, rcItem.bottom );
- arrPointsInnerArea[0] = CPoint(rcItem.left - 1, rcItem.top + 1 );
- arrPointsInnerArea[1] = CPoint(rcItem.right - 2,rcItem.top );
- arrPointsInnerArea[2] = CPoint(rcItem.right, rcItem.top + 2 );
- arrPointsInnerArea[3] = CPoint(rcItem.right, rcItem.bottom - 2 );
- arrPointsInnerArea[4] = CPoint(rcItem.right - 2,rcItem.bottom );
- arrPointsInnerArea[5] = CPoint(rcItem.left - 1, rcItem.bottom );
- arrPointsItemsSeparator[0] = CPoint(rcItem.right - 3, rcItem.bottom );
- arrPointsItemsSeparator[1] = CPoint(rcItem.left + 1, rcItem.bottom );
- }
- }
- // draw item border
- CPen pen(PS_SOLID, 1, GetColor( COLOR_3DSHADOW, this ) );
- CPen * pOldPen = dc.SelectObject( &pen );
- if( m_eStyle2005 != __ES2005_RC
- || bSelected
- || bGroupedMode
- )
- {
- for( int i = 0 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]) - 1; i++ )
- {
- dc.MoveTo( arrPointsBorders[i] );
- dc.LineTo( arrPointsBorders[i + 1] );
- }
- }
- else if( pTabs != NULL && nItemIndex < pTabs->ItemGetCount() - 1 )
- {
- dc.MoveTo( arrPointsItemsSeparator[0] );
- dc.LineTo( arrPointsItemsSeparator[1] );
- }
- dc.SelectObject( pOldPen );
- CRgn rgnBk;
- VERIFY( rgnBk.CreatePolygonRgn( arrPointsInnerArea, 6, ALTERNATE ) );
- if( m_eStyle2005 != __ES2005_RC )
- {
- if( (!bSelected || bGroupedMode )
- && ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8
- )
- {
- dc.SelectClipRgn( &rgnBk, RGN_AND );
- CRect rcFill( rcTabItemsArea );
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrBkLight = clrBkDark = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrBkLight = clrBkDark = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- stat_PaintGradientRect(
- dc,
- &rcFill,
- clrBkLight,
- clrBkDark,
- bHorz
- );
- }
- else
- {
- COLORREF clrBrushBk =
- (bSelected && !bGroupedMode)
- ? clrTabBorderLT
- : GetColor( COLOR_BTNFACE, this )
- ;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- CBrush brushBk( clrBrushBk );
- dc.FillRgn( &rgnBk, &brushBk );
- }
- }
- else if( bSelected && !bGroupedMode )
- {
- COLORREF clrBrushBk = RGB(252,252,254);
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- CBrush brushBk( clrBrushBk );
- dc.FillRgn( &rgnBk, &brushBk );
- }
- rcItem.DeflateRect(
- __EXTTAB_MARGIN_BORDER_HX+1,
- bHorz ? __EXTTAB_MARGIN_BORDER_VY : __EXTTAB_MARGIN_BORDER_VY+1,
- __EXTTAB_MARGIN_BORDER_HX,
- __EXTTAB_MARGIN_BORDER_VY
- );
- } // else if( m_eStyle2005 == __ES2005_BETA1 ...
- else
- {
- ASSERT( FALSE );
- AfxThrowNotSupportedException();
- }
- CSize _sizeIcon( 0, 0 );
- bool bDrawIcon = (
- pIcon != NULL
- && (!pIcon->IsEmpty())
- && ( pTabs == NULL || (pTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0 )
- );
- if( bDrawIcon )
- {
- _sizeIcon = pIcon->GetSize();
- ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
- }
- CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
- // IMPORTANT: the rcText calculation fixed by Genka
- CRect rcText(
- rcItem.left
- + ( bHorz
- ? (_sizeIcon.cx +
- ((_sizeIcon.cx > 0) ? __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 )
- {
- int nWidth0 = rcText.Width();
- int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
- if( nWidth1 > nWidth0 )
- {
- if( bInvertedVerticalMode )
- rcText.left = rcText.right - nWidth1;
- else
- rcText.right = rcText.left + nWidth1;
- }
- }
- bool bDrawText = ( ( ! sItemText.IsEmpty() ) && rcText.Width() > 0 && rcText.Height() > 0 ) ? true : false;
- if( bDrawIcon )
- {
- INT nIconAlignment = __ALIGN_VERT_TOP;
- if( (!bDrawText) && !( bGroupedMode && (!bInGroupActive) ) )
- {
- if( bCenteredText )
- nIconAlignment = __ALIGN_HORIZ_CENTER|__ALIGN_VERT_CENTER;
- else
- nIconAlignment |= __ALIGN_HORIZ_CENTER;
- }
- if( (bHorz && rcItem.Width() >= _sizeIcon.cx )
- || (!bHorz && rcItem.Height() >= _sizeIcon.cy)
- )
- {
- PaintIcon(
- dc,
- bHorz,
- pIcon,
- rcItem,
- false,
- bEnabled,
- false,
- nIconAlignment
- );
- }
- } // if( bDrawIcon )
- if( bDrawText )
- { // if we have sense to paint text on tab item
- ASSERT( pFont != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- 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("