ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
- pStatusBar;
- lParam;
- return false;
- }
- bool CExtPaintManagerNativeXP::StatusBar_EraseBackground(
- CDC & dc,
- const RECT & rcClient,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pStatusBar );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::StatusBar_EraseBackground(
- dc,
- rcClient,
- pStatusBar,
- lParam
- );
-
- if( g_PaintManager.m_UxTheme.OpenThemeData( pStatusBar->GetSafeHwnd(), VSCLASS_STATUS ) != NULL )
- {
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pStatusBar->GetSafeHwnd(),
- dc.GetSafeHdc(),
- 0,
- 0,
- &rcClient,
- &rcClient
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- return true;
- }
- bool CExtPaintManager::StatusBar_ErasePaneBackground(
- CDC & dc,
- int nPaneIdx,
- const RECT & rcPane,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pStatusBar );
- dc;
- nPaneIdx;
- rcPane;
- pStatusBar;
- lParam;
- return false;
- }
- bool CExtPaintManagerNativeXP::StatusBar_ErasePaneBackground(
- CDC & dc,
- int nPaneIdx,
- const RECT & rcPane,
- const CExtStatusControlBar * pStatusBar,
- LPARAM lParam // = 0
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT_VALID( pStatusBar );
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return CExtPaintManager::StatusBar_ErasePaneBackground( dc, nPaneIdx, rcPane, pStatusBar, lParam );
- if( g_PaintManager.m_UxTheme.OpenThemeData( pStatusBar->GetSafeHwnd(), VSCLASS_STATUS ) != NULL )
- {
- INT nPaneCount = pStatusBar->GetPaneCount();
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- pStatusBar->GetSafeHwnd(),
- dc.GetSafeHdc(),
- ( nPaneIdx == nPaneCount - 1 )
- ? SP_GRIPPERPANE
- : SP_PANE,
- 0,
- &rcPane,
- &rcPane
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- return true;
- }
- bool CExtPaintManager::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 );
- dc; nPaneIdx; rcPane; dwPaneStyle; hIcon; sPaneText; nDrawTextFlags; clrText; pStatusBar; lParam;
- return false;
- }
- bool CExtPaintManager::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 );
- dc;
- nPaneIdxAfterSep;
- rcPaneBefore;
- rcPaneAfter;
- pStatusBar;
- lParam;
- return false;
- }
- bool CExtPaintManagerNativeXP::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( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- return
- CExtPaintManager::StatusBar_PaintSeparator(
- dc,
- nPaneIdxAfterSep,
- rcPaneBefore,
- rcPaneAfter,
- pStatusBar,
- lParam
- );
- // do not paint pain separators
- return true;
- }
- #endif // __EXT_MFC_NO_STATUSBAR
- bool CExtPaintManager::AdjustControlFont(
- HFONT & hFont,
- CObject * pHelperSrc,
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( hFont != NULL );
- hFont;
- pHelperSrc;
- lParam;
- return false;
- }
- DLGTEMPLATE * CExtPaintManager::AdjustDialogTemplate(
- const DLGTEMPLATE * lpDialogTemplate,
- CObject * pHelperSrc,
- bool bWizard, // = false
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- ASSERT( lpDialogTemplate != NULL );
- lpDialogTemplate;
- pHelperSrc;
- bWizard;
- lParam;
- return NULL;
- }
- HFONT CExtPaintManager::CreateDefaultFont()
- {
- ASSERT_VALID( this );
- HFONT hDefaultGuiFont = stat_menu_HFONT_from_current_NONCLIENTMETRICS( m_bUseTahomaFont, false );
- if( hDefaultGuiFont == NULL )
- hDefaultGuiFont = (HFONT)::GetStockObject( DEFAULT_GUI_FONT );
- if( hDefaultGuiFont == NULL )
- hDefaultGuiFont = (HFONT)::GetStockObject( SYSTEM_FONT );
- ASSERT( hDefaultGuiFont != NULL );
- return hDefaultGuiFont;
- }
- HFONT CExtPaintManager::CreateCaptionFont()
- {
- ASSERT_VALID( this );
- HFONT hCaptionFont = stat_menu_HFONT_from_current_NONCLIENTMETRICS( false, /*m_bUseTahomaFont,*/ true );
- if( hCaptionFont != NULL )
- {
- LOGFONT lf;
- ::GetObject( hCaptionFont, sizeof(LOGFONT), &lf );
- lf.lfWeight = 400;
- HFONT hCaptionFont2 = ::CreateFontIndirect( &lf );
- if( hCaptionFont2 != NULL )
- {
- ::DeleteObject( hCaptionFont );
- return hCaptionFont2;
- }
- }
- hCaptionFont = (HFONT)::GetStockObject( DEFAULT_GUI_FONT );
- if( hCaptionFont == NULL )
- hCaptionFont = (HFONT)::GetStockObject( SYSTEM_FONT );
- ASSERT( hCaptionFont != NULL );
- return hCaptionFont;
- }
- HFONT CExtPaintManagerOffice2007_Impl::CreateDefaultFont()
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::CreateDefaultFont();
- return CExtPaintManagerOffice2003::CreateDefaultFont();
- // if( ! g_PaintManager.m_bIsWinXPorLater )
- // return CExtPaintManagerOffice2003::CreateDefaultFont();
- // if( g_ResourceManager->DesiredFont_GetFaceName() != NULL )
- // return CExtPaintManagerOffice2003::CreateDefaultFont();
- //bool bUseDesiredRibbonFontFaceName = false;
- //static __EXT_MFC_SAFE_LPCTSTR
- // g_sDesiredRibbonFontFaceName = _T("Segoe UI");
- //CWindowDC dc( NULL );
- // if( ! ::EnumFontFamilies(
- // dc.m_hDC,
- // NULL,
- // (FONTENUMPROC)stat_FindFontByNameCallBack,
- // reinterpret_cast < LPARAM > ( LPCTSTR(g_sDesiredRibbonFontFaceName) )
- // )
- // )
- // bUseDesiredRibbonFontFaceName = true;
- //HFONT hDef = (HFONT)::GetStockObject( DEFAULT_GUI_FONT );
- //LOGFONT _lf;
- // ::memset( &_lf, 0, sizeof(LOGFONT) );
- // ::GetObject( hDef, sizeof(LOGFONT), &_lf );
- // if( bUseDesiredRibbonFontFaceName )
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, g_sDesiredRibbonFontFaceName );
- // _lf.lfWidth = 0;
- // _lf.lfHeight = -12;
- // }
- // else
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, _T("Arial") );
- // _lf.lfWidth = 5;
- // _lf.lfHeight = 14;
- // _lf.lfWeight = 550;
- // }
- // if( g_PaintManager.m_bIsWinXPorLater )
- // _lf.lfQuality = CLEARTYPE_QUALITY;
- //HFONT hDefaultGuiFont = ::CreateFontIndirect( &_lf );
- // return hDefaultGuiFont;
- }
- HFONT CExtPaintManagerOffice2007_Impl::CreateCaptionFont()
- {
- ASSERT_VALID( this );
- if( IsHighContrast() )
- return CExtPaintManagerXP::CreateCaptionFont();
-
- return CExtPaintManagerOffice2003::CreateCaptionFont();
- //bool bUseDesiredRibbonFontFaceName = false;
- //static __EXT_MFC_SAFE_LPCTSTR
- // g_sDesiredRibbonFontFaceName = _T("Segoe UI");
- //CWindowDC dc( NULL );
- // if( ! ::EnumFontFamilies(
- // dc.m_hDC,
- // NULL,
- // (FONTENUMPROC)stat_FindFontByNameCallBack,
- // reinterpret_cast < LPARAM > ( LPCTSTR(g_sDesiredRibbonFontFaceName) )
- // )
- // )
- // bUseDesiredRibbonFontFaceName = true;
- //
- // if( g_ResourceManager->DesiredFont_GetFaceName() != NULL )
- // return CExtPaintManagerOffice2003::CreateCaptionFont();
- //
- //HFONT hDef = (HFONT)::GetStockObject( DEFAULT_GUI_FONT );
- //LOGFONT _lf;
- // ::memset( &_lf, 0, sizeof(LOGFONT) );
- // ::GetObject( hDef, sizeof(LOGFONT), &_lf );
- // if( bUseDesiredRibbonFontFaceName )
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, g_sDesiredRibbonFontFaceName );
- // _lf.lfWidth = 0;
- // _lf.lfHeight = -12;
- // // _lf.lfWidth = 6;
- // // _lf.lfHeight = 17;
- // // _lf.lfWeight = 550;
- // }
- // else
- // {
- // __EXT_MFC_STRCPY( _lf.lfFaceName, LF_FACESIZE, _T("Arial") );
- // _lf.lfWidth = 0;
- // _lf.lfHeight = -12;
- // _lf.lfWeight = 550;
- // }
- // if( g_PaintManager.m_bIsWinXPorLater )
- // _lf.lfQuality = CLEARTYPE_QUALITY;
- //HFONT hDefaultGuiFont = ::CreateFontIndirect( &_lf );
- // return hDefaultGuiFont;
- }
- void CExtPaintManager::SyncSysColors()
- {
- ASSERT_VALID( this );
- g_PaintManager.InitUserExApi();
- // init fonts
- if( m_FontNormal.GetSafeHandle() )
- m_FontNormal.DeleteObject();
- HFONT hDefaultGuiFont = CreateDefaultFont();
- ASSERT( hDefaultGuiFont != NULL );
- m_FontNormal.Attach( hDefaultGuiFont );
- if( m_FontCaption.GetSafeHandle() )
- m_FontCaption.DeleteObject();
- HFONT hCaptionFont = CreateCaptionFont();
- ASSERT( hCaptionFont != NULL );
- m_FontCaption.Attach( hCaptionFont );
- static __EXT_MFC_SAFE_LPCTSTR sVertFontFaceForNt4 = _T("Arial");
- LOGFONT lf;
- VERIFY( m_FontNormal.GetLogFont(&lf) );
- lf.lfWeight = 900;
- if( m_FontBold.GetSafeHandle() )
- m_FontBold.DeleteObject();
- VERIFY( m_FontBold.CreateFontIndirect(&lf) );
- VERIFY( m_FontCaption.GetLogFont(&lf) );
- lf.lfWeight = 900;
- if( m_FontCaptionBold.GetSafeHandle() )
- m_FontCaptionBold.DeleteObject();
- VERIFY( m_FontCaptionBold.CreateFontIndirect(&lf) );
- VERIFY( m_FontNormal.GetLogFont(&lf) );
- lf.lfCharSet = SYMBOL_CHARSET;
- lf.lfWeight = 0;
- lf.lfHeight = ::GetSystemMetrics(SM_CYMENUCHECK) - 1;
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Marlett") );
- if( m_FontMarlett.GetSafeHandle() )
- m_FontMarlett.DeleteObject();
- VERIFY( m_FontMarlett.CreateFontIndirect(&lf) );
- VERIFY( m_FontNormal.GetLogFont(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT__;
- if( m_FontNormalVert.GetSafeHandle() )
- m_FontNormalVert.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontNormalVert.CreateFontIndirect(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT_X__;
- if( m_FontNormalVertX.GetSafeHandle() )
- m_FontNormalVertX.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontNormalVertX.CreateFontIndirect(&lf) );
- VERIFY( m_FontCaption.GetLogFont(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT__;
- if( m_FontCaptionVert.GetSafeHandle() )
- m_FontCaptionVert.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontCaptionVert.CreateFontIndirect(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT_X__;
- if( m_FontCaptionVertX.GetSafeHandle() )
- m_FontCaptionVertX.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontCaptionVertX.CreateFontIndirect(&lf) );
- VERIFY( m_FontBold.GetLogFont(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT__;
- if( m_FontBoldVert.GetSafeHandle() )
- m_FontBoldVert.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontBoldVert.CreateFontIndirect(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT_X__;
- if( m_FontBoldVertX.GetSafeHandle() )
- m_FontBoldVertX.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontBoldVertX.CreateFontIndirect(&lf) );
- VERIFY( m_FontCaptionBold.GetLogFont(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT__;
- if( m_FontCaptionBoldVert.GetSafeHandle() )
- m_FontCaptionBoldVert.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontCaptionBoldVert.CreateFontIndirect(&lf) );
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT_X__;
- if( m_FontCaptionBoldVertX.GetSafeHandle() )
- m_FontCaptionBoldVertX.DeleteObject();
- if( g_PaintManager.m_bIsWinNT4 || g_PaintManager.m_bIsWin9x )
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, sVertFontFaceForNt4 );
- VERIFY( m_FontCaptionBoldVertX.CreateFontIndirect(&lf) );
- CFont * arrBarCaptFonts[7*2] =
- {
- &m_FontNormalBC, &m_FontCaption, // &m_FontNormal,
- &m_FontNormalVertBC, &m_FontCaptionVert, // &m_FontNormalVert,
- &m_FontNormalVertX, &m_FontCaptionVertX, // &m_FontNormalVertX,
- &m_FontNormalVertXBC, &m_FontCaptionVertX,
- &m_FontBoldBC, &m_FontCaptionBold, // &m_FontBold,
- &m_FontBoldVertBC, &m_FontCaptionBoldVert, // &m_FontBoldVert,
- &m_FontBoldVertXBC, &m_FontCaptionBoldVertX // &m_FontBoldVertX
- };
- int i = 0;
- for( i = 0;
- i < sizeof(arrBarCaptFonts)/sizeof(arrBarCaptFonts[0]);
- i += 2
- )
- {
- CFont * pFontSrc = arrBarCaptFonts[i+1];
- ASSERT( pFontSrc->GetSafeHandle() != NULL );
- CFont * pFontDst = arrBarCaptFonts[i];
- if( pFontDst->GetSafeHandle() != NULL )
- pFontDst->DeleteObject();
- VERIFY( pFontSrc->GetLogFont(&lf) );
- VERIFY( pFontDst->CreateFontIndirect(&lf) );
- }
- /// init colors
- COLORREF clrDefaultExtendColor = ::GetSysColor( COLOR_3DFACE );
- for( i = int(m_colors.GetSize());
- i <= __ExtMfc_MAX_SYS_COLOR_VAL;
- i++
- )
- {
- m_colors.Add( clrDefaultExtendColor );
- }
- HBRUSH hDefaultExtendBrush = ::GetSysColorBrush( COLOR_3DFACE );
- for( i = int(m_brushes.GetSize());
- i <= __ExtMfc_MAX_SYS_COLOR_VAL;
- i++
- )
- {
- m_brushes.Add( hDefaultExtendBrush );
- }
- //m_colors.clear();
- //m_brushes.clear();
- for( i = __ExtMfc_MIN_SYS_COLOR_VAL;
- i <= __ExtMfc_MAX_SYS_COLOR_VAL;
- i++
- )
- {
- m_colors[i] = ::GetSysColor( i );
- m_brushes[i] = ::GetSysColorBrush( i );
- }
- ASSERT( m_colors.GetSize() >= __ExtMfc_MAX_SYS_COLOR_VAL+1 );
- ASSERT( m_brushes.GetSize() >= __ExtMfc_MAX_SYS_COLOR_VAL+1 );
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- Ribbon_SyncFonts();
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- }
- // get any system color based brush
- HBRUSH CExtPaintManager::GetBrush(
- int nColorIndex
- )
- {
- ASSERT_VALID( this );
- int nBrushesCount = (int)m_brushes.GetSize();
- if(
- !(
- __ExtMfc_MIN_SYS_COLOR_VAL <= nColorIndex
- &&
- nColorIndex < nBrushesCount
- )
- )
- {
- ASSERT( FALSE );
- nColorIndex = COLOR_3DFACE;
- }
- HBRUSH hBrush = m_brushes[nColorIndex];
- return hBrush;
- }
- COLORREF CExtPaintManager::GetColor(
- int nColorIndex,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- )
- {
- ASSERT_VALID( this );
- pHelperSrc;
- lParam;
- if( nColorIndex >= __ExtMfc_COLOR_MAP_BASE )
- {
- int nColorIndex2 = 0;
- if( m_mapColorTranslate.Lookup(
- nColorIndex,
- nColorIndex2
- )
- )
- nColorIndex = nColorIndex2;
- else
- {
- ASSERT( FALSE );
- nColorIndex = COLOR_3DFACE;
- }
- }
- int nColorCount = (int)m_colors.GetSize();
- if(
- !(
- __ExtMfc_MIN_SYS_COLOR_VAL <= nColorIndex
- &&
- nColorIndex < nColorCount // <= __ExtMfc_MAX_SYS_COLOR_VAL
- )
- )
- {
- ASSERT( FALSE );
- nColorIndex = COLOR_3DFACE;
- }
- COLORREF clr = m_colors[nColorIndex];
- return clr;
- }
- COLORREF CExtPaintManager::GetColor(
- int nColorIndex,
- CObject * pHelperSrc, // = NULL
- LPARAM lParam // = 0L
- ) const
- {
- ASSERT_VALID( this );
- return
- ( const_cast < CExtPaintManager * > ( this ) )
- -> GetColor( nColorIndex, pHelperSrc, lParam );
- };
- int CExtPaintManager::InstallColor(
- COLORREF clr,
- int nColorIndex // = -1
- )
- {
- ASSERT_VALID( this );
- int nColorCount = (int)m_colors.GetSize();
- if( nColorIndex < 0 || nColorIndex >= nColorCount )
- {
- nColorIndex = (int)m_colors.Add( clr );
- }
- else
- m_colors[nColorIndex] = clr;
- return nColorIndex;
- }
- void CExtPaintManager::InitTranslatedColors()
- {
- ASSERT_VALID( this );
- m_mapColorTranslate.RemoveAll();
- m_mapColorTranslate[CLR_3DFACE_OUT] = COLOR_3DFACE;
- m_mapColorTranslate[CLR_3DFACE_IN] = COLOR_3DFACE;
- m_mapColorTranslate[CLR_3DFACE_DISABLED] = COLOR_3DFACE;
- m_mapColorTranslate[CLR_3DLIGHT_OUT] = COLOR_3DLIGHT;
- m_mapColorTranslate[CLR_3DLIGHT_IN] = COLOR_3DLIGHT;
- m_mapColorTranslate[CLR_3DLIGHT_DISABLED] = COLOR_3DLIGHT;
- m_mapColorTranslate[CLR_3DHILIGHT_OUT] = COLOR_3DHILIGHT;
- m_mapColorTranslate[CLR_3DHILIGHT_IN] = COLOR_3DHILIGHT;
- m_mapColorTranslate[CLR_3DHILIGHT_DISABLED] = COLOR_3DHILIGHT;
- m_mapColorTranslate[CLR_3DSHADOW_OUT] = COLOR_3DSHADOW;
- m_mapColorTranslate[CLR_3DSHADOW_IN] = COLOR_3DSHADOW;
- m_mapColorTranslate[CLR_3DSHADOW_DISABLED] = COLOR_3DSHADOW;
- m_mapColorTranslate[CLR_3DDKSHADOW_OUT] = COLOR_3DDKSHADOW;
- m_mapColorTranslate[CLR_3DDKSHADOW_IN] = COLOR_3DDKSHADOW;
- m_mapColorTranslate[CLR_3DDKSHADOW_DISABLED] = COLOR_3DDKSHADOW;
-
- m_mapColorTranslate[CLR_TEXT_OUT] = COLOR_WINDOWTEXT;
- m_mapColorTranslate[CLR_TEXT_IN] = COLOR_WINDOWTEXT;
- m_mapColorTranslate[CLR_TEXT_DISABLED] = COLOR_GRAYTEXT;
- // Menu text colors
- m_mapColorTranslate[CLR_MENUTEXT_OUT] = COLOR_WINDOWTEXT;
- m_mapColorTranslate[CLR_MENUTEXT_IN] = COLOR_HIGHLIGHTTEXT;
- m_mapColorTranslate[CLR_MENUTEXT_DISABLED] = COLOR_GRAYTEXT;
- // Task Pane Colors
- m_mapColorTranslate[CLR_TASK_PANE_BK_TOP] = COLOR_WINDOW;
- m_mapColorTranslate[CLR_TASK_PANE_BK_BOTTOM] = COLOR_WINDOW;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL] =
- COLOR_WINDOWTEXT;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED] =
- COLOR_WINDOWTEXT;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED] =
- COLOR_HIGHLIGHTTEXT;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED] =
- COLOR_HIGHLIGHTTEXT;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_NORMAL] =
- COLOR_3DFACE;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_HIGHLIGHTED] =
- COLOR_HIGHLIGHT;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL] =
- COLOR_3DFACE;
- m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_HIGHLIGHTED] =
- COLOR_HIGHLIGHT;
- // Page Navigator colors
- m_mapColorTranslate[CLR_PN_CAPTION_TEXT] = COLOR_WINDOW;
- // Group Box colors
- m_mapColorTranslate[CLR_GROUP_BOX_FRAME] = COLOR_3DSHADOW;
- // Resizable Bar non client area color
- m_mapColorTranslate[CLR_WRB_FRAME] = COLOR_3DSHADOW;
- }
- void CExtPaintManager::InitHelperBrushes()
- {
- ASSERT_VALID( this );
- if( m_brushLightDefault.GetSafeHandle() != NULL )
- m_brushLightDefault.DeleteObject();
- if( m_brushLightSystem.GetSafeHandle() != NULL )
- m_brushLightSystem.DeleteObject();
- if( m_brushDarkDefault.GetSafeHandle() != NULL )
- m_brushDarkDefault.DeleteObject();
- if( m_brushDarkSystem.GetSafeHandle() != NULL )
- m_brushDarkSystem.DeleteObject();
- if( m_brushLighterDefault.GetSafeHandle() != NULL )
- m_brushLighterDefault.DeleteObject();
- if( m_brushLighterSystem.GetSafeHandle() != NULL )
- m_brushLighterSystem.DeleteObject();
- if( m_brushDarkerDefault.GetSafeHandle() != NULL )
- m_brushDarkerDefault.DeleteObject();
- if( m_brushDarkerSystem.GetSafeHandle() != NULL )
- m_brushDarkerSystem.DeleteObject();
- if( m_brushLightestDefault.GetSafeHandle() != NULL )
- m_brushLightestDefault.DeleteObject();
- if( m_brushLightestSystem.GetSafeHandle() != NULL )
- m_brushLightestSystem.DeleteObject();
- if( m_brushDarkestDefault.GetSafeHandle() != NULL )
- m_brushDarkestDefault.DeleteObject();
- if( m_brushDarkestSystem.GetSafeHandle() != NULL )
- m_brushDarkestSystem.DeleteObject();
- int nBitsPerPixel = stat_GetBPP();
- if( nBitsPerPixel > 8 )
- {
- COLORREF clrDarker = GetColor( COLOR_3DFACE, this );
- COLORREF clrLighter = GetColor( COLOR_3DHILIGHT, this );
- COLORREF clrMixed = RGB (
- GetRValue(clrDarker) + ((GetRValue(clrLighter) -
- GetRValue(clrDarker)) / 2),
- GetGValue(clrDarker) + ((GetGValue(clrLighter) -
- GetGValue(clrDarker)) / 2),
- GetBValue(clrDarker) + ((GetBValue(clrLighter) -
- GetBValue(clrDarker)) / 2)
- );
- m_brushLightDefault.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),3,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),3,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),3,5)
- );
- m_brushLighterDefault.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),4,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),4,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),4,5)
- );
- m_brushLightestDefault.CreateSolidBrush( clrMixed );
-
- clrLighter = clrDarker;
- clrDarker = GetColor( COLOR_3DSHADOW, this );
- clrMixed = RGB (
- GetRValue(clrDarker) + ((GetRValue(clrLighter) -
- GetRValue(clrDarker)) / 2 ),
- GetGValue(clrDarker) + ((GetGValue(clrLighter) -
- GetGValue(clrDarker)) / 2),
- GetBValue(clrDarker) + ((GetBValue(clrLighter) -
- GetBValue(clrDarker)) / 2)
- );
- m_brushDarkDefault.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),2,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),2,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),2,5)
- );
- m_brushDarkerDefault.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),1,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),1,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),1,5)
- );
- m_brushDarkestDefault.CreateSolidBrush( clrMixed );
- clrDarker = ::GetSysColor( COLOR_3DFACE );
- clrLighter = ::GetSysColor( COLOR_3DHILIGHT );
- clrMixed = RGB (
- GetRValue(clrDarker) + ((GetRValue(clrLighter) -
- GetRValue(clrDarker)) / 2),
- GetGValue(clrDarker) + ((GetGValue(clrLighter) -
- GetGValue(clrDarker)) / 2),
- GetBValue(clrDarker) + ((GetBValue(clrLighter) -
- GetBValue(clrDarker)) / 2)
- );
- m_brushLightSystem.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),3,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),3,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),3,5)
- );
- m_brushLighterSystem.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),4,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),4,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),4,5)
- );
- m_brushLightestSystem.CreateSolidBrush( clrMixed );
-
- clrLighter = clrDarker;
- clrDarker = ::GetSysColor( COLOR_3DSHADOW );
- clrMixed = RGB (
- GetRValue(clrDarker) + ((GetRValue(clrLighter) -
- GetRValue(clrDarker)) / 2),
- GetGValue(clrDarker) + ((GetGValue(clrLighter) -
- GetGValue(clrDarker)) / 2),
- GetBValue(clrDarker) + ((GetBValue(clrLighter) -
- GetBValue(clrDarker)) / 2)
- );
- m_brushDarkSystem.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),2,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),2,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),2,5)
- );
- m_brushDarkerSystem.CreateSolidBrush( clrMixed );
- clrMixed = RGB (
- GetRValue(clrDarker) +
- ::MulDiv((GetRValue(clrLighter) -
- GetRValue(clrDarker)),1,5),
- GetGValue(clrDarker) +
- ::MulDiv((GetGValue(clrLighter) -
- GetGValue(clrDarker)),1,5),
- GetBValue(clrDarker) +
- ::MulDiv((GetBValue(clrLighter) -
- GetBValue(clrDarker)),1,5)
- );
- m_brushDarkestSystem.CreateSolidBrush( clrMixed );
- } // if( nBitsPerPixel > 8 )
- else
- {
- CBitmap bmp;
- COLORREF clrDarker = GetColor( COLOR_3DFACE, this );
- COLORREF clrLighter = GetColor( COLOR_3DHILIGHT, this );
- HBITMAP hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLightDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 1, 1, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLighterDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 2, 2, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLightestDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- clrLighter = clrDarker;
- clrDarker = GetColor( COLOR_3DSHADOW, this );
- hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 1, 1 );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkerDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- clrLighter = clrDarker;
- clrDarker = GetColor( COLOR_3DDKSHADOW, this );
- hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkestDefault.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- clrDarker = ::GetSysColor( COLOR_3DFACE );
- clrLighter = ::GetSysColor( COLOR_3DHILIGHT );
- hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLightSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 1, 1, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLighterSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 2, 2, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushLightestSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- clrLighter = clrDarker;
- clrDarker = ::GetSysColor( COLOR_3DSHADOW );
- hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- hBmp = stat_GenLBDIB( clrDarker, clrLighter, 1, 1, 1, 1 );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkerSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- clrLighter = clrDarker;
- clrDarker = ::GetSysColor( COLOR_3DDKSHADOW );
- hBmp = stat_GenLBDIB( clrDarker, clrLighter );
- ASSERT( hBmp != NULL );
- bmp.Attach( hBmp );
- m_brushDarkestSystem.CreatePatternBrush( &bmp );
- bmp.DeleteObject();
- } // else from if( nBitsPerPixel > 8 )
- }
- static const UINT stat_pixels_dock_btn_empty[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_close[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,1,1,0,0,0,0,1,1,
- 0,0,1,1,0,0,1,1,0,
- 0,0,0,1,1,1,1,0,0,
- 0,0,0,0,1,1,0,0,0,
- 0,0,0,1,1,1,1,0,0,
- 0,0,1,1,0,0,1,1,0,
- 0,1,1,0,0,0,0,1,1,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_close_dc2k[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,1,1,0,0,0,1,1,0,
- 0,0,1,1,0,1,1,0,0,
- 0,0,0,1,1,1,0,0,0,
- 0,0,0,1,1,1,0,0,0,
- 0,0,1,1,0,1,1,0,0,
- 0,1,1,0,0,0,1,1,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_thin_close[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,1,0,0,0,0,0,1,0,
- 0,0,1,0,0,0,1,0,0,
- 0,0,0,1,0,1,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,1,0,1,0,0,0,
- 0,0,1,0,0,0,1,0,0,
- 0,1,0,0,0,0,0,1,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_arrow_up[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,1,1,1,0,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,1,1,1,1,1,1,1,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_hollow_up[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,1,0,1,0,0,0,
- 0,0,1,0,0,0,1,0,0,
- 0,1,0,0,0,0,0,1,0,
- 1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_arrow_up_l[] =
- {
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,1,1,1,0,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,1,1,1,1,1,1,1,0,
- 1,1,1,1,1,1,1,1,1,
- 0,0,1,1,1,1,1,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_wnd_minimize[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,1,1,1,1,1,1,1,0,
- 0,1,1,1,1,1,1,1,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_wnd_restore[] =
- {
- 0,0,1,1,1,1,1,1,0,
- 0,0,1,0,0,0,0,1,0,
- 1,1,1,1,1,1,0,1,0,
- 1,1,1,1,1,1,0,1,0,
- 1,0,0,0,0,1,1,1,0,
- 1,0,0,0,0,1,0,0,0,
- 1,0,0,0,0,1,0,0,0,
- 1,1,1,1,1,1,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_wnd_maximize[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,1,1,1,1,1,1,1,1,
- };
- static const UINT stat_pixels_dock_wnd_keep[] =
- {
- 0,0,1,1,1,1,1,0,0,
- 0,0,1,0,0,1,1,0,0,
- 0,0,1,0,0,1,1,0,0,
- 0,0,1,0,0,1,1,0,0,
- 0,0,1,0,0,1,1,0,0,
- 0,1,1,1,1,1,1,1,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_dock_btn_contexthelp[] =
- {
- 0,0,0,1,1,1,1,0,0,
- 0,0,1,1,0,0,1,1,0,
- 0,0,1,1,0,0,1,1,0,
- 0,0,0,0,0,1,1,0,0,
- 0,0,0,0,1,1,0,0,0,
- 0,0,0,0,1,1,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,1,1,0,0,0,
- 0,0,0,0,1,1,0,0,0,
- };
- static const UINT stat_pixels_hollow_plus[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_hollow_minus[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,1,1,1,1,1,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_tree_plus[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,1,1,1,1,1,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,1,1,1,1,1,1,1,1,
- };
- static const UINT stat_pixels_tree_minus[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,1,1,1,1,1,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,1,1,1,1,1,1,1,1,
- };
- static const UINT stat_pixels_tree_plus_filled[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,2,2,1,2,2,2,1,
- 1,2,2,2,1,2,2,2,1,
- 1,2,1,1,1,1,1,2,1,
- 1,2,2,2,1,2,2,2,1,
- 1,2,2,2,1,2,2,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,1,1,1,1,1,1,1,1,
- };
- static const UINT stat_pixels_tree_minus_filled[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,1,1,1,1,1,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,2,2,2,2,2,2,2,1,
- 1,1,1,1,1,1,1,1,1,
- };
- static const UINT stat_pixels_circle_plus[] =
- {
- 0,0,1,1,1,1,1,0,0,
- 0,1,0,0,0,0,0,1,0,
- 1,0,0,0,1,0,0,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,1,1,1,1,1,0,1,
- 1,0,0,0,1,0,0,0,1,
- 1,0,0,0,1,0,0,0,1,
- 0,1,0,0,0,0,0,1,0,
- 0,0,1,1,1,1,1,0,0,
- };
- static const UINT stat_pixels_circle_minus[] =
- {
- 0,0,1,1,1,1,1,0,0,
- 0,1,0,0,0,0,0,1,0,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,1,1,1,1,1,0,1,
- 1,0,0,0,0,0,0,0,1,
- 1,0,0,0,0,0,0,0,1,
- 0,1,0,0,0,0,0,1,0,
- 0,0,1,1,1,1,1,0,0,
- };
- static const UINT stat_pixels_arrow_pt_up[] =
- {
- 0,0,0,0,0,1,0,0,0,0,0,
- 0,0,0,0,1,1,1,0,0,0,0,
- 0,0,0,1,1,1,1,1,0,0,0,
- 0,0,1,1,1,1,1,1,1,0,0,
- 0,1,1,1,1,1,1,1,1,1,0,
- 1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,1,1,1,1,1,0,0,0,
- 0,0,0,1,1,1,1,1,0,0,0,
- 0,0,0,1,1,1,1,1,0,0,0,
- 0,0,0,1,1,1,1,1,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_arrow_pt_lt[] =
- {
- 1,1,1,1,1,1,1,1,0,0,0,
- 1,1,1,1,1,1,1,0,0,0,0,
- 1,1,1,1,1,1,0,0,0,0,0,
- 1,1,1,1,1,1,0,0,0,0,0,
- 1,1,1,1,1,1,1,0,0,0,0,
- 1,1,1,1,1,1,1,1,0,0,0,
- 1,1,0,0,1,1,1,1,1,0,0,
- 1,0,0,0,0,1,1,1,0,0,0,
- 0,0,0,0,0,0,1,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,
- };
- static const UINT stat_pixels_arrow_small_up[] =
- {
- 0,0,1,0,0,
- 0,1,1,1,0,
- 1,1,1,1,1,
- };
- static const UINT stat_pixels_ellipsis[] =
- {
- 0,0,0,0,0,0,0,0,0,
- 0,1,0,0,1,0,0,1,0,
- 0,0,0,0,0,0,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_dock_empty(
- 9,9,2,
- stat_pixels_dock_btn_empty
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_close(
- 9,9,2,
- stat_pixels_dock_btn_close
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_close_dc2k(
- 9,9,2,
- stat_pixels_dock_btn_close_dc2k
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_xp_thin_close(
- 9,9,2,
- stat_pixels_dock_btn_thin_close
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_up(
- 9,9,2,
- stat_pixels_dock_btn_arrow_up
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_down(
- stat_glyph_dock_arrow_up,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_left(
- stat_glyph_dock_arrow_up,
- 270
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_right(
- stat_glyph_dock_arrow_left,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_minimize(
- 9,9,2,
- stat_pixels_dock_wnd_minimize
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_restore(
- 9,9,2,
- stat_pixels_dock_wnd_restore
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_maximize(
- 9,9,2,
- stat_pixels_dock_wnd_maximize
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_keep(
- 9,9,2,
- stat_pixels_dock_wnd_keep
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_unkeep(
- stat_glyph_dock_wnd_keep,
- 90
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_wnd_contexthelp(
- 9,9,2,
- stat_pixels_dock_btn_contexthelp
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_up_l(
- 9,9,2,
- stat_pixels_dock_btn_arrow_up_l
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_down_l(
- stat_glyph_dock_arrow_up_l,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_left_l(
- stat_glyph_dock_arrow_up_l,
- 270
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_arrow_right_l(
- stat_glyph_dock_arrow_left_l,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_hollow_up(
- 9,9,2,
- stat_pixels_dock_btn_hollow_up
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_hollow_down(
- stat_glyph_dock_hollow_up,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_hollow_left(
- stat_glyph_dock_hollow_up,
- 270
- );
- static CExtPaintManager::glyph_t stat_glyph_dock_hollow_right(
- stat_glyph_dock_hollow_left,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_hollow_plus(
- 9,9,2,
- stat_pixels_hollow_plus
- );
- static CExtPaintManager::glyph_t stat_glyph_hollow_minus(
- 9,9,2,
- stat_pixels_hollow_minus
- );
- static CExtPaintManager::glyph_t stat_glyph_tree_plus(
- 9,9,2,
- stat_pixels_tree_plus
- );
- static CExtPaintManager::glyph_t stat_glyph_tree_minus(
- 9,9,2,
- stat_pixels_tree_minus
- );
- static CExtPaintManager::glyph_t stat_glyph_tree_plus_filled(
- 9,9,3,
- stat_pixels_tree_plus_filled
- );
- static CExtPaintManager::glyph_t stat_glyph_tree_minus_filled(
- 9,9,3,
- stat_pixels_tree_minus_filled
- );
- static CExtPaintManager::glyph_t stat_glyph_circle_plus(
- 9,9,2,
- stat_pixels_circle_plus
- );
- static CExtPaintManager::glyph_t stat_glyph_circle_minus(
- 9,9,2,
- stat_pixels_circle_minus
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_up(
- 11,11,2,
- stat_pixels_arrow_pt_up
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_down(
- stat_glyph_arrow_pt_up,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_left(
- stat_glyph_arrow_pt_up,
- 270
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_right(
- stat_glyph_arrow_pt_left,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_small_up(
- 5,3,2,
- stat_pixels_arrow_small_up
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_small_down(
- stat_glyph_arrow_small_up,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_small_left(
- stat_glyph_arrow_small_up,
- 270
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_small_right(
- stat_glyph_arrow_small_left,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_ellipsis(
- 9,3,2,
- stat_pixels_ellipsis
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_lt(
- 11,11,2,
- stat_pixels_arrow_pt_lt
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_rt(
- stat_glyph_arrow_pt_lt,
- 90
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_rb(
- stat_glyph_arrow_pt_rt,
- 90
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_pt_lb(
- stat_glyph_arrow_pt_rb,
- 90
- );
- static const UINT stat_pixels_arrow_sort_up[] =
- {
- 0,0,0,0,1,1,0,0,0,0,
- 0,0,0,0,1,1,0,0,0,0,
- 0,0,0,1,3,1,1,0,0,0,
- 0,0,0,3,0,0,1,0,0,0,
- 0,0,1,1,0,0,1,1,0,0,
- 0,0,3,0,0,0,0,1,0,0,
- 0,1,1,0,0,0,0,1,1,0,
- 0,3,0,0,0,0,0,0,1,0,
- 1,1,0,0,0,0,0,0,1,1,
- 1,2,2,2,2,2,2,2,2,2,
- };
- static const UINT stat_pixels_arrow_sort_down[] =
- {
- 3,3,3,3,3,3,3,3,3,2,
- 1,1,0,0,0,0,0,0,2,2,
- 0,3,0,0,0,0,0,0,2,0,
- 0,1,1,0,0,0,0,2,2,0,
- 0,0,3,0,0,0,0,2,0,0,
- 0,0,1,1,0,0,2,2,0,0,
- 0,0,0,3,0,0,2,0,0,0,
- 0,0,0,1,3,2,2,0,0,0,
- 0,0,0,0,1,2,0,0,0,0,
- 0,0,0,0,1,2,0,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_up(
- 10,10,4, // 8,7,4,
- stat_pixels_arrow_sort_up
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_down(
- 10,10,4, // 8,7,4,
- stat_pixels_arrow_sort_down
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_left(
- stat_glyph_arrow_sort_down,
- 90
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_right(
- stat_glyph_arrow_sort_up,
- 90
- );
- static const UINT stat_pixels_arrow_sort_down_2007[] =
- {
- 1,1,1,1,1,1,1,1,1,
- 0,1,1,1,1,1,1,1,0,
- 0,0,1,1,1,1,1,0,0,
- 0,0,0,1,1,1,0,0,0,
- 0,0,0,0,1,0,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_down_2007(
- 9,5,2,
- stat_pixels_arrow_sort_down_2007
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_up_2007(
- stat_glyph_arrow_sort_down_2007,
- 180
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_left_2007(
- stat_glyph_arrow_sort_down_2007,
- 90
- );
- static CExtPaintManager::glyph_t stat_glyph_arrow_sort_right_2007(
- stat_glyph_arrow_sort_up_2007,
- 90
- );
- static const UINT stat_pixels_tabs_list_arrow[] =
- {
- 1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,
- 0,1,1,1,1,1,0,
- 0,0,1,1,1,0,0,
- 0,0,0,1,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_tabs_list_arrow(
- 7,7,2,
- stat_pixels_tabs_list_arrow
- );
- static const UINT stat_pixels_pn_config_button[] =
- {
- 1,1,0,1,1,0,0,
- 0,1,1,0,1,1,0,
- 0,0,1,1,0,1,1,
- 0,1,1,0,1,1,0,
- 1,1,0,1,1,0,0,
- 0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,
- 0,1,1,1,1,1,0,
- 0,0,1,1,1,0,0,
- 0,0,0,1,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_pn_config_button(
- 7,12,2,
- stat_pixels_pn_config_button
- );
- static const UINT stat_pixels_pn_config_button_2007[] =
- {
- 1,1,1,1,1,
- 0,1,1,1,0,
- 0,0,1,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_pn_config_button_2007(
- 5,3,2,
- stat_pixels_pn_config_button_2007
- );
- static const UINT stat_pixels_pn_caption_expanded[] =
- {
- 0,0,0,1,0,0,0,
- 0,0,1,1,1,0,0,
- 0,1,1,0,1,1,0,
- 1,1,0,0,0,1,1,
- 0,0,0,1,0,0,0,
- 0,0,1,1,1,0,0,
- 0,1,1,0,1,1,0,
- 1,1,0,0,0,1,1,
- };
- static CExtPaintManager::glyph_t stat_glyph_pn_caption_expanded(
- 7,8,2,
- stat_pixels_pn_caption_expanded
- );
- static const UINT stat_pixels_pn_caption_collapsed[] =
- {
- 1,1,0,0,0,1,1,
- 0,1,1,0,1,1,0,
- 0,0,1,1,1,0,0,
- 0,0,0,1,0,0,0,
- 1,1,0,0,0,1,1,
- 0,1,1,0,1,1,0,
- 0,0,1,1,1,0,0,
- 0,0,0,1,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_pn_caption_collapsed(
- 7,8,2,
- stat_pixels_pn_caption_collapsed
- );
- static const UINT stat_pixels_scroll_top[] =
- {
- 1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,
- 0,0,0,1,0,0,0,
- 0,0,1,1,1,0,0,
- 0,1,1,1,1,1,0,
- 1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_scroll_top(
- 7,7,2,
- stat_pixels_scroll_top
- );
- static const UINT stat_pixels_scroll_left[] =
- {
- 1,0,0,0,0,1,0,
- 1,0,0,0,1,1,0,
- 1,0,0,1,1,1,0,
- 1,0,1,1,1,1,0,
- 1,0,0,1,1,1,0,
- 1,0,0,0,1,1,0,
- 1,0,0,0,0,1,0,
- };
- static CExtPaintManager::glyph_t stat_glyph_scroll_left(
- 7,7,2,
- stat_pixels_scroll_left
- );
- static const UINT stat_pixels_scroll_bottom[] =
- {
- 0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,
- 0,1,1,1,1,1,0,
- 0,0,1,1,1,0,0,
- 0,0,0,1,0,0,0,
- 0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,
- };
- static CExtPaintManager::glyph_t stat_glyph_scroll_bottom(
- 7,7,2,
- stat_pixels_scroll_bottom
- );
- static const UINT stat_pixels_scroll_right[] =
- {
- 0,1,0,0,0,0,1,
- 0,1,1,0,0,0,1,
- 0,1,1,1,0,0,1,
- 0,1,1,1,1,0,1,
- 0,1,1,1,0,0,1,
- 0,1,1,0,0,0,1,
- 0,1,0,0,0,0,1,
- };
- static CExtPaintManager::glyph_t stat_glyph_scroll_right(
- 7,7,2,
- stat_pixels_scroll_right
- );
- CExtPaintManager::glyph_t *
- CExtPaintManager::g_DockingCaptionGlyphs[__DCBT_VALUE_MAX+1] =
- {
- & stat_glyph_dock_empty,
- & stat_glyph_dock_close,
- & stat_glyph_dock_arrow_up,
- & stat_glyph_dock_arrow_down,
- & stat_glyph_dock_arrow_left,
- & stat_glyph_dock_arrow_right,
- & stat_glyph_dock_wnd_minimize,
- & stat_glyph_dock_wnd_restore,
- & stat_glyph_dock_wnd_maximize,
- & stat_glyph_dock_wnd_contexthelp,
- & stat_glyph_dock_wnd_keep,
- & stat_glyph_dock_wnd_unkeep,
- & stat_glyph_dock_arrow_up_l,
- & stat_glyph_dock_arrow_down_l,
- & stat_glyph_dock_arrow_left_l,
- & stat_glyph_dock_arrow_right_l,
- & stat_glyph_dock_xp_thin_close,
- & stat_glyph_dock_hollow_up,
- & stat_glyph_dock_hollow_down,
- & stat_glyph_dock_hollow_left,
- & stat_glyph_dock_hollow_right,
- & stat_glyph_dock_close_dc2k,
- & stat_glyph_hollow_plus,
- & stat_glyph_hollow_minus,
- & stat_glyph_tree_plus,
- & stat_glyph_tree_minus,
- & stat_glyph_circle_plus,
- & stat_glyph_circle_minus,
- & stat_glyph_arrow_pt_up,
- & stat_glyph_arrow_pt_down,
- & stat_glyph_arrow_pt_left,
- & stat_glyph_arrow_pt_right,
- & stat_glyph_arrow_pt_lt,
- & stat_glyph_arrow_pt_rt,
- & stat_glyph_arrow_pt_rb,
- & stat_glyph_arrow_pt_lb,
- & stat_glyph_arrow_small_up,
- & stat_glyph_arrow_small_down,
- & stat_glyph_arrow_small_left,
- & stat_glyph_arrow_small_right,
- & stat_glyph_ellipsis,
- & stat_glyph_arrow_sort_up,
- & stat_glyph_arrow_sort_down,
- & stat_glyph_arrow_sort_left,
- & stat_glyph_arrow_sort_right,
- & stat_glyph_tabs_list_arrow,
- & stat_glyph_pn_config_button,
- & stat_glyph_pn_config_button_2007,
- & stat_glyph_pn_caption_expanded,
- & stat_glyph_pn_caption_collapsed,
- & stat_glyph_tree_plus_filled,
- & stat_glyph_tree_minus_filled,
- & stat_glyph_scroll_top,
- & stat_glyph_scroll_left,
- & stat_glyph_scroll_bottom,
- & stat_glyph_scroll_right,
- & stat_glyph_arrow_sort_up_2007,
- & stat_glyph_arrow_sort_down_2007,
- & stat_glyph_arrow_sort_left_2007,
- & stat_glyph_arrow_sort_right_2007,
- };
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA::PAINTDOCKINGCAPTIONBUTTONDATA()
- : m_pHelperSrc( NULL )
- , m_lParam( 0L )
- , m_rcClient( 0,0,0,0 )
- , m_eType( CExtPaintManager::__DCBT_EMPTY )
- , m_bHover( false )
- , m_bPushed( false )
- , m_bEnabled( false )
- , m_bSideBar( false )
- , m_bBarWndActive( false )
- , m_bFloating( false )
- {
- }
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA::PAINTDOCKINGCAPTIONBUTTONDATA(
- CObject * pHelperSrc,
- const RECT & rcClient,
- int eType, // CExtPaintManager::e_docking_caption_button_t
- bool bHover,
- bool bPushed,
- bool bEnabled,
- bool bSideBar,
- bool bBarWndActive,
- bool bFloating
- )
- : m_pHelperSrc( pHelperSrc )
- , m_lParam( 0L )
- , m_rcClient( rcClient )
- , m_eType( eType )
- , m_bHover( bHover )
- , m_bPushed( bPushed )
- , m_bEnabled( bEnabled )
- , m_bSideBar( bSideBar )
- , m_bBarWndActive( bBarWndActive )
- , m_bFloating( bFloating )
- {
- }
- void CExtPaintManager::PaintDockingCaptionButton(
- CDC & dc,
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA & _pdcbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT(
- __DCBT_VALUE_MIN <= _pdcbd.m_eType
- &&
- _pdcbd.m_eType <= __DCBT_VALUE_MAX
- );
- if( _pdcbd.m_rcClient.IsRectEmpty() )
- return;
- bool bHover = _pdcbd.m_bHover;
- if( !_pdcbd.m_bEnabled )
- bHover = false;
- COLORREF clr3dFace = ::GetSysColor( COLOR_3DFACE );
- COLORREF clr3dShadow = ::GetSysColor( COLOR_3DSHADOW );
- COLORREF clr3dDkShadow = ::GetSysColor( COLOR_3DDKSHADOW );
- COLORREF clr3dHiLight = ::GetSysColor( COLOR_3DHILIGHT );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- RGB(0,0,0),
- };
- ColorValues[1] =
- _pdcbd.m_bEnabled
- ? ::GetSysColor( COLOR_BTNTEXT )
- : ::GetSysColor( COLOR_GRAYTEXT );
- CRect rcGlyph( _pdcbd.m_rcClient );
- rcGlyph.NormalizeRect();
- if( rcGlyph.Width() & 1 )
- rcGlyph.left++;
- if( rcGlyph.Height() & 1 )
- rcGlyph.top++;
- if( _pdcbd.m_eType == __DCBT_CLOSE )
- _pdcbd.m_eType = __DCBT_CLOSE_DC2K;
- glyph_t * pGlyph = g_DockingCaptionGlyphs[_pdcbd.m_eType];
- ASSERT( pGlyph != NULL );
- if( !_pdcbd.m_bFloating )
- // rcGlyph.InflateRect( 2, 2 );
- // else
- rcGlyph.InflateRect( 1, 1 );
- rcGlyph.InflateRect( 1, 1, 0, 0 );
- dc.FillSolidRect(
- &rcGlyph,
- clr3dFace
- );
- CRect rcGlyphShape( rcGlyph );
- if( _pdcbd.m_bPushed )
- rcGlyphShape.OffsetRect( 1, 1 );
- PaintGlyphCentered(
- dc,
- rcGlyphShape,
- *pGlyph,
- ColorValues
- );
- /*
- if( bEnabled && bPushed )
- {
- dc.Draw3dRect(
- &rcGlyph,
- clr3dDkShadow, clr3dFace
- );
- rcGlyph.DeflateRect( 1, 1 );
- dc.Draw3dRect(
- &rcGlyph,
- clr3dShadow, clr3dHiLight
- );
- } // if( bPushed )
- else
- {
- dc.Draw3dRect(
- &rcGlyph,
- clr3dFace, clr3dDkShadow
- );
- rcGlyph.DeflateRect( 1, 1 );
- dc.Draw3dRect(
- &rcGlyph,
- clr3dHiLight, clr3dShadow
- );
- } // else if( bHover )
- */
- if( _pdcbd.m_bEnabled && _pdcbd.m_bPushed )
- {
- dc.Draw3dRect(
- &rcGlyph,
- clr3dShadow, clr3dHiLight
- );
- } // if( _pdcbd.m_bEnabled && _pdcbd.m_bPushed )
- else if( _pdcbd.m_bEnabled && bHover )
- {
- dc.Draw3dRect(
- &rcGlyph,
- clr3dFace, clr3dDkShadow
- );
- rcGlyph.DeflateRect( 1, 1 );
- dc.Draw3dRect(
- &rcGlyph,
- clr3dHiLight, clr3dShadow
- );
- } // else if( _pdcbd.m_bEnabled && bHover )
- else
- {
- dc.Draw3dRect(
- &rcGlyph,
- clr3dHiLight, clr3dShadow
- );
- } // else ...
-
- }
- void CExtPaintManagerXP::PaintDockingCaptionButton(
- CDC & dc,
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA & _pdcbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( __DCBT_VALUE_MIN <= _pdcbd.m_eType && _pdcbd.m_eType <= __DCBT_VALUE_MAX );
- if( _pdcbd.m_rcClient.IsRectEmpty() )
- return;
- bool bHover = _pdcbd.m_bHover;
- if( !_pdcbd.m_bEnabled )
- bHover = false;
- COLORREF ColorValues[2] = { RGB(0,0,0), RGB(0,0,0), };
- if( _pdcbd.m_bEnabled )
- {
- if( ! (bHover || _pdcbd.m_bPushed) )
- ColorValues[1] =
- GetColor(
- _pdcbd.m_bSideBar
- ? (_pdcbd.m_bBarWndActive ? COLOR_HIGHLIGHTTEXT : COLOR_3DDKSHADOW )
- : COLOR_HIGHLIGHTTEXT
- ,
- _pdcbd.m_pHelperSrc,
- _pdcbd.m_lParam
- );
- } // if( bEnabled )
- else
- ColorValues[1] = GetColor( COLOR_3DSHADOW, _pdcbd.m_pHelperSrc, _pdcbd.m_lParam );
- CRect rcGlyph( _pdcbd.m_rcClient );
- rcGlyph.NormalizeRect();
- if( bHover || _pdcbd.m_bPushed )
- {
- dc.FillSolidRect( &rcGlyph, GetColor( _pdcbd.m_bPushed ? XPCLR_HILIGHT : CLR_3DFACE_IN, _pdcbd.m_pHelperSrc, _pdcbd.m_lParam ) );
- CRect rcBtnBorder(rcGlyph);
- rcBtnBorder.InflateRect(1,1);
- COLORREF clrBtnBorder = GetColor( _pdcbd.m_bBarWndActive ? XPCLR_HILIGHT : XPCLR_HILIGHT_BORDER, _pdcbd.m_pHelperSrc, _pdcbd.m_lParam );
- dc.Draw3dRect( rcBtnBorder, clrBtnBorder, clrBtnBorder );
- }
- if( rcGlyph.Width() & 1 )
- rcGlyph.left++;
- if( rcGlyph.Height() & 1 )
- rcGlyph.top++;
- int eType = _pdcbd.m_eType;
- if( _pdcbd.m_bSideBar && !_pdcbd.m_bFloating && eType == __DCBT_CLOSE )
- eType = __DCBT_XP_THIN_CLOSE;
- glyph_t * pGlyph = g_DockingCaptionGlyphs[eType];
- ASSERT( pGlyph != NULL );
- PaintGlyphCentered( dc, rcGlyph, *pGlyph, ColorValues );
- }
- void CExtPaintManagerStudio2005::PaintDockingCaptionButton(
- CDC & dc,
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA & _pdcbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( IsHighContrast() )
- {
- CExtPaintManagerXP::PaintDockingCaptionButton( dc, _pdcbd );
- return;
- }
- if( _pdcbd.m_bSideBar
- && _pdcbd.m_bFloating
- && ( ( ! _pdcbd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtBarNcAreaButtonMenu) ) )
- #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
- || (! ((CExtBarNcAreaButtonMenu*)_pdcbd.m_pHelperSrc)->OnQueryDeactivateAutohideSlider() )
- #else
- || (! ((CExtBarNcAreaButtonMenu*)_pdcbd.m_pHelperSrc)->GetBar()->IsFixedMode() )
- #endif
- )
- )
- CExtPaintManager::PaintDockingCaptionButton( dc, _pdcbd );
- else
- CExtPaintManagerOffice2003::PaintDockingCaptionButton( dc, _pdcbd );
- }
- void CExtPaintManagerNativeXP::PaintDockingCaptionButton(
- CDC & dc,
- CExtPaintManager::PAINTDOCKINGCAPTIONBUTTONDATA & _pdcbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- ASSERT( __DCBT_VALUE_MIN <= _pdcbd.m_eType
- && _pdcbd.m_eType <= __DCBT_VALUE_MAX
- );
- if( _pdcbd.m_rcClient.IsRectEmpty() )
- return;
-
- if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- {
- CExtPaintManager::PaintDockingCaptionButton( dc, _pdcbd );
- return;
- } // if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
- HWND hWnd = NULL;
- CWnd * pWnd = DYNAMIC_DOWNCAST( CWnd, _pdcbd.m_pHelperSrc );
- if( pWnd != NULL )
- {
- ASSERT_VALID( pWnd );
- hWnd = pWnd->GetSafeHwnd();
- }
- if( _pdcbd.m_eType == __DCBT_CLOSE )
- {
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_WINDOW ) != NULL )
- {
- INT nStateID =
- (!_pdcbd.m_bEnabled)
- ? CBS_DISABLED
- : _pdcbd.m_bPushed
- ? CBS_PUSHED
- : _pdcbd.m_bHover
- ? CBS_HOT
- : CBS_NORMAL;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWnd,
- dc.GetSafeHdc(),
- WP_SMALLCLOSEBUTTON,
- nStateID,
- &_pdcbd.m_rcClient,
- &_pdcbd.m_rcClient
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- else
- {
- CRect rcGlyph( _pdcbd.m_rcClient );
- rcGlyph.NormalizeRect();
- if( (_pdcbd.m_bHover || _pdcbd.m_bPushed)
- && _pdcbd.m_bEnabled
- )
- {
- if( g_PaintManager.m_UxTheme.OpenThemeData( hWnd, VSCLASS_TOOLBAR ) != NULL )
- {
- INT nStateID =
- _pdcbd.m_bPushed
- ? TS_PRESSED
- : _pdcbd.m_bHover
- ? TS_HOT
- : TS_NORMAL;
- VERIFY(
- g_PaintManager.m_UxTheme.DrawBackground(
- hWnd,
- dc.GetSafeHdc(),
- TP_BUTTON,
- nStateID,
- &rcGlyph,
- &rcGlyph
- ) == S_OK
- );
- g_PaintManager.m_UxTheme.CloseThemeData();
- }
- }
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- ::GetSysColor(
- (!_pdcbd.m_bEnabled)
- ? COLOR_GRAYTEXT
- : (_pdcbd.m_bHover || _pdcbd.m_bPushed)
- ? COLOR_BTNTEXT
- : COLOR_HIGHLIGHTTEXT
- )
- };
-
- glyph_t * pGlyph = g_DockingCaptionGlyphs[ _pdcbd.m_eType ];
- ASSERT( pGlyph != NULL );
-
- if( _pdcbd.m_bPushed )
- rcGlyph.OffsetRect( 1, 1 );
- PaintGlyphCentered( dc, rcGlyph, *pGlyph, ColorValues );
- }
- }
- CExtPaintManager::PAINTPUSHBUTTONDATA::PAINTPUSHBUTTONDATA()
- : m_pHelperSrc( NULL )
- , m_lParam( 0L )
- , m_bHorz( false )
- , m_rcClient( 0,0,0,0 )
- , m_sText( _T("") )
- , m_pIcon( NULL )
- , m_bFlat( false )
- , m_bHover( false )
- , m_bPushed( false )
- , m_bChecked( false )
- , m_bIndeterminate( false )
- , m_bEnabled( false )
- , m_bDrawBorder( false )
- , m_bDrawFocusRect( false )
- , m_bDefaultPushButton( false )
- , m_nTextAlignment( __ALIGN_HORIZ_LEFT | __ALIGN_VERT_CENTER )
- , m_nIconAlignment( __ALIGN_HORIZ_LEFT | __ALIGN_VERT_CENTER )
- , m_rcBorderSizes( 0, 0, 0, 0 )
- , m_rcIconMargins( 0, 0, 0, 0 )
- , m_rcTextMargins( 0, 0, 0, 0 )
- , m_nFocusMode( __EBFM_CAPTION_AREA )
- , m_hFont( NULL )
- , m_bDropDown( false )
- , m_nHelperSysCmdID( 0 )
- , m_bTransparentBackground( false )
- , m_bSeparatedDropDown( false )
- , m_bNoDropDownArrow( false )
- , m_bPushedDropDown( false )
- , m_bHoverDropDown( false )
- , m_clrForceTextDisabled( ((COLORREF)-1L) )
- , m_clrForceTextNormal( ((COLORREF)-1L) )
- , m_clrForceTextHover( ((COLORREF)-1L) )
- , m_clrForceTextPressed( ((COLORREF)-1L) )
- , m_clrForceBk( ((COLORREF)-1L) )
- , m_nDrawTextFlagsH( DT_CENTER|DT_VCENTER ) // ( DT_SINGLELINE|DT_CENTER|DT_VCENTER )
- , m_bForceUseDrawTextApiH( false )
- , m_bForceRtlLayout( false )
- , m_bForceRtlText( false )
- , m_bWordBreak( false )
- , m_clrCustomAccentEffectForIcon( COLORREF(-1L) )
- , m_bHelperColorCellButton( false )
- {
- }
- CExtPaintManager::PAINTPUSHBUTTONDATA::PAINTPUSHBUTTONDATA(
- CObject * pHelperSrc,
- bool bHorz,
- const RECT & rcClient,
- __EXT_MFC_SAFE_LPCTSTR sText,
- CExtCmdIcon * pIcon,
- bool bFlat,
- bool bHover,
- bool bPushed,
- bool bIndeterminate,
- bool bEnabled,
- bool bDrawBorder,
- bool bDrawFocusRect,
- bool bDefaultPushButton,
- int eAlign,
- HFONT hFont, // = NULL
- bool bDropDown, // = false
- UINT nHelperSysCmdID, // = 0
- bool bTransparentBackground // = false
- )
- : m_pHelperSrc( pHelperSrc )
- , m_lParam( 0L )
- , m_bHorz( bHorz )
- , m_rcClient( rcClient )
- , m_sText( (sText==NULL) ? _T("") : sText )
- , m_pIcon( pIcon )
- , m_bFlat( bFlat )
- , m_bHover( bHover )
- , m_bPushed( bPushed )
- , m_bChecked( false )
- , m_bIndeterminate( bIndeterminate )
- , m_bEnabled( bEnabled )
- , m_bDrawBorder( bDrawBorder )
- , m_bDrawFocusRect( bDrawFocusRect )
- , m_bDefaultPushButton( bDefaultPushButton )
- , m_nTextAlignment( eAlign )
- , m_nIconAlignment( __ALIGN_HORIZ_LEFT | __ALIGN_VERT_CENTER )
- , m_rcBorderSizes( 0, 0, 0, 0 )
- , m_rcIconMargins( 0, 0, 0, 0 )
- , m_rcTextMargins( 0, 0, 0, 0 )
- , m_hFont( hFont )
- , m_bDropDown( bDropDown )
- , m_nHelperSysCmdID( nHelperSysCmdID )
- , m_bTransparentBackground( bTransparentBackground )
- , m_bSeparatedDropDown( false )
- , m_bNoDropDownArrow( false )
- , m_bPushedDropDown( false )
- , m_bHoverDropDown( false )
- , m_clrForceTextDisabled( ((COLORREF)-1L) )
- , m_clrForceTextNormal( ((COLORREF)-1L) )
- , m_clrForceTextHover( ((COLORREF)-1L) )
- , m_clrForceTextPressed( ((COLORREF)-1L) )
- , m_clrForceBk( ((COLORREF)-1L) )
- , m_nDrawTextFlagsH( 0 ) // ( DT_SINGLELINE )
- , m_bForceUseDrawTextApiH( false )
- , m_bForceRtlLayout( false )
- , m_bForceRtlText( false )
- , m_bWordBreak( false )
- , m_clrCustomAccentEffectForIcon( COLORREF(-1L) )
- , m_bHelperColorCellButton( false )
- {
- if( (m_nTextAlignment&__ALIGN_HORIZ_CENTER) != 0 )
- m_nDrawTextFlagsH |= DT_CENTER;
- else if( (m_nTextAlignment&__ALIGN_HORIZ_RIGHT) != 0 )
- m_nDrawTextFlagsH |= DT_RIGHT;
- else
- m_nDrawTextFlagsH |= DT_LEFT;
- if( (m_nTextAlignment&__ALIGN_VERT_CENTER) != 0 )
- m_nDrawTextFlagsH |= DT_VCENTER;
- else
- m_nDrawTextFlagsH |= DT_TOP;
- }
- bool CExtPaintManager::PAINTPUSHBUTTONDATA::IsRTL()
- {
- if( m_bForceRtlLayout )
- return true;
- if( m_pHelperSrc == NULL )
- return false;
- ASSERT_VALID( m_pHelperSrc );
- CExtPopupMenuWnd * pPopup =
- DYNAMIC_DOWNCAST( CExtPopupMenuWnd, m_pHelperSrc );
- if( pPopup != NULL )
- return pPopup->OnQueryLayoutRTL();
- CExtBarButton * pTBB =
- DYNAMIC_DOWNCAST( CExtBarButton, m_pHelperSrc );
- if( pTBB != NULL )
- {
- CExtToolControlBar * pToolBar =
- pTBB->GetBar();
- if( pToolBar != NULL )
- {
- if( (g_ResourceManager->OnQueryLangLayout()&LAYOUT_RTL) != 0 )
- return true;
- if( pToolBar->m_pDockSite != NULL
- && (pToolBar->m_pDockSite->GetExStyle()&WS_EX_LAYOUTRTL) != 0
- )
- return true;
- if( (pToolBar->GetParent()->GetExStyle()&WS_EX_LAYOUTRTL) != 0 )
- return true;
- } // if( pToolBar != NULL )
- } // if( pTBB != NULL )
- return false;
- }
- void CExtPaintManager::PaintPushButton(
- CDC & dc,
- CExtPaintManager::PAINTPUSHBUTTONDATA & _ppbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( _ppbd.m_rcClient.IsRectEmpty() )
- return;
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( _ppbd.m_pHelperSrc != NULL )
- {
- CExtBarButton * pTBB = DYNAMIC_DOWNCAST( CExtBarButton, _ppbd.m_pHelperSrc );
- if( pTBB != NULL )
- {
- if( pTBB->IsRibbonPaintingMode() )
- {
- Ribbon_PaintPushButton( dc, _ppbd );
- return;
- }
- CExtToolControlBar * pBar = pTBB->GetBar();
- if( pBar != NULL
- && pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) )
- && (! pTBB->IsNoRibbonLayout() )
- && (! pTBB->IsKindOf( RUNTIME_CLASS( CExtBarMdiRightButton ) ) )
- )
- {
- Ribbon_PaintPushButton( dc, _ppbd );
- return;
- }
- } // if( pTBB != NULL )
- } // if( _ppbd.m_pHelperSrc != NULL )
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- bool bRTL = _ppbd.IsRTL();
- if( !_ppbd.m_bEnabled )
- {
- _ppbd.m_bHover = false;
- _ppbd.m_bDrawFocusRect = false;
- _ppbd.m_bIndeterminate = false;
- }
- if( _ppbd.m_bSeparatedDropDown && (_ppbd.m_bPushed || _ppbd.m_bPushedDropDown) )
- _ppbd.m_bHover = false;
- COLORREF clrOldText = dc.GetTextColor();
- COLORREF clrOldBk = dc.GetBkColor();
- int nOldBkMode = dc.SetBkMode( TRANSPARENT );
- CBrush * pBrush = NULL;
- COLORREF bgColor = COLORREF(-1L);
- if( _ppbd.m_clrForceBk != ((COLORREF)-1L) )
- bgColor = _ppbd.m_clrForceBk;
- else if( _ppbd.m_bHover || _ppbd.m_bPushed )
- bgColor = GetColor( CLR_3DFACE_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- else if( _ppbd.m_bIndeterminate )
- {
- bgColor = GetColor( CLR_3DFACE_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- pBrush = &m_brushLightestSystem;
- }
- else
- bgColor = GetColor( CLR_3DFACE_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam );
- bool bPushedDropDown = false;
- if( (_ppbd.m_bPushed && !_ppbd.m_bSeparatedDropDown)
- || _ppbd.m_bPushedDropDown
- )
- bPushedDropDown = true;
- CRect rectClient( _ppbd.m_rcClient );
- CRect rectCaption( _ppbd.m_rcClient );
- CRect rectDropDown( 0, 0, 0, 0 );
- if( _ppbd.m_bDropDown )
- {
- rectDropDown = rectClient;
- if( _ppbd.m_bHorz )
- {
- if( bRTL )
- {
- rectCaption.left +=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_bottom.Size().cx
- ;
- rectDropDown.right = rectCaption.left + 1;
- } // if( bRTL )
- else
- {
- rectCaption.right -=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_bottom.Size().cx
- ;
- rectDropDown.left = rectCaption.right - 1;
- } // else from if( bRTL )
- } // if( _ppbd.m_bHorz )
- else
- {
- rectCaption.bottom -=
- __DROPDOWN_ARROW_GAP*2
- + g_glyph_btn_expand_right.Size().cy
- ;
- rectDropDown.top = rectCaption.bottom - 1;
- } // if( _ppbd.m_bHorz )
- if( !_ppbd.m_bTransparentBackground
- || _ppbd.m_clrForceBk != ((COLORREF)-1L)
- )
- {
- if( _ppbd.m_bEnabled
- && bPushedDropDown
- && _ppbd.m_bHover
- && _ppbd.m_clrForceBk == ((COLORREF)-1L)
- )
- dc.FillRect( &rectDropDown, &m_brushLightDefault );
- else
- dc.FillSolidRect( &rectDropDown, bgColor );
- } // if( ! _ppbd.m_bTransparentBackground )
- if( _ppbd.m_bSeparatedDropDown )
- {
- rectClient = rectCaption;
- if( bPushedDropDown )
- {
- if( (!_ppbd.m_bFlat) || _ppbd.m_bDrawBorder )
- dc.Draw3dRect(
- rectDropDown,
- GetColor( CLR_3DSHADOW_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DHILIGHT_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- } // if( bPushedDropDown )
- else
- {
- if( (!_ppbd.m_bFlat) || (_ppbd.m_bHover && _ppbd.m_bDrawBorder) )
- dc.Draw3dRect(
- rectDropDown,
- GetColor( CLR_3DHILIGHT_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DSHADOW_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- } // else from if( bPushedDropDown )
- } // if( _ppbd.m_bSeparatedDropDown )
- } // if( _ppbd.m_bDropDown )
- if( !_ppbd.m_bTransparentBackground
- || _ppbd.m_clrForceBk != ((COLORREF)-1L)
- )
- {
- if( _ppbd.m_bEnabled
- && _ppbd.m_bPushed
- && _ppbd.m_bHover
- && _ppbd.m_clrForceBk == ((COLORREF)-1L)
- )
- {
- dc.FillRect( &rectClient, &m_brushLightDefault );
- }
- else
- {
- if( pBrush != NULL )
- dc.FillRect( &rectClient, pBrush );
- else
- dc.FillSolidRect( &rectClient, bgColor );
- }
- } // if( !_ppbd.m_bTransparentBackground )
-
- // Draw pressed button
- if( _ppbd.m_bPushed || _ppbd.m_bIndeterminate )
- {
- if( pBrush != NULL )
- dc.FillRect( &rectClient, pBrush );
- if( (!_ppbd.m_bFlat) || _ppbd.m_bDrawBorder )
- dc.Draw3dRect(
- rectClient,
- GetColor( CLR_3DSHADOW_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DHILIGHT_IN, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- } // if( _ppbd.m_bPushed || _ppbd.m_bIndeterminate )
- else // ...else draw non pressed button
- {
- if( (!_ppbd.m_bFlat) || (_ppbd.m_bHover && _ppbd.m_bDrawBorder) )
- dc.Draw3dRect(
- rectClient,
- GetColor( CLR_3DHILIGHT_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DSHADOW_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- if( (!_ppbd.m_bFlat) && _ppbd.m_bHover )
- {
- CRect cc( _ppbd.m_rcClient );
- dc.Draw3dRect(
- cc,
- GetColor( CLR_3DSHADOW_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DDKSHADOW_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- cc.DeflateRect(1,1);
- dc.Draw3dRect(
- cc,
- GetColor( CLR_3DHILIGHT_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam ),
- GetColor( CLR_3DSHADOW_OUT, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- );
- } // if( (!_ppbd.m_bFlat) && _ppbd.m_bHover )
- } // else from if( _ppbd.m_bPushed )
- if( _ppbd.m_bDropDown && (! _ppbd.m_bNoDropDownArrow ) )
- {
- CRect rectGlyph( rectDropDown );
- if( bPushedDropDown )
- rectGlyph.OffsetRect( GetPushedOffset() );
- COLORREF ColorValues[2] =
- {
- RGB(0,0,0),
- GetColor(
- _ppbd.m_bEnabled
- ? CLR_TEXT_OUT
- : CLR_3DSHADOW_OUT
- ,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- )
- };
- if( bRTL && (rectGlyph.Width()&1) != 0 )
- rectGlyph.right++;
- PaintGlyphCentered(
- dc,
- rectGlyph,
- _ppbd.m_bHorz ? g_glyph_btn_expand_bottom : g_glyph_btn_expand_right,
- ColorValues
- );
- } // if( _ppbd.m_bDropDown && (! _ppbd.m_bNoDropDownArrow ) )
- dc.SetBkColor( bgColor );
- rectCaption.DeflateRect( _ppbd.m_rcBorderSizes );
- rectClient = rectCaption;
- CRect rcFocus( rectCaption );
- // Draw icon
- if( rectClient.bottom > rectClient.top
- && rectClient.right > rectClient.left
- )
- PaintPushButtonIcon(
- dc,
- rectClient,
- rectCaption,
- rcFocus,
- _ppbd
- );
- CExtSafeString sTitle( _T("") );
- if( _ppbd.m_sText != NULL )
- sTitle = _ppbd.m_sText;
- // Draw text
- if( rectCaption.bottom > rectCaption.top
- && rectCaption.right > rectCaption.left
- && (!sTitle.IsEmpty())
- )
- PaintPushButtonText(
- dc,
- rectCaption,
- _ppbd
- );
- // Draw focus rectangle
- if( _ppbd.m_bDrawFocusRect
- && ( ( !sTitle.IsEmpty() ) || _ppbd.m_nFocusMode == __EBFM_CLIENT_AREA )
- && rcFocus.bottom > rcFocus.top
- && rcFocus.right > rcFocus.left
- )
- {
- rcFocus.DeflateRect( 2, 2 );
- dc.DrawFocusRect( &rcFocus );
- }
- dc.SetBkMode( nOldBkMode );
- dc.SetBkColor( clrOldBk );
- dc.SetTextColor( clrOldText );
- }
- void CExtPaintManager::PaintPushButtonMdiRight(
- CDC & dc,
- CExtPaintManager::PAINTPUSHBUTTONDATA & _ppbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- PaintPushButton( dc, _ppbd );
- }
- void CExtPaintManager::PaintPushButtonText(
- CDC & dc,
- CRect & rcCaption,
- CExtPaintManager::PAINTPUSHBUTTONDATA & _ppbd
- )
- {
- ASSERT_VALID( this );
- ASSERT( dc.GetSafeHdc() != NULL );
- if( _ppbd.m_rcClient.IsRectEmpty() )
- return;
- CExtSafeString sTitle( _T("") );
- if( _ppbd.m_sText != NULL )
- sTitle = _ppbd.m_sText;
- bool bRTL = _ppbd.IsRTL();
- if( rcCaption.bottom > rcCaption.top
- && rcCaption.right > rcCaption.left
- && (!sTitle.IsEmpty())
- )
- {
- INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
- if( _ppbd.m_bEnabled )
- {
- if( _ppbd.m_bHover || _ppbd.m_bPushed )
- {
- if( _ppbd.m_bPushed
- && _ppbd.m_clrForceTextPressed != ((COLORREF)-1L)
- )
- dc.SetTextColor( _ppbd.m_clrForceTextPressed );
- else if( _ppbd.m_bHover
- && _ppbd.m_clrForceTextHover != ((COLORREF)-1L)
- )
- dc.SetTextColor( _ppbd.m_clrForceTextHover );
- else if( _ppbd.m_clrForceTextNormal != ((COLORREF)-1L) )
- dc.SetTextColor( _ppbd.m_clrForceTextNormal );
- else
- dc.SetTextColor( GetColor( COLOR_BTNTEXT, _ppbd.m_pHelperSrc, _ppbd.m_lParam ) );
- }
- else
- {
- dc.SetTextColor(
- ( _ppbd.m_clrForceTextNormal == ((COLORREF)-1L) )
- ? GetColor( COLOR_BTNTEXT, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- : _ppbd.m_clrForceTextNormal
- );
- }
- }
- else
- {
- dc.SetTextColor(
- ( _ppbd.m_clrForceTextDisabled == ((COLORREF)-1L) )
- ? GetColor( COLOR_3DFACE, _ppbd.m_pHelperSrc, _ppbd.m_lParam )
- : _ppbd.m_clrForceTextDisabled
- );
- }
- CFont * pOldBtnFont = NULL;
- CFont * pCurrFont = NULL;
- CFont fontDummy;
- if( _ppbd.m_hFont != NULL )
- {
- if( _ppbd.m_bHorz )
- pCurrFont = CFont::FromHandle(_ppbd.m_hFont);
- else
- {
- LOGFONT lf;
- ::memset(&lf,0,sizeof(LOGFONT));
- ::GetObject(_ppbd.m_hFont, sizeof(LOGFONT), &lf);
- if( lf.lfEscapement == 0 )
- {
- lf.lfEscapement = __EXT_VERT_FONT_ESCAPEMENT__;
- VERIFY(
- fontDummy.CreateFontIndirect(&lf)
- );
- pCurrFont = &fontDummy;
- }
- else
- {
- // suppose font already prepared
- pCurrFont = CFont::FromHandle( _ppbd.m_hFont );
- }
- }
- } // if( _ppbd.m_hFont != NULL )
- else
- {
- if( _ppbd.m_bHorz )
- {
- if( _ppbd.m_bDefaultPushButton )
- pCurrFont = &m_FontBold;
- else
- pCurrFont = &m_FontNormal;
- }
- else
- {
- if( _ppbd.m_bDefaultPushButton )
- pCurrFont = &m_FontBoldVert;
- else
- pCurrFont = &m_FontNormalVert;
- }
- } // else from if( _ppbd.m_hFont != NULL )
- ASSERT( pCurrFont != NULL );
- pOldBtnFont = dc.SelectObject( pCurrFont );
- ASSERT( pOldBtnFont != NULL );
- CExtSafeString sBtn( sTitle );
- if( _ppbd.m_bHorz )
- {
- CRect rcTextLocation( 0, 0, 0, 0);
- UINT nDtMeasureFlags =
- DT_LEFT | DT_TOP | DT_CALCRECT | ((bRTL || _ppbd.m_bForceRtlText) ? DT_RTLREADING : 0);
- if( _ppbd.m_bWordBreak )
- {
- rcTextLocation = rcCaption;
- rcTextLocation.OffsetRect( -rcTextLocation.TopLeft() );
- rcTextLocation.bottom = rcTextLocation.top;
- nDtMeasureFlags |= DT_WORDBREAK;
- }
- else
- nDtMeasureFlags |= DT_SINGLELINE;
- dc.DrawText(
- sBtn,
- -1,
- rcTextLocation,
- nDtMeasureFlags
- );
- rcTextLocation.OffsetRect(
- rcCaption.TopLeft() - rcTextLocation.TopLeft()
- );
-
- UINT nDtDrawFlags = 0;
- if( (_ppbd.m_nTextAlignment&__ALIGN_HORIZ_MASK) == __ALIGN_HORIZ_RIGHT )
- {
- nDtDrawFlags |= DT_RIGHT;
- rcTextLocation.OffsetRect(
- rcCaption.Width() - rcTextLocation.Width(),
- 0
- );
- }
- else if( (_ppbd.m_nTextAlignment&__ALIGN_HORIZ_MASK) == __ALIGN_HORIZ_CENTER )
- {
- nDtDrawFlags |= DT_CENTER;
- rcTextLocation.OffsetRect(
- ( rcCaption.Width() - rcTextLocation.Width() ) / 2,
- 0
- );
- }
- else
- nDtDrawFlags |= DT_LEFT;
-
- if( (_ppbd.m_nTextAlignment&__ALIGN_VERT_MASK) == __ALIGN_VERT_BOTTOM )
- {
- nDtDrawFlags |= DT_BOTTOM;
- rcTextLocation.OffsetRect(
- 0,
- rcCaption.Height() - rcTextLocation.Height()
- );
- }
- else if( (_ppbd.m_nTextAlignment&__ALIGN_VERT_MASK) == __ALIGN_VERT_TOP )
- {
- nDtDrawFlags |= DT_TOP;
- }
- else
- {
- nDtDrawFlags |= DT_VCENTER;
- rcTextLocation.OffsetRect(
- 0,
- ( rcCaption.Height() - rcTextLocation.Height() ) / 2
- );
- }
- if( _ppbd.m_bWordBreak )
- nDtDrawFlags |= DT_WORDBREAK;
- else
- nDtDrawFlags |= DT_SINGLELINE;
- if( _ppbd.m_bPushed )
- {
- CSize szPushedOffset = GetPushedOffset();
- rcTextLocation.OffsetRect( szPushedOffset );
- }
- if( _ppbd.m_bForceUseDrawTextApiH )
- {
- dc.DrawText(
- sTitle,
- -1,
- &rcTextLocation,
- nDtDrawFlags
- );
- } // if( _ppbd.m_bForceUseDrawTextApiH )
- else
- {
- if( _ppbd.m_bEnabled
- || _ppbd.m_clrForceTextDisabled != ((COLORREF)-1L)
- )
- {
- dc.DrawText(
- LPCTSTR(sTitle),
- sTitle.GetLength(),
- &rcTextLocation,
- nDtDrawFlags
- );
- }
- else
- {
- CRect rcDrawTextOffs = rcTextLocation;
- rcDrawTextOffs.OffsetRect( 1, 1 );
- COLORREF clrTextRestore =
- dc.SetTextColor(
- GetColor(
- COLOR_3DHILIGHT,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- )
- );
- dc.DrawText(
- LPCTSTR(sTitle),
- sTitle.GetLength(),
- &rcDrawTextOffs,
- nDtDrawFlags
- );
- dc.SetTextColor(
- GetColor(
- COLOR_3DSHADOW,
- _ppbd.m_pHelperSrc,
- _ppbd.m_lParam
- )
- );
- dc.DrawText(
- LPCTSTR(sTitle),
- sTitle.GetLength(),
- rcTextLocation,
- nDtDrawFlags
- );
- dc.SetTextColor( clrTextRestore );
- } // else from if( _ppbd.m_bEnabled )
- } // else from if( _ppbd.m_bForceUseDrawTextApiH )
- } // if( _ppbd.m_bHorz )
- else
- {
- INT nTextLength = sTitle.GetLength();
- INT nAmpIndex = sTitle.Find( _T('&') );
- if( nAmpIndex >= 0 )
- sBtn =
- sTitle.Left( nAmpIndex )
- + sTitle.Right( nTextLength - ( nAmpIndex + 1 ) );
- static TCHAR stat_strDummyAmpSeq[] = _T("