ExplorerTheme.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:2k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // ExplorerTheme.cpp: implementation of the CExplorerTheme class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "ExplorerTheme.h"
  6. //////////////////////////////////////////////////////////////////////
  7. // Construction/Destruction
  8. //////////////////////////////////////////////////////////////////////
  9. CExplorerTabPaintManager::CExplorerTabPaintManager()
  10. {
  11. SetAppearanceSet(new CExplorerTabAppearance());
  12. SetColor(xtpTabColorWinXP);
  13. m_bBoldSelected = FALSE;
  14. m_rcButtonMargin.SetRect(4, 2, 4, 1);
  15. m_bHotTracking = TRUE;
  16. m_bFillBackground = FALSE;
  17. m_szNavigateButton = CSize(17, 16);
  18. }
  19. void CExplorerTabPaintManager::DrawNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc)
  20. {
  21. if (GetColorSet()->IsAppThemed() && pButton->GetID() == xtpTabNavigateButtonClose)
  22. {
  23. LPCTSTR lpszImage = pButton->IsPressed() ? _T("IDB_EXPLORERTABCLOSEBUTTONPUSHED") : 
  24. pButton->IsHighlighted() ? _T("IDB_EXPLORERTABCLOSEBUTTONHOT") : _T("IDB_EXPLORERTABCLOSEBUTTON");
  25. CXTPOffice2007Image* pImage = ((CExplorerTabAppearance*)GetAppearanceSet())->m_images.LoadFile(lpszImage);
  26. if (pImage)
  27. {
  28. pImage->Premultiply();
  29. pImage->DrawImage(pDC, rc, pImage->GetSource());
  30. }
  31. }
  32. else
  33. {
  34. CXTPTabPaintManager::DrawNavigateButton(pDC, pButton, rc);
  35. }
  36. }
  37. void CExplorerTabPaintManager::CExplorerTabAppearance::DrawSingleButton(CDC* pDC, CXTPTabManagerItem* pItem)
  38. {
  39. if (!m_pPaintManager->GetColorSet()->IsAppThemed())
  40. {
  41. CAppearanceSetPropertyPage::DrawSingleButton(pDC, pItem);
  42. return;
  43. }
  44. CRect rcItem = pItem->GetRect();
  45. if (pItem->IsSelected())
  46. rcItem.InflateRect(1, 2, 1, 0);
  47. else rcItem.InflateRect(0, 0, 1, 0);
  48. LPCTSTR lpszImage = pItem->IsSelected() ? _T("IDB_EXPLORERTABSELECTED") : 
  49. pItem->IsHighlighted() ? _T("IDB_EXPLORERTABHOT") : _T("IDB_EXPLORERTABNORMAL");
  50. CXTPOffice2007Image* pImage = m_images.LoadFile(lpszImage);
  51. ASSERT(pImage);
  52. if (pImage)
  53. {
  54. pImage->Premultiply();
  55. pImage->DrawImage(pDC, rcItem, pImage->GetSource(), CRect(3, 3, 3, 3));
  56. }
  57. m_pPaintManager->DrawSingleButtonIconAndText(pDC, pItem, rcItem, TRUE);
  58. }