ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
- HRESULT CExtUxTheme::GetThemeString(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT __EXT_UX_LPWSTR pszBuff,
- int cchMaxBuffChars
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeString != NULL );
- if( m_pfnGetThemeString != NULL )
- return m_pfnGetThemeString( m_hUxTheme, iPartId, iStateId, iPropId, pszBuff, cchMaxBuffChars );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeBool(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT BOOL * pfVal
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeBool != NULL );
- if( m_pfnGetThemeBool != NULL )
- return m_pfnGetThemeBool( m_hUxTheme, iPartId, iStateId, iPropId, pfVal );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeInt(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT int * piVal
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeInt != NULL );
- if( m_pfnGetThemeInt != NULL )
- return m_pfnGetThemeInt( m_hUxTheme, iPartId, iStateId, iPropId, piVal );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeEnumValue(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT int * piVal
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeEnumValue != NULL );
- if( m_pfnGetThemeEnumValue != NULL )
- return m_pfnGetThemeEnumValue( m_hUxTheme, iPartId, iStateId, iPropId, piVal );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemePosition(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT POINT * pPoint
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemePosition != NULL );
- if( m_pfnGetThemePosition != NULL )
- return m_pfnGetThemePosition( m_hUxTheme, iPartId, iStateId, iPropId, pPoint );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeFont(
- OPTIONAL HDC hdc,
- int iPartId,
- int iStateId,
- int iPropId,
- OUT LOGFONT * pFont
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeFont != NULL );
- if( m_pfnGetThemeFont != NULL )
- return m_pfnGetThemeFont( m_hUxTheme, hdc, iPartId, iStateId, iPropId, pFont );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeRect(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT RECT * pRect
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeRect != NULL );
- if( m_pfnGetThemeRect != NULL )
- return m_pfnGetThemeRect( m_hUxTheme, iPartId, iStateId, iPropId, pRect );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeMargins(
- OPTIONAL HDC hdc,
- int iPartId,
- int iStateId,
- int iPropId,
- OPTIONAL RECT * prc,
- OUT CExtUxTheme::__EXT_UX_MARGINS * pMargins
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeMargins != NULL );
- if( m_pfnGetThemeMargins != NULL )
- return m_pfnGetThemeMargins( m_hUxTheme, hdc, iPartId, iStateId, iPropId, prc, pMargins );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeIntList(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT CExtUxTheme::__EXT_UX_INTLIST * pIntList
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeIntList != NULL );
- if( m_pfnGetThemeIntList != NULL )
- return m_pfnGetThemeIntList( m_hUxTheme, iPartId, iStateId, iPropId, pIntList );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemePropertyOrigin(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT enum __EXT_UX_PROPERTYORIGIN * pOrigin
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemePropertyOrigin != NULL );
- if( m_pfnGetThemePropertyOrigin != NULL )
- return m_pfnGetThemePropertyOrigin( m_hUxTheme, iPartId, iStateId, iPropId, pOrigin );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::SetWindowTheme(
- HWND hwnd,
- __EXT_UX_LPCWSTR pszSubAppName,
- __EXT_UX_LPCWSTR pszSubIdList
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnSetWindowTheme != NULL );
- if( m_pfnSetWindowTheme != NULL )
- return m_pfnSetWindowTheme( hwnd, pszSubAppName, pszSubIdList );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeFilename(
- int iPartId,
- int iStateId,
- int iPropId,
- OUT __EXT_UX_LPWSTR pszThemeFileName,
- int cchMaxBuffChars
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeFilename != NULL );
- if( m_pfnGetThemeFilename != NULL )
- return m_pfnGetThemeFilename( m_hUxTheme, iPartId, iStateId, iPropId, pszThemeFileName, cchMaxBuffChars );
- return S_FALSE;
- }
- COLORREF CExtUxTheme::GetThemeSysColor(
- BOOL bThemeSysColor,
- int iColorId
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysColor != NULL );
- if( m_pfnGetThemeSysColor != NULL )
- return m_pfnGetThemeSysColor( bThemeSysColor ? m_hUxTheme : NULL, iColorId );
- return COLORREF( -1 );
- }
- HBRUSH CExtUxTheme::GetThemeSysColorBrush(
- BOOL bThemeSysColor,
- int iColorId
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysColorBrush != NULL );
- if( m_pfnGetThemeSysColorBrush != NULL )
- return m_pfnGetThemeSysColorBrush( bThemeSysColor ? m_hUxTheme : NULL, iColorId );
- return NULL;
- }
- BOOL CExtUxTheme::GetThemeSysBool(
- BOOL bThemeSysColor,
- int iBoolId
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysBool != NULL );
- if( m_pfnGetThemeSysBool != NULL )
- return m_pfnGetThemeSysBool( bThemeSysColor ? m_hUxTheme : NULL, iBoolId );
- return FALSE;
- }
- int CExtUxTheme::GetThemeSysSize(
- BOOL bThemeSysColor,
- int iSizeId
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysSize != NULL );
- if( m_pfnGetThemeSysSize != NULL )
- return m_pfnGetThemeSysSize( bThemeSysColor ? m_hUxTheme : NULL, iSizeId );
- return 0;
- }
- HRESULT CExtUxTheme::GetThemeSysFont(
- BOOL bThemeSysColor,
- int iFontId,
- OUT LOGFONT * plf
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysFont != NULL );
- if( m_pfnGetThemeSysFont != NULL )
- return m_pfnGetThemeSysFont( bThemeSysColor ? m_hUxTheme : NULL, iFontId, plf );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeSysString(
- int iStringId,
- OUT __EXT_UX_LPWSTR pszStringBuff,
- int cchMaxStringChars
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysString != NULL );
- if( m_pfnGetThemeSysString != NULL )
- return m_pfnGetThemeSysString( m_hUxTheme, iStringId, pszStringBuff, cchMaxStringChars );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeSysInt(
- int iIntId,
- int * piValue
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeSysInt != NULL );
- if( m_pfnGetThemeSysInt != NULL )
- return m_pfnGetThemeSysInt( m_hUxTheme, iIntId, piValue );
- return S_FALSE;
- }
- BOOL CExtUxTheme::IsThemeActive()
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnIsThemeActive != NULL );
- if( m_pfnIsThemeActive != NULL )
- return m_pfnIsThemeActive();
- return FALSE;
- }
- BOOL CExtUxTheme::IsAppThemed()
- {
- if( m_hUxThemeDll == NULL )
- return FALSE;
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnIsAppThemed != NULL );
- if( m_pfnIsAppThemed != NULL )
- {
- __try
- {
- return m_pfnIsAppThemed();
- }
- __except( EXCEPTION_EXECUTE_HANDLER )
- {
- }
- }
- return FALSE;
- }
- CExtUxTheme::__EXT_UX_HTHEME CExtUxTheme::GetWindowTheme( HWND hwnd )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetWindowTheme != NULL );
- if( m_pfnGetWindowTheme != NULL )
- return m_pfnGetWindowTheme( hwnd );
- return NULL;
- }
- HRESULT CExtUxTheme::EnableThemeDialogTexture(
- HWND hwnd,
- DWORD dwFlags
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnEnableThemeDialogTexture != NULL );
- if( m_pfnEnableThemeDialogTexture != NULL )
- return m_pfnEnableThemeDialogTexture( hwnd, dwFlags );
- return S_FALSE;
- }
- BOOL CExtUxTheme::IsThemeDialogTextureEnabled( HWND hwnd )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnIsThemeDialogTextureEnabled != NULL );
- if( m_pfnIsThemeDialogTextureEnabled != NULL )
- return m_pfnIsThemeDialogTextureEnabled( hwnd );
- return FALSE;
- }
- DWORD CExtUxTheme::GetThemeAppProperties()
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeAppProperties != NULL );
- if( m_pfnGetThemeAppProperties != NULL )
- return m_pfnGetThemeAppProperties();
- return 0;
- }
- void CExtUxTheme::SetThemeAppProperties( DWORD dwFlags )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnSetThemeAppProperties != NULL );
- if( m_pfnSetThemeAppProperties != NULL )
- m_pfnSetThemeAppProperties( dwFlags );
- }
- HRESULT CExtUxTheme::GetCurrentThemeName(
- OUT __EXT_UX_LPWSTR pszThemeFileName,
- int cchMaxNameChars,
- OUT OPTIONAL __EXT_UX_LPWSTR pszColorBuff,
- int cchMaxColorChars,
- OUT OPTIONAL __EXT_UX_LPWSTR pszSizeBuff,
- int cchMaxSizeChars
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetCurrentThemeName != NULL );
- if( m_pfnGetCurrentThemeName != NULL )
- return m_pfnGetCurrentThemeName( pszThemeFileName, cchMaxNameChars, pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::GetThemeDocumentationProperty(
- __EXT_UX_LPCWSTR pszThemeName,
- __EXT_UX_LPCWSTR pszPropertyName,
- OUT __EXT_UX_LPWSTR pszValueBuff,
- int cchMaxValChars
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnGetThemeDocumentationProperty != NULL );
- if( m_pfnGetThemeDocumentationProperty != NULL )
- return m_pfnGetThemeDocumentationProperty( pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::DrawThemeParentBackground(
- HWND hwnd,
- HDC hdc,
- OPTIONAL RECT * prc
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnDrawThemeParentBackground != NULL );
- if( m_pfnDrawThemeParentBackground != NULL )
- return m_pfnDrawThemeParentBackground( hwnd, hdc, prc );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::EnableTheming( BOOL fEnable )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnEnableTheming != NULL );
- if( m_pfnEnableTheming != NULL )
- return m_pfnEnableTheming( fEnable );
- return S_FALSE;
- }
- HRESULT CExtUxTheme::DrawThemeBackgroundEx(
- HDC hdc,
- int iPartId,
- int iStateId,
- const RECT * pRect,
- OPTIONAL const CExtUxTheme::__EXT_UX_DTBGOPTS * pOptions
- )
- {
- //ASSERT( m_hUxTheme != NULL );
- //ASSERT( m_pfnDrawThemeBackgroundEx != NULL );
- if( m_pfnDrawThemeBackgroundEx != NULL )
- return m_pfnDrawThemeBackgroundEx( m_hUxTheme, hdc, iPartId, iStateId, pRect, pOptions );
- return S_FALSE;
- }
- //////////////////////////////////////////////////////////////////////////
- // CExtDWM class
- //////////////////////////////////////////////////////////////////////////
- CExtDWM::CExtDWM()
- : m_hDWMDll( NULL )
- , m_bNeedToFreeDll( false )
- , m_nDwmMaxQueuedBuffers( 8 )
- , m_nDwmMaxMonitors( 16 )
- , m_nDwmMaxAdapters( 16 )
- , m_pfnDwmDefWindowProc( NULL )
- , m_pfnDwmEnableBlurBehindWindow( NULL )
- , m_pfnDwmEnableComposition( NULL )
- , m_pfnDwmEnableMMCSS( NULL )
- , m_pfnDwmExtendFrameIntoClientArea( NULL )
- , m_pfnDwmGetColorizationColor( NULL )
- , m_pfnDwmGetCompositionTimingInfo( NULL )
- , m_pfnDwmGetWindowAttribute( NULL )
- , m_pfnDwmIsCompositionEnabled( NULL )
- , m_pfnDwmModifyPreviousDxFrameDuration( NULL )
- , m_pfnDwmQueryThumbnailSourceSize( NULL )
- , m_pfnDwmRegisterThumbnail( NULL )
- , m_pfnDwmSetDxFrameDuration( NULL )
- , m_pfnDwmSetPresentParameters( NULL )
- , m_pfnDwmSetWindowAttribute( NULL )
- , m_pfnDwmUnregisterThumbnail( NULL )
- , m_pfnDwmUpdateThumbnailProperties( NULL )
- {
- struct
- {
- FARPROC * m_pFarProc;
- LPCSTR m_strProcName;
- } arrDWMApi[] =
- {
- { (FARPROC*)&m_pfnDwmDefWindowProc, "DwmDefWindowProc" },
- { (FARPROC*)&m_pfnDwmEnableBlurBehindWindow, "DwmEnableBlurBehindWindow" },
- { (FARPROC*)&m_pfnDwmEnableComposition, "DwmEnableComposition" },
- { (FARPROC*)&m_pfnDwmEnableMMCSS, "DwmEnableMMCSS" },
- { (FARPROC*)&m_pfnDwmExtendFrameIntoClientArea, "DwmExtendFrameIntoClientArea" },
- { (FARPROC*)&m_pfnDwmGetColorizationColor, "DwmGetColorizationColor" },
- { (FARPROC*)&m_pfnDwmGetCompositionTimingInfo, "DwmGetCompositionTimingInfo" },
- { (FARPROC*)&m_pfnDwmGetWindowAttribute, "DwmGetWindowAttribute" },
- { (FARPROC*)&m_pfnDwmIsCompositionEnabled, "DwmIsCompositionEnabled" },
- { (FARPROC*)&m_pfnDwmModifyPreviousDxFrameDuration, "DwmModifyPreviousDxFrameDuration" },
- { (FARPROC*)&m_pfnDwmQueryThumbnailSourceSize, "DwmQueryThumbnailSourceSize" },
- { (FARPROC*)&m_pfnDwmRegisterThumbnail, "DwmRegisterThumbnail" },
- { (FARPROC*)&m_pfnDwmSetDxFrameDuration, "DwmSetDxFrameDuration" },
- { (FARPROC*)&m_pfnDwmSetPresentParameters, "DwmSetPresentParameters" },
- { (FARPROC*)&m_pfnDwmSetWindowAttribute, "DwmSetWindowAttribute" },
- { (FARPROC*)&m_pfnDwmUnregisterThumbnail, "DwmUnregisterThumbnail" },
- { (FARPROC*)&m_pfnDwmUpdateThumbnailProperties, "DwmUpdateThumbnailProperties" },
- };
- if( m_hDWMDll == NULL )
- {
- m_hDWMDll =
- ::GetModuleHandle( _T("dwmapi.dll") );
- if( m_hDWMDll == NULL )
- {
- m_hDWMDll = ::LoadLibrary( _T("dwmapi.dll") );
- m_bNeedToFreeDll = true;
- }
- } // if( m_hDWMDll == NULL )
- if( m_hDWMDll != NULL )
- {
- INT nApiCount = sizeof(arrDWMApi)/sizeof(arrDWMApi[0]);
- for( INT nFunc = 0; nFunc < nApiCount; nFunc++ )
- {
- FARPROC pFarProc = NULL;
- pFarProc =
- ::GetProcAddress(
- m_hDWMDll,
- arrDWMApi[nFunc].m_strProcName
- );
- *(arrDWMApi[nFunc].m_pFarProc) = pFarProc;
- }
- } // if( m_hDWMDll != NULL )
- }
- CExtDWM::~CExtDWM()
- {
- if( m_hDWMDll != NULL && m_bNeedToFreeDll )
- {
- ::FreeLibrary( m_hDWMDll );
- m_hDWMDll = NULL;
- }
- }
- BOOL CExtDWM::IsCompositionEnabled()
- {
- if( m_hDWMDll == NULL )
- return FALSE;
- BOOL bEnabled = FALSE;
- HRESULT hr = DwmIsCompositionEnabled( &bEnabled );
- if( SUCCEEDED(hr) )
- return bEnabled;
- return FALSE;
- }
- BOOL CExtDWM::DwmDefWindowProc(
- IN HWND hWnd,
- IN UINT msg,
- IN WPARAM wParam,
- IN LPARAM lParam,
- OUT LRESULT * plResult
- )
- {
- if( m_pfnDwmDefWindowProc != NULL )
- return m_pfnDwmDefWindowProc( hWnd, msg, wParam, lParam, plResult );
- return FALSE;
- }
- HRESULT CExtDWM::DwmEnableBlurBehindWindow(
- HWND hWnd,
- const __EXT_DWM_BLURBEHIND * pBlurBehind
- )
- {
- if( m_pfnDwmEnableBlurBehindWindow != NULL )
- return m_pfnDwmEnableBlurBehindWindow( hWnd, pBlurBehind );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmEnableComposition(
- BOOL fEnable
- )
- {
- if( m_pfnDwmEnableComposition != NULL )
- return m_pfnDwmEnableComposition( fEnable );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmEnableMMCSS(
- BOOL fEnableMMCSS
- )
- {
- if( m_pfnDwmEnableMMCSS != NULL )
- return m_pfnDwmEnableMMCSS( fEnableMMCSS );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmExtendFrameIntoClientArea(
- HWND hWnd,
- const CExtUxTheme::__EXT_UX__MARGINS * pMarInset
- )
- {
- if( m_pfnDwmExtendFrameIntoClientArea != NULL )
- return m_pfnDwmExtendFrameIntoClientArea( hWnd, pMarInset );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmGetColorizationColor(
- DWORD * pcrColorization,
- BOOL * pfOpaqueBlend
- )
- {
- if( m_pfnDwmGetColorizationColor != NULL )
- return m_pfnDwmGetColorizationColor( pcrColorization, pfOpaqueBlend );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmGetCompositionTimingInfo(
- HWND hwnd,
- __EXT_DWM_TIMING_INFO * pTimingInfo
- )
- {
- if( m_pfnDwmGetCompositionTimingInfo != NULL )
- return m_pfnDwmGetCompositionTimingInfo( hwnd, pTimingInfo );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmGetWindowAttribute(
- HWND hwnd,
- DWORD dwAttribute,
- PVOID pvAttribute,
- DWORD cbAttribute
- )
- {
- if( m_pfnDwmGetWindowAttribute != NULL )
- return m_pfnDwmGetWindowAttribute( hwnd, dwAttribute, pvAttribute, cbAttribute );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmIsCompositionEnabled(
- BOOL * pfEnabled
- )
- {
- if( m_pfnDwmIsCompositionEnabled != NULL )
- return m_pfnDwmIsCompositionEnabled( pfEnabled );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmModifyPreviousDxFrameDuration(
- HWND hwnd,
- INT cRefreshes,
- BOOL fRelative
- )
- {
- if( m_pfnDwmModifyPreviousDxFrameDuration != NULL )
- return m_pfnDwmModifyPreviousDxFrameDuration( hwnd, cRefreshes, fRelative );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmQueryThumbnailSourceSize(
- __EXT_HTHUMBNAIL hThumbnail,
- OUT PSIZE pSize
- )
- {
- if( m_pfnDwmQueryThumbnailSourceSize != NULL )
- return m_pfnDwmQueryThumbnailSourceSize( hThumbnail, pSize );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmRegisterThumbnail(
- HWND hwndDestination,
- HWND hwndSource,
- const SIZE * pMinimizedSize,
- __EXT_PHTHUMBNAIL phThumbnailId
- )
- {
- if( m_pfnDwmRegisterThumbnail != NULL )
- return m_pfnDwmRegisterThumbnail( hwndDestination, hwndSource, pMinimizedSize, phThumbnailId );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmSetDxFrameDuration(
- HWND hwnd,
- INT cRefreshes
- )
- {
- if( m_pfnDwmSetDxFrameDuration != NULL )
- return m_pfnDwmSetDxFrameDuration( hwnd, cRefreshes );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmSetPresentParameters(
- HWND hwnd,
- __EXT_DWM_PRESENT_PARAMETERS * pPresentParams
- )
- {
- if( m_pfnDwmSetPresentParameters != NULL )
- return m_pfnDwmSetPresentParameters( hwnd, pPresentParams );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmSetWindowAttribute(
- HWND hwnd,
- DWORD dwAttribute,
- LPCVOID pvAttribute,
- DWORD cbAttribute
- )
- {
- if( m_pfnDwmSetWindowAttribute != NULL )
- return m_pfnDwmSetWindowAttribute( hwnd, dwAttribute, pvAttribute, cbAttribute );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmUnregisterThumbnail(
- __EXT_HTHUMBNAIL hThumbnailId
- )
- {
- if( m_pfnDwmUnregisterThumbnail != NULL )
- return m_pfnDwmUnregisterThumbnail( hThumbnailId );
- return S_FALSE;
- }
- HRESULT CExtDWM::DwmUpdateThumbnailProperties(
- __EXT_HTHUMBNAIL hThumbnailId,
- const __EXT_DWM_THUMBNAIL_PROPERTIES * ptnProperties
- )
- {
- if( m_pfnDwmUpdateThumbnailProperties != NULL )
- return m_pfnDwmUpdateThumbnailProperties( hThumbnailId, ptnProperties );
- return S_FALSE;
- }
- //////////////////////////////////////////////////////////////////////////
- // CExtPaintManagerOffice2003NoThemes
- //////////////////////////////////////////////////////////////////////////
- CExtPaintManagerOffice2003NoThemes::CExtPaintManagerOffice2003NoThemes()
- {
- }
- CExtPaintManagerOffice2003NoThemes::~CExtPaintManagerOffice2003NoThemes()
- {
- }
- bool CExtPaintManagerOffice2003NoThemes::OnQueryUseThemeColors() const
- {
- ASSERT_VALID( this );
- return false;
- }
- double CExtPaintManagerOffice2003NoThemes::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- return -0.70;
- }
- COLORREF CExtPaintManagerOffice2003NoThemes::GetIconAlphaColor() const
- {
- COLORREF clrAlpha = ( const_cast < CExtPaintManagerOffice2003NoThemes * > ( this ) ) -> GetColor( COLOR_3DFACE, (CObject*)this );
- return clrAlpha;
- }
-
- //////////////////////////////////////////////////////////////////////////
- // CExtPaintManagerOffice2007_Impl
- //////////////////////////////////////////////////////////////////////////
- COLORREF CExtPaintManagerOffice2007_Impl::GetIconAlphaColor() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaColor();
- return m_clrIconAlphaColor;
- }
- double CExtPaintManagerOffice2007_Impl::GetIconAlphaAdjustPercent() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::GetIconAlphaAdjustPercent();
- return m_lfIconAlphaAdjustPercent;
- }
- CExtPaintManagerOffice2007_Impl::CExtPaintManagerOffice2007_Impl()
- : m_bThemedMenuItemsEverywhere( false )
- , m_clrFillHint( RGB(0,0,0) )
- , m_clrAccentHint( RGB(255,255,255) )
- , m_clrDockingFrameDark( RGB(0,0,0) )
- , m_clrFloatingToolbarGripperSolid( COLORREF(-1L) )
- , m_clrDockingFrameCaptionTextActive( RGB(0,0,0) )
- , m_clrDockingFrameCaptionTextInactive( RGB(255,255,255) )
- , m_clrDockingFrameCaptionTextFloatingFixed( RGB(255,255,255) )
- , m_clrDockingCaptionShapeFixedPushed( RGB(0,0,0) )
- , m_clrDockingCaptionShapeResizablePushed( RGB(0,0,0) )
- , m_clrDockingCaptionShapeFixedHover( RGB(0,0,0) )
- , m_clrDockingCaptionShapeResizableHover( RGB(0,0,0) )
- , m_clrDockingCaptionShapeFixedNormal( RGB(0,0,0) )
- , m_clrDockingCaptionShapeResizableNormal( RGB(0,0,0) )
- #ifdef __FREIWALD_ORIGINAL__
- #else
- // the following items remain unitialized in the original code:
- , m_clrDockingCaptionShapeFixedDisabled(RGB(160, 160, 160))
- , m_clrDockingCaptionShapeResizableDisabled(RGB(160, 160, 160))
- #endif
- , m_clrTransparentNcFrameActive( RGB(255,0,255) )
- , m_clrTransparentNcFrameInactive( RGB(255,0,255) )
- , m_rcNcFrameBordersActive( 0, 0, 0, 0 )
- , m_rcNcFrameBordersInactive( 0, 0, 0, 0 )
- , m_nCaptionHeightActive( 0 )
- , m_nCaptionHeightInactive( 0 )
- , m_bUseNcFrameBmpForDockerBkgnd( false )
- , m_clrNcFrameTextActive( COLORREF(-1L) )
- , m_clrNcFrameTextInactive( COLORREF(-1L) )
- , m_rcNcButtonBkPadding( 3, 3, 3, 3 )
- , m_sizeNcButtonShapeInArr( 17, 16 )
- , m_nNcBtnIdxDisabled( 3 )
- , m_nNcBtnIdxNormalActive( 0 )
- , m_nNcBtnIdxNormalInactive( 4 )
- , m_nNcBtnIdxHover( 1 )
- , m_nNcBtnIdxPressed( 2 )
- #if (!defined __EXT_MFC_NO_STATUSBAR)
- , m_rcStatusBkPadding( 0, 0, 0, 0 )
- , m_rcStatusSeparatorPadding( 0, 0, 0, 0 )
- , m_clrStatusPaneTextColorDisabled( RGB(128,128,128) )
- , m_clrStatusPaneTextColorNormal( RGB(0,0,0) )
- #endif // (!defined __EXT_MFC_NO_STATUSBAR)
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- , m_nIdxTabShapeDisabled( -1 )
- , m_nIdxTabShapeNormal( -1 )
- , m_nIdxTabShapeHover( -1 )
- , m_nIdxTabShapePressed( -1 )
- , m_nIdxTabShapeSelected( -1 )
- , m_nIdxTabShapeSelectedHover( -1 )
- , m_clrTabTextNormal( RGB(0,0,0) )
- , m_clrTabTextSelected( RGB(0,0,0) )
- , m_clrTabTextNormalDWM( COLORREF(-1L) )
- , m_clrTabTextSelectedDWM( COLORREF(-1L) )
- #endif // (!defined __EXT_MFC_NO_TAB_CTRL)
- , m_clrMenuItemLeftAreaMarginL( COLORREF(-1L) )
- , m_clrMenuItemLeftAreaMarginR( COLORREF(-1L) )
- , m_nMenuGlyphItemHeightSmall( 22 )
- , m_nMenuGlyphItemHeightLarge( 44 )
- , m_rcMenuItemPaddingLargeLeft( 3, 2, 3, 2 )
- , m_rcMenuItemPaddingLargeRight( 1, 2, 3, 2 )
- , m_rcMenuItemPaddingSmallLeft( 3, 2, 3, 2 )
- , m_rcMenuItemPaddingSmallRight( 1, 2, 3, 2 )
- , m_clrDCA1( COLORREF(-1) )
- , m_clrDCA2( COLORREF(-1) )
- , m_clrDCA3( COLORREF(-1) )
- , m_bDocumentClientAreaBkgndR2( false )
- , m_clrDCA_Solid( COLORREF(-1L) )
- , m_sizeComboBoxDropDown( 15, 19 )
- , m_rcPaddingComboBoxDropDown( 3, 3, 3, 3 )
- , m_lfIconAlphaAdjustPercent( -0.50 )
- , m_clrIconAlphaColor( COLORREF(-1L) )
- // , m_nTbbLightWeightSimpleGlyphHeightH( 22 )
- // , m_nTbbLightWeightSimpleGlyphHeightV( 22 )
- // , m_nTbbLightWeightSDDLeftGlyphHeightH( 22 )
- // , m_nTbbLightWeightSDDLeftGlyphHeightV( 22 )
- // , m_nTbbLightWeightSDDRightGlyphHeightH( 22 )
- // , m_nTbbLightWeightSDDRightGlyphHeightV( 9 )
- // , m_rcTbbLightWeightSimplePaddingH( 3, 3, 3, 3 )
- // , m_rcTbbLightWeightSimplePaddingV( 3, 3, 3, 3 )
- // , m_rcTbbLightWeightSDDLeftPaddingH( 3, 3, 3, 3 )
- // , m_rcTbbLightWeightSDDLeftPaddingV( 3, 3, 3, 3 )
- // , m_rcTbbLightWeightSDDRightPaddingH( 3, 3, 3, 3 )
- // , m_rcTbbLightWeightSDDRightPaddingV( 3, 3, 3, 3 )
- , m_nPushBtnSimpleGlyphHeightH( 22 )
- , m_nPushBtnSimpleGlyphHeightV( 22 )
- , m_nPushBtnSDDLeftGlyphHeightH( 22 )
- , m_nPushBtnSDDLeftGlyphHeightV( 22 )
- , m_nPushBtnSDDRightGlyphHeightH( 22 )
- , m_nPushBtnSDDRightGlyphHeightV( 9 )
- , m_rcPushBtnSimplePaddingH( 3, 3, 3, 3 )
- , m_rcPushBtnSimplePaddingV( 3, 3, 3, 3 )
- , m_rcPushBtnSDDLeftPaddingH( 3, 3, 3, 3 )
- , m_rcPushBtnSDDLeftPaddingV( 3, 3, 3, 3 )
- , m_rcPushBtnSDDRightPaddingH( 3, 3, 3, 3 )
- , m_rcPushBtnSDDRightPaddingV( 3, 3, 3, 3 )
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- , m_rcRibbonTabAreaBlurPadding( 0, 0, 0, 0 )
- , m_clrRibbonTabClientAreaActive( COLORREF(-1L) )
- , m_clrRibbonTabClientAreaInactive( COLORREF(-1L) )
- , m_nQatbAdditionalSpaceAtRight( 0 )
- , m_nQatbAdditionalSpaceAtRightDWM( 0 )
- , m_clrContractedMargin1( COLORREF(-1L) )
- , m_clrContractedMargin2( COLORREF(-1L) )
- , m_nContractedMarginHeight( 0 )
- , m_rcRibbonPageOuterContentPadding( 4, 3, 3, 4 )
- , m_nRibbonGroupIconBkVertOffset( 0 )
- , m_nRibbonCaptionPartHeight( 0 )
- , m_nRibbonGroupCaptionAreaHeightExpanded( 0 )
- , m_nRibbonGroupCaptionAreaHeightCollapsed( 0 )
- , m_rcRibbonPageBkPadding( 0, 0, 0, 0 )
- , m_rcRibbonGroupPaddingBkExpanded( 0, 0, 0, 0 )
- , m_rcRibbonGroupPaddingBkCollapsed( 0, 0, 0, 0 )
- , m_bRibbonGroupCaptionAtTop( false )
- , m_bRibbonGroupCaptionAreaHasPadding( false )
- , m_rcRibbonSeparatorPaddingH( 0, 0, 0, 0 )
- , m_rcRibbonSeparatorPaddingV( 0, 0, 0, 0 )
- , m_nRibbonSeparatorDrawModeH( 0 )
- , m_nRibbonSeparatorDrawModeV( 0 )
- , m_clrRibbonGroupCaptionTextExpanded( RGB( 255, 255, 255 ) )
- , m_clrRibbonGroupCaptionTextShadowExpanded( COLORREF(-1L) )
- , m_clrRibbonGroupCaptionTextCollapsed( RGB(0,0,0) )
- , m_clrRibbonButtonNormal( RGB(0,0,0) )
- , m_clrRibbonButtonDisabled( RGB(0,0,0) )
- , m_sizeRibbonGroupCaptionTextOffset( 0, 0 )
- , m_nRibbonGroupCaptionTextDF( DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_END_ELLIPSIS )
- , m_nRibbonGroupCaptionTextShadowDF( DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_END_ELLIPSIS )
- , m_nRibbonQuickAccessBarButtonsAlignment( -1 )
- , m_rcPaddingRibbonQuickAccessBarBkAtTheBottom( 0, 0, 0, 0 )
- , m_nRibbonTabIntersectionHeight( 0 )
- , m_rcRibbonNcCornerLeftCP( 0, 0, 0, 0 )
- , m_rcRibbonNcCornerRightCP( 0, 0, 0, 0 )
- , m_nRibbonFileButtonHeight( 45 )
- , m_clrRibbon_EmbeddedCaptionTextLeft( RGB(80,80,80) )
- , m_clrRibbon_EmbeddedCaptionTextRight( RGB(128,128,128) )
- , m_nRibbonEmbeddedCaptionTextAlignmentFlags( DT_SINGLELINE|DT_CENTER|DT_VCENTER )
- , m_bRibbonFileButtonItegrationSupported( true )
- , m_rcRibbonPaddingQACEB( 2, 2, 2, 2 )
- , m_nRibbonHeightOfQACEB( 18 )
- , m_nIdxRibbonQACEB_Normal( 0 )
- , m_nIdxRibbonQACEB_Hover( 1 )
- , m_nIdxRibbonQACEB_Pressed( 2 )
- , m_nIdxRibbonQACEB_Selected( 0 )
- , m_nRibbonHeightOfOneDLB( -1 )
- , m_nDlbIdxDisabled( -1 )
- , m_nDlbIdxNormal( -1 )
- , m_nDlbIdxHover( -1 )
- , m_nDlbIdxPressed( -1 )
- , rcRibbonContentPaddingDLB( 0, 0, 0, 0 )
- , m_clrRibbonGalleryInplaceBorderNormal( COLORREF( -1L ) )
- , m_clrRibbonGalleryInplaceBorderHover( COLORREF( -1L ) )
- , m_clrRibbonGalleryInplaceBkgndNormal( COLORREF( -1L ) )
- , m_clrRibbonGalleryInplaceBkgndHover( COLORREF( -1L ) )
- , m_rcRibbonGalleryScrollFill( COLORREF( -1L ) )
- , m_rcRibbonGalleryScrollButtonPadding( 0, 0, 0, 0 )
- , m_nHeightRibbonGalleryScrollButton( -1 )
- , m_nIndexRibbonGalleryScrollButtonDisabled( -1 )
- , m_nIndexRibbonGalleryScrollButtonNormal( -1 )
- , m_nIndexRibbonGalleryScrollButtonHover( -1 )
- , m_nIndexRibbonGalleryScrollButtonPressed( -1 )
- , m_sizeAboveTheRibbonShiftQACEB( 0, 0 )
- , m_nRibbonFileButtonMenuIntersectionHeight( 0 )
- , m_clrRibbonComboBackGroundNormal( COLORREF(-1L) )
- , m_clrRibbonComboBackGroundDisabled( COLORREF(-1L) )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- , m_sizeRibbonComboBoxDropDown( 15, 20 )
- , m_rcRibbonPaddingComboBoxDropDown( 1, 1, 1, 1 )
- , m_clrRibbonModeMenuTextNormal( COLORREF( -1L ) )
- , m_rcRibbonModeMenuBorderPadding( 3, 3, 3, 3 )
- , m_rcRibbonModeMenuMetrics( 1, 1, 1, 1 )
- , m_rcPaddingRibbonMenuResizingMarginHV( 0, 0, 0, 0 )
- , m_rcPaddingRibbonMenuResizingMarginV( 0, 0, 0, 0 )
- // tool buttons 2007
- , m_rcPaddingOfButtonTS( 3, 3, 3, 3 )
- , m_rcPaddingOfButtonSS( 3, 3, 3, 3 )
- , m_rcPaddingOfButtonLSM( 3, 3, 3, 3 )
- //, m_rcPaddingOfButtonLSB( 3, 3, 3, 3 )
- , m_rcPaddingOfButtonLSXM( 3, 3, 3, 3 )
- , m_rcPaddingOfButtonLSXB( 3, 3, 3, 3 )
- , m_rcPaddingOfToolButtonSeparator( 0, 3, 0, 3 )
- , m_rcPaddingOfLargeButtonSeparator( 2, 0, 2, 0 )
- , m_nHeightOfButtonTS( 22 )
- , m_nHeightOfButtonSS( 22 )
- , m_nHeightOfButtonLSM( 56 )
- //, m_nHeightOfButtonLSB( 26 )
- , m_nHeightOfButtonLSXM( 39 )
- , m_nHeightOfButtonLSXB( 27 )
- , m_rcAdvTipPaddingBorder( 3, 3, 3, 3 )
- , m_rcAdvTipPaddingGradient( 1, 1, 1, 1 )
- , m_clrAdvTipGradientTop( RGB(255,255,255) )
- , m_clrAdvTipGradientBottom( RGB(204,219,240) )
- , m_clrAdvTipText( RGB(64,64,64) )
- , m_bAdvTipOnePxExcludeMode( true )
- , m_clrMenuCaptionText( RGB(0,0,0) )
- , m_rcMenuCaptionBmpPadding( 0, 0, 0, 0 )
- , m_rcPaddingRibbonFileMenuBigBorder( 0, 0, 0, 0 )
- , m_rcPaddingRibbonFileMenuOptionsButton( 0, 0, 0, 0 )
- // , m_clrZsLineLightEnabled( RGB(0,0,0) )
- // , m_clrZsLineLightDisabled( RGB(0,0,0) )
- // , m_clrZsLineDarkEnabled( RGB(0,0,0) )
- // , m_clrZsLineDarkDisabled( RGB(0,0,0) )
- , m_rcProgressBarPartH( 0, 0, 92, 8 )
- , m_rcProgressBarPartV( 0, 92, 8, 182 )
- , m_rcProgressBackgroundPartH( 92, 0, 182, 8 )
- , m_rcProgressBackgroundPartV( 0, 0, 8, 92 )
- , m_rcProgressBarPaddingH( 1, 1, 10, 1 )
- , m_rcProgressBarPaddingV( 1, 10, 1, 1 )
- , m_rcProgressBackgroundPaddingH( 0, 0, 0, 0 )
- , m_rcProgressBackgroundPaddingV( 0, 0, 0, 0 )
- , m_rcProgressBorderPaddingH( 2, 2, 2, 2 )
- , m_rcProgressBorderPaddingV( 2, 2, 2, 2 )
- {
- m_bUseTahomaFont = false;
- #if (!defined __EXT_MFC_NO_PAGE_NAVIGATOR )
- m_bPnPaneCaptFontBold = true;
- m_strPnPaneCaptCustomFontFaceName = _T("Arial");
- // simple/gradient version of page navigator
- m_arrClrPnCaptNormal[0] = RGB(248,248,249);
- m_arrClrPnCaptNormal[1] = RGB(223,226,229);
- m_arrClrPnCaptNormal[2] = RGB(199,203,209);
- m_arrClrPnCaptNormal[3] = RGB(220,223,226);
- m_arrClrPnCaptActive[0] = RGB(255,217,170);
- m_arrClrPnCaptActive[1] = RGB(255,188,111);
- m_arrClrPnCaptActive[2] = RGB(255,171, 63);
- m_arrClrPnCaptActive[3] = RGB(254,225,123);
- m_arrClrPnCaptHover[0] = RGB(255,254,228);
- m_arrClrPnCaptHover[1] = RGB(255,233,168);
- m_arrClrPnCaptHover[2] = RGB(255,215,103);
- m_arrClrPnCaptHover[3] = RGB(255,230,159);
- m_arrClrPnCaptPressed[0] = RGB(255,189,105);
- m_arrClrPnCaptPressed[1] = RGB(255,173, 67);
- m_arrClrPnCaptPressed[2] = RGB(251,140, 60);
- m_arrClrPnCaptPressed[3] = RGB(255,187,103);
- m_arrClrPnSplitter[0] = RGB(255,255,255);
- m_arrClrPnSplitter[1] = RGB(196,200,206);
- m_clrPnSplitterDots = RGB(124,124,124);
- m_clrPnCaptText = RGB(0,0,0);
- m_arrClrPnItemText[0] = RGB(0,0,0);
- m_arrClrPnItemText[1] = RGB(55,60,67);
- m_clrPnConfigButton = RGB(49,52,49);
- // bitmap based version of page navigator
- INT nPnIndex, nPnCount = INT(ePn_Count);
- for( nPnIndex = 0; nPnIndex < nPnCount; nPnIndex ++ )
- {
- m_arrClrPnItemTextBmpVer[nPnIndex] = m_arrClrPnPaneTextBmpVer[nPnIndex] = COLORREF(-1L);
- m_arrRcPnItemPaddingExpanded[nPnIndex].SetRect( 0, 0, 0, 0 );
- m_arrRcPnItemPaddingCollapsed[nPnIndex].SetRect( 0, 0, 0, 0 );
- m_arrRcPnPanePadding[nPnIndex].SetRect( 0, 0, 0, 0 );
- }
- #endif // (!defined __EXT_MFC_NO_PAGE_NAVIGATOR )
- // tool buttons 2007
- INT nInitIndex, nInitCount;
- nInitCount = sizeof(m_arrIndicesButtonTS)/sizeof(m_arrIndicesButtonTS[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonTS[nInitIndex] = -1;
- nInitCount = sizeof(m_arrIndicesButtonSS_Left)/sizeof(m_arrIndicesButtonSS_Left[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonSS_Left[nInitIndex] = -1;
- nInitCount = sizeof(m_arrIndicesButtonSS_Right)/sizeof(m_arrIndicesButtonSS_Right[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonSS_Right[nInitIndex] = -1;
- nInitCount = sizeof(m_arrIndicesButtonLSM)/sizeof(m_arrIndicesButtonLSM[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonLSM[nInitIndex] = -1;
- // nInitCount = sizeof(m_arrIndicesButtonLSB)/sizeof(m_arrIndicesButtonLSB[0]);
- // for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- // m_arrIndicesButtonLSB[nInitIndex] = -1;
- nInitCount = sizeof(m_arrIndicesButtonLSXM)/sizeof(m_arrIndicesButtonLSXM[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonLSXM[nInitIndex] = -1;
- nInitCount = sizeof(m_arrIndicesButtonLSXB)/sizeof(m_arrIndicesButtonLSXB[0]);
- for( nInitIndex = 0; nInitIndex < nInitCount; nInitIndex++ )
- m_arrIndicesButtonLSXB[nInitIndex] = -1;
- VERIFY(
- m_bmpAdvTipBorder.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_2007_ADV_TIP_BORDER )
- )
- );
- m_bmpAdvTipBorder.Make32();
- m_bmpAdvTipBorder.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
- m_bmpAdvTipBorder.PreMultiplyRGBChannels();
- m_bmpAdvTipBorder.PreMultipliedRGBChannelsSet( true );
- VERIFY(
- m_bmpProgressMainH.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_2007_PROGRESS_MAIN )
- )
- );
- VERIFY(
- m_bmpProgressMainV.CreateRotated9xStack(
- m_bmpProgressMainH,
- 270,
- 1,
- m_bmpProgressMainH.GetSize().cx,
- m_bmpProgressMainH.GetSize().cy,
- true,
- true
- )
- );
- VERIFY(
- m_bmpProgressBorderH.LoadBMP_Resource(
- MAKEINTRESOURCE( IDB_EXT_2007_PROGRESS_BORDER )
- )
- );
- VERIFY(
- m_bmpProgressBorderV.CreateRotated9xStack(
- m_bmpProgressBorderH,
- 270,
- 1,
- m_bmpProgressBorderH.GetSize().cx,
- m_bmpProgressBorderH.GetSize().cy,
- true,
- true
- )
- );
- }
- CExtPaintManagerOffice2007_Impl::~CExtPaintManagerOffice2007_Impl()
- {
- }
- void CExtPaintManagerOffice2007_Impl::PaintComboFrame(
- CDC & dc,
- CExtPaintManager::PAINTCOMBOFRAMEDATA & _pcfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintComboFrame(
- dc,
- _pcfd
- );
- return;
- }
- if( _pcfd.m_pHelperSrc != NULL
- && _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
- && ( ((CExtPopupMenuWnd*)_pcfd.m_pHelperSrc)->TrackFlagsGet() & TPMX_RIBBON_MODE ) == 0
- )
- {
- CExtPaintManagerOffice2003::PaintComboFrame( dc, _pcfd );
- return;
- }
- CExtComboBoxBase * pWndCombo = NULL;
- if( _pcfd.m_pHelperSrc != NULL
- && _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtComboBoxBase ) )
- )
- {
- pWndCombo = STATIC_DOWNCAST( CExtComboBoxBase, _pcfd.m_pHelperSrc );
- ASSERT_VALID( pWndCombo );
- }
- if( m_bmpArrComboBoxDropDown.IsEmpty()
- || _pcfd.m_pHelperSrc == NULL
- || _pcfd.m_clrForceNABorder != COLORREF(-1L)
- || _pcfd.m_clrForceNAContent != COLORREF(-1L)
- || _pcfd.m_clrForceActiveOuterBorder != COLORREF(-1L)
- || (! ( _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CComboBox))
- || _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtBarButton))
- || _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtPopupMenuWnd))
- )
- )
- || (! GetCb2DbTransparentMode(_pcfd.m_pHelperSrc) )
- || ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
- )
- {
- CExtPaintManagerOffice2003::PaintComboFrame( dc, _pcfd );
- if( (!_pcfd.m_bEnabled) && pWndCombo != NULL )
- {
- ASSERT_VALID( pWndCombo );
- CRect rcClip( _pcfd.m_rcClient );
- rcClip.DeflateRect(1,1);
- dc.ExcludeClipRect( &rcClip );
- CExtPaintManagerOffice2003::PaintDockerBkgnd( true, dc, pWndCombo );
- dc.SelectClipRgn( NULL );
- }
- return;
- }
- bool bPopupMenuComboFieldMode = false;
- if( _pcfd.m_pHelperSrc != NULL
- && _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
- )
- bPopupMenuComboFieldMode = true;
- INT nDD = GetDropDownButtonWidth( _pcfd.m_pHelperSrc, _pcfd.m_lParam );
- CRect rcClient( _pcfd.m_rcClient );
- CRect rcEraser( rcClient );
- if( ! bPopupMenuComboFieldMode )
- rcEraser.DeflateRect(1,1);
- CRect rcHoverFrame( rcEraser );
- CRect rcDDButton( rcEraser );
- if( _pcfd.m_bRightText )
- rcDDButton.right = rcDDButton.left + nDD;
- else
- rcDDButton.left = rcDDButton.right - nDD;
- if( bPopupMenuComboFieldMode )
- {
- rcDDButton.DeflateRect( 1, 1 );
- if( _pcfd.m_bRightText )
- rcDDButton.right -= 2;
- else
- rcDDButton.left += 2;
- }
- CRect rcClientItem( rcEraser );
- rcClientItem.DeflateRect( 1, 1, 3, 1 );
- if( _pcfd.m_bRightText )
- rcClientItem.left += rcDDButton.Width();
- else
- rcClientItem.right -= rcDDButton.Width();
- if( bPopupMenuComboFieldMode )
- rcClientItem.InflateRect(1,1);
- CRgn rgnClip, rgnClientItem;
- if( (! bPopupMenuComboFieldMode )
- && rgnClip.CreateRectRgnIndirect(&rcClient)
- && rgnClientItem.CreateRectRgnIndirect(&rcClientItem)
- && rgnClip.CombineRgn( &rgnClip, &rgnClientItem, RGN_DIFF ) != ERROR
- )
- dc.SelectClipRgn( &rgnClip );
- if( pWndCombo != NULL )
- {
- ASSERT_VALID( pWndCombo );
- if( ! CExtPaintManagerOffice2003::PaintDockerBkgnd( true, dc, pWndCombo ) )
- {
- if( rgnClip.GetSafeHandle() != NULL )
- dc.SelectClipRgn( NULL );
- CExtPaintManagerXP::PaintComboFrame( dc, _pcfd );
- return;
- }
- } // if( pWndCombo != NULL )
- COLORREF clrWindow = COLORREF(-1L);
- if( pWndCombo != NULL )
- clrWindow = pWndCombo->GetBkColor();
- if( clrWindow == COLORREF(-1L) )
- {
- COLORREF clrSysBk = GetColor( _pcfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE, _pcfd.m_pHelperSrc, _pcfd.m_lParam );
- clrWindow = clrSysBk;
- }
- if( ! bPopupMenuComboFieldMode )
- {
- dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
- if( _pcfd.m_bRightText )
- rcEraser.left += nDD;
- else
- rcEraser.right -= nDD;
- INT nLeftDX = _pcfd.m_bRightText ? 1 : 0;
- INT nRightDX = _pcfd.m_bRightText ? 0 : 1;
- rcEraser.DeflateRect( _pcfd.m_bRightText ? -1 : 0, 1, _pcfd.m_bRightText ? 0 : -1, 1 );
- dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
-
- rcEraser.DeflateRect( 1, 0, 1, 0 );
- dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
- rcEraser.DeflateRect( nLeftDX, 0, nRightDX, 0 );
- dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
- rcEraser.DeflateRect( nLeftDX, 0, nRightDX, 0 );
- dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
- }
- // normal=0, hover=1, pressed=2, disabled=3
- int nIdx = 3;
- if( _pcfd.m_bEnabled )
- {
- if( _pcfd.m_bPushed )
- nIdx = 2;
- else if( _pcfd.m_bHover )
- nIdx = 1;
- else
- nIdx = 0;
- } // if( _pcfd.m_bEnabled )
- CRect rcSrc( 0, 0, m_sizeComboBoxDropDown.cx, m_sizeComboBoxDropDown.cy );
- rcSrc.OffsetRect( 0, m_sizeComboBoxDropDown.cy * nIdx );
- m_bmpArrComboBoxDropDown.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDDButton,
- rcSrc,
- m_rcPaddingComboBoxDropDown,
- CExtBitmap::__EDM_STRETCH,
- true
- );
- COLORREF clrBorder = m_arrClrComboBoxBorder[nIdx];
- dc.Draw3dRect( rcHoverFrame, clrBorder, clrBorder );
- if( (! bPopupMenuComboFieldMode )
- && rgnClip.GetSafeHandle() != NULL
- )
- dc.SelectClipRgn( NULL );
- }
- void CExtPaintManagerOffice2007_Impl::PaintControlFrame(
- CDC & dc,
- CExtPaintManager::PAINTCONTROLFRAMEDATA & _pcfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintControlFrame( dc, _pcfd );
- return;
- }
- if( _pcfd.m_pHelperSrc != NULL
- && _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
- && ( ((CExtPopupMenuWnd*)_pcfd.m_pHelperSrc)->TrackFlagsGet() & TPMX_RIBBON_MODE ) == 0
- )
- {
- CExtPaintManagerOffice2003::PaintControlFrame( dc, _pcfd );
- return;
- }
- COLORREF clrForceInner = COLORREF( -1L );
- COLORREF clrForceOuter = COLORREF( -1L );
- if( _pcfd.m_pHelperSrc != NULL )
- {
- #ifndef __EXT_MFC_NO_DURATIONWND
- if( _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDurationWnd ) ) )
- {
- CExtDurationWnd * pWnd =
- DYNAMIC_DOWNCAST( CExtDurationWnd, _pcfd.m_pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- clrForceInner = pWnd->GetBkColor();
- }
- }
- #endif // __EXT_MFC_NO_DURATIONWND
- if( _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtEdit ) ) )
- {
- CExtEdit * pWnd = DYNAMIC_DOWNCAST( CExtEdit, _pcfd.m_pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- clrForceInner = pWnd->GetBkColor();
- CWnd * pWndParent = pWnd->GetParent();
- if( pWndParent != NULL )
- {
- ASSERT_VALID( pWndParent );
- if( pWndParent->IsKindOf( RUNTIME_CLASS( CExtResizableDialog ) ) )
- {
- CExtResizableDialog * pDlg =
- DYNAMIC_DOWNCAST( CExtResizableDialog, pWndParent );
- if( pDlg != NULL )
- clrForceOuter = pDlg->GetBkColor();
- }
- else if( pWndParent->IsKindOf( RUNTIME_CLASS( CDialog ) ) )
- {
- clrForceOuter = ::GetSysColor( COLOR_3DFACE );
- }
- }
- }
- }
- } // if( _pcfd.m_pHelperSrc != NULL )
- COLORREF clrInner =
- ( clrForceInner != COLORREF( -1L ) )
- ? clrForceInner
- : GetColor(
- ( ! _pcfd.m_bEnabled )
- ? COLOR_3DFACE
- : COLOR_WINDOW,
- _pcfd.m_pHelperSrc,
- _pcfd.m_lParam
- );
- COLORREF clrIn = GetColor( COLOR_WINDOW, _pcfd.m_pHelperSrc, _pcfd.m_lParam );
- COLORREF clrOut = clrForceOuter;
- if( _pcfd.m_bEnabled )
- {
- clrIn = m_arrClrComboBoxBorder[1];
- if( _pcfd.m_bHover && _pcfd.m_bFocus )
- clrOut = m_arrClrComboBoxBorder[1];
- }
- CRect rcItem( _pcfd.m_rcClient );
- if( clrOut != COLORREF(-1L) )
- dc.Draw3dRect( rcItem, clrOut, clrOut );
- rcItem.DeflateRect(1,1);
- dc.Draw3dRect( rcItem, clrIn, clrIn );
-
- rcItem.DeflateRect(1,1);
- dc.Draw3dRect( rcItem, clrInner, clrInner );
- if( clrOut == COLORREF(-1L) )
- {
- CRect rcClip( _pcfd.m_rcClient );
- rcClip.DeflateRect(1,1);
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, _pcfd.m_pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- dc.ExcludeClipRect( &rcClip );
- CExtPaintManagerOffice2003::PaintDockerBkgnd( true, dc, pWnd );
- dc.SelectClipRgn( NULL );
- }
- }
- }
- void CExtPaintManagerOffice2007_Impl::PaintToolbarTextField(
- CDC & dc,
- CExtPaintManager::PAINTTOOLBARTEXTFIELDDATA & _ptbtfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintToolbarTextField( dc, _ptbtfd );
- return;
- }
- COLORREF clrDkBorder = GetColor( XPCLR_HILIGHT_BORDER, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- COLORREF clrForceBk = COLORREF(-1L);
- CRect rcTextFieldOuter( _ptbtfd.m_rcTextField );
- bool bRibbonMode = false;
- CExtBarButton * pTBB = NULL;
- if( _ptbtfd.m_pHelperSrc != NULL )
- {
- ASSERT_VALID( _ptbtfd.m_pHelperSrc );
- pTBB = DYNAMIC_DOWNCAST( CExtBarButton, _ptbtfd.m_pHelperSrc );
- if( pTBB != NULL )
- {
- ASSERT_VALID( pTBB );
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- CExtToolControlBar * pBar = pTBB->GetBar();
- if( pBar != NULL )
- {
- ASSERT_VALID( pBar );
- if( pBar->IsKindOf( RUNTIME_CLASS(CExtRibbonPage) ) )
- {
- bRibbonMode = true;
- rcTextFieldOuter.OffsetRect( 0, -1 );
- rcTextFieldOuter.InflateRect( 3, 1, 2, 4 );
- #ifndef __EXT_MFC_NO_BUILTIN_TEXTFIELD
- if( pTBB != NULL
- && CExtBarTextFieldButton::g_pBtnEditing != pTBB
- )
- {
- if( _ptbtfd.m_bEnabled )
- {
- if( ! ( _ptbtfd.m_bPushed || _ptbtfd.m_bHover ) )
- clrForceBk = m_clrRibbonComboBackGroundNormal;
- }
- else
- clrForceBk = m_clrRibbonComboBackGroundDisabled;
- }
- #endif // __EXT_MFC_NO_BUILTIN_TEXTFIELD
- }
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- }
- }
- if( (!bRibbonMode) && ( _ptbtfd.m_bHover || _ptbtfd.m_bPushed || (!_ptbtfd.m_bEnabled) ) )
- rcTextFieldOuter.InflateRect( 1, 1 );
- if( _ptbtfd.m_bComboField )
- {
- if( bRibbonMode )
- {
- int nIdx = -1; // 4; +288
- int nIdxBorder = 3;
- if( _ptbtfd.m_bEnabled )
- {
- if( _ptbtfd.m_bPushed )
- {
- nIdx = 3;
- nIdxBorder = 2;
- } // if( _ptbtfd.m_bPushed )
- else if( _ptbtfd.m_bHover )
- {
- nIdx = 2;
- nIdxBorder = 1;
- #ifndef __EXT_MFC_NO_BUILTIN_TEXTFIELD
- if( pTBB != NULL
- && CExtBarTextFieldButton::g_pBtnEditing != pTBB
- && ( ! pTBB->GetBar()->m_bLastDropDownHT )
- )
- {
- nIdx = 1;
- nIdxBorder = 2;
- }
- #endif // __EXT_MFC_NO_BUILTIN_TEXTFIELD
- } // else if( _ptbtfd.m_bHover )
- else
- {
- nIdx = 0;
- nIdxBorder = 0;
- if( pTBB != NULL )
- {
- bool bForceHoverMode = false;
- CExtToolControlBar * pBar = pTBB->GetBar();
- if( pBar != NULL )
- {
- ASSERT_VALID( pBar );
- if( pBar->IsKindOf( RUNTIME_CLASS(CExtMenuControlBar) ) )
- {
- INT nFTI = ((CExtMenuControlBar*)pBar)->_FlatTrackingIndexGet();
- if( nFTI >= 0
- && nFTI == pBar->_GetIndexOf( pTBB )
- )
- bForceHoverMode = true;
- } // if( pBar->IsKindOf( RUNTIME_CLASS(CExtMenuControlBar) ) )
- } // if( pBar != NULL )
- #ifndef __EXT_MFC_NO_BUILTIN_TEXTFIELD
- if( ( ! bForceHoverMode ) && CExtBarTextFieldButton::g_pBtnEditing == pTBB )
- bForceHoverMode = true;
- #endif // __EXT_MFC_NO_BUILTIN_TEXTFIELD
- if( bForceHoverMode )
- {
- nIdx = 2;
- nIdxBorder = 1;
- } // if( bForceHoverMode )
- } // if( pTBB != NULL )
- } // else from else if( _ptbtfd.m_bHover )
- } // if( _ptbtfd.m_bEnabled )
- // paint combo or date field
- INT nDD = GetDropDownButtonWidth( _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- rcTextFieldOuter.right += nDD;
- dc.FillSolidRect(
- &rcTextFieldOuter,
- ( clrForceBk != COLORREF(-1L) ) ? clrForceBk : ( ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE ) )
- );
- COLORREF clrBorder = m_arrClrComboBoxBorder[ nIdxBorder ];
- dc.Draw3dRect( rcTextFieldOuter, clrBorder, clrBorder );
- CRect rcBtn( rcTextFieldOuter );
- rcBtn.left = rcBtn.right - nDD;
- if( nIdx >= 0 )
- {
- CRect rcSrc( 0, 0, m_sizeRibbonComboBoxDropDown.cx, m_sizeRibbonComboBoxDropDown.cy );
- rcSrc.OffsetRect( 0, m_sizeRibbonComboBoxDropDown.cy * nIdx );
- m_bmpArrRibbonComboBoxDropDown.AlphaBlendSkinParts(
- dc.m_hDC,
- rcBtn,
- rcSrc,
- m_rcRibbonPaddingComboBoxDropDown,
- CExtBitmap::__EDM_STRETCH,
- true
- );
- } // if( nIdx >= 0 )
- // paint arrow down
- CSize szBmpDDA = m_bmpRibbonDDA.GetSize();
- CRect rcSrcDDA( 0, 0, szBmpDDA.cx, szBmpDDA.cy );
- CRect rcDstDDA( rcBtn.left, rcBtn.top, rcBtn.left + szBmpDDA.cx, rcBtn.top + szBmpDDA.cy );
- rcDstDDA.OffsetRect( ( rcBtn.Width() - szBmpDDA.cx ) / 2, ( rcBtn.Height() - szBmpDDA.cy ) / 2 );
- m_bmpRibbonDDA.AlphaBlendSkinParts(
- dc.m_hDC,
- rcDstDDA,
- rcSrcDDA,
- CRect( 0, 0, 0, 0 ),
- CExtBitmap::__EDM_STRETCH,
- true,
- true,
- _ptbtfd.m_bEnabled ? BYTE(255) : BYTE(128)
- );
- rcTextFieldOuter.right -= nDD;
- }
- else
- {
- // paint combo or date field
- INT nDD = CExtPaintManagerOffice2003::GetDropDownButtonWidth( _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- rcTextFieldOuter.right += nDD;
- CRect rcBtn( rcTextFieldOuter );
- rcBtn.left = rcBtn.right - nDD;
- if( (!(_ptbtfd.m_bHover || _ptbtfd.m_bPushed))
- && _ptbtfd.m_bEnabled
- )
- {
- rcBtn.DeflateRect( 3, 1, 1, 1 );
- dc.ExcludeClipRect( &rcBtn );
- }
- dc.FillSolidRect( &rcTextFieldOuter, ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE ) );
- dc.SelectClipRgn( NULL );
- if( _ptbtfd.m_bHover && _ptbtfd.m_bEnabled )
- {
- PAINTPUSHBUTTONDATA _ppbd(
- _ptbtfd.m_pHelperSrc,
- true,
- rcBtn,
- _T(""),
- NULL,
- true,
- _ptbtfd.m_bHover,
- _ptbtfd.m_bPushed,
- false,
- _ptbtfd.m_bEnabled,
- true,
- false,
- false,
- 0
- );
- CExtPaintManagerOffice2003::PaintPushButton( dc, _ppbd );
- dc.Draw3dRect( &rcTextFieldOuter, clrDkBorder, clrDkBorder );
- }
- else
- {
- if( ! _ptbtfd.m_bEnabled )
- {
- COLORREF clrBorder = GetColor( XPCLR_TEXT_FIELD_BORDER_DISABLED, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- dc.Draw3dRect( &rcTextFieldOuter, clrBorder, clrBorder );
- }
- }
- // paint arrow down
- rcBtn.top++;
- if( !_ptbtfd.m_bEnabled )
- rcBtn.left++;
- glyph_t* pGlyph = g_DockingCaptionGlyphs[ __DCBT_ARROW_SMALL_DOWN ];
- ASSERT( pGlyph != NULL );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- _ptbtfd.m_bEnabled
- ? GetColor( _ptbtfd.m_bPushed ? COLOR_3DDKSHADOW : COLOR_WINDOWTEXT, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam )
- : ::GetSysColor( COLOR_GRAYTEXT )
- };
- PaintGlyphCentered( dc, rcBtn, *pGlyph, ColorValues );
- rcTextFieldOuter.right -= nDD;
- }
- } // if( _ptbtfd.m_bComboField )
- else
- {
- // paint text field
- dc.FillSolidRect(
- &rcTextFieldOuter,
- ( clrForceBk != COLORREF(-1L) )
- ? clrForceBk
- : ( ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE ) )
- );
- if( _ptbtfd.m_bEnabled )
- {
- if( _ptbtfd.m_bHover || _ptbtfd.m_bPushed )
- dc.Draw3dRect( &rcTextFieldOuter, clrDkBorder, clrDkBorder );
- }
- else
- {
- COLORREF clrBorder = GetColor( XPCLR_TEXT_FIELD_BORDER_DISABLED, _ptbtfd.m_pHelperSrc, _ptbtfd.m_lParam );
- dc.Draw3dRect( &rcTextFieldOuter, clrBorder, clrBorder );
- }
- } // else from if( _ptbtfd.m_bComboField )
- if( ! _ptbtfd.m_sText.IsEmpty() )
- {
- COLORREF clrTextOld = dc.SetTextColor( ::GetSysColor( _ptbtfd.m_bEnabled ? COLOR_WINDOWTEXT : COLOR_GRAYTEXT ) );
- CFont * pFontOld = dc.SelectObject( &m_FontNormal );
- int nBkModeOld = dc.SetBkMode( TRANSPARENT );
- CRect rcText( _ptbtfd.m_rcTextField );
- rcText.left += 5;
- rcText.top += 2;
- bool bRTL = ( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 ) ? true : false;
- DWORD dwDtAlignFlags = bRTL ? (DT_RTLREADING|DT_RIGHT) : 0;
- dc.DrawText( _ptbtfd.m_sText, _ptbtfd.m_sText.GetLength(), &rcText, _ptbtfd.m_nDrawTextFlags|dwDtAlignFlags );
- dc.SetBkMode( nBkModeOld );
- dc.SelectObject( pFontOld );
- dc.SetTextColor( clrTextOld );
- } // if( ! _ptbtfd.m_sText.IsEmpty() )
- }
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- bool CExtPaintManagerOffice2007_Impl::QueryTabWndHoverChangingRedraw(
- const CExtTabWnd * pWndTab,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pWndTab );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::QueryTabWndHoverChangingRedraw(
- pWndTab,
- lParam
- );
- return true;
- }
- void CExtPaintManagerOffice2007_Impl::PaintTabbedTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- DWORD dwOrientation,
- bool bGroupedMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this);
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabbedTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc == NULL
- || (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) ) )
- )
- CExtPaintManager::PaintTabbedTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- CExtPaintManagerOffice2003::PaintDockerBkgnd(
- true,
- dc,
- (CWnd*)pHelperSrc
- );
- }
- void CExtPaintManagerOffice2007_Impl::PaintTabClientArea(
- CDC & dc,
- CRect & rcClient,
- CRect & rcTabItemsArea,
- CRect & rcTabNearBorderArea,
- DWORD dwOrientation,
- bool bGroupedMode,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this);
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc == NULL
- || (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) ) )
- )
- CExtPaintManager::PaintTabbedTabClientArea(
- dc,
- rcClient,
- rcTabItemsArea,
- rcTabNearBorderArea,
- dwOrientation,
- bGroupedMode,
- pHelperSrc,
- lParam
- );
- CExtPaintManagerOffice2003::PaintDockerBkgnd(
- true,
- dc,
- (CWnd*)pHelperSrc
- );
- //DWORD dwOrientation = ((CExtTabWnd*)pHelperSrc)->OrientationGet();
- e_TabShapeOrientationIndex_t eTSOI = __ETSOI_TOP;
- CRect rcPaint( 0, 0, 0, 0 );
- if( bGroupedMode )
- return;
- // if( bGroupedMode )
- // {
- // switch( dwOrientation )
- // {
- // case __ETWS_ORIENT_TOP:
- // dwOrientation = __ETWS_ORIENT_BOTTOM;
- // break;
- // case __ETWS_ORIENT_BOTTOM:
- // dwOrientation = __ETWS_ORIENT_TOP;
- // break;
- // case __ETWS_ORIENT_LEFT:
- // dwOrientation = __ETWS_ORIENT_RIGHT;
- // break;
- // case __ETWS_ORIENT_RIGHT:
- // dwOrientation = __ETWS_ORIENT_LEFT;
- // break;
- // }
- // }
- switch( dwOrientation )
- {
- case __ETWS_ORIENT_TOP:
- eTSOI = __ETSOI_TOP;
- rcPaint.SetRect(
- rcClient.left,
- rcTabItemsArea.bottom - m_arrTabAreaMargins[eTSOI],
- rcClient.right,
- rcClient.bottom
- );
- break;
- case __ETWS_ORIENT_BOTTOM:
- eTSOI = __ETSOI_BOTTOM;
- rcPaint.SetRect(
- rcClient.left,
- rcClient.top,
- rcClient.right,
- rcTabItemsArea.top + m_arrTabAreaMargins[eTSOI]
- );
- break;
- case __ETWS_ORIENT_LEFT:
- eTSOI = __ETSOI_LEFT;
- rcPaint.SetRect(
- rcTabItemsArea.right - m_arrTabAreaMargins[eTSOI],
- rcClient.top,
- rcClient.right,
- rcClient.bottom
- );
- break;
- case __ETWS_ORIENT_RIGHT:
- eTSOI = __ETSOI_RIGHT;
- rcPaint.SetRect(
- rcClient.left,
- rcClient.top,
- rcTabItemsArea.left + m_arrTabAreaMargins[eTSOI],
- rcClient.bottom
- );
- break;
- }
- const CExtBitmap & bmp = m_arrBmpTabArea[ eTSOI ];
- if( bmp.IsEmpty() )
- return;
- CSize _sizeBmp = bmp.GetSize();
- switch( eTSOI )
- {
- case __ETSOI_TOP:
- rcPaint.bottom = rcPaint.top + _sizeBmp.cy;
- break;
- case __ETSOI_BOTTOM:
- rcPaint.top = rcPaint.bottom - _sizeBmp.cy;
- break;
- case __ETSOI_LEFT:
- rcPaint.right = rcPaint.left + _sizeBmp.cx;
- break;
- case __ETSOI_RIGHT:
- rcPaint.left = rcPaint.right - _sizeBmp.cx;
- break;
- }
- bmp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcPaint,
- m_arrRectTabAreaPadding[eTSOI],
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- void CExtPaintManagerOffice2007_Impl::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;
- }
- // if( pHelperSrc == NULL
- // || ( (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) ) )
- // && (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtBarButton ) ) )
- // )
- // || IsHighContrast()
- // )
- // {
- // CExtPaintManager::PaintTabItem(
- // dc,
- // rcTabItemsArea,
- // bTopLeft,
- // bHorz,
- // bSelected,
- // bCenteredText,
- // bGroupedMode,
- // bInGroupActive,
- // bInvertedVerticalMode,
- // rcEntireItem,
- // sizeTextMeasured,
- // pFont,
- // sText,
- // pIcon,
- // pHelperSrc,
- // lParam,
- // clrForceText,
- // clrForceTabBk,
- // clrForceTabBorderLT,
- // clrForceTabBorderRB,
- // clrForceTabSeparator,
- // bDwmMode
- // );
- // return;
- // }
- CExtCmdIcon * pIconTabItemCloseButton = NULL;
- CExtCmdIcon::e_paint_type_t ePaintStateITICB =
- (CExtCmdIcon::e_paint_type_t) CExtCmdIcon::__PAINT_INVISIBLE;
- CRect rcTabItemCloseButton( 0, 0, 0, 0 );
- 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 );
- 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 )
- LPCTSTR _sText = LPCTSTR(sText);
- bool bDrawIcon = (
- pIcon != NULL
- && (! pIcon->IsEmpty() )
- && ( pTabs == NULL || (pTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0 )
- );
- if( bGroupedMode )
- bSelected = false;
- bool bEnabled = true;
- if( pTII != NULL )
- bEnabled = pTII->EnabledGet();
- else if( pTBB != NULL )
- bEnabled = pTBB->IsEnabled();
- bool bHover = false, bPressed = false;
- INT nIdxTabShape = m_nIdxTabShapeDisabled; // for disabled state
- if( pTabs != NULL && pTabs->ItemGet( LONG(lParam) )->EnabledGet() )
- {
- bHover = ( pTabs->GetHoverTrackingItem() == lParam ) ? true : false;
- bPressed = ( pTabs->GetPushedTrackingItem() == lParam ) ? true : false;
- } // if( pTabs != NULL && pTabs->ItemGet( LONG(lParam) )->EnabledGet() )
- else if( pTBB != NULL )
- {
- bHover = pTBB->IsHover();
- bPressed = pTBB->IsPressed();
- } // else if( pTBB != NULL )
- bool bDetectedDynTPC = false;
- bDetectedDynTPC;
- #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- if( pTII != NULL )
- {
- CObject * pObject = pTII->EventProviderGet();
- if( pObject != NULL )
- {
- CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pObject );
- if( pBar != NULL )
- {
- bool bFlashCaptionHighlightedState = false;
- if( pBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
- {
- if( bFlashCaptionHighlightedState )
- {
- clrForceText = pBar->m_clrFlashCaptionText;
- clrForceTabBk = pBar->m_clrFlashCaptionBackground;
- bSelected = true;
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- bDetectedDynTPC = true;
- #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- }
- }
- }
- }
- }
- #endif// (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
- COLORREF clrText = COLORREF(-1L);
- if( bDwmMode )
- clrText = bSelected ? m_clrTabTextSelectedDWM : m_clrTabTextNormalDWM;
- if( clrText == COLORREF(-1L) )
- clrText = QueryObjectTextColor( dc, bEnabled, false, bHover, bPressed, pHelperSrc, lParam );
- if( clrText == COLORREF(-1L) )
- clrText = bEnabled ? m_clrTabTextNormal : GetColor( CLR_TEXT_DISABLED, pHelperSrc, lParam );
- nIdxTabShape = m_nIdxTabShapeNormal;
- if( bSelected )
- {
- if( bEnabled && ( (! bDwmMode ) || clrText == COLORREF(-1L) ) )
- clrText = m_clrTabTextSelected;
- nIdxTabShape = m_nIdxTabShapeSelected;
- if( bHover && (!bPressed) )
- nIdxTabShape = m_nIdxTabShapeSelectedHover;
- }
- else
- {
- if( bPressed )
- nIdxTabShape = m_nIdxTabShapePressed;
- else if( bHover )
- nIdxTabShape = m_nIdxTabShapeHover;
- }
- e_TabShapeOrientationIndex_t eTSOI = __ETSOI_TOP;
- if( bTopLeft )
- {
- if( bHorz )
- eTSOI = __ETSOI_TOP;
- else
- eTSOI = __ETSOI_LEFT;
- }
- else
- {
- if( bHorz )
- eTSOI = __ETSOI_BOTTOM;
- else
- eTSOI = __ETSOI_RIGHT;
- }
- if( bGroupedMode )
- {
- switch( eTSOI )
- {
- case __ETSOI_TOP:
- eTSOI = __ETSOI_BOTTOM;
- break;
- case __ETSOI_BOTTOM:
- eTSOI = __ETSOI_TOP;
- break;
- case __ETSOI_LEFT:
- eTSOI = __ETSOI_RIGHT;
- break;
- case __ETSOI_RIGHT:
- eTSOI = __ETSOI_LEFT;
- break;
- }
- }
- 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 ) )
- )
- )
- {
- if( clrForceText != COLORREF(-1L) )
- clrText = clrForceText;
- 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()
- )
- {
- if( clrForceText != COLORREF(-1L) )
- clrText = clrForceText;
- clrColorizeTabShape = clrForceTabBk;
- }
- #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
- if( nIdxTabShape >= 0 )
- {
- bool bSelTrackingMode = false;
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( pTBB != NULL
- && pTBB->IsKindOf( RUNTIME_CLASS( CExtRibbonButtonTabPage ) )
- && ((CExtRibbonButtonTabPage*)pTBB)->IsSelectedRibbonPage()
- )
- {
- CExtToolControlBar * pToolBar = pTBB->GetBar();
- if( pToolBar != NULL )
- {
- CExtMenuControlBar * pMenuBar = DYNAMIC_DOWNCAST( CExtMenuControlBar, pToolBar );
- if( pMenuBar != NULL
- && pMenuBar->IsMenuBarTracking()
- )
- {
- int nFlatTrackingIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nFlatTrackingIndex >= 0 )
- {
- int nIndexOfTBB = pMenuBar->_GetIndexOf( pTBB );
- if( nFlatTrackingIndex == nIndexOfTBB )
- {
- if(! m_arrBmpTabShapeSelArea[0].IsEmpty() )
- bSelTrackingMode = true;
- else
- nIdxTabShape = m_nIdxTabShapeHover;
- }
- }
- }
- }
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- const CExtBitmap & _bmpTabShape =
- bSelTrackingMode
- ? m_arrBmpTabShapeSelArea[ int(eTSOI) ]
- : m_arrBmpTabShapeNormal[ int(eTSOI) ]
- ;
- if( ! _bmpTabShape.IsEmpty() )
- {
- DWORD dwDcLayout = dc.GetLayout();
- if( bDwmMode )
- dc.SetLayout( LAYOUT_LTR );
- CRect rcPadding = m_arrRectTabShapePadding[ int(eTSOI) ];
- CRect rcSrc( 0, 0, m_arrSizeTabShape[int(eTSOI)].cx, m_arrSizeTabShape[int(eTSOI)].cy );
- rcSrc.OffsetRect(
- 0,
- m_arrSizeTabShape[int(eTSOI)].cy * nIdxTabShape
- );
- CRect rcPaintTabShape = rcEntireItem;
- switch( eTSOI )
- {
- case __ETSOI_TOP:
- case __ETSOI_BOTTOM:
- rcPaintTabShape.right --;
- break;
- case __ETSOI_LEFT:
- case __ETSOI_RIGHT:
- rcPaintTabShape.bottom --;
- break;
- }
- if( clrColorizeTabShape != COLORREF(-1L) )
- {
- CExtBitmap _bmpTabShape2 = _bmpTabShape;
- _bmpTabShape2.Make32();
- _bmpTabShape2.AdjustHLS( COLORREF(-1L), COLORREF(-1L), 0.0, -0.5, -1.0 );
- _bmpTabShape2.MakeMono( clrColorizeTabShape );
- _bmpTabShape2.AlphaBlendSkinParts(
- dc.m_hDC,
- rcPaintTabShape,
- rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- }
- else
- _bmpTabShape.AlphaBlendSkinParts(
- dc.m_hDC,
- rcPaintTabShape,
- rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true
- );
- dc.SetLayout( dwDcLayout );
- }
- }
- CRect rcEntireItemX = rcEntireItem;
- rcEntireItemX.DeflateRect( 3, 3 );
- CExtPaintManager::stat_PaintTabItemImpl(
- dc,
- rcTabItemsArea,
- bTopLeft,
- bHorz,
- bSelected,
- bEnabled,
- bCenteredText,
- bGroupedMode,
- bInGroupActive,
- bInvertedVerticalMode,
- bDrawIcon,
- rcEntireItemX,
- sizeTextMeasured,
- pFont,
- _sText,
- bNoPrefix,
- pIcon,
- // bTopLeft
- // ? ( bSelected ? RGB(255,255,255) : RGB(0,0,0) )
- // : ( bSelected ? RGB(0,0,0) : RGB(255,255,255) )
- pIconTabItemCloseButton,
- INT(ePaintStateITICB),
- rcTabItemCloseButton,
- clrText,
- COLORREF(-1L), // clrTabBk,
- COLORREF(-1L), // clrTabBorderLT,
- COLORREF(-1L), // clrTabBorderRB,
- COLORREF(-1L), // clrTabSeparator
- ( pTBB != NULL ) ? false : true,
- pHelperSrc,
- bDwmMode
- );
- const CExtBitmap & _bmpTabSeparator = m_arrBmpTabSeparator[ int(eTSOI) ];
- if( ! _bmpTabSeparator.IsEmpty() )
- {
- CRect rcPaintSeparator = rcEntireItem;
- CRect rcPadding = m_arrRectTabSeparatorPadding[ int(eTSOI) ];
- CRect rcSrc( 0, 0, m_arrSizeTabSeparator[int(eTSOI)].cx, m_arrSizeTabSeparator[int(eTSOI)].cy );
- e_paint_manager_name_t ePMN = OnQueryPaintManagerName();
- switch( eTSOI )
- {
- case __ETSOI_TOP:
- rcPaintSeparator.left = rcPaintSeparator.right - m_arrSizeTabSeparator[int(eTSOI)].cx;
- rcPaintSeparator.bottom --;
- if( ePMN == Office2007_R2_Obsidian )
- rcPaintSeparator.bottom -= 2;
- break;
- case __ETSOI_BOTTOM:
- rcPaintSeparator.left = rcPaintSeparator.right - m_arrSizeTabSeparator[int(eTSOI)].cx;
- rcPaintSeparator.top ++;
- break;
- case __ETSOI_LEFT:
- rcPaintSeparator.top = rcPaintSeparator.bottom - m_arrSizeTabSeparator[int(eTSOI)].cy;
- rcPaintSeparator.right --;
- break;
- case __ETSOI_RIGHT:
- rcPaintSeparator.top = rcPaintSeparator.bottom - m_arrSizeTabSeparator[int(eTSOI)].cy;
- // rcPaintSeparator.top ++;
- rcPaintSeparator.left ++;
- break;
- }
- BYTE nSCA = BYTE(0x0FF);
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( pTBB != NULL )
- {
- CExtRibbonButtonTabPage * pRibbonButtonTabPage =
- DYNAMIC_DOWNCAST( CExtRibbonButtonTabPage, pTBB );
- if( pRibbonButtonTabPage != NULL )
- nSCA = pRibbonButtonTabPage->Get2007SeparatorAlpha();
- } // if( pTBB != NULL )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- DWORD dwDcLayout = dc.GetLayout();
- if( bDwmMode )
- dc.SetLayout( LAYOUT_LTR );
- _bmpTabSeparator.AlphaBlendSkinParts(
- dc.m_hDC,
- rcPaintSeparator,
- rcSrc,
- rcPadding,
- CExtBitmap::__EDM_STRETCH,
- true,
- true,
- nSCA
- );
- dc.SetLayout( dwDcLayout );
- } // if( ! _bmpTabSeparator.IsEmpty() )
- }
- void CExtPaintManagerOffice2007_Impl::PaintTabButton(
- CDC & dc,
- CRect & rcButton,
- LONG nHitTest,
- bool bTopLeft,
- bool bHorz,
- bool bEnabled,
- bool bHover,
- bool bPushed,
- bool bGroupedMode,
- CObject * pHelperSrc,
- LPARAM lParam, // = 0L
- bool bFlat // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabButton(
- dc,
- rcButton,
- nHitTest,
- bTopLeft,
- bHorz,
- bEnabled,
- bHover,
- bPushed,
- bGroupedMode,
- pHelperSrc,
- lParam,
- bFlat
- );
- return;
- }
- // bTopLeft;
- // bHorz;
- // lParam;
- // if( pHelperSrc == NULL
- // || (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) ) )
- // )
- // {
- CExtPaintManager::PaintTabButton(
- dc,
- rcButton,
- nHitTest,
- bTopLeft,
- bHorz,
- bEnabled,
- bHover,
- bPushed,
- bGroupedMode,
- pHelperSrc,
- lParam,
- bFlat
- );
- // return;
- // }
- // LPCTSTR strButtonType = _T("Close");
- // switch( nHitTest )
- // {
- // case __ETWH_BUTTON_LEFTUP:
- // strButtonType = _T("Up");
- // break;
- // case __ETWH_BUTTON_RIGHTDOWN:
- // strButtonType = _T("Down");
- // break;
- // case __ETWH_BUTTON_HELP:
- // strButtonType = _T("Help");
- // break;
- // case __ETWH_BUTTON_CLOSE:
- // strButtonType = _T("Close");
- // break;
- // case __ETWH_BUTTON_TAB_LIST:
- // strButtonType = _T("TabList");
- // break;
- // case __ETWH_BUTTON_SCROLL_HOME:
- // strButtonType = _T("Home");
- // break;
- // case __ETWH_BUTTON_SCROLL_END:
- // strButtonType = _T("End");
- // break;
- // default:
- // CExtPaintManager::PaintTabButton(
- // dc,
- // rcButton,
- // nHitTest,
- // bTopLeft,
- // bHorz,
- // bEnabled,
- // bHover,
- // bPushed,
- // bGroupedMode,
- // pHelperSrc,
- // lParam,
- // bFlat
- // );
- // return;
- // } // switch( nHitTest )
- // CExtTabWnd * pWndTab = STATIC_DOWNCAST( CExtTabWnd, pHelperSrc );
- //
- // LPCTSTR strGroupped = _T("Simple"); // bGroupedMode ? _T("Groupped") : _T("Simple");
- //
- // LPCTSTR strState =
- // bEnabled
- // ? ( bPushed
- // ? _T("Pressed")
- // : bHover ? _T("Hover") : _T("Normal")
- // )
- // : _T("Disabled")
- // ;
- // //LPCTSTR strSkinnedTabControlType = GetSkinnedTabControlType( pWndTab );
- // LPCTSTR strSkinnedTabControlOrientation = GetSkinnedTabControlOrientation( pWndTab );
- // CExtSkinGlyph & tabItem =
- // m_Skin[_T("TabButton")][strGroupped][strButtonType][strState]
- // [strSkinnedTabControlOrientation] //[strSkinnedTabControlType]
- // .Glyph( _T("Area") );
- // tabItem.Draw( dc.m_hDC, rcButton );
- }
- void CExtPaintManagerOffice2007_Impl::PaintTabNcAreaRect(
- CDC & dc,
- const RECT & rc,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintTabNcAreaRect(
- dc,
- rc,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc == NULL
- || (! pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) ) )
- || ((CExtTabWnd*)pHelperSrc)->_IsCustomLayoutTabWnd()
- )
- {
- CExtPaintManager::PaintTabNcAreaRect(
- dc,
- rc,
- pHelperSrc,
- lParam
- );
- return;
- }
- // CExtPaintManagerOffice2003::PaintDockerBkgnd( false, dc, (CWnd*)pHelperSrc, lParam );
- dc.FillSolidRect( &rc, GetColor( _2003CLR_GRADIENT_DARK, NULL ) );
- }
- void CExtPaintManagerOffice2007_Impl::TabWnd_MeasureItemAreaMargins(
- CExtTabWnd * pTabWnd,
- LONG & nSpaceBefore,
- LONG & nSpaceAfter,
- LONG & nSpaceOver
- )
- {
- ASSERT_VALID( this );
- ASSERT( pTabWnd != NULL && ::IsWindow(pTabWnd->m_hWnd) );
- ASSERT_VALID( pTabWnd );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::TabWnd_MeasureItemAreaMargins(
- pTabWnd,
- nSpaceBefore,
- nSpaceAfter,
- nSpaceOver
- );
- return;
- }
-
- CExtPaintManager::TabWnd_MeasureItemAreaMargins(
- pTabWnd,
- nSpaceBefore,
- nSpaceAfter,
- nSpaceOver
- );
- }
- void CExtPaintManagerOffice2007_Impl::TabWnd_UpdateItemMeasure(
- CExtTabWnd * pTabWnd,
- CExtTabWnd::TAB_ITEM_INFO * pTii,
- CDC & dcMeasure,
- CSize & sizePreCalc
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTii );
- ASSERT( dcMeasure.GetSafeHdc() != NULL );
- ASSERT( pTii->GetTabWnd() == pTabWnd );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::TabWnd_UpdateItemMeasure(
- pTabWnd,
- pTii,
- dcMeasure,
- sizePreCalc
- );
- return;
- }
- CExtPaintManager::TabWnd_UpdateItemMeasure(
- pTabWnd,
- pTii,
- dcMeasure,
- sizePreCalc
- );
- sizePreCalc.cx += 6;
- sizePreCalc.cy += 6;
- }
- void CExtPaintManagerOffice2007_Impl::TabWnd_AdjustItemCloseButtonRect(
- CRect & rcCloseButton,
- CExtTabWnd * pTabWnd
- )
- {
- ASSERT_VALID( this );
- pTabWnd;
- rcCloseButton;
- //rcCloseButton.OffsetRect( -3, 0 );
- }
- bool CExtPaintManagerOffice2007_R1::TabWnd_GetParentSizingMargin(
- INT & nMargin,
- DWORD dwOrientation,
- CExtTabWnd * pTabWnd
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pTabWnd );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::TabWnd_GetParentSizingMargin(
- nMargin,
- dwOrientation,
- pTabWnd
- );
- if( pTabWnd->_IsCustomLayoutTabWnd() )
- return
- CExtPaintManagerOffice2007_Impl::TabWnd_GetParentSizingMargin(
- nMargin,
- dwOrientation,
- pTabWnd
- );
- nMargin = 0;
- return true;
- }
- void CExtPaintManagerOffice2007_Impl::GetThemeAccentTabColors(
- COLORREF * pClrSetectedTabItemText,
- COLORREF * pClrSetectedTabItemFace, // = NULL
- COLORREF * pClrSetectedTabItemBorderLight, // = NULL
- COLORREF * pClrSetectedTabItemBorderDark, // = NULL
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::GetThemeAccentTabColors(
- pClrSetectedTabItemText,
- pClrSetectedTabItemFace,
- pClrSetectedTabItemBorderLight,
- pClrSetectedTabItemBorderDark,
- pHelperSrc,
- lParam
- );
- return;
- }
- CExtPaintManager::GetThemeAccentTabColors(
- pClrSetectedTabItemText,
- pClrSetectedTabItemFace,
- pClrSetectedTabItemBorderLight,
- pClrSetectedTabItemBorderDark,
- pHelperSrc,
- lParam
- );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CTRL)
- #if (!defined __EXT_MFC_NO_STATUSBAR)
- bool CExtPaintManagerOffice2007_Impl::StatusBar_EraseBackground(
- CDC & dc,
- const RECT & rcClient,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pStatusBar );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::StatusBar_EraseBackground(
- dc,
- rcClient,
- pStatusBar,
- lParam
- );
-
- if( m_bmpStatusBkLight.IsEmpty()
- || m_bmpStatusBkDark.IsEmpty()
- )
- return false;
- bool bLastIsDark = true;
- INT nPaneIdx, nPaneCount = pStatusBar->GetPaneCount();
- if( nPaneCount > 0 )
- {
- CExtStatusControlBar::e_StatusPaneBackgroundAccent_t eSPBA =
- pStatusBar->OnQueryPaneBackgroundAccent( nPaneCount - 1 );
- if( eSPBA == CExtStatusControlBar::__ESPBA_LIGHT )
- bLastIsDark = false;
- } // if( nPaneCount > 0 )
- if( bLastIsDark )
- m_bmpStatusBkDark.DrawSkinParts(
- dc.m_hDC,
- rcClient,
- m_rcStatusBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- else
- m_bmpStatusBkLight.DrawSkinParts(
- dc.m_hDC,
- rcClient,
- m_rcStatusBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- for( nPaneIdx = 0; nPaneIdx < nPaneCount; nPaneIdx++ )
- {
- CExtStatusControlBar::e_StatusPaneBackgroundAccent_t eSPBA =
- pStatusBar->OnQueryPaneBackgroundAccent( nPaneIdx );
- if( bLastIsDark )
- {
- if( eSPBA == CExtStatusControlBar::__ESPBA_LIGHT )
- {
- CRect rcPane;
- pStatusBar->GetItemRect( nPaneIdx, &rcPane );
- rcPane.top = rcClient.top;
- rcPane.bottom = rcClient.bottom;
- if( rcPane.IsRectEmpty() || (! dc.RectVisible( &rcPane ) ) )
- continue;
- m_bmpStatusBkLight.DrawSkinParts(
- dc.m_hDC,
- rcPane,
- m_rcStatusBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- continue;
- } // if( eSPBA == CExtStatusControlBar::__ESPBA_LIGHT )
- } // if( bLastIsDark )
- else
- {
- if( eSPBA == CExtStatusControlBar::__ESPBA_DARK )
- {
- CRect rcPane;
- pStatusBar->GetItemRect( nPaneIdx, &rcPane );
- rcPane.top = rcClient.top;
- rcPane.bottom = rcClient.bottom;
- if( rcPane.IsRectEmpty() || (! dc.RectVisible( &rcPane ) ) )
- continue;
- m_bmpStatusBkDark.DrawSkinParts(
- dc.m_hDC,
- rcPane,
- m_rcStatusBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- continue;
- } // if( eSPBA == CExtStatusControlBar::__ESPBA_DARK )
- } // else from if( bLastIsDark )
- } // for( nPaneIdx = 0; nPaneIdx < nPaneCount; nPaneIdx++ )
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::StatusBar_PaintSeparator(
- CDC & dc,
- int nPaneIdxAfterSep,
- const RECT & rcPaneBefore,
- const RECT & rcPaneAfter,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pStatusBar );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::StatusBar_PaintSeparator(
- dc,
- nPaneIdxAfterSep,
- rcPaneBefore,
- rcPaneAfter,
- pStatusBar,
- lParam
- );
-
- if( m_bmpStatusSeparator.IsEmpty() )
- return false;
- CRect rcClient;
- pStatusBar->GetClientRect( &rcClient );
- int iWidth = 0;
- UINT nIndex = 0, nPaneStyle = 0;
- pStatusBar->GetPaneInfo( nPaneIdxAfterSep, nIndex, nPaneStyle, iWidth );
- CRect rcSeparator(
- rcPaneBefore.right,
- rcClient.top,
- rcPaneAfter.left,
- rcClient.bottom
- );
- //bool bDisabled = ( ( nPaneStyle & SBPS_DISABLED ) != 0 ) ? true : false;
- CSize _size = m_bmpStatusSeparator.GetSize();
- int nWidth = rcSeparator.Width();
- if( nWidth != _size.cx )
- {
- rcSeparator.left += ( nWidth - _size.cx ) / 2;
- rcSeparator.right = rcSeparator.left + _size.cx;
- }
- m_bmpStatusSeparator.AlphaBlendSkinParts(
- dc.m_hDC,
- rcSeparator,
- m_rcStatusBkPadding,
- CExtBitmap::__EDM_STRETCH
- );
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::StatusBar_PaintPane(
- CDC & dc,
- int nPaneIdx,
- const RECT & rcPane,
- DWORD dwPaneStyle,
- HICON hIcon,
- __EXT_MFC_SAFE_LPCTSTR sPaneText,
- UINT nDrawTextFlags,
- COLORREF clrText,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pStatusBar );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::StatusBar_PaintPane(
- dc,
- nPaneIdx,
- rcPane,
- dwPaneStyle,
- hIcon,
- sPaneText,
- nDrawTextFlags,
- clrText,
- pStatusBar,
- lParam
- );
- bool bDisabled = ( ( dwPaneStyle & SBPS_DISABLED ) != 0 ) ? true : false;
- CRect rectPane( rcPane );
- rectPane.DeflateRect( 1, 1 );
- CRect rcText( rectPane );
- if( hIcon != NULL )
- {
- CExtCmdIcon _icon;
- _icon.AssignFromHICON( hIcon, true );
- CSize sizeIcon = _icon.GetSize();
- rcText.left += sizeIcon.cx + 1;
- _icon.Paint(
- const_cast < CExtPaintManagerOffice2007_Impl * > ( this ),
- dc,
- rectPane.left,
- rectPane.top + ( rectPane.Height() - sizeIcon.cy ) / 2,
- -1,
- -1
- );
- } // if( hIcon != NULL )
-
- int nPaneTextLen = (sPaneText == NULL) ? int(0) : int(_tcslen(sPaneText));
- if( ( !bDisabled )
- || ( bDisabled && ( !pStatusBar->m_bHideTextOnDisabledPanes ) )
- && nPaneTextLen > 0
- )
- { // if text painting is allowed
- if( rcText.right > rcText.left )
- {
- COLORREF clrStatusPaneTextColor =
- ( clrText != COLORREF(-1L) )
- ? clrText
- : bDisabled
- ? m_clrStatusPaneTextColorDisabled
- : m_clrStatusPaneTextColorNormal;
- if( clrStatusPaneTextColor != COLORREF(-1L) )
- {
- COLORREF clrTextRestore = dc.SetTextColor( clrStatusPaneTextColor );
- dc.DrawText(
- LPCTSTR(sPaneText),
- nPaneTextLen,
- &rcText,
- nDrawTextFlags
- );
- if( clrTextRestore != COLORREF(-1L) )
- dc.SetTextColor( clrTextRestore );
- } // if( clrStatusPaneTextColor != COLORREF(-1L) )
- } // if( rcText.right > rcText.left )
- } // if text painting is allowed
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::StatusBar_QuerySkinSupport(
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pStatusBar );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::StatusBar_QuerySkinSupport(
- pStatusBar,
- lParam
- );
-
- return true;
- }
- #endif // (!defined __EXT_MFC_NO_STATUSBAR)
- bool CExtPaintManagerOffice2007_Impl::NcFrame_IsSupported(
- const CWnd * pWnd,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- lParam;
- if( pWnd == NULL )
- return false;
- //ASSERT_VALID( pWnd );
- if( pWnd->GetSafeHwnd() == NULL )
- return false;
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::NcFrame_IsSupported(
- pWnd,
- lParam
- );
- //DWORD dwStyle = pWnd->GetStyle();
- // if( (dwStyle&WS_CHILD) != 0 )
- // return false;
- return true;
- }
- HRGN CExtPaintManagerOffice2007_Impl::NcFrame_GenerateSkinFrameRGN(
- const RECT & rcWnd,
- const CWnd * pWnd,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( pWnd );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::NcFrame_GenerateSkinFrameRGN(
- rcWnd,
- pWnd,
- lParam
- );
-
- if( pWnd->GetSafeHwnd() != NULL
- && (pWnd->GetStyle()&WS_CHILD) == 0
- && pWnd->IsZoomed()
- )
- return ( (HRGN)NULL );
- CRect rcThemePadding = m_rcNcFrameBordersActive;
- rcThemePadding.top += m_nCaptionHeightActive;
- bool bRTL = false; //( (pWnd->GetExStyle()&WS_EX_LAYOUTRTL) != 0 ) ? true : false;
- HRGN hRgn =
- m_bmpNcFrameActive.GenerateSkinFrameAlphaRGN(
- bRTL,
- rcWnd,
- rcThemePadding
- );
- return hRgn;
- }
- void CExtPaintManagerOffice2007_Impl::NcFrame_GetMetrics(
- RECT & rcNcBorders,
- RECT & rcThemePadding,
- const CWnd * pWnd,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( NcFrame_IsSupported( pWnd ) );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::NcFrame_GetMetrics(
- rcNcBorders,
- rcThemePadding,
- pWnd,
- lParam
- );
- return;
- }
-
- if( pWnd->GetSafeHwnd() != NULL
- && (pWnd->GetStyle()&WS_CHILD) == 0
- && pWnd->IsZoomed()
- )
- {
- ::SetRect( &rcNcBorders, 0, 0, 0, 0 );
- ::SetRect( &rcThemePadding, 0, 0, 0, 0 );
- }
- else
- {
- rcNcBorders = m_rcNcFrameBordersActive;
- rcThemePadding = m_rcNcFrameBordersActive;
- }
- INT nCaptionHeightActive = m_nCaptionHeightActive;
- nCaptionHeightActive = UiScalingDo( nCaptionHeightActive, __EUIST_Y );
- rcThemePadding.top += nCaptionHeightActive;
- //DWORD dwStyleEx = pWnd->GetExStyle();
- //bool bRTL = ( (dwStyleEx&WS_EX_LAYOUTRTL) != 0 ) ? true : false;
- // if( bRTL )
- // {
- // __EXT_MFC_SwapLeftRight( &rcNcBorders );
- // __EXT_MFC_SwapLeftRight( &rcThemePadding );
- // }
- }
- CRect CExtPaintManagerOffice2007_Impl::NcFrame_GetHtRect(
- UINT nHT,
- bool bScreenMapping,
- bool bLayoutBordersH,
- bool bLayoutBordersV,
- const CExtCmdIcon * pIcon,
- const CWnd * pWnd,
- LPMINMAXINFO pMinMaxInfo, // = NULL
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( NcFrame_IsSupported( pWnd ) );
- if( IsHighContrast() )
- return
- CExtPaintManagerXP::NcFrame_GetHtRect(
- nHT,
- bScreenMapping,
- bLayoutBordersH,
- bLayoutBordersV,
- pIcon,
- pWnd,
- pMinMaxInfo,
- lParam
- );
- CRect rcNcBorders, rcThemePadding;
- NcFrame_GetMetrics(
- rcNcBorders,
- rcThemePadding,
- pWnd,
- lParam
- );
- CRect rcWnd;
- pWnd->GetWindowRect( &rcWnd );
- if( ! bScreenMapping )
- rcWnd.OffsetRect( -rcWnd.TopLeft() );
- bool bMaximizedMode = false;
- if( ( ! g_PaintManager.m_DWM.IsCompositionEnabled() )
- && (pWnd->GetStyle()&WS_CHILD) == 0
- && pWnd->IsZoomed()
- )
- bMaximizedMode = true;
- // rcWnd.InflateRect(
- // rcNcBorders.left,
- // rcNcBorders.top,
- // rcNcBorders.right,
- // rcNcBorders.bottom
- // );
- bool bZoomed = pWnd->IsZoomed()? true : false;
- bool bSupportsResizingH = bLayoutBordersH;
- bool bSupportsResizingV = bLayoutBordersV;
- DWORD dwWndStyle = pWnd->GetStyle();
- if( (dwWndStyle&WS_THICKFRAME) != 0
- && ( (! bSupportsResizingH )
- || (! bSupportsResizingV )
- )
- )
- {
- bool bHaveMinMaxInfo = false;
- MINMAXINFO _mmi;
- if( pMinMaxInfo != NULL )
- {
- bHaveMinMaxInfo = true;
- __EXT_MFC_MEMCPY(
- &_mmi,
- sizeof(MINMAXINFO),
- pMinMaxInfo,
- sizeof(MINMAXINFO)
- );
- } // if( pMinMaxInfo != NULL )
- else
- {
- ::memset( &_mmi, 0, sizeof(MINMAXINFO) );
- monitor_parms_t _mp;
- stat_GetMonitorParms( _mp, (CWnd*)pWnd );
- _mmi.ptMaxPosition.x = _mp.m_rcWorkArea.left;
- _mmi.ptMaxPosition.y = _mp.m_rcWorkArea.top;
- _mmi.ptMaxTrackSize.x = _mp.m_rcWorkArea.Width(); // ::GetSystemMetrics( SM_CXMAXTRACK );
- _mmi.ptMaxTrackSize.y = _mp.m_rcWorkArea.Height(); // ::GetSystemMetrics( SM_CYMAXTRACK );
- _mmi.ptMinTrackSize.x = ::GetSystemMetrics( SM_CXMINTRACK );
- _mmi.ptMinTrackSize.y = ::GetSystemMetrics( SM_CYMINTRACK );
- _mmi.ptMaxSize.x = _mmi.ptMaxTrackSize.x;
- _mmi.ptMaxSize.y = _mmi.ptMaxTrackSize.y;
- if( ((CWnd*)pWnd)->SendMessage( WM_GETMINMAXINFO, 0, LPARAM(&_mmi) ) == 0 )
- bHaveMinMaxInfo = true;
- } // else from if( pMinMaxInfo != NULL )
- if( bHaveMinMaxInfo )
- {
- if( _mmi.ptMinTrackSize.x < _mmi.ptMaxTrackSize.x )
- bSupportsResizingH = true;
- if( _mmi.ptMinTrackSize.y < _mmi.ptMaxTrackSize.y )
- bSupportsResizingV = true;
- } // if( bHaveMinMaxInfo )
- } // if( (dwWndStyle&WS_THICKFRAME) != 0 ...
- CRect rcPart( 0, 0, 0, 0 );
- bool bRtlEnabledHT = false;
- switch( nHT )
- {
- case HTSYSMENU:
- {
- if( (dwWndStyle&WS_SYSMENU) == 0 )
- break;
- int nIconAreaWidth = 0;
- if( pIcon != NULL && (! pIcon->IsEmpty() ) )
- nIconAreaWidth = UiScalingDo( pIcon->GetSize().cx + 2, __EUIST_Y );
- bRtlEnabledHT = true;
- rcPart.SetRect(
- rcWnd.left + (bZoomed ? 0 : ( bSupportsResizingH ? rcNcBorders.left : 0 ) ),
- rcWnd.top + (bZoomed ? 0 : ( bSupportsResizingV ? rcNcBorders.top : 0 ) ),
- rcWnd.left + (bZoomed ? 0 : ( bSupportsResizingH ? rcNcBorders.left : 0 ) )
- + nIconAreaWidth,
- rcWnd.top + (bZoomed ? 0 : ( bSupportsResizingV ? rcNcBorders.top : 0 ) )
- + rcThemePadding.top
- );
- if( bMaximizedMode )
- rcPart.OffsetRect( 0, -m_rcNcFrameBordersActive.top );
- }
- break;
- case HTCAPTION:
- // if( (dwWndStyle&WS_CAPTION) == 0 )
- // break;
- rcPart.SetRect(
- rcWnd.left + (bZoomed ? 0 : ( bSupportsResizingH ? rcNcBorders.left : 0 ) ),
- rcWnd.top + (bZoomed ? 0 : ( bSupportsResizingV ? rcNcBorders.top : 0 ) ),
- rcWnd.right - (bZoomed ? 0 : ( bSupportsResizingH ? rcNcBorders.right : 0 ) ),
- rcWnd.top + rcThemePadding.top
- );
- if( bMaximizedMode )
- rcPart.OffsetRect( 0, -m_rcNcFrameBordersActive.top );
- break;
- case HTTOP:
- if( bZoomed || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.left + ( bSupportsResizingH ? rcNcBorders.left : 0 ),
- rcWnd.top,
- rcWnd.right - ( bSupportsResizingH ? rcNcBorders.right : 0 ),
- rcWnd.top + rcNcBorders.top
- );
- break;
- case HTBOTTOM:
- if( bZoomed || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.left + ( bSupportsResizingH ? rcNcBorders.left : 0 ),
- rcWnd.bottom - rcNcBorders.bottom,
- rcWnd.right - ( bSupportsResizingH ? rcNcBorders.right : 0 ),
- rcWnd.bottom
- );
- break;
- case HTLEFT:
- if( bZoomed || (! bSupportsResizingH ) )
- break;
- rcPart.SetRect(
- rcWnd.left,
- rcWnd.top + ( bSupportsResizingV ? rcNcBorders.top : 0 ),
- rcWnd.left + rcNcBorders.left,
- rcWnd.bottom - ( bSupportsResizingV ? rcNcBorders.bottom : 0 )
- );
- break;
- case HTRIGHT:
- if( bZoomed || (! bSupportsResizingH ) )
- break;
- rcPart.SetRect(
- rcWnd.right - rcNcBorders.right,
- rcWnd.top + ( bSupportsResizingV ? rcNcBorders.top : 0 ),
- rcWnd.right,
- rcWnd.bottom - ( bSupportsResizingV ? rcNcBorders.bottom : 0 )
- );
- break;
- case HTTOPLEFT:
- if( bZoomed || (! bSupportsResizingH ) || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.left,
- rcWnd.top,
- rcWnd.left + rcNcBorders.left,
- rcWnd.top + rcNcBorders.top
- );
- break;
- case HTTOPRIGHT:
- if( bZoomed || (! bSupportsResizingH ) || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.right - rcNcBorders.right,
- rcWnd.top,
- rcWnd.right,
- rcWnd.top + rcNcBorders.top
- );
- break;
- case HTBOTTOMLEFT:
- if( bZoomed || (! bSupportsResizingH ) || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.left,
- rcWnd.bottom - rcNcBorders.bottom,
- rcWnd.left + rcNcBorders.left,
- rcWnd.bottom
- );
- break;
- case HTBOTTOMRIGHT:
- if( bZoomed || (! bSupportsResizingH ) || (! bSupportsResizingV ) )
- break;
- rcPart.SetRect(
- rcWnd.right - rcNcBorders.right,
- rcWnd.bottom - rcNcBorders.bottom,
- rcWnd.right,
- rcWnd.bottom
- );
- break;
- } // switch( nHT )
- if( bRtlEnabledHT && ( ! rcPart.IsRectEmpty() ) )
- {
- bool bRTL = ( (pWnd->GetExStyle()&WS_EX_LAYOUTRTL) != 0 ) ? true : false;
- if( bRTL )
- {
- CRect rcWnd;
- pWnd->GetWindowRect( &rcWnd );
- rcWnd.OffsetRect( -rcWnd.TopLeft() );
- ::SetRect(
- &rcPart,
- rcWnd.right - 1 - rcPart.right,
- rcPart.top,
- rcWnd.right - 1 - rcPart.left,
- rcPart.bottom
- );
- } // if( bRTL )
- } // if( bRtlEnabledHT && ( ! rcPart.IsRectEmpty() ) )
- return rcPart;
- }
- void CExtPaintManagerOffice2007_Impl::NcFrame_Paint(
- CDC & dc,
- const CExtCmdIcon * pIcon,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- UINT nDrawTextAlignFlags,
- const RECT & rcFrame,
- const RECT & rcClient,
- const RECT & rcIcon,
- const RECT & rcText,
- const RECT & rcHelp,
- const RECT & rcMinimize,
- const RECT & rcMaximizeRestore,
- const RECT & rcClose,
- bool bFrameActive,
- bool bFrameEnabled,
- bool bFrameMaximized,
- CExtPaintManager::e_nc_button_state_t eStateButtonHelp,
- CExtPaintManager::e_nc_button_state_t eStateButtonMinimize,
- CExtPaintManager::e_nc_button_state_t eStateButtonMaximizeRestore,
- CExtPaintManager::e_nc_button_state_t eStateButtonClose,
- const CWnd * pWnd,
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::NcFrame_Paint(
- dc, pIcon, strCaption, nDrawTextAlignFlags, rcFrame, rcClient, rcIcon, rcText,
- rcHelp, rcMinimize, rcMaximizeRestore, rcClose, bFrameActive, bFrameEnabled, bFrameMaximized,
- eStateButtonHelp, eStateButtonMinimize, eStateButtonMaximizeRestore, eStateButtonClose,
- pWnd, lParam
- );
- return;
- }
- int nOldStretchBltMode = ::GetStretchBltMode( dc.m_hDC );
- ::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
- const CExtBitmap & _bmpNcFrame = bFrameActive ? m_bmpNcFrameActive : m_bmpNcFrameInactive;
- const CRect & rcPadding = bFrameActive ? m_rcNcFrameBordersActive : m_rcNcFrameBordersInactive;
- const INT nCaptionHeightSrc = bFrameActive ? m_nCaptionHeightActive : m_nCaptionHeightInactive;
- const INT nCaptionHeightDst = UiScalingDo( nCaptionHeightSrc, __EUIST_Y );
- CRect _rcFrame = rcFrame;
- CRect _rcText = rcText;
- bool bZoomed = pWnd->IsZoomed()? true : false;
- if( bZoomed && ( ! g_PaintManager.m_DWM.IsCompositionEnabled() ) )
- {
- _rcText.top += rcPadding.top;
- _rcText.bottom += rcPadding.top;
- _rcFrame.top -= rcPadding.top;
- _rcFrame.left -= rcPadding.left;
- _rcFrame.right += rcPadding.right;
- }
- _bmpNcFrame.DrawNcFrame( dc.m_hDC, _rcFrame, rcPadding, nCaptionHeightDst, nCaptionHeightSrc );
- if( pIcon != NULL
- && (! pIcon->IsEmpty() )
- && ( ! ::IsRectEmpty( &rcIcon ) )
- && dc.RectVisible( &rcIcon )
- )
- {
- CSize _sizeIconArea( rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top );
- CSize _sizeIconSurface = pIcon->GetSize();
- bool bDrawDefaultIconSize = true;
- if( _sizeIconSurface != _sizeIconArea )
- {
- CExtCmdIcon _icon;
- _icon = *pIcon;
- if( ! _icon.IsEmpty() )
- {
- _icon.Scale( _sizeIconArea );
- if( ! _icon.IsEmpty() )
- {
- bDrawDefaultIconSize = false;
- _icon.Paint(
- const_cast < CExtPaintManagerOffice2007_Impl * > ( this ),
- dc.m_hDC,
- rcIcon.left,
- rcIcon.top,
- _sizeIconArea.cx,
- _sizeIconArea.cy
- );
- } // if( ! _icon.IsEmpty() )
- } // if( ! _icon.IsEmpty() )
- } // if( _sizeIconSurface != _sizeIconArea )
- if( bDrawDefaultIconSize )
- pIcon->Paint(
- const_cast < CExtPaintManagerOffice2007_Impl * > ( this ),
- dc.m_hDC,
- rcIcon.left,
- rcIcon.top,
- -1,
- -1
- );
- }
- COLORREF colorFrameText = bFrameActive ? m_clrNcFrameTextActive : m_clrNcFrameTextInactive;
- if( colorFrameText != COLORREF(-1L) )
- {
- int nLenCaption = int( ( strCaption == NULL ) ? 0 : _tcslen( strCaption ) );
- if( nLenCaption > 0
- && ( ! ::IsRectEmpty( &_rcText ) )
- && dc.RectVisible( &rcText )
- )
- {
- UINT _nDrawTextAlignFlags = nDrawTextAlignFlags;
- if( pWnd->GetSafeHwnd() != NULL
- && (pWnd->GetExStyle()&WS_EX_LAYOUT_RTL) != 0
- && (nDrawTextAlignFlags&DT_CENTER) == 0
- )
- {
- _nDrawTextAlignFlags &= ~(DT_LEFT|DT_CENTER|DT_RIGHT);
- if( (nDrawTextAlignFlags&DT_RIGHT) != 0 )
- _nDrawTextAlignFlags |= DT_LEFT;
- else
- _nDrawTextAlignFlags |= DT_RIGHT;
- _nDrawTextAlignFlags |= DT_RTLREADING;
- }
- COLORREF clrOldText = dc.SetTextColor( colorFrameText );
- CFont * pOldFont = dc.SelectObject( (CFont*)&m_FontCaption );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- dc.DrawText(
- strCaption,
- nLenCaption,
- (LPRECT)&_rcText,
- _nDrawTextAlignFlags|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX
- );
- dc.SetBkMode( nOldBkMode );
- dc.SelectObject( pOldFont );
- dc.SetTextColor( clrOldText );
- }
- } // if( colorFrameText != COLORREF(-1L) )
- static const RECT rcZeroPadding = { 0, 0, 0, 0 };
- if( ( ! ::IsRectEmpty( &rcHelp ) )
- && dc.RectVisible( &rcHelp )
- )
- {
- //LPCTSTR strGlyph = stat_NcFrameButton_NameFromState( eStateButtonHelp );
- //const CExtSkinGlyph & glyph = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Help")][strFrameActive].Glyph(strGlyph);
- //glyph.Draw( dc.m_hDC, rcHelp );
- INT nIndexInArray = bFrameActive ? m_nNcBtnIdxNormalActive : m_nNcBtnIdxNormalInactive;
- if( eStateButtonHelp == __ENCBS_HOVER )
- {
- m_bmpNcButtonBkHover.AlphaBlendSkinParts( dc.m_hDC, rcHelp, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxHover;
- }
- else if( eStateButtonHelp == __ENCBS_PRESSED )
- {
- m_bmpNcButtonBkPressed.AlphaBlendSkinParts( dc.m_hDC, rcHelp, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxPressed;
- }
- else if( eStateButtonHelp == __ENCBS_DISABLED )
- nIndexInArray = m_nNcBtnIdxDisabled;
- CRect rcSrc( 0, 0, m_sizeNcButtonShapeInArr.cx, m_sizeNcButtonShapeInArr.cy );
- rcSrc.OffsetRect( 0, m_sizeNcButtonShapeInArr.cy * nIndexInArray );
- m_bmpArrNcButtonsHelp.AlphaBlendSkinParts(
- dc.m_hDC,
- rcHelp,
- rcSrc,
- rcZeroPadding,
- ( g_PaintManager.m_nLPZ == 96 ) ? ( CExtBitmap::__EDM_CENTER ) : ( CExtBitmap::__EDM_STRETCH ),
- true,
- true
- );
- }
- if( ( ! ::IsRectEmpty( &rcMinimize ) )
- && dc.RectVisible( &rcMinimize )
- )
- {
- //LPCTSTR strGlyph = stat_NcFrameButton_NameFromState( eStateButtonMinimize );
- //const CExtSkinGlyph & glyph = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Minimize")][strFrameActive].Glyph(strGlyph);
- //glyph.Draw( dc.m_hDC, rcMinimize );
- INT nIndexInArray = bFrameActive ? m_nNcBtnIdxNormalActive : m_nNcBtnIdxNormalInactive;
- if( eStateButtonMinimize == __ENCBS_HOVER )
- {
- m_bmpNcButtonBkHover.AlphaBlendSkinParts( dc.m_hDC, rcMinimize, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxHover;
- }
- else if( eStateButtonMinimize == __ENCBS_PRESSED )
- {
- m_bmpNcButtonBkPressed.AlphaBlendSkinParts( dc.m_hDC, rcMinimize, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxPressed;
- }
- else if( eStateButtonMinimize == __ENCBS_DISABLED )
- nIndexInArray = m_nNcBtnIdxDisabled;
- CRect rcSrc( 0, 0, m_sizeNcButtonShapeInArr.cx, m_sizeNcButtonShapeInArr.cy );
- rcSrc.OffsetRect( 0, m_sizeNcButtonShapeInArr.cy * nIndexInArray );
- const CExtBitmap & _bmpMin = ( pWnd != NULL && pWnd->IsIconic() ) ? m_bmpArrNcButtonsRestore : m_bmpArrNcButtonsMinimize;
- _bmpMin.AlphaBlendSkinParts(
- dc.m_hDC,
- rcMinimize,
- rcSrc,
- rcZeroPadding,
- ( g_PaintManager.m_nLPZ == 96 ) ? ( CExtBitmap::__EDM_CENTER ) : ( CExtBitmap::__EDM_STRETCH ),
- true,
- true
- );
- }
- if( ( ! ::IsRectEmpty( &rcMaximizeRestore ) )
- && dc.RectVisible( &rcMaximizeRestore )
- )
- {
- //LPCTSTR strGlyph = stat_NcFrameButton_NameFromState( eStateButtonMaximizeRestore );
- //const CExtSkinGlyph & glyph = m_Skin[_T("Button")][_T("FrameNcButton")][ bFrameMaximized ? _T("Restore") : _T("Maximize") ][strFrameActive].Glyph(strGlyph);
- //glyph.Draw( dc.m_hDC, rcMaximizeRestore );
- INT nIndexInArray = bFrameActive ? m_nNcBtnIdxNormalActive : m_nNcBtnIdxNormalInactive;
- if( eStateButtonMaximizeRestore == __ENCBS_HOVER )
- {
- m_bmpNcButtonBkHover.AlphaBlendSkinParts( dc.m_hDC, rcMaximizeRestore, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxHover;
- }
- else if( eStateButtonMaximizeRestore == __ENCBS_PRESSED )
- {
- m_bmpNcButtonBkPressed.AlphaBlendSkinParts( dc.m_hDC, rcMaximizeRestore, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxPressed;
- }
- else if( eStateButtonMaximizeRestore == __ENCBS_DISABLED )
- nIndexInArray = m_nNcBtnIdxDisabled;
- CRect rcSrc( 0, 0, m_sizeNcButtonShapeInArr.cx, m_sizeNcButtonShapeInArr.cy );
- rcSrc.OffsetRect( 0, m_sizeNcButtonShapeInArr.cy * nIndexInArray );
- if( bFrameMaximized )
- m_bmpArrNcButtonsRestore.AlphaBlendSkinParts(
- dc.m_hDC,
- rcMaximizeRestore,
- rcSrc,
- rcZeroPadding,
- ( g_PaintManager.m_nLPZ == 96 ) ? ( CExtBitmap::__EDM_CENTER ) : ( CExtBitmap::__EDM_STRETCH ),
- true,
- true
- );
- else
- m_bmpArrNcButtonsMaximize.AlphaBlendSkinParts(
- dc.m_hDC,
- rcMaximizeRestore,
- rcSrc,
- rcZeroPadding,
- ( g_PaintManager.m_nLPZ == 96 ) ? ( CExtBitmap::__EDM_CENTER ) : ( CExtBitmap::__EDM_STRETCH ),
- true,
- true
- );
- }
- if( ( ! ::IsRectEmpty( &rcClose ) )
- && dc.RectVisible( &rcClose )
- )
- {
- //LPCTSTR strGlyph = stat_NcFrameButton_NameFromState( eStateButtonClose );
- //const CExtSkinGlyph & glyph = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Close")][strFrameActive].Glyph(strGlyph);
- //glyph.Draw( dc.m_hDC, rcClose );
- INT nIndexInArray = bFrameActive ? m_nNcBtnIdxNormalActive : m_nNcBtnIdxNormalInactive;
- if( eStateButtonClose == __ENCBS_HOVER )
- {
- const CExtBitmap * pBmp = &m_bmpNcButtonBkHover;
- if( ! m_bmpNcButtonBkHoverX.IsEmpty() )
- pBmp = &m_bmpNcButtonBkHoverX;
- pBmp->AlphaBlendSkinParts( dc.m_hDC, rcClose, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxHover;
- }
- else if( eStateButtonClose == __ENCBS_PRESSED )
- {
- const CExtBitmap * pBmp = &m_bmpNcButtonBkPressed;
- if( ! m_bmpNcButtonBkPressedX.IsEmpty() )
- pBmp = &m_bmpNcButtonBkPressedX;
- pBmp->AlphaBlendSkinParts( dc.m_hDC, rcClose, m_rcNcButtonBkPadding, CExtBitmap::__EDM_STRETCH );
- nIndexInArray = m_nNcBtnIdxPressed;
- }
- else if( eStateButtonClose == __ENCBS_DISABLED )
- nIndexInArray = m_nNcBtnIdxDisabled;
- CRect rcSrc( 0, 0, m_sizeNcButtonShapeInArr.cx, m_sizeNcButtonShapeInArr.cy );
- rcSrc.OffsetRect( 0, m_sizeNcButtonShapeInArr.cy * nIndexInArray );
- m_bmpArrNcButtonsClose.AlphaBlendSkinParts(
- dc.m_hDC,
- rcClose,
- rcSrc,
- rcZeroPadding,
- ( g_PaintManager.m_nLPZ == 96 ) ? ( CExtBitmap::__EDM_CENTER ) : ( CExtBitmap::__EDM_STRETCH ),
- true,
- true
- );
- }
- ::SetStretchBltMode( dc.m_hDC, nOldStretchBltMode );
- }
- #define __EXT_MFC_SKINNED_CAPTION_TEXT_GAP 4
- void CExtPaintManagerOffice2007_Impl::NcFrame_GetRects(
- CExtCmdIcon * pIcon,
- __EXT_MFC_SAFE_LPCTSTR strCaption,
- UINT nDrawTextAlignFlags,
- RECT & rcIcon,
- RECT & rcText,
- RECT & rcHelp,
- RECT & rcMinimize,
- RECT & rcMaximizeRestore,
- RECT & rcClose,
- const CWnd * pWnd,
- LPMINMAXINFO pMinMaxInfo, // = NULL
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::NcFrame_GetRects(
- pIcon,
- strCaption,
- nDrawTextAlignFlags,
- rcIcon,
- rcText,
- rcHelp,
- rcMinimize,
- rcMaximizeRestore,
- rcClose,
- pWnd,
- pMinMaxInfo,
- lParam
- );
- return;
- }
-
- ::SetRectEmpty( &rcIcon );
- ::SetRectEmpty( &rcText );
- ::SetRectEmpty( &rcHelp );
- ::SetRectEmpty( &rcMinimize );
- ::SetRectEmpty( &rcMaximizeRestore );
- ::SetRectEmpty( &rcClose );
- ASSERT( NcFrame_IsSupported( pWnd ) );
- DWORD dwWndStyle = pWnd->GetStyle();
- // if( (dwWndStyle&WS_CAPTION) == 0 )
- // return;
- DWORD dwWndStyleEx = pWnd->GetExStyle();
- CRect rcNcBorders, rcThemePadding;
- NcFrame_GetMetrics(
- rcNcBorders,
- rcThemePadding,
- pWnd,
- lParam
- );
- CRect rcCaption =
- NcFrame_GetHtRect(
- HTCAPTION,
- false,
- true,
- true,
- pIcon,
- pWnd,
- pMinMaxInfo
- );
- CRect rc = rcCaption;
- ::CopyRect( &rcText, &rcCaption );
- bool bZoomed = pWnd->IsZoomed()? true : false;
- static const POINT g_ptZoomedButtonOffset = { -2, 5 };
- static const POINT g_ptZoomedIconAndTextOffset = { 4, 3 };
- if( (dwWndStyle&WS_SYSMENU) != 0 )
- {
- //LPCTSTR strFrameActive = _T("Active");
- //const CExtSkinGlyph & glyphClose = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Close")][strFrameActive].Glyph(_T("Normal"));
- CSize _sizeScClose(m_nCaptionHeightActive-2,m_nCaptionHeightActive-3); // = glyphClose.GetSize();
- _sizeScClose.cx = UiScalingDo( _sizeScClose.cx, __EUIST_Y );
- _sizeScClose.cy = UiScalingDo( _sizeScClose.cy, __EUIST_Y );
- CRect _rcOffsetScClose(0,0,0,0); // = glyphClose.GetOffset();
- rc.right -= bZoomed ? rcThemePadding.right : 1;
- rc.right -= _rcOffsetScClose.right;
- rc.left = rc.right - _sizeScClose.cx;
- rc.top = rcCaption.top + _rcOffsetScClose.top + ( bZoomed ? _rcOffsetScClose.bottom : 0 );
- rc.bottom = rc.top + _sizeScClose.cy;
- if( bZoomed )
- rc.OffsetRect( g_ptZoomedButtonOffset );
- ::CopyRect( &rcClose, &rc );
- rc.OffsetRect( -_sizeScClose.cx, 0 );
- rcText.right = rcCaption.right - __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- if( (dwWndStyle&WS_MAXIMIZEBOX) != 0 )
- {
- //const CExtSkinGlyph & glyphMaximize = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Maximize")][strFrameActive].Glyph(_T("Normal"));
- CSize _sizeScMaximize(m_nCaptionHeightActive-2,m_nCaptionHeightActive-3); // = glyphMaximize.GetSize();
- _sizeScMaximize.cx = UiScalingDo( _sizeScMaximize.cx, __EUIST_Y );
- _sizeScMaximize.cy = UiScalingDo( _sizeScMaximize.cy, __EUIST_Y );
- CRect _rcOffsetScMaximize(0,0,0,0); // = glyphMaximize.GetOffset();
- rc.right -= _rcOffsetScMaximize.right;
- rc.top = rcCaption.top + _rcOffsetScMaximize.top + ( bZoomed ? _rcOffsetScMaximize.bottom : 0 );
- rc.left = rc.right - _sizeScMaximize.cx;
- rc.bottom = rc.top + _sizeScMaximize.cy;
- if( bZoomed )
- rc.OffsetRect( g_ptZoomedButtonOffset );
- ::CopyRect( &rcMaximizeRestore, &rc );
- rc.OffsetRect( -_sizeScMaximize.cx, 0 );
- rcText.right = rcMaximizeRestore.left - __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- } // if( (dwWndStyle&WS_MAXIMIZEBOX) != 0 )
- if( (dwWndStyle&WS_MINIMIZEBOX) != 0 )
- {
- //const CExtSkinGlyph & glyphMinimize = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Minimize")][strFrameActive].Glyph(_T("Normal"));
- CSize _sizeScMinimize(m_nCaptionHeightActive-2,m_nCaptionHeightActive-3); // = glyphMinimize.GetSize();
- _sizeScMinimize.cx = UiScalingDo( _sizeScMinimize.cx, __EUIST_Y );
- _sizeScMinimize.cy = UiScalingDo( _sizeScMinimize.cy, __EUIST_Y );
- CRect _rcOffsetScMinimize(0,0,0,0); // = glyphMinimize.GetOffset();
- rc.right -= _rcOffsetScMinimize.right;
- rc.top = rcCaption.top + _rcOffsetScMinimize.top + ( bZoomed ? _rcOffsetScMinimize.bottom : 0 );
- rc.left = rc.right - _sizeScMinimize.cx;
- rc.bottom = rc.top + _sizeScMinimize.cy;
- if( bZoomed )
- rc.OffsetRect( g_ptZoomedButtonOffset );
- ::CopyRect( &rcMinimize, &rc );
- rc.OffsetRect( -_sizeScMinimize.cx, 0 );
- rcText.right = rcMinimize.left - __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- } // if( (dwWndStyle&WS_MINIMIZEBOX) != 0 )
- if( (dwWndStyleEx&WS_EX_CONTEXTHELP) != 0 )
- {
- //const CExtSkinGlyph & glyphHelp = m_Skin[_T("Button")][_T("FrameNcButton")][_T("Help")][strFrameActive].Glyph(_T("Normal"));
- CSize _sizeScHelp(m_nCaptionHeightActive-2,m_nCaptionHeightActive-3); // = glyphHelp.GetSize();
- _sizeScHelp.cx = UiScalingDo( _sizeScHelp.cx, __EUIST_Y );
- _sizeScHelp.cy = UiScalingDo( _sizeScHelp.cy, __EUIST_Y );
- CRect _rcOffsetScHelp(0,0,0,0); // = glyphHelp.GetOffset();
- rc.right -= _rcOffsetScHelp.right;
- rc.top = rcCaption.top + _rcOffsetScHelp.top + ( bZoomed ? _rcOffsetScHelp.bottom : 0 );
- rc.left = rc.right - _sizeScHelp.cx;
- rc.bottom = rc.top + _sizeScHelp.cy;
- if( bZoomed )
- rc.OffsetRect( g_ptZoomedButtonOffset );
- ::CopyRect( &rcHelp, &rc );
- rcText.right = rcHelp.left - __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- } // if( (dwWndStyleEx&WS_EX_CONTEXTHELP) != 0 )
- if( pIcon != NULL
- && (! pIcon->IsEmpty() )
- )
- {
- CSize _sizeIcon = pIcon->GetSize();
- if( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 )
- {
- _sizeIcon.cx = UiScalingDo( _sizeIcon.cx, __EUIST_Y );
- _sizeIcon.cy = UiScalingDo( _sizeIcon.cy, __EUIST_Y );
- int x = rcCaption.left + (bZoomed ? rcNcBorders.left : 0 );
- int y = rcCaption.top + ( rcCaption.Height() - _sizeIcon.cy ) / 2;
- ::SetRect(
- &rcIcon,
- x,
- y,
- x + _sizeIcon.cx,
- y + _sizeIcon.cy
- );
- if( bZoomed )
- ::OffsetRect(
- &rcIcon,
- g_ptZoomedIconAndTextOffset.x,
- g_ptZoomedIconAndTextOffset.y
- );
- rcText.left = rcIcon.right + __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- } // if( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 )
- else
- {
- rcText.left += __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- if( bZoomed )
- {
- rcText.left += g_ptZoomedIconAndTextOffset.x;
- //::OffsetRect( &rcText, 0, g_ptZoomedIconAndTextOffset.y );
- rcText.top += g_ptZoomedIconAndTextOffset.y;
- }
- }
- } // if( pIcon != NULL ...
- else
- {
- rcText.left += __EXT_MFC_SKINNED_CAPTION_TEXT_GAP + (bZoomed ? rcNcBorders.left : 0 );
- if( bZoomed )
- {
- rcText.left += g_ptZoomedIconAndTextOffset.x;
- //::OffsetRect( &rcText, 0, g_ptZoomedIconAndTextOffset.y );
- rcText.top += g_ptZoomedIconAndTextOffset.y;
- }
- }
- } // if( (dwWndStyle&WS_SYSMENU) != 0 )
- else
- {
- rcText.left += __EXT_MFC_SKINNED_CAPTION_TEXT_GAP + (bZoomed ? rcNcBorders.left : 0 );
- rcText.right -= __EXT_MFC_SKINNED_CAPTION_TEXT_GAP;
- if( bZoomed )
- {
- rcText.left += g_ptZoomedIconAndTextOffset.x;
- //::OffsetRect( &rcText, 0, g_ptZoomedIconAndTextOffset.y );
- rcText.top += g_ptZoomedIconAndTextOffset.y;
- rcText.top += m_rcNcFrameBordersActive.top;
- }
- }
- bool bRTL = ( (pWnd->GetExStyle()&WS_EX_LAYOUTRTL) != 0 ) ? true : false;
- if( bRTL )
- {
- CRect rcWnd;
- pWnd->GetWindowRect( &rcWnd );
- rcWnd.OffsetRect( -rcWnd.TopLeft() );
- ::SetRect(
- &rcIcon,
- rcWnd.right - 1 - rcIcon.right,
- rcIcon.top,
- rcWnd.right - 1 - rcIcon.left,
- rcIcon.bottom
- );
- ::SetRect(
- &rcText,
- rcWnd.right - 1 - rcText.right,
- rcText.top,
- rcWnd.right - 1 - rcText.left,
- rcText.bottom
- );
- ::SetRect(
- &rcHelp,
- rcWnd.right - 1 - rcHelp.right,
- rcHelp.top,
- rcWnd.right - 1 - rcHelp.left,
- rcHelp.bottom
- );
- ::SetRect(
- &rcMinimize,
- rcWnd.right - 1 - rcMinimize.right,
- rcMinimize.top,
- rcWnd.right - 1 - rcMinimize.left,
- rcMinimize.bottom
- );
- ::SetRect(
- &rcMaximizeRestore,
- rcWnd.right - 1 - rcMaximizeRestore.right,
- rcMaximizeRestore.top,
- rcWnd.right - 1 - rcMaximizeRestore.left,
- rcMaximizeRestore.bottom
- );
- ::SetRect(
- &rcClose,
- rcWnd.right - 1 - rcClose.right,
- rcClose.top,
- rcWnd.right - 1 - rcClose.left,
- rcClose.bottom
- );
- } // if( bRTL )
- }
- bool CExtPaintManagerOffice2007_Impl::OnQueryThemeColors(
- COLORREF *pclrFillHint,
- COLORREF *pclrAccentHint // = NULL
- )
- {
- ASSERT_VALID( this );
- if( pclrFillHint != NULL )
- *pclrFillHint = m_clrFillHint;
- if( pclrAccentHint != NULL )
- *pclrAccentHint = m_clrAccentHint;
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::OnQueryUseThemeColors() const
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::OnQueryUseThemeColors();
- return true;
- }
- bool CExtPaintManagerOffice2007_Impl::PaintDocumentClientAreaBkgnd(
- CDC & dc,
- CWnd * pWnd,
- LPARAM lParam // = NULL
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pWnd->GetSafeHwnd() != NULL && ::IsWindow(pWnd->GetSafeHwnd()) );
- if( IsHighContrast() )
- return CExtPaintManagerXP::PaintDocumentClientAreaBkgnd( dc, pWnd, lParam );
- bool bHaveBitmapDCA = false;
- if( (! m_bmpDCA.IsEmpty() )
- && m_clrDCA1 != COLORREF(-1L)
- && m_clrDCA2 != COLORREF(-1L)
- && m_clrDCA3 != COLORREF(-1L)
- )
- bHaveBitmapDCA = true;
- if( bHaveBitmapDCA || m_clrDCA_Solid != COLORREF(-1L) )
- {
- CRect rcClient;
- pWnd->GetClientRect( &rcClient );
- if( dc.RectVisible( &rcClient ) )
- {
- if( bHaveBitmapDCA )
- {
- CRect rcPadding(0,0,0,0);
- if( m_bDocumentClientAreaBkgndR2 )
- { // R2 style
- CSize _sizeBmpDCA = m_bmpDCA.GetSize();
- rcPadding.left = _sizeBmpDCA.cx - 8;
- CRect rcPaintGradient = rcClient;
- CRect rcPaintBmp = rcClient;
- rcPaintGradient.top = rcPaintBmp.bottom = rcPaintBmp.top + _sizeBmpDCA.cy;
- if( dc.RectVisible( &rcPaintBmp ) )
- m_bmpDCA.AlphaBlendSkinParts( dc.m_hDC, rcPaintBmp, rcPadding, CExtBitmap::__EDM_STRETCH, true, true );
- if( rcPaintGradient.bottom > rcPaintGradient.top && dc.RectVisible( &rcPaintGradient ) )
- stat_PaintGradientRect2steps( dc, rcPaintGradient, m_clrDCA1, m_clrDCA2, m_clrDCA3, true, 2, 3, 256 );
- } // R2 style
- else
- { // R1 style
- stat_PaintGradientRect2steps( dc, rcClient, m_clrDCA1, m_clrDCA2, m_clrDCA3, true, 2, 3, 256 );
- m_bmpDCA.AlphaBlendSkinParts( dc.m_hDC, rcClient, rcPadding, CExtBitmap::__EDM_TILE, true, true );
- } // R1 style
- } // if( bHaveBitmapDCA )
- else if( m_clrDCA_Solid != COLORREF(-1L) )
- {
- CRect rcClient;
- pWnd->GetClientRect( &rcClient );
- if( dc.RectVisible( &rcClient ) )
- dc.FillSolidRect( &rcClient, m_clrDCA_Solid );
- return true;
- } // else if( m_clrDCA_Solid != COLORREF(-1L) )
- } // if( dc.RectVisible( &rcClient ) )
- return true;
- } // if( bHaveBitmapDCA || m_clrDCA_Solid != COLORREF(-1L) )
- return CExtPaintManagerOffice2003::PaintDocumentClientAreaBkgnd( dc, pWnd, lParam );
- }
- bool CExtPaintManagerOffice2010_Impl::PaintDocumentClientAreaBkgnd(
- CDC & dc,
- CWnd * pWnd,
- LPARAM lParam // = NULL
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( pWnd->GetSafeHwnd() != NULL && ::IsWindow(pWnd->GetSafeHwnd()) );
- if( IsHighContrast() )
- return CExtPaintManagerXP::PaintDocumentClientAreaBkgnd( dc, pWnd, lParam );
- if( ! m_bmpDCA.IsEmpty() )
- {
- CRect rcClient;
- pWnd->GetClientRect( &rcClient );
- if( dc.RectVisible( &rcClient ) )
- {
- int nOldStretchBltMode = ::GetStretchBltMode( dc.m_hDC );
- ::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
- m_bmpDCA.Draw( dc.m_hDC, rcClient );
- ::SetStretchBltMode( dc.m_hDC, nOldStretchBltMode );
- } // if( dc.RectVisible( &rcClient ) )
- return true;
- } // if( ! m_bmpDCA.IsEmpty() )
- return CExtPaintManagerOffice2003::PaintDocumentClientAreaBkgnd( dc, pWnd, lParam );
- }
- bool CExtPaintManagerOffice2007_Impl::PaintDockerBkgnd(
- bool bClientMapping,
- CDC & dc,
- const CRect &rcDst,
- const CRect &rcWnd,
- LPARAM lParam // = NULL
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- return CExtPaintManagerXP::PaintDockerBkgnd( bClientMapping, dc, rcDst, rcWnd, lParam );
- if( ! m_bUseNcFrameBmpForDockerBkgnd )
- return CExtPaintManagerOffice2003::PaintDockerBkgnd( bClientMapping, dc, rcDst, rcWnd, lParam );
- int nOldStretchBltMode = ::GetStretchBltMode( dc.m_hDC );
- ::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
- CSize _size = m_bmpNcFrameActive.GetSize();
- CRect rcSrc(
- m_rcNcFrameBordersActive.left,
- m_rcNcFrameBordersActive.top + m_nCaptionHeightActive,
- _size.cx - m_rcNcFrameBordersActive.right,
- _size.cy - m_rcNcFrameBordersActive.bottom
- );
- if( g_PaintManager.m_bIsWin2000orLater )
- {
- if( m_bmpNcFrameActive.Draw( dc.m_hDC, rcDst, rcSrc ) == GDI_ERROR )
- CExtPaintManagerOffice2003::PaintDockerBkgnd( bClientMapping, dc, rcDst, rcWnd, lParam );
- }
- else
- {
- if( m_bmpNcFrameActive.AlphaBlend( dc.m_hDC, rcDst.left, rcDst.top, rcDst.Width(), rcDst.Height(), rcSrc.left, rcSrc.top, rcSrc.Width(), rcSrc.Height() ) == GDI_ERROR )
- CExtPaintManagerOffice2003::PaintDockerBkgnd( bClientMapping, dc, rcDst, rcWnd, lParam );
- }
- ::SetStretchBltMode( dc.m_hDC, nOldStretchBltMode );
- return true;
- }
- void CExtPaintManagerOffice2007_Impl::PaintSeparator(
- CDC & dc,
- const RECT & rectItem,
- bool bHorz,
- bool bTransparentBk,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintSeparator(
- dc,
- rectItem,
- bHorz,
- bTransparentBk,
- pHelperSrc,
- lParam
- );
- return;
- }
- if( pHelperSrc == NULL
- || (!( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
- || pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtBarButton))
- #ifndef __EXT_MFC_NO_STATUSBAR
- || pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtStatusControlBar))
- #endif // __EXT_MFC_NO_STATUSBAR
- ))
- || ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
- )
- {
- CExtPaintManagerXP::PaintSeparator(
- dc,
- rectItem,
- bHorz,
- bTransparentBk,
- pHelperSrc,
- lParam
- );
- return;
- }
- CRect rectItem2(rectItem);
- if( !bTransparentBk )
- dc.FillSolidRect(
- rectItem2,
- GetColor( CLR_3DFACE_OUT, pHelperSrc, lParam )
- );
- COLORREF clrBtnShadow = GetColor( _2003CLR_SEPARATOR_DARK, pHelperSrc, lParam );
- COLORREF clrBtnHilight = GetColor( _2003CLR_SEPARATOR_LIGHT, pHelperSrc, lParam );
- if( bHorz )
- {
- int x = (rectItem2.left + rectItem2.right) / 2;
- rectItem2.left = x-1; rectItem2.right = x+1;
- if( pHelperSrc == NULL
- #ifndef __EXT_MFC_NO_STATUSBAR
- || (! pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtStatusControlBar)) )
- #endif // __EXT_MFC_NO_STATUSBAR
- )
- rectItem2.DeflateRect( 0, 1, 0, 1 );
- dc.Draw3dRect(
- rectItem2,
- clrBtnShadow,
- clrBtnHilight
- );
- } // if( bHorz )
- else
- {
- int y = (rectItem2.top+rectItem2.bottom)/2;
- rectItem2.top = y-1; rectItem2.bottom = y+1;
- if( pHelperSrc == NULL
- #ifndef __EXT_MFC_NO_STATUSBAR
- || (! pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtStatusControlBar)) )
- #endif // __EXT_MFC_NO_STATUSBAR
- )
- rectItem2.DeflateRect( 2, 0, 2, 0 );
- dc.Draw3dRect(
- rectItem2,
- clrBtnShadow,
- clrBtnHilight
- );
- } // else from if( bHorz )
- }
- COLORREF CExtPaintManagerOffice2007_R2_Obsidian::QueryObjectTextColor(
- CDC & dc,
- bool bEnabled,
- bool bFocused,
- bool bHovered,
- bool bPressed,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::QueryObjectTextColor( dc, bEnabled, bFocused, bHovered, bPressed, pHelperSrc, lParam );
- if( pHelperSrc != NULL )
- {
- if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtButton)) )
- {
- if( bEnabled )
- {
- if( bPressed )
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorPressed();
- if( clr != COLORREF(-1L) )
- return clr;
- }
- else if( bHovered )
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorHover();
- if( clr != COLORREF(-1L) )
- return clr;
- }
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorNormal();
- if( clr != COLORREF(-1L) )
- return clr;
- } // if( bEnabled )
- else
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorDisabled();
- if( clr != COLORREF(-1L) )
- return clr;
- } // else from if( bEnabled )
- } // if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtButton)) )
- else if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtGroupBox)) )
- {
- COLORREF clr = ((CExtGroupBox*)pHelperSrc)->GetTextColor( bEnabled );
- if( clr != COLORREF(-1L) )
- return clr;
- }
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- else if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtTabWnd)) )
- {
- if( bEnabled )
- return COLORREF( -1L );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CTRL)
- if( bEnabled )
- return RGB(255,255,255);
- else
- return RGB(141,141,141);
- }
- return CExtPaintManagerOffice2007_Impl::QueryObjectTextColor( dc, bEnabled, bFocused, bHovered, bPressed, pHelperSrc, lParam );
- }
- COLORREF CExtPaintManagerOffice2010_R2_Black::QueryObjectTextColor(
- CDC & dc,
- bool bEnabled,
- bool bFocused,
- bool bHovered,
- bool bPressed,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::QueryObjectTextColor( dc, bEnabled, bFocused, bHovered, bPressed, pHelperSrc, lParam );
- if( pHelperSrc != NULL )
- {
- if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtButton)) )
- {
- if( bEnabled )
- {
- if( bPressed )
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorPressed();
- if( clr != COLORREF(-1L) )
- return clr;
- }
- else if( bHovered )
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorHover();
- if( clr != COLORREF(-1L) )
- return clr;
- }
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorNormal();
- if( clr != COLORREF(-1L) )
- return clr;
- } // if( bEnabled )
- else
- {
- COLORREF clr = ((CExtButton*)pHelperSrc)->GetTextColorDisabled();
- if( clr != COLORREF(-1L) )
- return clr;
- } // else from if( bEnabled )
- } // if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtButton)) )
- else if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtGroupBox)) )
- {
- COLORREF clr = ((CExtGroupBox*)pHelperSrc)->GetTextColor( bEnabled );
- if( clr != COLORREF(-1L) )
- return clr;
- }
- #if (!defined __EXT_MFC_NO_TAB_CTRL)
- else if( pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtTabWnd)) )
- {
- if( bEnabled )
- return COLORREF( -1L );
- }
- #endif // (!defined __EXT_MFC_NO_TAB_CTRL)
- if( bEnabled )
- return RGB(220,220,220);
- else
- return RGB(141,141,141);
- }
- return CExtPaintManagerOffice2007_Impl::QueryObjectTextColor( dc, bEnabled, bFocused, bHovered, bPressed, pHelperSrc, lParam );
- }
- void CExtPaintManagerOffice2007_Impl::PaintGripper(
- CDC & dc,
- CExtPaintManager::PAINTGRIPPERDATA & _pgd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintGripper(
- dc,
- _pgd
- );
- return;
- }
- if( (! ( _pgd.m_bSideBar || _pgd.m_bFloating ) )
- || _pgd.m_pHelperSrc == NULL
- || (!(
- _pgd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtControlBar))
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- || _pgd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtDynAutoHideSlider))
- #endif
- || _pgd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd))
- ))
- || ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
- )
- {
- CExtPaintManagerOffice2003::PaintGripper( dc, _pgd );
- return;
- }
- if( _pgd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtMiniDockFrameWnd)) )
- {
- CExtControlBar * pBar = ((CExtMiniDockFrameWnd*)_pgd.m_pHelperSrc)->GetControlBarExt();
- if( pBar == NULL )
- {
- CExtPaintManagerOffice2003::PaintGripper( dc, _pgd );
- return;
- }
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- #ifdef __FREIWALD_ORIGINAL__
- #else
- if ((pBar != NULL) && (!pBar->IsKindOf(RUNTIME_CLASS(CExtDynTabControlBar))))
- #endif
- #endif
- if( pBar->IsFixedMode()
- || pBar->IsKindOf( RUNTIME_CLASS(CExtDynControlBar) )
- )
- {
- _pgd.m_bFloating = true;
- _pgd.m_bSideBar = false;
- _pgd.m_bActive = false;
- }
- }
- CRect rectGripper2( _pgd.m_rcGripper );
- if( _pgd.m_bFlashCaptionHighlightedState )
- {
- ASSERT( _pgd.m_clrFlashCaptionBackground != COLORREF(-1L) );
- ASSERT( _pgd.m_clrFlashCaptionText != COLORREF(-1L) );
- dc.FillSolidRect(
- rectGripper2,
- _pgd.m_clrFlashCaptionBackground
- );
- } // if( _pgd.m_bFlashCaptionHighlightedState )
- else if( ! _pgd.m_bHelperNoFill )
- {
- if( _pgd.m_bFloating
- && (!_pgd.m_bSideBar)
- && m_clrFloatingToolbarGripperSolid != COLORREF(-1L)
- )
- {
- dc.FillSolidRect( &rectGripper2, m_clrFloatingToolbarGripperSolid );
- }
- else
- {
- if( _pgd.m_bActive )
- stat_PaintGradientRect(
- dc,
- &rectGripper2,
- GetColor( _2003CLR_BTN_HP_LEFT, _pgd.m_pHelperSrc, _pgd.m_lParam ),
- GetColor( _2003CLR_BTN_HP_RIGHT, _pgd.m_pHelperSrc, _pgd.m_lParam ),
- (!_pgd.m_bHorz)
- );
- else
- OnPaintToolBarGradient( dc, rectGripper2, (!_pgd.m_bHorz), _pgd.m_pHelperSrc, _pgd.m_lParam );
- }
- }
- int nTextLen = 0;
- if( _pgd.m_sCaption != NULL
- && ( nTextLen = int(_tcslen(_pgd.m_sCaption)) ) > 0
- && (! _pgd.m_rcText.IsRectEmpty() )
- && _pgd.m_rcText.right > _pgd.m_rcText.left
- && _pgd.m_rcText.bottom > _pgd.m_rcText.top
- )
- {
- COLORREF clrText =
- _pgd.m_bFlashCaptionHighlightedState
- ? _pgd.m_clrFlashCaptionText
- : (
- _pgd.m_bSideBar
- ? ( _pgd.m_bActive
- ? m_clrDockingFrameCaptionTextActive
- : m_clrDockingFrameCaptionTextInactive
- )
- : m_clrDockingFrameCaptionTextFloatingFixed
- )
- ;
- COLORREF clrOldText = dc.SetTextColor( clrText );
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- CFont * pCurrFont =
- (! _pgd.m_bHorz)
- ? &m_FontBoldBC
- : &m_FontBoldVertXBC;
- CFont * pOldFont =
- dc.SelectObject( pCurrFont );
- ASSERT( pOldFont != NULL );
- if( !_pgd.m_bHorz )
- { // if text is horizontal
- bool bFloatingFixedBar = false;
- UINT nDtAlign = _pgd.m_bForceRTL ? DT_RIGHT : DT_LEFT;
- if( _pgd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) ) )
- {
- CExtControlBar * pBar =
- ((CExtMiniDockFrameWnd *)_pgd.m_pHelperSrc)->GetControlBarExt();
- if( pBar != NULL
- && pBar->IsFixedMode()
- )
- bFloatingFixedBar = true;
- }
- if( bFloatingFixedBar )
- {
- CExtSafeString sCaption( _pgd.m_sCaption );
- INT nAvailableWidth = _pgd.m_rcText.Width();
- for(;;)
- {
- INT nWidth =
- stat_CalcTextWidth(
- dc,
- *pCurrFont,
- sCaption
- );
- if( nAvailableWidth >= nWidth
- || sCaption.IsEmpty()
- )
- break;
- sCaption.Delete( sCaption.GetLength() - 1 );
- }
- if( sCaption.GetLength() > 0 )
- dc.DrawText(
- sCaption,
- sCaption.GetLength(),
- (LPRECT)&_pgd.m_rcText,
- nDtAlign|DT_SINGLELINE|DT_VCENTER|DT_NOCLIP
- );
- } // if( bFloatingFixedBar )
- else
- {
- dc.DrawText(
- _pgd.m_sCaption,
- nTextLen,
- (LPRECT)&_pgd.m_rcText,
- nDtAlign|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS
- );
- } // else if( bFloatingFixedBar )
- } // if text is horizontal
- else
- { // if text is vertical
- LOGFONT lf;
- ::memset(&lf,0,sizeof(LOGFONT));
- pCurrFont->GetLogFont(&lf);
- int _cyHorzFont = abs(lf.lfHeight);
- int _cyTextMargin =
- (_pgd.m_rcText.Width() - _cyHorzFont) / 2
- ;
- CRect rcString =
- CRect(
- CPoint(
- _pgd.m_rcText.left + _cyTextMargin - __ExtMfc_CXTEXTMARGIN,
- _pgd.m_rcText.bottom - __ExtMfc_CYTEXTMARGIN
- ),
- _pgd.m_rcText.Size() //m_sizeHorz
- );
- rcString.DeflateRect(2,2);
- CRect rcExclude;
- rcExclude.SetRect(
- _pgd.m_rcGripper.left,
- _pgd.m_rcGripper.top,
- _pgd.m_rcGripper.right,
- _pgd.m_rcText.top
- );
- dc.ExcludeClipRect( &rcExclude );
- rcString.OffsetRect( -2, -3 );
- dc.DrawText(
- _pgd.m_sCaption,
- nTextLen,
- rcString,
- DT_SINGLELINE //|DT_CENTER|DT_VCENTER
- |DT_NOCLIP |DT_NOPREFIX
- ); // don't forget DT_NOCLIP
- //dc.IntersectClipRect( &rectGripper );
- dc.SelectClipRgn(NULL);
- } // if text is vertical
- dc.SelectObject( pOldFont );
- dc.SetBkMode(nOldBkMode);
- dc.SetTextColor(clrOldText);
- }
- }
- void CExtPaintManagerOffice2007_Impl::PaintDockingFrame(
- CDC & dc,
- CExtPaintManager::PAINTDOCKINGFRAMEDATA & _pdfd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( _pdfd.m_rcWindow.IsRectEmpty() )
- return;
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintDockingFrame(
- dc,
- _pdfd
- );
- return;
- }
- if( _pdfd.m_pHelperSrc == NULL
- || (! ( ( _pdfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtControlBar) )
- && (! ((CExtControlBar*)_pdfd.m_pHelperSrc)->IsFixedMode() )
- )
- || _pdfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) )
- )
- )
- || ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
- )
- {
- CExtPaintManagerOffice2003::PaintDockingFrame(
- dc,
- _pdfd
- );
- return;
- }
- dc.ExcludeClipRect( _pdfd.m_rcClient );
- CRect rcWnd( _pdfd.m_rcWindow );
- COLORREF clr3dFace = GetColor( COLOR_3DFACE, _pdfd.m_pHelperSrc, _pdfd.m_lParam );
- COLORREF clrDark = m_clrDockingFrameDark;
- COLORREF clrBkOld = dc.GetBkColor();
- COLORREF clrBkNew =
- GetColor(
- ( _pdfd.m_bFloating )
- ? ( _pdfd.m_bExtBar
- ? XPCLR_3DFACE_FLOAT_R
- : XPCLR_3DFACE_FLOAT_F
- )
- : CLR_3DFACE_OUT
- ,
- _pdfd.m_pHelperSrc,
- _pdfd.m_lParam
- );
- if( _pdfd.m_bFloating )
- {
- dc.Draw3dRect( &rcWnd, clrDark, clrDark);
- rcWnd.DeflateRect(1,1);
- dc.Draw3dRect( &rcWnd, clrDark, clrDark);
- rcWnd.DeflateRect(1,1);
- dc.Draw3dRect( &rcWnd, clrBkNew, clrBkNew);
- rcWnd.DeflateRect(0,0,1,1);
- dc.SetPixel( rcWnd.left, rcWnd.top, clrDark );
- dc.SetPixel( rcWnd.left, rcWnd.bottom, clrDark );
- dc.SetPixel( rcWnd.right, rcWnd.top, clrDark );
- dc.SetPixel( rcWnd.right, rcWnd.bottom, clrDark );
- } // if( _pdfd.m_bFloating )
- else
- {
- if( _pdfd.m_pHelperSrc != NULL
- && _pdfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtToolControlBar) )
- && ( ((CExtToolControlBar*)_pdfd.m_pHelperSrc)->m_pDockSite != NULL )
- && ( ((CExtToolControlBar*)_pdfd.m_pHelperSrc)->m_bForceNoBalloonWhenRedockable )
- )
- return;
- dc.FillSolidRect( &rcWnd, clrBkNew );
- if( ! _pdfd.m_bExtBar )
- dc.Draw3dRect( &rcWnd, clr3dFace, clr3dFace);
- if( !_pdfd.m_bSideBar && ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8 )
- {
- static WORD hatchBits[8] =
- {
- 0xAA,
- 0x55,
- 0xAA,
- 0x55,
- 0xAA,
- 0x55,
- 0xAA,