ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
- CDC & dc,
- const RECT & rcGroupBk,
- const CExtRibbonButtonGroup * pGroupTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGroupTBB );
- if( ::IsRectEmpty( &rcGroupBk ) )
- return true;
- if( ! dc.RectVisible( &rcGroupBk ) )
- return true;
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_PaintQuickAccessGroupButton(
- dc,
- rcGroupBk,
- pGroupTBB,
- lParam
- );
- bool bEnabled = pGroupTBB->IsEnabled();
- bool bHover = ( bEnabled && pGroupTBB->IsHover() ) ? true : false;
- if( bHover && pGroupTBB->GetBar()->GetMenuTrackingButton() >= 0 )
- bHover = false;
- bool bPressed = false;
- if( bEnabled )
- bPressed = pGroupTBB->IsPressed();
- bool bSelTrackingMode = false;
- const CExtToolControlBar * pToolBar = pGroupTBB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( (CExtBarButton*)pGroupTBB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- bSelTrackingMode = true;
- }
- }
- }
- CExtBitmap & _bmp1 = m_bmpRibbonGroupBkQATB[ bSelTrackingMode ? 3 : ( bPressed ? 2 : ( bHover ? 1 : 0 ) ) ];
- CExtBitmap & _bmp2 = m_bmpRibbonGroupBkCollapsed[ bSelTrackingMode ? 3 : ( bPressed ? 2 : ( bHover ? 1 : 0 ) ) ];
- CExtBitmap & _bmp = _bmp1.IsEmpty() ? _bmp2 : _bmp1;
- if( _bmp.IsEmpty() )
- return false;
- CRect rcPadding(3,3,3,3);
- //CExtMemoryDC dcMem( &dc, &rcGroupBk, CExtMemoryDC::MDCOPT_FORCE_DIB|CExtMemoryDC::MDCOPT_TO_MEMORY|CExtMemoryDC::MDCOPT_FILL_BITS|CExtMemoryDC::MDCOPT_RTL_COMPATIBILITY );
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC, // dcMem.m_hDC
- rcGroupBk,
- rcPadding, //m_rcRibbonGroupPaddingBkCollapsed,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- // dcMem.__Flush();
- //CExtCmdIcon * pCmdIcon = Ribbon_GetGroupCollapsedIcon( pGroupTBB, lParam );
- //CExtCmdIcon * pCmdIcon = ((CExtBarButton*)pGroupTBB)->GetIconPtr();
- CExtRibbonNode * pRibbonNode = (CExtRibbonNode *)pGroupTBB->Ribbon_GetNode();
- if( pRibbonNode == NULL )
- return true;
- ASSERT_VALID( pRibbonNode );
- if( pRibbonNode->m_iconSmall.IsEmpty() )
- {
- if( pRibbonNode->m_iconBig.IsEmpty() )
- return true;
- CSize _size = Ribbon_GetIconSize( pGroupTBB, __EXT_RIBBON_ILV_SIMPLE_SMALL );
- pRibbonNode->m_iconSmall = pRibbonNode->m_iconBig;
- pRibbonNode->m_iconSmall.Scale( _size );
- }
- CExtCmdIcon * pCmdIcon = & pRibbonNode->m_iconSmall;
- if( pCmdIcon == NULL || pCmdIcon->IsEmpty() )
- return true;
- CSize _sizeIcon = pCmdIcon->GetSize();
- pCmdIcon->Paint(
- this,
- dc,
- rcGroupBk.left + ( rcGroupBk.right - rcGroupBk.left - _sizeIcon.cx ) / 2,
- rcGroupBk.top + ( rcGroupBk.bottom - rcGroupBk.top - _sizeIcon.cy ) / 2,
- -1,
- -1
- );
- return true;
- }
- void CExtPaintManager::Ribbon_PaintGroupBk(
- CDC & dc,
- const RECT & rcGroupBk,
- const CExtRibbonButtonGroup * pGroupTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGroupTBB );
- if( pGroupTBB->ParentButtonGet() != NULL )
- return;
- if( ::IsRectEmpty( &rcGroupBk ) )
- return;
- if( ! dc.RectVisible( &rcGroupBk ) )
- return;
- CRect _rcGroupBk = rcGroupBk;
- _rcGroupBk.InflateRect( 0, 0, 1, 1 );
- CExtSafeString strCaptionText = pGroupTBB->GetText();
- INT nCaptionTextLength = strCaptionText.GetLength();
- bool bEnabled = pGroupTBB->IsEnabled();
- bool bHover = ( bEnabled && pGroupTBB->IsHover() ) ? true : false;
- if( bHover && pGroupTBB->GetBar()->GetMenuTrackingButton() >= 0 )
- bHover = false;
- bool bCollapsed = pGroupTBB->TopCollapsedStateGet();
- if( bCollapsed )
- {
- bool bPressed = false;
- if( bEnabled )
- bPressed = pGroupTBB->IsPressed();
- PAINTPUSHBUTTONDATA _ppbd;
- _ppbd.m_rcClient = _rcGroupBk;
- _ppbd.m_bFlat = false;
- _ppbd.m_bEnabled = bEnabled;
- _ppbd.m_bHover = bHover;
- _ppbd.m_bPushed = bPressed;
- _ppbd.m_bHorz = true;
- PaintPushButton( dc, _ppbd );
- CExtCmdIcon * pCmdIcon = Ribbon_GetGroupCollapsedIcon( pGroupTBB, lParam );
- //CExtCmdIcon * pCmdIcon = ((CExtBarButton*)pGroupTBB)->GetIconPtr();
- CRect rcIconArea = _rcGroupBk, rcTextArea = _rcGroupBk;
- if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- {
- CSize _sizeIcon = pCmdIcon->GetSize();
- rcIconArea.left += ( rcIconArea.Width() - _sizeIcon.cx ) / 2;
- rcIconArea.top += ( rcIconArea.Height() - _sizeIcon.cy ) / 2 - 6;
- rcIconArea.right = rcIconArea.left + _sizeIcon.cx;
- rcIconArea.bottom = rcIconArea.top + _sizeIcon.cy;
- rcTextArea.top = rcIconArea.bottom + 7;
- } // if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- else
- rcTextArea.top += 16;
- rcIconArea.OffsetRect( 0, -10 );
- if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- {
- pCmdIcon->Paint(
- this,
- dc,
- rcIconArea.left,
- rcIconArea.top,
- -1,
- -1
- );
- } // if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- if( nCaptionTextLength > 0 )
- {
- CExtRibbonPage * pRibbonPage =
- const_cast < CExtRibbonPage * >
- ( pGroupTBB->GetRibbonPage() );
- ASSERT_VALID( pRibbonPage );
- ASSERT( pRibbonPage->GetSafeHwnd() != NULL );
- CFont * pFont = pRibbonPage->OnGetToolbarFont( false, false );
- ASSERT( pFont->GetSafeHandle() != NULL );
- //CFont * pOldFont = dc.SelectObject( pFont );
- CFont * pOldFont = dc.SelectObject( &m_FontRibbonGroupCaption );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldTextColor = dc.SetTextColor( GetColor( COLOR_BTNTEXT ) );
- CRect rcCaption = rcTextArea;
- rcCaption.OffsetRect( 0, -5 );
- // dc.DrawText(
- // LPCTSTR( strCaptionText ),
- // nCaptionTextLength,
- // &rcCaption,
- // DT_CENTER|DT_TOP //m_nRibbonGroupCaptionTextDF
- // );
- Ribbon_PaintText(
- dc,
- LPCTSTR( strCaptionText ),
- rcCaption,
- DT_CENTER|DT_TOP,
- true,
- NULL,
- (CObject*)pGroupTBB,
- lParam
- );
- dc.SetTextColor( clrOldTextColor );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- } // if( nCaptionTextLength > 0 )
- } // if( bCollapsed )
- else
- {
- const CExtRibbonPage * pRibbonPage = pGroupTBB->GetRibbonPage();
- ASSERT_VALID( pRibbonPage );
- CWnd * pWndParent = pRibbonPage->GetParent();
- bool bDrawCaption = true, bPopupMode =
- ( pWndParent != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS( CExtRibbonPopupMenuWnd ) )
- && (! ((CExtRibbonPopupMenuWnd*)pWndParent)->m_wndRibbonPage.m_bHelperAutoHideMode )
- ) ? true : false;
- INT nCaptionHeight = 0;
- if( bPopupMode && (! Ribbon_IsPopupGroupWithCaption( (CObject*) pRibbonPage ) ) )
- {
- bDrawCaption = false;
- strCaptionText.Empty();
- nCaptionTextLength = 0;
- }
- else
- {
- strCaptionText.Replace( _T("r"), _T(" ") );
- strCaptionText.Replace( _T("n"), _T(" ") );
- strCaptionText.Replace( _T("t"), _T(" ") );
- strCaptionText.Replace( _T(" "), _T(" ") );
- strCaptionText.TrimLeft( _T(" ") );
- strCaptionText.TrimRight( _T(" ") );
- nCaptionHeight = Ribbon_GroupCaptionGetHeight( pGroupTBB, lParam );
- ASSERT( nCaptionHeight >= 0 );
- }
- COLORREF clrBorder = RGB(0,0,0);
- if( bEnabled )
- {
- if( bHover )
- {
- clrBorder = GetColor( COLOR_3DDKSHADOW );
- dc.FillRect( &_rcGroupBk, &m_brushLighterDefault );
- } // if( bHover )
- else
- clrBorder = GetColor( COLOR_3DSHADOW );
- } // if( bEnabled )
- else
- clrBorder = GetColor( COLOR_3DSHADOW );
- if( nCaptionHeight > 0 && nCaptionTextLength > 0 )
- {
- CRect rcCaption = _rcGroupBk;
- bool bTopCaption = Ribbon_GroupCaptionIsAtTop( pGroupTBB );
- if( bTopCaption )
- rcCaption.bottom = rcCaption.top + nCaptionHeight;
- else
- rcCaption.top = rcCaption.bottom - nCaptionHeight;
- dc.FillSolidRect( &rcCaption, GetColor( COLOR_3DSHADOW ) );
- dc.Draw3dRect( &rcCaption, clrBorder, clrBorder );
- CExtRibbonPage * pRibbonPage =
- const_cast < CExtRibbonPage * >
- ( pGroupTBB->GetRibbonPage() );
- ASSERT_VALID( pRibbonPage );
- ASSERT( pRibbonPage->GetSafeHwnd() != NULL );
- CFont * pFont = pRibbonPage->OnGetToolbarFont( false, false );
- ASSERT( pFont->GetSafeHandle() != NULL );
- CRect rcCaptionTextAlignmentDLB =
- pGroupTBB->GetCaptionTextAlignmentRect();
- if( ! rcCaptionTextAlignmentDLB.IsRectEmpty() )
- {
- rcCaption.left =
- max(
- rcCaption.left,
- rcCaptionTextAlignmentDLB.left
- );
- rcCaption.right =
- min(
- rcCaption.right,
- rcCaptionTextAlignmentDLB.right
- );
- } // if( ! rcCaptionTextAlignmentDLB.IsRectEmpty() )
- //CFont * pOldFont = dc.SelectObject( pFont );
- CFont * pOldFont = dc.SelectObject( &m_FontRibbonGroupCaption );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldTextColor = dc.SetTextColor( GetColor( COLOR_3DDKSHADOW ) );
- rcCaption.OffsetRect( 1, 1 );
- UINT nRibbonGroupCaptionTextShadowDF = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_END_ELLIPSIS;
- dc.DrawText(
- LPCTSTR( strCaptionText ),
- nCaptionTextLength,
- &rcCaption,
- nRibbonGroupCaptionTextShadowDF
- );
- rcCaption.OffsetRect( -1, -1 );
- dc.SetTextColor( GetColor( COLOR_3DHIGHLIGHT ) );
- dc.DrawText(
- LPCTSTR( strCaptionText ),
- nCaptionTextLength,
- &rcCaption,
- nRibbonGroupCaptionTextShadowDF
- );
- dc.SetTextColor( clrOldTextColor );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- } // if( nCaptionHeight > 0 && nCaptionTextLength > 0 )
- // dc.Draw3dRect( &_rcGroupBk, clrBorder, clrBorder );
- } // else from if( bCollapsed )
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_PaintGroupBk(
- CDC & dc,
- const RECT & rcGroupBk,
- const CExtRibbonButtonGroup * pGroupTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGroupTBB );
- if( pGroupTBB->ParentButtonGet() != NULL )
- return;
- if( ::IsRectEmpty( &rcGroupBk ) )
- return;
- if( ! dc.RectVisible( &rcGroupBk ) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintGroupBk(
- dc,
- rcGroupBk,
- pGroupTBB,
- lParam
- );
- return;
- }
- CExtSafeString strCaptionText = pGroupTBB->GetText();
- INT nCaptionTextLength = strCaptionText.GetLength();
- bool bEnabled = pGroupTBB->IsEnabled();
- bool bHover = ( bEnabled && pGroupTBB->IsHover() ) ? true : false;
- if( bHover && pGroupTBB->GetBar()->GetMenuTrackingButton() >= 0 )
- bHover = false;
- bool bCollapsed = pGroupTBB->TopCollapsedStateGet();
- if( bCollapsed )
- {
- bool bPressed = false;
- if( bEnabled )
- bPressed = pGroupTBB->IsPressed();
- bool bSelTrackingMode = false;
- const CExtToolControlBar * pToolBar = pGroupTBB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( (CExtBarButton*)pGroupTBB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- bSelTrackingMode = true;
- }
- }
- }
- CExtBitmap & _bmp = m_bmpRibbonGroupBkCollapsed[ bSelTrackingMode ? 3 : ( bPressed ? 2 : ( bHover ? 1 : 0 ) ) ];
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcGroupBk,
- m_rcRibbonGroupPaddingBkCollapsed,
- CExtBitmap::__EDM_STRETCH
- );
- CExtCmdIcon * pCmdIcon = Ribbon_GetGroupCollapsedIcon( pGroupTBB, lParam );
- //CExtCmdIcon * pCmdIcon = ((CExtBarButton*)pGroupTBB)->GetIconPtr();
- CRect rcIconArea = rcGroupBk, rcTextArea = rcGroupBk;
- //CExtBitmap & _bmpIconBk = m_bmpRibbonIconBkCollapsed[ bPressed ? 2 : ( bHover ? 1 : 0 ) ];
- CExtBitmap & _bmpIconBk = m_bmpRibbonIconBkCF;
- if( ! _bmpIconBk.IsEmpty() )
- {
- CSize _sizeIconBk = _bmpIconBk.GetSize();
- rcIconArea.left = rcGroupBk.left + ( rcGroupBk.right - rcGroupBk.left - _sizeIconBk.cx ) / 2;
- rcIconArea.top = rcGroupBk.top + m_nRibbonGroupIconBkVertOffset;
- rcIconArea.right = rcIconArea.left + _sizeIconBk.cx;
- rcIconArea.bottom = rcIconArea.top + _sizeIconBk.cy;
- _bmpIconBk.AlphaBlend(
- dc.m_hDC,
- rcIconArea.left,
- rcIconArea.top,
- _sizeIconBk.cx,
- _sizeIconBk.cy
- );
- if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- {
- CSize _sizeIcon = pCmdIcon->GetSize();
- rcIconArea.left += ( rcIconArea.Width() - _sizeIcon.cx ) / 2;
- rcIconArea.top += ( rcIconArea.Height() - _sizeIcon.cy - 8 ) / 2;
- rcTextArea.top = rcIconArea.bottom + 2;
- rcIconArea.right = rcIconArea.left + _sizeIcon.cx;
- rcIconArea.bottom = rcIconArea.top + _sizeIcon.cy;
- } // if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- else
- rcTextArea.top += 16;
- } // if( ! _bmpIconBk.IsEmpty() )
- else
- {
- if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- {
- CSize _sizeIcon = pCmdIcon->GetSize();
- rcIconArea.left += ( rcIconArea.Width() - _sizeIcon.cx ) / 2;
- rcIconArea.top += ( rcIconArea.Height() - _sizeIcon.cy ) / 2 - 6;
- rcIconArea.right = rcIconArea.left + _sizeIcon.cx;
- rcIconArea.bottom = rcIconArea.top + _sizeIcon.cy;
- rcTextArea.top = rcIconArea.bottom + 7;
- } // if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- else
- rcTextArea.top += 16;
- } // else from if( ! _bmpIconBk.IsEmpty() )
- if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- {
- pCmdIcon->Paint(
- this,
- dc,
- rcIconArea.left,
- rcIconArea.top,
- -1,
- -1
- );
- } // if( pCmdIcon != NULL && (! pCmdIcon->IsEmpty() ) )
- if( nCaptionTextLength > 0 )
- {
- CExtRibbonPage * pRibbonPage =
- const_cast < CExtRibbonPage * >
- ( pGroupTBB->GetRibbonPage() );
- ASSERT_VALID( pRibbonPage );
- ASSERT( pRibbonPage->GetSafeHwnd() != NULL );
- CFont * pFont = pRibbonPage->OnGetToolbarFont( false, false );
- ASSERT( pFont->GetSafeHandle() != NULL );
- //CFont * pOldFont = dc.SelectObject( pFont );
- CFont * pOldFont = dc.SelectObject( &m_FontRibbonGroupCaption );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldTextColor = dc.SetTextColor( m_clrRibbonGroupCaptionTextCollapsed );
- CRect rcCaption = rcTextArea;
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) )
- rcCaption.OffsetRect( 0, -5 );
- else if( g_PaintManager.m_nLPY > 96 )
- rcCaption.top += 10;
- // dc.DrawText(
- // LPCTSTR( strCaptionText ),
- // nCaptionTextLength,
- // &rcCaption,
- // DT_CENTER|DT_TOP //m_nRibbonGroupCaptionTextDF
- // );
- Ribbon_PaintText(
- dc,
- LPCTSTR( strCaptionText ),
- rcCaption,
- DT_CENTER|DT_TOP,
- true,
- &m_bmpRibbonDDA,
- (CObject*)pGroupTBB,
- lParam
- );
- dc.SetTextColor( clrOldTextColor );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- } // if( nCaptionTextLength > 0 )
- } // if( bCollapsed )
- else
- {
- const CExtRibbonPage * pRibbonPage = pGroupTBB->GetRibbonPage();
- ASSERT_VALID( pRibbonPage );
- CWnd * pWndParent = pRibbonPage->GetParent();
- bool bDrawCaption = true, bPopupMode =
- ( pWndParent != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS( CExtRibbonPopupMenuWnd ) )
- && (! ((CExtRibbonPopupMenuWnd*)pWndParent)->m_wndRibbonPage.m_bHelperAutoHideMode )
- ) ? true : false;
- INT nCaptionHeight = 0;
- if( bPopupMode && (! Ribbon_IsPopupGroupWithCaption( (CObject*) pRibbonPage ) ) )
- {
- bDrawCaption = false;
- strCaptionText.Empty();
- nCaptionTextLength = 0;
- }
- else
- {
- strCaptionText.Replace( _T("r"), _T(" ") );
- strCaptionText.Replace( _T("n"), _T(" ") );
- strCaptionText.Replace( _T("t"), _T(" ") );
- strCaptionText.Replace( _T(" "), _T(" ") );
- strCaptionText.TrimLeft( _T(" ") );
- strCaptionText.TrimRight( _T(" ") );
- nCaptionHeight = Ribbon_GroupCaptionGetHeight( pGroupTBB, lParam );
- ASSERT( nCaptionHeight >= 0 );
- }
- CExtBitmap & _bmp = m_bmpRibbonGroupBkExpanded[ bHover ? 1 : 0 ];
- if( nCaptionHeight == 0 )
- {
- CSize _size = _bmp.GetSize();
- CRect rcSrc( 0, 0, _size.cx, _size.cy );
- if( ! bDrawCaption )
- {
- bool bTopCaption = Ribbon_GroupCaptionIsAtTop( pGroupTBB );
- if( bTopCaption )
- rcSrc.top += m_nRibbonCaptionPartHeight;
- else
- rcSrc.bottom += m_nRibbonCaptionPartHeight;
- rcSrc.DeflateRect( 2, 2 );
- }
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcGroupBk,
- rcSrc,
- m_rcRibbonGroupPaddingBkExpanded,
- CExtBitmap::__EDM_STRETCH
- );
- } // if( nCaptionHeight == 0 )
- else
- {
- CSize _size = _bmp.GetSize();
- CRect rcDstGroupBk( rcGroupBk ),
- rcSrcGroupBk( 0, 0, _size.cx, _size.cy ),
- rcDstCaptionBk( rcGroupBk ),
- rcSrcCaptionBk( 0, 0, _size.cx, _size.cy );
- bool bTopCaption = Ribbon_GroupCaptionIsAtTop( pGroupTBB );
- if( bTopCaption )
- {
- rcDstGroupBk.top += nCaptionHeight;
- rcDstCaptionBk.bottom = rcDstGroupBk.top;
- rcSrcGroupBk.top += m_nRibbonCaptionPartHeight;
- rcSrcCaptionBk.bottom = rcSrcGroupBk.top;
- } // if( bTopCaption )
- else
- {
- rcDstGroupBk.bottom -= nCaptionHeight;
- rcDstCaptionBk.top = rcDstGroupBk.bottom;
- rcSrcGroupBk.bottom -= m_nRibbonCaptionPartHeight;
- rcSrcCaptionBk.top = rcSrcGroupBk.bottom;
- } // else from if( bTopCaption )
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDstGroupBk,
- rcSrcGroupBk,
- m_rcRibbonGroupPaddingBkExpanded,
- CExtBitmap::__EDM_STRETCH
- );
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDstCaptionBk,
- rcSrcCaptionBk,
- m_rcRibbonGroupPaddingBkExpanded,
- CExtBitmap::__EDM_STRETCH
- );
- if( nCaptionTextLength > 0 )
- {
- CExtRibbonPage * pRibbonPage =
- const_cast < CExtRibbonPage * >
- ( pGroupTBB->GetRibbonPage() );
- ASSERT_VALID( pRibbonPage );
- ASSERT( pRibbonPage->GetSafeHwnd() != NULL );
- CFont * pFont = pRibbonPage->OnGetToolbarFont( false, false );
- ASSERT( pFont->GetSafeHandle() != NULL );
- //CFont * pOldFont = dc.SelectObject( pFont );
- CFont * pOldFont = dc.SelectObject( &m_FontRibbonGroupCaption );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldTextColor =
- dc.SetTextColor(
- ( m_clrRibbonGroupCaptionTextShadowExpanded == COLORREF(-1L) )
- ? m_clrRibbonGroupCaptionTextExpanded
- : m_clrRibbonGroupCaptionTextShadowExpanded
- );
- CRect rcCaption = rcDstCaptionBk;
- rcCaption.DeflateRect(
- m_rcRibbonGroupPaddingBkExpanded.left,
- 2,
- m_rcRibbonGroupPaddingBkExpanded.right,
- 2
- );
- if( ! bTopCaption )
- rcCaption.OffsetRect( 0, -1 );
- if( m_clrRibbonGroupCaptionTextShadowExpanded != COLORREF(-1L) )
- {
- rcCaption.OffsetRect(
- m_sizeRibbonGroupCaptionTextOffset.cx,
- m_sizeRibbonGroupCaptionTextOffset.cy
- );
- dc.DrawText(
- LPCTSTR( strCaptionText ),
- nCaptionTextLength,
- &rcCaption,
- m_nRibbonGroupCaptionTextShadowDF
- );
- rcCaption.OffsetRect(
- - m_sizeRibbonGroupCaptionTextOffset.cx,
- - m_sizeRibbonGroupCaptionTextOffset.cy
- );
- dc.SetTextColor( m_clrRibbonGroupCaptionTextExpanded );
- } // if( m_clrRibbonGroupCaptionTextShadowExpanded != COLORREF(-1L) )
- CRect rcCaptionTextAlignmentDLB =
- pGroupTBB->GetCaptionTextAlignmentRect();
- if( ! rcCaptionTextAlignmentDLB.IsRectEmpty() )
- {
- rcCaption.left =
- max(
- rcCaption.left,
- rcCaptionTextAlignmentDLB.left
- );
- rcCaption.right =
- min(
- rcCaption.right,
- rcCaptionTextAlignmentDLB.right
- );
- } // if( ! rcCaptionTextAlignmentDLB.IsRectEmpty() )
- dc.DrawText(
- LPCTSTR( strCaptionText ),
- nCaptionTextLength,
- &rcCaption,
- m_nRibbonGroupCaptionTextDF
- );
- dc.SetTextColor( clrOldTextColor );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- } // if( nCaptionTextLength > 0 )
- } // else from if( nCaptionHeight == 0 )
- } // else from if( bCollapsed )
- }
- CRect CExtPaintManager::Ribbon_GetPageOuterContentPadding(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- return CRect( 3, 3, 3, 3 );
- }
- CRect CExtPaintManagerNativeXP::Ribbon_GetPageOuterContentPadding(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- CRect rc =
- CExtPaintManager::Ribbon_GetPageOuterContentPadding( pRibbonPage, lParam );
- e_system_theme_t eST = OnQuerySystemTheme();
- if( eST == ThemeLunaRoyale // +2.87
- || eST == ThemeVistaOrLaterUX // +2.87
- || eST == ThemeVistaOrLaterDWM // +2.87
- || eST == ThemeLunaBlue
- || eST == ThemeLunaOlive
- || eST == ThemeLunaSilver
- )
- rc.bottom += 2;
- return rc;
- }
- CRect CExtPaintManagerOffice2007_Impl::Ribbon_GetPageOuterContentPadding(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_GetPageOuterContentPadding(
- pRibbonPage,
- lParam
- );
- return m_rcRibbonPageOuterContentPadding;
- }
- void CExtPaintManager::Ribbon_PaintPageBk(
- CDC & dc,
- const RECT & rcPageBk,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- lParam;
- if( ! dc.RectVisible( &rcPageBk ) )
- return;
- if( pRibbonPage->GetSafeHwnd() != NULL )
- {
- CWnd * pWndParent = pRibbonPage->GetParent();
- if( pWndParent != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- )
- return;
- } // if( pRibbonPage->GetSafeHwnd() != NULL )
- CRect rc = rcPageBk;
- rc.DeflateRect( 2, 0 );
- stat_PaintGradientRect(
- dc,
- rc,
- GetColor( COLOR_3DHILIGHT ),
- GetColor( COLOR_3DFACE ),
- true
- );
- dc.Draw3dRect(
- &rc,
- GetColor( COLOR_3DHIGHLIGHT ),
- GetColor( COLOR_3DSHADOW )
- );
- }
- void CExtPaintManagerStudio2005::Ribbon_PaintPageBk(
- CDC & dc,
- const RECT & rcPageBk,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintPageBk(
- dc,
- rcPageBk,
- pRibbonPage,
- lParam
- );
- return;
- }
- if( ! dc.RectVisible( &rcPageBk ) )
- return;
- if( pRibbonPage->GetSafeHwnd() != NULL )
- {
- CWnd * pWndParent = pRibbonPage->GetParent();
- if( pWndParent != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- )
- return;
- } // if( pRibbonPage->GetSafeHwnd() != NULL )
- CRect rc = rcPageBk;
- rc.DeflateRect( 2, 0 );
- // dc.FillSolidRect(
- // &rc,
- // GetColor( COLOR_3DHILIGHT )
- // );
- stat_PaintGradientRect(
- dc,
- rc,
- GetColor( COLOR_3DFACE ),
- GetColor( COLOR_3DHILIGHT ),
- true
- );
- COLORREF clrBorder = GetColor( COLOR_3DSHADOW );
- dc.Draw3dRect(
- &rc,
- clrBorder,
- clrBorder
- );
- }
- void CExtPaintManagerNativeXP::Ribbon_PaintPageBk(
- CDC & dc,
- const RECT & rcPageBk,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- lParam;
- if( ! dc.RectVisible( &rcPageBk ) )
- return;
- if( pRibbonPage->GetSafeHwnd() != NULL )
- {
- CWnd * pWndParent = pRibbonPage->GetParent();
- if( pWndParent != NULL
- && pWndParent->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- )
- return;
- } // if( pRibbonPage->GetSafeHwnd() != NULL )
- if( g_PaintManager.m_UxTheme.IsAppThemed() )
- {
- HWND hWndOpenTheme = pRibbonPage->GetSafeHwnd();
- if( hWndOpenTheme != NULL )
- hWndOpenTheme = ::GetDesktopWindow();
- ASSERT( hWndOpenTheme != NULL );
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWndOpenTheme, VSCLASS_TAB ) != NULL )
- {
- CRect rcItem = rcPageBk;
- rcItem.DeflateRect( 2, 0 );
- INT nPartID = TABP_PANE;
- INT nStateID = 0;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWndOpenTheme,
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcItem,
- &rcItem
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- } // if( g_PaintManager.m_UxTheme.IsAppThemed() )
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_PaintPageBk(
- CDC & dc,
- const RECT & rcPageBk,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintPageBk( dc, rcPageBk, pRibbonPage, lParam );
- return;
- }
- if( m_bmpRibbonPageBk.IsEmpty() )
- return;
- if( ::IsRectEmpty( &rcPageBk ) )
- return;
- if( ! dc.RectVisible( &rcPageBk ) )
- return;
- CRect _rcPageBk = rcPageBk;
- if( m_rcRibbonPageBkPadding.bottom > 1 )
- {
- CFont * pFont = ((CExtToolControlBar*)pRibbonPage)->OnGetToolbarFont( false, true );
- LOGFONT _lf;
- ::memset( &_lf, 0, sizeof(LOGFONT) );
- pFont->GetLogFont( &_lf );
- if( _tcscmp( _lf.lfFaceName, _T("Segoe UI") ) != 0 )
- _rcPageBk.bottom ++;
- }
- m_bmpRibbonPageBk.AlphaBlendSkinParts(
- dc.m_hDC,
- _rcPageBk,
- m_rcRibbonPageBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- }
- void CExtPaintManagerOffice2007_R1::Ribbon_PaintPageBk(
- CDC & dc,
- const RECT & rcPageBk,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- if( ! dc.RectVisible( &rcPageBk ) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintPageBk(
- dc,
- rcPageBk,
- pRibbonPage,
- lParam
- );
- return;
- }
- CExtPaintManagerOffice2007_Impl::Ribbon_PaintPageBk(
- dc,
- rcPageBk,
- pRibbonPage,
- lParam
- );
- INT nCaptionHeight = Ribbon_GroupCaptionGetHeight( NULL, lParam );
- ASSERT( nCaptionHeight >= 0 );
- if( nCaptionHeight == 0 )
- return;
- CRect rcPageBkAtEnd = rcPageBk;
- INT nPos, nCount = pRibbonPage->RibbonGroupButton_GetCount();
- for( nPos = 0; nPos < nCount; nPos ++ )
- {
- const CExtRibbonButtonGroup * pTBB =
- pRibbonPage->RibbonGroupButton_GetAt( nPos );
- ASSERT_VALID( pTBB );
- if( ! pTBB->IsVisible() )
- continue;
- if( ( pTBB->GetStyle() & TBBS_HIDDEN ) != 0 )
- continue;
- CRect rcTBB = *pTBB;
- rcPageBkAtEnd.left = rcTBB.right;
- } // for( nPos = 0; nPos < nCount; nPos ++ )
- CExtBitmap & _bmp = m_bmpRibbonGroupBkExpanded[ 0 ];
- CSize _size = _bmp.GetSize();
- CRect rcDstGroupBk( rcPageBkAtEnd ),
- rcSrcGroupBk( 0, 0, _size.cx, _size.cy ),
- rcDstCaptionBk( rcPageBkAtEnd ),
- rcSrcCaptionBk( 0, 0, _size.cx, _size.cy );
- bool bTopCaption = Ribbon_GroupCaptionIsAtTop( NULL );
- if( bTopCaption )
- {
- rcDstGroupBk.top += nCaptionHeight;
- rcDstCaptionBk.bottom = rcDstGroupBk.top;
- rcSrcGroupBk.top += m_nRibbonCaptionPartHeight;
- rcSrcCaptionBk.bottom = rcSrcGroupBk.top;
- } // if( bTopCaption )
- else
- {
- rcDstGroupBk.bottom -= nCaptionHeight;
- rcDstCaptionBk.top = rcDstGroupBk.bottom;
- rcSrcGroupBk.bottom -= m_nRibbonCaptionPartHeight;
- rcSrcCaptionBk.top = rcSrcGroupBk.bottom;
- } // else from if( bTopCaption )
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDstGroupBk,
- rcSrcGroupBk,
- m_rcRibbonGroupPaddingBkExpanded,
- CExtBitmap::__EDM_STRETCH
- );
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDstCaptionBk,
- rcSrcCaptionBk,
- m_rcRibbonGroupPaddingBkExpanded,
- CExtBitmap::__EDM_STRETCH
- );
- }
- bool CExtPaintManager::Ribbon_HaveSeparatorsBetweenToolGroups() const
- {
- ASSERT_VALID( this );
- return false;
- }
- void CExtPaintManager::Ribbon_PaintSeparator(
- CDC & dc,
- const RECT & rcTBB,
- const CExtBarButton * pSepTBB, // can be NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- pSepTBB;
- lParam;
- CRect _rcTBB = rcTBB;
- if( ! dc.RectVisible( &_rcTBB ) )
- return;
- for( ; _rcTBB.Width() < 3; _rcTBB.InflateRect( 1, 0 ) );
- for( ; _rcTBB.Height() < 3; _rcTBB.InflateRect( 0, 1 ) );
- PaintSeparator(
- dc,
- _rcTBB,
- ( _rcTBB.Width() < _rcTBB.Height() ) ? true : false,
- true,
- (CObject*)pSepTBB,
- lParam
- );
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_PaintSeparator(
- CDC & dc,
- const RECT & rcTBB,
- const CExtBarButton * pSepTBB, // can be NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- pSepTBB;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintSeparator(
- dc,
- rcTBB,
- pSepTBB,
- lParam
- );
- return;
- }
- CRect _rcTBB = rcTBB;
- if( ! dc.RectVisible( &_rcTBB ) )
- return;
- if( _rcTBB.Width() > _rcTBB.Height() )
- {
- if( ! m_bmpRibbonSeparatorH.IsEmpty() )
- {
- CSize _size = m_bmpRibbonSeparatorH.GetSize();
- INT nY = _rcTBB.top + ( _rcTBB.Height() - _size.cy ) / 2;
- CRect rc(
- _rcTBB.left,
- nY,
- _rcTBB.right,
- nY + _size.cy
- );
- m_bmpRibbonSeparatorH.AlphaBlendSkinParts(
- dc.m_hDC,
- rc,
- m_rcRibbonSeparatorPaddingH,
- CExtBitmap::e_DrawMethod_t( m_nRibbonSeparatorDrawModeH )
- );
- } // if( ! m_bmpRibbonSeparatorH.IsEmpty() )
- } // if( _rcTBB.Width() > _rcTBB.Height() )
- else
- {
- if( ! m_bmpRibbonSeparatorV.IsEmpty() )
- {
- CSize _size = m_bmpRibbonSeparatorV.GetSize();
- INT nX = _rcTBB.left + ( _rcTBB.Width() - _size.cx ) / 2;
- CRect rc(
- nX,
- _rcTBB.top,
- nX + _size.cx,
- _rcTBB.bottom
- );
- m_bmpRibbonSeparatorV.AlphaBlendSkinParts(
- dc.m_hDC,
- rc,
- m_rcRibbonSeparatorPaddingV,
- CExtBitmap::e_DrawMethod_t( m_nRibbonSeparatorDrawModeV )
- );
- } // if( ! m_bmpRibbonSeparatorV.IsEmpty() )
- } // else from if( _rcTBB.Width() > _rcTBB.Height() )
- }
- void CExtPaintManager::Ribbon_SyncFonts()
- {
- ASSERT_VALID( this );
- ASSERT( m_FontNormal.GetSafeHandle() != NULL );
- if( m_FontRibbonNormal.GetSafeHandle() != NULL )
- m_FontRibbonNormal.DeleteObject();
- if( m_FontRibbonGroupCaption.GetSafeHandle() != NULL )
- m_FontRibbonGroupCaption.DeleteObject();
- if( m_FontRibbonTabItem.GetSafeHandle() != NULL )
- m_FontRibbonTabItem.DeleteObject();
- //bool bUseDesiredRibbonFontFaceName = false;
- //static __EXT_MFC_SAFE_LPCTSTR
- // g_sDesiredRibbonFontFaceName = _T("Segoe UI");
- //CWindowDC dc( NULL );
- // if( ! ::EnumFontFamilies(
- // dc.m_hDC,
- // NULL,
- // (FONTENUMPROC)stat_FindFontByNameCallBack,
- // reinterpret_cast < LPARAM > ( LPCTSTR(g_sDesiredRibbonFontFaceName) )
- // )
- // )
- // bUseDesiredRibbonFontFaceName = true;
- LOGFONT _lf;
- ::memset( &_lf, 0, sizeof(LOGFONT) );
- m_FontNormal.GetLogFont( &_lf );
- // if( bUseDesiredRibbonFontFaceName )
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, g_sDesiredRibbonFontFaceName );
- // _lf.lfWidth = 0;
- // _lf.lfHeight = -11;
- // }
- // else
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, _T("Arial") );
- // _lf.lfWidth = 5;
- // _lf.lfHeight = 14;
- // _lf.lfWeight = 550;
- // }
- if( g_PaintManager.m_bIsWinXPorLater )
- _lf.lfQuality = CLEARTYPE_QUALITY;
- if( g_PaintManager.m_bIsWinVistaOrLater )
- {
- static __EXT_MFC_SAFE_LPCTSTR g_sDesiredRibbonFontFaceName = _T("Segoe UI");
- CWindowDC dc( NULL );
- if( ! ::EnumFontFamilies(
- dc.m_hDC,
- NULL,
- (FONTENUMPROC)stat_FindFontByNameCallBack,
- reinterpret_cast < LPARAM > ( LPCTSTR(g_sDesiredRibbonFontFaceName) )
- )
- )
- {
- __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, g_sDesiredRibbonFontFaceName );
- _lf.lfWidth = 0;
- if( UiScalingIsEnabled( __EUIST_Y )
- && g_PaintManager.m_nLPY > 96
- )
- _lf.lfHeight = -13;
- else
- _lf.lfHeight = -11;
- }
- }
- VERIFY( m_FontRibbonNormal.CreateFontIndirect( &_lf ) );
- VERIFY( m_FontRibbonGroupCaption.CreateFontIndirect( &_lf ) );
- VERIFY( m_FontRibbonTabItem.CreateFontIndirect( &_lf ) );
- }
- void CExtPaintManagerOffice2007_R1::Ribbon_SyncFonts()
- {
- ASSERT_VALID( this );
- ASSERT( m_FontNormal.GetSafeHandle() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_SyncFonts();
- return;
- }
- CExtPaintManagerOffice2003::Ribbon_SyncFonts();
- ASSERT( m_FontRibbonTabItem.GetSafeHandle() != NULL );
- LOGFONT _lf;
- ::memset( &_lf, 0, sizeof(LOGFONT) );
- m_FontRibbonTabItem.GetLogFont( &_lf );
- m_FontRibbonTabItem.DeleteObject();
- _lf.lfWidth = 0;
- _lf.lfHeight = -13;
- VERIFY( m_FontRibbonTabItem.CreateFontIndirect( &_lf ) );
- }
- CRect CExtPaintManager::Ribbon_GetPopupGroupBorderMetrics(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage; lParam;
- return CRect( 2, 2, 2, 2 );
- }
- CRect CExtPaintManagerXP::Ribbon_GetPopupGroupBorderMetrics(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage; lParam;
- return CRect( 1, 1, 1, 1 );
- }
- CRect CExtPaintManagerOffice2007_Impl::Ribbon_GetPopupGroupBorderMetrics(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_GetPopupGroupBorderMetrics( pRibbonPage, lParam );
- return CRect( -1, 0, -1, -2 );
- }
- CRect CExtPaintManagerOffice2007_R1::Ribbon_GetPopupGroupBorderMetrics(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_GetPopupGroupBorderMetrics( pRibbonPage, lParam );
- return CRect( 1, 1, 1, 1 );
- }
- bool CExtPaintManager::Ribbon_IsPopupGroupWithCaption(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- pHelperSrc; lParam;
- return false;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_IsPopupGroupWithCaption(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_IsPopupGroupWithCaption( pHelperSrc, lParam );
- return true;
- }
- bool CExtPaintManagerOffice2007_R1::Ribbon_IsPopupGroupWithCaption(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_IsPopupGroupWithCaption( pHelperSrc, lParam );
- return false;
- }
- INT CExtPaintManager::RibbonQuickAccessBar_GetBottomHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage; lParam;
- INT nHeight = UiScalingDo( 24, __EUIST_Y );
- return nHeight;
- }
- INT CExtPaintManagerOffice2007_R2_LunaBlue::RibbonQuickAccessBar_GetBottomHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonQuickAccessBar_GetBottomHeight( pRibbonPage, lParam );
- INT nHeight = UiScalingDo( 26, __EUIST_Y );
- return nHeight;
- }
- INT CExtPaintManagerOffice2007_R2_Silver::RibbonQuickAccessBar_GetBottomHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonQuickAccessBar_GetBottomHeight( pRibbonPage, lParam );
- INT nHeight = UiScalingDo( 24, __EUIST_Y );
- return nHeight;
- }
- INT CExtPaintManagerOffice2007_R2_Obsidian::RibbonQuickAccessBar_GetBottomHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonQuickAccessBar_GetBottomHeight( pRibbonPage, lParam );
- INT nHeight = UiScalingDo( 24, __EUIST_Y );
- return nHeight;
- }
- INT CExtPaintManager::RibbonQuickAccessBar_GetButtonsAlignment(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage; lParam;
- return 0;
- }
- INT CExtPaintManagerOffice2007_Impl::RibbonQuickAccessBar_GetButtonsAlignment(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonQuickAccessBar_GetButtonsAlignment( pRibbonPage, lParam );
- return m_nRibbonQuickAccessBarButtonsAlignment;
- }
- void CExtPaintManager::RibbonQuickAccessBar_PaintBkAtTheBottom(
- CDC & dc,
- CRect rcQATB,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- dc; rcQATB; pRibbonPage; lParam;
- }
- void CExtPaintManagerNativeXP::RibbonQuickAccessBar_PaintBkAtTheBottom(
- CDC & dc,
- CRect rcQATB,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- if( g_PaintManager.m_UxTheme.OpenThemeData( pRibbonPage->GetSafeHwnd(), VSCLASS_REBAR ) != NULL )
- {
- CRect rcPaint = rcQATB;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pRibbonPage->GetSafeHwnd(),
- dc.GetSafeHdc(),
- 0,
- 0,
- &rcPaint,
- &rcPaint
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- void CExtPaintManagerOffice2007_Impl::RibbonQuickAccessBar_PaintBkAtTheBottom(
- CDC & dc,
- CRect rcQATB,
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::RibbonQuickAccessBar_PaintBkAtTheBottom( dc, rcQATB, pRibbonPage, lParam );
- return;
- }
- if( m_bmpRibbonQuickAccessBarBkAtTheBottom.IsEmpty() )
- return;
- m_bmpRibbonQuickAccessBarBkAtTheBottom.AlphaBlendSkinParts(
- dc.m_hDC,
- rcQATB,
- m_rcPaddingRibbonQuickAccessBarBkAtTheBottom,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- void CExtPaintManager::RibbonQuickAccessBar_AdjustButtonLocation(
- CExtBarButton * pTBB,
- CRect & rcTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTBB );
- pTBB; rcTBB; lParam;
- }
- void CExtPaintManagerOffice2007_Impl::RibbonQuickAccessBar_AdjustButtonLocation(
- CExtBarButton * pTBB,
- CRect & rcTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTBB );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::RibbonQuickAccessBar_AdjustButtonLocation( pTBB, rcTBB, lParam );
- return;
- }
- if( g_PaintManager.m_DWM.IsCompositionEnabled()
- && Ribbon_FileButtonIsItegrationSupported()
- )
- {
- CExtRibbonBar * pRibbonBar = STATIC_DOWNCAST( CExtRibbonBar, pTBB->GetBar() );
- if( pRibbonBar != NULL
- && pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- && pRibbonBar->RibbonQuickAccessBar_AboveTheRibbonGet()
- )
- {
- bool bZoomedMode = false;
- if( pRibbonBar->GetParent()->IsZoomed() )
- bZoomedMode = true;
- rcTBB.OffsetRect( 0, bZoomedMode ? 3 : 2 );
- // if( ( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_LunaBlue ) ) )
- // && ( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Obsidian ) ) )
- // && ( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Silver ) ) )
- // )
- // rcTBB.OffsetRect( 0, 3 );
- // else
- // {
- // if( UiScalingIsEnabled( __EUIST_Y )
- // && g_PaintManager.m_nLPY > 96
- // )
- // rcTBB.OffsetRect( 0, 1 );
- // }
- }
- } // if( g_PaintManager.m_DWM.IsCompositionEnabled() ...
- }
- INT CExtPaintManager::RibbonQuickAccessBar_GetAdditionalSpaceAtRight(
- bool bDwmMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- bDwmMode; pHelperSrc; lParam;
- return 0;
- }
- INT CExtPaintManagerOffice2007_Impl::RibbonQuickAccessBar_GetAdditionalSpaceAtRight(
- bool bDwmMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- pHelperSrc; lParam;
- return bDwmMode ? m_nQatbAdditionalSpaceAtRightDWM : m_nQatbAdditionalSpaceAtRight;
- }
- void CExtPaintManager::Ribbon_PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- bool bSelected,
- const CRect & rcEntireItem,
- 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)
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- if( ! dc.RectVisible( &rcEntireItem ) )
- return;
- if( clrForceText == COLORREF(-1L) )
- clrForceText = GetColor( COLOR_BTNTEXT );
- if( clrForceTabSeparator == COLORREF(-1L) )
- clrForceTabSeparator = GetColor( COLOR_BTNTEXT );
- CRect _rcEntireItem = rcEntireItem;
- if( bSelected )
- _rcEntireItem.DeflateRect( 0, 2, 0, 0 );
- // else if(
- // pHelperSrc != NULL
- // && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtBarButton ) )
- // && ((CExtBarButton*)pHelperSrc)->IsHover()
- // )
- // {
- // bSelected = true;
- // _rcEntireItem.DeflateRect( 2, 1, 3, 1 );
- // clrForceText = GetColor( COLOR_3DHIGHLIGHT );
- // clrForceTabBk = clrForceTabBorderLT = clrForceTabBorderRB =
- // GetColor( COLOR_3DDKSHADOW );
- // }
- else
- _rcEntireItem.DeflateRect( 0, 2, 0, 2 );
- CSize sizeTextMeasured = stat_CalcTextDimension( dc, *pFont, CExtSafeString(sText), DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- PaintTabItem(
- dc,
- rcTabItemsArea,
- true,
- true,
- bSelected,
- true,
- false,
- false,
- false,
- _rcEntireItem,
- sizeTextMeasured,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator
- );
- }
- void CExtPaintManagerNativeXP::Ribbon_PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- bool bSelected,
- const CRect & rcEntireItem,
- 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)
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- if( ! dc.RectVisible( &rcEntireItem ) )
- return;
- if( clrForceText == COLORREF(-1L) )
- clrForceText = GetColor( COLOR_BTNTEXT );
- if( clrForceTabSeparator == COLORREF(-1L) )
- clrForceTabSeparator = GetColor( COLOR_BTNTEXT );
- CRect _rcEntireItem = rcEntireItem;
- _rcEntireItem.DeflateRect( 0, 2, 0, 2 );
- CSize sizeTextMeasured = stat_CalcTextDimension( dc, *pFont, CExtSafeString(sText), DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- PaintTabItem(
- dc,
- rcTabItemsArea,
- true,
- true,
- bSelected,
- true,
- false,
- false,
- false,
- _rcEntireItem,
- sizeTextMeasured,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator
- );
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- bool bSelected,
- const CRect & rcEntireItem,
- 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)
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- if( ! dc.RectVisible( &rcEntireItem ) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintTabItem(
- dc,
- rcTabItemsArea,
- bSelected,
- rcEntireItem,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator
- );
- return;
- }
- bool bDwmMode = false;
- if( g_PaintManager.m_bIsWinVistaOrLater
- && g_PaintManager.m_DWM.IsCompositionEnabled()
- && pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtBarButton) )
- )
- {
- CExtToolControlBar * pToolBar = ((CExtBarButton*)pHelperSrc)->GetSafeBar();
- if( pToolBar != NULL )
- {
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pToolBar );
- if( pRibbonBar != NULL )
- {
- if( pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- bDwmMode = true;
- }
- }
- }
- CDC * pDC = &dc;
- CExtMemoryDC * p_dc32 = NULL;
- if( bDwmMode )
- {
- if( ! g_PaintManager.m_UxTheme.OpenThemeDataEx( ::GetDesktopWindow(), VSCLASS_WINDOW, __EXT_UX_OTD_NONCLIENT ) != NULL )
- bDwmMode = false;
- else
- {
- p_dc32 = new CExtMemoryDC(
- &dc,
- &rcEntireItem,
- CExtMemoryDC::MDCOPT_TO_MEMORY
- | CExtMemoryDC::MDCOPT_FORCE_DIB
- | CExtMemoryDC::MDCOPT_FILL_BITS
- | CExtMemoryDC::MDCOPT_DIB_NEGATIVE_HEIGHT
- );
- ASSERT( p_dc32->GetSafeHdc() != NULL );
- pDC = p_dc32;
- }
- }
- CSize sizeTextMeasured = stat_CalcTextDimension( dc, *pFont, CExtSafeString(sText), DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- PaintTabItem(
- *pDC,
- rcTabItemsArea,
- true,
- true,
- bSelected,
- true,
- false,
- false,
- false,
- rcEntireItem,
- sizeTextMeasured,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator,
- bDwmMode
- );
- if( bDwmMode )
- {
- ASSERT( p_dc32 != NULL );
- delete p_dc32;
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- void CExtPaintManagerOffice2007_R1::Ribbon_PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- bool bSelected,
- const CRect & rcEntireItem,
- 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)
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintTabItem(
- dc,
- rcTabItemsArea,
- bSelected,
- rcEntireItem,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator
- );
- return;
- }
- CRect _rcEntireItem = rcEntireItem;
- _rcEntireItem.top ++;
- if( ! dc.RectVisible( &_rcEntireItem ) )
- return;
- CExtPaintManagerOffice2007_Impl::Ribbon_PaintTabItem(
- dc,
- rcTabItemsArea,
- bSelected,
- _rcEntireItem,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator
- );
- }
- void CExtPaintManager::Ribbon_PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- dc;
- rcClient;
- rcTabItemsArea;
- rcTabNearBorderArea;
- pHelperSrc;
- lParam;
- }
- void CExtPaintManagerOffice2007_R1::Ribbon_PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_PaintTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc == NULL )
- return;
- ASSERT_VALID( pHelperSrc );
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- if( pRibbonBar == NULL )
- return;
- CRect rcLine(
- rcClient.left,
- rcTabItemsArea.top,
- rcClient.right,
- rcTabItemsArea.top + 1
- );
- if( dc.RectVisible( &rcLine ) )
- dc.FillSolidRect(
- rcLine,
- RGB(216,214,214)
- );
- if( m_bmpRibbonFileButtonArea.IsEmpty() )
- return;
- CExtRibbonButtonFile * pFileTBB = pRibbonBar->Ribbon_FileButtonGet();
- if( pFileTBB == NULL )
- return;
- ASSERT_VALID( pFileTBB );
- CRect rcTBB = *pFileTBB;
- CRect rcDst(
- rcClient.left,
- rcTabItemsArea.top,
- rcTBB.right + 6,
- rcTabItemsArea.bottom
- );
- CRect rcPadding( 0, 0, 10, 0 );
- if( dc.RectVisible( &rcDst ) )
- m_bmpRibbonFileButtonArea.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDst,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- CExtPaintManagerOffice2003::Ribbon_PaintTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- pHelperSrc,
- lParam
- );
- if( IsHighContrast() )
- return;
- if( pHelperSrc == NULL )
- return;
- ASSERT_VALID( pHelperSrc );
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- if( pRibbonBar == NULL )
- return;
- if( Ribbon_DwmAreaCoversTabs() )
- {
- bool bDrawDefaultTabClientArea = true;
- if( (! m_bmpRibbonTabAreaBlur.IsEmpty() ) && g_PaintManager.m_DWM.IsCompositionEnabled() )
- {
- bool bDwmMode = false;
- if( pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- bDwmMode = true;
- if( bDwmMode )
- {
- bDrawDefaultTabClientArea = false;
- CRect rcBlur = rcTabItemsArea;
- rcBlur.top = min( rcBlur.top, rcClient.top );
- DWORD dwDcLayout = dc.GetLayout();
- dc.SetLayout( LAYOUT_LTR );
- m_bmpRibbonTabAreaBlur.AlphaBlendSkinParts(
- dc.m_hDC,
- rcBlur,
- m_rcRibbonTabAreaBlurPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- dc.SetLayout( dwDcLayout );
- }
- }
- if( bDrawDefaultTabClientArea && pHelperSrc != NULL && ( m_clrRibbonTabClientAreaActive != COLORREF(-1L) || m_clrRibbonTabClientAreaInactive != COLORREF(-1L) ) )
- {
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- if( pRibbonBar != NULL && pRibbonBar->m_pExtNcFrameImpl != NULL )
- {
- COLORREF clrFill = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsActive() ? m_clrRibbonTabClientAreaActive : m_clrRibbonTabClientAreaInactive;
- dc.FillSolidRect( &rcTabItemsArea, clrFill );
- }
- }
- }
- }
- INT CExtPaintManager::Ribbon_GetTabIntersectionHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- return 0;
- }
- INT CExtPaintManagerNativeXP::Ribbon_GetTabIntersectionHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- return 0;
- }
- INT CExtPaintManagerOffice2007_Impl::Ribbon_GetTabIntersectionHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_GetTabIntersectionHeight(
- pRibbonPage,
- lParam
- );
- return m_nRibbonTabIntersectionHeight;
- }
- INT CExtPaintManager::Ribbon_GetTabLineHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- pRibbonPage;
- lParam;
- CFont * pMeasureFont = (CFont*)&m_FontRibbonNormal;
- ASSERT( pMeasureFont->GetSafeHandle() != NULL );
- CWindowDC dc( NULL );
- CFont * pOldFont = dc.SelectObject( pMeasureFont );
- TEXTMETRIC _TxtM;
- ::memset( &_TxtM, 0, sizeof(TEXTMETRIC) );
- if( ! dc.GetTextMetrics( &_TxtM ) )
- _TxtM.tmHeight = 17;
- dc.SelectObject( pOldFont );
- // INT nBasicHeight = _TxtM.tmHeight + 10;
- // INT nTabLineHeight = UiScalingDo( nBasicHeight, __EUIST_Y );
- INT nTabLineHeight = _TxtM.tmHeight + UiScalingDo( 10, __EUIST_Y );
- return nTabLineHeight;
- }
- INT CExtPaintManagerOffice2007_R1::Ribbon_GetTabLineHeight(
- const CExtRibbonPage * pRibbonPage,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonPage );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_GetTabLineHeight( pRibbonPage, lParam );
- INT nTabLineHeight = CExtPaintManagerOffice2007_Impl::Ribbon_GetTabLineHeight( pRibbonPage, lParam );
- return nTabLineHeight;
- }
- HRGN CExtPaintManager::Ribbon_GetRgnCornerExclude(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return ((HRGN)NULL);
- }
- HRGN CExtPaintManagerOffice2007_Impl::Ribbon_GetRgnCornerExclude(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_GetRgnCornerExclude(
- pHelperSrc,
- lParam
- );
- if( pHelperSrc != 0
- && pHelperSrc->IsKindOf( RUNTIME_CLASS(CWnd) )
- && ((CWnd*)pHelperSrc)->IsZoomed()
- )
- return NULL;
- HRGN hRgn = (HRGN)m_rgnRibbonNcCornerExclude.GetSafeHandle();
- if( hRgn != NULL )
- return hRgn;
- if( m_bmpRibbonNcCornerHT.IsEmpty() )
- return ((HRGN)NULL);
- HRGN hRgnBmp = m_bmpRibbonNcCornerHT.GenerateColorHRGN( false, RGB(255,0,255) );
- if( hRgnBmp == NULL )
- return NULL;
- CSize _size = m_bmpRibbonNcCornerHT.GetSize();
- hRgn = ::CreateRectRgn( 0, 0, _size.cx, _size.cy );
- ::CombineRgn( hRgn, hRgn, hRgnBmp, RGN_DIFF );
- ::DeleteObject( hRgnBmp );
- m_rgnRibbonNcCornerExclude.Attach( hRgn );
- return hRgn;
- }
- HRGN CExtPaintManager::Ribbon_GetRgnCornerResizing(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- return ((HRGN)NULL);
- }
- HRGN CExtPaintManagerOffice2007_Impl::Ribbon_GetRgnCornerResizing(
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_GetRgnCornerResizing(
- pHelperSrc,
- lParam
- );
- HRGN hRgn = (HRGN)m_rgnRibbonNcCornerResizing.GetSafeHandle();
- if( hRgn != NULL )
- return hRgn;
- if( m_bmpRibbonNcCornerHT.IsEmpty() )
- return ((HRGN)NULL);
- bool bRTL = false;
- if( pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS(CWnd) )
- && (((CWnd*)pHelperSrc)->GetExStyle()&WS_EX_LAYOUTRTL) != 0
- )
- bRTL = true;
- HRGN hRgnBmp = m_bmpRibbonNcCornerHT.GenerateColorHRGN( bRTL, RGB(0,255,0) );
- if( hRgnBmp == NULL )
- return NULL;
- CSize _size = m_bmpRibbonNcCornerHT.GetSize();
- hRgn = ::CreateRectRgn( 0, 0, _size.cx, _size.cy );
- ::CombineRgn( hRgn, hRgn, hRgnBmp, RGN_DIFF );
- ::DeleteObject( hRgnBmp );
- m_rgnRibbonNcCornerResizing.Attach( hRgn );
- return hRgn;
- }
- void CExtPaintManager::Ribbon_EmbeddedCaptionPaintText(
- CDC & dc,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- CRect rcDrawText,
- __EXT_MFC_SAFE_LPCTSTR strCaptionDelimiter,
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- dc;
- pRibbonBar;
- strCaption;
- rcDrawText;
- strCaptionDelimiter;
- pRibbonBar;
- lParam;
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_EmbeddedCaptionPaintText(
- CDC & dc,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- CRect rcDrawText,
- __EXT_MFC_SAFE_LPCTSTR strCaptionDelimiter,
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- if( strCaption == NULL
- || (! dc.RectVisible(&rcDrawText) )
- )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_EmbeddedCaptionPaintText(
- dc,
- strCaption,
- rcDrawText,
- strCaptionDelimiter,
- pRibbonBar,
- lParam
- );
- return;
- }
- INT nLenCaption = INT( _tcslen( strCaption ) );
- if( nLenCaption == 0 )
- return;
- bool bRTL = ( (pRibbonBar->GetExStyle()&WS_EX_LAYOUTRTL) != 0 ) ? true : false;;
- if( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) )
- {
- if( bRTL )
- {
- CRect rcClient;
- pRibbonBar->GetClientRect( &rcClient );
- rcDrawText.OffsetRect(
- rcClient.right - rcDrawText.left * 2 - rcDrawText.Width(),
- 0
- );
- } // if( bRTL )
- } // if( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) )
- UINT nBaseDT = Ribbon_EmbeddedCaptionGetTextAlignmentFlags( pRibbonBar );
- //UINT nAlignDT = nBaseDT & (DT_LEFT|DT_CENTER|DT_RIGHT);
- UINT nDT = nBaseDT & (~(DT_CALCRECT));
- if( bRTL )
- {
- if( (nDT&3) == DT_RIGHT )
- {
- nDT &= ~3;
- nDT |= DT_LEFT;
- }
- else if( (nDT&3) == DT_LEFT )
- {
- nDT &= ~3;
- nDT |= DT_RIGHT;
- }
- } // if( bRTL )
- CExtSafeString strLeft = strCaption, strMiddle, strRight;
- INT nLenDelimiter = 0;
- if( strCaptionDelimiter != NULL )
- {
- nLenDelimiter = INT( _tcslen( strCaptionDelimiter ) );
- if( nLenDelimiter > 0 )
- {
- INT nPos = strLeft.Find( strCaptionDelimiter );
- if( nPos >= 0 )
- {
- strRight = strLeft.Right( nLenCaption - nPos - nLenDelimiter );
- strLeft = strLeft.Left( nPos );
- if( ! strRight.IsEmpty() )
- strMiddle = strCaptionDelimiter;
- } // if( nPos >= 0 )
- } // if( nLenDelimiter > 0 )
- } // if( strCaptionDelimiter != NULL )
- CFont * pOldFont = dc.SelectObject( &m_FontCaption );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldText = dc.GetTextColor();
- nDT &= ~(DT_END_ELLIPSIS);
- INT nWidthLeft = stat_CalcTextDimension( dc, m_FontCaption, strLeft, DT_SINGLELINE|DT_LEFT|DT_TOP|DT_CALCRECT ).Width();
- INT nWidthMiddle = 0, nWidthRight = 0, nWidthAvailable = rcDrawText.Width();
- if( ! strRight.IsEmpty() )
- {
- nWidthMiddle = stat_CalcTextDimension( dc, m_FontCaption, strMiddle, DT_SINGLELINE|DT_LEFT|DT_TOP|DT_CALCRECT ).Width();
- nWidthRight = stat_CalcTextDimension( dc, m_FontCaption, strRight, DT_SINGLELINE|DT_LEFT|DT_TOP|DT_CALCRECT ).Width();
- }
- dc.SetTextColor( m_clrRibbon_EmbeddedCaptionTextLeft );
- if( nWidthAvailable > ( nWidthLeft + nWidthMiddle + nWidthRight ) && (! strRight.IsEmpty() ) )
- {
- if( (nDT&DT_RIGHT) != 0 )
- rcDrawText.left = rcDrawText.right - ( nWidthLeft + nWidthMiddle + nWidthRight );
- else if( (nDT&DT_CENTER) != 0 )
- rcDrawText.left += ( rcDrawText.Width() - ( nWidthLeft + nWidthMiddle + nWidthRight ) ) / 2;
- nDT &= ~(DT_RIGHT|DT_CENTER);
- nDT |= DT_LEFT;
- dc.DrawText( strLeft, strLeft.GetLength(), rcDrawText, nDT );
- rcDrawText.left += nWidthLeft;
- dc.DrawText( strMiddle, strMiddle.GetLength(), rcDrawText, nDT );
- dc.SetTextColor( m_clrRibbon_EmbeddedCaptionTextRight );
- rcDrawText.left += nWidthMiddle;
- nDT |= DT_END_ELLIPSIS;
- dc.DrawText( strRight, strRight.GetLength(), rcDrawText, nDT );
- } // if( nWidthAvailable > ( nWidthLeft + nWidthMiddle ) && (! strRight.IsEmpty() ) )
- else
- {
- nDT &= ~(DT_LEFT|DT_CENTER|DT_RIGHT);
- nDT |= DT_LEFT; // nDT |= nAlignDT;
- nDT |= DT_END_ELLIPSIS;
- if( bRTL )
- nDT |= DT_RTLREADING;
- dc.DrawText( strLeft, strLeft.GetLength(), rcDrawText, nDT );
- if(! strRight.IsEmpty() )
- {
- rcDrawText.left += nWidthLeft;
- if( ( rcDrawText.Width() + nWidthMiddle ) > 0 )
- {
- dc.DrawText( strMiddle, strMiddle.GetLength(), rcDrawText, nDT );
- dc.SetTextColor( m_clrRibbon_EmbeddedCaptionTextRight );
- rcDrawText.left += nWidthMiddle;
- dc.DrawText( strRight, strRight.GetLength(), rcDrawText, nDT );
- }
- }
- } // else from if( nWidthAvailable > ( nWidthLeft + nWidthMiddle ) && (! strRight.IsEmpty() ) )
- dc.SetTextColor( clrOldText );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( &pOldFont );
- }
- UINT CExtPaintManager::Ribbon_EmbeddedCaptionGetTextAlignmentFlags(
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- pRibbonBar;
- lParam;
- return (DT_SINGLELINE|DT_CENTER|DT_VCENTER);
- }
- UINT CExtPaintManagerOffice2007_Impl::Ribbon_EmbeddedCaptionGetTextAlignmentFlags(
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_EmbeddedCaptionGetTextAlignmentFlags(
- pRibbonBar,
- lParam
- );
- return m_nRibbonEmbeddedCaptionTextAlignmentFlags;
- }
- void CExtPaintManager::Ribbon_EmbeddedCaptionAdjustTextRect(
- CRect & rcAdjust,
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- rcAdjust;
- pRibbonBar;
- lParam;
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_EmbeddedCaptionAdjustTextRect(
- CRect & rcAdjust,
- const CExtRibbonBar * pRibbonBar,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_EmbeddedCaptionAdjustTextRect(
- rcAdjust,
- pRibbonBar,
- lParam
- );
- return;
- }
- bool bDwmMode = false;
- if( pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- bDwmMode = true;
- if( ( ! bDwmMode )
- && pRibbonBar->GetParent()->IsZoomed()
- )
- {
- rcAdjust.OffsetRect( 0, 3 );
- }
- }
- void CExtPaintManager::Ribbon_NcOverPaint(
- CDC & dc,
- bool bFrameActive,
- INT nWidthFromLeft,
- bool bDwmMode,
- LPCRECT pRectDwmText,
- __EXT_MFC_SAFE_LPCTSTR strDwmCaptionTitle,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- dc; bFrameActive; nWidthFromLeft; bDwmMode; pRectDwmText; strDwmCaptionTitle; pHelperSrc; lParam;
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_NcOverPaint(
- CDC & dc,
- bool bFrameActive,
- INT nWidthFromLeft,
- bool bDwmMode,
- LPCRECT pRectDwmText,
- __EXT_MFC_SAFE_LPCTSTR strDwmCaptionTitle,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_NcOverPaint( dc, bFrameActive, nWidthFromLeft, bDwmMode, pRectDwmText, strDwmCaptionTitle, pHelperSrc, lParam );
- return;
- }
- bool bZoomedMode = false;
- bool bThirdRelease = false, bSecondRelease = false, bDrawQatbBackground = true;
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_LunaBlue ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Silver ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Obsidian ) )
- )
- {
- bThirdRelease = true;
- if( pHelperSrc != NULL )
- {
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- if( pRibbonBar != NULL )
- {
- if( ! pRibbonBar->RibbonQuickAccessBar_AboveTheRibbonGet() )
- bDrawQatbBackground = false;
- if( pRibbonBar->GetParent()->IsZoomed() )
- bZoomedMode = true;
- } // if( pRibbonBar != NULL )
- } // if( pHelperSrc != NULL )
- }
- else
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_LunaBlue ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_Silver ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_Obsidian ) )
- )
- {
- bSecondRelease = true;
- if( pHelperSrc != NULL )
- {
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- if( pRibbonBar != NULL )
- {
- if( pRibbonBar->GetParent()->IsZoomed() )
- bZoomedMode = true;
- } // if( pRibbonBar != NULL )
- } // if( pHelperSrc != NULL )
- }
- nWidthFromLeft += 15;
- bool bActiveGlyph = bFrameActive && ( ! ( bDwmMode && bThirdRelease ) );
- CExtBitmap & _bmpLeft = ( bDwmMode && ( ! m_bmpRibbonNcCornerDwmLeft.IsEmpty() ) ) ? m_bmpRibbonNcCornerDwmLeft : ( bActiveGlyph ? m_bmpRibbonNcCornerActiveLeft : m_bmpRibbonNcCornerInactiveLeft );
- CExtBitmap & _bmpRight = ( bDwmMode && ( ! m_bmpRibbonNcCornerDwmRight.IsEmpty() ) ) ? m_bmpRibbonNcCornerDwmRight : ( bActiveGlyph ? m_bmpRibbonNcCornerActiveRight : m_bmpRibbonNcCornerInactiveRight );
- if( _bmpLeft.IsEmpty() || _bmpRight.IsEmpty() )
- bDrawQatbBackground = false;
- if( bDrawQatbBackground )
- {
- CSize _sizeLeft = _bmpLeft.GetSize();
- CSize _sizeRight = _bmpRight.GetSize();
- if( bThirdRelease )
- {
- _sizeLeft.cy = UiScalingDo( _sizeLeft.cy, __EUIST_Y );
- _sizeRight.cy = UiScalingDo( _sizeRight.cy, __EUIST_Y );
- } // if( bThirdRelease )
- INT nMinWidthFromLeft = _sizeLeft.cx + _sizeRight.cx;
- if( nWidthFromLeft < nMinWidthFromLeft )
- nWidthFromLeft = nMinWidthFromLeft;
- CRect rcRibbonNcCornerLeftCP = m_rcRibbonNcCornerLeftCP;
- CRect rcRibbonNcCornerRightCP = m_rcRibbonNcCornerRightCP;
- BYTE nSCA = BYTE(0x0FF);
- CRect rcDstLeft( 0, 0, _sizeLeft.cx, _sizeLeft.cy );
- CRect rcDstRight( _sizeLeft.cx, 0, nWidthFromLeft, _sizeRight.cy );
- if( bThirdRelease )
- {
- if( g_PaintManager.m_nLPY > 96 )
- rcDstLeft.left += 10;
- if( bDwmMode )
- {
- POINT ptOffset = { 4, -2 };
- if( bZoomedMode )
- {
- ptOffset.x -= ::GetSystemMetrics( SM_CXFRAME )/4;
- ptOffset.y += ::GetSystemMetrics( SM_CYFRAME ) - 2;
- }
- rcDstLeft. OffsetRect( ptOffset );
- rcDstRight.OffsetRect( ptOffset );
- if( UiScalingIsEnabled( __EUIST_Y )
- && g_PaintManager.m_nLPY > 96
- )
- {
- rcDstLeft. bottom -= 1;
- rcDstRight.bottom -= 1;
- }
- else
- {
- rcDstLeft. bottom += 1;
- rcDstRight.bottom += 1;
- }
- rcRibbonNcCornerRightCP.left = 0;
- } // if( bDwmMode )
- else
- {
- if( bZoomedMode )
- {
- const POINT ptOffset = { -4, -4 };
- rcDstLeft. OffsetRect( ptOffset );
- rcDstRight.OffsetRect( ptOffset );
- }
- if( ! g_PaintManager.m_bIsWin2000orLater )
- {
- rcRibbonNcCornerRightCP.left = 0;
- } // if( ! g_PaintManager.m_bIsWin2000orLater )
- } // else from if( bDwmMode )
- } // if( bThirdRelease )
- else
- {
- if( bDwmMode )
- {
- POINT ptOffset = { 8, -1 };
- if( bZoomedMode )
- ptOffset.y += ::GetSystemMetrics( SM_CYFRAME );
- rcDstLeft. OffsetRect( ptOffset );
- rcDstRight.OffsetRect( ptOffset );
- if( ! bZoomedMode )
- {
- rcDstLeft. top += 4;
- rcDstRight.top += 4;
- }
- } // if( bDwmMode )
- else
- {
- if( bSecondRelease )
- {
- if( bZoomedMode )
- {
- const POINT ptOffset = { -5, -4 };
- rcDstLeft. OffsetRect( ptOffset );
- rcDstRight.OffsetRect( ptOffset );
- }
- } // if( bSecondRelease )
- } // if( bDwmMode )
- } // else from if( bThirdRelease )
- DWORD dwOldRTF = 0;
- if( bDwmMode )
- {
- dwOldRTF = _bmpLeft.RunTimeFlagsGet();
- _bmpLeft.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- }
- _bmpLeft.AlphaBlendSkinParts( dc.m_hDC, rcDstLeft, m_rcRibbonNcCornerLeftCP, CExtBitmap::__EDM_STRETCH, true, true, nSCA );
- if( bDwmMode )
- {
- _bmpLeft.RunTimeFlagsSet( dwOldRTF );
- dwOldRTF = _bmpRight.RunTimeFlagsGet();
- _bmpRight.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- // if( bSecondRelease )
- // rcDstRight.right -= rcRibbonNcCornerRightCP.left + rcRibbonNcCornerRightCP.right;
- }
- rcDstRight.right -= RibbonQuickAccessBar_GetAdditionalSpaceAtRight( bDwmMode, pHelperSrc );
- _bmpRight.AlphaBlendSkinParts( dc.m_hDC, rcDstRight, rcRibbonNcCornerRightCP, CExtBitmap::__EDM_STRETCH, true, true, nSCA );
- if( bDwmMode )
- _bmpRight.RunTimeFlagsSet( dwOldRTF );
- } // if( bDrawQatbBackground )
- INT nTextLen = 0;
- if( pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtRibbonBar) )
- )
- {
- CExtRibbonBar * pRibbonBar = STATIC_DOWNCAST( CExtRibbonBar, pHelperSrc );
- CRect rcIcon( 0, 0, 0, 0 );
- if( bDwmMode
- && pRectDwmText != NULL
- && LPCTSTR(strDwmCaptionTitle) != NULL
- && ( nTextLen = INT(_tcslen(LPCTSTR(strDwmCaptionTitle))) ) > 0
- // && pRectDwmText->left < pRectDwmText->right
- // && pRectDwmText->top < pRectDwmText->bottom
- // && dc.RectVisible( pRectDwmText )
- )
- {
- CWnd * pWnd = (CWnd*)pHelperSrc;
- bool bRTL = ( (pWnd->GetExStyle()&WS_EX_LAYOUTRTL) != 0 ) ? true : false;
- for( ; (pWnd->GetStyle()&WS_CHILD) != 0; pWnd = pWnd->GetParent() );
- if( pWnd != NULL )
- {
- CRect rcText = *pRectDwmText;
- if( pRibbonBar->m_pExtNcFrameImpl != NULL )
- {
- bool bMode2007_R1 = IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) ? true : false;
- bool bMode2010 = IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2010_Impl ) ) ? true : false;
- if( bMode2007_R1 || bMode2010 )
- {
- CExtCmdIcon _icon;
- pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetIcon( _icon );
- if( ! _icon.IsEmpty() )
- {
- CSize _sizeIcon = _icon.GetSize();
- ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
- INT nIconTop = rcText.top + ( rcText.Height() - _sizeIcon.cy ) / 2;
- if( bMode2010 )
- {
- // if( bRTL )
- // {
- // rcIcon = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetNcHtRect( HTCAPTION, false );
- // rcIcon.left = rcIcon.right - _sizeIcon.cx;
- // rcIcon.bottom = rcIcon.top + _sizeIcon.cy;
- // rcIcon.OffsetRect( - ::GetSystemMetrics( SM_CXFRAME ), rcText.top - rcIcon.top + ( rcText.Height() - _sizeIcon.cy ) / 2 + ( pWnd->IsZoomed() ? (-2) : 1 ) );
- // }
- // else
- {
- rcIcon = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetNcHtRect( HTSYSMENU, false );
- rcIcon.right = rcIcon.left + _sizeIcon.cx;
- rcIcon.bottom = rcIcon.top + _sizeIcon.cy;
- if( bRTL )
- {
- CRect rcWnd;
- pWnd->GetWindowRect( &rcWnd );
- rcIcon.OffsetRect( - rcWnd.Width() + _sizeIcon.cx * 2 , 0 );
- }
- else
- rcIcon.OffsetRect( ::GetSystemMetrics( SM_CXFRAME ), 0 );
- rcIcon.OffsetRect( 0, rcText.top - rcIcon.top + ( rcText.Height() - _sizeIcon.cy ) / 2 + ( pWnd->IsZoomed() ? (-2) : 1 ) );
- }
- }
- else
- {
- rcIcon.SetRect( rcText.left, nIconTop, rcText.left + _sizeIcon.cx, nIconTop + _sizeIcon.cy );
- INT nV = ::GetSystemMetrics( SM_CXFRAME );
- rcIcon.OffsetRect( nV, 0 );
- rcText.left = rcIcon.right + nV;
- }
- if( dc.RectVisible( &rcIcon ) )
- {
- DWORD dwOldRTF = 0;
- CExtCmdIcon::e_paint_type_t ePT = CExtCmdIcon::__PAINT_NORMAL;
- CWnd * pFrameWnd = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetFrameWindow();
- if( pFrameWnd != NULL
- && (! pFrameWnd->IsWindowEnabled() )
- )
- ePT = CExtCmdIcon::__PAINT_DISABLED;
- CExtBitmap & _bmp = _icon.GetBitmap( ePT, this );
- if( bDwmMode && bRTL )
- {
- dwOldRTF = _bmp.RunTimeFlagsGet();
- _bmp.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- }
- if( bRTL )
- {
- CExtBitmap _bmp2 = _bmp;
- _bmp2.FlipHorizontal();
- if( ! _bmp2.IsEmpty() )
- {
- CSize _size = _bmp2.GetSize();
- _bmp2.AlphaBlend(
- dc.m_hDC,
- rcIcon.left, rcIcon.top, rcIcon.Width(), rcIcon.Height(),
- 0, 0, rcIcon.Width(), rcIcon.Height()
- );
- }
- }
- else
- {
- _icon.Paint(
- this,
- dc,
- rcIcon,
- pWnd->IsWindowEnabled() ? CExtCmdIcon::__PAINT_NORMAL : CExtCmdIcon::__PAINT_DISABLED
- );
- }
- if( bDwmMode && bRTL )
- _bmp.RunTimeFlagsSet( dwOldRTF );
- }
- } // if( ! _icon.IsEmpty() )
- } // if( bMode2007_R1 || bMode2010 )
- }
- if( pRectDwmText->left < pRectDwmText->right
- && pRectDwmText->top < pRectDwmText->bottom
- && dc.RectVisible( pRectDwmText )
- )
- {
- HWND hWndOpenThemeData = pWnd->m_hWnd;
- if( g_PaintManager.m_UxTheme.OpenThemeDataEx( hWndOpenThemeData, VSCLASS_WINDOW, __EXT_UX_OTD_NONCLIENT ) != NULL )
- { // if extended theme data was open successfully
- static const int g_nDwmGlowSize2007 = 10;
- CExtSafeString strWindowText = LPCTSTR(strDwmCaptionTitle);
- CFont * pOldFont = dc.SelectObject( &m_FontCaption );
- INT nTextWidthRequredPX = rcText.Width() - g_nDwmGlowSize2007 * 2;
- CExtUxTheme::__EXT_UX_DTTOPTS dtoMeasure = { sizeof(CExtUxTheme::__EXT_UX_DTTOPTS) };
- dtoMeasure.dwFlags = __EXT_UX_DTT_COMPOSITED | __EXT_UX_DTT_GLOWSIZE;
- dtoMeasure.iGlowSize = g_nDwmGlowSize2007;
- CRect rcTextMeasure;
- rcTextMeasure.SetRect( 0, 0, 0, 0 );
- g_PaintManager.m_UxTheme.GetThemeTextExtent(
- dc.m_hDC,
- 0,
- 0,
- strWindowText,
- -1,
- DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX|DT_CALCRECT,
- NULL,
- &rcTextMeasure
- );
- INT nTextWidthCurrentPX = rcTextMeasure.Width();
- bool bDrawText = true;
- if( nTextWidthCurrentPX > nTextWidthRequredPX )
- {
- bDrawText = false;
- INT nLenCalc = strWindowText.GetLength() - 1;
- for( ; nLenCalc > 0; nLenCalc -- )
- {
- CExtSafeString strCalc = strWindowText.Left( nLenCalc );
- // if( bRTL )
- // {
- // CString strTmp = strCalc;
- // strCalc = _T("...");
- // strCalc += strTmp;
- // } // if( bRTL )
- // else
- strCalc += _T("...");
- rcTextMeasure.SetRect( 0, 0, 0, 0 );
- g_PaintManager.m_UxTheme.GetThemeTextExtent(
- dc.m_hDC,
- 0,
- 0,
- strCalc,
- -1,
- DT_SINGLELINE|DT_LEFT|DT_TOP|DT_NOPREFIX|DT_CALCRECT,
- NULL,
- &rcTextMeasure
- );
- INT nTextWidthCurrentPX = rcTextMeasure.Width();
- if( nTextWidthCurrentPX <= nTextWidthRequredPX )
- {
- strWindowText = strCalc;
- bDrawText = true;
- break;
- } // if( nTextWidthCurrentPX <= nTextWidthRequredPX )
- } // for( ; nLenCalc > 0; nLenCalc -- )
- } // if( nTextWidthCurrentPX > nTextWidthRequredPX )
- dc.SelectObject( &pOldFont );
- if( bDrawText )
- {
- DWORD dwOldLayout1 = LAYOUT_LTR, dwOldLayout2 = LAYOUT_LTR;
- if( bRTL )
- dwOldLayout1 = dc.SetLayout( LAYOUT_RTL );
- CExtMemoryDC dc32(
- &dc,
- &rcText,
- CExtMemoryDC::MDCOPT_TO_MEMORY
- | CExtMemoryDC::MDCOPT_FORCE_DIB
- | CExtMemoryDC::MDCOPT_FILL_BITS
- | CExtMemoryDC::MDCOPT_DIB_NEGATIVE_HEIGHT
- );
- ASSERT( dc32.GetSafeHdc() != NULL );
- dc.FillSolidRect( &rcText, RGB(0,0,0) );
- if( bRTL )
- dwOldLayout2 = dc32.SetLayout( LAYOUT_RTL );
- pOldFont = dc32.SelectObject( &m_FontCaption );
- CExtUxTheme::__EXT_UX_DTTOPTS dto = { sizeof(CExtUxTheme::__EXT_UX_DTTOPTS) };
- dto.dwFlags = __EXT_UX_DTT_TEXTCOLOR;
- dto.iGlowSize = g_nDwmGlowSize2007;
- if( ( ! g_PaintManager.m_bIsWin7OrLater ) && pWnd->IsZoomed() )
- dto.crText = RGB(0x0FF,0x0FF,0x0FF);
- else
- {
- dto.dwFlags |= __EXT_UX_DTT_COMPOSITED | __EXT_UX_DTT_GLOWSIZE;
- dto.crText = bFrameActive ? RGB(0,0,0) : RGB(0x060,0x060,0x060);
- }
- g_PaintManager.m_UxTheme.DrawThemeTextEx(
- dc32.m_hDC,
- 0,
- 0,
- strWindowText,
- -1,
- DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX,
- rcText,
- &dto
- );
- dc32.SelectObject( pOldFont );
- if( bRTL )
- {
- dc.SetLayout( dwOldLayout1 );
- dc32.SetLayout( dwOldLayout2 );
- } // if( bRTL )
- } // if( bDrawText )
- g_PaintManager.m_UxTheme.CloseThemeData();
- } // if extended theme data was open successfully
- }
- } // if( pWnd != NULL )
- } // if( bDwmMode ...
-
- if( pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->RibbonLayout_IsFrameIntegrationEnabled()
- && pRibbonBar->RibbonQuickAccessBar_AboveTheRibbonGet()
- && Ribbon_IsSystemMenuIconPresent()
- )
- {
- CWnd * pWndFrameImpl = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetFrameWindow();
- if( pWndFrameImpl->GetSafeHwnd() != NULL )
- {
- CRect rcSeparator( 0, 0, 0, 0 );
- if( bDwmMode )
- {
- rcSeparator.SetRect( rcIcon.right + 2, rcIcon.top, rcIcon.right + 3, rcIcon.bottom );
- CExtMemoryDC dc32(
- &dc,
- &rcSeparator,
- CExtMemoryDC::MDCOPT_TO_MEMORY
- | CExtMemoryDC::MDCOPT_FORCE_DIB
- | CExtMemoryDC::MDCOPT_FILL_BITS
- | CExtMemoryDC::MDCOPT_DIB_NEGATIVE_HEIGHT
- );
- ASSERT( dc32.GetSafeHdc() != NULL );
- dc32.FillSolidRect( &rcSeparator, RGB(0,0,0) );
- CPen _penGray( PS_SOLID, 1, RGB(64,64,64) ), _penWhite( PS_SOLID, 1, RGB(128,128,128) );
- CPen * pPenOld = dc32.SelectObject( &_penGray );
- dc32.MoveTo( rcSeparator.left, rcSeparator.top );
- dc32.LineTo( rcSeparator.left, rcSeparator.bottom );
- dc32.SelectObject( &_penWhite );
- dc32.MoveTo( rcSeparator.right, rcSeparator.top );
- dc32.LineTo( rcSeparator.right, rcSeparator.bottom );
- dc32.SelectObject( pPenOld );
- }
- else
- {
- CRect rcWnd;
- pWndFrameImpl->GetWindowRect( &rcWnd );
- rcIcon = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetNcHtRect(HTSYSMENU,false,false,false,NULL,&rcWnd);
- rcSeparator.SetRect( rcIcon.right + 0, rcIcon.top, rcIcon.right + 2, rcIcon.bottom - 3 );
- if( pWndFrameImpl->IsZoomed() )
- rcSeparator.OffsetRect( m_rcNcFrameBordersActive.left, m_rcNcFrameBordersActive.top );
- Ribbon_PaintSeparator( dc, rcSeparator, NULL );
- }
- }
- }
- }
- }
- bool CExtPaintManager::Ribbon_QuickAccessContentExpandButtonCalcLayout(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- dc;
- lParam;
- pQACEB->Size( CSize(13,22) );
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_QuickAccessContentExpandButtonCalcLayout(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_QuickAccessContentExpandButtonCalcLayout(
- dc,
- pQACEB,
- lParam
- );
- if( m_bmpArrRibbonQACEB.IsEmpty()
- || m_nRibbonHeightOfQACEB <= 0
- )
- return
- CExtPaintManagerOffice2003::Ribbon_QuickAccessContentExpandButtonCalcLayout(
- dc,
- pQACEB,
- lParam
- );
- CSize _size = m_bmpArrRibbonQACEB.GetSize();
- _size.cy = m_nRibbonHeightOfQACEB;
- _size.cx = UiScalingDo( _size.cx, __EUIST_X );
- _size.cy = UiScalingDo( _size.cy, __EUIST_Y );
- CSize _sizeAboveTheRibbonShiftQACEB =
- Ribbon_QuickAccessContentExpandGetShift(
- dc,
- pQACEB,
- lParam
- );
- _size.cx += _sizeAboveTheRibbonShiftQACEB.cx;
- _size.cy += _sizeAboveTheRibbonShiftQACEB.cy;
- pQACEB->Size( _size );
- return true;
- }
- bool CExtPaintManager::Ribbon_QuickAccessContentExpandButtonPaint(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- CRect rcTBB = *pQACEB;
- // PaintToolbarExpandButton(
- // dc,
- // rcTBB,
- // true,
- // true,
- // true,
- // pQACEB->IsPressed(),
- // pQACEB->IsHover(),
- // pQACEB,
- // lParam,
- // true
- // );
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- pQACEB,
- true,
- rcTBB,
- _T(""),
- NULL,
- true,
- pQACEB->IsHover(),
- pQACEB->IsPressed(),
- false,
- pQACEB->IsEnabled(),
- true,false,false,
- __ALIGN_HORIZ_CENTER | __ALIGN_VERT_CENTER,
- NULL,
- true,
- 0,
- true
- );
- _ppbd.m_lParam = lParam;
- PaintPushButton( dc, _ppbd );
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_QuickAccessContentExpandButtonPaint(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_QuickAccessContentExpandButtonPaint(
- dc,
- pQACEB,
- lParam
- );
- if( m_bmpArrRibbonQACEB.IsEmpty()
- || m_nRibbonHeightOfQACEB <= 0
- )
- return
- CExtPaintManagerOffice2003::Ribbon_QuickAccessContentExpandButtonPaint(
- dc,
- pQACEB,
- lParam
- );
- INT nBmpIdx = m_nIdxRibbonQACEB_Normal;
- bool bSelTrackingMode = false;
- const CExtToolControlBar * pToolBar = pQACEB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( pQACEB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- bSelTrackingMode = true;
- }
- }
- }
- if( bSelTrackingMode )
- nBmpIdx = m_nIdxRibbonQACEB_Hover;
- else if( pQACEB->IsEnabled() )
- {
- if( pQACEB->IsPressed() )
- nBmpIdx = m_nIdxRibbonQACEB_Pressed;
- else if( pQACEB->IsHover() )
- nBmpIdx = m_nIdxRibbonQACEB_Hover;
- }
- CSize _sizeAboveTheRibbonShiftQACEB =
- Ribbon_QuickAccessContentExpandGetShift(
- dc,
- pQACEB,
- lParam
- );
- CRect rcTBB = *pQACEB;
- rcTBB.left += _sizeAboveTheRibbonShiftQACEB.cx;
- rcTBB.top += _sizeAboveTheRibbonShiftQACEB.cy;
- CRect rcSrc( 0, 0, m_bmpArrRibbonQACEB.GetSize().cx, m_nRibbonHeightOfQACEB );
- rcSrc.OffsetRect( 0, m_nRibbonHeightOfQACEB*nBmpIdx );
- m_bmpArrRibbonQACEB.AlphaBlendSkinParts(
- dc.m_hDC,
- rcTBB,
- rcSrc,
- m_rcRibbonPaddingQACEB,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- return true;
- }
- CSize CExtPaintManager::Ribbon_QuickAccessContentExpandGetShift(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- dc;
- pQACEB;
- lParam;
- return CSize( 0, 0 );
- }
- CSize CExtPaintManagerOffice2007_Impl::Ribbon_QuickAccessContentExpandGetShift(
- CDC & dc,
- CExtRibbonButtonQuickAccessContentExpand * pQACEB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pQACEB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_QuickAccessContentExpandGetShift(
- dc,
- pQACEB,
- lParam
- );
-
- CExtRibbonBar * pRibbonBar =
- DYNAMIC_DOWNCAST(
- CExtRibbonBar,
- pQACEB->GetSafeBar()
- );
- if( pRibbonBar == NULL )
- return CSize( 0, 0 );
- if( ! pRibbonBar->RibbonQuickAccessBar_AboveTheRibbonGet() )
- return CSize( 0, 0 );
- if( pRibbonBar->RibbonLayout_GetFrameCaptionHeight() <= 0 )
- return CSize( 0, 0 );
- if( ! Ribbon_FileButtonIsItegrationSupported() )
- return CSize( 0, 0 );
- CSize _size = m_sizeAboveTheRibbonShiftQACEB;
- _size.cx = UiScalingDo( _size.cx, __EUIST_X );
- _size.cy = UiScalingDo( _size.cy, __EUIST_Y );
- return _size;
- }
- bool CExtPaintManager::Ribbon_DLB_IsVisible(
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTBB );
- lParam;
- CExtToolControlBar * pBar = pTBB->GetSafeBar();
- if( pBar == NULL )
- return false;
- CExtRibbonPage * pRibbonPage =
- DYNAMIC_DOWNCAST( CExtRibbonPage, pBar );
- if( pRibbonPage == NULL )
- return false;
- if( pRibbonPage->m_bHelperPopupMode
- && ( ! pRibbonPage->m_bHelperAutoHideMode )
- )
- return false;
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_DLB_IsVisible(
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_DLB_IsVisible(
- pTBB,
- lParam
- );
- if( ! IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) )
- return true;
- return
- CExtPaintManagerOffice2003::Ribbon_DLB_IsVisible( pTBB, lParam );
- }
- CSize CExtPaintManager::Ribbon_DLB_CalcSize(
- CDC & dc,
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pTBB );
- dc;
- pTBB;
- lParam;
- CSize _size( 17, 15 );
- _size.cx = UiScalingDo( _size.cx, __EUIST_X );
- _size.cy = UiScalingDo( _size.cy, __EUIST_Y );
- return _size;
- }
- CSize CExtPaintManagerOffice2007_Impl::Ribbon_DLB_CalcSize(
- CDC & dc,
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_DLB_CalcSize(
- dc,
- pTBB,
- lParam
- );
- if( m_arrBmpRibbonDLB.IsEmpty()
- || m_nRibbonHeightOfOneDLB <= 0
- || m_nDlbIdxDisabled < 0
- || m_nDlbIdxNormal < 0
- || m_nDlbIdxHover < 0
- || m_nDlbIdxPressed < 0
- )
- return
- CExtPaintManagerOffice2003::Ribbon_DLB_CalcSize(
- dc,
- pTBB,
- lParam
- );
- CSize _size = m_arrBmpRibbonDLB.GetSize();
- _size.cy = m_nRibbonHeightOfOneDLB;
- _size.cx = UiScalingDo( _size.cx, __EUIST_X );
- _size.cy = UiScalingDo( _size.cy, __EUIST_Y );
- return _size;
- }
- void CExtPaintManager::Ribbon_DLB_Paint(
- CDC & dc,
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pTBB );
- lParam;
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- pTBB,
- true,
- *pTBB,
- _T("..."),
- NULL,
- false,
- pTBB->IsHover(),
- pTBB->IsPressed(),
- false,
- pTBB->IsEnabled(),
- true,false,false,
- __ALIGN_HORIZ_CENTER | __ALIGN_VERT_CENTER,
- NULL,
- false,
- 0,
- false
- );
- PaintPushButton( dc, _ppbd );
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_DLB_Paint(
- CDC & dc,
- CExtRibbonButtonDialogLauncher * pTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pTBB );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_DLB_Paint(
- dc,
- pTBB,
- lParam
- );
- return;
- }
- if( m_arrBmpRibbonDLB.IsEmpty()
- || m_nRibbonHeightOfOneDLB <= 0
- || m_nDlbIdxDisabled < 0
- || m_nDlbIdxNormal < 0
- || m_nDlbIdxHover < 0
- || m_nDlbIdxPressed < 0
- )
- {
- CExtPaintManagerOffice2003::Ribbon_DLB_Paint(
- dc,
- pTBB,
- lParam
- );
- return;
- }
- INT nBmpIdx = m_nDlbIdxDisabled;
- if( pTBB->IsEnabled() )
- {
- if( pTBB->IsPressed() )
- nBmpIdx = m_nDlbIdxPressed;
- else if( pTBB->IsHover() )
- nBmpIdx = m_nDlbIdxHover;
- else
- nBmpIdx = m_nDlbIdxNormal;
- } // if( pTBB->IsEnabled() )
- ASSERT( nBmpIdx >= 0 );
- CRect rcDst = *pTBB;
- CRect rcSrc( 0, 0, m_arrBmpRibbonDLB.GetSize().cx, m_nRibbonHeightOfOneDLB );
- rcSrc.OffsetRect( 0, nBmpIdx*m_nRibbonHeightOfOneDLB );
- m_arrBmpRibbonDLB.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDst,
- rcSrc,
- rcRibbonContentPaddingDLB,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- void CExtPaintManager::Ribbon_FileMenuButtonQuery(
- LPVOID pData,
- CExtCmdIcon * pIcon, // = NULL
- __EXT_MFC_SAFE_LPCTSTR sText, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( pData != NULL );
- CExtPopupMenuWnd::RIBBONFILEMENUBUTTONQUERY & _rfmbq = *((CExtPopupMenuWnd::RIBBONFILEMENUBUTTONQUERY*)pData);
- _rfmbq.m_bQueryHandled = true;
- if( _rfmbq.m_pDC != NULL )
- {
- ASSERT( _rfmbq.m_pDC->GetSafeHdc() != NULL );
- PAINTPUSHBUTTONDATA _ppbd(
- _rfmbq.m_pPopup,
- true,
- _rfmbq.m_rcButton,
- sText,
- pIcon,
- false,
- _rfmbq.m_bHover,
- _rfmbq.m_bPressed,
- false,
- true,
- true,
- false,
- false,
- __ALIGN_HORIZ_CENTER | __ALIGN_VERT_CENTER,
- NULL,
- false,
- 0,
- false
- );
- _ppbd.m_lParam = lParam;
- PaintPushButton( *_rfmbq.m_pDC, _ppbd );
- } // if( _rfmbq.m_pDC != NULL )
- else
- {
- CSize _sizeIcon( 0, 0 ), _sizeText( 0, 0 );
- if( pIcon != NULL
- && ( ! pIcon->IsEmpty() )
- )
- _sizeIcon = pIcon->GetSize();
- if( sText != NULL
- && INT( _tcslen( sText ) ) > 0
- )
- {
- CWindowDC dc( NULL );
- CExtSafeString s = sText;
- _sizeText = stat_CalcTextDimension( dc, m_FontNormal, s, DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- }
- _rfmbq.m_nMeasuredWidth = _sizeIcon.cx + _sizeText.cx + 10;
- if( _sizeIcon.cx > 0 )
- _rfmbq.m_nMeasuredWidth += 5;
- } // else from if( _rfmbq.m_pDC != NULL )
- }
- void CExtPaintManagerOffice2007_Impl::Ribbon_FileMenuButtonQuery(
- LPVOID pData,
- CExtCmdIcon * pIcon, // = NULL
- __EXT_MFC_SAFE_LPCTSTR sText, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( pData != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::Ribbon_FileMenuButtonQuery(
- pData,
- pIcon,
- sText,
- lParam
- );
- return;
- }
- CExtPopupMenuWnd::RIBBONFILEMENUBUTTONQUERY & _rfmbq = *((CExtPopupMenuWnd::RIBBONFILEMENUBUTTONQUERY*)pData);
- _rfmbq.m_bQueryHandled = true;
- if( _rfmbq.m_pDC != NULL )
- {
- ASSERT( _rfmbq.m_pDC->GetSafeHdc() != NULL );
- // PAINTPUSHBUTTONDATA _ppbd(
- // _rfmbq.m_pPopup,
- // true,
- // _rfmbq.m_rcButton,
- // sText,
- // pIcon,
- // false,
- // _rfmbq.m_bHover,
- // _rfmbq.m_bPressed,
- // false,
- // true,
- // true,
- // false,
- // false,
- // __ALIGN_HORIZ_CENTER
- // | __ALIGN_VERT_CENTER,
- // NULL,
- // false,
- // 0,
- // false
- // );
- // _ppbd.m_lParam = lParam;
- // PaintPushButton( *_rfmbq.m_pDC, _ppbd );
- INT nImgIndex = INT(__E07BI_NORMAL);
- if( _rfmbq.m_bPressed )
- nImgIndex = INT(__E07BI_PRESSED);
- else if( _rfmbq.m_bHover )
- nImgIndex = INT(__E07BI_HOVER);
- nImgIndex = m_arrIndicesButtonTS[nImgIndex];
- CExtBitmap & _bmp = m_bmpArrButtonTS[ INT(__EBTSA_SOLID) ];
- CSize _sizeBmp = _bmp.GetSize();
- CRect rcSrc( 0, 0, _sizeBmp.cx, m_nHeightOfButtonTS );
- rcSrc.OffsetRect( 0, m_nHeightOfButtonTS*nImgIndex );
- if( (! _bmp.IsEmpty() )
- && (! rcSrc.IsRectEmpty() )
- && _rfmbq.m_pDC->RectVisible( &_rfmbq.m_rcButton )
- )
- _bmp.AlphaBlendSkinParts(
- *_rfmbq.m_pDC,
- _rfmbq.m_rcButton,
- rcSrc,
- m_rcPaddingOfButtonTS,
- CExtBitmap::__EDM_STRETCH,
- true
- );
- CRect rcText = _rfmbq.m_rcButton;
- rcText.DeflateRect( 10, 0 );
- if( pIcon != NULL && ( ! pIcon->IsEmpty() ) )
- {
- CSize _sizeIcon = pIcon->GetSize();
- CRect rcIcon(
- rcText.left,
- rcText.top,
- rcText.left + _sizeIcon.cx,
- rcText.bottom
- );
- rcIcon.OffsetRect(
- 0,
- ( rcIcon.Height() - _sizeIcon.cy ) / 2
- );
- rcIcon.bottom = rcIcon.top + _sizeIcon.cy;
- rcText.left = rcIcon.right + 3;
- CExtCmdIcon::e_paint_type_t ePT = CExtCmdIcon::__PAINT_NORMAL;
- if( _rfmbq.m_bPressed )
- ePT = CExtCmdIcon::__PAINT_PRESSED;
- else if( _rfmbq.m_bHover )
- ePT = CExtCmdIcon::__PAINT_HOVER;
- pIcon->Paint(
- this,
- _rfmbq.m_pDC->m_hDC,
- rcIcon,
- ePT
- );
- } // if( pIcon != NULL && ( ! pIcon->IsEmpty() ) )
- INT nTextLength = ( sText == NULL ) ? 0 : INT( _tcslen( sText ) );
- if( nTextLength > 0 )
- {
- CExtSafeString s = sText;
- CSize _sizeText = stat_CalcTextDimension( *_rfmbq.m_pDC, m_FontRibbonNormal, s, DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- rcText.OffsetRect(
- 0,
- ( rcText.Height() - _sizeText.cy ) / 2
- );
- rcText.bottom = rcText.top + _sizeText.cy;
- CFont * pOldFont = _rfmbq.m_pDC->SelectObject( &m_FontRibbonNormal );
- int nOldBkMode = _rfmbq.m_pDC->SetBkMode( TRANSPARENT );
- COLORREF clrOldText = _rfmbq.m_pDC->SetTextColor( m_clrRibbonButtonNormal );
- Ribbon_PaintText(
- *_rfmbq.m_pDC,
- sText,
- rcText,
- DT_SINGLELINE|DT_LEFT|DT_TOP,
- false,
- &m_bmpRibbonDDA,
- _rfmbq.m_pPopup,
- lParam
- );
- _rfmbq.m_pDC->SetTextColor( clrOldText );
- _rfmbq.m_pDC->SetBkMode( nOldBkMode );
- _rfmbq.m_pDC->SelectObject( pOldFont );
- } // if( nTextLength > 0 || _ppbd.m_bDropDown )
- } // if( _rfmbq.m_pDC != NULL )
- else
- {
- CSize _sizeIcon( 0, 0 ), _sizeText( 0, 0 );
- if( pIcon != NULL
- && ( ! pIcon->IsEmpty() )
- )
- _sizeIcon = pIcon->GetSize();
- if( sText != NULL
- && INT( _tcslen( sText ) ) > 0
- )
- {
- CWindowDC dc( NULL );
- CExtSafeString s = sText;
- _sizeText = stat_CalcTextDimension( dc, m_FontRibbonNormal, s, DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- }
- _rfmbq.m_nMeasuredWidth = _sizeIcon.cx + _sizeText.cx + 20;
- if( _sizeIcon.cx > 0 )
- _rfmbq.m_nMeasuredWidth += 3;
- } // else from if( _rfmbq.m_pDC != NULL )
- }
- bool CExtPaintManager::Ribbon_FileButtonIsItegrationSupported() const
- {
- ASSERT_VALID( this );
- return false;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_FileButtonIsItegrationSupported() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_FileButtonIsItegrationSupported();
- return m_bRibbonFileButtonItegrationSupported;
- }
- INT CExtPaintManager::Ribbon_FileButtonGetMenuIntersectionHeight() const
- {
- ASSERT_VALID( this );
- return 0;
- }
- INT CExtPaintManagerOffice2007_Impl::Ribbon_FileButtonGetMenuIntersectionHeight() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::Ribbon_FileButtonGetMenuIntersectionHeight();
- if( ! Ribbon_FileButtonIsItegrationSupported() )
- return 0;
- INT nRibbonFileButtonMenuIntersectionHeight =
- UiScalingDo( m_nRibbonFileButtonMenuIntersectionHeight, __EUIST_Y );
- return nRibbonFileButtonMenuIntersectionHeight;
- }
- bool CExtPaintManager::Ribbon_FileButtonCalcLayout(
- CDC & dc,
- CExtNcFrameImpl * pExtNcFrameImpl,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pExtNcFrameImpl != NULL );
- ASSERT_VALID( pFileTBB );
- dc;
- pExtNcFrameImpl;
- pFileTBB;
- lParam;
- return false;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_FileButtonCalcLayout(
- CDC & dc,
- CExtNcFrameImpl * pExtNcFrameImpl,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pExtNcFrameImpl != NULL );
- ASSERT_VALID( pFileTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_FileButtonCalcLayout(
- dc,
- pExtNcFrameImpl,
- pFileTBB,
- lParam
- );
-
- if( m_bmpArrRibbonFileButton.IsEmpty() )
- return false;
- CPoint ptTopLeftTBB( 0, 0 );
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pFileTBB->GetBar() );
- if( pRibbonBar != NULL
- && pRibbonBar->RibbonLayout_IsFrameIntegrationEnabled()
- && (! pRibbonBar->RibbonLayout_IsDwmCaptionIntegration() )
- )
- {
- INT nTopBorderHeight = 0;
- INT nFrameCaptionHeight = pRibbonBar->RibbonLayout_GetFrameCaptionHeight( &nTopBorderHeight );
- ptTopLeftTBB.y += nFrameCaptionHeight + nTopBorderHeight;
- }
- CSize _sizeTBB( m_bmpArrRibbonFileButton.GetSize().cx, m_nRibbonFileButtonHeight );
- _sizeTBB.cx = UiScalingDo( _sizeTBB.cx, __EUIST_X );
- _sizeTBB.cy = UiScalingDo( _sizeTBB.cy, __EUIST_Y );
- CRect rcTBB( ptTopLeftTBB, _sizeTBB );
- if( pRibbonBar != NULL
- && pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- {
- bool bZoomed = false;
- CWnd * pWnd = pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_GetFrameWindow();
- if( pWnd->GetSafeHwnd() != NULL && pWnd->IsZoomed() )
- bZoomed = true;
- if( bZoomed )
- {
- POINT ptOffset = { ::GetSystemMetrics(SM_CXFRAME)/4, ::GetSystemMetrics(SM_CYFRAME) };
- rcTBB.OffsetRect( ptOffset );
- }
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_LunaBlue ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Silver ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Obsidian ) )
- )
- rcTBB.OffsetRect( bZoomed ? (-4) : 0, 3 );
- else
- rcTBB.OffsetRect( 3, bZoomed ? 0 : 6 );
- }
- pFileTBB->Size( _sizeTBB );
- pFileTBB->SetRect( rcTBB );
- return true;
- }
- bool CExtPaintManagerOffice2010_Impl::Ribbon_FileButtonCalcLayout(
- CDC & dc,
- CExtNcFrameImpl * pExtNcFrameImpl,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pExtNcFrameImpl != NULL );
- ASSERT_VALID( pFileTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_FileButtonCalcLayout(
- dc,
- pExtNcFrameImpl,
- pFileTBB,
- lParam
- );
-
- if( m_bmpArrRibbonFileButton.IsEmpty() )
- return false;
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pFileTBB->GetBar() );
- if( pRibbonBar == NULL )
- return false;
- ASSERT_VALID( pRibbonBar );
- CSize _sizeTBB( m_bmpArrRibbonFileButton.GetSize().cx, m_nRibbonFileButtonHeight - 1 );
- _sizeTBB.cx = UiScalingDo( _sizeTBB.cx, __EUIST_X );
- _sizeTBB.cy = UiScalingDo( _sizeTBB.cy, __EUIST_Y );
- INT nPageIndex, nPageCount = pRibbonBar->RibbonTabPageButton_GetCount();
- for( nPageIndex = 0; nPageIndex < nPageCount; nPageIndex ++ )
- {
- CExtRibbonButtonTabPage * pTabPageTBB = pRibbonBar->RibbonTabPageButton_GetAt( nPageIndex );
- ASSERT( pTabPageTBB );
- if( ( pTabPageTBB->GetStyle() & TBBS_HIDDEN ) != 0 )
- continue;
- if( ! pTabPageTBB->IsVisible() )
- continue;
- CSize sizeTabPageButton = pTabPageTBB->Size();
- _sizeTBB.cy = max( _sizeTBB.cy, sizeTabPageButton.cy );
- break;
- } // for( . . .
- INT nTabLineHeight = pRibbonBar->RibbonLayout_GetTabLineHeight();
- INT nTopBorderHeight = 0;
- INT nFrameCaptionHeight = pRibbonBar->RibbonLayout_GetFrameCaptionHeight( &nTopBorderHeight );
- INT nHeightAtTheTop = nTabLineHeight + nFrameCaptionHeight;
- INT nBottomLineHeight = pRibbonBar->RibbonLayout_GetBottomLineHeight();
- CRect rcClient;
- pRibbonBar->GetClientRect( &rcClient );
- CRect rcPageBk = rcClient;
- rcPageBk.top += nHeightAtTheTop;
- rcPageBk.bottom -= nBottomLineHeight;
- if( pRibbonBar->RibbonLayout_IsFrameIntegrationEnabled()
- && (! pRibbonBar->RibbonLayout_IsDwmCaptionIntegration() )
- )
- rcPageBk.top += nFrameCaptionHeight + nTopBorderHeight;
- CRect rcTabLine(
- rcPageBk.left,
- rcPageBk.top - nTabLineHeight,
- rcPageBk.right,
- rcPageBk.top
- );
- pRibbonBar->RibbonLayout_AdjustTabLineRect( rcTabLine );
- // CRect rcTabNearBorderArea = rcTabLine;
- // rcTabNearBorderArea.top = rcTabNearBorderArea.bottom;
- // rcTabNearBorderArea.bottom += pRibbonBar->RibbonLayout_GetTabIntersectionHeight();
- INT nHorzOffset = UiScalingDo( 2, __EUIST_X );
- CRect rcTBB(
- nHorzOffset,
- rcTabLine.bottom - _sizeTBB.cy,
- nHorzOffset + _sizeTBB.cx,
- rcTabLine.bottom
- );
- pFileTBB->Size( _sizeTBB );
- pFileTBB->SetRect( rcTBB );
- return true;
- }
- bool CExtPaintManagerOffice2007_R1::Ribbon_FileButtonCalcLayout(
- CDC & dc,
- CExtNcFrameImpl * pExtNcFrameImpl,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pExtNcFrameImpl != NULL );
- ASSERT_VALID( pFileTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_FileButtonCalcLayout(
- dc,
- pExtNcFrameImpl,
- pFileTBB,
- lParam
- );
- return false;
- }
- bool CExtPaintManager::Ribbon_FileButtonPaint(
- CDC & dc,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pFileTBB );
- dc;
- pFileTBB;
- lParam;
- return false;
- }
- bool CExtPaintManagerOffice2007_Impl::Ribbon_FileButtonPaint(
- CDC & dc,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pFileTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_FileButtonPaint(
- dc,
- pFileTBB,
- lParam
- );
-
- if( m_bmpArrRibbonFileButton.IsEmpty() )
- return false;
- CRect rcTBB = *pFileTBB;
- if( ! dc.RectVisible( &rcTBB ) )
- return true;
- INT nBmpIndex = 0;
- CExtCmdIcon::e_paint_type_t ePT = CExtCmdIcon::__PAINT_DISABLED;
- bool bSelTrackingMode = false;
- const CExtToolControlBar * pToolBar = pFileTBB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( pFileTBB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- bSelTrackingMode = true;
- }
- }
- }
- if( bSelTrackingMode )
- {
- nBmpIndex = 1;
- ePT = CExtCmdIcon::__PAINT_HOVER;
- }
- else if( pFileTBB->IsEnabled() )
- {
- if( pFileTBB->IsPressed() )
- {
- nBmpIndex = 2;
- ePT = CExtCmdIcon::__PAINT_PRESSED;
- }
- else if( pFileTBB->IsHover() )
- {
- nBmpIndex = 1;
- ePT = CExtCmdIcon::__PAINT_HOVER;
- }
- else
- {
- ePT = CExtCmdIcon::__PAINT_NORMAL;
- }
- }
- bool bRTL = false;
- if( (dc.GetLayout()&LAYOUT_RTL) == LAYOUT_RTL )
- bRTL = true;
- bool bDwmMode = false;
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pFileTBB->GetSafeBar() );
- if( pRibbonBar != NULL
- && pRibbonBar->RibbonLayout_IsDwmCaptionIntegration()
- )
- bDwmMode = true;
- DWORD dwOldRTF = 0;
- CRect rcSrc( 0, 0, m_bmpArrRibbonFileButton.GetSize().cx, m_nRibbonFileButtonHeight );
- rcSrc.OffsetRect( 0, nBmpIndex * m_nRibbonFileButtonHeight );
- CRect rcPadding( 0, 0, 0, 0 );
- if( rcSrc.Size() != rcTBB.Size() )
- {
- CExtBitmap _bmp;
- _bmp.FromBitmap( m_bmpArrRibbonFileButton, rcSrc );
- CRect _rcSrc( 0, 0, rcTBB.Width(), rcTBB.Height() );
- CExtBitmap::Filter _f( CExtBitmap::Filter::gaussian );
- _f.FilterWidthSet( 2.0 );
- _bmp.Scale( rcTBB.Width(), rcTBB.Height(), _f );
- if( bDwmMode && bRTL )
- {
- dwOldRTF = _bmp.RunTimeFlagsGet();
- _bmp.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- }
- _bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcTBB,
- _rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- if( bDwmMode && bRTL )
- {
- _bmp.RunTimeFlagsSet( dwOldRTF );
- }
- }
- else
- {
- if( bDwmMode && bRTL )
- {
- dwOldRTF = m_bmpArrRibbonFileButton.RunTimeFlagsGet();
- m_bmpArrRibbonFileButton.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- }
- m_bmpArrRibbonFileButton.AlphaBlendSkinParts(
- dc.m_hDC,
- rcTBB,
- rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- if( bDwmMode && bRTL )
- {
- m_bmpArrRibbonFileButton.RunTimeFlagsSet( dwOldRTF );
- }
- }
- if( ! pFileTBB->m_iconForLargeMode.IsEmpty() )
- {
- CRect rc( rcTBB.TopLeft(), pFileTBB->m_iconForLargeMode.GetSize() );
- rc.OffsetRect(
- ( rcTBB.Width() - rc.Width() ) / 2,
- ( rcTBB.Height() - rc.Height() ) / 2
- );
- CExtBitmap & _bmp = pFileTBB->m_iconForLargeMode.GetBitmap( ePT, this );
- if( bDwmMode && bRTL )
- {
- dwOldRTF = _bmp.RunTimeFlagsGet();
- _bmp.RunTimeFlagsSet( dwOldRTF | __EXT_BMP_FLAG_NO_RTL_DETECTION );
- }
- if( bRTL )
- {
- CExtBitmap _bmp2 = _bmp;
- _bmp2.FlipHorizontal();
- if( ! _bmp2.IsEmpty() )
- {
- CSize _size = _bmp2.GetSize();
- _bmp2.AlphaBlend(
- dc.m_hDC,
- rc.left,
- rc.top,
- rc.Width(),
- rc.Height(),
- 0,
- 0,
- rc.Width(),
- rc.Height()
- );
- }
- }
- else
- {
- pFileTBB->m_iconForLargeMode.Paint(
- this,
- dc.m_hDC,
- rc,
- ePT
- );
- }
- if( bDwmMode && bRTL )
- {
- _bmp.RunTimeFlagsSet( dwOldRTF );
- }
- } // if( ! pFileTBB->m_iconForLargeMode.IsEmpty() )
- return true;
- }
- bool CExtPaintManagerOffice2007_R1::Ribbon_FileButtonPaint(
- CDC & dc,
- CExtRibbonButtonFile * pFileTBB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pFileTBB );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Ribbon_FileButtonPaint(
- dc,
- pFileTBB,
- lParam
- );
- CExtBitmap * pBmp = NULL;
- CRect rcSrc( 0, 0, 35, 22 );
- CRect rcTBB = *pFileTBB;
- rcTBB.InflateRect( 2, 0, 1, 0 );
- bool bSelTrackingMode = false;
- const CExtToolControlBar * pToolBar = pFileTBB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( pFileTBB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- bSelTrackingMode = true;
- }
- }
- }
- if( bSelTrackingMode )
- pBmp = &m_bmpArrRibbonFileButtonR1;
- else if( pFileTBB->IsEnabled() )
- {
- if( pFileTBB->IsPressed() )
- {
- pBmp = &m_bmpArrRibbonFileButtonR1;
- rcSrc.OffsetRect( 0, rcSrc.Height() );
- }
- else if( pFileTBB->IsHover() )
- pBmp = &m_bmpArrRibbonFileButtonR1;
- }
- if( pBmp != NULL
- && (! pBmp->IsEmpty() )
- )
- {
- CRect rcPadding( 3, 3, 3, 3 );
- pBmp->AlphaBlendSkinParts(
- dc.m_hDC,
- rcTBB,
- rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- CExtSafeString sText = pFileTBB->GetText();
- if( ! sText.IsEmpty() )
- {
- CFont * pFont = pFileTBB->GetBar()->OnGetToolbarFont( false, false );
- ASSERT( pFont->GetSafeHandle() != NULL );
- CFont * pOldFont = dc.SelectObject( pFont );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrOldTextColor = dc.SetTextColor( m_clrRibbonGroupCaptionTextCollapsed );
- rcTBB.DeflateRect( 0, 0, 3, 0 );
- Ribbon_PaintText(
- dc,
- LPCTSTR( sText ),
- rcTBB,
- DT_SINGLELINE|DT_CENTER|DT_VCENTER,
- true,
- &m_bmpRibbonDDA,
- (CObject*)pFileTBB,
- lParam
- );
- dc.SetTextColor( clrOldTextColor );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- } // if( ! sText.IsEmpty() )
- return true;
- }
- INT CExtPaintManager::RibbonLayout_CalcQatbAboveRibbonHorzStart(
- CExtRibbonBar * pRibbonBar,
- LPARAM lParam //= 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- pRibbonBar;
- lParam;
- return -1;
- }
- INT CExtPaintManagerOffice2010_Impl::RibbonLayout_CalcQatbAboveRibbonHorzStart(
- CExtRibbonBar * pRibbonBar,
- LPARAM lParam //= 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pRibbonBar );
- lParam;
- INT nRetVal = (16+4);
- if( pRibbonBar != NULL
- && pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- nRetVal += 4;
- return nRetVal;
- }
- bool CExtPaintManager::Ribbon_IsSystemMenuIconPresent() const
- {
- ASSERT_VALID( this );
- return false;
- }
- bool CExtPaintManagerOffice2010_Impl::Ribbon_IsSystemMenuIconPresent() const
- {
- ASSERT_VALID( this );
- return true;
- }
- CFont * CExtPaintManager::RibbonGallery_GetItemFont(
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pGalleryWnd );
- pGalleryWnd; pGalleryItemData; lParam;
- return NULL;
- }
- CFont * CExtPaintManagerOffice2007_Impl::RibbonGallery_GetItemFont(
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pGalleryWnd );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonGallery_GetItemFont( pGalleryWnd, pGalleryItemData, lParam );
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI =
- (CExtToolBoxWnd::TOOLBOX_ITEM_DATA *)pGalleryItemData;
- if( pTBCI->ItemGetNext( __TBCGN_PARENT ) == pGalleryWnd->ItemGetRoot() )
- return (&m_FontBold);
- else
- return (&m_FontNormal);
- }
- CSize CExtPaintManager::RibbonGallery_MeasureItem(
- CDC & dc,
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- dc; pGalleryWnd; pGalleryItemData; lParam;
- return CSize( -1, -1 );
- }
- CSize CExtPaintManagerOffice2007_Impl::RibbonGallery_MeasureItem(
- CDC & dc,
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonGallery_MeasureItem( dc, pGalleryWnd, pGalleryItemData, lParam );
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI = (CExtToolBoxWnd::TOOLBOX_ITEM_DATA *)pGalleryItemData;
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_Parent = pTBCI->ItemGetNext( __TBCGN_PARENT );
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_Root = pGalleryWnd->ItemGetRoot();
- ASSERT( pTBCI_Parent != NULL );
- if( pTBCI_Parent != pTBCI_Root )
- return CSize( -1, -1 );
- else
- {
- if( (pGalleryWnd->GetToolBoxWndStyle()&__TBWS_ZERO_HEIGHT_CAPTIONS) != 0 )
- return CSize( 0, 0 );
- __EXT_MFC_SAFE_LPCTSTR sText = pTBCI->TextGet();
- CFont * pFont = RibbonGallery_GetItemFont( pGalleryWnd, pGalleryItemData, lParam );
- ASSERT( pFont->GetSafeHandle() != NULL );
- CSize _size = stat_CalcTextDimension( dc, *pFont, sText, DT_SINGLELINE|DT_TOP|DT_LEFT ).Size();
- _size.cx += 20;
- _size.cy += 8;
- return _size;
- } // else from if( pTBCI_Parent != pTBCI_Root )
- }
- bool CExtPaintManager::RibbonGallery_DrawItem(
- CDC & dc,
- CExtRibbonGalleryWnd * pGalleryWnd,
- const RECT & rcItem,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- dc; pGalleryWnd; rcItem; pGalleryItemData; lParam;
- return false;
- }
- bool CExtPaintManagerOffice2007_Impl::RibbonGallery_DrawItem(
- CDC & dc,
- CExtRibbonGalleryWnd * pGalleryWnd,
- const RECT & rcItem,
- LPVOID pGalleryItemData,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonGallery_DrawItem( dc, pGalleryWnd, rcItem, pGalleryItemData, lParam );
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI = (CExtToolBoxWnd::TOOLBOX_ITEM_DATA *)pGalleryItemData;
- DWORD dwItemStyle = pTBCI->GetItemStyle();
- CRect _rcItem = rcItem;
- CSize sizeItem = _rcItem.Size();
- if( (dwItemStyle & __TBWI_VISIBLE) == 0
- || _rcItem.IsRectEmpty()
- || (! dc.RectVisible( &_rcItem ) )
- )
- return true;
- __EXT_MFC_SAFE_LPCTSTR sText = pTBCI->TextGet();
- DWORD dwToolBoxWndStyles = pGalleryWnd->GetToolBoxWndStyle();
- bool bTreeBoxes = ( (dwToolBoxWndStyles&__TBWS_TREE_BOXES) != 0 ) ? true : false;
- bool bListViewMode = false;
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_Parent = pTBCI->ItemGetNext( __TBCGN_PARENT );
- CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_Root = pGalleryWnd->ItemGetRoot();
- ASSERT( pTBCI_Parent != NULL );
- if( pTBCI_Parent != pTBCI_Root )
- {
- bTreeBoxes = false;
- ASSERT( pTBCI_Parent->ItemGetNext( __TBCGN_PARENT ) == pTBCI_Root );
- if( pTBCI_Parent->GetItemStyle() & __TBWI_LISTBOX_VIEW )
- bListViewMode = true;
- INT nImgIndex1 = INT(__E07BI_NORMAL);
- // if( bSelTrackingMode )
- // nImgIndex1 = INT(__E07BI_SEL_T);
- // else
- if( (dwItemStyle & __TBWI_ENABLED) != 0 )
- {
- if( (dwItemStyle & (__TBWI_PRESSED|__TBWI_SELECTED) ) != 0 )
- {
- if( (dwItemStyle & __TBWI_HOVER) != 0 )
- nImgIndex1 = INT(__E07BI_HDD);
- else
- nImgIndex1 = INT(__E07BI_PRESSED);
- }
- else if( (dwItemStyle & __TBWI_HOVER) != 0 )
- nImgIndex1 = INT(__E07BI_HOVER);
- } // else if( _ppbd.m_bEnabled )
- if( nImgIndex1 != __E07BI_NORMAL )
- {
- nImgIndex1 = m_arrIndicesButtonLSM[nImgIndex1];
- CSize _sizeBmp = m_bmpArrButtonLSM.GetSize();
- CRect rcSrc( 0, 0, _sizeBmp.cx, m_nHeightOfButtonLSM );
- rcSrc.OffsetRect( 0, m_nHeightOfButtonLSM*nImgIndex1 );
- m_bmpArrButtonLSM.AlphaBlendSkinParts(
- dc.m_hDC,
- rcItem,
- rcSrc,
- m_rcPaddingOfButtonLSM,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- } // if( nImgIndex1 != __E07BI_NORMAL )
- } // if( pTBCI_Parent != pTBCI_Root )
- else
- {
- bListViewMode = true;
- MenuCaption_Paint(
- dc,
- rcItem,
- NULL,
- ( pGalleryWnd->GetSafeHwnd() != NULL )
- ? ( DYNAMIC_DOWNCAST( CExtPopupMenuWnd, pGalleryWnd->GetParent() ) )
- : NULL
- );
- } // else from if( pTBCI_Parent != pTBCI_Root )
- bool bMultipleExp = ( (dwToolBoxWndStyles&__TBWS_MULTIPLE_EXPANDED_GROUPS) != 0 ) ? true : false;
- bool bAllowSelectionDrawing = true;
- if( bMultipleExp
- && pTBCI->ItemGetNext( __TBCGN_PARENT ) != pGalleryWnd->ItemGetActive()
- )
- bAllowSelectionDrawing = false;
- bool bEnabled = (dwItemStyle & __TBWI_ENABLED) ? true : false;
- CSize sizeIcon( 0, 0 );
- CExtCmdIcon & _icon = pTBCI->IconGet();
- sizeIcon = _icon.GetSize();
- sizeIcon.cx = UiScalingDo( sizeIcon.cx, __EUIST_X );
- sizeIcon.cy = UiScalingDo( sizeIcon.cy, __EUIST_Y );
- if( bListViewMode )
- {
- if( (dwToolBoxWndStyles&(__TBWS_FLAT_GROUPS_2005|__TBWS_PM_BUTTONS)) != 0 )
- _rcItem.DeflateRect( __EXT_TOOLBOXWND_2005_MARGIN_DX, 0 );
- if( bTreeBoxes )
- {
- int nTreeBoxAreaDX = max( sizeItem.cy, __EXT_TOOLBOXWND_TREE_BOX_AREA_DY );
- CRect rcTreeBox = _rcItem;
- rcTreeBox.right = rcTreeBox.left + nTreeBoxAreaDX;
- bool bPlus = true;
- if( bMultipleExp )
- {
- if( (dwItemStyle&__TBWI_EXPANDED) != 0 )
- bPlus = false;
- } // if( bMultipleExp )
- else
- {
- if( (dwItemStyle&__TBWI_ACTIVE) != 0 )
- bPlus = false;
- } // else from if( bMultipleExp )
- pGalleryWnd->OnToolBoxWndDrawTreeBox( pTBCI, _rcItem, rcTreeBox, (! bPlus ), dc );
- _rcItem.left += nTreeBoxAreaDX;
- } // if( bTreeBoxes )
- CRect rcText = _rcItem;
- rcText.DeflateRect( __EXT_TOOLBOXWND_ITEM_MARGIN_DX, __EXT_TOOLBOXWND_ITEM_MARGIN_DY );
- if( ( ! _icon.IsEmpty() ) && sizeIcon.cx > 0 && sizeIcon.cy > 0 )
- {
- CRect rcIcon = rcText;
- rcIcon.right = rcIcon.left + sizeIcon.cx;
- rcText.left += sizeIcon.cx + __EXT_TOOLBOXWND_ICON2TEXT_DX;
- rcIcon.top += (rcIcon.Height() - sizeIcon.cy) / 2;
- _icon.Paint(
- this,
- dc.GetSafeHdc(),
- rcIcon,
- bEnabled ? CExtCmdIcon::__PAINT_NORMAL : CExtCmdIcon::__PAINT_DISABLED
- );
- }
- if( (rcText.right - rcText.left > 6)
- && (rcText.bottom - rcText.top > 6)
- )
- {
- INT nTextLen = 0;
- if( sText != NULL
- && ( nTextLen = INT(_tcslen(sText)) ) > 0
- )
- {
- CFont * pOldFont = dc.SelectObject( pTBCI->ItemGetFont() );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- COLORREF clrTextOld = dc.SetTextColor( m_clrRibbonModeMenuTextNormal );
- CRect _rcText = rcText;
- _rcText.OffsetRect( 0, -1 );
- dc.DrawText( sText, nTextLen, _rcText, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_END_ELLIPSIS );
- dc.SetTextColor( clrTextOld );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- }
- }
- } // if( bListViewMode )
- else
- {
- if( ( ! _icon.IsEmpty() ) && sizeIcon.cx > 0 && sizeIcon.cy > 0 )
- {
- CRect rcIcon = _rcItem;
- rcIcon.DeflateRect( (rcIcon.Width() - sizeIcon.cx) / 2, (rcIcon.Height() - sizeIcon.cy) / 2 );
- rcIcon.right = rcIcon.left + sizeIcon.cx;
- rcIcon.bottom = rcIcon.top + sizeIcon.cy;
- _icon.Paint(
- this,
- dc.GetSafeHdc(),
- rcIcon,
- bEnabled ? CExtCmdIcon::__PAINT_NORMAL : CExtCmdIcon::__PAINT_DISABLED
- );
- }
- } // else from if( bListViewMode )
- CWnd * pWnd = pGalleryWnd->GetParent();
- if( pWnd != NULL
- && pWnd->IsKindOf( RUNTIME_CLASS( CExtRibbonGalleryPopupMenuWnd ) )
- && (((CExtRibbonGalleryPopupMenuWnd*)pWnd)->TrackFlagsGet()&TPMX_RIBBON_FILE_MENU)
- )
- {
- CRect rcClient;
- pGalleryWnd->GetClientRect( &rcClient );
- dc.FillSolidRect( rcClient.left, rcClient.top, 1, rcClient.Height(), RGB(197,197,197) );
- dc.FillSolidRect( rcClient.left+1, rcClient.top, 1, rcClient.Height(), RGB(245,245,245) );
- }
- return true;
- }
- bool CExtPaintManager::RibbonGallery_EraseEntireBk(
- CDC & dc,
- const CRect & rcClient,
- const CRect & rcActiveChildArea,
- CRgn & rgnActiveChildArea,
- const CRect & rcActiveChildArea2,
- CRgn & rgnActiveChildArea2,
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- rcActiveChildArea; rgnActiveChildArea; rcActiveChildArea2; rgnActiveChildArea2; pGalleryWnd; lParam;
- rcClient;
- CRect _rcClient;
- pGalleryWnd->GetClientRect( &_rcClient );
- COLORREF clrBkgnd = GetColor( COLOR_WINDOW );
- if( pGalleryWnd->m_bInPlaceGallery
- && pGalleryWnd->_IsKeyFocusGallery()
- )
- clrBkgnd = GetColor( COLOR_HIGHLIGHT );
- dc.FillSolidRect( &_rcClient, clrBkgnd );
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::RibbonGallery_EraseEntireBk(
- CDC & dc,
- const CRect & rcClient,
- const CRect & rcActiveChildArea,
- CRgn & rgnActiveChildArea,
- const CRect & rcActiveChildArea2,
- CRgn & rgnActiveChildArea2,
- CExtRibbonGalleryWnd * pGalleryWnd,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pGalleryWnd );
- if( IsHighContrast() )
- return CExtPaintManagerXP::RibbonGallery_EraseEntireBk( dc, rcClient, rcActiveChildArea, rgnActiveChildArea, rcActiveChildArea2, rgnActiveChildArea2, pGalleryWnd, lParam );
- if( pGalleryWnd->m_bInPlaceGallery )
- {
- COLORREF clrBorder = m_clrRibbonGalleryInplaceBorderNormal;
- COLORREF clrBkgnd = m_clrRibbonGalleryInplaceBkgndNormal;
- if( pGalleryWnd->_IsKeyFocusGallery() )
- clrBkgnd = CExtBitmap::stat_HLS_Adjust( clrBkgnd, 0.0, 0.5 );
- CPoint ptCursor;
- if( ::GetCursorPos( &ptCursor ) )
- {
- HWND hWnd = ::WindowFromPoint( ptCursor );
- if( hWnd != NULL
- && ( hWnd == pGalleryWnd->m_hWnd
- || hWnd == pGalleryWnd->GetScrollBarCtrl(SB_VERT)->GetSafeHwnd()
- )
- )
- {
- clrBorder = m_clrRibbonGalleryInplaceBorderHover;
- clrBkgnd = m_clrRibbonGalleryInplaceBkgndHover;
- }
- }
- dc.FillSolidRect( &rcClient, clrBkgnd );
- CRect _rcClient;
- pGalleryWnd->GetClientRect( &_rcClient );
- dc.Draw3dRect( &_rcClient, clrBorder, clrBorder );
- return true;
- } // if( pGalleryWnd->m_bInPlaceGallery )
- CWnd * pWnd = pGalleryWnd->GetParent();
- if( pWnd != NULL
- && pWnd->IsKindOf( RUNTIME_CLASS( CExtRibbonGalleryPopupMenuWnd ) )
- && (((CExtRibbonGalleryPopupMenuWnd*)pWnd)->TrackFlagsGet()&TPMX_RIBBON_FILE_MENU)
- )
- {
- dc.FillSolidRect( &rcClient, RGB(233,234,238) );
- dc.FillSolidRect( rcClient.left, rcClient.top, 1, rcClient.Height(), RGB(197,197,197) );
- dc.FillSolidRect( rcClient.left+1, rcClient.top, 1, rcClient.Height(), RGB(245,245,245) );
- return true;
- }
- dc.FillSolidRect( &rcClient, GetColor( COLOR_WINDOW ) );
- return true;
- }
- void CExtPaintManager::RibbonGallery_AdjustClientRect(
- CRect & rcClient,
- const CExtRibbonGalleryWnd * pGalleryWnd,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pGalleryWnd );
- lParam;
- if( pGalleryWnd->m_bInPlaceGallery
- && pGalleryWnd->GetScrollBarCtrl(SB_VERT)->GetSafeHwnd() != NULL
- )
- rcClient.DeflateRect( 1, 1, 0, 1 );
- }
- void CExtPaintManager::RibbonGallery_PaintScrollArea(
- CDC & dc,
- CExtRibbonGalleryInplaceScrollBar * pSB,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pSB );
- ASSERT( pSB->GetSafeHwnd() != NULL );
- bool bKeyFocusMode = false;
- CExtRibbonGalleryWnd * pRibbonGalleryWnd =
- STATIC_DOWNCAST( CExtRibbonGalleryWnd, pSB->GetParent() );
- if( pRibbonGalleryWnd->m_bInPlaceGallery
- && pRibbonGalleryWnd->_IsKeyFocusGallery()
- )
- bKeyFocusMode = true;
- INT nIndex, nCount = sizeof(pSB->m_arrButtons) / sizeof(pSB->m_arrButtons[0]);
- for( nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- CRect rc = pSB->RgBtnGetRect( (CExtRibbonGalleryInplaceScrollBar::e_ButtonType_t)nIndex );
- LPCTSTR strText = NULL;
- switch( nIndex )
- {
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_UP):
- strText = _T("t");
- break;
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_DOWN):
- strText = _T("u");
- break;
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_MENU):
- strText = _T("7");
- break;
- } // switch( nIndex )
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- pSB,
- true,
- rc,
- strText, //bTopButton ? _T("t") : _T("u"), // up arrow / down arrow
- NULL,
- true,
- ( pSB->m_arrButtons[ nIndex ] == CExtRibbonGalleryInplaceScrollBar::__BST_HOVER || ( bKeyFocusMode && nIndex == INT(CExtRibbonGalleryInplaceScrollBar::__BTT_MENU) ) ) ? true : false,
- ( pSB->m_arrButtons[ nIndex ] == CExtRibbonGalleryInplaceScrollBar::__BST_PRESSED ) ? true : false,
- false,
- ( pSB->m_arrButtons[ nIndex ] != CExtRibbonGalleryInplaceScrollBar::__BST_DISABLED ) ? true : false,
- true,false,false,
- __ALIGN_HORIZ_CENTER | __ALIGN_VERT_CENTER,
- (HFONT)m_FontMarlett.GetSafeHandle()
- );
- _ppbd.m_lParam = lParam;
- PaintPushButton( dc, _ppbd );
- }
- }
- void CExtPaintManagerOffice2007_Impl::RibbonGallery_PaintScrollArea(
- CDC & dc,
- CExtRibbonGalleryInplaceScrollBar * pSB,
- LPARAM lParam // = 0L