ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pSB );
- ASSERT( pSB->GetSafeHwnd() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::RibbonGallery_PaintScrollArea( dc, pSB, lParam );
- return;
- }
- CRect rcClient;
- pSB->GetClientRect( &rcClient );
- if( m_rcRibbonGalleryScrollFill != COLORREF(-1L) )
- dc.FillSolidRect( &rcClient, m_rcRibbonGalleryScrollFill );
- 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]);
- INT nNextTop = 0;
- for( nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- bool bForceHover = false;
- CRect rc = pSB->RgBtnGetRect( (CExtRibbonGalleryInplaceScrollBar::e_ButtonType_t)nIndex );
- INT nBtnHeightSrc = m_nHeightRibbonGalleryScrollButton;
- INT nBtnHeightDst = UiScalingDo( nBtnHeightSrc, __EUIST_X );
- CExtBitmap * pBmp = NULL;
- switch( nIndex )
- {
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_UP):
- pBmp = &m_bmpArrRibbonGalleryScrollButtonUp;
- if( nBtnHeightSrc < 0 )
- {
- nBtnHeightSrc = 21;
- nBtnHeightDst = UiScalingDo( nBtnHeightSrc, __EUIST_X );
- }
- break;
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_DOWN):
- pBmp = &m_bmpArrRibbonGalleryScrollButtonDown;
- if( nBtnHeightSrc < 0 )
- {
- nBtnHeightSrc = 19;
- nBtnHeightDst = UiScalingDo( nBtnHeightSrc, __EUIST_X );
- }
- break;
- case INT(CExtRibbonGalleryInplaceScrollBar::__BTT_MENU):
- pBmp = &m_bmpArrRibbonGalleryScrollButtonMenu;
- if( nBtnHeightSrc < 0 )
- {
- nBtnHeightSrc = 20;
- nBtnHeightDst = UiScalingDo( nBtnHeightSrc, __EUIST_X );
- }
- if( bKeyFocusMode )
- bForceHover = true;
- break;
- } // switch( nIndex )
- if( pBmp != NULL && (! pBmp->IsEmpty() ) && nBtnHeightSrc > 0 )
- {
- rc.top = nNextTop;
- rc.bottom = rc.top + nBtnHeightDst;
- INT nOffsetIndex = 0;
- CExtRibbonGalleryInplaceScrollBar::e_ButtonState_t eBST = pSB->m_arrButtons[ nIndex ];
- if( bForceHover )
- eBST = CExtRibbonGalleryInplaceScrollBar::__BST_HOVER;
- switch( eBST )
- {
- case CExtRibbonGalleryInplaceScrollBar::__BST_DISABLED:
- nOffsetIndex = m_nIndexRibbonGalleryScrollButtonDisabled;
- break;
- case CExtRibbonGalleryInplaceScrollBar::__BST_NORMAL:
- nOffsetIndex = m_nIndexRibbonGalleryScrollButtonNormal;
- break;
- case CExtRibbonGalleryInplaceScrollBar::__BST_HOVER:
- nOffsetIndex = m_nIndexRibbonGalleryScrollButtonHover;
- break;
- case CExtRibbonGalleryInplaceScrollBar::__BST_PRESSED:
- nOffsetIndex = m_nIndexRibbonGalleryScrollButtonPressed;
- break;
- } // switch( eBST )
- if( rc.bottom > rcClient.bottom )
- rc.bottom = rcClient.bottom;
- CRect rcSrc( 0, 0, pBmp->GetSize().cx, nBtnHeightSrc );
- rcSrc.OffsetRect( 0, nBtnHeightSrc*nOffsetIndex );
- pBmp->AlphaBlendSkinParts(
- dc.m_hAttribDC,
- rc,
- rcSrc,
- m_rcRibbonGalleryScrollButtonPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- nNextTop = rc.bottom;
- continue;
- } // if( pBmp != NULL ..
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- pSB,
- true,
- rc,
- NULL,
- NULL,
- true,
- ( pSB->m_arrButtons[ nIndex ] == CExtRibbonGalleryInplaceScrollBar::__BST_HOVER ) ? 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 );
- }
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- void CExtPaintManagerOffice2007_Impl::PaintMenuItem(
- CDC & dc,
- CExtPaintManager::PAINTMENUITEMDATA & _pmid
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( _pmid.m_rcItem.IsRectEmpty() )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintMenuItem( dc, _pmid );
- return;
- }
- if( _pmid.m_pHelperSrc != NULL
- && _pmid.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- && ((CExtPopupMenuWnd*)_pmid.m_pHelperSrc)->_IsRibbonMode()
- )
- {
- if( _pmid.m_bEnabled
- && m_clrRibbonModeMenuTextNormal != COLORREF(-1L)
- && _pmid.m_clrForceMenuText == COLORREF(-1L)
- )
- _pmid.m_clrForceMenuText = m_clrRibbonModeMenuTextNormal;
- }
- CExtPaintManagerOffice2003::PaintMenuItem( dc, _pmid );
- }
- CRect CExtPaintManagerOffice2007_Impl::GetMenuBorderMetrics(
- CWnd * pWnd,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::GetMenuBorderMetrics(
- pWnd,
- lParam
- );
- if( pWnd != NULL
- && pWnd->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- && ((CExtPopupMenuWnd*)pWnd)->_IsRibbonMode()
- )
- {
- if( ( ((CExtPopupMenuWnd*)pWnd)->TrackFlagsGet() & TPMX_RIBBON_FILE_MENU ) != 0 )
- return m_rcPaddingRibbonFileMenuBigBorder;
- return m_rcRibbonModeMenuMetrics;
- }
- return CExtPaintManagerOffice2003::GetMenuBorderMetrics( pWnd, lParam );
- }
- void CExtPaintManagerOffice2007_Impl::PaintMenuBorder(
- CDC & dc,
- const RECT & rectClient,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ::IsRectEmpty( &rectClient ) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintMenuBorder(
- dc,
- rectClient,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtPopupMenuWnd ) )
- && ((CExtPopupMenuWnd*)pHelperSrc)->_IsRibbonMode()
- )
- {
- if( ( ((CExtPopupMenuWnd*)pHelperSrc)->TrackFlagsGet() & TPMX_RIBBON_FILE_MENU ) != 0 )
- {
- m_bmpRibbonFileMenuBigBorder.AlphaBlendSkinParts(
- dc.m_hDC,
- rectClient,
- m_rcPaddingRibbonFileMenuBigBorder,
- CExtBitmap::__EDM_STRETCH,
- false,
- true
- );
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- CExtRibbonGalleryPopupMenuWnd * pGalleryPopup =
- DYNAMIC_DOWNCAST( CExtRibbonGalleryPopupMenuWnd, pHelperSrc );
- if( pGalleryPopup != NULL
- && pGalleryPopup != NULL
- && pGalleryPopup->m_pRibbonSrcTrackingButton != NULL
- && pGalleryPopup->m_pRibbonSrcTrackingButton->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonFile ) )
- && pGalleryPopup->m_pRibbonSrcTrackingButton->GetSafeBar() != NULL
- && pGalleryPopup->m_pRibbonSrcTrackingButton->GetBar()->IsKindOf( RUNTIME_CLASS( CExtRibbonBar) )
- )
- {
- CExtRibbonButtonFile * pFileTBB =
- STATIC_DOWNCAST(
- CExtRibbonButtonFile,
- pGalleryPopup->m_pRibbonSrcTrackingButton
- );
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pFileTBB->GetBar() );
- if( pRibbonBar != NULL
- //&& Ribbon_FileButtonIsItegrationSupported()
- && pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsSupported()
- && pRibbonBar->RibbonLayout_IsFrameIntegrationEnabled()
- )
- {
- INT nRibbonFileButtonMenuIntersectionHeight =
- Ribbon_FileButtonGetMenuIntersectionHeight();
- if( nRibbonFileButtonMenuIntersectionHeight != 0 )
- {
- CRect rcTBB = *pFileTBB;
- pFileTBB->GetBar()->ClientToScreen( &rcTBB );
- pGalleryPopup->ScreenToClient( &rcTBB );
- if( rcTBB.top <= rectClient.top && rectClient.top <= rcTBB.bottom )
- {
- CRect _rcTBB = rcTBB;
- if( pRibbonBar->m_pExtNcFrameImpl != NULL
- && pRibbonBar->m_pExtNcFrameImpl->NcFrameImpl_IsDwmCaptionReplacement()
- )
- {
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_LunaBlue ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Silver ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Obsidian ) )
- )
- _rcTBB.OffsetRect( 0, -3 );
- }
- INT nTopBorderHeight = 0;
- INT nFrameCaptionHeight = pRibbonBar->RibbonLayout_GetFrameCaptionHeight( &nTopBorderHeight );
- if( pRibbonBar->RibbonLayout_IsDwmCaptionIntegration() )
- {
- 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 + 4, - ::GetSystemMetrics(SM_CYFRAME) };
- _rcTBB.OffsetRect( ptOffset );
- }
- }
- else
- {
- _rcTBB.OffsetRect( 0, - nFrameCaptionHeight - nTopBorderHeight );
- }
- dc.OffsetViewportOrg(
- _rcTBB.left,
- _rcTBB.top //- nFrameCaptionHeight - nTopBorderHeight
- );
- pFileTBB->AnimationClient_SiteGet()->AnimationSite_ClientProgressStop( pFileTBB );
- pFileTBB->Paint( dc );
- dc.OffsetViewportOrg(
- -_rcTBB.left,
- -_rcTBB.top //+ nFrameCaptionHeight + nTopBorderHeight
- );
- } // if( rcTBB.top <= rectClient.top && rectClient.top <= rcTBB.bottom )
- } // if( nRibbonFileButtonMenuIntersectionHeight != 0 )
- } // if( pRibbonBar != NULL ...
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- return;
- }
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( ((CExtPopupMenuWnd*)pHelperSrc)->IsKindOf( RUNTIME_CLASS( CExtRibbonPopupMenuWnd ) )
- && IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) )
- )
- {
- }
- else
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- {
- m_bmpRibbonModeMenuBorder.AlphaBlendSkinParts(
- dc.m_hDC,
- rectClient,
- m_rcRibbonModeMenuBorderPadding,
- CExtBitmap::__EDM_STRETCH,
- false,
- true
- );
- return;
- }
- }
- CExtPaintManagerOffice2003::PaintMenuBorder( dc, rectClient, pHelperSrc, lParam );
- }
- CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersEmpty( 0, 0 );
- CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersNormal( __EXT_MFC_DEF_ANIMATION_STEP_COUNT, __EXT_MFC_DEF_ANIMATION_TIMER_ELAPSE );
- CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersSlow( __EXT_MFC_DEF_ANIMATION_STEP_COUNT+1, __EXT_MFC_DEF_ANIMATION_TIMER_ELAPSE );
- CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersVerySlow( __EXT_MFC_DEF_ANIMATION_STEP_COUNT+2, __EXT_MFC_DEF_ANIMATION_TIMER_ELAPSE );
- //CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersVerySlowAndSmooth( __EXT_MFC_DEF_ANIMATION_STEP_COUNT+4, __EXT_MFC_DEF_ANIMATION_TIMER_ELAPSE );
- CExtAnimationParameters CExtPaintManager::g_DefAnimationParametersVerySlowAndSmooth( 4, 80 );
- const CExtAnimationParameters *
- CExtPaintManager::Animation_GetParameters(
- INT eAPT, // __EAPT_*** animation type
- CObject * pHelperSrc,
- const CExtAnimationClient * pAC,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( pAC != NULL );
- eAPT;
- pHelperSrc;
- pAC;
- lParam;
- // if( ! g_PaintManager.m_bIsWin2000orLater )
- // return (&g_PaintManager->g_DefAnimationParametersEmpty);
- // if( pHelperSrc != NULL )
- // {
- // ASSERT_VALID( pHelperSrc );
- // if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- // {
- // if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtScrollBar ) ) )
- // return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- // } // if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- // #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- // CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- // if( pTBB != NULL )
- // {
- // CExtToolControlBar * pToolBar = pTBB->GetBar();
- // if( pToolBar != NULL )
- // {
- // ASSERT_VALID( pToolBar );
- // CExtRibbonPage * pRibbonPage = DYNAMIC_DOWNCAST( CExtRibbonPage, pToolBar );
- // if( pRibbonPage != NULL )
- // {
- // if( pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonDialogLauncher ) ) )
- // {
- // if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON
- // || eAPT == __EAPT_BY_HOVERED_STATE_TURNED_OFF
- // )
- // return (&g_DefAnimationParametersEmpty);
- // }
- // CExtBarButton * pParentTBB = pTBB->ParentButtonGet();
- // CExtRibbonButtonGroup * pGroupTBB = DYNAMIC_DOWNCAST( CExtRibbonButtonGroup, pTBB );
- // if( pGroupTBB != NULL )
- // {
- // if( pParentTBB != NULL )
- // return (&g_DefAnimationParametersEmpty);
- // // if( pGroupTBB->TopCollapsedStateGet() )
- // return (&g_DefAnimationParametersNormal);
- // // return (&g_DefAnimationParametersVerySlowAndSmooth);
- // }
- // if( pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonTabPage ) ) )
- // {
- // if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON )
- // return (&g_DefAnimationParametersEmpty);
- // return (&g_DefAnimationParametersVerySlow);
- // }
- // if( ( pParentTBB != NULL
- // && pParentTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonToolGroup ) )
- // )
- // || pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonFile ) )
- // || pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonQuickAccessContentExpand ) )
- // )
- // return (&g_DefAnimationParametersNormal);
- // // final case
- // if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON )
- // return (&g_DefAnimationParametersEmpty);
- // return (&g_DefAnimationParametersNormal);
- // } // if( pRibbonPage != NULL )
- // } // if( pToolBar != NULL )
- // } // if( pTBB != NULL )
- // #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- // } // if( pHelperSrc != NULL )
- return (&g_DefAnimationParametersEmpty);
- }
- const CExtAnimationParameters *
- CExtPaintManagerNativeXP::Animation_GetParameters(
- INT eAPT, // __EAPT_*** animation type
- CObject * pHelperSrc,
- const CExtAnimationClient * pAC,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( pAC != NULL );
- if( ! g_PaintManager.m_bIsWin2000orLater )
- return (&g_PaintManager->g_DefAnimationParametersEmpty);
- if( pHelperSrc != NULL )
- {
- ASSERT_VALID( pHelperSrc );
- if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- {
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtButton ) ) )
- return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- #if (!defined __EXT_MFC_NO_SPIN)
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtSpinWnd ) ) )
- return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- #endif // (!defined __EXT_MFC_NO_SPIN)
- } // if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- } // if( pHelperSrc != NULL )
- const CExtAnimationParameters * pAnimationParameters =
- CExtPaintManager::Animation_GetParameters(
- eAPT,
- pHelperSrc,
- pAC,
- lParam
- );
- return pAnimationParameters;
- }
- const CExtAnimationParameters *
- CExtPaintManagerOffice2007_Impl::Animation_GetParameters(
- INT eAPT, // __EAPT_*** animation type
- CObject * pHelperSrc,
- const CExtAnimationClient * pAC,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::Animation_GetParameters(
- eAPT,
- pHelperSrc,
- pAC,
- lParam
- );
-
- if( ! g_PaintManager.m_bIsWin2000orLater )
- return (&g_PaintManager->g_DefAnimationParametersEmpty);
- if( pHelperSrc != NULL )
- {
- ASSERT_VALID( pHelperSrc );
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtButton ) ) )
- return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtScrollBar ) ) )
- return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- #if (!defined __EXT_MFC_NO_DATE_PICKER)
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDatePickerWnd ) ) )
- return (&g_PaintManager->g_DefAnimationParametersSlow);
- #endif // (!defined __EXT_MFC_NO_DATE_PICKER)
- #if (!defined __EXT_MFC_NO_DURATIONWND)
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDurationWnd ) ) )
- return (&g_PaintManager->g_DefAnimationParametersSlow);
- #endif // (!defined __EXT_MFC_NO_DURATIONWND)
- #if (!defined __EXT_MFC_NO_SPIN)
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtSpinWnd ) ) )
- return (&g_PaintManager->g_DefAnimationParametersSlow);
- #endif // (!defined __EXT_MFC_NO_SPIN)
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtRibbonGalleryWnd ) ) )
- return (&g_PaintManager->g_DefAnimationParametersNormal);
- CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- if( pTBB != NULL )
- {
- bool bCheckEmpty = false;
- if( pTBB->ParentButtonGet() != NULL )
- bCheckEmpty = true;
- else
- {
- CExtRibbonBar * pRibbonBar = DYNAMIC_DOWNCAST( CExtRibbonBar, pTBB->GetBar() );
- if( pRibbonBar != NULL )
- {
- if( pTBB->IsKindOf( RUNTIME_CLASS(CExtRibbonButtonFile) ) )
- bCheckEmpty = true;
- else
- {
- INT nQatbIndex = pRibbonBar->RibbonQuickAccessButton_GetIndexOf( pTBB );
- if( nQatbIndex >= 0 )
- bCheckEmpty = true;
- }
- } // if( pRibbonBar != NULL )
- } // else from if( ((CExtBarButton*)pHelperSrc)->ParentButtonGet() != NULL )
- if( bCheckEmpty )
- {
- if( IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_LunaBlue ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Silver ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2007_R3_Obsidian ) )
- || IsKindOf( RUNTIME_CLASS( CExtPaintManagerOffice2010_Impl ) )
- )
- return (&g_PaintManager->g_DefAnimationParametersEmpty);
- } // if( bCheckEmpty )
- } // if( pTBB != NULL )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- } // if( pHelperSrc != NULL )
- //const CExtAnimationParameters * pAnimationParameters =
- // CExtPaintManagerOffice2003::Animation_GetParameters(
- // eAPT,
- // pHelperSrc,
- // pAC,
- // lParam
- // );
- // return pAnimationParameters;
- if( ! g_PaintManager.m_bIsWin2000orLater )
- return (&g_PaintManager->g_DefAnimationParametersEmpty);
- if( pHelperSrc != NULL )
- {
- ASSERT_VALID( pHelperSrc );
- if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- {
- if( pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtScrollBar ) ) )
- return (&g_PaintManager->g_DefAnimationParametersVerySlow);
- } // if( g_PaintManager.m_DWM.IsCompositionEnabled() )
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- if( pTBB != NULL )
- {
- CExtToolControlBar * pToolBar = pTBB->GetBar();
- if( pToolBar != NULL )
- {
- ASSERT_VALID( pToolBar );
- CExtRibbonPage * pRibbonPage = DYNAMIC_DOWNCAST( CExtRibbonPage, pToolBar );
- if( pRibbonPage != NULL )
- {
- if( pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonDialogLauncher ) ) )
- {
- if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON
- || eAPT == __EAPT_BY_HOVERED_STATE_TURNED_OFF
- )
- return (&g_DefAnimationParametersEmpty);
- }
- CExtBarButton * pParentTBB = pTBB->ParentButtonGet();
- if( pParentTBB == NULL
- && Ribbon_DwmAreaCoversTabs()
- && (! pTBB->IsKindOf( RUNTIME_CLASS(CExtRibbonButtonGroup) ) )
- )
- return (&g_DefAnimationParametersEmpty);
- CExtRibbonButtonGroup * pGroupTBB = DYNAMIC_DOWNCAST( CExtRibbonButtonGroup, pTBB );
- if( pGroupTBB != NULL )
- {
- if( pParentTBB != NULL )
- return (&g_DefAnimationParametersEmpty);
- // if( pGroupTBB->TopCollapsedStateGet() )
- return (&g_DefAnimationParametersNormal);
- // return (&g_DefAnimationParametersVerySlowAndSmooth);
- }
- if( pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonTabPage ) ) )
- {
- if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON )
- return (&g_DefAnimationParametersEmpty);
- return (&g_DefAnimationParametersVerySlow);
- }
- if( ( pParentTBB != NULL
- && pParentTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonToolGroup ) )
- )
- || pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonFile ) )
- || pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonQuickAccessContentExpand ) )
- )
- return (&g_DefAnimationParametersNormal);
- // final case
- if( eAPT == __EAPT_BY_HOVERED_STATE_TURNED_ON )
- return (&g_DefAnimationParametersEmpty);
- return (&g_DefAnimationParametersNormal);
- } // if( pRibbonPage != NULL )
- } // if( pToolBar != NULL )
- } // if( pTBB != NULL )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- } // if( pHelperSrc != NULL )
- return (&g_DefAnimationParametersEmpty);
- }
- void CExtPaintManager::MenuBottomResizingMarginGetInfo(
- INT & nMarginHeight,
- INT & nResizingCornerPartWidth,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pPopup );
- lParam;
- nMarginHeight = 0;
- nResizingCornerPartWidth = 0;
- DWORD dwTrackFlags = pPopup->TrackFlagsGet();
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING) != 0 )
- {
- nMarginHeight = 10;
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING_VERTICAL_ONLY) == 0 )
- nResizingCornerPartWidth = 10;
- }
- }
- void CExtPaintManagerOffice2007_Impl::MenuBottomResizingMarginGetInfo(
- INT & nMarginHeight,
- INT & nResizingCornerPartWidth,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pPopup );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::MenuBottomResizingMarginGetInfo(
- nMarginHeight,
- nResizingCornerPartWidth,
- pPopup,
- lParam
- );
- return;
- }
- DWORD dwTrackFlags = pPopup->TrackFlagsGet();
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING) != 0 )
- {
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING_VERTICAL_ONLY) != 0 )
- {
- if( m_bmpRibbonMenuResizingMarginV.IsEmpty() )
- nMarginHeight = m_bmpResizingGripper.GetSize().cy;
- else
- nMarginHeight = m_bmpRibbonMenuResizingMarginV.GetSize().cy;
- }
- else
- {
- if( m_bmpRibbonMenuResizingMarginHV.IsEmpty() )
- nMarginHeight = m_bmpResizingGripper.GetSize().cy;
- else
- nMarginHeight = m_bmpRibbonMenuResizingMarginHV.GetSize().cy;
- if( m_bmpRibbonMenuResizingGripperHV.IsEmpty() )
- nResizingCornerPartWidth = m_bmpResizingGripper.GetSize().cx;
- else
- nResizingCornerPartWidth = m_bmpRibbonMenuResizingGripperHV.GetSize().cx;
- }
- }
- }
- void CExtPaintManager::MenuBottomResizingMarginPaint(
- CDC & dc,
- const RECT & rcResizingArea,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pPopup );
- lParam;
- if( ! dc.RectVisible( &rcResizingArea ) )
- return;
- DWORD dwTrackFlags = pPopup->TrackFlagsGet();
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING) == 0 )
- return;
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING_VERTICAL_ONLY) != 0 )
- {
- PaintMenuTearOffButton( dc, rcResizingArea, false, false, pPopup, lParam );
- return;
- }
- INT nMarginHeight = 0, nResizingCornerPartWidth = 0;
- MenuBottomResizingMarginGetInfo( nMarginHeight, nResizingCornerPartWidth, pPopup, lParam );
- CRect rcGrip = rcResizingArea;
- rcGrip.left = rcGrip.right - nResizingCornerPartWidth;
- if( ! dc.RectVisible( &rcGrip ) )
- return;
- PaintResizingGripper( dc, rcGrip, pPopup, lParam );
- }
- void CExtPaintManagerOffice2007_Impl::MenuBottomResizingMarginPaint(
- CDC & dc,
- const RECT & rcResizingArea,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pPopup );
- if( ! dc.RectVisible( &rcResizingArea ) )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::MenuBottomResizingMarginPaint( dc, rcResizingArea, pPopup, lParam );
- return;
- }
- DWORD dwTrackFlags = pPopup->TrackFlagsGet();
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING) == 0 )
- return;
- if( (dwTrackFlags&TPMX_RIBBON_RESIZING_VERTICAL_ONLY) != 0 )
- {
- if( m_bmpRibbonMenuResizingMarginV.IsEmpty() )
- {
- INT nMarginHeight = 0, nResizingCornerPartWidth = 0;
- MenuBottomResizingMarginGetInfo( nMarginHeight, nResizingCornerPartWidth, pPopup, lParam );
- CRect rcGrip = rcResizingArea;
- rcGrip.left = rcGrip.right - nResizingCornerPartWidth;
- if( ! dc.RectVisible( &rcGrip ) )
- return;
- PaintResizingGripper( dc, rcGrip, pPopup, lParam );
- return;
- }
- m_bmpRibbonMenuResizingMarginV.AlphaBlendSkinParts(
- dc.m_hDC,
- rcResizingArea,
- m_rcPaddingRibbonMenuResizingMarginV,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- m_bmpRibbonMenuResizingGripperV.AlphaBlendSkinParts(
- dc.m_hDC,
- rcResizingArea,
- CRect(0,0,0,0),
- CExtBitmap::__EDM_CENTER,
- true,
- true
- );
- }
- else
- {
- if( m_bmpRibbonMenuResizingMarginHV.IsEmpty() )
- {
- INT nMarginHeight = 0, nResizingCornerPartWidth = 0;
- MenuBottomResizingMarginGetInfo( nMarginHeight, nResizingCornerPartWidth, pPopup, lParam );
- CRect rcGrip = rcResizingArea;
- rcGrip.left = rcGrip.right - nResizingCornerPartWidth;
- if( ! dc.RectVisible( &rcGrip ) )
- return;
- PaintResizingGripper( dc, rcGrip, pPopup, lParam );
- return;
- }
- m_bmpRibbonMenuResizingMarginHV.AlphaBlendSkinParts(
- dc.m_hDC,
- rcResizingArea,
- m_rcPaddingRibbonMenuResizingMarginHV,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- CSize _size = m_bmpRibbonMenuResizingGripperHV.GetSize();
- CRect rcGrip(
- rcResizingArea.right - _size.cx,
- rcResizingArea.bottom - _size.cy,
- rcResizingArea.right,
- rcResizingArea.bottom
- );
- if( ! dc.RectVisible( &rcGrip ) )
- return;
- m_bmpRibbonMenuResizingGripperHV.AlphaBlendSkinParts(
- dc.m_hDC,
- rcGrip,
- CRect(0,0,0,0),
- CExtBitmap::__EDM_CENTER,
- true,
- true
- );
- }
- }
- CFont * CExtPaintManager::MenuCaptionGetFont(
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pPopup );
- pPopup;
- lParam;
- return ( const_cast < CFont * > ( & m_FontNormal ) );
- }
- CSize CExtPaintManager::MenuCaption_Measure(
- CDC & dc,
- __EXT_MFC_SAFE_LPCTSTR sMenuCaptionText,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pPopup );
- if( sMenuCaptionText == NULL )
- return CSize( 0, 0 );
- CExtSafeString _sText = sMenuCaptionText;
- if( _sText.GetLength() == 0 )
- return CSize( 0, 0 );
- CFont * pFont = MenuCaptionGetFont( pPopup, 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;
- }
- void CExtPaintManager::MenuCaption_Paint(
- CDC & dc,
- const RECT & rcMenuCaption,
- __EXT_MFC_SAFE_LPCTSTR sMenuCaptionText,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ( ! dc.RectVisible( &rcMenuCaption ) )
- //|| sMenuCaptionText == NULL
- )
- return;
- INT nTextLen = ( sMenuCaptionText != NULL ) ? INT( _tcslen( sMenuCaptionText ) ) : 0;
- // if( nTextLen == 0 )
- // return;
- CRect _rcMenuCaption = rcMenuCaption;
- if( _rcMenuCaption.IsRectEmpty()
- || ( ! dc.RectVisible( &_rcMenuCaption ) )
- )
- return;
- _rcMenuCaption.DeflateRect( 2, 2, 2, 0 );
- dc.FillSolidRect( &_rcMenuCaption, GetColor( COLOR_3DSHADOW ) );
- _rcMenuCaption.DeflateRect( 8, 0 );
- if( nTextLen )
- {
- bool bRTL = (pPopup != NULL) ? pPopup->OnQueryLayoutRTL() : false;
- UINT nDT = DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS|DT_NOCLIP
- | ( bRTL ? DT_RIGHT : DT_LEFT );
- CFont * pFont = MenuCaptionGetFont( pPopup, lParam );
- ASSERT( pFont->GetSafeHandle() != NULL );
- CFont * pOldFont = dc.SelectObject( pFont );
- COLORREF clrOldText = dc.SetTextColor( GetColor( COLOR_3DHIGHLIGHT ) );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- dc.DrawText(
- LPCTSTR( sMenuCaptionText ),
- nTextLen,
- &_rcMenuCaption,
- nDT
- );
- dc.SetBkMode( nOldBkMode );
- dc.SetTextColor( clrOldText );
- dc.SelectObject( pOldFont );
- } // if( nTextLen )
- }
- void CExtPaintManagerOffice2007_Impl::MenuCaption_Paint(
- CDC & dc,
- const RECT & rcMenuCaption,
- __EXT_MFC_SAFE_LPCTSTR sMenuCaptionText,
- CExtPopupMenuWnd * pPopup,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- // ASSERT_VALID( pPopup );
- if( ( ! dc.RectVisible( &rcMenuCaption ) )
- //|| sMenuCaptionText == NULL
- )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::MenuCaption_Paint(
- dc,
- rcMenuCaption,
- sMenuCaptionText,
- pPopup,
- lParam
- );
- return;
- }
- INT nTextLen = ( sMenuCaptionText != NULL ) ? INT( _tcslen( sMenuCaptionText ) ) : 0;
- // if( nTextLen == 0 )
- // return;
- CRect _rcMenuCaption = rcMenuCaption;
- if( _rcMenuCaption.IsRectEmpty()
- || ( ! dc.RectVisible( &_rcMenuCaption ) )
- )
- return;
- CRect _rcMenuCaptionBk = _rcMenuCaption;
- //_rcMenuCaptionBk.InflateRect( 2, 2, 2, 0 );
- m_bmpMenuCaptionBk.AlphaBlendSkinParts(
- dc.m_hDC,
- _rcMenuCaptionBk,
- m_rcMenuCaptionBmpPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- _rcMenuCaption.DeflateRect( 10, 0 );
- if( nTextLen != 0 )
- {
- bool bRTL = ( pPopup != NULL ) ? pPopup->OnQueryLayoutRTL() : false;
- UINT nDT = DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS|DT_NOCLIP
- | ( bRTL ? DT_RIGHT : DT_LEFT );
- CFont * pFont = MenuCaptionGetFont( pPopup, lParam );
- ASSERT( pFont->GetSafeHandle() != NULL );
- CFont * pOldFont = dc.SelectObject( pFont );
- COLORREF clrOldText = dc.SetTextColor( m_clrMenuCaptionText );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- dc.DrawText(
- LPCTSTR( sMenuCaptionText ),
- nTextLen,
- &_rcMenuCaption,
- nDT
- );
- dc.SetBkMode( nOldBkMode );
- dc.SetTextColor( clrOldText );
- dc.SelectObject( pOldFont );
- }
- }
- CExtPaintManagerOffice2007_Blue::CExtPaintManagerOffice2007_Blue()
- {
- }
- CExtPaintManagerOffice2007_Blue::~CExtPaintManagerOffice2007_Blue()
- {
- }
- CExtPaintManagerOffice2007_Black::CExtPaintManagerOffice2007_Black()
- {
- }
- CExtPaintManagerOffice2007_Black::~CExtPaintManagerOffice2007_Black()
- {
- }
- CExtPaintManagerOffice2007_Silver::CExtPaintManagerOffice2007_Silver()
- {
- }
- CExtPaintManagerOffice2007_Silver::~CExtPaintManagerOffice2007_Silver()
- {
- }
- bool CExtPaintManager::PaintProgress(
- CDC & dc,
- CExtPaintManager::PAINTPROGRESSDATA & _ppd
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- dc;
- _ppd;
- return false;
- }
- bool CExtPaintManagerNativeXP::PaintProgress(
- CDC & dc,
- CExtPaintManager::PAINTPROGRESSDATA & _ppd
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return CExtPaintManager::PaintProgress( dc, _ppd );
- if( g_PaintManager.m_UxTheme.OpenThemeData( ::GetDesktopWindow(), L"PROGRESS" ) == NULL )
- return false;
- CRect rcProgress( _ppd.m_rcClient );
- if( g_PaintManager.m_UxTheme.DrawThemeBackground(
- dc.GetSafeHdc(),
- _ppd.m_bHorz ? PP_BAR : PP_BARVERT,
- 0,
- &rcProgress,
- &rcProgress
- ) == S_OK
- )
- {
- if( _ppd.m_bEndlessMode )
- {
-
- ASSERT( _ppd.m_nEndlessNominator > 0 );
- ASSERT( _ppd.m_nEndlessDenominator > 0 );
- ASSERT( _ppd.m_nEndlessNominator < _ppd.m_nEndlessDenominator );
- if( _ppd.m_bHorz )
- {
- LONG nBasic = rcProgress.Width();
- LONG nCross = rcProgress.Height();
- if( nCross <= 0 )
- nCross = 1;
- LONG nAll = nBasic - nBasic % nCross;
- LONG nPart = ::MulDiv( nAll, _ppd.m_nEndlessNominator, _ppd.m_nEndlessDenominator );
- LONG nExt = nAll - nPart;
- rcProgress.left += ::MulDiv( nExt, _ppd.m_nPos, _ppd.m_nRange );
- rcProgress.right = rcProgress.left + nPart;
- }
- else
- {
- LONG nBasic = rcProgress.Height();
- LONG nCross = rcProgress.Width();
- if( nCross <= 0 )
- nCross = 1;
- LONG nAll = nBasic - nBasic % nCross;
- LONG nPart = ::MulDiv( nAll, _ppd.m_nEndlessNominator, _ppd.m_nEndlessDenominator );
- LONG nExt = nAll - nPart;
- rcProgress.bottom -= ::MulDiv( nExt, _ppd.m_nPos, _ppd.m_nRange );
- rcProgress.top = rcProgress.bottom - nPart;
- }
- } // if( _ppd.m_bEndlessMode )
- else
- {
- if( _ppd.m_bHorz )
- rcProgress.right =
- rcProgress.left
- + ::MulDiv( rcProgress.Width(), _ppd.m_nPos, _ppd.m_nRange );
- else
- rcProgress.top =
- rcProgress.bottom
- - ::MulDiv( rcProgress.Height(), _ppd.m_nPos, _ppd.m_nRange );
- } // else from if( _ppd.m_bEndlessMode )
- INT nChunkSize = 0; // The size of the progress control "chunk" shapes that define how far an operation has progressed
- INT nSpaceSize = 0; // The total size of all of the progress control "chunks"
- if( g_PaintManager.m_UxTheme.GetThemeMetric(
- dc.GetSafeHdc(),
- _ppd.m_bHorz ? PP_CHUNK : PP_CHUNKVERT,
- 0,
- TMT_PROGRESSCHUNKSIZE,
- &nChunkSize
- ) == S_OK
- && g_PaintManager.m_UxTheme.GetThemeMetric(
- dc.GetSafeHdc(),
- _ppd.m_bHorz ? PP_CHUNK : PP_CHUNKVERT,
- 0,
- TMT_PROGRESSSPACESIZE,
- &nSpaceSize
- ) == S_OK
- )
- {
- rcProgress.DeflateRect( 2, 2 );
- CRect rcChunk( rcProgress );
- INT nChunkShift = nChunkSize + nSpaceSize;
- rcChunk.SetRect(
- _ppd.m_bHorz ? rcChunk.left : rcChunk.left,
- _ppd.m_bHorz ? rcChunk.top : (rcChunk.bottom - nChunkSize ),
- _ppd.m_bHorz ? ( rcChunk.left + nChunkSize ) : rcChunk.right,
- _ppd.m_bHorz ? rcChunk.bottom : rcChunk.bottom
- );
- ASSERT(
- ( (!_ppd.m_bHorz) && rcChunk.Height() == nChunkSize )
- || ( _ppd.m_bHorz && rcChunk.Width() == nChunkSize )
- );
- while( true )
- {
- CRect rcProgressFullClip = rcProgress;
- rcProgressFullClip.DeflateRect( 2, 2 );
- CRect rcChunkClip;
- rcChunkClip.IntersectRect( &rcProgressFullClip, rcChunk );
- if( g_PaintManager.m_UxTheme.DrawThemeBackground(
- dc.GetSafeHdc(),
- _ppd.m_bHorz ? PP_CHUNK : PP_CHUNKVERT,
- 0,
- &rcChunk,
- &rcChunkClip
- ) != S_OK
- )
- break;
- if( _ppd.m_bHorz )
- {
- if( rcChunk.right > rcProgress.right )
- break;
- }
- else
- {
- if( rcChunk.top < rcProgress.top )
- break;
- }
- rcChunk.OffsetRect(
- _ppd.m_bHorz ? nChunkShift : 0,
- _ppd.m_bHorz ? 0 : ( - nChunkShift )
- );
- }
- }
- }
- g_PaintManager.m_UxTheme.CloseThemeData( true );
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::PaintProgress(
- CDC & dc,
- CExtPaintManager::PAINTPROGRESSDATA & _ppd
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::PaintProgress(
- dc,
- _ppd
- );
- if( _ppd.m_rcClient.Width() <= 0
- || _ppd.m_rcClient.Height() <= 0
- || ( ! dc.RectVisible( &_ppd.m_rcClient ) )
- )
- return false;
- CExtBitmap & bmpProgressMain = _ppd.m_bHorz ? m_bmpProgressMainH : m_bmpProgressMainV;
- if( bmpProgressMain.IsEmpty() )
- return false;
- CRect rcProgress( _ppd.m_rcClient );
- // if( _ppd.m_pHelperSrc == NULL
- // || ( ! _ppd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CWnd ) ) )
- // || ( ! GetCb2DbTransparentMode( _ppd.m_pHelperSrc, _ppd.m_lParam ) )
- // || ( ! PaintDockerBkgnd( true, dc, (CWnd*)_ppd.m_pHelperSrc, _ppd.m_lParam ) )
- // )
- // {
- // COLORREF clrBackgroundArea = GetColor( COLOR_3DFACE, _ppd.m_pHelperSrc, _ppd.m_lParam );
- // clrBackgroundArea = dc.GetNearestColor( clrBackgroundArea );
- // dc.FillSolidRect( &rcProgress, clrBackgroundArea );
- // }
- if( _ppd.m_bBorder )
- {
- CExtBitmap & bmpProgressBorder = _ppd.m_bHorz ? m_bmpProgressBorderH : m_bmpProgressBorderV;
- if( bmpProgressBorder.IsEmpty() )
- return false;
- CRect rcProgressBorderPadding = _ppd.m_bHorz ? m_rcProgressBorderPaddingH : m_rcProgressBorderPaddingV;
- if( ! bmpProgressBorder.AlphaBlendSkinParts(
- dc.m_hDC,
- rcProgress,
- rcProgressBorderPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- )
- )
- return false;
- rcProgress.DeflateRect(
- rcProgressBorderPadding.left,
- rcProgressBorderPadding.top,
- rcProgressBorderPadding.right,
- rcProgressBorderPadding.bottom
- );
- } // if( _ppd.m_bBorder )
- if( rcProgress.Width() <= 0
- || rcProgress.Height() <= 0
- || ( ! dc.RectVisible( &rcProgress ) )
- )
- return true;
- CExtMemoryDC dcX( &dc, &rcProgress, CExtMemoryDC::MDCOPT_TO_MEMORY|CExtMemoryDC::MDCOPT_RTL_COMPATIBILITY );
- CRect rcProgressBackgroundPadding = _ppd.m_bHorz ? m_rcProgressBackgroundPaddingH : m_rcProgressBackgroundPaddingV;
- CRect rcProgressBackgroundPart = _ppd.m_bHorz ? m_rcProgressBackgroundPartH : m_rcProgressBackgroundPartV;
- if( ! bmpProgressMain.AlphaBlendSkinParts(
- dcX.m_hDC,
- rcProgress,
- rcProgressBackgroundPart,
- rcProgressBackgroundPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- )
- )
- return false;
- CRect rcProgressBarPadding = _ppd.m_bHorz ? m_rcProgressBarPaddingH : m_rcProgressBarPaddingV;
- if( _ppd.m_bEndlessMode )
- {
-
- ASSERT( _ppd.m_nEndlessNominator > 0 );
- ASSERT( _ppd.m_nEndlessDenominator > 0 );
- ASSERT( _ppd.m_nEndlessNominator < _ppd.m_nEndlessDenominator );
- if( _ppd.m_bHorz )
- {
- LONG nAll = rcProgress.Width();;
- LONG nPart = ::MulDiv( nAll, _ppd.m_nEndlessNominator, _ppd.m_nEndlessDenominator );
- LONG nExt = nAll - nPart;
- rcProgress.left += ::MulDiv( nExt, _ppd.m_nPos, _ppd.m_nRange );
- rcProgress.right = rcProgress.left + nPart;
- }
- else
- {
- LONG nAll = rcProgress.Height();
- LONG nPart = ::MulDiv( nAll, _ppd.m_nEndlessNominator, _ppd.m_nEndlessDenominator );
- LONG nExt = nAll - nPart;
- rcProgress.bottom -= ::MulDiv( nExt, _ppd.m_nPos, _ppd.m_nRange );
- rcProgress.top = rcProgress.bottom - nPart;
- }
- } // if( _ppd.m_bEndlessMode )
- else
- {
- if( _ppd.m_bHorz )
- rcProgress.right =
- rcProgress.left
- + ::MulDiv( rcProgress.Width(), _ppd.m_nPos, _ppd.m_nRange )
- + rcProgressBarPadding.right
- ;
- else
- rcProgress.top =
- rcProgress.bottom
- - ::MulDiv( rcProgress.Height(), _ppd.m_nPos, _ppd.m_nRange )
- - rcProgressBarPadding.top
- ;
- } // else from if( _ppd.m_bEndlessMode )
- if( rcProgress.Width() <= 0
- || rcProgress.Height() <= 0
- || ( ! dcX.RectVisible( &rcProgress ) )
- )
- return true;
- CRect rcProgressBarPart = _ppd.m_bHorz ? m_rcProgressBarPartH : m_rcProgressBarPartV;
- if( ! bmpProgressMain.AlphaBlendSkinParts(
- dcX.m_hDC,
- rcProgress,
- rcProgressBarPart,
- rcProgressBarPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- )
- )
- return false;
- return true;
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CFont & CExtPaintManager::ScreenTip_GetFont(
- bool bCaption,
- bool bMainPart,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- bMainPart;
- _CCST;
- pHelperSrc;
- lParam;
- return bCaption ? m_FontBold : m_FontNormal;
- }
- CRect CExtPaintManager::ScreenTip_GetPaddingOuter(
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- pHelperSrc;
- lParam;
- bool bMainTextMode = false;
- CExtSafeString strCaptionMain = _CCST.CaptionMainGet();
- CExtSafeString strTextMain = _CCST.TextMainGet();
- CExtSafeString strCaptionSecondary = _CCST.CaptionSecondaryGet();
- CExtSafeString strTextSecondary = _CCST.TextSecondaryGet();
- if( strCaptionMain.IsEmpty()
- && (! strTextMain.IsEmpty() )
- && strCaptionSecondary.IsEmpty()
- && strTextSecondary.IsEmpty()
- )
- bMainTextMode = true;
- INT n = bMainTextMode ? 0 : 5;
- CRect rcPadding( n, n, n, n );
- rcPadding.left = UiScalingDo( rcPadding.left, __EUIST_X );
- rcPadding.top = UiScalingDo( rcPadding.top, __EUIST_Y );
- rcPadding.right = UiScalingDo( rcPadding.right, __EUIST_X );
- rcPadding.bottom = UiScalingDo( rcPadding.bottom, __EUIST_Y );
- return rcPadding;
- }
- CRect CExtPaintManager::ScreenTip_GetPaddingInnerBmp(
- bool bMainPart,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- bMainPart;
- _CCST;
- pHelperSrc;
- lParam;
- CRect rcPadding( 2, 2, 2, 2 );
- rcPadding.left = UiScalingDo( rcPadding.left, __EUIST_X );
- rcPadding.top = UiScalingDo( rcPadding.top, __EUIST_Y );
- rcPadding.right = UiScalingDo( rcPadding.right, __EUIST_X );
- rcPadding.bottom = UiScalingDo( rcPadding.bottom, __EUIST_Y );
- return rcPadding;
- }
- CRect CExtPaintManager::ScreenTip_GetPaddingInnerText(
- bool bCaption,
- bool bMainPart,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- bCaption;
- bMainPart;
- _CCST;
- pHelperSrc;
- lParam;
- CRect rcPadding( 3, 3, 3, 3 );
- if( ! bCaption )
- rcPadding.left += 10;
- rcPadding.left = UiScalingDo( rcPadding.left, __EUIST_X );
- rcPadding.top = UiScalingDo( rcPadding.top, __EUIST_Y );
- rcPadding.right = UiScalingDo( rcPadding.right, __EUIST_X );
- rcPadding.bottom = UiScalingDo( rcPadding.bottom, __EUIST_Y );
- return rcPadding;
- }
- INT CExtPaintManager::ScreenTip_GetSeparatorHeight(
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- pHelperSrc;
- lParam;
- bool bHaveSeparator = ( (_CCST.GetFlags()&__ECCST_SEPARATOR) != 0 ) ? true : false;
- if( ! bHaveSeparator )
- return 0;
- INT nSeparatorHeight = UiScalingDo( 11, __EUIST_Y );
- return nSeparatorHeight;
- }
- COLORREF CExtPaintManager::ScreenTip_GetTextColor(
- bool bCaption,
- bool bMainPart,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- bCaption;
- bMainPart;
- _CCST;
- COLORREF clrText = GetColor( COLOR_INFOTEXT, pHelperSrc, lParam );
- return clrText;
- }
- COLORREF CExtPaintManagerOffice2007_Impl::ScreenTip_GetTextColor(
- bool bCaption,
- bool bMainPart,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( &_CCST );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::ScreenTip_GetTextColor(
- bCaption,
- bMainPart,
- _CCST,
- pHelperSrc,
- lParam
- );
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- return m_clrRibbonGroupCaptionTextCollapsed;
- #else
- return RGB(0,0,0);
- #endif
- }
- CSize CExtPaintManager::ScreenTip_Measure(
- CDC & dc,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( &_CCST );
- if( _CCST.IsEmpty() )
- return CSize( 0, 0 );
- bool bMainPartEmpty = true, bSecondaryPartEmpty = true;
- CSize _sizeBmpMain = _CCST.BmpMainGet().GetSize();
- _sizeBmpMain.cx = UiScalingDo( _sizeBmpMain.cx, __EUIST_X );
- _sizeBmpMain.cy = UiScalingDo( _sizeBmpMain.cy, __EUIST_Y );
- if( _sizeBmpMain.cx > 0 && _sizeBmpMain.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( true, _CCST, pHelperSrc, lParam );
- _sizeBmpMain.cx += rcPadding.left + rcPadding.right;
- _sizeBmpMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- CSize _sizeBmpSecondary = _CCST.BmpSecondaryGet().GetSize();
- _sizeBmpSecondary.cx = UiScalingDo( _sizeBmpSecondary.cx, __EUIST_X );
- _sizeBmpSecondary.cy = UiScalingDo( _sizeBmpSecondary.cy, __EUIST_Y );
- if( _sizeBmpSecondary.cx > 0 && _sizeBmpSecondary.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( false, _CCST, pHelperSrc, lParam );
- _sizeBmpSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeBmpSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- CExtSafeString str;
- str = _CCST.CaptionMainGet();
- CSize _sizeCaptionMain( 0, 0 );
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, true, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( true, true, _CCST, pHelperSrc, lParam );
- _sizeCaptionMain = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- _sizeCaptionMain.cx += rcPadding.left + rcPadding.right;
- _sizeCaptionMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- str = _CCST.CaptionSecondaryGet();
- CSize _sizeCaptionSecondary( 0, 0 );
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, false, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( true, false, _CCST, pHelperSrc, lParam );
- _sizeCaptionSecondary = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- _sizeCaptionSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeCaptionSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- CSize _sizeTextMain( 0, 0 );
- str = _CCST.TextMainGet();
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, true, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( false, true, _CCST, pHelperSrc, lParam );
- _sizeTextMain = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_LEFT|DT_TOP ).Size();
- _sizeTextMain.cx += rcPadding.left + rcPadding.right;
- _sizeTextMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- CSize _sizeTextSecondary( 0, 0 );
- str = _CCST.TextSecondaryGet();
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, false, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( false, false, _CCST, pHelperSrc, lParam );
- _sizeTextSecondary = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_LEFT|DT_TOP ).Size();
- _sizeTextSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeTextSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- if( bMainPartEmpty && bSecondaryPartEmpty )
- return CSize( 0, 0 );
- CRect rcPadding = ScreenTip_GetPaddingOuter( _CCST, pHelperSrc, lParam );
- CSize _sizeAll( rcPadding.left + rcPadding.right, rcPadding.top + rcPadding.bottom ), _sizeMain( 0, 0 ), _sizeSecondary( 0, 0 );
- if( ! ( bMainPartEmpty || bSecondaryPartEmpty ) )
- _sizeAll.cy += ScreenTip_GetSeparatorHeight( _CCST, pHelperSrc, lParam );
- if( ! bMainPartEmpty )
- {
- _sizeMain = _sizeCaptionMain;
- INT nWidth = _sizeBmpMain.cx + _sizeTextMain.cx;
- _sizeMain.cx = max( _sizeMain.cx, nWidth );
- INT nHeight = max( _sizeBmpMain.cy, _sizeTextMain.cy );
- _sizeMain.cy += nHeight;
- }
- if( ! bSecondaryPartEmpty )
- {
- _sizeSecondary.cx = max( _sizeCaptionSecondary.cx, _sizeTextSecondary.cx );
- _sizeSecondary.cx += _sizeBmpSecondary.cx;
- _sizeSecondary.cy = _sizeCaptionSecondary.cy + _sizeTextSecondary.cy;
- _sizeSecondary.cy = max( _sizeBmpSecondary.cy, _sizeSecondary.cy );
- }
- _sizeAll.cx += max( _sizeMain.cx, _sizeSecondary.cx );
- _sizeAll.cy += _sizeMain.cy + _sizeSecondary.cy;
- return _sizeAll;
- }
- void CExtPaintManager::ScreenTip_PaintBackground(
- CDC & dc,
- const RECT & rcScreenTip,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( &_CCST );
- _CCST;
- COLORREF clrOldText = dc.GetTextColor();
- COLORREF clrBk = GetColor( COLOR_INFOBK, pHelperSrc, lParam );
- dc.FillSolidRect( &rcScreenTip, clrBk );
- COLORREF clrLT = GetColor( COLOR_3DFACE, pHelperSrc, lParam );
- COLORREF clrRB = GetColor( COLOR_3DSHADOW, pHelperSrc, lParam );
- dc.Draw3dRect( &rcScreenTip, clrLT, clrRB );
- dc.SetTextColor( clrOldText );
- }
- void CExtPaintManagerOffice2007_Impl::ScreenTip_PaintBackground(
- CDC & dc,
- const RECT & rcScreenTip,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( &_CCST );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::ScreenTip_PaintBackground(
- dc,
- rcScreenTip,
- _CCST,
- pHelperSrc,
- lParam
- );
- return;
- }
- CRect rcGradient = rcScreenTip;
- rcGradient.DeflateRect(
- m_rcAdvTipPaddingGradient.left,
- m_rcAdvTipPaddingGradient.top,
- m_rcAdvTipPaddingGradient.right,
- m_rcAdvTipPaddingGradient.bottom
- );
- stat_PaintGradientRect(
- dc,
- rcGradient,
- m_clrAdvTipGradientBottom,
- m_clrAdvTipGradientTop,
- true,
- 255
- );
- m_bmpAdvTipBorder.AlphaBlendSkinParts(
- dc,
- rcScreenTip,
- m_rcAdvTipPaddingBorder,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- void CExtPaintManager::ScreenTip_Paint(
- CDC & dc,
- const RECT & rcScreenTip,
- CExtCustomizeCmdScreenTip & _CCST,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( &_CCST );
- if( ! dc.RectVisible( &rcScreenTip ) )
- return;
- bool bPaintBackGround = true;
- if( pHelperSrc != NULL
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtPopupMenuTipWnd ) )
- )
- {
- CExtPopupMenuTipWnd::e_tip_style_t eTS = ((CExtPopupMenuTipWnd*)pHelperSrc)->GetTipStyle();
- if( eTS == CExtPopupMenuTipWnd::__ETS_BALLOON
- || eTS == CExtPopupMenuTipWnd::__ETS_BALLOON
- )
- bPaintBackGround = false;
- }
- if( bPaintBackGround )
- ScreenTip_PaintBackground(
- dc,
- rcScreenTip,
- _CCST,
- pHelperSrc,
- lParam
- );
- if( _CCST.IsEmpty() )
- return;
- bool bMainPartEmpty = true, bSecondaryPartEmpty = true;
- CSize _sizeBmpMain = _CCST.BmpMainGet().GetSize();
- _sizeBmpMain.cx = UiScalingDo( _sizeBmpMain.cx, __EUIST_X );
- _sizeBmpMain.cy = UiScalingDo( _sizeBmpMain.cy, __EUIST_Y );
- if( _sizeBmpMain.cx > 0 && _sizeBmpMain.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( true, _CCST, pHelperSrc, lParam );
- _sizeBmpMain.cx += rcPadding.left + rcPadding.right;
- _sizeBmpMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- CSize _sizeBmpSecondary = _CCST.BmpSecondaryGet().GetSize();
- _sizeBmpSecondary.cx = UiScalingDo( _sizeBmpSecondary.cx, __EUIST_X );
- _sizeBmpSecondary.cy = UiScalingDo( _sizeBmpSecondary.cy, __EUIST_Y );
- if( _sizeBmpSecondary.cx > 0 && _sizeBmpSecondary.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( false, _CCST, pHelperSrc, lParam );
- _sizeBmpSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeBmpSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- CExtSafeString str;
- str = _CCST.CaptionMainGet();
- CSize _sizeCaptionMain( 0, 0 );
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, true, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( true, true, _CCST, pHelperSrc, lParam );
- _sizeCaptionMain = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- _sizeCaptionMain.cx += rcPadding.left + rcPadding.right;
- _sizeCaptionMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- str = _CCST.CaptionSecondaryGet();
- CSize _sizeCaptionSecondary( 0, 0 );
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, false, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( true, false, _CCST, pHelperSrc, lParam );
- _sizeCaptionSecondary = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_SINGLELINE|DT_LEFT|DT_TOP ).Size();
- _sizeCaptionSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeCaptionSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- CSize _sizeTextMain( 0, 0 );
- str = _CCST.TextMainGet();
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, true, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( false, true, _CCST, pHelperSrc, lParam );
- _sizeTextMain = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_LEFT|DT_TOP ).Size();
- _sizeTextMain.cx += rcPadding.left + rcPadding.right;
- _sizeTextMain.cy += rcPadding.top + rcPadding.bottom;
- bMainPartEmpty = false;
- }
- CSize _sizeTextSecondary( 0, 0 );
- str = _CCST.TextSecondaryGet();
- if( str.GetLength() > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, false, _CCST, pHelperSrc, lParam );
- CFont & _font = ScreenTip_GetFont( false, false, _CCST, pHelperSrc, lParam );
- _sizeTextSecondary = stat_CalcTextDimension( dc, _font, str, DT_CALCRECT|DT_LEFT|DT_TOP ).Size();
- _sizeTextSecondary.cx += rcPadding.left + rcPadding.right;
- _sizeTextSecondary.cy += rcPadding.top + rcPadding.bottom;
- bSecondaryPartEmpty = false;
- }
- if( bMainPartEmpty && bSecondaryPartEmpty )
- return;
- CSize _sizeMain( 0, 0 ), _sizeSecondary( 0, 0 );
- if( ! bMainPartEmpty )
- {
- _sizeMain = _sizeCaptionMain;
- INT nWidth = _sizeBmpMain.cx + _sizeTextMain.cx;
- _sizeMain.cx = max( _sizeMain.cx, nWidth );
- INT nHeight = max( _sizeBmpMain.cy, _sizeTextMain.cy );
- _sizeMain.cy += nHeight;
- }
- if( ! bSecondaryPartEmpty )
- {
- _sizeSecondary.cx = max( _sizeCaptionSecondary.cx, _sizeTextSecondary.cx );
- _sizeSecondary.cx += _sizeBmpSecondary.cx;
- _sizeSecondary.cy = _sizeCaptionSecondary.cy + _sizeTextSecondary.cy;
- _sizeSecondary.cy = max( _sizeBmpSecondary.cy, _sizeSecondary.cy );
- }
- INT nSeparatorHeight = 0;
- if( ! ( bMainPartEmpty || bSecondaryPartEmpty ) )
- nSeparatorHeight = ScreenTip_GetSeparatorHeight( _CCST, pHelperSrc, lParam );
- CRect rcPadding = ScreenTip_GetPaddingOuter( _CCST, pHelperSrc, lParam );
- CRect rcMainAll = rcScreenTip;
- rcMainAll.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, 0 );
- rcMainAll.bottom = rcMainAll.top + _sizeMain.cy;
- CRect rcSecondaryAll( rcMainAll.left, rcMainAll.bottom, rcMainAll.right, rcMainAll.bottom + _sizeSecondary.cy );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- CRect rcCaption = rcMainAll, rcBmp = rcMainAll, rcText = rcMainAll;
- if( _sizeMain.cx > 0 && _sizeMain.cy > 0 )
- {
- str = _CCST.CaptionMainGet();
- rcCaption.bottom = rcBmp.top = rcText.top = rcCaption.top + _sizeCaptionMain.cy;
- rcBmp.right = rcText.left = rcBmp.left + _sizeBmpMain.cx;
- if( _sizeCaptionMain.cx > 0 && _sizeCaptionMain.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, true, _CCST, pHelperSrc, lParam );
- rcCaption.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- COLORREF clrText = ScreenTip_GetTextColor( true, true, _CCST, pHelperSrc, lParam );
- COLORREF clrOld = dc.SetTextColor( clrText );
- CFont & _font = ScreenTip_GetFont( true, true, _CCST, pHelperSrc, lParam );
- CFont * pOldFont = dc.SelectObject( &_font );
- str = _CCST.CaptionMainGet();
- ASSERT( str.GetLength() > 0 );
- dc.DrawText(
- LPCTSTR( str ),
- str.GetLength(),
- &rcCaption,
- DT_SINGLELINE|DT_LEFT|DT_TOP
- );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOld );
- }
- if( _sizeTextMain.cx > 0 && _sizeTextMain.cy > 0 )
- {
- UINT nDT = DT_CENTER|DT_VCENTER|DT_SINGLELINE;
- if( ! str.IsEmpty() )
- {
- nDT = DT_LEFT|DT_TOP;
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, true, _CCST, pHelperSrc, lParam );
- rcText.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- }
- COLORREF clrText = ScreenTip_GetTextColor( false, true, _CCST, pHelperSrc, lParam );
- COLORREF clrOld = dc.SetTextColor( clrText );
- CFont & _font = ScreenTip_GetFont( false, true, _CCST, pHelperSrc, lParam );
- CFont * pOldFont = dc.SelectObject( &_font );
- str = _CCST.TextMainGet();
- ASSERT( str.GetLength() > 0 );
- dc.DrawText(
- LPCTSTR( str ),
- str.GetLength(),
- &rcText,
- nDT
- );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOld );
- }
- if( _sizeBmpMain.cx > 0 && _sizeBmpMain.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( true, _CCST, pHelperSrc, lParam );
- rcBmp.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- CSize _size = _CCST.BmpMainGet().GetSize();
- rcBmp.right = rcBmp.left + _size.cx;
- rcBmp.bottom = rcBmp.top + _size.cy;
- _CCST.BmpMainGet().AlphaBlend( dc.m_hDC, rcBmp );
- }
- }
- if( nSeparatorHeight != 0 )
- {
- CRect rcSeparator(
- rcMainAll.left,
- rcMainAll.top + _sizeMain.cy,
- rcMainAll.right,
- rcMainAll.top + _sizeMain.cy + nSeparatorHeight
- );
- rcSeparator.DeflateRect( 0, rcSeparator.Height() / 2 );
- rcSeparator.bottom = rcSeparator.top + 2;
- // COLORREF clrLT = GetColor( COLOR_3DDKSHADOW, pHelperSrc, lParam );
- // COLORREF clrRB = GetColor( COLOR_3DHILIGHT, pHelperSrc, lParam );
- dc.Draw3dRect(
- &rcSeparator,
- RGB(145,153,164), // clrLT,
- RGB(224,224,224) // clrRB
- );
- }
- if( _sizeSecondary.cx > 0 && _sizeSecondary.cy > 0 )
- {
- rcCaption = rcMainAll;
- rcCaption.top += _sizeMain.cy + nSeparatorHeight;
- rcBmp = rcCaption;
- rcCaption.left += _sizeBmpSecondary.cx;
- rcText = rcCaption;
- rcCaption.bottom = rcText.top = rcCaption.top + _sizeCaptionSecondary.cy;
- rcText.bottom = rcBmp.bottom = rcMainAll.bottom + _sizeSecondary.cy + nSeparatorHeight;
- if( _sizeCaptionSecondary.cx > 0 && _sizeCaptionSecondary.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( true, false, _CCST, pHelperSrc, lParam );
- rcCaption.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- COLORREF clrText = ScreenTip_GetTextColor( true, false, _CCST, pHelperSrc, lParam );
- COLORREF clrOld = dc.SetTextColor( clrText );
- CFont & _font = ScreenTip_GetFont( true, false, _CCST, pHelperSrc, lParam );
- CFont * pOldFont = dc.SelectObject( &_font );
- str = _CCST.CaptionSecondaryGet();
- ASSERT( str.GetLength() > 0 );
- dc.DrawText(
- LPCTSTR( str ),
- str.GetLength(),
- &rcCaption,
- DT_SINGLELINE|DT_LEFT|DT_TOP
- );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOld );
- }
- if( _sizeTextSecondary.cx > 0 && _sizeTextSecondary.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerText( false, false, _CCST, pHelperSrc, lParam );
- rcText.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- COLORREF clrText = ScreenTip_GetTextColor( false, false, _CCST, pHelperSrc, lParam );
- COLORREF clrOld = dc.SetTextColor( clrText );
- CFont & _font = ScreenTip_GetFont( false, false, _CCST, pHelperSrc, lParam );
- CFont * pOldFont = dc.SelectObject( &_font );
- str = _CCST.TextSecondaryGet();
- ASSERT( str.GetLength() > 0 );
- dc.DrawText(
- LPCTSTR( str ),
- str.GetLength(),
- &rcText,
- DT_LEFT|DT_TOP
- );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOld );
- }
- if( _sizeBmpSecondary.cx > 0 && _sizeBmpSecondary.cy > 0 )
- {
- CRect rcPadding = ScreenTip_GetPaddingInnerBmp( false, _CCST, pHelperSrc, lParam );
- rcBmp.DeflateRect( rcPadding.left, rcPadding.top, rcPadding.right, rcPadding.bottom );
- CSize _size = _CCST.BmpSecondaryGet().GetSize();
- rcBmp.right = rcBmp.left + _size.cx;
- rcBmp.bottom = rcBmp.top + _size.cy;
- _CCST.BmpSecondaryGet().AlphaBlend( dc.m_hDC, rcBmp );
- }
- }
- dc.SetBkMode( nOldBkMode );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- #if (!defined __EXT_MFC_NO_PAGECONTAINER_CTRL)
- void CExtPaintManager::PageContainer_EraseEntire(
- CDC & dc,
- CRect rcClient,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pWndPageContainer );
- if( ! dc.RectVisible( &rcClient ) )
- return;
- if( (! GetCb2DbTransparentMode( pWndPageContainer, lParam ) )
- || (! PaintDockerBkgnd( true, dc, pWndPageContainer, lParam ) )
- )
- dc.FillSolidRect(
- &rcClient,
- GetColor( CExtPaintManager::CLR_3DFACE_OUT, pWndPageContainer, lParam )
- );
- }
- void CExtPaintManager::PageContainer_EraseScrollPosArea(
- CDC & dc,
- CRect rcScrollPosArea,
- LONG nScrollPos,
- LONG nScrollSize,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pWndPageContainer );
- ASSERT( nScrollPos <= nScrollSize );
- nScrollPos;
- nScrollSize;
- if( (rcScrollPosArea.right - rcScrollPosArea.left) <= 1
- || (rcScrollPosArea.bottom - rcScrollPosArea.top) <= 1
- )
- return;
- if( ! dc.RectVisible( &rcScrollPosArea ) )
- return;
- COLORREF clrLight = GetColor( COLOR_3DHIGHLIGHT, pWndPageContainer, lParam );
- COLORREF clrShadow = GetColor( COLOR_3DDKSHADOW, pWndPageContainer, lParam );
- COLORREF clrFace = GetColor( COLOR_3DSHADOW, pWndPageContainer, lParam );
- dc.FillSolidRect(
- &rcScrollPosArea,
- clrFace
- );
- dc.Draw3dRect(
- &rcScrollPosArea,
- clrShadow,
- clrLight
- );
- }
- void CExtPaintManager::PageContainer_DrawScrollPosArea(
- CDC & dc,
- CRect rcScrollPosArea,
- LONG nScrollPos,
- LONG nScrollSize,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pWndPageContainer );
- ASSERT( nScrollPos <= nScrollSize );
- if( (rcScrollPosArea.right - rcScrollPosArea.left) <= 1
- || (rcScrollPosArea.bottom - rcScrollPosArea.top) <= 1
- )
- return;
- if( ! dc.RectVisible( &rcScrollPosArea ) )
- return;
- CRect rcScrollBtn( rcScrollPosArea );
- rcScrollBtn.DeflateRect( 1, 1 );
- if( (rcScrollBtn.right - rcScrollBtn.left) <= 1
- || (rcScrollBtn.bottom - rcScrollBtn.top) <= 1
- )
- return;
- if( nScrollSize > 0 )
- {
- ASSERT( nScrollPos <= nScrollSize );
- bool bHorzLayout = pWndPageContainer->IsHorizontalLayout();
- LONG nScrollPecrent =
- ::MulDiv(
- nScrollPos,
- 100,
- nScrollSize
- );
- LONG nWindowMetric =
- bHorzLayout
- ? rcScrollPosArea.Width()
- : rcScrollPosArea.Height()
- ;
- LONG nBtnMetric =
- ::MulDiv(
- nWindowMetric,
- 100,
- ( nScrollSize + nWindowMetric )
- );
- nBtnMetric =
- ::MulDiv(
- nBtnMetric,
- nWindowMetric,
- 100
- );
- if( nBtnMetric < 10L )
- nBtnMetric = 10L;
- LONG nBtnMetricMax =
- bHorzLayout
- ? rcScrollBtn.Width()
- : rcScrollBtn.Height()
- ;
- LONG nBtnOffset = 0L;
- if( nBtnMetric >= nBtnMetricMax
- || nBtnMetric >= ( nWindowMetric - 2 )
- )
- nBtnMetric =
- min(
- nBtnMetricMax,
- ( nWindowMetric - 2 )
- );
- else
- {
- nBtnOffset =
- ::MulDiv(
- nWindowMetric - nBtnMetric,
- nScrollPecrent,
- 100
- );
- } // else from if( nBtnMetric >= nBtnMetricMax )
- if( bHorzLayout )
- {
- rcScrollBtn.left += nBtnOffset;
- rcScrollBtn.right =
- rcScrollBtn.left + nBtnMetric;
- if( (rcScrollBtn.right+1) >= rcScrollPosArea.right )
- rcScrollBtn.right =
- rcScrollPosArea.right - 1;
- } // if( bHorzLayout )
- else
- {
- rcScrollBtn.top += nBtnOffset;
- rcScrollBtn.bottom =
- rcScrollBtn.top + nBtnMetric;
- if( (rcScrollBtn.bottom+1) >= rcScrollPosArea.bottom )
- rcScrollBtn.bottom =
- rcScrollPosArea.bottom - 1;
- } // else from if( bHorzLayout )
- } // if( nScrollSize > 0 )
- COLORREF clrLight = GetColor( COLOR_3DHIGHLIGHT, pWndPageContainer, lParam );
- COLORREF clrShadow = GetColor( COLOR_3DDKSHADOW, pWndPageContainer, lParam );
- COLORREF clrFace = GetColor( COLOR_3DFACE, pWndPageContainer, lParam );
- dc.FillSolidRect(
- &rcScrollBtn,
- clrFace
- );
- dc.Draw3dRect(
- &rcScrollBtn,
- clrLight,
- clrShadow
- );
- }
- void CExtPaintManager::PageContainer_EraseItem(
- CDC & dc,
- LPVOID pPageInfo, // CExtPageContainerWnd::PAGE_ITEM_INFO
- CRect rcPage,
- CRect rcCaption,
- CRect rcWnd,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pPageInfo != NULL );
- ASSERT( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsVisible() );
- ASSERT_VALID( pWndPageContainer );
- rcCaption;
- rcWnd;
- if( rcPage.left >= rcPage.right
- || rcPage.top >= rcPage.bottom
- )
- return;
- if( ! dc.RectVisible( &rcPage ) )
- return;
- DWORD dwPageContainerStyle = pWndPageContainer->GetPageContainerStyle();
- if( (dwPageContainerStyle & __EPCWS_PAGE_BORDERS) == 0 )
- return;
- bool bPageIsExpanded = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsExpanded();
- if( ! bPageIsExpanded )
- return;
- ASSERT(
- rcPage.left <= rcWnd.left
- && rcPage.top <= rcWnd.top
- && rcPage.right >= rcWnd.right
- && rcPage.bottom >= rcWnd.bottom
- );
- CRect rcMiddle(
- (rcPage.left + rcWnd.left) / 2,
- (rcPage.top + rcWnd.top) / 2,
- (rcPage.right + rcWnd.right) / 2,
- (rcPage.bottom + rcWnd.bottom) / 2
- );
- if( m_bPageContainerUseGroupBoxStyle )
- {
- PaintGroupBoxFrame(
- dc,
- rcMiddle,
- COLORREF(-1L),
- pWndPageContainer,
- lParam
- );
- } // if( m_bPageContainerUseGroupBoxStyle )
- else
- {
- if( rcMiddle.left < rcMiddle.right
- && rcMiddle.top < rcMiddle.bottom
- )
- {
- if( ( dwPageContainerStyle & __EPCWS_CAPTION_FLAT ) != 0
- && (! ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionHover() )
- && (! ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionPressed() )
- )
- {
- HWND hWndPage = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->GetSafePageHwnd();
- ASSERT( hWndPage != NULL );
- ASSERT( ::IsWindow( hWndPage ) );
- bool bEnabled = ( ::IsWindowEnabled( hWndPage ) ) ? true : false;
- COLORREF clrFrame =
- GetColor(
- bEnabled
- ? COLOR_3DDKSHADOW
- : COLOR_3DSHADOW
- ,
- pWndPageContainer,
- lParam
- );
- dc.Draw3dRect( &rcMiddle, clrFrame, clrFrame );
- }
- else
- {
- COLORREF clrLight = GetColor( COLOR_3DHIGHLIGHT, pWndPageContainer, lParam );
- COLORREF clrShadow = GetColor( COLOR_3DSHADOW, pWndPageContainer, lParam );
- dc.Draw3dRect( &rcMiddle, clrShadow, clrLight );
- rcMiddle.DeflateRect( 1, 1 );
- dc.Draw3dRect( &rcMiddle, clrLight, clrShadow );
- }
- }
- } // else from if( m_bPageContainerUseGroupBoxStyle )
- }
- void CExtPaintManager::PageContainer_DrawItem(
- CDC & dc,
- LPVOID pPageInfo, // CExtPageContainerWnd::PAGE_ITEM_INFO
- CRect rcPage,
- CRect rcCaption,
- CRect rcWnd,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pPageInfo != NULL );
- ASSERT_VALID( pWndPageContainer );
- dc;
- pPageInfo; // CExtPageContainerWnd::PAGE_ITEM_INFO
- rcPage;
- rcCaption;
- rcWnd;
- pWndPageContainer;
- lParam;
- }
- void CExtPaintManager::PageContainer_EraseCaption(
- CDC & dc,
- LPVOID pPageInfo, // CExtPageContainerWnd::PAGE_ITEM_INFO
- CRect rcCaption,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pPageInfo != NULL );
- ASSERT_VALID( pWndPageContainer );
- ASSERT( pPageInfo != NULL );
- ASSERT( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsVisible() );
- pPageInfo;
- if( (rcCaption.right - rcCaption.left) <= 4
- || (rcCaption.bottom - rcCaption.top) <= 4
- )
- return;
- if( ! dc.RectVisible( &rcCaption ) )
- return;
- if( m_bPageContainerUseButtonStyle )
- {
- HWND hWndPage = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->GetSafePageHwnd();
- ASSERT( hWndPage != NULL );
- ASSERT( ::IsWindow( hWndPage ) );
- bool bEnabled = ( ::IsWindowEnabled( hWndPage ) ) ? true : false;
- DWORD dwPageContainerStyle = pWndPageContainer->GetPageContainerStyle();
- PAINTPUSHBUTTONDATA _ppbd(
- pWndPageContainer,
- true, // bHorz
- rcCaption,
- NULL, // sText
- NULL, // hIcon
- ( dwPageContainerStyle & __EPCWS_CAPTION_FLAT ) ? true : false, //bool bFlat
- ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionHover(),
- ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionPressed(),
- false, // bIndeterminate
- bEnabled,
- true, // bDrawBorder
- false, // bDrawFocusRect
- false,
- __ALIGN_HORIZ_CENTER,
- NULL,
- false,
- 0,
- false
- );
- CExtMemoryDC dcX( &dc, &rcCaption );
- PaintPushButton( dcX, _ppbd );
- } // if( m_bPageContainerUseButtonStyle )
- else
- {
- COLORREF clrFace = GetColor( CExtPaintManager::CLR_3DFACE_OUT, pWndPageContainer, lParam );
- dc.FillSolidRect( &rcCaption, clrFace );
- } // else from if( m_bPageContainerUseButtonStyle )
- }
- void CExtPaintManager::PageContainer_DrawCaption(
- CDC & dc,
- LPVOID pPageInfo, // CExtPageContainerWnd::PAGE_ITEM_INFO
- CRect rcCaption,
- CExtPageContainerWnd * pWndPageContainer,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pPageInfo != NULL );
- ASSERT_VALID( pWndPageContainer );
- ASSERT( pPageInfo != NULL );
- ASSERT( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsVisible() );
- if( (rcCaption.right - rcCaption.left) <= 4
- || (rcCaption.bottom - rcCaption.top) <= 4
- )
- return;
- if( ! dc.RectVisible( &rcCaption ) )
- return;
- CRgn rgnCaption;
- if( rgnCaption.CreateRectRgnIndirect( &rcCaption ) )
- {
- ASSERT( rgnCaption.GetSafeHandle() != NULL );
- dc.SelectClipRgn( &rgnCaption );
- }
- HWND hWndPage = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->GetSafePageHwnd();
- ASSERT( hWndPage != NULL );
- ASSERT( ::IsWindow( hWndPage ) );
- bool bEnabled = ( ::IsWindowEnabled( hWndPage ) ) ? true : false;
- COLORREF clrLight = GetColor( COLOR_3DHIGHLIGHT, pWndPageContainer, lParam );
- COLORREF clrFace = GetColor( CExtPaintManager::CLR_3DFACE_OUT, pWndPageContainer, lParam );
- COLORREF clrShadow = GetColor( COLOR_3DSHADOW, pWndPageContainer, lParam );
- COLORREF clrDkShadow = GetColor( COLOR_3DDKSHADOW, pWndPageContainer, lParam );
- CRect rcCaptBorder( rcCaption );
- bool bHorzLayout = pWndPageContainer->IsHorizontalLayout();
- if( bHorzLayout )
- {
- rcCaption.DeflateRect(
- __EXT_PAGECONTAINERWND_CAPT_HBORDER_DX,
- __EXT_PAGECONTAINERWND_CAPT_HBORDER_DY
- );
- rcCaption.bottom -= __EXT_PAGECONTAINERWND_CAPT_BEFORE_DY;
- rcCaption.top += __EXT_PAGECONTAINERWND_CAPT_AFTER_DY;
- } // if( bHorzLayout )
- else
- {
- rcCaption.DeflateRect(
- __EXT_PAGECONTAINERWND_CAPT_VBORDER_DX,
- __EXT_PAGECONTAINERWND_CAPT_VBORDER_DY
- );
- rcCaption.left += __EXT_PAGECONTAINERWND_CAPT_BEFORE_DX;
- rcCaption.right -= __EXT_PAGECONTAINERWND_CAPT_AFTER_DX;
- } // else from if( bHorzLayout )
- DWORD dwPageContainerStyle = pWndPageContainer->GetPageContainerStyle();
- if( ( dwPageContainerStyle & __EPCWS_CAPTION_EXPBTN ) != 0 )
- {
- CExtPaintManager::glyph_t & _glyph =
- pWndPageContainer->OnPageContainerQueryItemGlyph(
- ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo),
- ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsExpanded()
- );
- CSize sizeGlyph = _glyph.Size();
- if( sizeGlyph.cx > 0 && sizeGlyph.cy > 0 )
- {
- CRect rcGlyph( rcCaption );
- if( bHorzLayout )
- {
- rcGlyph.left += (rcCaption.Width() - sizeGlyph.cx)/2;
- rcGlyph.top = rcGlyph.bottom - sizeGlyph.cy;
- rcGlyph.right = rcGlyph.left + sizeGlyph.cx;
- rcCaption.bottom = rcGlyph.top - __EXT_PAGECONTAINERWND_CAPT_ICON2TEXT_DY;
- } // if( bHorzLayout )
- else
- {
- rcGlyph.right = rcGlyph.left + sizeGlyph.cx;
- rcGlyph.top += (rcCaption.Height() - sizeGlyph.cy)/2;
- rcGlyph.bottom = rcGlyph.top + sizeGlyph.cy;
- rcCaption.left = rcGlyph.right + __EXT_PAGECONTAINERWND_CAPT_ICON2TEXT_DX;
- } // else from if( bHorzLayout )
- COLORREF ColorValues[] =
- {
- RGB(0,0,0),
- GetColor( bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, pWndPageContainer, lParam )
- };
- PaintGlyphCentered( dc, rcGlyph, _glyph, ColorValues );
- } // if( sizeGlyph.cx > 0 && sizeGlyph.cy > 0 )
- // if( bHorzLayout )
- // {
- // if( sizeGlyph.cy > 0 )
- // rcCaption.top +=
- // sizeGlyph.cy
- // + __EXT_PAGECONTAINERWND_CAPT_AFTER_GLYPH_DY
- // ;
- // } // if( bHorzLayout )
- // else
- // {
- // if( sizeGlyph.cx > 0 )
- // rcCaption.left +=
- // sizeGlyph.cx
- // + __EXT_PAGECONTAINERWND_CAPT_AFTER_GLYPH_DX
- // ;
- // } // else from if( bHorzLayout )
- } // if( ( dwPageContainerStyle & __EPCWS_CAPTION_EXPBTN ) != 0 )
- CExtCmdIcon & _icon = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IconGet();
- CSize sizeIcon = _icon.GetSize();
- if( sizeIcon.cx > 0 && sizeIcon.cy > 0 )
- {
- CRect rcIcon( rcCaption );
- if( bHorzLayout )
- {
- rcIcon.left += (rcCaption.Width() - sizeIcon.cx)/2;
- rcIcon.top = rcIcon.bottom - sizeIcon.cy;
- rcIcon.right = rcIcon.left + sizeIcon.cx;
- rcCaption.bottom = rcIcon.top - __EXT_PAGECONTAINERWND_CAPT_ICON2TEXT_DY;
- } // if( bHorzLayout )
- else
- {
- rcIcon.right = rcIcon.left + sizeIcon.cx;
- rcIcon.top += (rcCaption.Height() - sizeIcon.cy)/2;
- rcIcon.bottom = rcIcon.top + sizeIcon.cy;
- rcCaption.left = rcIcon.right + __EXT_PAGECONTAINERWND_CAPT_ICON2TEXT_DX;
- } // else from if( bHorzLayout )
- if( rcIcon.right > rcIcon.left
- && rcIcon.bottom > rcIcon.top
- )
- {
- // ICON 2.53
- // dc.DrawState(
- // rcIcon.TopLeft(),
- // rcIcon.Size(),
- // hItemIcon,
- // bEnabled ? DSS_NORMAL : DSS_DISABLED,
- // (CBrush*)NULL
- // );
- _icon.Paint(
- this,
- dc.GetSafeHdc(),
- rcIcon,
- bEnabled
- ? CExtCmdIcon::__PAINT_NORMAL
- : CExtCmdIcon::__PAINT_DISABLED
- );
- }
- } // if( sizeIcon.cx > 0 && sizeIcon.cy > 0 )
- bool bCenteredText =
- (dwPageContainerStyle & __EPCWS_CAPTION_CENTER_TEXT)
- ? true : false;
- __EXT_MFC_SAFE_LPCTSTR sItemText = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->TextGet();
- LONG nItemTextLen = 0;
- if( sItemText != NULL
- && ( nItemTextLen = LONG(_tcslen(sItemText)) ) > 0
- && rcCaption.right > rcCaption.left
- && rcCaption.bottom > rcCaption.top
- )
- { // if can draw text
- CFont * pItemFont = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->GetCaptionFont( bHorzLayout );
- ASSERT( pItemFont != NULL );
- ASSERT( pItemFont->GetSafeHandle() != NULL );
- CFont * pOldFont = dc.SelectObject( pItemFont );
- COLORREF clrTextOld =
- dc.SetTextColor(
- GetColor(
- bEnabled ? COLOR_BTNTEXT : ( m_bPageContainerNoEmbossDisabledText ? CLR_TEXT_DISABLED : COLOR_3DHILIGHT ),
- pWndPageContainer,
- lParam
- )
- );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- if( bHorzLayout )
- {
- rcCaption.InflateRect( 3, 0 );
- rcCaption.OffsetRect( -2, 0 );
- CSize sizeTextMeasured = ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->GetLastMeasuredTextSize();
- if( bCenteredText )
- {
- UINT nOldTA = dc.SetTextAlign( TA_CENTER | TA_BASELINE );
- rcCaption.OffsetRect(
- ( (dwPageContainerStyle & __EPCWS_CAPTION_INV_VFONT) == 0 )
- ? sizeTextMeasured.cy/2
- : - sizeTextMeasured.cy/2
- ,
- 0
- );
- CPoint ptCenter = rcCaption.CenterPoint();
- dc.ExtTextOut(
- ptCenter.x,
- ptCenter.y,
- ETO_CLIPPED,
- &rcCaption,
- sItemText,
- nItemTextLen,
- NULL
- );
- if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- {
- dc.SetTextColor( GetColor( CLR_TEXT_DISABLED, pWndPageContainer, lParam ) );
- ptCenter.x--;
- ptCenter.y--;
- rcCaption.OffsetRect( -1, -1 );
- dc.ExtTextOut(
- ptCenter.x,
- ptCenter.y,
- ETO_CLIPPED,
- &rcCaption,
- sItemText,
- nItemTextLen,
- NULL
- );
- } // if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- dc.SetTextAlign( nOldTA );
- } // if( bCenteredText )
- else
- {
- UINT nOldTA = dc.SetTextAlign( TA_TOP | TA_BASELINE );
- rcCaption.OffsetRect(
- ( (dwPageContainerStyle & __EPCWS_CAPTION_INV_VFONT) == 0 )
- ? sizeTextMeasured.cy/2
- : - sizeTextMeasured.cy/2
- ,
- 0
- );
- CPoint ptCenter = rcCaption.CenterPoint();
- if( (dwPageContainerStyle & __EPCWS_CAPTION_INV_VFONT) == 0 )
- ptCenter.y =
- rcCaption.bottom - 4
- - (rcCaption.Height() - sizeTextMeasured.cx)
- ;
- else
- ptCenter.y =
- rcCaption.top + 4
- ;
- dc.ExtTextOut(
- ptCenter.x,
- ptCenter.y,
- ETO_CLIPPED,
- &rcCaption,
- sItemText,
- nItemTextLen,
- NULL
- );
- if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- {
- dc.SetTextColor( GetColor( CLR_TEXT_DISABLED, pWndPageContainer, lParam ) );
- ptCenter.x--;
- ptCenter.y--;
- rcCaption.OffsetRect( -1, -1 );
- dc.ExtTextOut(
- ptCenter.x,
- ptCenter.y,
- ETO_CLIPPED,
- &rcCaption,
- sItemText,
- nItemTextLen,
- NULL
- );
- } // if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- dc.SetTextAlign( nOldTA );
- } // else from if( bCenteredText )
- } // if( bHorzLayout )
- else
- {
- UINT nFormat = DT_SINGLELINE|DT_END_ELLIPSIS;
- if( bCenteredText )
- nFormat |= DT_CENTER|DT_VCENTER;
- else
- nFormat |= DT_VCENTER|DT_LEFT;
- dc.DrawText( sItemText, nItemTextLen, &rcCaption, nFormat );
- if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- {
- dc.SetTextColor( GetColor( CLR_TEXT_DISABLED, pWndPageContainer, lParam ) );
- rcCaption.OffsetRect( -1, -1 );
- dc.DrawText( sItemText, nItemTextLen, &rcCaption, nFormat );
- } // if( ( ! bEnabled ) && ( ! m_bPageContainerNoEmbossDisabledText ) )
- } // else from if( bHorzLayout )
- dc.SetBkMode( nOldBkMode );
- dc.SetTextColor( clrTextOld );
- dc.SelectObject( pOldFont );
- } // if can draw text
- if( ! m_bPageContainerUseButtonStyle )
- {
- if( ( dwPageContainerStyle & __EPCWS_CAPTION_FLAT ) != 0 )
- { // if flat captions
- if( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionPressed() )
- { // if caption is pressed
- dc.Draw3dRect(
- &rcCaptBorder,
- clrShadow,
- clrLight
- );
- } // if caption is pressed
- else if( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionHover() )
- { // if caption is under mouse pointer
- dc.Draw3dRect(
- &rcCaptBorder,
- clrLight,
- clrShadow
- );
- } // if caption is under mouse pointer
- else
- { // if caption is neither pressed nor under mouse pointer
- dc.Draw3dRect(
- &rcCaptBorder,
- bEnabled ? clrDkShadow : clrShadow,
- bEnabled ? clrDkShadow : clrShadow
- );
- } // if caption is neither pressed nor under mouse pointer
- } // if flat captions
- else
- { // if semi-flat captions
- if( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionPressed() )
- { // if caption is pressed
- dc.Draw3dRect(
- &rcCaptBorder,
- clrDkShadow,
- clrLight
- );
- rcCaptBorder.DeflateRect( 1, 1 );
- dc.Draw3dRect(
- &rcCaptBorder,
- clrShadow,
- clrFace
- );
- } // if caption is pressed
- else if( ((CExtPageContainerWnd::PAGE_ITEM_INFO*)pPageInfo)->IsCaptionHover() )
- { // if caption is under mouse pointer
- dc.Draw3dRect(
- &rcCaptBorder,
- clrLight,
- clrDkShadow
- );
- rcCaptBorder.DeflateRect( 1, 1 );
- dc.Draw3dRect(
- &rcCaptBorder,
- clrFace,
- clrShadow
- );
- } // if caption is under mouse pointer
- else
- { // if caption is neither pressed nor under mouse pointer
- dc.Draw3dRect(
- &rcCaptBorder,
- clrLight,
- clrShadow
- );
- } // if caption is neither pressed nor under mouse pointer
- } // if semi-flat captions
- } // if( ! m_bPageContainerUseButtonStyle )
- dc.SelectClipRgn( NULL );
- }
- #endif // (!defined __EXT_MFC_NO_PAGECONTAINER_CTRL)
- //////////////////////////////////////////////////////////////////////////
- // CExtPaintManagerStudio2008
- //////////////////////////////////////////////////////////////////////////
- CExtPaintManagerStudio2008::CExtPaintManagerStudio2008()
- {
- VERIFY(
- m_bmpMenuItemLunaBlue.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_LUNA_BLUE )
- )
- );
- m_bmpMenuItemLunaBlue.Make32();
- m_bmpMenuItemLunaBlue.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- VERIFY(
- m_bmpMenuItemLunaOliveGreen.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_LUNA_OLIVE_GREEN )
- )
- );
- m_bmpMenuItemLunaOliveGreen.Make32();
- m_bmpMenuItemLunaOliveGreen.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- VERIFY(
- m_bmpMenuItemLunaSilver.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_LUNA_SILVER )
- )
- );
- m_bmpMenuItemLunaSilver.Make32();
- m_bmpMenuItemLunaSilver.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- VERIFY(
- m_bmpMenuItemLunaRoyale.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_LUNA_ROYALE )
- )
- );
- m_bmpMenuItemLunaRoyale.Make32();
- m_bmpMenuItemLunaRoyale.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- VERIFY(
- m_bmpMenuItemVista.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_VISTA )
- )
- );
- m_bmpMenuItemVista.Make32();
- m_bmpMenuItemVista.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- }
- CExtPaintManagerStudio2008::~CExtPaintManagerStudio2008()
- {
- }
- int CExtPaintManagerStudio2008::GetMenuIconAreaWidth() const
- {
- ASSERT_VALID( this );
- return 28;
- }
- bool CExtPaintManagerStudio2008::OnQueryUseThemeColors() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::OnQueryUseThemeColors();
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- bool bUseThemedColors = (
- g_PaintManager.m_UxTheme.IsAppThemed()
- && g_PaintManager.m_bUxValidColorsExtracted
- && ( eCurrentTheme == ThemeLunaRoyale // +2.87
- || eCurrentTheme == ThemeVistaOrLaterUX // +2.87
- || eCurrentTheme == ThemeVistaOrLaterDWM // +2.87
- || eCurrentTheme == ThemeLunaBlue
- || eCurrentTheme == ThemeLunaOlive
- || eCurrentTheme == ThemeLunaSilver
- )
- //&& eCurrentTheme != ThemeLunaRoyale // -2.87
- );
- return bUseThemedColors;
- }
- void CExtPaintManagerStudio2008::InitTranslatedColors()
- {
- ASSERT_VALID( this );
- CExtPaintManagerStudio2005::InitTranslatedColors();
- VERIFY( m_bmpMenuItemOther.LoadBMP_Resource( MAKEINTRESOURCE( IDB_EXT_VS2008_MENU_ITEM_OTHER ) ) );
- if( stat_GetBPP() > 8 )
- {
- COLORREF clrMlaNormLeft = COLORREF(-1L);
- COLORREF clrMlaNormMiddle = COLORREF(-1L);
- COLORREF clrMlaNormRight = COLORREF(-1L);
- COLORREF clrMlaMarginLeft = COLORREF(-1L);
- COLORREF clrMlaMarginRight = COLORREF(-1L);
- COLORREF clrMlaRarelyLeft = COLORREF(-1L);
- COLORREF clrMlaRarelyRight = COLORREF(-1L);
- COLORREF clrMlaRarelyMiddle = COLORREF(-1L);
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- switch( eCurrentTheme )
- {
- // case ThemeVistaOrLaterUX: // +2.87 -2.88
- // case ThemeVistaOrLaterDWM: // +2.87 -2.88
- case ThemeLunaBlue:
- clrMlaNormLeft = RGB( 241, 241, 241 );
- clrMlaNormMiddle = RGB( 241, 241, 241 );
- clrMlaNormRight = RGB( 241, 241, 241 );
- clrMlaMarginLeft = RGB( 197, 194, 184 );
- clrMlaMarginRight = RGB( 255, 255, 255 );
- break;
- case ThemeLunaOlive:
- clrMlaNormLeft = RGB( 247, 246, 239 );
- clrMlaNormMiddle = RGB( 242, 240, 229 );
- clrMlaNormRight = RGB( 233, 230, 214 );
- clrMlaMarginLeft = RGB( 197, 194, 184 );
- clrMlaMarginRight = RGB( 255, 255, 255 );
- break;
- case ThemeVistaOrLaterUX: // +2.88
- case ThemeVistaOrLaterDWM: // +2.88
- m_mapColorTranslate[_2003CLR_EXPBTN_LIGHT] = InstallColor( RGB(195, 202, 218) );
- m_mapColorTranslate[_2003CLR_EXPBTN_DARK] = InstallColor( RGB(233, 236, 250) );
- m_mapColorTranslate[_2003CLR_GRADIENT_LIGHT] = InstallColor( RGB(244, 247, 252) );
- m_mapColorTranslate[_2003CLR_GRADIENT_DARK] = InstallColor( RGB(233, 236, 250) );
- clrMlaNormLeft = RGB(243, 245, 248);
- clrMlaNormRight = RGB(213, 217, 231);
- clrMlaNormMiddle = RGB(233, 236, 250);
- clrMlaRarelyLeft = CExtBitmap::stat_HLS_Adjust( clrMlaNormLeft, 0.00, -0.10, 0.00 );
- clrMlaRarelyRight = CExtBitmap::stat_HLS_Adjust( clrMlaNormRight, 0.00, -0.10, 0.00 );
- clrMlaRarelyMiddle = CExtBitmap::stat_HLS_Adjust( clrMlaNormMiddle, 0.00, -0.10, 0.00 );
- clrMlaMarginLeft = RGB( 170, 171, 190 );
- clrMlaMarginRight = RGB( 252, 252, 252 );
- m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_LIGHT] = InstallColor( RGB(250, 250, 253) );
- m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_MIDDLE] = InstallColor( RGB(223, 227, 241) );
- m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_DARK] = InstallColor( RGB(196, 203, 219) );
- m_mapColorTranslate[_2003CLR_TOOLBAR_BOTTOM_LINE] = InstallColor( RGB(181, 190, 206) );
- break;
- case ThemeLunaSilver:
- clrMlaNormLeft = RGB( 232, 233, 242 );
- clrMlaNormMiddle = RGB( 216, 216, 227 );
- clrMlaNormRight = RGB( 193, 193, 211 );
- clrMlaMarginLeft = RGB( 110, 109, 143 );
- clrMlaMarginRight = RGB( 255, 255, 255 );
- break;
- case ThemeLunaRoyale:
- clrMlaNormLeft = RGB( 247, 246, 248 );
- clrMlaNormMiddle = RGB( 241, 240, 242 );
- clrMlaNormRight = RGB( 241, 240, 242 );
- clrMlaMarginLeft = RGB( 193, 193, 196 );
- clrMlaMarginRight = RGB( 255, 255, 255 );
- break;
- default:
- clrMlaMarginLeft = GetColor( COLOR_3DSHADOW, this );
- clrMlaMarginRight = GetColor( COLOR_WINDOW, this );
- break;
- } // switch( eCurrentTheme )
- if( clrMlaNormLeft != COLORREF(-1L) )
- {
- m_mapColorTranslate[_2003CLR_MLA_NORM_LEFT] = InstallColor( clrMlaNormLeft );
- m_mapColorTranslate[_2003CLR_MLA_RARELY_LEFT] = InstallColor( CExtBitmap::stat_HLS_Adjust( clrMlaNormLeft, 0.00, -0.10, 0.0 ) );
- }
- if( clrMlaNormMiddle != COLORREF(-1L) )
- {
- m_mapColorTranslate[_2003CLR_MLA_NORM_MIDDLE] = InstallColor( clrMlaNormMiddle );
- m_mapColorTranslate[_2003CLR_MLA_RARELY_MIDDLE] = InstallColor( CExtBitmap::stat_HLS_Adjust( clrMlaNormMiddle, 0.00, -0.10, 0.0 ) );
- }
- if( clrMlaNormRight != COLORREF(-1L) )
- {
- m_mapColorTranslate[_2003CLR_MLA_NORM_RIGHT] = InstallColor( clrMlaNormRight );
- m_mapColorTranslate[_2003CLR_MLA_RARELY_RIGHT] = InstallColor( CExtBitmap::stat_HLS_Adjust( clrMlaNormRight, 0.00, -0.10, 0.0 ) );
- }
- m_mapColorTranslate[_STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_LEFT] = InstallColor( clrMlaMarginLeft );
- m_mapColorTranslate[_STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_RIGHT] = InstallColor( clrMlaMarginRight );
- if( clrMlaRarelyLeft != COLORREF(-1L) )
- m_mapColorTranslate[_2003CLR_MLA_RARELY_LEFT] = InstallColor( clrMlaRarelyLeft );
- if( clrMlaRarelyMiddle != COLORREF(-1L) )
- m_mapColorTranslate[_2003CLR_MLA_RARELY_MIDDLE] = InstallColor( clrMlaRarelyMiddle );
- if( clrMlaRarelyRight != COLORREF(-1L) )
- m_mapColorTranslate[_2003CLR_MLA_RARELY_RIGHT] = InstallColor( clrMlaRarelyRight );
- // colorize menu item selection bitmap
- if( (!g_PaintManager.m_bIsWinVistaOrLater)
- && eCurrentTheme == ThemeUnknown
- )
- {
- m_mapColorTranslate[CLR_MENUTEXT_IN] = COLOR_HIGHLIGHTTEXT;
- COLORREF clrHighlight = GetColor( COLOR_HIGHLIGHT, this );
- BYTE nRed = BYTE( GetRValue( clrHighlight ) );
- BYTE nGreen = BYTE( GetGValue( clrHighlight ) );
- BYTE nBlue = BYTE( GetBValue( clrHighlight ) );
- CSize _sizeBmp = m_bmpMenuItemOther.GetSize();
- INT nX, nY;
- for( nY = 0; nY < _sizeBmp.cy; nY++ )
- {
- for( nX = 0; nX < _sizeBmp.cx; nX++ )
- {
- RGBQUAD _pixel;
- m_bmpMenuItemOther.GetPixel( nX, nY, _pixel );
- _pixel.rgbRed = nRed;
- _pixel.rgbGreen = nGreen;
- _pixel.rgbBlue = nBlue;
- m_bmpMenuItemOther.SetPixel( nX, nY, _pixel );
- }
- }
- }
- else
- m_mapColorTranslate[CLR_MENUTEXT_IN] = COLOR_WINDOWTEXT;
- } // if( stat_GetBPP() > 8 )
- else
- {
- m_mapColorTranslate[_STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_LEFT] = COLOR_3DSHADOW;
- m_mapColorTranslate[_STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_RIGHT] = COLOR_WINDOW;
- } // else from if( stat_GetBPP() > 8 )
- }
- int CExtPaintManagerStudio2008::GetThemeDockingType() const
- {
- ASSERT_VALID( this );
- if( (! g_PaintManager.m_bIsWin2000orLater )
- || stat_GetBPP() < 24
- || IsHighContrast()
- )
- return CExtPaintManagerStudio2005::GetThemeDockingType();
- #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
- return int(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2008_AUTO);
- #else
- return CExtPaintManagerStudio2005::GetThemeDockingType();
- #endif
- }
- bool CExtPaintManagerStudio2008::IsMenuMustCombineExcludeArea(
- const CObject * pMenuTrackerObject // = NULL
- ) const
- {
- ASSERT_VALID( this );
- pMenuTrackerObject;
- return false;
- }
- void CExtPaintManagerStudio2008::PaintMenuItemLeftAreaMarginXP(
- CDC & dc,
- CExtPaintManager::PAINTMENUITEMDATA & _pmid,
- const RECT & rcFillLeftPart,
- const RECT & rcFillRightPart
- )
- {
- ASSERT_VALID( this );
- if( _pmid.m_bForceNoLeftGradient )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintMenuItemLeftAreaMarginXP(
- dc,
- _pmid,
- rcFillLeftPart,
- rcFillRightPart
- );
- return;
- }
- dc.FillSolidRect(
- rcFillLeftPart.right - 1,
- rcFillLeftPart.top,
- 1,
- rcFillLeftPart.bottom - rcFillLeftPart.top,
- GetColor(
- _STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_LEFT,
- _pmid.m_pHelperSrc,
- _pmid.m_lParam
- )
- );
- dc.FillSolidRect(
- rcFillLeftPart.right,
- rcFillLeftPart.top,
- 1,
- rcFillLeftPart.bottom - rcFillLeftPart.top,
- GetColor(
- _STUDIO_2008CLR_MENU_ITEM_LEFT_AREA_MARGIN_RIGHT,
- _pmid.m_pHelperSrc,
- _pmid.m_lParam
- )
- );
- }
- bool CExtPaintManagerStudio2008::PaintMenuItemSelectionAreaXP(
- CDC & dc,
- CExtPaintManager::PAINTMENUITEMDATA & _pmid,
- const RECT & rcSelectionArea
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::PaintMenuItemBackgroundXP( dc, _pmid, rcSelectionArea );
- if( ! _pmid.m_bSelected )
- return false;
- CExtPopupMenuWnd * pPopup = NULL;
- if( _pmid.m_pHelperSrc != NULL )
- {
- ASSERT_VALID( _pmid.m_pHelperSrc );
- pPopup = DYNAMIC_DOWNCAST( CExtPopupMenuWnd, _pmid.m_pHelperSrc );
- }
- CExtBitmapCache * pbmpMenuItem = NULL;
- if( ! g_PaintManager.m_bIsWinVistaOrLater )
- {
- e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
- switch( eCurrentTheme )
- {
- // case ThemeVistaOrLaterUX: // +2.87 -2.88
- // case ThemeVistaOrLaterDWM: // +2.87 -2.88
- case ThemeLunaBlue:
- pbmpMenuItem = &m_bmpMenuItemLunaBlue;
- break;
- case ThemeLunaOlive:
- pbmpMenuItem = &m_bmpMenuItemLunaOliveGreen;
- break;
- case ThemeVistaOrLaterUX: // +2.88
- case ThemeVistaOrLaterDWM: // +2.88
- case ThemeLunaSilver:
- pbmpMenuItem = &m_bmpMenuItemLunaSilver;
- break;
- case ThemeLunaRoyale:
- pbmpMenuItem = &m_bmpMenuItemLunaRoyale;
- break;
- default:
- pbmpMenuItem = &m_bmpMenuItemOther;
- break;
- } // switch( eCurrentTheme )
- } // if( ! g_PaintManager.m_bIsWinVistaOrLater )
- else
- pbmpMenuItem = &m_bmpMenuItemVista;
- ASSERT( pbmpMenuItem != NULL );
- if( pbmpMenuItem != NULL )
- pbmpMenuItem->AlphaBlendSkinParts(
- dc.m_hDC,
- rcSelectionArea,
- CRect(3,3,3,3),
- CExtBitmap::__EDM_STRETCH,
- true,
- false
- );
- return true;
- }
- void CExtPaintManagerStudio2008::PaintPushButton(
- CDC & dc,
- CExtPaintManager::PAINTPUSHBUTTONDATA & _ppbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( _ppbd.m_rcClient.IsRectEmpty() )
- return;
- bool bMenuBar = false;
- if( _ppbd.m_pHelperSrc != NULL )
- {
- if( _ppbd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtBarButton ) )
- && (! (_ppbd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtBarSliderButton ) )
- && _ppbd.m_lParam == CExtBarSliderButton::__ESA_THUMB) )
- )
- {
- CExtBarButton * pBarButton = (CExtBarButton*)_ppbd.m_pHelperSrc;
- CExtToolControlBar * pToolBar = DYNAMIC_DOWNCAST( CExtToolControlBar, pBarButton->GetBar() );
- ASSERT( pToolBar != NULL );
-
- if( pToolBar->IsKindOf(RUNTIME_CLASS(CExtMenuControlBar)) )
- bMenuBar = true;
- }
- }
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( _ppbd.m_pHelperSrc != NULL )
- {
- CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, _ppbd.m_pHelperSrc );
- if( pTBB != NULL )
- {
- if( pTBB->IsRibbonPaintingMode() )
- {
- Ribbon_PaintPushButton( dc, _ppbd );
- return;
- }
- CExtToolControlBar * pBar = pTBB->GetBar();
- if( pBar != NULL
- && pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) )
- && (! pTBB->IsNoRibbonLayout() )
- && (! pTBB->IsKindOf( RUNTIME_CLASS( CExtBarMdiRightButton ) ) )
- )
- {
- Ribbon_PaintPushButton( dc, _ppbd );
- return;
- }
- } // if( pTBB != NULL )
- } // if( _ppbd.m_pHelperSrc != NULL )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- bool bRTL = _ppbd.IsRTL();
- if( !_ppbd.m_bEnabled )
- {
- _ppbd.m_bHover = false;
- _ppbd.m_bDrawFocusRect = false;
- _ppbd.m_bIndeterminate = false;
- } // if( ! _ppbd.m_bEnabled )
- COLORREF clrOldText = dc.GetTextColor();
- COLORREF clrOldBk = dc.GetBkColor();
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- int nIdxMainGradientLeft = -1;
- int nIdxMainGradientRight = -1;
- COLORREF bgColor, bgColorDD;
- if( _ppbd.m_clrForceBk != ((COLORREF)-1L) )
- bgColor = bgColorDD = _ppbd.m_clrForceBk;
- else if(_ppbd.m_bHover
- || _ppbd.m_bPushed
- || _ppbd.m_bIndeterminate
- || _ppbd.m_bPushedDropDown
- || _ppbd.m_bDefaultPushButton
- )
- {
- bgColor = bgColorDD = GetColor( CLR_3DFACE_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- if( _ppbd.m_bPushed || _ppbd.m_bPushedDropDown || _ppbd.m_bDefaultPushButton )
- {
- if( _ppbd.m_bDefaultPushButton )
- bgColorDD = bgColor = dc.GetNearestColor( stat_HLS_Adjust( GetColor( XPCLR_HILIGHT ), 0.0, 0.2, 0.0 ) );
- (( _ppbd.m_bPushedDropDown ) ? bgColorDD : bgColor) =
- GetColor( _ppbd.m_bHover ? XPCLR_HILIGHT : CLR_3DFACE_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- }
- if( (!_ppbd.m_bHover)
- && _ppbd.m_bPushed
- && (!_ppbd.m_bPushedDropDown)
- && _ppbd.m_bSeparatedDropDown
- )
- bgColorDD = GetColor( CLR_3DFACE_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- if( _ppbd.m_bIndeterminate && ( !_ppbd.m_bHover ) && ( !_ppbd.m_bPushed ) )
- bgColor = dc.GetNearestColor( stat_HLS_Adjust( bgColor, 0.0, 0.5, 0.5 ) );
-
- if( _ppbd.m_bHover )
- {
- if( _ppbd.m_bPushed )
- {
- nIdxMainGradientLeft = m_nIdxClrBtnHovPresLeft;
- nIdxMainGradientRight = m_nIdxClrBtnHovPresRight;
- } // if( _ppbd.m_bPushed )
- else
- {
- nIdxMainGradientLeft = m_nIdxClrBtnHoverLeft;
- nIdxMainGradientRight = m_nIdxClrBtnHoverRight;
- } // else from if( _ppbd.m_bPushed )
- } // if( _ppbd.m_bHover )
- else if( _ppbd.m_bPushed )
- {
- nIdxMainGradientLeft = m_nIdxClrBtnPressedLeft;
- nIdxMainGradientRight = m_nIdxClrBtnPressedRight;
- } // else if( _ppbd.m_bPushed )
- } // if( _ppbd.m_bHover || _ppbd.m_bPushed || _ppbd.m_bIndeterminate || _ppbd.m_bPushedDropDown )
- else
- {
- bgColor = bgColorDD =
- GetColor(
- _ppbd.m_bFlat ? CLR_3DFACE_OUT : COLOR_3DFACE,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- );
- }
- COLORREF clrDkBorder =
- GetColor(
- (_ppbd.m_bHover || _ppbd.m_bPushed || _ppbd.m_bPushedDropDown )
- ? XPCLR_HILIGHT_BORDER
- : ( _ppbd.m_bFlat ? XPCLR_HILIGHT_BORDER : COLOR_3DSHADOW )
- ,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- );
- bool bPushedDropDown = false;
- if( (_ppbd.m_bPushed && !_ppbd.m_bSeparatedDropDown)
- || _ppbd.m_bPushedDropDown
- )
- bPushedDropDown = true;
- CRect rectClient( _ppbd.m_rcClient );
- CRect rectCaption( _ppbd.m_rcClient );
- CRect rectDropDown( 0, 0, 0, 0 );
- if( _ppbd.m_bDropDown )
- {
- rectDropDown = rectClient;
- if( _ppbd.m_bHorz )
- {
- if( bRTL )
- {
- rectCaption.left +=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_bottom.Size().cx
- ;
- rectDropDown.right = rectCaption.left + 1;
- } // if( bRTL )
- else
- {
- rectCaption.right -=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_bottom.Size().cx
- ;
- rectDropDown.left = rectCaption.right - 1;
- } // else from if( bRTL )
- } // if( _ppbd.m_bHorz )
- else
- {
- rectCaption.bottom -=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_right.Size().cy
- ;
- rectDropDown.top = rectCaption.bottom - 1;
- } // if( _ppbd.m_bHorz )
- if( (! _ppbd.m_bTransparentBackground )
- && ( _ppbd.m_bHover || _ppbd.m_bPushedDropDown )
- || _ppbd.m_clrForceBk != ((COLORREF)-1L)
- )
- dc.FillSolidRect( &rectDropDown, bgColorDD );
- if( _ppbd.m_bSeparatedDropDown )
- {
- rectClient = rectCaption;
- if( bPushedDropDown )
- {
- if( (!_ppbd.m_bFlat) || _ppbd.m_bDrawBorder )
- dc.Draw3dRect( rectDropDown, clrDkBorder, clrDkBorder );
- } // if( bPushedDropDown )
- else
- {
- if( (!_ppbd.m_bFlat) || (_ppbd.m_bHover && _ppbd.m_bDrawBorder) )
- dc.Draw3dRect( rectDropDown, clrDkBorder, clrDkBorder );
- } // else from if( bPushedDropDown )
- } // if( _ppbd.m_bSeparatedDropDown )
- } // if( _ppbd.m_bDropDown )
- if( bMenuBar )
- {
- if( ( ! _ppbd.m_bTransparentBackground )
- && ( _ppbd.m_bHover || _ppbd.m_bPushed )
- )
- {
- CRect rcButton( rectClient );
- COLORREF clrBack = RGB(255,255,255);
- CBrush br( clrBack );
- CBrush * pOldBrush = dc.SelectObject( &br );
-
- CPen pen( PS_SOLID, 1, clrBack );
- CPen * pOldPen = dc.SelectObject( &pen );
-
- dc.RoundRect( rcButton, CPoint(2,2) );
-
- rcButton.DeflateRect( 1, 1 );
- br.DeleteObject();
- br.CreateSolidBrush( bgColor );
- dc.SelectObject( &br );
-
- pen.DeleteObject();
- pen.CreatePen( PS_SOLID, 1, clrDkBorder );
- dc.SelectObject( &pen );
- dc.RoundRect( rcButton, CPoint(2,2) );
- if( _ppbd.m_bPushed )
- {
- rcButton.DeflateRect( 1, 1 );
- if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
- stat_PaintGradientRect(
- dc,
- rcButton,
- GetColor( _2003CLR_TBB_BK_COMBINED_BOTTOM, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( _2003CLR_TBB_BK_COMBINED_TOP, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- true
- );
- else
- dc.FillSolidRect(
- &rcButton,
- GetColor( COLOR_WINDOW, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- }
- dc.SelectObject( pOldBrush );
- dc.SelectObject( pOldPen );
- }
- }
- else
- {
- if( ( ! _ppbd.m_bTransparentBackground )
- || _ppbd.m_bIndeterminate
- || _ppbd.m_clrForceBk != ((COLORREF)-1L)
- )
- {
- if( nIdxMainGradientLeft >= 0
- && nIdxMainGradientRight >= 0
- && ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8
- )
- {
- stat_PaintGradientRect(
- dc,
- rectClient,
- GetColor( _ppbd.m_bHorz ? nIdxMainGradientRight : nIdxMainGradientLeft, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( _ppbd.m_bHorz ? nIdxMainGradientLeft : nIdxMainGradientRight, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- _ppbd.m_bHorz
- );
- }
- else
- dc.FillSolidRect( &rectClient, bgColor );
- }
- // Draw pressed button
- if( _ppbd.m_bPushed || _ppbd.m_bIndeterminate || _ppbd.m_bPushedDropDown )
- {
- if( (!_ppbd.m_bFlat) || _ppbd.m_bDrawBorder )
- dc.Draw3dRect( rectClient, clrDkBorder, clrDkBorder );
- }
- else
- {
- if( _ppbd.m_bFlat )
- {
- if( _ppbd.m_bHover && _ppbd.m_bDrawBorder )
- dc.Draw3dRect( rectClient, clrDkBorder, clrDkBorder );
- }
- else
- {
- dc.Draw3dRect( rectClient, clrDkBorder, clrDkBorder );
- if( _ppbd.m_bHover )
- dc.Draw3dRect( _ppbd.m_rcClient, clrDkBorder, clrDkBorder );
- }
- }
- }
- if( _ppbd.m_bDropDown && (! _ppbd.m_bNoDropDownArrow ) )
- {
- CRect rectGlyph( rectDropDown );
- if( bPushedDropDown )
- rectGlyph.OffsetRect( GetPushedOffset() );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- RGB(0,0,0),
- };
- bool bSetDefaultColorForDD = true;
- if( _ppbd.m_bEnabled )
- {
- if( m_clrCustomDropDownGlyphEnabled != COLORREF(-1L) )
- {
- ColorValues[1] = m_clrCustomDropDownGlyphEnabled;
- bSetDefaultColorForDD = false;
- }
- }
- else
- {
- if( m_clrCustomDropDownGlyphDisabled != COLORREF(-1L) )
- {
- ColorValues[1] = m_clrCustomDropDownGlyphDisabled;
- bSetDefaultColorForDD = false;
- }
- }
- if( bSetDefaultColorForDD )
- ColorValues[1] =
- GetColor(
- _ppbd.m_bEnabled
- ? COLOR_BTNTEXT
- : COLOR_3DSHADOW
- ,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- );
- if( bRTL && (rectGlyph.Width()&1) == 0 )
- rectGlyph.right++;
- PaintGlyphCentered(
- dc,
- rectGlyph,
- _ppbd.m_bHorz ? g_glyph_btn_expand_bottom : g_glyph_btn_expand_right,
- ColorValues
- );
- } // if( _ppbd.m_bDropDown && (! _ppbd.m_bNoDropDownArrow ) )
- dc.SetBkColor( bgColor );
- rectCaption.DeflateRect( _ppbd.m_rcBorderSizes );
- rectClient = rectCaption;
- CRect rcFocus( rectCaption );
- // Draw icon
- if( rectClient.bottom > rectClient.top
- && rectClient.right > rectClient.left
- )
- PaintPushButtonIcon(
- dc,
- rectClient,
- rectCaption,
- rcFocus,
- _ppbd
- );
- CExtSafeString sTitle( _T("") );
- if( _ppbd.m_sText != NULL )
- sTitle = _ppbd.m_sText;
- // Draw text
- if( rectCaption.bottom > rectCaption.top
- && rectCaption.right > rectCaption.left
- && (!sTitle.IsEmpty())
- )
- PaintPushButtonText(
- dc,
- rectCaption,
- _ppbd
- );
- // Draw focus rectangle
- if( _ppbd.m_bDrawFocusRect
- && ( ( !sTitle.IsEmpty() ) || _ppbd.m_nFocusMode == __EBFM_CLIENT_AREA )
- && rcFocus.bottom > rcFocus.top
- && rcFocus.right > rcFocus.left
- )
- {
- rcFocus.DeflateRect( 2, 2 );
- dc.DrawFocusRect( &rcFocus );
- }
- dc.SetBkMode( nOldBkMode );
- dc.SetBkColor( clrOldBk );
- dc.SetTextColor( clrOldText );
- }
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- void CExtPaintManagerStudio2008::PaintTabItem(
- CDC & dc,
- CRect & rcTabItemsArea,
- bool bTopLeft,
- bool bHorz,
- bool bSelected,
- bool bCenteredText,
- bool bGroupedMode,
- bool bInGroupActive,
- bool bInvertedVerticalMode,
- const CRect & rcEntireItem,
- CSize sizeTextMeasured,
- CFont * pFont,
- __EXT_MFC_SAFE_LPCTSTR sText,
- CExtCmdIcon * pIcon,
- CObject * pHelperSrc,
- LPARAM lParam, // = 0L
- COLORREF clrForceText, // = COLORREF(-1L)
- COLORREF clrForceTabBk, // = COLORREF(-1L)
- COLORREF clrForceTabBorderLT, // = COLORREF(-1L)
- COLORREF clrForceTabBorderRB, // = COLORREF(-1L)
- COLORREF clrForceTabSeparator, // = COLORREF(-1L)
- bool bDwmMode // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabItem(
- dc,
- rcTabItemsArea,
- bTopLeft,
- bHorz,
- bSelected,
- bCenteredText,
- bGroupedMode,
- bInGroupActive,
- bInvertedVerticalMode,
- rcEntireItem,
- sizeTextMeasured,
- pFont,
- sText,
- pIcon,
- pHelperSrc,
- lParam,
- clrForceText,
- clrForceTabBk,
- clrForceTabBorderLT,
- clrForceTabBorderRB,
- clrForceTabSeparator,
- bDwmMode
- );
- return;
- }
- LONG nItemIndex = 1;
- CExtCmdIcon * pIconTabItemCloseButton = NULL;
- CExtCmdIcon::e_paint_type_t ePaintStateITICB =
- (CExtCmdIcon::e_paint_type_t) CExtCmdIcon::__PAINT_INVISIBLE;
- CRect rcTabItemCloseButton( 0, 0, 0, 0 );
- CExtBarButton * pTBB = NULL;
- CExtTabWnd * pTabs = NULL;
- CExtTabWnd::TAB_ITEM_INFO * pTII = NULL;
- bool bNoPrefix = false;
- if( pHelperSrc != NULL )
- {
- pTabs = DYNAMIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- if( pTabs != NULL )
- {
- ASSERT_VALID( pTabs );
- pTII = pTabs->ItemGet( LONG( lParam ) );
- ASSERT( pTII != NULL );
- ASSERT_VALID( pTII );
- nItemIndex = (LONG)lParam;
- pIconTabItemCloseButton =
- pTabs->OnTabWndQueryItemCloseButtonShape( pTII );
- if( pIconTabItemCloseButton != NULL )
- {
- rcTabItemCloseButton = pTII->CloseButtonRectGet();
- ePaintStateITICB = (CExtCmdIcon::e_paint_type_t)
- pTabs->OnTabWndQueryItemCloseButtonPaintState( pTII );
- } // if( pIconTabItemCloseButton != NULL )
- bNoPrefix = ( ( pTabs->GetTabWndStyleEx() & __ETWS_EX_NO_PREFIX ) != 0 ) ? true : false;
- } // if( pTabs != NULL )
- else
- {
- pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
- #ifdef _DEBUG
- if( pTBB != NULL )
- {
- ASSERT_VALID( pTBB );
- } // if( pTBB != NULL )
- #endif // _DEBUG
- } // else from if( pTabs != NULL )
- } // if( pHelperSrc != NULL )
- LONG nSelectionIndex = -1;
- if( pTabs != NULL )
- nSelectionIndex = pTabs->SelectionGet();
- bool bInGroupFirst = false;
- bool bInGroupLast = false;
- if( bGroupedMode && pTII != NULL )
- {
- ASSERT( pTabs != NULL );
- CExtTabWnd::TAB_ITEM_INFO * pTiiFirst = pTII->GetInGroupFirst();
- CExtTabWnd::TAB_ITEM_INFO * pTiiLast = pTII->GetInGroupLast();
- ASSERT_VALID( pTiiFirst );
- ASSERT_VALID( pTiiLast );
- bInGroupFirst = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiFirst ) );
- bInGroupLast = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiLast ) );
- }
- bool bFirstItem = false, bLastItem = false;
- if( pTII != NULL )
- {
- ASSERT( pTabs != NULL );
- bFirstItem =
- ( nItemIndex == 0
- || ( bInGroupFirst
- && nItemIndex != nSelectionIndex
- )
- );
- bLastItem =
- ( nItemIndex == pTabs->ItemGetCount() - 1
- || ( bInGroupLast
- && nItemIndex != nSelectionIndex
- )
- );
- }
- bool bDrawIcon = (
- pIcon != NULL
- && (! pIcon->IsEmpty() )
- && ( pTabs == NULL || (pTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0 )
- );
-
- if( bGroupedMode )
- bSelected = false;
- bool bHover = false;
- bool bPressed = false;
- bool bEnabled = true;
- if( pTII != NULL )
- {
- ASSERT( pTabs != NULL );
- bEnabled = pTII->EnabledGet();
- bHover = ( pTabs->GetHoverTrackingItem() == nItemIndex && bEnabled ) ? true : false;
- bPressed = ( pTabs->GetPushedTrackingItem() == nItemIndex && bEnabled ) ? true : false;
- }
- else if( pTBB != NULL )
- {
- bEnabled = pTBB->IsEnabled();
- bHover = pTBB->IsHover();
- bPressed = pTBB->IsPressed();
- }
- bool bDetectedDynTPC = false;
- bDetectedDynTPC;
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- if( pTII != NULL )
- {
- CObject * pObject = pTII->EventProviderGet();
- if( pObject != NULL )
- {
- CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pObject );
- if( pBar != NULL )
- {
- bool bFlashCaptionHighlightedState = false;
- if( pBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
- {
- if( bFlashCaptionHighlightedState )
- {
- clrForceText = pBar->m_clrFlashCaptionText;
- clrForceTabBk = pBar->m_clrFlashCaptionBackground;
- bSelected = true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bDetectedDynTPC = true;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- }
- }
- }
- }
- #endif// (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- COLORREF clrColorizeTabShape = COLORREF(-1L);
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrColorizeTabShape = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrColorizeTabShape = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- enum e_TabOrientation_t
- {
- __ETO_TOP = 0,
- __ETO_BOTTOM = 1,
- __ETO_LEFT = 2,
- __ETO_RIGHT = 3,
- };
- e_TabOrientation_t eTO = __ETO_TOP;
- if( bTopLeft )
- {
- if( bHorz )
- eTO = __ETO_TOP;
- else
- eTO = __ETO_LEFT;
- }
- else
- {
- if( bHorz )
- eTO = __ETO_BOTTOM;
- else
- eTO = __ETO_RIGHT;
- }
- if( bGroupedMode )
- {
- switch( eTO )
- {
- case __ETO_TOP:
- eTO = __ETO_BOTTOM;
- break;
- case __ETO_BOTTOM:
- eTO = __ETO_TOP;
- break;
- case __ETO_LEFT:
- eTO = __ETO_RIGHT;
- break;
- case __ETO_RIGHT:
- eTO = __ETO_LEFT;
- break;
- }
- }
- CRect rcItem( rcEntireItem );
- if( g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- HWND hWndOpenTheme = pTabs->GetSafeHwnd();
- if( hWndOpenTheme == NULL )
- hWndOpenTheme = ::GetDesktopWindow();
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWndOpenTheme, VSCLASS_TAB ) != NULL )
- {
- INT nPartID = TABP_TABITEM;
- INT nStateID =
- (!bEnabled)
- ? TIS_DISABLED
- : bSelected
- ? TIS_SELECTED
- : bPressed
- ? TIS_FOCUSED
- : bHover
- ? TIS_HOT
- : TIS_NORMAL;
- CExtBitmap _bmp1, _bmp2;
- COLORREF * pClrSurface = NULL;
- CBitmap _bmp;
- CBitmap * pOldBmp = NULL;
- CDC dcX;
- if( eTO == __ETO_TOP || eTO == __ETO_BOTTOM )
- {
- if( eTO == __ETO_TOP
- && clrColorizeTabShape == COLORREF(-1L)
- )
- {
- rcItem.OffsetRect( 0, 2 );
- if( bSelected )
- rcItem.InflateRect(
- bFirstItem ? 0 : 2,
- ( eTO == __ETO_TOP ) ? 2 : 0,
- bLastItem ? 0 : 2,
- ( eTO == __ETO_BOTTOM ) ? 2 : 0
- );
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWndOpenTheme,
- dc.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcItem,
- &rcItem
- ) == S_OK
- );
- }
- else
- {
- if( eTO == __ETO_BOTTOM )
- {
- if( g_PaintManager.m_bIsWinVista )
- rcItem.DeflateRect( 0, -2, 0, 2 );
- else
- rcItem.OffsetRect( 0, -1 );
- }
- if( bSelected )
- rcItem.InflateRect(
- bFirstItem ? 0 : 2,
- ( eTO == __ETO_TOP ) ? 2 : 0,
- bLastItem ? 0 : 2,
- ( eTO == __ETO_BOTTOM ) ? 2 : 0
- );
- VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
- if( eTO != __ETO_TOP )
- {
- VERIFY(
- _bmp2.CreateRotated9xStack(
- _bmp1,
- 180,
- 1,
- rcItem.Width(),
- rcItem.Height(),
- false,
- false
- )
- );
- }
- else
- _bmp2 = _bmp1;
- HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
- ASSERT( hBmp != NULL && pClrSurface != NULL );
- _bmp.Attach( hBmp );
- VERIFY( dcX.CreateCompatibleDC( NULL ) );
- pOldBmp = dcX.SelectObject( &_bmp );
- CRect rcItemX( 0, 0, rcItem.Width(), rcItem.Height() );
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWndOpenTheme,
- dcX.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcItemX,
- &rcItemX
- ) == S_OK
- );
- dcX.SelectObject( pOldBmp );
- _bmp2.Empty();
- VERIFY( _bmp2.FromBitmap( hBmp ) );
- _bmp1.Empty();
- if( eTO != __ETO_TOP )
- {
- VERIFY(
- _bmp1.CreateRotated9xStack(
- _bmp2,
- 180,
- 1,
- rcItem.Width(),
- rcItem.Height(),
- false,
- false
- )
- );
- }
- else
- _bmp1 = _bmp2;
- if( clrColorizeTabShape != COLORREF(-1L) )
- {
- _bmp1.Make32();
- _bmp1.AdjustHLS( COLORREF(-1L), COLORREF(-1L), 0.0, -0.5 );
- _bmp1.MakeMono( clrColorizeTabShape );
- _bmp1.AlphaBlend( dc.m_hDC, rcItem, 64 );
- }
- else
- _bmp1.Draw( dc.m_hDC, rcItem );
- }
- } // if( eTO == __ETO_TOP || eTO == __ETO_BOTTOM )
- else
- {
- if( eTO == __ETO_LEFT
- && clrColorizeTabShape == COLORREF(-1L)
- )
- {
- rcItem.OffsetRect( 2, 0 );
- if( g_PaintManager.m_bIsWinVista && eTO == __ETO_RIGHT )
- rcItem.DeflateRect( -2, 0, 2, 0 );
- if( bSelected )
- rcItem.InflateRect( 2, bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2 );
- VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
- VERIFY(
- _bmp2.CreateRotated9xStack(
- _bmp1,
- 90,
- 1,
- rcItem.Width(),
- rcItem.Height(),
- false,
- false
- )
- );
- HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
- ASSERT( hBmp != NULL && pClrSurface != NULL );
- _bmp.Attach( hBmp );
- VERIFY( dcX.CreateCompatibleDC( NULL ) );
- pOldBmp = dcX.SelectObject( &_bmp );
- CRect rcItemX( 0, 0, rcItem.Height(), rcItem.Width() );
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWndOpenTheme,
- dcX.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcItemX,
- &rcItemX
- ) == S_OK
- );
- dcX.SelectObject( pOldBmp );
- _bmp2.Empty();
- VERIFY( _bmp2.FromBitmap( hBmp ) );
- _bmp1.Empty();
- VERIFY(
- _bmp1.CreateRotated9xStack(
- _bmp2,
- 270,
- 1,
- rcItem.Height(),
- rcItem.Width(),
- false,
- false
- )
- );
- _bmp1.Draw( dc.m_hDC, rcItem );
- }
- else
- {
- if( g_PaintManager.m_bIsWinVista && eTO == __ETO_RIGHT )
- rcItem.DeflateRect( -2, 0, 2, 0 );
- if( bSelected )
- rcItem.InflateRect( 2, bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2 );
- VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
- if( eTO != __ETO_LEFT )
- {
- VERIFY(
- _bmp2.CreateRotated9xStack(
- _bmp1,
- 270,
- 1,
- rcItem.Width(),
- rcItem.Height(),
- false,
- false
- )
- );
- }
- else
- _bmp2 = _bmp1;
- HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
- ASSERT( hBmp != NULL && pClrSurface != NULL );
- _bmp.Attach( hBmp );
- VERIFY( dcX.CreateCompatibleDC( NULL ) );
- pOldBmp = dcX.SelectObject( &_bmp );
- CRect rcItemX( 0, 0, rcItem.Height(), rcItem.Width() );
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWndOpenTheme,
- dcX.GetSafeHdc(),
- nPartID,
- nStateID,
- &rcItemX,
- &rcItemX
- ) == S_OK
- );
- dcX.SelectObject( pOldBmp );
- _bmp2.Empty();
- VERIFY( _bmp2.FromBitmap( hBmp ) );
- _bmp1.Empty();
- if( eTO != __ETO_LEFT )
- {
- VERIFY(
- _bmp1.CreateRotated9xStack(
- _bmp2,
- 90,
- 1,
- rcItem.Height(),
- rcItem.Width(),
- false,
- false
- )
- );
- }
- else
- _bmp1 = _bmp2;
- if( clrColorizeTabShape != COLORREF(-1L) )
- {
- _bmp1.Make32();
- _bmp1.AdjustHLS( COLORREF(-1L), COLORREF(-1L), 0.0, -0.5 );
- _bmp1.MakeMono( clrColorizeTabShape );
- _bmp1.AlphaBlend( dc.m_hDC, rcItem, 64 );
- }
- else
- _bmp1.Draw( dc.m_hDC, rcItem );
- }
- } // else if( eTO == __ETO_TOP || eTO == __ETO_BOTTOM )
-
- if( _bmp.GetSafeHandle() != NULL )
- _bmp.DeleteObject();
-
- if( dcX.GetSafeHdc() != NULL )
- dcX.DeleteDC();
- g_PaintManager.m_UxTheme.CloseThemeData();
- } // if( g_PaintManager.m_UxTheme.OpenThemeData( ...
- }
- else // if( g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- POINT arrPointsBorders[4] = { {0,0}, {0,0}, {0,0}, {0,0} };
- if( eTO == __ETO_TOP || eTO == __ETO_BOTTOM )
- {
- if( eTO == __ETO_TOP )
- {
- rcItem.OffsetRect( 0, 2 );
- if( bSelected )
- rcItem.InflateRect(
- bFirstItem ? 0 : 2,
- 2,
- bLastItem ? 0 : 2,
- -2
- );
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.bottom );
- arrPointsBorders[1] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[2] = CPoint(rcItem.right, rcItem.top );
- arrPointsBorders[3] = CPoint(rcItem.right, rcItem.bottom );
- if( bSelected || bGroupedMode )
- {
- arrPointsBorders[0].y += 1;
- arrPointsBorders[3].y += 1;
- }
- }
- else
- {
- if( bSelected )
- rcItem.InflateRect(
- bFirstItem ? 0 : 2,
- 0,
- bLastItem ? 0 : 2,
- 2
- );
-
- rcItem.bottom -= 3;
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.left, rcItem.bottom );
- arrPointsBorders[2] = CPoint(rcItem.right, rcItem.bottom );
- arrPointsBorders[3] = CPoint(rcItem.right, rcItem.top - 1 );
- if( bSelected || bGroupedMode )
- {
- arrPointsBorders[0].y -= 1;
- arrPointsBorders[3].y -= 1;
- }
- }
- }
- else
- {
- if( eTO == __ETO_LEFT )
- {
- rcItem.OffsetRect( 2, 0 );
- if( bSelected )
- rcItem.InflateRect(
- 2,
- bFirstItem ? 0 : 2,
- 2,
- bLastItem ? 0 : 2
- );
- arrPointsBorders[0] = CPoint(rcItem.right, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[2] = CPoint(rcItem.left, rcItem.bottom );
- arrPointsBorders[3] = CPoint(rcItem.right, rcItem.bottom );
- if( bSelected || bGroupedMode )
- {
- arrPointsBorders[0].x += 1;
- arrPointsBorders[3].x += 1;
- }
- }
- else
- {
- if( bSelected )
- rcItem.InflateRect(
- 2,
- bFirstItem ? 0 : 2,
- 2,
- bLastItem ? 0 : 2
- );
-
- rcItem.right -= 3;
- arrPointsBorders[0] = CPoint(rcItem.left, rcItem.top );
- arrPointsBorders[1] = CPoint(rcItem.right, rcItem.top );
- arrPointsBorders[2] = CPoint(rcItem.right, rcItem.bottom );
- arrPointsBorders[3] = CPoint(rcItem.left - 1, rcItem.bottom );
- if( bSelected || bGroupedMode )
- {
- arrPointsBorders[0].x -= 1;
- arrPointsBorders[3].x -= 1;
- }
- }
- }
- CRgn rgnBk;
- VERIFY( rgnBk.CreatePolygonRgn( arrPointsBorders, 4, ALTERNATE ) );
- if( bSelected
- || ( bHover && bGroupedMode )
- )
- {
- COLORREF clrBrushBk = RGB(252,252,254);
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && ( bDetectedDynTPC
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
- || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
- )
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( pHelperSrc != NULL
- && clrForceTabBk != COLORREF(-1L)
- && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
- && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
- )
- clrBrushBk = clrForceTabBk;
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- CBrush brushBk( clrBrushBk );
- dc.FillRgn( &rgnBk, &brushBk );
- }
- // draw item border
- CPen pen(PS_SOLID, 1, GetColor( COLOR_3DSHADOW, this ) );
- CPen * pOldPen = dc.SelectObject( &pen );
- for( int i = 0 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]) - 1; i++ )
- {
- dc.MoveTo( arrPointsBorders[i] );
- dc.LineTo( arrPointsBorders[i + 1] );
- }
- dc.SelectObject( pOldPen );
- } // if( g_PaintManager.m_UxTheme.IsControlsThemed() )
- COLORREF clrText = clrForceText;
- if( clrText == COLORREF(-1L) )
- clrText =
- GetColor(
- bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED,
- pHelperSrc,
- lParam
- );
- #define __EXTTAB_INDENT_TOP 2
- #define __EXTTAB_INDENT_BOTTOM 2
- #define __EXTTAB_INDENT_LEFT 2
- #define __EXTTAB_INDENT_RIGHT 2
- rcItem.DeflateRect(
- bHorz
- ? __EXTTAB_INDENT_LEFT
- : __EXTTAB_INDENT_TOP,
- bHorz
- ? __EXTTAB_INDENT_TOP
- : __EXTTAB_INDENT_LEFT,
- bHorz
- ? __EXTTAB_INDENT_RIGHT
- : __EXTTAB_INDENT_TOP,
- bHorz
- ? __EXTTAB_INDENT_BOTTOM
- : __EXTTAB_INDENT_RIGHT
- );
-
- CSize _sizeIcon( 0, 0 );
- if( bDrawIcon )
- {
- _sizeIcon = pIcon->GetSize();
- ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
- }
- CRect rcItemForIcon( rcItem );
- if( bDrawIcon
- && _sizeIcon.cx > 0
- && _sizeIcon.cy > 0
- )
- {
- // rcItemForIcon.DeflateRect(
- // bHorz ? 0 : ( rcItem.Width() - _sizeIcon.cx),
- // bHorz ? ( rcItem.Height() - _sizeIcon.cy) : 0
- // );
- rcItemForIcon.right = rcItemForIcon.left + _sizeIcon.cx;
- rcItemForIcon.bottom = rcItemForIcon.top + _sizeIcon.cy;
- rcItemForIcon.OffsetRect(
- bHorz ? 0 : ((rcItem.Width() - _sizeIcon.cx) / 2),
- bHorz ? ((rcItem.Height() - _sizeIcon.cy) / 2) : 0
- );
- if( rcItemForIcon.left < (rcItem.left+1) )
- rcItemForIcon.left = (rcItem.left+1);
- if( rcItemForIcon.right < (rcItem.right-1) )
- rcItemForIcon.right = (rcItem.right-1);
- if( rcItemForIcon.top < (rcItem.top+1) )
- rcItemForIcon.top = (rcItem.top+1);
- if( rcItemForIcon.bottom < (rcItem.bottom-1) )
- rcItemForIcon.bottom = (rcItem.bottom-1);
- }
- CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
- // IMPORTANT: the rcText calculation fixed by Genka
- CRect rcText(
- rcItem.left // rcItemForIcon.left
- + ( bHorz
- ? (_sizeIcon.cx +
- ((_sizeIcon.cx > 0) ? __EXTTAB_MARGIN_ICON2TEXT_X : 0)
- )
- : 0
- ),
- rcItem.top // rcItemForIcon.left
- + ( bHorz
- ? 0
- : (_sizeIcon.cy +
- ((_sizeIcon.cy > 0) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0)
- )
- ),
- rcItem.right,
- rcItem.bottom
- );
- if( !bHorz )
- {
- if( pIconTabItemCloseButton != NULL )
- rcText.bottom = min( rcText.bottom, rcTabItemCloseButton.top );
- int nWidth0 = rcText.Width();
- int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
- if( nWidth1 > nWidth0 )
- {
- if( bInvertedVerticalMode )
- {
- //rcText.right -= __EXTTAB_MARGIN_ICON2TEXT_X;
- rcText.left = rcText.right - nWidth1;
- } // if( bInvertedVerticalMode )
- else
- {
- //rcText.left += __EXTTAB_MARGIN_ICON2TEXT_X;
- rcText.right = rcText.left + nWidth1;
- } // else from if( bInvertedVerticalMode )
- } // if( nWidth1 > nWidth0 )
- } // if( !bHorz )
- else
- {
- if( pIconTabItemCloseButton != NULL )
- rcText.right = min( rcText.right, rcTabItemCloseButton.left );
- }
- bool bDrawText = ( ( ! sItemText.IsEmpty() ) && rcText.Width() > 0 && rcText.Height() > 0 ) ? true : false;
- INT nIconAlignment = __ALIGN_HORIZ_LEFT | __ALIGN_VERT_TOP;
- if( (!bDrawText) && !( bGroupedMode && (!bInGroupActive) ) )
- {
- if( bCenteredText )
- nIconAlignment = __ALIGN_HORIZ_CENTER|__ALIGN_VERT_CENTER;
- else
- rcItemForIcon.OffsetRect(
- bHorz ? (rcItem.Width() - _sizeIcon.cx)/2 : 0,
- bHorz ? 0 : (rcItem.Height() - _sizeIcon.cy)/2
- );
- }
- if( bDrawIcon )
- {
- if( (bHorz && rcItemForIcon.Width() >= _sizeIcon.cx )
- || (!bHorz && rcItemForIcon.Height() >= _sizeIcon.cy)
- )
- {
- PaintIcon(
- dc,
- true,
- pIcon,
- rcItemForIcon,
- false,
- bEnabled,
- false,
- nIconAlignment
- );
- }
- } // if( bDrawIcon )
- if( bDrawText )
- { // if we have sense to paint text on tab item
- ASSERT( pFont != NULL );
- ASSERT( pFont->GetSafeHandle() != NULL );
- COLORREF clrOldText = dc.SetTextColor( clrText );
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
-
- CFont * pOldFont = dc.SelectObject( pFont );
- if( !bHorz )
- {
- if( bCenteredText )
- rcText.OffsetRect(
- 0,
- ( rcText.Height() - sizeTextMeasured.cx ) / 2
- );
- int nTextLength = sItemText.GetLength();
- int nAmpIndex = bNoPrefix ? (-1) : int( sItemText.Find( _T('&') ) );
- CExtSafeString sBtn;
- if( nAmpIndex < 0 || bNoPrefix )
- sBtn = sItemText;
- else
- sBtn =
- sItemText.Left( nAmpIndex )
- + sItemText.Right( nTextLength - ( nAmpIndex + 1 ) );
- if( ! bNoPrefix )
- {
- static TCHAR stat_strDummyAmpSeq[] = _T("