ExtPaintManager.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:1653k
源码类别:

界面编程

开发平台:

Visual C++

  1. dc.DrawText(
  2. sItemText,
  3. sItemText.GetLength(),
  4. rcText,
  5. nFormat
  6. );
  7. }
  8. dc.SelectObject( pOldFont );
  9. dc.SetBkMode( nOldBkMode );
  10. dc.SetTextColor( clrOldText );
  11. } // if we have sense to paint text on tab item
  12. if( pIconTabItemCloseButton != NULL )
  13. {
  14. ASSERT( ! pIconTabItemCloseButton->IsEmpty() );
  15. if( dc.RectVisible( &rcTabItemCloseButton ) )
  16. pIconTabItemCloseButton->Paint(
  17. g_PaintManager.GetPM(),
  18. dc.m_hDC,
  19. rcTabItemCloseButton,
  20. ePaintStateITICB
  21. );
  22. } // if( pIconTabItemCloseButton != NULL )
  23. }
  24. void CExtPaintManagerNativeXP::PaintTabItem(
  25. CDC & dc,
  26. CRect & rcTabItemsArea,
  27. bool bTopLeft,
  28. bool bHorz,
  29. bool bSelected,
  30. bool bCenteredText,
  31. bool bGroupedMode,
  32. bool bInGroupActive,
  33. bool bInvertedVerticalMode,
  34. const CRect & rcEntireItem,
  35. CSize sizeTextMeasured,
  36. CFont * pFont,
  37. __EXT_MFC_SAFE_LPCTSTR sText,
  38. CExtCmdIcon * pIcon,
  39. CObject * pHelperSrc,
  40. LPARAM lParam, // = 0L
  41. COLORREF clrForceText, // = COLORREF(-1L)
  42. COLORREF clrForceTabBk, // = COLORREF(-1L)
  43. COLORREF clrForceTabBorderLT, // = COLORREF(-1L)
  44. COLORREF clrForceTabBorderRB, // = COLORREF(-1L)
  45. COLORREF clrForceTabSeparator, // = COLORREF(-1L)
  46. bool bDwmMode // = false
  47. )
  48. {
  49. ASSERT_VALID( this );
  50. ASSERT( dc.GetSafeHdc() != NULL );
  51. if( bGroupedMode
  52. || (! g_PaintManager.m_UxTheme.IsControlsThemed() )
  53. )
  54. {
  55. CExtPaintManager::PaintTabItem(
  56. dc,
  57. rcTabItemsArea,
  58. bTopLeft,
  59. bHorz,
  60. bSelected,
  61. bCenteredText,
  62. bGroupedMode,
  63. bInGroupActive,
  64. bInvertedVerticalMode,
  65. rcEntireItem,
  66. sizeTextMeasured,
  67. pFont,
  68. sText,
  69. pIcon,
  70. pHelperSrc,
  71. lParam,
  72. clrForceText,
  73. clrForceTabBk,
  74. clrForceTabBorderLT,
  75. clrForceTabBorderRB,
  76. clrForceTabSeparator,
  77. bDwmMode
  78. );
  79. return;
  80. }
  81. LONG nItemIndex = 1;
  82. CExtCmdIcon * pIconTabItemCloseButton = NULL;
  83. CExtCmdIcon::e_paint_type_t ePaintStateITICB =
  84. (CExtCmdIcon::e_paint_type_t) CExtCmdIcon::__PAINT_INVISIBLE;
  85. CRect rcTabItemCloseButton( 0, 0, 0, 0 );
  86. CExtBarButton * pTBB = NULL;
  87. CExtTabWnd * pTabs = NULL;
  88. CExtTabWnd::TAB_ITEM_INFO * pTII = NULL;
  89. bool bNoPrefix = false;
  90. if( pHelperSrc != NULL )
  91. {
  92. pTabs = DYNAMIC_DOWNCAST( CExtTabWnd, pHelperSrc );
  93. if( pTabs != NULL )
  94. {
  95. ASSERT_VALID( pTabs );
  96. pTII = pTabs->ItemGet( LONG( lParam ) );
  97. ASSERT( pTII != NULL );
  98. ASSERT_VALID( pTII );
  99. nItemIndex = (LONG)lParam;
  100. pIconTabItemCloseButton =
  101. pTabs->OnTabWndQueryItemCloseButtonShape( pTII );
  102. if( pIconTabItemCloseButton != NULL )
  103. {
  104. rcTabItemCloseButton = pTII->CloseButtonRectGet();
  105. ePaintStateITICB = (CExtCmdIcon::e_paint_type_t)
  106. pTabs->OnTabWndQueryItemCloseButtonPaintState( pTII );
  107. } // if( pIconTabItemCloseButton != NULL )
  108. bNoPrefix = ( ( pTabs->GetTabWndStyleEx() & __ETWS_EX_NO_PREFIX ) != 0 ) ? true : false;
  109. } // if( pTabs != NULL )
  110. else
  111. {
  112. pTBB = DYNAMIC_DOWNCAST( CExtBarButton, pHelperSrc );
  113. #ifdef _DEBUG
  114. if( pTBB != NULL )
  115. {
  116. ASSERT_VALID( pTBB );
  117. } // if( pTBB != NULL )
  118. #endif // _DEBUG
  119. } // else from if( pTabs != NULL )
  120. } // if( pHelperSrc != NULL )
  121. LONG nSelectionIndex = -1;
  122. if( pTabs != NULL )
  123. nSelectionIndex = pTabs->SelectionGet();
  124. bool bInGroupFirst = false;
  125. bool bInGroupLast = false;
  126. if( bGroupedMode && pTII != NULL )
  127. {
  128. ASSERT( pTabs != NULL );
  129. CExtTabWnd::TAB_ITEM_INFO * pTiiFirst = pTII->GetInGroupFirst();
  130. CExtTabWnd::TAB_ITEM_INFO * pTiiLast = pTII->GetInGroupLast();
  131. ASSERT_VALID( pTiiFirst );
  132. ASSERT_VALID( pTiiLast );
  133. bInGroupFirst = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiFirst ) );
  134. bInGroupLast = ( nItemIndex == pTabs->ItemGetIndexOf( pTiiLast ) );
  135. }
  136. bool bFirstItem = false, bLastItem = false;
  137. if( pTII != NULL )
  138. {
  139. ASSERT( pTabs != NULL );
  140. bFirstItem =
  141. ( nItemIndex == 0
  142. || ( bInGroupFirst
  143. && nItemIndex != nSelectionIndex
  144. )
  145. );
  146. bLastItem = 
  147. ( nItemIndex == pTabs->ItemGetCount() - 1
  148. || ( bInGroupLast
  149. && nItemIndex != nSelectionIndex
  150. )
  151. );
  152. }
  153. bool bHover = false;
  154. bool bPressed = false;
  155. bool bEnabled = true;
  156. if( pTII != NULL )
  157. {
  158. ASSERT( pTabs != NULL );
  159. bEnabled = pTII->EnabledGet();
  160. bHover = ( pTabs->GetHoverTrackingItem() == nItemIndex ) ? true : false;
  161. bPressed = ( pTabs->GetPushedTrackingItem() == nItemIndex ) ? true : false;
  162. }
  163. else if( pTBB != NULL )
  164. {
  165. bEnabled = pTBB->IsEnabled();
  166. bHover = pTBB->IsHover();
  167. bPressed = pTBB->IsPressed();
  168. }
  169. CRect rcItem( rcEntireItem );
  170. HWND hWndOpenTheme = pTabs->GetSafeHwnd();
  171. if( hWndOpenTheme == NULL )
  172. hWndOpenTheme = ::GetDesktopWindow();
  173. if( g_PaintManager.m_UxTheme.OpenThemeData( hWndOpenTheme, VSCLASS_TAB ) != NULL )
  174. {
  175. INT nPartID = TABP_TABITEM;
  176. INT nStateID = 
  177. (!bEnabled)
  178. ? TIS_DISABLED
  179. : bSelected
  180. ? TIS_SELECTED
  181. : bPressed
  182. ? TIS_FOCUSED
  183. : bHover
  184. ? TIS_HOT
  185. : TIS_NORMAL;
  186. CExtBitmap _bmp1, _bmp2;
  187. COLORREF * pClrSurface = NULL;
  188. CBitmap _bmp;
  189. CBitmap * pOldBmp = NULL;
  190. CDC dcX;
  191. bool bDetectedDynTPC = false;
  192. bDetectedDynTPC;
  193. #if (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
  194. if( pTII != NULL )
  195. {
  196. CObject * pObject = pTII->EventProviderGet();
  197. if( pObject != NULL )
  198. {
  199. CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pObject );
  200. if( pBar != NULL )
  201. {
  202. bool bFlashCaptionHighlightedState = false;
  203. if( pBar->FlashCaptionIsInProgress( &bFlashCaptionHighlightedState ) )
  204. {
  205. if( bFlashCaptionHighlightedState )
  206. {
  207. clrForceText = pBar->m_clrFlashCaptionText;
  208. clrForceTabBk = pBar->m_clrFlashCaptionBackground;
  209. bSelected = true;
  210. #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  211. bDetectedDynTPC = true;
  212. #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  213. }
  214. }
  215. }
  216. }
  217. }
  218. #endif// (!defined __EXT_MFC_NO_DYNAMIC_BAR_SITE)
  219. COLORREF clrColorizeTabShape = COLORREF(-1L);
  220. #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  221. if( pHelperSrc != NULL
  222. && clrForceTabBk != COLORREF(-1L)
  223. && ( bDetectedDynTPC
  224. || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynTabWnd ) )
  225. || pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtDynAutoHideArea ) )
  226. )
  227. )
  228. clrColorizeTabShape = clrForceTabBk;
  229. #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  230. #if (!defined __EXT_MFC_NO_TABMDI_CTRL)
  231. if( pHelperSrc != NULL
  232. && clrForceTabBk != COLORREF(-1L)
  233. && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
  234. && ((CExtTabWnd*)pHelperSrc)->_IsMdiTabCtrl()
  235. )
  236. clrColorizeTabShape = clrForceTabBk;
  237. #endif // (!defined __EXT_MFC_NO_TABMDI_CTRL)
  238. if( bHorz )
  239. {
  240. if( bTopLeft && clrColorizeTabShape == COLORREF(-1L) )
  241. {
  242. rcItem.OffsetRect( 0, 2 );
  243. if( bSelected )
  244. rcItem.InflateRect( bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2, 2 );
  245. VERIFY( 
  246. g_PaintManager.m_UxTheme.DrawBackground(
  247. hWndOpenTheme,
  248. dc.GetSafeHdc(), 
  249. nPartID, 
  250. nStateID, 
  251. &rcItem, 
  252. &rcItem
  253. ) == S_OK
  254. );
  255. }
  256. else
  257. {
  258. if( bSelected )
  259. rcItem.InflateRect( bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2, 2 );
  260. VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
  261. if( ! bTopLeft )
  262. {
  263. VERIFY(
  264. _bmp2.CreateRotated9xStack(
  265. _bmp1,
  266. 180,
  267. 1,
  268. rcItem.Width(),
  269. rcItem.Height(),
  270. false,
  271. false
  272. )
  273. );
  274. }
  275. else
  276. _bmp2 = _bmp1;
  277. HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
  278. ASSERT( hBmp != NULL && pClrSurface != NULL );
  279. _bmp.Attach( hBmp );
  280. VERIFY( dcX.CreateCompatibleDC( NULL ) );
  281. pOldBmp = dcX.SelectObject( &_bmp );
  282. CRect rcItemX( 0, 0, rcItem.Width(), rcItem.Height() );
  283. VERIFY( 
  284. g_PaintManager.m_UxTheme.DrawBackground(
  285. hWndOpenTheme,
  286. dcX.GetSafeHdc(), 
  287. nPartID, 
  288. nStateID, 
  289. &rcItemX, 
  290. &rcItemX
  291. ) == S_OK
  292. );
  293. dcX.SelectObject( pOldBmp );
  294. _bmp2.Empty();
  295. VERIFY( _bmp2.FromBitmap( hBmp ) );
  296. _bmp1.Empty();
  297. if( ! bTopLeft )
  298. {
  299. VERIFY(
  300. _bmp1.CreateRotated9xStack(
  301. _bmp2,
  302. 180,
  303. 1,
  304. rcItem.Width(),
  305. rcItem.Height(),
  306. false,
  307. false
  308. )
  309. );
  310. }
  311. else
  312. _bmp1 = _bmp2;
  313. if( clrColorizeTabShape != COLORREF(-1L) )
  314. {
  315. _bmp1.Make32();
  316. _bmp1.AdjustHLS( COLORREF(-1L), COLORREF(-1L), 0.0, -0.5 );
  317. _bmp1.MakeMono( clrColorizeTabShape );
  318. _bmp1.AlphaBlend( dc.m_hDC, rcItem, 64 );
  319. }
  320. else
  321. _bmp1.Draw( dc.m_hDC, rcItem );
  322. }
  323. } // if( bHorz )
  324. else
  325. {
  326. if( bTopLeft && clrColorizeTabShape == COLORREF(-1L) )
  327. {
  328. rcItem.OffsetRect( 2, 0 );
  329. if( bSelected )
  330. rcItem.InflateRect( 2, bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2 );
  331. VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
  332. VERIFY(
  333. _bmp2.CreateRotated9xStack(
  334. _bmp1,
  335. 90,
  336. 1,
  337. rcItem.Width(),
  338. rcItem.Height(),
  339. false,
  340. false
  341. )
  342. );
  343. HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
  344. ASSERT( hBmp != NULL && pClrSurface != NULL );
  345. _bmp.Attach( hBmp );
  346. VERIFY( dcX.CreateCompatibleDC( NULL ) );
  347. pOldBmp = dcX.SelectObject( &_bmp );
  348. CRect rcItemX( 0, 0, rcItem.Height(), rcItem.Width() );
  349. VERIFY( 
  350. g_PaintManager.m_UxTheme.DrawBackground(
  351. hWndOpenTheme,
  352. dcX.GetSafeHdc(), 
  353. nPartID, 
  354. nStateID, 
  355. &rcItemX, 
  356. &rcItemX
  357. ) == S_OK
  358. );
  359. dcX.SelectObject( pOldBmp );
  360. _bmp2.Empty();
  361. VERIFY( _bmp2.FromBitmap( hBmp ) );
  362. _bmp1.Empty();
  363. VERIFY(
  364. _bmp1.CreateRotated9xStack(
  365. _bmp2,
  366. 270,
  367. 1,
  368. rcItem.Height(),
  369. rcItem.Width(),
  370. false,
  371. false
  372. )
  373. );
  374. _bmp1.Draw( dc.m_hDC, rcItem );
  375. }
  376. else
  377. {
  378. if( bSelected )
  379. rcItem.InflateRect( 2, bFirstItem ? 0 : 2, 2, bLastItem ? 0 : 2 );
  380. VERIFY( _bmp1.FromSurface( dc.m_hDC, rcItem ) );
  381. if( ! bTopLeft )
  382. {
  383. VERIFY(
  384. _bmp2.CreateRotated9xStack(
  385. _bmp1,
  386. 270,
  387. 1,
  388. rcItem.Width(),
  389. rcItem.Height(),
  390. false,
  391. false
  392. )
  393. );
  394. }
  395. else
  396. _bmp2 = _bmp1;
  397. HBITMAP hBmp = _bmp2.CreateBitmap( &pClrSurface );
  398. ASSERT( hBmp != NULL && pClrSurface != NULL );
  399. _bmp.Attach( hBmp );
  400. VERIFY( dcX.CreateCompatibleDC( NULL ) );
  401. pOldBmp = dcX.SelectObject( &_bmp );
  402. CRect rcItemX( 0, 0, rcItem.Height(), rcItem.Width() );
  403. VERIFY( 
  404. g_PaintManager.m_UxTheme.DrawBackground(
  405. hWndOpenTheme,
  406. dcX.GetSafeHdc(), 
  407. nPartID, 
  408. nStateID, 
  409. &rcItemX, 
  410. &rcItemX
  411. ) == S_OK
  412. );
  413. dcX.SelectObject( pOldBmp );
  414. _bmp2.Empty();
  415. VERIFY( _bmp2.FromBitmap( hBmp ) );
  416. _bmp1.Empty();
  417. if( ! bTopLeft )
  418. {
  419. VERIFY(
  420. _bmp1.CreateRotated9xStack(
  421. _bmp2,
  422. 90,
  423. 1,
  424. rcItem.Height(),
  425. rcItem.Width(),
  426. false,
  427. false
  428. )
  429. );
  430. }
  431. else
  432. _bmp1 = _bmp2;
  433. if( clrColorizeTabShape != COLORREF(-1L) )
  434. {
  435. _bmp1.Make32();
  436. _bmp1.AdjustHLS( COLORREF(-1L), COLORREF(-1L), 0.0, -0.5 );
  437. _bmp1.MakeMono( clrColorizeTabShape );
  438. _bmp1.AlphaBlend( dc.m_hDC, rcItem, 64 );
  439. }
  440. else
  441. _bmp1.Draw( dc.m_hDC, rcItem );
  442. }
  443. } // else if( bHorz )
  444. if( _bmp.GetSafeHandle() != NULL )
  445. _bmp.DeleteObject();
  446. if( dcX.GetSafeHdc() != NULL )
  447. dcX.DeleteDC();
  448. g_PaintManager.m_UxTheme.CloseThemeData();
  449. } // if( g_PaintManager.m_UxTheme.OpenThemeData( ...
  450. COLORREF clrText = clrForceText;
  451. if( clrText == COLORREF(-1L) )
  452. clrText = 
  453. ::GetSysColor( bEnabled ? COLOR_BTNTEXT : COLOR_GRAYTEXT );
  454. #define __EXTTAB_INDENT_TOP 2
  455. #define __EXTTAB_INDENT_BOTTOM 2
  456. #define __EXTTAB_INDENT_LEFT 2
  457. #define __EXTTAB_INDENT_RIGHT 2
  458. rcItem.DeflateRect(
  459. bHorz 
  460. ? __EXTTAB_INDENT_LEFT 
  461. : __EXTTAB_INDENT_TOP,
  462. bHorz 
  463. ? __EXTTAB_INDENT_TOP 
  464. : __EXTTAB_INDENT_LEFT,
  465. bHorz 
  466. ? __EXTTAB_INDENT_RIGHT 
  467. : __EXTTAB_INDENT_TOP,
  468. bHorz 
  469. ? __EXTTAB_INDENT_BOTTOM 
  470. : __EXTTAB_INDENT_RIGHT
  471. );
  472. CSize _sizeIcon( 0, 0 );
  473. bool bDrawIcon = (
  474.   pIcon != NULL 
  475.   && (!pIcon->IsEmpty()) 
  476.   && ( pTabs == NULL || (pTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0  ) 
  477.   );
  478. if( bDrawIcon )
  479. {
  480. _sizeIcon = pIcon->GetSize();
  481. ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
  482. }
  483. CRect rcItemForIcon( rcItem );
  484. if( bDrawIcon
  485. && _sizeIcon.cx > 0
  486. && _sizeIcon.cy > 0
  487. )
  488. {
  489. // rcItemForIcon.DeflateRect(
  490. // bHorz ? 0 : ( rcItem.Width() - _sizeIcon.cx),
  491. // bHorz ? ( rcItem.Height() - _sizeIcon.cy) : 0
  492. // );
  493. rcItemForIcon.right = rcItemForIcon.left + _sizeIcon.cx;
  494. rcItemForIcon.bottom = rcItemForIcon.top + _sizeIcon.cy;
  495. rcItemForIcon.OffsetRect(
  496. bHorz ? 0 : ((rcItem.Width() - _sizeIcon.cx) / 2),
  497. bHorz ? ((rcItem.Height() - _sizeIcon.cy) / 2) : 0
  498. );
  499. if( rcItemForIcon.left < (rcItem.left+1) )
  500. rcItemForIcon.left = (rcItem.left+1);
  501. if( rcItemForIcon.right < (rcItem.right-1) )
  502. rcItemForIcon.right = (rcItem.right-1);
  503. if( rcItemForIcon.top < (rcItem.top+1) )
  504. rcItemForIcon.top = (rcItem.top+1);
  505. if( rcItemForIcon.bottom < (rcItem.bottom-1) )
  506. rcItemForIcon.bottom = (rcItem.bottom-1);
  507. }
  508. CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
  509. // IMPORTANT:  the rcText calculation fixed by Genka
  510. CRect rcText(
  511. rcItem.left // rcItemForIcon.left
  512. + ( bHorz
  513. ? (_sizeIcon.cx +
  514. ((_sizeIcon.cx > 0) ? __EXTTAB_MARGIN_ICON2TEXT_X : 0)
  515. )
  516. : 0
  517. ),
  518. rcItem.top // rcItemForIcon.left
  519. + ( bHorz
  520. ? 0
  521. : (_sizeIcon.cy +
  522. ((_sizeIcon.cy > 0) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0)
  523. )
  524. ),
  525. rcItem.right,
  526. rcItem.bottom
  527. );
  528. if( !bHorz )
  529. {
  530. if( pIconTabItemCloseButton != NULL )
  531. rcText.bottom = min( rcText.bottom, rcTabItemCloseButton.top );
  532. int nWidth0 = rcText.Width();
  533. int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
  534. if( nWidth1 > nWidth0 )
  535. {
  536. if( bInvertedVerticalMode )
  537. {
  538. //rcText.right -= __EXTTAB_MARGIN_ICON2TEXT_X;
  539. rcText.left = rcText.right - nWidth1;
  540. } // if( bInvertedVerticalMode )
  541. else
  542. {
  543. //rcText.left += __EXTTAB_MARGIN_ICON2TEXT_X;
  544. rcText.right = rcText.left + nWidth1;
  545. } // else from if( bInvertedVerticalMode )
  546. } // if( nWidth1 > nWidth0 )
  547. } // if( !bHorz )
  548. else
  549. {
  550. if( pIconTabItemCloseButton != NULL )
  551. rcText.right = min( rcText.right, rcTabItemCloseButton.left );
  552. }
  553. bool bDrawText = ( ( ! sItemText.IsEmpty() ) && rcText.Width() > 0 && rcText.Height() > 0 ) ? true : false;
  554. INT nIconAlignment = __ALIGN_HORIZ_LEFT | __ALIGN_VERT_TOP;
  555. if( (!bDrawText) && !( bGroupedMode && (!bInGroupActive) ) )
  556. {
  557. if( bCenteredText )
  558. nIconAlignment = __ALIGN_HORIZ_CENTER|__ALIGN_VERT_CENTER;
  559. else
  560. rcItemForIcon.OffsetRect(
  561. bHorz ? (rcItem.Width() - _sizeIcon.cx)/2 : 0,
  562. bHorz ? 0 : (rcItem.Height() - _sizeIcon.cy)/2
  563. );
  564. }
  565. if( bDrawIcon )
  566. {
  567. if( (bHorz && rcItemForIcon.Width() >= _sizeIcon.cx )
  568. || (!bHorz && rcItemForIcon.Height() >= _sizeIcon.cy)
  569. )
  570. {
  571. PaintIcon(
  572. dc,
  573. true,
  574. pIcon,
  575. rcItemForIcon,
  576. false,
  577. bEnabled,
  578. false,
  579. nIconAlignment
  580. );
  581. }
  582. } // if( bDrawIcon )
  583. if( bDrawText )
  584. { // if we have sense to paint text on tab item
  585. ASSERT( pFont != NULL );
  586. ASSERT( pFont->GetSafeHandle() != NULL );
  587. COLORREF clrOldText = dc.SetTextColor( clrText );
  588. INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
  589. CFont * pOldFont = dc.SelectObject( pFont );
  590. if( !bHorz )
  591. {
  592. if( bCenteredText )
  593. rcText.OffsetRect(
  594. 0,
  595. ( rcText.Height() - sizeTextMeasured.cx ) / 2
  596. );
  597. int nTextLength = sItemText.GetLength();
  598. int nAmpIndex = bNoPrefix ? (-1) : int( sItemText.Find( _T('&') ) );
  599. CExtSafeString sBtn;
  600. if( nAmpIndex < 0 || bNoPrefix )
  601. sBtn = sItemText;
  602. else
  603. sBtn =
  604. sItemText.Left( nAmpIndex )
  605. + sItemText.Right( nTextLength - ( nAmpIndex + 1 ) );
  606. if( ! bNoPrefix )
  607. {
  608. static TCHAR stat_strDummyAmpSeq[] = _T("0101");
  609. sBtn.Replace( _T("&&"), stat_strDummyAmpSeq );
  610. sBtn.Remove( _T('&') );
  611. sBtn.Replace( stat_strDummyAmpSeq, _T("&") );
  612. }
  613. LOGFONT lf;
  614. ::memset(&lf,0,sizeof(LOGFONT));
  615. pFont->GetLogFont(&lf);
  616. int _cyHorzFont = abs(lf.lfHeight);
  617. int _cyTextMargin =
  618. (rcText.Width() - _cyHorzFont)  / 2
  619. ;
  620. CPoint
  621. ptLineFrom(0,0),
  622. ptLineTo(0,0);
  623. if( nAmpIndex >= 0 && ( ! bNoPrefix ) )
  624. {
  625. ptLineFrom =
  626. CPoint(
  627. __ExtMfc_CXTEXTMARGIN
  628. + _cyTextMargin,
  629. __ExtMfc_CYTEXTMARGIN
  630. + stat_CalcTextWidth(
  631. dc,
  632. *pFont,
  633. sBtn.Left(nAmpIndex)
  634. )
  635. );
  636. ptLineTo =
  637. CPoint(
  638. __ExtMfc_CXTEXTMARGIN
  639. + _cyTextMargin,
  640. __ExtMfc_CYTEXTMARGIN
  641. + stat_CalcTextWidth(
  642. dc,
  643. *pFont,
  644. sBtn.Left(nAmpIndex+1)
  645. )
  646. );
  647. int nXOffsPlus =
  648. rcText.Width()
  649. - stat_CalcTextDimension(
  650. dc,
  651. *pFont,
  652. sBtn
  653. ).Height();
  654. nXOffsPlus /= 2;
  655. nXOffsPlus -= 4;
  656. ptLineFrom.x += nXOffsPlus;
  657. ptLineTo.x   += nXOffsPlus;
  658. } // if( nAmpIndex >= 0 )
  659. CRect rcString = 
  660. CRect(
  661. CPoint(
  662. rcText.right - _cyTextMargin + __ExtMfc_CXTEXTMARGIN,
  663. rcText.top + __ExtMfc_CYTEXTMARGIN
  664. ),
  665. rcText.Size() //m_sizeHorz
  666. );
  667. rcString.DeflateRect(2,2);
  668. if( bInvertedVerticalMode )
  669. {
  670. rcString.OffsetRect( 0, -2 );
  671. CSize ptFix( -rcString.Width() + 1, 0 );
  672. ptLineFrom.x += sizeTextMeasured.cy - 2;
  673. ptLineFrom.y = - ptLineFrom.y + sizeTextMeasured.cx - 4;
  674. ptLineTo.x += sizeTextMeasured.cy - 2;
  675. ptLineTo.y = - ptLineTo.y + sizeTextMeasured.cx - 4;
  676. ptLineFrom += rcString.TopLeft() + ptFix;
  677. ptLineTo += rcString.TopLeft() + ptFix;
  678. rcString.OffsetRect(
  679. - sizeTextMeasured.cy + 3,
  680. sizeTextMeasured.cx - 3
  681. );
  682. }
  683. else
  684. {
  685. rcString.OffsetRect( -2, 0 );
  686. CSize ptFix( -rcString.Width() + 1, 0 );
  687. ptLineFrom += rcString.TopLeft() + ptFix;
  688. ptLineTo += rcString.TopLeft() + ptFix;
  689. }
  690. dc.DrawText(
  691. sBtn,
  692. sBtn.GetLength(),
  693. rcString,
  694. DT_SINGLELINE | DT_NOCLIP | ( bNoPrefix ? (DT_NOPREFIX) : 0 )
  695. );
  696. if( nAmpIndex >= 0 )
  697. {
  698. CPen pen(
  699. PS_SOLID,
  700. 0,
  701. dc.GetTextColor()
  702. );
  703. CPen * pOldPen = dc.SelectObject( &pen );
  704. dc.MoveTo( ptLineFrom );
  705. dc.LineTo( ptLineTo );
  706. dc.SelectObject( pOldPen );
  707. } // if( nAmpIndex >= 0 )
  708. } // if( !bHorz )
  709. else
  710. {
  711. UINT nFormat =
  712. DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS;
  713. if( bCenteredText )
  714. nFormat |= DT_CENTER;
  715. else
  716. nFormat |= DT_LEFT;
  717. if( bNoPrefix )
  718. nFormat |= DT_NOPREFIX;
  719. dc.DrawText(
  720. sItemText,
  721. sItemText.GetLength(),
  722. rcText,
  723. nFormat
  724. );
  725. }
  726. dc.SelectObject( pOldFont );
  727. dc.SetBkMode( nOldBkMode );
  728. dc.SetTextColor( clrOldText );
  729. } // if we have sense to paint text on tab item
  730. if( pIconTabItemCloseButton != NULL )
  731. {
  732. ASSERT( ! pIconTabItemCloseButton->IsEmpty() );
  733. if( dc.RectVisible( &rcTabItemCloseButton ) )
  734. {
  735. CRect _rcTabItemCloseButton = rcTabItemCloseButton;
  736. if( bHorz )
  737. {
  738. if( bTopLeft )
  739. _rcTabItemCloseButton.OffsetRect( 0, 2 );
  740. }
  741. else
  742. {
  743. if( bTopLeft )
  744. _rcTabItemCloseButton.OffsetRect( 2, 0 );
  745. }
  746. pIconTabItemCloseButton->Paint(
  747. g_PaintManager.GetPM(),
  748. dc.m_hDC,
  749. _rcTabItemCloseButton,
  750. ePaintStateITICB
  751. );
  752. }
  753. } // if( pIconTabItemCloseButton != NULL )
  754. }
  755. #endif // #if (!defined __EXT_MFC_NO_TAB_CTRL)
  756. void CExtPaintManagerStudio2005::InitTranslatedColors()
  757. {
  758. ASSERT_VALID( this );
  759. CExtPaintManagerOffice2003::InitTranslatedColors();
  760. if( stat_GetBPP() > 8 )
  761. {
  762. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  763. if( OnQueryUseThemeColors() )
  764. {
  765. // if use WinXP themed colors
  766. COLORREF clrFillHint, clrAccentHint;
  767. OnQueryThemeColors( &clrFillHint, &clrAccentHint );
  768. // re-install XP colors
  769. // xp - menu area light ver, menu items background color
  770. COLORREF xpclr_MenuLight = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.95, -0.05 );
  771. xpclr_MenuLight = RGB(
  772. GetRValue(xpclr_MenuLight) + ::MulDiv( 255 - GetRValue(xpclr_MenuLight), 40, 100 ),
  773. GetGValue(xpclr_MenuLight) + ::MulDiv( 255 - GetGValue(xpclr_MenuLight), 20, 100 ),
  774. GetBValue(xpclr_MenuLight) );
  775. // 2003 - float light
  776. COLORREF xpclr_FloatFace = clrFillHint;
  777. // xp - rarely used item left side
  778. COLORREF xpclr_RarelyUsedMenuLeft = RGB(
  779. ( 999L*long(GetRValue(clrFillHint)) ) / 1000L,
  780. ( 995L*long(GetGValue(clrFillHint)) ) / 1000L,
  781. ( 995L*long(GetBValue(clrFillHint)) ) / 1000L );
  782. // xp - control bar background
  783. COLORREF xpclr_ControlBarBk = clrFillHint;
  784. // xp - blue like light ver
  785. COLORREF xpclr_Highlight = CExtBitmap::stat_HLS_Adjust( clrAccentHint, 0.00, 0.70, 0.00 );
  786. // xp - blue like dark ver
  787. COLORREF xpclr_HighlightDarked = CExtBitmap::stat_HLS_Adjust( clrAccentHint, 0.00, 0.50, 0.00 );
  788. // xp - blue dark selected border
  789. COLORREF xpclr_HighlightBorder = clrAccentHint;
  790. // xp - dark gray separator
  791. COLORREF xpclr_Separator = RGB(
  792. ( 857L*long(GetRValue(clrFillHint)) ) / 1000L,
  793. ( 857L*long(GetGValue(clrFillHint)) ) / 1000L,
  794. ( 857L*long(GetBValue(clrFillHint)) ) / 1000L );
  795. // xp - dark panel border (for floating controlbars)
  796. COLORREF xpclr_PanelBorder = xpclr_MenuLight;
  797. if( eCurrentTheme != ThemeLunaSilver )
  798. {
  799. m_mapColorTranslate[CLR_3DFACE_OUT] = InstallColor( xpclr_ControlBarBk );
  800. m_mapColorTranslate[CLR_3DFACE_IN] = InstallColor( xpclr_Highlight );
  801. m_mapColorTranslate[CLR_3DFACE_DISABLED] = COLOR_3DFACE;
  802. int idxClrDark = InstallColor( xpclr_PanelBorder );
  803. m_mapColorTranslate[CLR_3DLIGHT_OUT] = idxClrDark;
  804. m_mapColorTranslate[CLR_3DLIGHT_IN] = idxClrDark;
  805. m_mapColorTranslate[CLR_3DLIGHT_DISABLED] = idxClrDark;
  806. m_mapColorTranslate[CLR_3DHILIGHT_OUT] = idxClrDark;
  807. m_mapColorTranslate[CLR_3DHILIGHT_IN] = idxClrDark;
  808. m_mapColorTranslate[CLR_3DHILIGHT_DISABLED] = idxClrDark;
  809. // - 2.55
  810. //  m_mapColorTranslate[CLR_3DSHADOW_OUT] = idxClrDark;
  811. //  m_mapColorTranslate[CLR_3DSHADOW_IN] = idxClrDark;
  812. //  m_mapColorTranslate[CLR_3DSHADOW_DISABLED] = idxClrDark;
  813. m_mapColorTranslate[CLR_3DDKSHADOW_OUT] = idxClrDark;
  814. m_mapColorTranslate[CLR_3DDKSHADOW_IN] = idxClrDark;
  815. m_mapColorTranslate[CLR_3DDKSHADOW_DISABLED] = idxClrDark;
  816. m_mapColorTranslate[CLR_TEXT_OUT] = COLOR_WINDOWTEXT;
  817. m_mapColorTranslate[CLR_TEXT_IN] = COLOR_WINDOWTEXT;
  818. m_mapColorTranslate[CLR_TEXT_DISABLED] = COLOR_GRAYTEXT;
  819. m_mapColorTranslate[XPCLR_TEXT_FIELD_BORDER_NORMAL]   = COLOR_3DFACE;
  820. m_mapColorTranslate[XPCLR_TEXT_FIELD_BORDER_DISABLED] = InstallColor( xpclr_Separator );
  821. m_mapColorTranslate[XPCLR_PUSHEDHOVERTEXT]          = COLOR_BTNTEXT;
  822. m_mapColorTranslate[XPCLR_3DFACE_DARK]              = InstallColor( xpclr_ControlBarBk );
  823. m_mapColorTranslate[XPCLR_3DFACE_NORMAL]            = InstallColor( xpclr_MenuLight );
  824. m_mapColorTranslate[XPCLR_SEPARATOR]                = InstallColor( xpclr_Separator ); 
  825. m_mapColorTranslate[XPCLR_HILIGHT]                  = InstallColor( xpclr_HighlightDarked ); 
  826. m_mapColorTranslate[XPCLR_HILIGHT_BORDER]           = InstallColor( xpclr_HighlightBorder ); 
  827. m_mapColorTranslate[XPCLR_HILIGHT_BORDER_SELECTED]  = InstallColor( xpclr_HighlightBorder ); 
  828. m_mapColorTranslate[XPCLR_RARELY_BORDER]            = InstallColor( xpclr_RarelyUsedMenuLeft );
  829. m_mapColorTranslate[XPCLR_3DFACE_FLOAT_F]           = InstallColor( xpclr_FloatFace );
  830. // install new colors
  831. m_mapColorTranslate[_2003CLR_GRADIENT_LIGHT]        = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.80, 0.00 ) );
  832. m_mapColorTranslate[_2003CLR_GRADIENT_DARK]         = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.15, 0.00 ) );
  833. m_mapColorTranslate[_2003CLR_SEPARATOR_LIGHT]       = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.98, 0.00 ) );
  834. m_mapColorTranslate[_2003CLR_SEPARATOR_DARK]        = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.40, 0.00 ) );
  835. m_mapColorTranslate[_2003CLR_GRIPPER_DOT_DARK]      = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.20, 0.00 ) );
  836. m_mapColorTranslate[_2003CLR_GRIPPER_DOT_LIGHT]     = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.95, 0.00 ) );
  837. m_mapColorTranslate[_2003CLR_EXPBTN_LIGHT]          = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.60, 0.00 ) );
  838. m_mapColorTranslate[_2003CLR_EXPBTN_DARK]           = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.40, -0.40 ) );
  839. m_mapColorTranslate[_2003CLR_EXPBTN_HOVER_LIGHT]    = InstallColor( xpclr_Highlight );
  840. m_mapColorTranslate[_2003CLR_EXPBTN_HOVER_DARK]     = InstallColor( xpclr_Highlight );
  841. m_mapColorTranslate[_2003CLR_EXPBTN_PRESSED_LIGHT]  = InstallColor( xpclr_HighlightDarked );
  842. m_mapColorTranslate[_2003CLR_EXPBTN_PRESSED_DARK]   = InstallColor( xpclr_HighlightDarked );
  843. m_mapColorTranslate[_2003CLR_EXPGLYPH_LIGHT]        = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.97, 0.00 ) );
  844. m_mapColorTranslate[_2003CLR_EXPGLYPH_DARK]         = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.97, 0.00 ) );
  845. m_mapColorTranslate[_2003CLR_STATUSBAR_ITEM] = COLOR_3DSHADOW;
  846. COLORREF clrTbGradientLight  = (COLORREF)(-1L);
  847. COLORREF clrTbGradientMiddle = (COLORREF)(-1L);
  848. COLORREF clrTbGradientDark   = (COLORREF)(-1L);
  849. COLORREF clrTbBottomLine     = (COLORREF)(-1L);
  850. COLORREF clrMlaNormLeft      = (COLORREF)(-1L);
  851. COLORREF clrMlaNormMiddle    = (COLORREF)(-1L);
  852. COLORREF clrMlaNormRight     = (COLORREF)(-1L);
  853. COLORREF clrMlaRarelyLeft    = (COLORREF)(-1L);
  854. COLORREF clrMlaRarelyMiddle  = (COLORREF)(-1L);
  855. COLORREF clrMlaRarelyRight   = (COLORREF)(-1L);
  856. COLORREF clrMenuBorder       = (COLORREF)(-1L);
  857. COLORREF clrTbbBkTop         = (COLORREF)(-1L);
  858. COLORREF clrTbbBkBottom      = (COLORREF)(-1L);
  859. switch( eCurrentTheme ) 
  860. {
  861. case ThemeLunaRoyale:       // +2.87
  862. // case ThemeVistaOrLaterUX:   // +2.87 -2.88
  863. // case ThemeVistaOrLaterDWM:  // +2.87 -2.88
  864. case ThemeLunaBlue:
  865. case ThemeLunaOlive:
  866. clrTbGradientLight  = RGB(250, 249, 245);
  867. clrTbGradientMiddle = RGB(235, 231, 224);
  868. clrTbGradientDark   = RGB(180, 182, 153);
  869. clrTbBottomLine     = RGB(163, 163, 124);
  870. clrMlaNormLeft      = RGB(252, 252, 249);
  871. clrMlaNormMiddle    = RGB(246, 244, 236);
  872. clrMlaNormRight     = RGB(186, 186, 160);
  873. clrMlaRarelyLeft    = RGB(245, 245, 241);
  874. clrMlaRarelyMiddle  = RGB(222, 222, 209);
  875. clrMlaRarelyRight   = RGB(165, 165, 127);
  876. clrMenuBorder       = RGB(138, 134, 122);
  877. clrTbbBkTop         = RGB(251, 251, 249);
  878. clrTbbBkBottom      = RGB(247, 245, 239);
  879. break;
  880. case ThemeLunaSilver:
  881. ASSERT( FALSE );
  882. break;
  883. case ThemeVistaOrLaterUX:   // +2.88
  884. case ThemeVistaOrLaterDWM:  // +2.88
  885. m_mapColorTranslate[_2003CLR_EXPBTN_LIGHT]   = InstallColor( RGB(236, 236, 236) );
  886. m_mapColorTranslate[_2003CLR_EXPBTN_DARK]    = InstallColor( RGB(160, 160, 160) );
  887. m_mapColorTranslate[_2003CLR_GRADIENT_LIGHT] = InstallColor( RGB(251, 251, 251) );
  888. m_mapColorTranslate[_2003CLR_GRADIENT_DARK]  = InstallColor( RGB(240, 240, 240) );
  889. clrTbGradientLight  = RGB(251, 251, 251);
  890. clrTbGradientMiddle = RGB(244, 244, 244);
  891. clrTbGradientDark   = RGB(242, 242, 242);
  892. clrTbBottomLine     = RGB(242, 242, 242);
  893. clrMlaNormLeft      = RGB(252, 252, 252);
  894. clrMlaNormRight     = RGB(241, 241, 241);
  895. clrMlaNormMiddle    = RGB(248, 248, 248);
  896. clrMlaRarelyLeft    = CExtBitmap::stat_HLS_Adjust( clrMlaNormLeft,   0.00, -0.10, 0.00 );
  897. clrMlaRarelyRight   = CExtBitmap::stat_HLS_Adjust( clrMlaNormRight,  0.00, -0.10, 0.00 );
  898. clrMlaRarelyMiddle  = CExtBitmap::stat_HLS_Adjust( clrMlaNormMiddle, 0.00, -0.10, 0.00 );
  899. clrMenuBorder       = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.50, 0.00 );
  900. clrTbbBkTop         = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.98, 0.00 );
  901. clrTbbBkBottom      = CExtBitmap::stat_HLS_Adjust( GetColor( XPCLR_3DFACE_DARK, this ), 0.00, -0.20, -0.10 );
  902. break;
  903. default:
  904. clrTbGradientLight  = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.75, 0.15 );
  905. clrTbGradientMiddle = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.65, 0.15 );
  906. clrTbGradientDark   = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00,-0.22,-0.25 );
  907. clrTbBottomLine     = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.60, 0.00 );
  908. clrMlaNormLeft      = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.98, 0.00 );
  909. clrMlaNormRight     = CExtBitmap::stat_HLS_Adjust( GetColor( XPCLR_3DFACE_DARK, this ), 0.00, -0.20, -0.10 );
  910. clrMlaNormMiddle    = CExtBitmap::stat_HLS_Adjust( clrMlaNormRight, 0.00, 0.55, 0.00 );
  911. clrMlaRarelyLeft    = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.98, 0.00 );
  912. clrMlaRarelyRight   = CExtBitmap::stat_HLS_Adjust( GetColor( XPCLR_3DFACE_DARK, this ), 0.00, -0.40, -0.10 );
  913. clrMlaRarelyMiddle  = CExtBitmap::stat_HLS_Adjust( clrMlaRarelyRight, 0.00, 0.55, 0.00 );
  914. clrMenuBorder       = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.50, 0.00 );
  915. clrTbbBkTop         = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.98, 0.00 );
  916. clrTbbBkBottom      = CExtBitmap::stat_HLS_Adjust( GetColor( XPCLR_3DFACE_DARK, this ), 0.00, -0.20, -0.10 );
  917. break;
  918. } // switch( eCurrentTheme ) 
  919. m_mapColorTranslate[_2003CLR_TBB_BK_COMBINED_TOP]      = InstallColor( clrTbbBkTop );
  920. m_mapColorTranslate[_2003CLR_TBB_BK_COMBINED_BOTTOM]   = InstallColor( clrTbbBkBottom );
  921. m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_LIGHT]   = InstallColor( clrTbGradientLight );
  922. m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_MIDDLE]  = InstallColor( clrTbGradientMiddle );
  923. m_mapColorTranslate[_2003CLR_TOOLBAR_GRADIENT_DARK]    = InstallColor( clrTbGradientDark );
  924. m_mapColorTranslate[_2003CLR_TOOLBAR_BOTTOM_LINE]      = InstallColor( clrTbBottomLine );
  925. m_mapColorTranslate[_2003CLR_MLA_NORM_LEFT]            = InstallColor( clrMlaNormLeft );
  926. m_mapColorTranslate[_2003CLR_MLA_NORM_MIDDLE]          = InstallColor( clrMlaNormMiddle );
  927. m_mapColorTranslate[_2003CLR_MLA_NORM_RIGHT]           = InstallColor( clrMlaNormRight );
  928. m_mapColorTranslate[_2003CLR_MLA_RARELY_LEFT]          = InstallColor( clrMlaRarelyLeft );
  929. m_mapColorTranslate[_2003CLR_MLA_RARELY_MIDDLE]        = InstallColor( clrMlaRarelyMiddle );
  930. m_mapColorTranslate[_2003CLR_MLA_RARELY_RIGHT]         = InstallColor( clrMlaRarelyRight );
  931. m_mapColorTranslate[XPCLR_MENU_BORDER]                 = InstallColor( clrMenuBorder );
  932. m_mapColorTranslate[_2003CLR_BTN_HOVER_LEFT]           =  InstallColor( xpclr_Highlight );
  933. m_mapColorTranslate[_2003CLR_BTN_HOVER_RIGHT]          = InstallColor( xpclr_Highlight );
  934. m_mapColorTranslate[_2003CLR_BTN_PRESSED_LEFT]         = InstallColor( xpclr_HighlightDarked );
  935. m_mapColorTranslate[_2003CLR_BTN_PRESSED_RIGHT]        = InstallColor( xpclr_HighlightDarked );
  936. m_mapColorTranslate[_2003CLR_BTN_HP_LEFT]              = InstallColor( xpclr_HighlightDarked );
  937. m_mapColorTranslate[_2003CLR_BTN_HP_RIGHT]             = InstallColor( xpclr_HighlightDarked );
  938. // page navigator colors
  939. m_mapColorTranslate[_2003CLR_PN_BORDER]                = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.10, -0.55, 0.00 ) );
  940. m_mapColorTranslate[_2003CLR_PN_GRIPPER_LIGHT]         = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.02, -0.23, -0.25 ) );
  941. m_mapColorTranslate[_2003CLR_PN_GRIPPER_DARK]          = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.05, -0.60, 0.00 ) );
  942. m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_LIGHT]    = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.45, 0.00 ) );
  943. m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_DARK]     = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.00, 0.00 ) );
  944. m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_HOVER_LIGHT] = m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_LIGHT];
  945. m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_HOVER_DARK]  = m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_DARK];
  946. m_mapColorTranslate[_2003CLR_PN_PANE_CAPTION_BOTTOM_LINE] = m_mapColorTranslate[_2003CLR_PN_BORDER];
  947. m_mapColorTranslate[_2003CLR_PN_ITEM_LIGHT]            = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.55, 0.20 ) );
  948. m_mapColorTranslate[_2003CLR_PN_ITEM_DARK]             = InstallColor( CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.13, -0.15 ) );
  949. // Popup menu Expand Button
  950. m_mapColorTranslate[_2003CLR_EXPBTN_CIRCLE_LIGHT]      = InstallColor( GetColor( _2003CLR_MLA_NORM_LEFT, this ) );
  951. m_mapColorTranslate[_2003CLR_EXPBTN_CIRCLE_DARK]       = InstallColor( GetColor( _2003CLR_MLA_NORM_RIGHT, this ) );
  952. m_nIdxClrBtnHoverLeft    = _2003CLR_BTN_HOVER_LEFT;
  953. m_nIdxClrBtnHoverRight   = _2003CLR_BTN_HOVER_RIGHT;
  954. m_nIdxClrBtnPressedLeft  = _2003CLR_BTN_PRESSED_LEFT;
  955. m_nIdxClrBtnPressedRight = _2003CLR_BTN_PRESSED_RIGHT;
  956. m_nIdxClrBtnHovPresLeft  = _2003CLR_BTN_HP_LEFT;
  957. m_nIdxClrBtnHovPresRight = _2003CLR_BTN_HP_RIGHT;
  958. m_nIdxClrTbFillMargin    = _2003CLR_EXPBTN_DARK;
  959. m_colors[COLOR_3DFACE]      = clrFillHint;
  960. m_colors[COLOR_3DLIGHT]     = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.10, 0.00 );
  961. m_colors[COLOR_3DHIGHLIGHT] = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.95, 0.00 );
  962. m_colors[COLOR_3DSHADOW]    = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.30, -0.50 );
  963. m_colors[COLOR_3DDKSHADOW]  = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, -0.70, -0.50 );
  964. } // if( eCurrentTheme != ThemeLunaSilver ....
  965. COLORREF clrBarCaptionInactive     = (COLORREF)(-1L);
  966. COLORREF clrBarCaptionActiveTop    = (COLORREF)(-1L);
  967. COLORREF clrBarCaptionActiveBottom = (COLORREF)(-1L);
  968. switch( eCurrentTheme ) 
  969. {
  970. case ThemeLunaRoyale:       // +2.87
  971. // case ThemeVistaOrLaterUX:   // +2.87 -2.88
  972. // case ThemeVistaOrLaterDWM:  // +2.87 -2.88
  973. case ThemeLunaBlue:
  974. clrBarCaptionInactive = RGB( 204, 199, 186 );
  975. clrBarCaptionActiveTop = RGB(  59, 128, 237 );
  976. clrBarCaptionActiveBottom = RGB(  49, 106, 197 );
  977. break;
  978. case ThemeLunaOlive:
  979. clrBarCaptionInactive = RGB( 204, 199, 186 );
  980. clrBarCaptionActiveTop = RGB( 182, 195, 146 );
  981. clrBarCaptionActiveBottom = RGB( 145, 160, 117 );
  982. break;
  983. case ThemeLunaSilver:
  984. clrBarCaptionInactive = RGB( 240, 240, 245 );
  985. clrBarCaptionActiveTop = RGB( 211, 212, 221 );
  986. clrBarCaptionActiveBottom = RGB( 166, 165, 191 );
  987. break;
  988. case ThemeVistaOrLaterUX:   // +2.88
  989. case ThemeVistaOrLaterDWM:  // +2.88
  990. default:
  991. clrBarCaptionInactive = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.80, 0.00 );
  992. clrBarCaptionActiveTop = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00, 0.40, 0.00 );
  993. clrBarCaptionActiveBottom = CExtBitmap::stat_HLS_Adjust( clrFillHint, 0.00,-0.15, 0.00 );
  994. break;
  995. } // switch( eCurrentTheme ) 
  996. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_INACTIVE]      = InstallColor( clrBarCaptionInactive );
  997. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_ACTIVE_TOP]    = InstallColor( clrBarCaptionActiveTop );
  998. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_ACTIVE_BOTTOM] = InstallColor( clrBarCaptionActiveBottom );
  999. } // if use WinXP themed colors
  1000. else
  1001. {
  1002. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_INACTIVE]      = COLOR_INACTIVECAPTION;
  1003. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_ACTIVE_TOP]    = COLOR_ACTIVECAPTION;
  1004. m_mapColorTranslate[_STUDIO_2005CLR_BAR_CAPTION_ACTIVE_BOTTOM] = COLOR_ACTIVECAPTION;
  1005. }
  1006. // Task Pane Colors
  1007. m_mapColorTranslate[ CLR_TASK_PANE_BK_TOP ]    = InstallColor( CExtBitmap::stat_RGB_Enlight( GetColor( COLOR_3DFACE, this ), GetColor( COLOR_WINDOW, this ), 50 ) );
  1008. m_mapColorTranslate[ CLR_TASK_PANE_BK_BOTTOM ] = InstallColor( CExtBitmap::stat_RGB_Enlight( GetColor( COLOR_3DSHADOW, this ), GetColor( COLOR_WINDOW, this ), 60 ) );
  1009. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL ]         = InstallColor( GetColor( COLOR_WINDOWTEXT, this ) );
  1010. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED ] = InstallColor(  GetColor( COLOR_WINDOWTEXT, this ) );
  1011. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED ]    = m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL ];
  1012. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED ] = m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED ];
  1013. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_NORMAL]        = InstallColor( CExtBitmap::stat_RGB_Enlight( GetColor( COLOR_3DFACE, this ), GetColor( COLOR_WINDOW, this ), 39 ) );
  1014. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL]       = InstallColor( CExtBitmap::stat_RGB_Enlight( GetColor( COLOR_3DSHADOW, this ), GetColor( COLOR_WINDOW, this ), 60 ) );
  1015. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_HIGHLIGHTED]   = m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL];
  1016. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_HIGHLIGHTED]  =  m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_NORMAL];
  1017. } // if( stat_GetBPP() > 8 )
  1018. }
  1019. int CExtPaintManager::GetThemeDockingType() const
  1020. {
  1021. ASSERT_VALID( this );
  1022. return int(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2003);
  1023. }
  1024. int CExtPaintManagerStudio2005::GetThemeDockingType() const
  1025. {
  1026. ASSERT_VALID( this );
  1027. if( IsHighContrast() )
  1028. return CExtPaintManagerXP::GetThemeDockingType();
  1029. #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
  1030. return int(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2005);
  1031. #else
  1032. return CExtPaintManagerOffice2003::GetThemeDockingType();
  1033. #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
  1034. }
  1035. int CExtPaintManagerOffice2007_Impl::GetThemeDockingType() const
  1036. {
  1037. ASSERT_VALID( this );
  1038. if( IsHighContrast() )
  1039. return CExtPaintManagerXP::GetThemeDockingType();
  1040. #if (!defined __EXT_MFC_NO_DOCK_MARKERS)
  1041. return int(CExtControlBar::__RESIZABLE_DOCKING_TYPE_STUDIO_2005);
  1042. #else
  1043. return CExtPaintManagerOffice2003::GetThemeDockingType();
  1044. #endif // (!defined __EXT_MFC_NO_DOCK_MARKERS)
  1045. }
  1046. #if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  1047. int CExtPaintManager::GetAutoHideTabsType() const
  1048. {
  1049. ASSERT_VALID( this );
  1050. return int(CExtControlBar::__AUTOHIDE_TABS_TYPE_STUDIO_2003);
  1051. }
  1052. int CExtPaintManagerStudio2005::GetAutoHideTabsType() const
  1053. {
  1054. ASSERT_VALID( this );
  1055. if( IsHighContrast() )
  1056. return CExtPaintManagerXP::GetAutoHideTabsType();
  1057. return int(CExtControlBar::__AUTOHIDE_TABS_TYPE_STUDIO_2005);
  1058. }
  1059. int CExtPaintManagerOffice2007_Impl::GetAutoHideTabsType() const
  1060. {
  1061. ASSERT_VALID( this );
  1062. if( IsHighContrast() )
  1063. return CExtPaintManagerXP::GetAutoHideTabsType();
  1064. return int(CExtControlBar::__AUTOHIDE_TABS_TYPE_STUDIO_2005);
  1065. }
  1066. #endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  1067. bool CExtPaintManagerStudio2005::OnQueryThemeColors(
  1068. COLORREF *pclrFillHint,
  1069. COLORREF *pclrAccentHint // = NULL
  1070. )
  1071. {
  1072. ASSERT_VALID( this );
  1073. bool bRet = CExtPaintManagerOffice2003::OnQueryThemeColors( pclrFillHint, pclrAccentHint );
  1074. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  1075. if( OnQueryUseThemeColors()
  1076. && ( eCurrentTheme == ThemeLunaRoyale       // +2.87
  1077. || eCurrentTheme == ThemeVistaOrLaterUX   // +2.87
  1078. || eCurrentTheme == ThemeVistaOrLaterDWM  // +2.87
  1079. || eCurrentTheme == ThemeLunaBlue
  1080. || eCurrentTheme == ThemeLunaOlive
  1081. )
  1082. )
  1083. {
  1084. if( pclrFillHint == NULL && pclrAccentHint == NULL )
  1085. return true;
  1086. if( pclrFillHint != NULL )
  1087. *pclrFillHint = RGB(225, 225, 210);
  1088. if( pclrAccentHint != NULL )
  1089. {
  1090. switch( eCurrentTheme )
  1091. {
  1092. case ThemeLunaOlive:    (*pclrAccentHint) = RGB(147, 160, 112);   break;
  1093. default:                (*pclrAccentHint) = RGB( 49, 106, 197);   break;
  1094. } // switch( eCurrentTheme )
  1095. } // if( pclrAccentHint != NULL )
  1096. return true;
  1097. }
  1098. return bRet;
  1099. }
  1100. bool CExtPaintManagerXP::OnQueryUseThemeColors() const
  1101. {
  1102. ASSERT_VALID( this );
  1103. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  1104. bool bUseThemedColors = ( g_PaintManager.m_UxTheme.IsAppThemed() && eCurrentTheme != ThemeUnknown );
  1105. return bUseThemedColors;
  1106. }
  1107. bool CExtPaintManager::OnQueryUseThemeColors() const
  1108. {
  1109. ASSERT_VALID( this );
  1110. return false;
  1111. }
  1112. CExtPaintManager::e_system_theme_t CExtPaintManager::OnQuerySystemTheme() const
  1113. {
  1114. if( g_PaintManager.m_eCurrentTheme == ThemeUnknown )
  1115. {
  1116. if( g_PaintManager.m_bIsWinVistaOrLater )
  1117. {
  1118. if( g_PaintManager.m_DWM.IsCompositionEnabled() )
  1119. return ThemeVistaOrLaterDWM;
  1120. if( g_PaintManager.m_UxTheme.IsAppThemed() )
  1121. return ThemeVistaOrLaterUX;
  1122. }
  1123. }
  1124. return g_PaintManager.m_eCurrentTheme;
  1125. }
  1126. bool CExtPaintManager::IsHighContrast() const
  1127. {
  1128. COLORREF clr3DFace = ::GetSysColor( COLOR_3DFACE );
  1129. if( clr3DFace == RGB(255,255,255) 
  1130. || clr3DFace == RGB(0,0,0)
  1131. )
  1132. return true;
  1133. return false;
  1134. }
  1135. void CExtPaintManager::PaintBarButtonCombinedArea(
  1136. CDC & dc,
  1137. CExtBarButton * pTBB,
  1138. LPARAM lParam // = 0L
  1139. )
  1140. {
  1141. ASSERT_VALID( this );
  1142. ASSERT( dc.GetSafeHdc() != NULL );
  1143. ASSERT_VALID( pTBB );
  1144. ASSERT_VALID( pTBB->GetBar() );
  1145. dc;
  1146. pTBB;
  1147. lParam;
  1148. }
  1149. void CExtPaintManagerOffice2003::PaintBarButtonCombinedArea(
  1150. CDC & dc,
  1151. CExtBarButton * pTBB,
  1152. LPARAM lParam // = 0L
  1153. )
  1154. {
  1155. ASSERT_VALID( (&dc) );
  1156. ASSERT( dc.GetSafeHdc() != NULL );
  1157. ASSERT_VALID( pTBB );
  1158. ASSERT_VALID( pTBB->GetBar() );
  1159. if( IsHighContrast() )
  1160. {
  1161. CExtPaintManagerXP::PaintBarButtonCombinedArea( dc, pTBB, lParam );
  1162. return;
  1163. }
  1164. if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8 )
  1165. {
  1166. CExtPaintManagerXP::PaintBarButtonCombinedArea( dc, pTBB, lParam );
  1167. return;
  1168. }
  1169. CExtToolControlBar * pBar = pTBB->GetBar();
  1170. ASSERT_VALID( pBar );
  1171. bool bHorz = pBar->IsDockedVertically() ? false : true;
  1172. bool bMenuBar = pBar->IsKindOf( RUNTIME_CLASS( CExtMenuControlBar ) ) ? true : false;
  1173. CRect rcTBB = pTBB->Rect();
  1174. CRect rcPaintGradient = rcTBB;
  1175. rcPaintGradient.DeflateRect( 1, 1 );
  1176. INT nGradientHeight = 21;
  1177. if( bHorz )
  1178. nGradientHeight = max( nGradientHeight, rcTBB.Height() );
  1179. else
  1180. nGradientHeight = max( nGradientHeight, rcTBB.Width() );
  1181. rcPaintGradient.bottom = rcPaintGradient.top + nGradientHeight;
  1182. COLORREF clrTbbBkTop = GetColor( _2003CLR_TBB_BK_COMBINED_TOP, pTBB, lParam );
  1183. COLORREF clrTbbBkBottom = GetColor( _2003CLR_TBB_BK_COMBINED_BOTTOM, pTBB, lParam );
  1184. if( bHorz )
  1185. {
  1186. if( bMenuBar )
  1187. {
  1188. CRect rcBk( rcTBB );
  1189. rcBk.DeflateRect( 1, 1, 1, 0 );
  1190. dc.FillSolidRect( &rcBk, GetColor( XPCLR_3DFACE_NORMAL, pTBB, lParam ) );
  1191. CRect rcExclude( rcPaintGradient );
  1192. rcExclude.top = rcTBB.bottom - 1;
  1193. dc.ExcludeClipRect( &rcExclude );
  1194. stat_PaintGradientRect( dc, rcPaintGradient, clrTbbBkBottom, clrTbbBkTop, true );
  1195. dc.SelectClipRgn( NULL );
  1196. }
  1197. else
  1198. {
  1199. CRect rc = rcTBB;
  1200. rc.DeflateRect( 1, 1 );
  1201. stat_PaintGradientRect( dc, rc, clrTbbBkBottom, clrTbbBkTop, true );
  1202. }
  1203. }
  1204. else
  1205. {
  1206. stat_PaintGradientRect( dc, rcPaintGradient, clrTbbBkBottom, clrTbbBkTop, true );
  1207. if( rcTBB.bottom > rcPaintGradient.bottom )
  1208. {
  1209. CRect rcRest( rcPaintGradient.left, rcPaintGradient.bottom, rcPaintGradient.right, rcTBB.bottom );
  1210. dc.FillSolidRect( &rcRest, clrTbbBkBottom );
  1211. }
  1212. }
  1213. if( (! bHorz )
  1214. && (! pTBB->IsKindOf( RUNTIME_CLASS(CExtBarColorButton) ) )
  1215. && (! pTBB->GetSeparatedDropDown() )
  1216. )
  1217. {
  1218. COLORREF clrDkBorder = GetColor( XPCLR_MENU_BORDER, pTBB, lParam );
  1219. dc.Draw3dRect( pTBB->Rect(), clrDkBorder, clrDkBorder );
  1220. }
  1221. }
  1222. void CExtPaintManagerStudio2005::PaintGripper(
  1223. CDC & dc,
  1224. CExtPaintManager::PAINTGRIPPERDATA & _pgd
  1225. )
  1226. {
  1227. ASSERT_VALID( this );
  1228. ASSERT( dc.GetSafeHdc() != NULL );
  1229. if( IsHighContrast() )
  1230. {
  1231. CExtPaintManagerXP::PaintGripper( dc, _pgd );
  1232. return;
  1233. }
  1234. switch( m_eStyle2005 )
  1235. {
  1236. case __ES2005_BETA1:
  1237. if( _pgd.m_bSideBar )
  1238. CExtPaintManager::PaintGripper( dc, _pgd );
  1239. else
  1240. CExtPaintManagerOffice2003::PaintGripper( dc, _pgd );
  1241. break;
  1242. case __ES2005_BETA2:
  1243. case __ES2005_RC:
  1244. if( _pgd.m_bSideBar )
  1245. {
  1246. CWnd * pBar = STATIC_DOWNCAST( CWnd, _pgd.m_pHelperSrc );
  1247. ASSERT( pBar != NULL );
  1248. ASSERT_VALID( pBar );
  1249. CRect rcBarWnd, rcBarClient;
  1250. pBar->GetWindowRect( &rcBarWnd );
  1251. pBar->GetClientRect( &rcBarClient );
  1252. pBar->ClientToScreen( &rcBarClient );
  1253. CRect rcHelper( rcBarClient );
  1254. rcHelper.OffsetRect( -rcBarWnd.TopLeft() );
  1255. CRect rcGripper( _pgd.m_rcGripper );
  1256. // rcGripper.bottom = rcHelper.top + 4;
  1257. if( _pgd.m_bFlashCaptionHighlightedState )
  1258. {
  1259. ASSERT( _pgd.m_clrFlashCaptionBackground != COLORREF(-1L) );
  1260. ASSERT( _pgd.m_clrFlashCaptionText != COLORREF(-1L) );
  1261. dc.FillSolidRect(
  1262. rcGripper,
  1263. _pgd.m_clrFlashCaptionBackground
  1264. );
  1265. } // if( _pgd.m_bFlashCaptionHighlightedState )
  1266. else
  1267. {
  1268. if( stat_GetBPP() > 8 )
  1269. {
  1270. if( _pgd.m_bActive )
  1271. stat_PaintGradientRect(
  1272. dc,
  1273. rcGripper,
  1274. GetColor( _STUDIO_2005CLR_BAR_CAPTION_ACTIVE_BOTTOM ),
  1275. GetColor( _STUDIO_2005CLR_BAR_CAPTION_ACTIVE_TOP ),
  1276. !_pgd.m_bHorz
  1277. );
  1278. else
  1279. dc.FillSolidRect( 
  1280. &rcGripper, 
  1281. GetColor( _STUDIO_2005CLR_BAR_CAPTION_INACTIVE )
  1282. );
  1283. }
  1284. else
  1285. {
  1286. dc.FillSolidRect( 
  1287. &rcGripper, 
  1288. GetColor( _pgd.m_bActive ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION )
  1289. );
  1290. }
  1291. } // else from if( _pgd.m_bFlashCaptionHighlightedState )
  1292. _pgd.m_bHelperNoFill = _pgd.m_bHelperNoRect = true;
  1293. if( OnQueryUseThemeColors() )
  1294. CExtPaintManagerXP::PaintGripper( dc, _pgd );
  1295. else
  1296. CExtPaintManager::PaintGripper( dc, _pgd );
  1297. }
  1298. else
  1299. CExtPaintManagerOffice2003::PaintGripper( dc, _pgd );
  1300. break;
  1301. default:
  1302. {
  1303. ASSERT( FALSE );
  1304. AfxThrowNotSupportedException();
  1305. }
  1306. } // switch( m_eStyle2005 )
  1307. }
  1308. void CExtPaintManagerStudio2005::PaintDockingFrame(
  1309. CDC & dc,
  1310. CExtPaintManager::PAINTDOCKINGFRAMEDATA & _pdfd
  1311. )
  1312. {
  1313. ASSERT_VALID( this );
  1314. ASSERT( dc.GetSafeHdc() != NULL );
  1315. if( IsHighContrast() )
  1316. {
  1317. CExtPaintManagerXP::PaintDockingFrame( dc, _pdfd );
  1318. return;
  1319. }
  1320. if( ( _pdfd.m_pHelperSrc != NULL 
  1321. && ( _pdfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
  1322. || _pdfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtMenuControlBar))
  1323. )
  1324. )
  1325. || _pdfd.m_bExtBar == false
  1326. || _pdfd.m_bFloating == false
  1327. || _pdfd.m_rcWindow.IsRectEmpty()
  1328. )
  1329. {
  1330. CExtPaintManagerOffice2003::PaintDockingFrame(
  1331. dc,
  1332. _pdfd
  1333. );
  1334. return;
  1335. }
  1336. dc.ExcludeClipRect( _pdfd.m_rcClient );
  1337. CRect rcWnd( _pdfd.m_rcWindow );
  1338. COLORREF clr3dFace = GetColor( CLR_3DFACE_OUT, _pdfd.m_pHelperSrc, _pdfd.m_lParam );
  1339. COLORREF clr3dHilight = GetColor( COLOR_WINDOW, _pdfd.m_pHelperSrc, _pdfd.m_lParam );
  1340. COLORREF clr3dShadow = GetColor( COLOR_3DSHADOW, _pdfd.m_pHelperSrc, _pdfd.m_lParam );
  1341. COLORREF clr3dDkShadow = GetColor( COLOR_3DDKSHADOW, _pdfd.m_pHelperSrc, _pdfd.m_lParam );
  1342. dc.FillSolidRect(
  1343. &rcWnd,
  1344. clr3dFace
  1345. );
  1346. if( _pdfd.m_bFloating )
  1347. {
  1348. dc.Draw3dRect(
  1349. &rcWnd, clr3dFace, clr3dDkShadow);
  1350. rcWnd.DeflateRect(1,1);
  1351. dc.Draw3dRect(
  1352. &rcWnd, clr3dHilight, clr3dShadow);
  1353. }
  1354. else
  1355. {
  1356. if( !_pdfd.m_bExtBar )
  1357. {
  1358. dc.Draw3dRect(
  1359. &rcWnd, clr3dHilight, clr3dShadow);
  1360. }
  1361. }
  1362. dc.IntersectClipRect( _pdfd.m_rcWindow );
  1363. }
  1364. #if (!defined __EXT_MFC_NO_PAGE_NAVIGATOR )
  1365. INT CExtPaintManager::PageNavigator_GetSplitterHeight() const
  1366. {
  1367. ASSERT_VALID( this );
  1368. return UiScalingDo( 6, __EUIST_Y );
  1369. }
  1370. INT CExtPaintManagerOffice2007_Impl::PageNavigator_GetSplitterHeight() const
  1371. {
  1372. ASSERT_VALID( this );
  1373. if( IsHighContrast() )
  1374. return CExtPaintManagerXP::PageNavigator_GetSplitterHeight();
  1375. return UiScalingDo( 8, __EUIST_Y );
  1376. }
  1377. INT CExtPaintManager::PageNavigator_GetItemCaptionHeight() const
  1378. {
  1379. ASSERT_VALID( this );
  1380. return UiScalingDo( 24, __EUIST_Y );
  1381. }
  1382. INT CExtPaintManagerOffice2007_Impl::PageNavigator_GetItemCaptionHeight() const
  1383. {
  1384. ASSERT_VALID( this );
  1385. if( IsHighContrast() )
  1386. return CExtPaintManagerXP::PageNavigator_GetItemCaptionHeight();
  1387. return UiScalingDo( 27, __EUIST_Y );
  1388. }
  1389. INT CExtPaintManager::PageNavigator_GetItemPaneCaptionHeight() const
  1390. {
  1391. ASSERT_VALID( this );
  1392. return UiScalingDo( 19, __EUIST_Y );
  1393. }
  1394. INT CExtPaintManagerOffice2007_Impl::PageNavigator_GetItemPaneCaptionHeight() const
  1395. {
  1396. ASSERT_VALID( this );
  1397. if( IsHighContrast() )
  1398. return CExtPaintManagerXP::PageNavigator_GetItemPaneCaptionHeight();
  1399. return UiScalingDo( 20, __EUIST_Y );
  1400. }
  1401. void CExtPaintManager::PaintPageNavigatorClientArea(
  1402. CDC & dc,
  1403. const RECT & rcClient,
  1404. CObject * pHelperSrc
  1405. )
  1406. {
  1407. ASSERT_VALID( this );
  1408. ASSERT( dc.GetSafeHdc() != NULL );
  1409. if( ! dc.RectVisible(&rcClient) )
  1410. return;
  1411. dc.FillSolidRect( &rcClient, GetColor( COLOR_WINDOW, pHelperSrc ) );
  1412. }
  1413. void CExtPaintManager::PaintPageNavigatorBorder(
  1414. CDC & dc,
  1415. const RECT & rcControl
  1416. )
  1417. {
  1418. ASSERT_VALID( this );
  1419. ASSERT( dc.GetSafeHdc() != NULL );
  1420. if( ! dc.RectVisible(&rcControl) )
  1421. return;
  1422. dc.Draw3dRect( &rcControl, GetColor( COLOR_3DSHADOW, this ), GetColor( COLOR_WINDOW, this ) );
  1423. }
  1424. void CExtPaintManagerXP::PaintPageNavigatorBorder(
  1425. CDC & dc,
  1426. const RECT & rcControl
  1427. )
  1428. {
  1429. ASSERT_VALID( this );
  1430. ASSERT( dc.GetSafeHdc() != NULL );
  1431. if( ! dc.RectVisible(&rcControl) )
  1432. return;
  1433. CBrush brBorder( GetColor( COLOR_3DSHADOW, this ) );
  1434. dc.FrameRect( &rcControl, &brBorder );
  1435. }
  1436. void CExtPaintManagerOffice2003::PaintPageNavigatorBorder(
  1437. CDC & dc,
  1438. const RECT & rcControl
  1439. )
  1440. {
  1441. ASSERT_VALID( this );
  1442. ASSERT( dc.GetSafeHdc() != NULL );
  1443. if( ! dc.RectVisible(&rcControl) )
  1444. return;
  1445. if( IsHighContrast() )
  1446. {
  1447. CExtPaintManagerXP::PaintPageNavigatorBorder( dc, rcControl );
  1448. return;
  1449. }
  1450. CBrush brBorder( GetColor( _2003CLR_PN_BORDER, this ) );
  1451. dc.FrameRect( &rcControl, &brBorder );
  1452. }
  1453. void CExtPaintManager::PaintPageNavigatorItemCaptionText(
  1454. CDC & dc,
  1455. const CRect & rcCaption,
  1456. __EXT_MFC_SAFE_LPCTSTR strCaption
  1457. )
  1458. {
  1459. ASSERT_VALID( this );
  1460. ASSERT( dc.GetSafeHdc() != NULL );
  1461. if( ! dc.RectVisible(&rcCaption) )
  1462. return;
  1463. if( strCaption == NULL )
  1464. return;
  1465. // caption text
  1466. LOGFONT lf = { sizeof(LOGFONT) };
  1467. VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0 ) );
  1468. __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Arial") );
  1469. lf.lfWeight = FW_BOLD;
  1470. lf.lfHeight = 20;
  1471. CFont font;
  1472. font.CreateFontIndirect(&lf);
  1473. CFont * pOldFont = dc.SelectObject( &font );
  1474. COLORREF clrOldText = dc.SetTextColor( GetColor( CLR_PN_CAPTION_TEXT, this ) );
  1475. int nOldBkMode = dc.SetBkMode( TRANSPARENT );
  1476. // text metrics
  1477. CExtSafeString sText( strCaption );
  1478. UINT nFormat = DT_LEFT | DT_TOP | DT_END_ELLIPSIS;
  1479. if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
  1480. nFormat |= DT_EXPANDTABS;
  1481. CRect rcMeasureText( rcCaption );
  1482. dc.DrawText( LPCTSTR(sText), sText.GetLength(), rcMeasureText, (nFormat|DT_CALCRECT) );
  1483. // align text vertically
  1484. INT nLeftMargin = 4;
  1485. CRect rcDrawText(
  1486. rcCaption.left + nLeftMargin,
  1487. rcCaption.top + ( ( rcCaption.Height() - rcMeasureText.Height() ) / 2 ),
  1488. rcCaption.left + nLeftMargin + rcMeasureText.Width(),
  1489. rcCaption.top + ( ( rcCaption.Height() + rcMeasureText.Height() ) / 2 )
  1490. );
  1491. rcDrawText.IntersectRect( rcCaption, rcDrawText );
  1492. dc.DrawText( LPCTSTR(strCaption), int(_tcslen(strCaption)), &rcDrawText, nFormat );
  1493. dc.SetBkMode( nOldBkMode );
  1494. dc.SetTextColor( clrOldText );
  1495. dc.SelectObject( pOldFont );
  1496. }
  1497. void CExtPaintManager::PaintPageNavigatorItemCaption(
  1498. CDC & dc,
  1499. const CRect & rcCaption,
  1500. __EXT_MFC_SAFE_LPCTSTR strCaption
  1501. )
  1502. {
  1503. ASSERT_VALID( this );
  1504. ASSERT( dc.GetSafeHdc() != NULL );
  1505. if( ! dc.RectVisible(&rcCaption) )
  1506. return;
  1507. dc.FillSolidRect( &rcCaption, GetColor( COLOR_3DSHADOW, this ) );
  1508. PaintPageNavigatorItemCaptionText( dc, rcCaption, strCaption );
  1509. }
  1510. void CExtPaintManager::PaintPageNavigatorCaptionTextImpl(
  1511. CDC & dc,
  1512. const CRect & rcItem,
  1513. __EXT_MFC_SAFE_LPCTSTR strCaption
  1514. )
  1515. {
  1516. ASSERT_VALID( this );
  1517. ASSERT( dc.GetSafeHdc() != NULL );
  1518. if( ! dc.RectVisible(&rcItem) )
  1519. return;
  1520. int nOldBkMode = dc.SetBkMode( TRANSPARENT );
  1521. // text metrics
  1522. CExtSafeString sText( strCaption );
  1523. UINT nFormat = DT_LEFT|DT_TOP|DT_WORDBREAK;
  1524. if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
  1525. nFormat |= DT_EXPANDTABS;
  1526. CRect rcMeasureText( rcItem );
  1527. dc.DrawText( sText,  sText.GetLength(), rcMeasureText, (nFormat|DT_CALCRECT) );
  1528. // align text vertically
  1529. CRect rcDrawText(
  1530. rcItem.left,
  1531. rcItem.top + ( ( rcItem.Height() - rcMeasureText.Height() ) / 2 ),
  1532. rcItem.left + rcMeasureText.Width(),
  1533. rcItem.top + ( ( rcItem.Height() + rcMeasureText.Height() ) / 2 )
  1534. );
  1535. rcDrawText.IntersectRect( rcItem, rcDrawText );
  1536. dc.DrawText( strCaption, int(_tcslen(strCaption)), &rcDrawText, (nFormat|DT_END_ELLIPSIS) );
  1537. dc.SetBkMode( nOldBkMode );
  1538. }
  1539. void CExtPaintManager::PaintPageNavigatorCaptionText(
  1540. CDC & dc,
  1541. const CRect & rcItem,
  1542. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1543. bool bSelected,
  1544. bool bPushed,
  1545. bool bHover,
  1546. bool bAllowInvertTextColor, // = true
  1547. COLORREF clrForceText // = COLORREF(-1L)
  1548. )
  1549. {
  1550. ASSERT_VALID( this );
  1551. ASSERT( dc.GetSafeHdc() != NULL );
  1552. if( ! dc.RectVisible(&rcItem) )
  1553. return;
  1554. LOGFONT lf = { sizeof(LOGFONT) };
  1555. VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0 ) );
  1556. __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Arial") );
  1557. lf.lfWeight = FW_BOLD;
  1558. CFont font;
  1559. font.CreateFontIndirect(&lf);
  1560. CFont * pOldFont = dc.SelectObject( &font );
  1561. COLORREF clrOldText =
  1562. dc.SetTextColor( 
  1563. ( clrForceText != COLORREF(-1L) )
  1564. ? clrForceText
  1565. : GetColor( ( ( bPushed || bSelected ) && bHover && bAllowInvertTextColor ) ? COLOR_WINDOW : COLOR_BTNTEXT, this ) 
  1566. );
  1567. PaintPageNavigatorCaptionTextImpl( dc, rcItem, strCaption );
  1568. dc.SetTextColor( clrOldText );
  1569. dc.SelectObject( pOldFont );
  1570. }
  1571. void CExtPaintManager::PaintPageNavigatorCaption(
  1572. CDC & dc,
  1573. const CRect & rcItem,
  1574. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1575. CExtCmdIcon * pIcon,
  1576. bool bExpanded,
  1577. bool bSelected,
  1578. bool bPushed,
  1579. bool bHover,
  1580. bool bAllowInvertTextColor, // = true
  1581. COLORREF clrForceText // = COLORREF(-1L)
  1582. )
  1583. {
  1584. ASSERT_VALID( this );
  1585. ASSERT( dc.GetSafeHdc() != NULL );
  1586. if( ! dc.RectVisible(&rcItem) )
  1587. return;
  1588. CSize rcIconSize = CSize(0,0);
  1589. if( pIcon != NULL )
  1590. rcIconSize = pIcon->GetSize();
  1591. INT nIconAreaWidth = rcIconSize.cx + ::MulDiv( rcIconSize.cx, 1, 2 );
  1592. // caption text
  1593. if( bExpanded && strCaption != NULL )
  1594. {
  1595. CRect rcText( rcItem );
  1596. rcText.left += nIconAreaWidth;
  1597. PaintPageNavigatorCaptionText( dc, rcText, strCaption, bSelected, bPushed, bHover, bAllowInvertTextColor, clrForceText );
  1598. }
  1599. // caption icon
  1600. if( pIcon != NULL )
  1601. {
  1602. CRect rcIcon;
  1603. if( bExpanded )
  1604. rcIcon.SetRect( 
  1605. rcItem.left + (rcItem.left + nIconAreaWidth - rcIconSize.cx) / 2,
  1606. rcItem.top  + (rcItem.Height() - rcIconSize.cy) / 2,
  1607. rcItem.left + (rcItem.left + nIconAreaWidth + rcIconSize.cx) / 2,
  1608. rcItem.top  + (rcItem.Height() + rcIconSize.cy) / 2
  1609. );
  1610. else
  1611. rcIcon.SetRect( 
  1612. rcItem.left + (rcItem.Width() - rcIconSize.cx ) / 2,
  1613. rcItem.top  + (rcItem.Height() - rcIconSize.cy) / 2,
  1614. rcItem.left + (rcItem.Width() + rcIconSize.cx ) / 2,
  1615. rcItem.top  + (rcItem.Height() + rcIconSize.cy) / 2
  1616. );
  1617. PaintIcon( dc, true, pIcon, rcIcon, bPushed, true, bHover, __ALIGN_HORIZ_LEFT|__ALIGN_VERT_TOP );
  1618. }
  1619. }
  1620. void CExtPaintManager::PaintPageNavigatorItemPaneCaptionTextImpl(
  1621. CDC & dc,
  1622. const CRect & rcCaption,
  1623. __EXT_MFC_SAFE_LPCTSTR strCaption
  1624. )
  1625. {
  1626. ASSERT_VALID( this );
  1627. ASSERT( dc.GetSafeHdc() != NULL );
  1628. if( ! dc.RectVisible(&rcCaption) )
  1629. return;
  1630. if( strCaption == NULL )
  1631. return;
  1632. int nOldBkMode = dc.SetBkMode( TRANSPARENT );
  1633. // text metrics
  1634. CExtSafeString sText( strCaption );
  1635. UINT nFormat = DT_LEFT | DT_TOP;
  1636. if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
  1637. nFormat |= DT_EXPANDTABS;
  1638. CRect rcMeasureText( rcCaption );
  1639. dc.DrawText( LPCTSTR(sText), sText.GetLength(), rcMeasureText, (nFormat|DT_CALCRECT) );
  1640. // align text vertically
  1641. INT nLeftMargin = 7;
  1642. CRect rcDrawText(
  1643. rcCaption.left + nLeftMargin,
  1644. rcCaption.top + ( ( rcCaption.Height() - rcMeasureText.Height() ) / 2 ),
  1645. rcCaption.left + nLeftMargin + rcMeasureText.Width(),
  1646. rcCaption.top + ( ( rcCaption.Height() + rcMeasureText.Height() ) / 2 )
  1647. );
  1648. rcDrawText.IntersectRect( rcCaption, rcDrawText );
  1649. dc.DrawText( strCaption, int(_tcslen(strCaption)), &rcDrawText, (nFormat|DT_END_ELLIPSIS) );
  1650. dc.SetBkMode( nOldBkMode );
  1651. }
  1652. void CExtPaintManager::PaintPageNavigatorItemPaneCaptionText(
  1653. CDC & dc,
  1654. const CRect & rcCaption,
  1655. __EXT_MFC_SAFE_LPCTSTR strCaption
  1656. )
  1657. {
  1658. ASSERT_VALID( this );
  1659. ASSERT( dc.GetSafeHdc() != NULL );
  1660. if( ! dc.RectVisible(&rcCaption) )
  1661. return;
  1662. if( strCaption == NULL )
  1663. return;
  1664. LOGFONT lf = { sizeof(LOGFONT) };
  1665. VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0 ) );
  1666. CFont font;
  1667. font.CreateFontIndirect(&lf);
  1668. CFont * pOldFont = dc.SelectObject( &font );
  1669. COLORREF clrOldText = dc.SetTextColor( GetColor( COLOR_WINDOWTEXT, this ) );
  1670. PaintPageNavigatorItemPaneCaptionTextImpl( dc, rcCaption, strCaption );
  1671. dc.SetTextColor( clrOldText );
  1672. dc.SelectObject( pOldFont );
  1673. }
  1674. void CExtPaintManager::PaintPageNavigatorItemPaneCaption(
  1675. CDC & dc,
  1676. const CRect & rcCaption,
  1677. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1678. bool bHover,
  1679. bool bPressed,
  1680. bool bExpandable,
  1681. bool bExpanded,
  1682. bool bDrawTopLine // = true
  1683. )
  1684. {
  1685. ASSERT_VALID( this );
  1686. ASSERT( dc.GetSafeHdc() != NULL );
  1687. bHover; bPressed; bDrawTopLine;
  1688. if( ! dc.RectVisible(&rcCaption) )
  1689. return;
  1690. dc.FillSolidRect( &rcCaption, GetColor( COLOR_3DFACE, this ) );
  1691. CRect rcBottomLine( rcCaption );
  1692. rcBottomLine.top = rcBottomLine.bottom - 1;
  1693. dc.FillSolidRect( &rcBottomLine, GetColor( COLOR_3DSHADOW, this ) );
  1694. CRect rcText( rcCaption );
  1695. if( bExpandable )
  1696. {
  1697. CExtPaintManager::glyph_t * pGlyph = 
  1698. CExtPaintManager::g_DockingCaptionGlyphs[
  1699. bExpanded ? CExtPaintManager::__DCBT_PN_CAPTION_EXPANDED : CExtPaintManager::__DCBT_PN_CAPTION_COLLAPSED
  1700. ];
  1701. ASSERT( pGlyph != NULL );
  1702. COLORREF ColorValues[2] = {  RGB(0,0,0),  GetColor( COLOR_3DDKSHADOW, this )  };
  1703. CRect rcExpandButton( rcText );
  1704. rcExpandButton.right -= 6;
  1705. rcExpandButton.left = rcExpandButton.right - pGlyph->Size().cx - 1*2;
  1706. PaintGlyphCentered( dc, rcExpandButton, *pGlyph, ColorValues );
  1707. rcText.right = rcExpandButton.left;
  1708. }
  1709. PaintPageNavigatorItemPaneCaptionText( dc, rcText, strCaption );
  1710. }
  1711. void CExtPaintManagerOffice2003::PaintPageNavigatorItemPaneCaption(
  1712. CDC & dc,
  1713. const CRect & rcCaption,
  1714. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1715. bool bHover,
  1716. bool bPressed,
  1717. bool bExpandable,
  1718. bool bExpanded,
  1719. bool bDrawTopLine // = true
  1720. )
  1721. {
  1722. ASSERT_VALID( this );
  1723. ASSERT( dc.GetSafeHdc() != NULL );
  1724. if( ! dc.RectVisible(&rcCaption) )
  1725. return;
  1726. if( IsHighContrast() )
  1727. {
  1728. CExtPaintManagerXP::PaintPageNavigatorItemPaneCaption( dc, rcCaption, strCaption, bHover, bPressed, bExpandable, bExpanded, bDrawTopLine );
  1729. return;
  1730. }
  1731. if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
  1732. stat_PaintGradientRect(
  1733. dc,
  1734. &rcCaption,
  1735. GetColor( bHover ? _2003CLR_PN_PANE_CAPTION_HOVER_DARK : _2003CLR_PN_PANE_CAPTION_DARK, this ),
  1736. GetColor( bHover ? _2003CLR_PN_PANE_CAPTION_HOVER_LIGHT : _2003CLR_PN_PANE_CAPTION_LIGHT, this ),
  1737. true
  1738. );
  1739. else
  1740. dc.FillSolidRect( &rcCaption, GetColor( COLOR_3DSHADOW, this ) );
  1741. CRect rcBottomLine( rcCaption );
  1742. rcBottomLine.top = rcBottomLine.bottom - 1;
  1743. dc.FillSolidRect( &rcBottomLine, GetColor( _2003CLR_PN_PANE_CAPTION_BOTTOM_LINE, this ) );
  1744. CRect rcTopLine( rcCaption );
  1745. rcTopLine.bottom = rcTopLine.top + 1;
  1746. dc.FillSolidRect( &rcTopLine, GetColor( _2003CLR_PN_PANE_CAPTION_DARK, this ) );
  1747. CRect rcText( rcCaption );
  1748. if( bExpandable )
  1749. {
  1750. CExtPaintManager::glyph_t * pGlyph = 
  1751. CExtPaintManager::g_DockingCaptionGlyphs[
  1752. bExpanded ? CExtPaintManager::__DCBT_PN_CAPTION_EXPANDED : CExtPaintManager::__DCBT_PN_CAPTION_COLLAPSED
  1753. ];
  1754. ASSERT( pGlyph != NULL );
  1755. COLORREF ColorValues[2] = {  RGB(0,0,0),  GetColor( COLOR_3DDKSHADOW, this )  };
  1756. CRect rcExpandButton( rcText );
  1757. rcExpandButton.right -= 6;
  1758. rcExpandButton.left = rcExpandButton.right - pGlyph->Size().cx - 1*2;
  1759. PaintGlyphCentered( dc, rcExpandButton, *pGlyph, ColorValues );
  1760. rcText.right = rcExpandButton.left;
  1761. }
  1762. PaintPageNavigatorItemPaneCaptionText( dc, rcText, strCaption );
  1763. }
  1764. void CExtPaintManager::PaintPageNavigatorConfigButton(
  1765. CDC & dc,
  1766. const CRect & rcItem,
  1767. bool bPushed,
  1768. bool bHover
  1769. )
  1770. {
  1771. ASSERT_VALID( this );
  1772. ASSERT( dc.GetSafeHdc() != NULL );
  1773. bHover; bPushed;
  1774. if( ! dc.RectVisible(&rcItem) )
  1775. return;
  1776. CExtPaintManager::glyph_t * pGlyph =  CExtPaintManager::g_DockingCaptionGlyphs[ CExtPaintManager::__DCBT_PN_CONFIG_BUTTON ];
  1777. ASSERT( pGlyph != NULL );
  1778. COLORREF ColorValues[2] = {  RGB(0,0,0),  GetColor( COLOR_BTNTEXT, this )  };
  1779. PaintGlyphCentered( dc, rcItem, *pGlyph, ColorValues );
  1780. }
  1781. void CExtPaintManager::PaintPageNavigatorItem(
  1782. CDC & dc,
  1783. const CRect & rcItem,
  1784. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1785. CExtCmdIcon * pIcon,
  1786. bool bExpanded,
  1787. bool bSelected,
  1788. bool bPushed,
  1789. bool bHover
  1790. )
  1791. {
  1792. ASSERT_VALID( this );
  1793. ASSERT( dc.GetSafeHdc() != NULL );
  1794. if( ! dc.RectVisible(&rcItem) )
  1795. return;
  1796. CRect rcItemInner( rcItem );
  1797. if( bExpanded )
  1798. rcItemInner.DeflateRect( 1, 0, 1, 1 );
  1799. dc.FillSolidRect( &rcItemInner, GetColor( ( bHover || bSelected || bPushed ) ? COLOR_3DSHADOW : COLOR_3DFACE, this ) );
  1800. if( bExpanded )
  1801. {
  1802. CRect rcTopLine( rcItemInner );
  1803. rcTopLine.bottom = rcTopLine.top + 1;
  1804. dc.FillSolidRect( &rcTopLine, GetColor( COLOR_3DDKSHADOW, this ) );
  1805. }
  1806. if( bHover && (! ( bPushed || bSelected ) ) )
  1807. dc.Draw3dRect( &rcItemInner, GetColor( COLOR_WINDOW, this ), GetColor( COLOR_3DDKSHADOW, this ) );
  1808. else if( bPushed || bSelected ) 
  1809. dc.Draw3dRect( &rcItemInner, GetColor( COLOR_3DDKSHADOW, this ), GetColor( COLOR_WINDOW, this ) );
  1810. PaintPageNavigatorCaption( dc, rcItem, strCaption, pIcon, bExpanded, bSelected, bPushed, bHover, true );
  1811. }
  1812. void CExtPaintManagerXP::PaintPageNavigatorItem(
  1813. CDC & dc,
  1814. const CRect & rcItem,
  1815. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1816. CExtCmdIcon * pIcon,
  1817. bool bExpanded,
  1818. bool bSelected,
  1819. bool bPushed,
  1820. bool bHover
  1821. )
  1822. {
  1823. ASSERT_VALID( this );
  1824. ASSERT( dc.GetSafeHdc() != NULL );
  1825. if( ! dc.RectVisible(&rcItem) )
  1826. return;
  1827. // border
  1828. if( bExpanded )
  1829. {
  1830. CBrush brBorder( GetColor( COLOR_3DSHADOW, this ) );
  1831. dc.FrameRect( &rcItem, &brBorder );
  1832. }
  1833. CRect rcItemInner( rcItem );
  1834. if( bExpanded )
  1835. rcItemInner.DeflateRect(1,1);
  1836. if( bHover || bPushed || bSelected )
  1837. {
  1838. PAINTPUSHBUTTONDATA _ppbd(
  1839. this, // pHelperSrc
  1840. true, // bHorz
  1841. rcItemInner,
  1842. _T(""),
  1843. NULL, // pIcon
  1844. true, // bFlat
  1845. bHover  || bSelected, // bHover
  1846. bPushed || bSelected,
  1847. false, // bIndeterminate
  1848. true, // bEnabled
  1849. false, // bDrawBorder
  1850. false, // bDrawFocusRect
  1851. bSelected, // false, // bDefaultPushButton
  1852. 0, // eAlign
  1853. NULL, // hFont
  1854. false // bDropDown
  1855. );
  1856. PaintPushButton( dc, _ppbd );
  1857. }
  1858. else
  1859. dc.FillSolidRect(
  1860. &rcItemInner,
  1861. ( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 ) ? GetColor( CLR_3DFACE_OUT, this ) : GetColor( XPCLR_3DFACE_NORMAL, this )
  1862. );
  1863. PaintPageNavigatorCaption( dc, rcItem, strCaption, pIcon, bExpanded, bSelected, bPushed, bHover, true );
  1864. }
  1865. void CExtPaintManagerOffice2003::PaintPageNavigatorItemCaption(
  1866. CDC & dc,
  1867. const CRect & rcCaption,
  1868. __EXT_MFC_SAFE_LPCTSTR strCaption
  1869. )
  1870. {
  1871. ASSERT_VALID( this );
  1872. ASSERT( dc.GetSafeHdc() != NULL );
  1873. if( ! dc.RectVisible(&rcCaption) )
  1874. return;
  1875. if( IsHighContrast() )
  1876. {
  1877. CExtPaintManagerXP::PaintPageNavigatorItemCaption( dc, rcCaption, strCaption );
  1878. return;
  1879. }
  1880. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  1881. if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 
  1882. && ( eCurrentTheme == ThemeLunaRoyale       // +2.87
  1883. || eCurrentTheme == ThemeVistaOrLaterUX   // +2.87
  1884. || eCurrentTheme == ThemeVistaOrLaterDWM  // +2.87
  1885. || eCurrentTheme == ThemeLunaBlue
  1886. || eCurrentTheme == ThemeLunaOlive
  1887. || eCurrentTheme == ThemeLunaSilver
  1888. )
  1889. )
  1890. stat_PaintGradientRect( dc, &rcCaption, GetColor( _2003CLR_PN_GRIPPER_DARK, this ), GetColor( _2003CLR_PN_GRIPPER_LIGHT, this ), true );
  1891. else
  1892. dc.FillSolidRect( &rcCaption, GetColor( COLOR_3DSHADOW, this ) );
  1893. PaintPageNavigatorItemCaptionText( dc, rcCaption, strCaption );
  1894. }
  1895. void CExtPaintManagerOffice2003::PaintPageNavigatorItem(
  1896. CDC & dc,
  1897. const CRect & rcItem,
  1898. __EXT_MFC_SAFE_LPCTSTR strCaption,
  1899. CExtCmdIcon * pIcon,
  1900. bool bExpanded,
  1901. bool bSelected,
  1902. bool bPushed,
  1903. bool bHover
  1904. )
  1905. {
  1906. ASSERT_VALID( this );
  1907. ASSERT( dc.GetSafeHdc() != NULL );
  1908. if( ! dc.RectVisible(&rcItem) )
  1909. return;
  1910. if( IsHighContrast() )
  1911. {
  1912. CExtPaintManagerXP::PaintPageNavigatorItem( dc, rcItem, strCaption, pIcon, bExpanded, bSelected, bPushed, bHover );
  1913. return;
  1914. }
  1915. // border
  1916. if( bExpanded )
  1917. {
  1918. CBrush brBorder( GetColor( _2003CLR_PN_BORDER, this ) );
  1919. dc.FrameRect( &rcItem, &brBorder );
  1920. }
  1921. CRect rcItemInner( rcItem );
  1922. if( bExpanded )
  1923. rcItemInner.DeflateRect(1,1);
  1924. if( bHover || bPushed || bSelected )
  1925. {
  1926. PAINTPUSHBUTTONDATA _ppbd(
  1927. this, // pHelperSrc
  1928. true, // bHorz
  1929. rcItemInner,
  1930. _T(""),
  1931. NULL, // pIcon
  1932. true, // bFlat
  1933. bHover  || bSelected, // bHover
  1934. bPushed || bSelected,
  1935. false, // bIndeterminate
  1936. true, // bEnabled
  1937. false, // bDrawBorder
  1938. false, // bDrawFocusRect
  1939. bSelected, // false, // bDefaultPushButton
  1940. 0, // eAlign
  1941. NULL, // hFont
  1942. false // bDropDown
  1943. );
  1944. PaintPushButton( dc, _ppbd );
  1945. }
  1946. else
  1947. if( ::GetDeviceCaps(  dc.m_hDC, BITSPIXEL ) > 8 )
  1948. stat_PaintGradientRect(
  1949. dc,
  1950. &rcItemInner,
  1951. GetColor( _2003CLR_PN_ITEM_DARK, this ), 
  1952. GetColor( _2003CLR_PN_ITEM_LIGHT, this ), 
  1953. true
  1954. );
  1955. else
  1956. dc.FillSolidRect( &rcItemInner, GetColor( XPCLR_3DFACE_NORMAL, this ) );
  1957. PaintPageNavigatorCaption( dc, rcItem, strCaption, pIcon, bExpanded, bSelected, bPushed, bHover, false );
  1958. }
  1959. void CExtPaintManager::PaintPageNavigatorSplitterDotsImpl(
  1960. CDC & dc,
  1961. const CRect & rcSplitter,
  1962. COLORREF clrDark,
  1963. COLORREF clrLight,
  1964. INT nOffsetV, // = 0
  1965. INT nDotCount // = 9
  1966. )
  1967. {
  1968. ASSERT_VALID( this );
  1969. ASSERT( dc.GetSafeHdc() != NULL );
  1970. const CSize szGripDot( 2, 2 ), szGripDist( 1, 1 ), szGripShadowOffset( 1, 1 );
  1971. INT nDotsAreaHeight = szGripDot.cy + szGripShadowOffset.cy;
  1972. INT nDotsAreaWidth = nDotCount * ( szGripDot.cx + szGripDist.cx + szGripShadowOffset.cx );
  1973. CRect rcDotArea( rcSplitter );
  1974. rcDotArea.DeflateRect( ( rcSplitter.Width() - nDotsAreaWidth ) / 2, ( rcSplitter.Height() - nDotsAreaHeight ) / 2 + 1 );
  1975. if( nOffsetV != 0 )
  1976. rcDotArea.OffsetRect(0, nOffsetV );
  1977. for( INT nDot = 0; nDot < nDotCount; nDot++ )
  1978. {
  1979. INT nOffsetX = nDot * (szGripDot.cx + szGripShadowOffset.cx + szGripDist.cx);
  1980. CRect rcDot( 
  1981. rcDotArea.left + nOffsetX,
  1982. rcDotArea.top,
  1983. rcDotArea.left + nOffsetX + szGripDot.cx,
  1984. rcDotArea.top + szGripDot.cy
  1985. );
  1986. CRect rcShadow( rcDot );
  1987. rcShadow.OffsetRect( szGripShadowOffset );
  1988. dc.FillSolidRect( &rcShadow, clrLight );
  1989. dc.FillSolidRect( &rcDot, clrDark );
  1990. } // for( INT nDot = 0; nDot < nDotCount; nDot++ )
  1991. }
  1992. void CExtPaintManager::PaintPageNavigatorSplitterDots(
  1993. CDC & dc,
  1994. const CRect & rcSplitter,
  1995. INT nOffsetV // = 0
  1996. )
  1997. {
  1998. ASSERT_VALID( this );
  1999. ASSERT( dc.GetSafeHdc() != NULL );
  2000. PaintPageNavigatorSplitterDotsImpl( dc, rcSplitter, GetColor( COLOR_3DDKSHADOW, this ), GetColor( COLOR_WINDOW, this ), nOffsetV, 9 );
  2001. }
  2002. void CExtPaintManagerOffice2007_Impl::PaintPageNavigatorSplitterDots(
  2003. CDC & dc,
  2004. const CRect & rcSplitter,
  2005. INT nOffsetV // = 0
  2006. )
  2007. {
  2008. ASSERT_VALID( this );
  2009. ASSERT( dc.GetSafeHdc() != NULL );
  2010. if( IsHighContrast() )
  2011. {
  2012. CExtPaintManagerXP::PaintPageNavigatorSplitterDots( dc, rcSplitter, nOffsetV );
  2013. return;
  2014. }
  2015. PaintPageNavigatorSplitterDotsImpl( dc, rcSplitter, m_clrPnSplitterDots, GetColor( COLOR_WINDOW, this ), nOffsetV, 5 );
  2016. }
  2017. void CExtPaintManagerOffice2010_Impl::PaintPageNavigatorSplitterDots(
  2018. CDC & dc,
  2019. const CRect & rcSplitter,
  2020. INT nOffsetV // = 0
  2021. )
  2022. {
  2023. ASSERT_VALID( this );
  2024. ASSERT( dc.GetSafeHdc() != NULL );
  2025. if( IsHighContrast() )
  2026. {
  2027. CExtPaintManagerOffice2007_Impl::PaintPageNavigatorSplitterDots( dc, rcSplitter, nOffsetV );
  2028. return;
  2029. }
  2030. // do not paint dots in 2010 themes
  2031. }
  2032. void CExtPaintManager::PaintPageNavigatorSplitter(
  2033. CDC & dc,
  2034. const CRect & rcSplitter,
  2035. bool bDrawDots // = true
  2036. )
  2037. {
  2038. ASSERT_VALID( this );
  2039. ASSERT( dc.GetSafeHdc() != NULL );
  2040. dc.FillSolidRect( &rcSplitter, GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) );
  2041. CRect rcLine( rcSplitter );
  2042. rcLine.bottom = rcLine.top + 1;
  2043. dc.FillSolidRect( &rcLine, GetColor( COLOR_3DSHADOW, this ) );
  2044. rcLine.OffsetRect(0,1);
  2045. dc.FillSolidRect( &rcLine, GetColor( COLOR_WINDOW, this ) );
  2046. rcLine.SetRect(
  2047. rcSplitter.left,
  2048. rcSplitter.top + 1,
  2049. rcSplitter.left + 1,
  2050. rcSplitter.bottom
  2051. );
  2052. dc.FillSolidRect( &rcLine, GetColor( COLOR_WINDOW, this ) );
  2053. if( bDrawDots )
  2054. PaintPageNavigatorSplitterDots( dc, rcSplitter );
  2055. }
  2056. void CExtPaintManagerXP::PaintPageNavigatorSplitter(
  2057. CDC & dc,
  2058. const CRect & rcSplitter,
  2059. bool bDrawDots // = true
  2060. )
  2061. {
  2062. ASSERT_VALID( this );
  2063. ASSERT( dc.GetSafeHdc() != NULL );
  2064. dc.FillSolidRect( &rcSplitter, GetColor( CExtPaintManager::CLR_3DFACE_OUT, this ) );
  2065. CRect rcLine( rcSplitter );
  2066. rcLine.bottom = rcLine.top + 1;
  2067. dc.FillSolidRect( &rcLine, GetColor( COLOR_3DSHADOW, this ) );
  2068. rcLine.OffsetRect(0,1);
  2069. dc.FillSolidRect( &rcLine, GetColor( COLOR_WINDOW, this ) );
  2070. rcLine.SetRect(
  2071. rcSplitter.left,
  2072. rcSplitter.top + 1,
  2073. rcSplitter.left + 1,
  2074. rcSplitter.bottom
  2075. );
  2076. dc.FillSolidRect( &rcLine, GetColor( COLOR_WINDOW, this ) );
  2077. if( bDrawDots )
  2078. PaintPageNavigatorSplitterDots( dc, rcSplitter );
  2079. }
  2080. void CExtPaintManagerOffice2003::PaintPageNavigatorSplitter(
  2081. CDC & dc,
  2082. const CRect & rcSplitter,
  2083. bool bDrawDots // = true
  2084. )
  2085. {
  2086. ASSERT_VALID( this );
  2087. ASSERT( dc.GetSafeHdc() != NULL );
  2088. if( IsHighContrast() )
  2089. {
  2090. CExtPaintManagerXP::PaintPageNavigatorSplitter( dc, rcSplitter, true );
  2091. return;
  2092. }
  2093. if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
  2094. {
  2095. stat_PaintGradientRect( dc, &rcSplitter,   GetColor( _2003CLR_PN_GRIPPER_DARK, this ),  GetColor( _2003CLR_PN_GRIPPER_LIGHT, this ),  true );
  2096. if( bDrawDots )
  2097. PaintPageNavigatorSplitterDots( dc, rcSplitter, -1 );
  2098. }
  2099. else
  2100. CExtPaintManagerXP::PaintPageNavigatorSplitter( dc, rcSplitter, true );
  2101. }
  2102. #endif // (!defined __EXT_MFC_NO_PAGE_NAVIGATOR )
  2103. #if (!defined __EXT_MFC_NO_TASK_PANE )
  2104. void CExtPaintManager::TaskPanePaintClientArea(
  2105. CDC & dc,
  2106. const RECT & rcClient,
  2107. CObject * pHelperSrc
  2108. )
  2109. {
  2110. ASSERT_VALID( this );
  2111. ASSERT( dc.GetSafeHdc() != NULL );
  2112. if( ! dc.RectVisible(&rcClient) )
  2113. return;
  2114. COLORREF clrBkTop = 
  2115. GetColor( CLR_TASK_PANE_BK_TOP, pHelperSrc );
  2116. COLORREF clrBkBottom = 
  2117. GetColor( CLR_TASK_PANE_BK_BOTTOM, pHelperSrc );
  2118. if( clrBkTop == clrBkBottom )
  2119. dc.FillSolidRect(
  2120. &rcClient,
  2121. clrBkTop
  2122. );
  2123. else
  2124. stat_PaintGradientRect(
  2125. dc,
  2126. rcClient,
  2127. clrBkBottom,
  2128. clrBkTop,
  2129. true
  2130. );
  2131. }
  2132. void CExtPaintManager::TaskPanePaintClientAreaToolbar(
  2133. CDC & dc,
  2134. const RECT & rcClient,
  2135. CObject * pHelperSrc
  2136. )
  2137. {
  2138. ASSERT_VALID( this );
  2139. ASSERT( dc.GetSafeHdc() != NULL );
  2140. if( ! dc.RectVisible(&rcClient) )
  2141. return;
  2142. dc.FillSolidRect(
  2143. &rcClient,
  2144. GetColor( CLR_TASK_PANE_BK_TOP, pHelperSrc )
  2145. );
  2146. }
  2147. void CExtPaintManager::TaskPanePaintBorder(
  2148. CDC & dc,
  2149. const RECT & rcClient,
  2150. CObject * pHelperSrc
  2151. )
  2152. {
  2153. ASSERT_VALID( this );
  2154. ASSERT( dc.GetSafeHdc() != NULL );
  2155. if( ! dc.RectVisible(&rcClient) )
  2156. return;
  2157. dc.Draw3dRect(
  2158. &rcClient, 
  2159. GetColor( COLOR_3DSHADOW, pHelperSrc ),
  2160. GetColor( COLOR_WINDOW, pHelperSrc )
  2161. );
  2162. }
  2163. void CExtPaintManagerXP::TaskPanePaintBorder(
  2164. CDC & dc,
  2165. const RECT & rcClient,
  2166. CObject * pHelperSrc
  2167. )
  2168. {
  2169. ASSERT_VALID( this );
  2170. ASSERT( dc.GetSafeHdc() != NULL );
  2171. if( ! dc.RectVisible(&rcClient) )
  2172. return;
  2173. CBrush brBorder( GetColor( COLOR_3DSHADOW, pHelperSrc ) );
  2174. dc.FrameRect( &rcClient, &brBorder );
  2175. }
  2176. CRect CExtPaintManager::TaskPaneQueryMarginsPage() const
  2177. {
  2178. ASSERT_VALID( this );
  2179. return CRect( 12, 9, 12, 12 );
  2180. }
  2181. CRect CExtPaintManagerOffice2003::TaskPaneQueryMarginsPage() const
  2182. {
  2183. ASSERT_VALID( this );
  2184. if( IsHighContrast() )
  2185. return TaskPaneQueryMarginsPage();
  2186. return CRect( 5, 9, 0, 7 );
  2187. }
  2188. LONG CExtPaintManager::TaskPaneQueryGroupSpacing() const
  2189. {
  2190. ASSERT_VALID( this );
  2191. return 15;
  2192. }
  2193. LONG CExtPaintManager::TaskPaneQueryGroupCaptionMinHeight() const
  2194. {
  2195. ASSERT_VALID( this );
  2196. return 25;
  2197. }
  2198. CRect CExtPaintManager::TaskPaneQueryGroupCaptionTextMargins() const
  2199. {
  2200. ASSERT_VALID( this );
  2201. return CRect( 13, 0, 2, 0 );
  2202. }
  2203. CRect CExtPaintManagerXP::TaskPaneQueryGroupCaptionTextMargins() const
  2204. {
  2205. ASSERT_VALID( this );
  2206. return CRect( 0, 0, 2, 0 );
  2207. }
  2208. CRect CExtPaintManagerOffice2003::TaskPaneQueryGroupCaptionTextMargins() const
  2209. {
  2210. ASSERT_VALID( this );
  2211. if( IsHighContrast() )
  2212. return TaskPaneQueryGroupCaptionTextMargins();
  2213. return CRect( 10, 0, 2, 0 );
  2214. }
  2215. CRect CExtPaintManagerNativeXP::TaskPaneQueryGroupCaptionTextMargins() const
  2216. {
  2217. ASSERT_VALID( this );
  2218. if( ! g_PaintManager.m_UxTheme.IsControlsThemed() )
  2219. return CExtPaintManager::TaskPaneQueryGroupCaptionTextMargins();
  2220. return CRect( 13, 0, 2, 0 );
  2221. }
  2222. LONG CExtPaintManagerXP::TaskPaneQueryGroupCaptionMinHeight() const
  2223. {
  2224. ASSERT_VALID( this );
  2225. return 18;
  2226. }
  2227. HFONT CExtPaintManager::TaskPaneQueryGroupCaptionFont()
  2228. {
  2229. ASSERT_VALID( this );
  2230. LOGFONT lf = { sizeof(LOGFONT) };
  2231. VERIFY(
  2232. ::SystemParametersInfo(
  2233. SPI_GETICONTITLELOGFONT,
  2234. sizeof(LOGFONT), 
  2235. &lf, 
  2236. 0 )
  2237. );
  2238. lf.lfWeight = FW_BOLD;
  2239. HFONT hFont = ::CreateFontIndirect( &lf );
  2240. if( hFont == NULL )
  2241. {
  2242. ASSERT( FALSE );
  2243. memset( &lf, 0, sizeof(LOGFONT) );
  2244. m_FontNormal.GetLogFont( &lf );
  2245. lf.lfWeight = FW_BOLD;
  2246. hFont = ::CreateFontIndirect( &lf );
  2247. ASSERT( hFont != NULL );
  2248. }
  2249. return hFont;
  2250. }
  2251. HFONT CExtPaintManagerOffice2003::TaskPaneQueryGroupCaptionFont()
  2252. {
  2253. ASSERT_VALID( this );
  2254. if( IsHighContrast() )
  2255. return TaskPaneQueryGroupCaptionFont();
  2256. LOGFONT lf = { sizeof(LOGFONT) };
  2257. VERIFY(
  2258. ::SystemParametersInfo(
  2259. SPI_GETICONTITLELOGFONT,
  2260. sizeof(LOGFONT), 
  2261. &lf, 
  2262. 0 )
  2263. );
  2264. __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Tahoma") );
  2265. lf.lfWeight = FW_BOLD;
  2266. lf.lfHeight = 18;
  2267. HFONT hFont = ::CreateFontIndirect( &lf );
  2268. if( hFont == NULL )
  2269. {
  2270. ASSERT( FALSE );
  2271. memset( &lf, 0, sizeof(LOGFONT) );
  2272. m_FontNormal.GetLogFont( &lf );
  2273. hFont = ::CreateFontIndirect( &lf );
  2274. ASSERT( hFont != NULL );
  2275. }
  2276. return hFont;
  2277. }
  2278. void CExtPaintManager::TaskPanePaintGroupCaptionText(
  2279. CDC & dc,
  2280. const CRect & rcText,
  2281. __EXT_MFC_SAFE_LPCTSTR strText,
  2282. bool bHover,
  2283. bool bPressed,
  2284. bool bHighlighted,
  2285. CObject * pHelperSrc
  2286. )
  2287. {
  2288. ASSERT_VALID( this );
  2289. ASSERT( dc.GetSafeHdc() != NULL );
  2290. bPressed;
  2291. if( ! dc.RectVisible(&rcText) )
  2292. return;
  2293. if( strText == NULL )
  2294. return;
  2295. HFONT hFont = TaskPaneQueryGroupCaptionFont();
  2296. ASSERT( hFont != NULL );
  2297.   CFont font;
  2298. font.Attach( hFont );
  2299. CFont * pOldFont = dc.SelectObject( &font );
  2300. int nOldBkMode = dc.SetBkMode( TRANSPARENT );
  2301. COLORREF clrText = 
  2302. GetColor( 
  2303. bHover 
  2304. ? (bHighlighted
  2305. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED
  2306. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED)
  2307. : (bHighlighted
  2308. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED
  2309. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL),
  2310. pHelperSrc 
  2311. );
  2312. COLORREF clrOldText =
  2313. dc.SetTextColor( clrText );
  2314. // text metrics
  2315. CRect rcTextDraw( rcText );
  2316. CRect rcTextMargins = TaskPaneQueryGroupCaptionTextMargins();
  2317. rcTextDraw.DeflateRect( &rcTextMargins );
  2318. CExtSafeString sText( strText );
  2319. UINT nFormat = DT_LEFT | DT_TOP | DT_WORDBREAK;
  2320. if( sText.Find( _T('t') ) != -1 ) // do tabs expanding
  2321. nFormat |= DT_EXPANDTABS;
  2322. CRect rcMeasureText( rcTextDraw );
  2323. dc.DrawText(
  2324. sText, 
  2325. sText.GetLength(),
  2326. rcMeasureText,
  2327. (nFormat|DT_CALCRECT)
  2328. );
  2329. // align text vertically
  2330. CRect rcDrawText(
  2331. rcTextDraw.left,
  2332. rcTextDraw.top + ( ( rcTextDraw.Height() - rcMeasureText.Height() ) / 2 ),
  2333. rcTextDraw.left + rcMeasureText.Width(),
  2334. rcTextDraw.top + ( ( rcTextDraw.Height() + rcMeasureText.Height() ) / 2 )
  2335. );
  2336. rcDrawText.IntersectRect( rcTextDraw, rcDrawText );
  2337. dc.DrawText(
  2338. strText,
  2339. int(_tcslen(strText)),
  2340. &rcDrawText,
  2341. nFormat
  2342. );
  2343. dc.SetTextColor( clrOldText );
  2344. dc.SetBkMode( nOldBkMode );
  2345. dc.SelectObject( pOldFont );
  2346. }
  2347. void CExtPaintManager::TaskPanePaintGroupCaptionBackground(
  2348. CDC & dc,
  2349. const CRect & rcCaption,
  2350. bool bHover,
  2351. bool bPressed,
  2352. bool bHighlighted,
  2353. bool bRoundedLeftTopCorner,
  2354. bool bRoundedRightTopCorner,
  2355. bool bGradient2Steps,
  2356. CObject * pHelperSrc
  2357. )
  2358. {
  2359. ASSERT_VALID( this );
  2360. bPressed;
  2361. bHover;
  2362. ASSERT( dc.GetSafeHdc() != NULL );
  2363. if( ! dc.RectVisible(&rcCaption) )
  2364. return;
  2365. COLORREF clrBkLeft = 
  2366. GetColor( 
  2367. bHighlighted
  2368. ? CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_HIGHLIGHTED
  2369. : CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_NORMAL,
  2370. pHelperSrc 
  2371. );
  2372. COLORREF clrBkRight = 
  2373. GetColor( 
  2374. bHighlighted
  2375. ? CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_HIGHLIGHTED
  2376. : CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL,
  2377. pHelperSrc 
  2378. );
  2379. if( bRoundedLeftTopCorner )
  2380. {
  2381. dc.ExcludeClipRect( 
  2382. rcCaption.left, 
  2383. rcCaption.top, 
  2384. rcCaption.left + 2, 
  2385. rcCaption.top + 1 
  2386. );
  2387. dc.ExcludeClipRect( 
  2388. rcCaption.left, 
  2389. rcCaption.top + 1, 
  2390. rcCaption.left + 1, 
  2391. rcCaption.top + 2 
  2392. );
  2393. }
  2394. if( bRoundedRightTopCorner )
  2395. {
  2396. dc.ExcludeClipRect( 
  2397. rcCaption.right, 
  2398. rcCaption.top, 
  2399. rcCaption.right - 2, 
  2400. rcCaption.top + 1 
  2401. );
  2402. dc.ExcludeClipRect( 
  2403. rcCaption.right, 
  2404. rcCaption.top + 1, 
  2405. rcCaption.right - 1, 
  2406. rcCaption.top + 2 
  2407. );
  2408. }
  2409. if( clrBkLeft == clrBkRight )
  2410. dc.FillSolidRect(
  2411. &rcCaption,
  2412. clrBkLeft
  2413. );
  2414. else if( bGradient2Steps && !bHighlighted )
  2415. stat_PaintGradientRect2steps(
  2416. dc,
  2417. rcCaption,
  2418. clrBkLeft,
  2419. clrBkLeft,
  2420. clrBkRight,
  2421. false,
  2422. 7, 15
  2423. );
  2424. else
  2425. stat_PaintGradientRect(
  2426. dc,
  2427. rcCaption,
  2428. clrBkLeft,
  2429. clrBkRight,
  2430. false
  2431. );
  2432. }
  2433. void CExtPaintManager::TaskPanePaintGroupCaption(
  2434. CDC & dc,
  2435. const CRect & rcCaption,
  2436. __EXT_MFC_SAFE_LPCTSTR strCaption,
  2437. bool bHover,
  2438. bool bPressed,
  2439. bool bHighlighted,
  2440. bool bPaintExpandButton,
  2441. bool bExpanded,
  2442. CObject * pHelperSrc
  2443. )
  2444. {
  2445. ASSERT_VALID( this );
  2446. ASSERT( dc.GetSafeHdc() != NULL );
  2447. if( ! dc.RectVisible(&rcCaption) )
  2448. return;
  2449. TaskPanePaintGroupCaptionBackground(
  2450. dc,
  2451. rcCaption,
  2452. bHover,
  2453. bPressed,
  2454. bHighlighted,
  2455. false,
  2456. false,
  2457. false,
  2458. pHelperSrc
  2459. );
  2460. CRect rcText( rcCaption );
  2461. if( bPaintExpandButton )
  2462. {
  2463. CRect rcExpandButton( 
  2464. rcCaption.left, 
  2465. rcCaption.top, 
  2466. rcCaption.left + 17, 
  2467. rcCaption.top + 16 
  2468. );
  2469. rcExpandButton.OffsetRect(
  2470. rcCaption.Width() - 6 - rcExpandButton.Width(),
  2471. (rcCaption.Height() - rcExpandButton.Height()) / 2
  2472. );
  2473. if( rcExpandButton.left > rcCaption.left )
  2474. {
  2475. rcText.right -= rcExpandButton.Width();
  2476. if( bHover )
  2477. dc.Draw3dRect(
  2478. rcExpandButton, 
  2479. GetColor( COLOR_3DHIGHLIGHT, pHelperSrc ), 
  2480. GetColor( COLOR_3DSHADOW, pHelperSrc )
  2481. );
  2482. COLORREF clrText = 
  2483. GetColor( 
  2484. bHover 
  2485. ? (bHighlighted
  2486. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED
  2487. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED)
  2488. : (bHighlighted
  2489. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED
  2490. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL),
  2491. pHelperSrc 
  2492. );
  2493. COLORREF clrColorValues[] =
  2494. {
  2495. RGB(0,0,0),
  2496. clrText
  2497. };
  2498. PaintGlyphCentered(
  2499. dc,
  2500. rcExpandButton,
  2501. bExpanded 
  2502. ? g_glyph_task_pane_btn_expand_up
  2503. : g_glyph_task_pane_btn_expand_down,
  2504. clrColorValues
  2505. );
  2506. } // if( rcExpandButton.left > rcCaption.left )
  2507. } // if( bPaintExpandButton )
  2508. TaskPanePaintGroupCaptionText(
  2509. dc,
  2510. rcText,
  2511. strCaption,
  2512. bHover,
  2513. bPressed,
  2514. bHighlighted,
  2515. pHelperSrc
  2516. );
  2517. }
  2518. void CExtPaintManagerXP::TaskPanePaintGroupCaption(
  2519. CDC & dc,
  2520. const CRect & rcCaption,
  2521. __EXT_MFC_SAFE_LPCTSTR strCaption,
  2522. bool bHover,
  2523. bool bPressed,
  2524. bool bHighlighted,
  2525. bool bPaintExpandButton,
  2526. bool bExpanded,
  2527. CObject * pHelperSrc
  2528. )
  2529. {
  2530. ASSERT_VALID( this );
  2531. bPaintExpandButton;
  2532. bExpanded;
  2533. ASSERT( dc.GetSafeHdc() != NULL );
  2534. if( ! dc.RectVisible(&rcCaption) )
  2535. return;
  2536. CRect rcBotomLine( rcCaption );
  2537. rcBotomLine.top = rcBotomLine.bottom - 1;
  2538. dc.FillSolidRect(
  2539. &rcBotomLine,
  2540. GetColor( COLOR_3DSHADOW )
  2541. );
  2542. CRect rcText( rcCaption );
  2543. TaskPanePaintGroupCaptionText(
  2544. dc,
  2545. rcText,
  2546. strCaption,
  2547. bHover,
  2548. bPressed,
  2549. bHighlighted,
  2550. pHelperSrc
  2551. );
  2552. }
  2553. void CExtPaintManagerOffice2003::TaskPanePaintGroupCaption(
  2554. CDC & dc,
  2555. const CRect & rcCaption,
  2556. __EXT_MFC_SAFE_LPCTSTR strCaption,
  2557. bool bHover,
  2558. bool bPressed,
  2559. bool bHighlighted,
  2560. bool bPaintExpandButton,
  2561. bool bExpanded,
  2562. CObject * pHelperSrc
  2563. )
  2564. {
  2565. ASSERT_VALID( this );
  2566. ASSERT( dc.GetSafeHdc() != NULL );
  2567. if( ! dc.RectVisible(&rcCaption) )
  2568. return;
  2569. if( IsHighContrast() )
  2570. {
  2571. CExtPaintManagerXP::TaskPanePaintGroupCaption(
  2572. dc,
  2573. rcCaption,
  2574. strCaption,
  2575. bHover,
  2576. bPressed,
  2577. bHighlighted,
  2578. bPaintExpandButton,
  2579. bExpanded,
  2580. pHelperSrc
  2581. );
  2582. return;
  2583. }
  2584. TaskPanePaintGroupCaptionBackground(
  2585. dc,
  2586. rcCaption,
  2587. bHover,
  2588. bPressed,
  2589. bHighlighted,
  2590. true,
  2591. false,
  2592. false,
  2593. pHelperSrc
  2594. );
  2595. CRect rcText( rcCaption );
  2596. TaskPanePaintGroupCaptionText(
  2597. dc,
  2598. rcText,
  2599. strCaption,
  2600. bHover,
  2601. bPressed,
  2602. bHighlighted,
  2603. pHelperSrc
  2604. );
  2605. }
  2606. void CExtPaintManagerNativeXP::TaskPanePaintGroupCaption(
  2607. CDC & dc,
  2608. const CRect & rcCaption,
  2609. __EXT_MFC_SAFE_LPCTSTR strCaption,
  2610. bool bHover,
  2611. bool bPressed,
  2612. bool bHighlighted,
  2613. bool bPaintExpandButton,
  2614. bool bExpanded,
  2615. CObject * pHelperSrc
  2616. )
  2617. {
  2618. ASSERT_VALID( this );
  2619. ASSERT( dc.GetSafeHdc() != NULL );
  2620. if( ! dc.RectVisible(&rcCaption) )
  2621. return;
  2622. bool bRoundedLeftTopCorner = true;
  2623. bool bRoundedRightTopCorner = true;
  2624. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  2625. if( eCurrentTheme == ThemeUnknown )
  2626. bRoundedLeftTopCorner = bRoundedRightTopCorner = false;
  2627. TaskPanePaintGroupCaptionBackground(
  2628. dc,
  2629. rcCaption,
  2630. bHover,
  2631. bPressed,
  2632. bHighlighted,
  2633. bRoundedLeftTopCorner,
  2634. bRoundedRightTopCorner,
  2635. true,
  2636. pHelperSrc
  2637. );
  2638. CRect rcText( rcCaption );
  2639. if( bPaintExpandButton )
  2640. {
  2641. HBITMAP hBitmap = NULL;
  2642. bool bUseThemeBitmaps = false;
  2643. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  2644. if( g_PaintManager.m_UxTheme.IsAppThemed()
  2645. && eCurrentTheme != ThemeUnknown
  2646. && g_PaintManager.m_pfnMsImgGradientFill != NULL
  2647. )
  2648. {
  2649. WCHAR pszThemeName[MAX_PATH] = L"";
  2650. WCHAR pszColor[MAX_PATH] = L"";
  2651. if( g_PaintManager.m_UxTheme.GetCurrentThemeName(
  2652. pszThemeName, 
  2653. MAX_PATH, 
  2654. pszColor, 
  2655. MAX_PATH, 
  2656. NULL, 
  2657. ) == S_OK
  2658. && wcsstr( __EXT_MFC_WCSLWR( pszThemeName, wcslen( pszThemeName ) + 1 ), L"luna.msstyles"))
  2659. {
  2660. CString sShellPath( pszThemeName );
  2661. sShellPath = sShellPath.Left( sShellPath.ReverseFind( _T('\') ) + 1 );
  2662. sShellPath = sShellPath + _T("shell\") + CString( pszColor ) + _T("\shellstyle.dll");
  2663. HMODULE hShellLib = 
  2664. ::LoadLibraryEx(
  2665. sShellPath, 
  2666. 0, 
  2667. LOAD_LIBRARY_AS_DATAFILE
  2668. );
  2669. if( hShellLib != NULL )
  2670. {
  2671. int nOffset = bHighlighted ? 4 : 0;
  2672. nOffset += bExpanded ? 0 : 2;
  2673. nOffset += bHover ? 1 : 0;
  2674. hBitmap = 
  2675. (HBITMAP)::LoadImage(
  2676. hShellLib, 
  2677. MAKEINTRESOURCE( 100 + nOffset ), 
  2678. IMAGE_BITMAP, 
  2679. 0, 0, 
  2680. LR_CREATEDIBSECTION
  2681. );
  2682. if( hBitmap != NULL )
  2683. {
  2684. CDC dcSrc;
  2685. if( dcSrc.CreateCompatibleDC( NULL ) )
  2686. {
  2687. PBYTE pBits = NULL;
  2688. PBITMAPINFO pbmi = NULL;
  2689. BITMAPINFO bmi;
  2690. memset( &bmi, 0, sizeof(bmi) );
  2691. bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  2692. TRY
  2693. {
  2694. if( ::GetDIBits(
  2695. dcSrc, 
  2696. hBitmap, 
  2697. 0, 0, NULL, 
  2698. (BITMAPINFO*)&bmi, 
  2699. DIB_RGB_COLORS
  2700. ) != 0
  2701. )
  2702. {
  2703. if( bmi.bmiHeader.biBitCount == 32 )
  2704. {
  2705. UINT nSize = 
  2706. bmi.bmiHeader.biSizeImage != 0
  2707. ? bmi.bmiHeader.biSizeImage
  2708. : bmi.bmiHeader.biHeight * ((bmi.bmiHeader.biWidth * 4 + 3) & ~3);
  2709. pBits = new BYTE[ nSize ];
  2710. pbmi = new BITMAPINFO[ sizeof(BITMAPINFOHEADER)+sizeof(DWORD)*3 ];
  2711. if( pBits  == NULL || pbmi == NULL )
  2712. ::AfxThrowMemoryException();
  2713. __EXT_MFC_MEMCPY( 
  2714. pbmi, 
  2715. sizeof(BITMAPINFOHEADER),
  2716. &bmi, 
  2717. sizeof(BITMAPINFOHEADER) 
  2718. );
  2719. if( ::GetDIBits(
  2720. dcSrc, 
  2721. hBitmap, 
  2722. 0, 
  2723. bmi.bmiHeader.biHeight, 
  2724. pBits, 
  2725. pbmi, 
  2726. DIB_RGB_COLORS
  2727. ) != 0
  2728. )
  2729. {
  2730. for( UINT i = 0; i < nSize; i += 4 )
  2731. {
  2732. INT nAlpha = pBits[i + 3];
  2733. pBits[i + 0] = (BYTE)(pBits[i + 0] * nAlpha / 255);
  2734. pBits[i + 1] = (BYTE)(pBits[i + 1] * nAlpha / 255);
  2735. pBits[i + 2] = (BYTE)(pBits[i + 2] * nAlpha / 255);
  2736. }
  2737. if( ::SetDIBits(
  2738. dcSrc, 
  2739. hBitmap, 
  2740. 0, 
  2741. bmi.bmiHeader.biHeight, 
  2742. pBits, 
  2743. pbmi, 
  2744. DIB_RGB_COLORS
  2745. ) != 0
  2746. )
  2747. bUseThemeBitmaps = true;
  2748. }
  2749. } // if( bmi.bmiHeader.biBitCount == 32 )
  2750. } // if( ::GetDIBits ...
  2751. }
  2752. CATCH (CMemoryException, e)
  2753. {
  2754. }
  2755. END_CATCH;
  2756. if( pBits != NULL )
  2757. {
  2758. delete pBits;
  2759. pBits = NULL;
  2760. }
  2761. if( pbmi != NULL )
  2762. {
  2763. delete pbmi;
  2764. pbmi = NULL;
  2765. }
  2766. } // if( dcSrc.CreateCompatibleDC( NULL ) )
  2767. } // if( hBitmap != NULL )
  2768. FreeLibrary( hShellLib );
  2769. hShellLib = NULL;
  2770. } // if( hShellLib != NULL )
  2771. }
  2772. }
  2773. if( !bUseThemeBitmaps )
  2774. {
  2775. const BYTE arrBmpDataExpandButton[] =
  2776. {
  2777. 0x42,0x4D,0xAA,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x74,0x04,0x00,0x00,0xC3,0x0E,0x00,0x00,0xC3,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,
  2778. 0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,
  2779. 0x00,0x00,0xFF,0x00,0xC6,0xC6,0xC6,0xC2,0xC2,0xC2,0xC1,0xC1,0xC1,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC8,0xC8,0xC8,0xBF,0xBF,0xBF,
  2780. 0xBA,0xBA,0xBA,0xB7,0xB7,0xB7,0xB7,0xB7,0xB7,0xB7,0xB7,0xB7,0xB6,0xB6,0xB6,0xB7,0xB7,0xB7,0xB8,0xB8,0xB8,0xBB,0xBB,0xBB,0xC0,0xC0,0xC0,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC7,0xC7,0xC7,0xB8,0xB8,0xB8,0xB1,0xB1,0xB1,0xBA,0xBA,0xBA,0xC5,
  2781. 0xC5,0xC5,0xCA,0xCA,0xCA,0xCA,0xCA,0xCA,0xC5,0xC5,0xC5,0xBA,0xBA,0xBA,0xB1,0xB1,0xB1,0xB4,0xB4,0xB4,0xB9,0xB9,0xB9,0xBF,0xBF,0xBF,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC7,0xC7,0xC7,0xB6,0xB6,0xB6,0xB5,0xB5,0xB5,0xD3,0xD3,0xD3,0xEA,0xEA,0xEA,0xF1,0xF1,0xF1,0xF1,0xF1,
  2782. 0xF1,0xF1,0xF1,0xF1,0xEE,0xEE,0xEE,0xE5,0xE5,0xE5,0xCF,0xCF,0xCF,0xB8,0xB8,0xB8,0xB1,0xB1,0xB1,0xB9,0xB9,0xB9,0xC0,0xC0,0xC0,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xCD,0xCD,0xCD,0xB7,0xB7,0xB7,0xB8,0xB8,0xB8,0xE0,0xE0,0xE0,0xF9,0xF9,0xF9,0xF7,0xF7,0xF7,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
  2783. 0xF5,0xF5,0xF5,0xF2,0xF2,0xF2,0xEF,0xEF,0xEF,0xD9,0xD9,0xD9,0xBA,0xBA,0xBA,0xB1,0xB1,0xB1,0xBB,0xBB,0xBB,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xC0,0xC0,0xC0,0xB5,0xB5,0xB5,0xE2,0xE2,0xE2,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xFC,0xF9,
  2784. 0xF9,0xF9,0xF5,0xF5,0xF5,0xF1,0xF1,0xF1,0xD8,0xD8,0xD8,0xB5,0xB5,0xB5,0xB6,0xB6,0xB6,0xC1,0xC1,0xC1,0x00,0xFF,0x00,0x00,0x00,0x00,0xD1,0xD1,0xD1,0xB5,0xB5,0xB5,0xD2,0xD2,0xD2,0xFD,0xFD,0xFD,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xFB,
  2785. 0xFB,0xF5,0xF5,0xF5,0xEE,0xEE,0xEE,0xC8,0xC8,0xC8,0xB3,0xB3,0xB3,0xC0,0xC0,0xC0,0x00,0xFF,0x00,0x00,0x00,0x00,0xCB,0xCB,0xCB,0xB8,0xB8,0xB8,0xEE,0xEE,0xEE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xF9,0xF9,0xF9,
  2786. 0xF5,0xF5,0xF5,0xDD,0xDD,0xDD,0xB5,0xB5,0xB5,0xBF,0xBF,0xBF,0x00,0xFF,0x00,0x00,0x00,0x00,0xC7,0xC7,0xC7,0xC3,0xC3,0xC3,0xFC,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFC,0xFC,0xFC,0xF7,0xF7,0xF7,0xE7,
  2787. 0xE7,0xE7,0xB8,0xB8,0xB8,0xBE,0xBE,0xBE,0x00,0xFF,0x00,0x00,0x00,0x00,0xC7,0xC7,0xC7,0xCA,0xCA,0xCA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0xFD,0xFD,0xFA,0xFA,0xFA,0xEC,0xEC,0xEC,0xB9,0xB9,
  2788. 0xB9,0xC0,0xC0,0xC0,0x00,0xFF,0x00,0x00,0x00,0x00,0xC7,0xC7,0xC7,0xCA,0xCA,0xCA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFA,0xFA,0xFA,0xEB,0xEB,0xEB,0xB8,0xB8,0xB8,0xC0,0xC0,0xC0,
  2789. 0x00,0xFF,0x00,0x00,0x00,0x00,0xC8,0xC8,0xC8,0xC4,0xC4,0xC4,0xFA,0xFA,0xFA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFB,0xFB,0xFB,0xE4,0xE4,0xE4,0xB5,0xB5,0xB5,0xC4,0xC4,0xC4,0x00,0xFF,0x00,0x00,
  2790. 0x00,0x00,0xCD,0xCD,0xCD,0xBB,0xBB,0xBB,0xEA,0xEA,0xEA,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xCF,0xCF,0xCF,0xB5,0xB5,0xB5,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,
  2791. 0x00,0xBA,0xBA,0xBA,0xD0,0xD0,0xD0,0xFC,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEB,0xEB,0xEB,0xB5,0xB5,0xB5,0xBE,0xBE,0xBE,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xC7,0xC7,0xC7,
  2792. 0xB8,0xB8,0xB8,0xDB,0xDB,0xDB,0xFD,0xFD,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF1,0xF1,0xF1,0xC1,0xC1,0xC1,0xB5,0xB5,0xB5,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC0,0xC0,0xC0,0xB7,
  2793. 0xB7,0xB7,0xDA,0xDA,0xDA,0xF6,0xF6,0xF6,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0xFD,0xFD,0xE6,0xE6,0xE6,0xBF,0xBF,0xBF,0xB3,0xB3,0xB3,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC2,0xC2,0xC2,0xB8,0xB8,
  2794. 0xB8,0xC6,0xC6,0xC6,0xDB,0xDB,0xDB,0xE6,0xE6,0xE6,0xEE,0xEE,0xEE,0xEB,0xEB,0xEB,0xDF,0xDF,0xDF,0xCA,0xCA,0xCA,0xB2,0xB2,0xB2,0xB8,0xB8,0xB8,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0xC1,0xC1,0xC1,
  2795. 0xBD,0xBD,0xBD,0xB9,0xB9,0xB9,0xBC,0xBC,0xBC,0xBB,0xBB,0xBB,0xB8,0xB8,0xB8,0xBC,0xBC,0xBC,0xC5,0xC5,0xC5,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00
  2796. };
  2797. const BYTE arrBmpDataExpandButtonHighlighted[] =
  2798. {
  2799. 0x42,0x4D,0xAA,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x74,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,
  2800. 0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,
  2801. 0x00,0x00,0xFF,0x00,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x65,0x65,0x65,0x67,0x67,0x67,
  2802. 0x73,0x73,0x73,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x74,0x74,0x74,0x67,0x67,0x67,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x61,0x61,0x61,0x81,0x81,0x81,0x9F,0x9F,0x9F,0x9D,0x9D,0x9D,0x91,
  2803. 0x91,0x91,0x8B,0x8B,0x8B,0x8B,0x8B,0x8B,0x91,0x91,0x91,0x99,0x99,0x99,0x9A,0x9A,0x9A,0x80,0x80,0x80,0x64,0x64,0x64,0x65,0x65,0x65,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x65,0x65,0x65,0x8E,0x8E,0x8E,0xA6,0xA6,0xA6,0x85,0x85,0x85,0x6B,0x6B,0x6B,0x62,0x62,0x62,0x61,0x61,
  2804. 0x61,0x61,0x61,0x61,0x63,0x63,0x63,0x6D,0x6D,0x6D,0x84,0x84,0x84,0xA0,0xA0,0xA0,0x8E,0x8E,0x8E,0x66,0x66,0x66,0x65,0x65,0x65,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x62,0x62,0x62,0x8E,0x8E,0x8E,0xA3,0xA3,0xA3,0x7A,0x7A,0x7A,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x63,0x63,0x63,0x62,0x62,0x62,
  2805. 0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x62,0x79,0x79,0x79,0x9F,0x9F,0x9F,0x8C,0x8C,0x8C,0x61,0x61,0x61,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x7C,0x7C,0x7C,0xA5,0xA5,0xA5,0x7A,0x7A,0x7A,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x63,0x63,0x63,0x63,
  2806. 0x63,0x63,0x62,0x62,0x62,0x61,0x61,0x61,0x7A,0x7A,0x7A,0x9F,0x9F,0x9F,0x77,0x77,0x77,0x65,0x65,0x65,0x5F,0x5F,0x5F,0x00,0x00,0x00,0x65,0x65,0x65,0x99,0x99,0x99,0x8C,0x8C,0x8C,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x62,0x62,
  2807. 0x62,0x62,0x62,0x62,0x64,0x64,0x64,0x8F,0x8F,0x8F,0x8E,0x8E,0x8E,0x65,0x65,0x65,0x5E,0x5E,0x5E,0x00,0x00,0x00,0x70,0x70,0x70,0x9F,0x9F,0x9F,0x74,0x74,0x74,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x62,0x62,0x62,
  2808. 0x62,0x62,0x62,0x78,0x78,0x78,0x96,0x96,0x96,0x65,0x65,0x65,0x5E,0x5E,0x5E,0x00,0x00,0x00,0x76,0x76,0x76,0x9D,0x9D,0x9D,0x6E,0x6E,0x6E,0x68,0x68,0x68,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x6F,
  2809. 0x6F,0x6F,0x97,0x97,0x97,0x65,0x65,0x65,0x5E,0x5E,0x5E,0x00,0x00,0x00,0x77,0x77,0x77,0x97,0x97,0x97,0x70,0x70,0x70,0x6B,0x6B,0x6B,0x65,0x65,0x65,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x6C,0x6C,0x6C,0x95,0x95,
  2810. 0x95,0x66,0x66,0x66,0x5F,0x5F,0x5F,0x00,0x00,0x00,0x77,0x77,0x77,0x98,0x98,0x98,0x73,0x73,0x73,0x6D,0x6D,0x6D,0x67,0x67,0x67,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x6F,0x6F,0x6F,0x97,0x97,0x97,0x66,0x66,0x66,
  2811. 0x5E,0x5E,0x5E,0x00,0x00,0x00,0x77,0x77,0x77,0x9C,0x9C,0x9C,0x7A,0x7A,0x7A,0x71,0x71,0x71,0x69,0x69,0x69,0x64,0x64,0x64,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x63,0x63,0x63,0x77,0x77,0x77,0x9A,0x9A,0x9A,0x65,0x65,0x65,0x5F,0x5F,0x5F,0x00,
  2812. 0x00,0x00,0x72,0x72,0x72,0x9F,0x9F,0x9F,0x85,0x85,0x85,0x77,0x77,0x77,0x6F,0x6F,0x6F,0x67,0x67,0x67,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0x63,0x63,0x63,0x63,0x63,0x63,0x8C,0x8C,0x8C,0x92,0x92,0x92,0x65,0x65,0x65,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,
  2813. 0x00,0x95,0x95,0x95,0x98,0x98,0x98,0x7F,0x7F,0x7F,0x78,0x78,0x78,0x6F,0x6F,0x6F,0x68,0x68,0x68,0x65,0x65,0x65,0x63,0x63,0x63,0x65,0x65,0x65,0x65,0x65,0x65,0x67,0x67,0x67,0x67,0x67,0x67,0x65,0x65,0x65,0x74,0x74,0x74,0xA3,0xA3,0xA3,0x7C,0x7C,0x7C,0x5F,0x5F,0x5F,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x7C,0x7C,0x7C,
  2814. 0xA2,0xA2,0xA2,0x92,0x92,0x92,0x7F,0x7F,0x7F,0x7A,0x7A,0x7A,0x73,0x73,0x73,0x6D,0x6D,0x6D,0x6C,0x6C,0x6C,0x6B,0x6B,0x6B,0x6C,0x6C,0x6C,0x6D,0x6D,0x6D,0x6D,0x6D,0x6D,0x76,0x76,0x76,0x9C,0x9C,0x9C,0x98,0x98,0x98,0x67,0x67,0x67,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x87,0x87,0x87,0xA3,
  2815. 0xA3,0xA3,0x94,0x94,0x94,0x85,0x85,0x85,0x7E,0x7E,0x7E,0x7A,0x7A,0x7A,0x77,0x77,0x77,0x76,0x76,0x76,0x75,0x75,0x75,0x75,0x75,0x75,0x83,0x83,0x83,0x9F,0x9F,0x9F,0x9D,0x9D,0x9D,0x6E,0x6E,0x6E,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x86,0x86,0x86,0xA0,0xA0,
  2816. 0xA0,0xA0,0xA0,0xA0,0x94,0x94,0x94,0x8D,0x8D,0x8D,0x88,0x88,0x88,0x87,0x87,0x87,0x8C,0x8C,0x8C,0x99,0x99,0x99,0xA7,0xA7,0xA7,0x92,0x92,0x92,0x6E,0x6E,0x6E,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x73,0x73,0x73,0x88,0x88,0x88,
  2817. 0x92,0x92,0x92,0x98,0x98,0x98,0x96,0x96,0x96,0x97,0x97,0x97,0x94,0x94,0x94,0x8C,0x8C,0x8C,0x77,0x77,0x77,0x64,0x64,0x64,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00
  2818. };
  2819. if( bHighlighted )
  2820. {
  2821. CExtBitmap _bitmap;
  2822. _bitmap.LoadBMP_Buffer(
  2823. arrBmpDataExpandButtonHighlighted,
  2824. sizeof( arrBmpDataExpandButtonHighlighted ) / sizeof( arrBmpDataExpandButtonHighlighted[0] )
  2825. );
  2826. hBitmap = _bitmap.CreateBitmap( false );
  2827. }
  2828. else
  2829. {
  2830. CExtBitmap _bitmap;
  2831. _bitmap.LoadBMP_Buffer(
  2832. arrBmpDataExpandButton,
  2833. sizeof( arrBmpDataExpandButton ) / sizeof( arrBmpDataExpandButton[0] )
  2834. );
  2835. hBitmap = _bitmap.CreateBitmap( false );
  2836. }
  2837. } // if( !bUseThemeBitmaps )
  2838. if( hBitmap != NULL )
  2839. {
  2840. CBitmap bmp;
  2841. bmp.Attach( hBitmap );
  2842. BITMAP bmpInfo;
  2843. ::memset( &bmpInfo, 0, sizeof(BITMAP) );
  2844. bmp.GetObject( sizeof(BITMAP), &bmpInfo );
  2845. ASSERT( bmpInfo.bmWidth > 0 && bmpInfo.bmHeight > 0 );
  2846. CRect rcExpandButton( 
  2847. rcCaption.left, 
  2848. rcCaption.top, 
  2849. rcCaption.left + bmpInfo.bmWidth, 
  2850. rcCaption.top + bmpInfo.bmHeight 
  2851. );
  2852. rcExpandButton.OffsetRect(
  2853. rcCaption.Width() - 3 - rcExpandButton.Width(),
  2854. 0
  2855. );
  2856. if( rcExpandButton.left > rcCaption.left )
  2857. {
  2858. rcText.right -= (rcExpandButton.Width() + 4);
  2859. if( ! bUseThemeBitmaps )
  2860. {
  2861. rcExpandButton.OffsetRect(
  2862. 0,
  2863. (rcCaption.Height() - rcExpandButton.Height()) / 2
  2864. );
  2865. COLORREF clrTransparent = RGB( 0, 255, 0 );
  2866. COLORREF clrBk = 
  2867. GetColor( 
  2868. bHighlighted
  2869. ? CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_HIGHLIGHTED
  2870. : CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL,
  2871. pHelperSrc 
  2872. );
  2873. HBITMAP hBitmapDst = 
  2874. stat_ColorizeMonochromeBitmap(
  2875. hBitmap,
  2876. clrTransparent,
  2877. clrBk
  2878. );
  2879. ASSERT( hBitmapDst != NULL );
  2880. CBitmap bmpDst;
  2881. bmpDst.Attach( hBitmapDst );
  2882. double percentH = 0.00;
  2883. double percentL = 0.00;
  2884. double percentS = 0.00;
  2885. if( bHighlighted )
  2886. {
  2887. if( eCurrentTheme == ThemeLunaSilver )
  2888. {
  2889. percentL = 0.50;
  2890. percentS = -0.30;
  2891. }
  2892. else
  2893. {
  2894. percentL = 0.15;
  2895. percentS = 0.10;
  2896. }
  2897. }
  2898. else
  2899. {
  2900. percentL = 0.30;
  2901. percentS = -0.40;
  2902. }
  2903. VERIFY(
  2904. stat_HLS_Adjust_Bitmap(
  2905. bmpDst,
  2906. clrTransparent,
  2907. RGB(0,0,0),
  2908. percentH,
  2909. percentL,
  2910. percentS
  2911. )
  2912. );
  2913. CImageList il;
  2914. if( il.Create(
  2915. bmpInfo.bmWidth,
  2916. bmpInfo.bmHeight,
  2917. ILC_COLOR32 | ILC_MASK,
  2918. 0, 1
  2919. )
  2920. )
  2921. {
  2922. il.Add( &bmpDst, clrTransparent );
  2923. HICON hIcon = il.ExtractIcon(0);
  2924. if( hIcon != NULL )
  2925. {
  2926. dc.DrawState(
  2927. rcExpandButton.TopLeft(), 
  2928. CSize(bmpInfo.bmWidth, bmpInfo.bmHeight), 
  2929. hIcon, 
  2930. DST_ICON,
  2931. (CBrush*) NULL 
  2932. );
  2933. }
  2934. ::DestroyIcon( hIcon );
  2935. hIcon = NULL;
  2936. }
  2937. // CDC dcMemory;
  2938. // if( dcMemory.CreateCompatibleDC( &dc ) )
  2939. // {
  2940. // CBitmap * pOldBmp =
  2941. // dcMemory.SelectObject( &bmpDst );
  2942. // dc.SelectClipRgn( NULL );
  2943. // dcMemory.SelectClipRgn( NULL );
  2944. // stat_TransparentBlt(
  2945. // dc.m_hDC,
  2946. // rcExpandButton.left, 
  2947. // rcExpandButton.top, 
  2948. // bmpInfo.bmWidth, 
  2949. // bmpInfo.bmHeight,
  2950. // dcMemory.m_hDC,
  2951. // 0,
  2952. // 0,
  2953. // bmpInfo.bmWidth, 
  2954. // bmpInfo.bmHeight,
  2955. // clrTransparent
  2956. // );
  2957. // dcMemory.SelectObject( pOldBmp );
  2958. // dcMemory.DeleteDC();
  2959. // }
  2960. COLORREF clrText = 
  2961. GetColor( 
  2962. bHover 
  2963. ? (bHighlighted
  2964. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED
  2965. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED)
  2966. : (bHighlighted
  2967. ? CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED
  2968. : CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL),
  2969. pHelperSrc 
  2970. );
  2971. COLORREF clrColorValues[] =
  2972. {
  2973. RGB(0,0,0),
  2974. clrText
  2975. };
  2976. if( !bExpanded )
  2977. rcExpandButton.OffsetRect( -1, 0 );
  2978. else
  2979. rcExpandButton.OffsetRect( -1, -1 );
  2980. PaintGlyphCentered(
  2981. dc,
  2982. rcExpandButton,
  2983. bExpanded 
  2984. ? g_glyph_task_pane_btn_expand_up
  2985. : g_glyph_task_pane_btn_expand_down,
  2986. clrColorValues
  2987. );
  2988. } // if( ! bUseThemeBitmaps )
  2989. else
  2990. {
  2991. rcExpandButton.OffsetRect( 0, 2 );
  2992. CDC dcMemory;
  2993. if( dcMemory.CreateCompatibleDC( &dc ) )
  2994. {
  2995. CBitmap * pOldBmp =
  2996. dcMemory.SelectObject( &bmp );
  2997. if( g_PaintManager.m_pfnMsImgGradientFill != NULL )
  2998. {
  2999. CExtPaintManager::CExtPaintManagerAutoPtr::__EXT_MFC_BLENDFUNCTION
  3000. bf = {AC_SRC_OVER, 0, 255, 1};
  3001. g_PaintManager.m_pfnMsImgAlphaBlend(
  3002. dc.GetSafeHdc(), 
  3003. rcExpandButton.left, 
  3004. rcExpandButton.top, 
  3005. bmpInfo.bmWidth, 
  3006. bmpInfo.bmHeight,  
  3007. dcMemory.GetSafeHdc(), 
  3008. 0, 0, 
  3009. bmpInfo.bmWidth, 
  3010. bmpInfo.bmHeight, 
  3011. bf
  3012. );
  3013. }
  3014. dcMemory.SelectObject( pOldBmp );
  3015. dcMemory.DeleteDC();
  3016. }
  3017. }
  3018. } // if( rcExpandButton.left > rcCaption.left )
  3019. } // if( hBitmap != NULL )
  3020. } // if( bPaintExpandButton )
  3021. TaskPanePaintGroupCaptionText(
  3022. dc,
  3023. rcText,
  3024. strCaption,
  3025. bHover,
  3026. bPressed,
  3027. bHighlighted,
  3028. pHelperSrc
  3029. );
  3030. }
  3031. #endif // (!defined __EXT_MFC_NO_TASK_PANE )
  3032. #ifndef __EXT_MFC_NO_TAB_ONENOTE_CTRL
  3033. void CExtPaintManager::TabOneNoteWnd_DrawClientArea(
  3034. CDC & dc,
  3035. CRect & rcClient,
  3036. CObject * pHelperSrc, // = NULL
  3037. LPARAM lParam // = 0L
  3038. )
  3039. {
  3040. ASSERT_VALID( this );
  3041. dc.FillSolidRect(
  3042. &rcClient, 
  3043. GetColor( COLOR_3DFACE, pHelperSrc, lParam ) 
  3044. );
  3045. }
  3046. void CExtPaintManagerOffice2003::TabOneNoteWnd_DrawClientArea(
  3047. CDC & dc,
  3048. CRect & rcClient,
  3049. CObject * pHelperSrc, // = NULL
  3050. LPARAM lParam // = 0L
  3051. )
  3052. {
  3053. ASSERT_VALID( this );
  3054. if( IsHighContrast() )
  3055. {
  3056. CExtPaintManagerXP::TabOneNoteWnd_DrawClientArea(
  3057. dc,
  3058. rcClient,
  3059. pHelperSrc,
  3060. lParam
  3061. );
  3062. return;
  3063. }
  3064. if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
  3065. {
  3066. bool bHorz = true;
  3067. bool bTopLeft = true;
  3068. if( pHelperSrc != NULL 
  3069. && pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtTabWnd ) )
  3070. )
  3071. {
  3072. CExtTabWnd * pWnd = STATIC_DOWNCAST( CExtTabWnd, pHelperSrc );
  3073. ASSERT_VALID( pWnd );
  3074. bHorz = pWnd->OrientationIsHorizontal();
  3075. bTopLeft = pWnd->OrientationIsTopLeft();
  3076. }
  3077. COLORREF clrDark = GetColor( COLOR_3DLIGHT, pHelperSrc, lParam );
  3078. COLORREF clrLight = GetColor( COLOR_3DHILIGHT, pHelperSrc, lParam );
  3079. stat_PaintGradientRect(
  3080. dc,
  3081. &rcClient,
  3082. bHorz 
  3083. ? ( bTopLeft ? clrLight : clrDark )
  3084. : ( bTopLeft ? clrDark : clrLight ),
  3085. bHorz
  3086. ? ( bTopLeft ? clrDark : clrLight )
  3087. : ( bTopLeft ? clrLight : clrDark ),
  3088. bHorz
  3089. );
  3090. }
  3091. else 
  3092. {
  3093. dc.FillSolidRect(
  3094. &rcClient, 
  3095. GetColor( COLOR_3DFACE, pHelperSrc, lParam ) 
  3096. );
  3097. }
  3098. }
  3099. void CExtPaintManager::GetTabOneNoteItemColors(
  3100. bool bSelected,
  3101. bool bHover,
  3102. bool bEnabled,
  3103. COLORREF &clrBorderLight,
  3104. COLORREF &clrBorderDark,
  3105. COLORREF &clrBkLight,
  3106. COLORREF &clrBkDark,
  3107. COLORREF &clrText
  3108. )
  3109. {
  3110. ASSERT_VALID( this );
  3111. if( bHover && bEnabled )
  3112. {
  3113. clrText = clrBorderLight = clrBorderDark = RGB(0, 0, 128);
  3114. clrBkDark = RGB(179, 179, 217);
  3115. clrBkLight = RGB(233, 233, 244);
  3116. }
  3117. else
  3118. {
  3119. clrText =  GetColor( bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, this );
  3120. clrBorderLight = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DFACE, this );
  3121. clrBorderDark = GetColor( COLOR_3DSHADOW, this );
  3122. clrBkDark = clrBkLight = GetColor( COLOR_3DFACE, this );
  3123. }
  3124. }
  3125. void CExtPaintManagerOffice2003::GetTabOneNoteItemColors(
  3126. bool bSelected,
  3127. bool bHover,
  3128. bool bEnabled,
  3129. COLORREF &clrBorderLight,
  3130. COLORREF &clrBorderDark,
  3131. COLORREF &clrBkLight,
  3132. COLORREF &clrBkDark,
  3133. COLORREF &clrText
  3134. )
  3135. {
  3136. ASSERT_VALID( this );
  3137. if( IsHighContrast() )
  3138. {
  3139. CExtPaintManagerXP::GetTabOneNoteItemColors(
  3140. bSelected,
  3141. bHover,
  3142. bEnabled,
  3143. clrBorderLight,
  3144. clrBorderDark,
  3145. clrBkLight,
  3146. clrBkDark,
  3147. clrText
  3148. );
  3149. return;
  3150. }
  3151. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  3152. if( bHover && bEnabled )
  3153. {
  3154. switch( eCurrentTheme ) 
  3155. {
  3156. case ThemeLunaRoyale:       // +2.87
  3157. case ThemeVistaOrLaterUX:   // +2.87
  3158. case ThemeVistaOrLaterDWM:  // +2.87
  3159. case ThemeLunaBlue:
  3160. clrText = RGB(0,0,0);
  3161. clrBorderLight = 
  3162. clrBorderDark = RGB(0, 0, 128);
  3163. break;
  3164. case ThemeLunaOlive:
  3165. clrText = RGB(0,0,0);
  3166. clrBorderLight = clrBorderDark = RGB(63, 93, 56);
  3167. break;
  3168. case ThemeLunaSilver:
  3169. clrText = RGB(0,0,0);
  3170. clrBorderLight = clrBorderDark = RGB(75, 75, 111);
  3171. break;
  3172. default:
  3173. clrText = clrBorderLight = clrBorderDark = RGB(0, 0, 128);
  3174. break;
  3175. } // switch( eCurrentTheme ) 
  3176. if( eCurrentTheme != ThemeUnknown )
  3177. {
  3178. clrBkDark  = RGB(255, 238, 194);
  3179. clrBkLight = RGB(255, 249, 237);
  3180. }
  3181. else
  3182. {
  3183. clrBkDark  = RGB(179, 179, 217);
  3184. clrBkLight = RGB(233, 233, 244);
  3185. }
  3186. }
  3187. else
  3188. {
  3189. clrText = GetColor( bEnabled ? COLOR_BTNTEXT : CLR_TEXT_DISABLED, this );
  3190. clrBorderLight = GetColor( ( bSelected || eCurrentTheme != ThemeUnknown ) ? COLOR_WINDOW : COLOR_3DFACE, this  );
  3191. clrBkDark = clrBkLight = GetColor( COLOR_3DFACE, this );
  3192. switch( eCurrentTheme ) 
  3193. {
  3194. case ThemeLunaRoyale:       // +2.87
  3195. case ThemeVistaOrLaterUX:   // +2.87
  3196. case ThemeVistaOrLaterDWM:  // +2.87
  3197. case ThemeLunaBlue:
  3198. clrBorderDark = RGB(0, 53, 154);
  3199. break;
  3200. case ThemeLunaOlive:
  3201. clrBorderDark = RGB(96, 119, 107);
  3202. break;
  3203. case ThemeLunaSilver:
  3204. clrBorderDark = RGB(118, 116, 146);
  3205. break;
  3206. default:
  3207. clrBorderDark = GetColor( COLOR_3DSHADOW, this );
  3208. break;
  3209. } // switch( eCurrentTheme ) 
  3210. }
  3211. }
  3212. void CExtPaintManagerStudio2005::GetTabOneNoteItemColors(
  3213. bool bSelected,
  3214. bool bHover,
  3215. bool bEnabled,
  3216. COLORREF &clrBorderLight,
  3217. COLORREF &clrBorderDark,
  3218. COLORREF &clrBkLight,
  3219. COLORREF &clrBkDark,
  3220. COLORREF &clrText
  3221. )
  3222. {
  3223. ASSERT_VALID( this );
  3224. if( IsHighContrast() )
  3225. {
  3226. CExtPaintManagerXP::GetTabOneNoteItemColors(
  3227. bSelected,
  3228. bHover,
  3229. bEnabled,
  3230. clrBorderLight,
  3231. clrBorderDark,
  3232. clrBkLight,
  3233. clrBkDark,
  3234. clrText
  3235. );
  3236. return;
  3237. }
  3238. CExtPaintManager::GetTabOneNoteItemColors(
  3239. bSelected,
  3240. bHover,
  3241. bEnabled,
  3242. clrBorderLight,
  3243. clrBorderDark,
  3244. clrBkLight,
  3245. clrBkDark,
  3246. clrText
  3247. );
  3248. }
  3249. #endif // __EXT_MFC_NO_TAB_ONENOTE_CTRL
  3250. #ifndef __EXT_MFC_NO_TAB_WHIDBEY_CTRL
  3251. void CExtPaintManager::GetTabWhidbeyItemColors(
  3252. bool bSelected,
  3253. bool bHover,
  3254. bool bEnabled,
  3255. COLORREF &clrBorder,
  3256. COLORREF &clrBkLight,
  3257. COLORREF &clrBkDark,
  3258. COLORREF &clrText
  3259. )
  3260. {
  3261. ASSERT_VALID( this );
  3262. bHover;
  3263. clrText = GetColor(  bEnabled ? ( bSelected ? COLOR_WINDOWTEXT : COLOR_BTNTEXT ) : CLR_TEXT_DISABLED, this );
  3264. clrBorder = GetColor( COLOR_3DSHADOW, this );
  3265. clrBkDark = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DLIGHT, this );
  3266. clrBkLight = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DLIGHT, this );
  3267. }
  3268. void CExtPaintManagerOffice2003::GetTabWhidbeyItemColors(
  3269. bool bSelected,
  3270. bool bHover,
  3271. bool bEnabled,
  3272. COLORREF &clrBorder,
  3273. COLORREF &clrBkLight,
  3274. COLORREF &clrBkDark,
  3275. COLORREF &clrText
  3276. )
  3277. {
  3278. ASSERT_VALID( this );
  3279. if( IsHighContrast() )
  3280. {
  3281. CExtPaintManagerXP::GetTabWhidbeyItemColors( bSelected, bHover, bEnabled, clrBorder, clrBkLight, clrBkDark, clrText );
  3282. return;
  3283. }
  3284. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  3285. clrText = GetColor( bEnabled ? ( bSelected ? COLOR_WINDOWTEXT : COLOR_BTNTEXT ) : CLR_TEXT_DISABLED, this );
  3286. clrBorder = GetColor( COLOR_3DSHADOW, this );
  3287. clrBkDark = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DLIGHT, this );
  3288. if( eCurrentTheme != ThemeUnknown)
  3289. clrBkLight = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DHILIGHT, this );
  3290. else
  3291. clrBkLight = GetColor( bSelected ? COLOR_WINDOW : COLOR_3DLIGHT, this );
  3292. }
  3293. #endif // __EXT_MFC_NO_TAB_WHIDBEY_CTRL
  3294. //////////////////////////////////////////////////////////////////////////
  3295. // CExtPaintManagerNativeXP
  3296. //////////////////////////////////////////////////////////////////////////
  3297. CExtPaintManagerNativeXP::CExtPaintManagerNativeXP()
  3298. {
  3299. #if (!defined __EXT_MFC_NO_PAGECONTAINER_CTRL)
  3300. m_bPageContainerUseButtonStyle = true;
  3301. m_bPageContainerUseGroupBoxStyle = true;
  3302. m_bPageContainerNoEmbossDisabledText = true;
  3303. #endif // (!defined __EXT_MFC_NO_PAGECONTAINER_CTRL)
  3304. #if (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
  3305. m_bShortcutListUseButtonStyleInScrollButtons = true;
  3306. m_bShortcutListUseDockerBkgnd = true;
  3307. m_bShortcutListItemUseButtonStyle = true;
  3308. #endif // (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
  3309. }
  3310. CExtPaintManagerNativeXP::~CExtPaintManagerNativeXP()
  3311. {
  3312. }
  3313. bool CExtPaintManagerNativeXP::OnQueryUseThemeColors() const
  3314. {
  3315. ASSERT_VALID( this );
  3316. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  3317. bool bUseThemedColors = (
  3318. g_PaintManager.m_UxTheme.IsAppThemed()
  3319. && eCurrentTheme != ThemeUnknown
  3320. );
  3321. return bUseThemedColors;
  3322. }
  3323. void CExtPaintManagerNativeXP::InitTranslatedColors()
  3324. {
  3325. ASSERT_VALID( this );
  3326. CExtPaintManager::InitTranslatedColors();
  3327. if( stat_GetBPP() > 8 )
  3328. {
  3329. if( OnQueryUseThemeColors() )
  3330. {
  3331. e_system_theme_t eCurrentTheme = OnQuerySystemTheme();
  3332. // Task Pane Colors
  3333. COLORREF clrTPBkTop    = (COLORREF)(-1L);
  3334. COLORREF clrTPBkBottom = (COLORREF)(-1L);
  3335. COLORREF clrTPGroupCaptionTextNormal           = (COLORREF)(-1L);
  3336. COLORREF clrTPGroupCaptionTextNormalHover      = (COLORREF)(-1L);
  3337. COLORREF clrTPGroupCaptionTextHighlighted      = (COLORREF)(-1L);
  3338. COLORREF clrTPGroupCaptionTextHighlightedHover = (COLORREF)(-1L);
  3339. COLORREF clrTPGroupCaptionBkLeftNormal         = (COLORREF)(-1L);
  3340. COLORREF clrTPGroupCaptionBkRightNormal        = (COLORREF)(-1L);
  3341. COLORREF clrTPGroupCaptionBkLeftHighlighted    = (COLORREF)(-1L);
  3342. COLORREF clrTPGroupCaptionBkRightHighlighted   = (COLORREF)(-1L);
  3343. switch( eCurrentTheme ) 
  3344. {
  3345. case ThemeLunaRoyale:       // +2.87
  3346. case ThemeVistaOrLaterUX:   // +2.87
  3347. case ThemeVistaOrLaterDWM:  // +2.87
  3348. case ThemeLunaBlue:
  3349. clrTPBkTop = RGB(123, 162, 231);
  3350. clrTPBkBottom = RGB(99, 117, 214);
  3351. clrTPGroupCaptionTextNormal = RGB( 33,  93, 198);
  3352. clrTPGroupCaptionTextNormalHover = RGB( 66, 142, 255);
  3353. clrTPGroupCaptionTextHighlighted = RGB(255, 255, 255);
  3354. clrTPGroupCaptionTextHighlightedHover = RGB( 66, 142, 255);
  3355. clrTPGroupCaptionBkLeftNormal = RGB(255, 255, 255);
  3356. clrTPGroupCaptionBkRightNormal = RGB(198, 211, 247);
  3357. clrTPGroupCaptionBkLeftHighlighted = RGB(0, 73, 181);
  3358. clrTPGroupCaptionBkRightHighlighted = RGB(41, 93, 206);
  3359. break;
  3360. case ThemeLunaOlive:
  3361. clrTPBkTop = RGB(204, 217, 173);
  3362. clrTPBkBottom = RGB(165, 189, 132);
  3363. clrTPGroupCaptionTextNormal = RGB( 86, 102,  45);
  3364. clrTPGroupCaptionTextNormalHover = RGB(114, 146, 29);
  3365. clrTPGroupCaptionTextHighlighted = RGB(255, 255, 255);
  3366. clrTPGroupCaptionTextHighlightedHover = RGB(224, 231, 184);
  3367. clrTPGroupCaptionBkLeftNormal = RGB(255, 252, 236);
  3368. clrTPGroupCaptionBkRightNormal = RGB(224, 231, 184);
  3369. clrTPGroupCaptionBkLeftHighlighted = RGB(119, 140, 64);
  3370. clrTPGroupCaptionBkRightHighlighted = RGB(150, 168, 103);
  3371. break;
  3372. case ThemeLunaSilver:
  3373. clrTPBkTop = RGB(196, 200, 212);
  3374. clrTPBkBottom = RGB(177, 179, 200);
  3375. clrTPGroupCaptionTextNormal = RGB( 63,  61, 61);
  3376. clrTPGroupCaptionTextNormalHover = RGB(126, 124, 124);
  3377. clrTPGroupCaptionTextHighlighted = RGB(255, 255, 255);
  3378. clrTPGroupCaptionTextHighlightedHover = RGB(230, 230, 230);
  3379. clrTPGroupCaptionBkLeftNormal = RGB(255, 255, 255);
  3380. clrTPGroupCaptionBkRightNormal = RGB(214, 215, 224);
  3381. clrTPGroupCaptionBkLeftHighlighted = RGB(119, 119, 146);
  3382. clrTPGroupCaptionBkRightHighlighted = RGB(180, 182, 199);
  3383. break;
  3384. default:
  3385. clrTPBkTop = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_INACTIVECAPTION, this ), GetColor( COLOR_WINDOW, this ), 128 );
  3386. clrTPBkBottom = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_ACTIVECAPTION, this ), GetColor( COLOR_WINDOW, this ), 192 );
  3387. clrTPGroupCaptionTextNormal = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_HIGHLIGHT, this ), GetColor( COLOR_WINDOWTEXT, this ), 192 );
  3388. clrTPGroupCaptionTextNormalHover = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_HIGHLIGHT, this ), GetColor( COLOR_WINDOWTEXT, this ), 240 );
  3389. clrTPGroupCaptionTextHighlighted = GetColor( COLOR_HIGHLIGHTTEXT, this );
  3390. clrTPGroupCaptionTextHighlightedHover = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_HIGHLIGHTTEXT, this ), GetColor( COLOR_HIGHLIGHT, this ), 128 );
  3391. clrTPGroupCaptionBkLeftNormal = GetColor( COLOR_WINDOW, this );
  3392. clrTPGroupCaptionBkRightNormal = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_INACTIVECAPTION, this ), GetColor( COLOR_WINDOW, this ), 92 );
  3393. clrTPGroupCaptionBkLeftHighlighted = GetColor( COLOR_ACTIVECAPTION, this );
  3394. clrTPGroupCaptionBkRightHighlighted = CExtBitmap::stat_RGB_Blend( GetColor( COLOR_ACTIVECAPTION, this ), GetColor( COLOR_WINDOW, this ), 92 );
  3395. break;
  3396. } // switch( eCurrentTheme ) 
  3397. m_mapColorTranslate[ CLR_TASK_PANE_BK_TOP ]    = InstallColor( clrTPBkTop );
  3398. m_mapColorTranslate[ CLR_TASK_PANE_BK_BOTTOM ] = InstallColor( clrTPBkBottom );
  3399. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL ]              = InstallColor( clrTPGroupCaptionTextNormal );
  3400. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_NORMAL_HOVERED ]      = InstallColor( clrTPGroupCaptionTextNormalHover );
  3401. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED ]         = InstallColor( clrTPGroupCaptionTextHighlighted );
  3402. m_mapColorTranslate[ CLR_TASK_PANE_GROUP_CAPTION_TEXT_HIGHLIGHTED_HOVERED ] = InstallColor( clrTPGroupCaptionTextHighlightedHover );
  3403. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_NORMAL]       = InstallColor( clrTPGroupCaptionBkLeftNormal );
  3404. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_LEFT_HIGHLIGHTED]  = InstallColor( clrTPGroupCaptionBkLeftHighlighted );
  3405. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_NORMAL]      = InstallColor( clrTPGroupCaptionBkRightNormal );
  3406. m_mapColorTranslate[CLR_TASK_PANE_GROUP_CAPTION_BK_RIGHT_HIGHLIGHTED] = InstallColor( clrTPGroupCaptionBkRightHighlighted );
  3407. } // if( OnQueryUseThemeColors() )
  3408. } // if( stat_GetBPP() > 8 )
  3409. #if (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
  3410. m_clrShortcutListItemAlternativeText = GetColor( COLOR_BTNTEXT );
  3411. #endif // (!defined __EXT_MFC_NO_SHORTCUTLIST_CTRL)
  3412. }
  3413. //////////////////////////////////////////////////////////////////////////
  3414. // CExtUxTheme class
  3415. //////////////////////////////////////////////////////////////////////////
  3416. CExtUxTheme::CExtUxTheme()
  3417. : m_hUxTheme( NULL )
  3418. , m_hUxThemeDll( NULL )
  3419. , m_bNeedToFreeDll( false )
  3420. , m_hWndCached( NULL )
  3421. , m_dwComCtlVersion( 0 )
  3422. , m_pfnOpenThemeData( NULL )
  3423. , m_pfnOpenThemeDataEx( NULL )
  3424. , m_pfnCloseThemeData( NULL )
  3425. , m_pfnDrawThemeBackground( NULL )
  3426. , m_pfnDrawThemeText( NULL )
  3427. , m_pfnDrawThemeTextEx( NULL )
  3428. , m_pfnGetThemeBackgroundContentRect( NULL )
  3429. , m_pfnGetThemeBackgroundExtent( NULL )
  3430. , m_pfnGetThemePartSize( NULL )
  3431. , m_pfnGetThemeTextExtent( NULL )
  3432. , m_pfnGetThemeTextMetrics( NULL )
  3433. , m_pfnGetThemeBackgroundRegion( NULL )
  3434. , m_pfnHitTestThemeBackground( NULL )
  3435. , m_pfnDrawThemeEdge( NULL )
  3436. , m_pfnDrawThemeIcon( NULL )
  3437. , m_pfnIsThemePartDefined( NULL )
  3438. , m_pfnIsThemeBackgroundPartiallyTransparent( NULL )
  3439. , m_pfnGetThemeColor( NULL )
  3440. , m_pfnGetThemeMetric( NULL )
  3441. , m_pfnGetThemeString( NULL )
  3442. , m_pfnGetThemeBool( NULL )
  3443. , m_pfnGetThemeInt( NULL )
  3444. , m_pfnGetThemeEnumValue( NULL )
  3445. , m_pfnGetThemePosition( NULL )
  3446. , m_pfnGetThemeFont( NULL )
  3447. , m_pfnGetThemeRect( NULL )
  3448. , m_pfnGetThemeMargins( NULL )
  3449. , m_pfnGetThemeIntList( NULL )
  3450. , m_pfnGetThemePropertyOrigin( NULL )
  3451. , m_pfnSetWindowTheme( NULL )
  3452. , m_pfnGetThemeFilename( NULL )
  3453. , m_pfnGetThemeSysColor( NULL )
  3454. , m_pfnGetThemeSysColorBrush( NULL )
  3455. , m_pfnGetThemeSysBool( NULL )
  3456. , m_pfnGetThemeSysSize( NULL )
  3457. , m_pfnGetThemeSysFont( NULL )
  3458. , m_pfnGetThemeSysString( NULL )
  3459. , m_pfnGetThemeSysInt( NULL )
  3460. , m_pfnIsThemeActive( NULL )
  3461. , m_pfnIsAppThemed( NULL )
  3462. , m_pfnGetWindowTheme( NULL )
  3463. , m_pfnEnableThemeDialogTexture( NULL )
  3464. , m_pfnIsThemeDialogTextureEnabled( NULL )
  3465. , m_pfnGetThemeAppProperties( NULL )
  3466. , m_pfnSetThemeAppProperties( NULL )
  3467. , m_pfnGetCurrentThemeName( NULL )
  3468. , m_pfnGetThemeDocumentationProperty( NULL )
  3469. , m_pfnDrawThemeParentBackground( NULL )
  3470. , m_pfnEnableTheming( NULL )
  3471. , m_pfnDrawThemeBackgroundEx( NULL )
  3472. {
  3473. struct
  3474. {
  3475. FARPROC * m_pFarProc;
  3476. LPCSTR m_strProcName;
  3477. }arrUxThemeApi[] =
  3478. {
  3479. { (FARPROC*)&m_pfnOpenThemeData, "OpenThemeData" },
  3480. { (FARPROC*)&m_pfnOpenThemeDataEx, "OpenThemeDataEx"},
  3481. { (FARPROC*)&m_pfnCloseThemeData, "CloseThemeData" },
  3482. { (FARPROC*)&m_pfnDrawThemeBackground, "DrawThemeBackground" },
  3483. { (FARPROC*)&m_pfnDrawThemeText, "DrawThemeText" },
  3484. { (FARPROC*)&m_pfnDrawThemeTextEx, "DrawThemeTextEx" },
  3485. { (FARPROC*)&m_pfnGetThemeBackgroundContentRect, "GetThemeBackgroundContentRect" },
  3486. { (FARPROC*)&m_pfnGetThemeBackgroundExtent, "GetThemeBackgroundExtent" },
  3487. { (FARPROC*)&m_pfnGetThemePartSize, "GetThemePartSize" },
  3488. { (FARPROC*)&m_pfnGetThemeTextExtent, "GetThemeTextExtent" },
  3489. { (FARPROC*)&m_pfnGetThemeTextMetrics, "GetThemeTextMetrics" },
  3490. { (FARPROC*)&m_pfnGetThemeBackgroundRegion, "GetThemeBackgroundRegion" },
  3491. { (FARPROC*)&m_pfnHitTestThemeBackground, "HitTestThemeBackground" },
  3492. { (FARPROC*)&m_pfnDrawThemeEdge, "DrawThemeEdge" },
  3493. { (FARPROC*)&m_pfnDrawThemeIcon, "DrawThemeIcon" },
  3494. { (FARPROC*)&m_pfnIsThemePartDefined, "IsThemePartDefined" },
  3495. { (FARPROC*)&m_pfnIsThemeBackgroundPartiallyTransparent, "IsThemeBackgroundPartiallyTransparent" },
  3496. { (FARPROC*)&m_pfnGetThemeColor, "GetThemeColor" },
  3497. { (FARPROC*)&m_pfnGetThemeMetric, "GetThemeMetric" },
  3498. { (FARPROC*)&m_pfnGetThemeString, "GetThemeString" },
  3499. { (FARPROC*)&m_pfnGetThemeBool, "GetThemeBool" },
  3500. { (FARPROC*)&m_pfnGetThemeInt, "GetThemeInt" },
  3501. { (FARPROC*)&m_pfnGetThemeEnumValue, "GetThemeEnumValue" },
  3502. { (FARPROC*)&m_pfnGetThemePosition, "GetThemePosition" },
  3503. { (FARPROC*)&m_pfnGetThemeFont, "GetThemeFont" },
  3504. { (FARPROC*)&m_pfnGetThemeRect, "GetThemeRect" },
  3505. { (FARPROC*)&m_pfnGetThemeMargins, "GetThemeMargins" },
  3506. { (FARPROC*)&m_pfnGetThemeIntList, "GetThemeIntList" },
  3507. { (FARPROC*)&m_pfnGetThemePropertyOrigin, "GetThemePropertyOrigin" },
  3508. { (FARPROC*)&m_pfnSetWindowTheme, "SetWindowTheme" },
  3509. { (FARPROC*)&m_pfnGetThemeFilename, "GetThemeFilename" },
  3510. { (FARPROC*)&m_pfnGetThemeSysColor, "GetThemeSysColor" },
  3511. { (FARPROC*)&m_pfnGetThemeSysColorBrush, "GetThemeSysColorBrush" },
  3512. { (FARPROC*)&m_pfnGetThemeSysBool, "GetThemeSysBool" },
  3513. { (FARPROC*)&m_pfnGetThemeSysSize, "GetThemeSysSize" },
  3514. { (FARPROC*)&m_pfnGetThemeSysFont, "GetThemeSysFont" },
  3515. { (FARPROC*)&m_pfnGetThemeSysString, "GetThemeSysString" },
  3516. { (FARPROC*)&m_pfnGetThemeSysInt, "GetThemeSysInt" },
  3517. { (FARPROC*)&m_pfnIsThemeActive, "IsThemeActive" },
  3518. { (FARPROC*)&m_pfnIsAppThemed, "IsAppThemed" },
  3519. { (FARPROC*)&m_pfnGetWindowTheme, "GetWindowTheme" },
  3520. { (FARPROC*)&m_pfnEnableThemeDialogTexture, "EnableThemeDialogTexture" },
  3521. { (FARPROC*)&m_pfnIsThemeDialogTextureEnabled, "IsThemeDialogTextureEnabled" },
  3522. { (FARPROC*)&m_pfnGetThemeAppProperties, "GetThemeAppProperties" },
  3523. { (FARPROC*)&m_pfnSetThemeAppProperties, "SetThemeAppProperties" },
  3524. { (FARPROC*)&m_pfnGetCurrentThemeName, "GetCurrentThemeName" },
  3525. { (FARPROC*)&m_pfnGetThemeDocumentationProperty, "GetThemeDocumentationProperty" },
  3526. { (FARPROC*)&m_pfnDrawThemeParentBackground, "DrawThemeParentBackground" },
  3527. { (FARPROC*)&m_pfnEnableTheming, "EnableTheming" },
  3528. { (FARPROC*)&m_pfnDrawThemeBackgroundEx, "DrawThemeBackgroundEx" },
  3529. };
  3530. if( m_hUxThemeDll == NULL )
  3531. {
  3532. m_hUxThemeDll =
  3533. ::GetModuleHandle( _T("UxTheme.dll") );
  3534. if( m_hUxThemeDll == NULL )
  3535. {
  3536. m_hUxThemeDll = ::LoadLibrary( _T("UxTheme.dll") );
  3537. m_bNeedToFreeDll = true;
  3538. }
  3539. } // if( m_hUxThemeDll == NULL )
  3540. if( m_hUxThemeDll != NULL )
  3541. {
  3542. INT nApiCount = sizeof(arrUxThemeApi)/sizeof(arrUxThemeApi[0]);
  3543. for( INT nFunc = 0; nFunc < nApiCount; nFunc++ )
  3544. {
  3545. FARPROC pFarProc = NULL;
  3546. pFarProc = 
  3547. ::GetProcAddress(
  3548. m_hUxThemeDll,
  3549. arrUxThemeApi[nFunc].m_strProcName
  3550. );
  3551. *(arrUxThemeApi[nFunc].m_pFarProc) = pFarProc;
  3552. }
  3553. // DrawThemeBackgroundEx() may absent
  3554. } // if( m_hUxThemeDll != NULL )
  3555. memset( m_szClassListCached, 0, sizeof( m_szClassListCached ) / sizeof( m_szClassListCached[0] ) );
  3556. m_dwComCtlVersion = CExtPaintManager::stat_DllGetVersion( _T("COMCTL32.DLL") );
  3557. }
  3558. CExtUxTheme::~CExtUxTheme()
  3559. {
  3560. CloseThemeData( false );
  3561. if( m_hUxThemeDll != NULL && m_bNeedToFreeDll ) 
  3562. {
  3563. ::FreeLibrary( m_hUxThemeDll );
  3564. m_hUxThemeDll = NULL;
  3565. }
  3566. }
  3567. bool CExtUxTheme::IsControlsThemed( 
  3568. bool bCheckComCtlVersion // = true
  3569. )
  3570. {
  3571. if( m_hUxThemeDll == NULL )
  3572. return false;
  3573. return (
  3574. IsThemeActive() 
  3575. && (GetThemeAppProperties()&__EXT_UX_STAP_ALLOW_CONTROLS) != 0 
  3576. && (bCheckComCtlVersion ? (HIWORD(m_dwComCtlVersion) > 5) : true )
  3577. );
  3578. }
  3579. bool CExtUxTheme::IsNonClientThemed( 
  3580. bool bCheckComCtlVersion // = true
  3581. )
  3582. {
  3583. if( m_hUxThemeDll == NULL )
  3584. return false;
  3585. return (
  3586. IsThemeActive() 
  3587. && (GetThemeAppProperties()&__EXT_UX_STAP_ALLOW_NONCLIENT) != 0 
  3588. && (bCheckComCtlVersion ? (HIWORD(m_dwComCtlVersion) > 5) : true )
  3589. );
  3590. }
  3591. bool CExtUxTheme::IsWebContentThemed( 
  3592. bool bCheckComCtlVersion // = true
  3593. )
  3594. {
  3595. if( m_hUxThemeDll == NULL )
  3596. return false;
  3597. return (
  3598. IsThemeActive() 
  3599. && (GetThemeAppProperties()&__EXT_UX_STAP_ALLOW_WEBCONTENT) != 0 
  3600. && (bCheckComCtlVersion ? (HIWORD(m_dwComCtlVersion) > 5) : true )
  3601. );
  3602. }
  3603. CExtUxTheme::__EXT_UX_HTHEME CExtUxTheme::OpenThemeData(
  3604. HWND hWnd, 
  3605. __EXT_UX_LPCWSTR pszClassList
  3606. )
  3607. {
  3608. //ASSERT( m_pfnOpenThemeData != NULL );
  3609. if( m_pfnOpenThemeData != NULL ) 
  3610. {
  3611. WCHAR szClassList[ MAX_PATH+1 ] = L"";
  3612. if( pszClassList != NULL )
  3613. __EXT_MFC_WCSCPY( szClassList, MAX_PATH, pszClassList );
  3614. if( _wcsnicmp( szClassList, L"", wcslen( szClassList ) ) == 0 )
  3615. {
  3616. TCHAR szClassName[ MAX_PATH + 1 ] = _T("");
  3617. ::GetClassName( hWnd, szClassName, MAX_PATH );
  3618. USES_CONVERSION;
  3619. __EXT_MFC_WCSCPY( szClassList, MAX_PATH, T2OLE( szClassName ) );
  3620. }
  3621. if( _wcsnicmp( szClassList, m_szClassListCached, wcslen( szClassList ) ) != 0 
  3622. || hWnd != m_hWndCached 
  3623. || (! ::IsWindow( m_hWndCached )  )
  3624. )
  3625. {
  3626. CloseThemeData( false );
  3627. m_hUxTheme = m_pfnOpenThemeData( hWnd, szClassList );
  3628. memset( m_szClassListCached, 0, sizeof( m_szClassListCached ) / sizeof( m_szClassListCached[0] ) );
  3629. m_hWndCached = NULL;
  3630. if( m_hUxTheme != NULL )
  3631. {
  3632. __EXT_MFC_WCSCPY( m_szClassListCached, MAX_PATH, szClassList );
  3633. m_hWndCached = hWnd;
  3634. }
  3635. }
  3636. //ASSERT( m_hUxTheme != NULL );
  3637. return m_hUxTheme;
  3638. }
  3639. return NULL;
  3640. }
  3641. CExtUxTheme::__EXT_UX_HTHEME CExtUxTheme::OpenThemeDataEx(
  3642. HWND hWnd, 
  3643. __EXT_UX_LPCWSTR pszClassList,
  3644. DWORD dwFlags
  3645. )
  3646. {
  3647. //ASSERT( m_pfnOpenThemeData != NULL );
  3648. if( m_pfnOpenThemeDataEx != NULL ) 
  3649. {
  3650. WCHAR szClassList[ MAX_PATH+1 ] = L"";
  3651. if( pszClassList != NULL )
  3652. __EXT_MFC_WCSCPY( szClassList, MAX_PATH, pszClassList );
  3653. if( _wcsnicmp( szClassList, L"", wcslen( szClassList ) ) == 0 )
  3654. {
  3655. TCHAR szClassName[ MAX_PATH + 1 ] = _T("");
  3656. ::GetClassName( hWnd, szClassName, MAX_PATH );
  3657. USES_CONVERSION;
  3658. __EXT_MFC_WCSCPY( szClassList, MAX_PATH, T2OLE( szClassName ) );
  3659. }
  3660. if( _wcsnicmp( szClassList, m_szClassListCached, wcslen( szClassList ) ) != 0 
  3661. || hWnd != m_hWndCached 
  3662. || (! ::IsWindow( m_hWndCached )  )
  3663. )
  3664. {
  3665. CloseThemeData( false );
  3666. m_hUxTheme = m_pfnOpenThemeDataEx( hWnd, szClassList, dwFlags );
  3667. memset( m_szClassListCached, 0, sizeof( m_szClassListCached ) / sizeof( m_szClassListCached[0] ) );
  3668. m_hWndCached = NULL;
  3669. if( m_hUxTheme != NULL )
  3670. {
  3671. __EXT_MFC_WCSCPY( m_szClassListCached, MAX_PATH, szClassList );
  3672. m_hWndCached = hWnd;
  3673. }
  3674. }
  3675. //ASSERT( m_hUxTheme != NULL );
  3676. return m_hUxTheme;
  3677. }
  3678. return NULL;
  3679. }
  3680. HRESULT CExtUxTheme::_CloseThemeData( 
  3681. __EXT_UX_HTHEME hUxTheme 
  3682. )
  3683. {
  3684. //ASSERT( hUxTheme != NULL );
  3685. //ASSERT( m_pfnCloseThemeData != NULL );
  3686. if( hUxTheme == NULL 
  3687. || m_pfnCloseThemeData == NULL
  3688. || (! ::IsWindow( m_hWndCached ) )
  3689. )
  3690. return S_FALSE;
  3691. HRESULT lResult = S_FALSE;
  3692. __try
  3693. {
  3694. if( m_pfnCloseThemeData != NULL ) 
  3695. lResult = m_pfnCloseThemeData( hUxTheme );
  3696. }
  3697. __except( EXCEPTION_EXECUTE_HANDLER )
  3698. {
  3699. return S_FALSE;
  3700. }
  3701. return lResult;
  3702. }
  3703. HRESULT CExtUxTheme::CloseThemeData(
  3704. bool bAllowCaching // = false
  3705. )
  3706. {
  3707. if( m_hUxTheme == NULL 
  3708. || bAllowCaching
  3709. )
  3710. return S_OK;
  3711. ASSERT( m_pfnCloseThemeData != NULL );
  3712. HRESULT lResult = 
  3713. _CloseThemeData( m_hUxTheme );
  3714. m_hUxTheme = NULL;
  3715. memset( m_szClassListCached, 0, sizeof( m_szClassListCached ) / sizeof( m_szClassListCached[0] ) );
  3716. m_hWndCached = NULL;
  3717. return lResult;
  3718. }
  3719. HRESULT CExtUxTheme::DrawThemeBackground(
  3720. HDC hdc, 
  3721. int iPartId, 
  3722. int iStateId, 
  3723. const RECT * pRect, 
  3724. OPTIONAL const RECT * pClipRect
  3725. )
  3726. {
  3727. //ASSERT( m_hUxTheme != NULL );
  3728. //ASSERT( m_pfnDrawThemeBackground != NULL );
  3729. if( m_pfnDrawThemeBackground != NULL ) 
  3730. return m_pfnDrawThemeBackground( m_hUxTheme, hdc, iPartId, iStateId, pRect, pClipRect );
  3731. return S_FALSE;
  3732. }
  3733. HRESULT CExtUxTheme::DrawBackground(
  3734. HWND hWnd,
  3735. HDC hdc, 
  3736. int iPartId, 
  3737. int iStateId, 
  3738. const RECT * pRect, 
  3739. OPTIONAL const RECT * pClipRect
  3740. )
  3741. {
  3742. hWnd;
  3743. CRect rcRect( 0, 0, 0, 0 );
  3744. if( pRect != NULL )
  3745. rcRect = *pRect;
  3746. CRect rcClipRect( 0, 0, 0, 0 );
  3747. if( pClipRect != NULL )
  3748. rcClipRect = *pClipRect;
  3749. //  if( IsThemeBackgroundPartiallyTransparent( 
  3750. //  iPartId, 
  3751. //  iStateId 
  3752. //  ) 
  3753. //  )
  3754. //  DrawThemeParentBackground(
  3755. //  hWnd, 
  3756. //  hdc, 
  3757. //  &rcRect
  3758. //  );
  3759. return
  3760. DrawThemeBackground(
  3761. hdc, 
  3762. iPartId, 
  3763. iStateId, 
  3764. &rcRect, 
  3765. &rcClipRect
  3766. );
  3767. }
  3768. HRESULT CExtUxTheme::DrawThemeText(
  3769. HDC hdc, 
  3770. int iPartId, 
  3771. int iStateId, 
  3772. __EXT_UX_LPCWSTR pszText, 
  3773. int iCharCount, 
  3774. DWORD dwTextFlags, 
  3775. DWORD dwTextFlags2, 
  3776. const RECT * pRect
  3777. )
  3778. {
  3779. //ASSERT( m_hUxTheme != NULL );
  3780. //ASSERT( m_pfnDrawThemeText != NULL );
  3781. if( m_pfnDrawThemeText != NULL ) 
  3782. return m_pfnDrawThemeText( m_hUxTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect );
  3783. return S_FALSE;
  3784. }
  3785. HRESULT CExtUxTheme::DrawThemeText(
  3786. HDC hdc, 
  3787. int iPartId, 
  3788. int iStateId, 
  3789. const CExtSafeString & sText, 
  3790. int iCharCount, 
  3791. DWORD dwTextFlags, 
  3792. DWORD dwTextFlags2, 
  3793. const RECT * pRect
  3794. )
  3795. {
  3796. USES_CONVERSION;
  3797. LPCOLESTR wStrText = T2COLE( LPCTSTR( sText ) );
  3798. return
  3799. DrawThemeText(
  3800. hdc,
  3801. iPartId,
  3802. iStateId,
  3803. wStrText,
  3804. iCharCount,
  3805. dwTextFlags,
  3806. dwTextFlags2,
  3807. pRect
  3808. );
  3809. }
  3810. HRESULT CExtUxTheme::DrawThemeTextEx(
  3811. HDC hdc,
  3812. int iPartId,
  3813. int iStateId,
  3814. __EXT_UX_LPCWSTR pszText,
  3815. int iCharCount,
  3816. DWORD dwFlags,
  3817. LPRECT pRect,
  3818. const CExtUxTheme::__EXT_UX_DTTOPTS * pOptions
  3819. )
  3820. {
  3821. //ASSERT( m_hUxTheme != NULL );
  3822. //ASSERT( m_pfnDrawThemeTextEx != NULL );
  3823. if( m_pfnDrawThemeTextEx != NULL ) 
  3824. return m_pfnDrawThemeTextEx( m_hUxTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwFlags, pRect, pOptions );
  3825. return S_FALSE;
  3826. }
  3827. HRESULT CExtUxTheme::DrawThemeTextEx(
  3828. HDC hdc,
  3829. int iPartId,
  3830. int iStateId,
  3831. const CExtSafeString & sText, 
  3832. int iCharCount,
  3833. DWORD dwFlags,
  3834. LPRECT pRect,
  3835. const CExtUxTheme::__EXT_UX_DTTOPTS * pOptions
  3836. )
  3837. {
  3838. USES_CONVERSION;
  3839. LPCOLESTR wStrText = T2COLE( LPCTSTR( sText ) );
  3840. return
  3841. DrawThemeTextEx(
  3842. hdc,
  3843. iPartId,
  3844. iStateId,
  3845. wStrText,
  3846. iCharCount,
  3847. dwFlags,
  3848. pRect,
  3849. pOptions
  3850. );
  3851. }
  3852. HRESULT CExtUxTheme::GetThemeBackgroundContentRect(
  3853. OPTIONAL HDC hdc, 
  3854. int iPartId, 
  3855. int iStateId,  
  3856. const RECT * pBoundingRect, 
  3857. OUT RECT * pContentRect
  3858. )
  3859. {
  3860. //ASSERT( m_hUxTheme != NULL );
  3861. //ASSERT( m_pfnGetThemeBackgroundContentRect != NULL );
  3862. if( m_pfnGetThemeBackgroundContentRect != NULL ) 
  3863. return m_pfnGetThemeBackgroundContentRect( m_hUxTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect );
  3864. return S_FALSE;
  3865. }
  3866. HRESULT CExtUxTheme::GetThemeBackgroundExtent(
  3867. OPTIONAL HDC hdc,
  3868. int iPartId, 
  3869. int iStateId, 
  3870. const RECT * pContentRect, 
  3871. OUT RECT * pExtentRect
  3872. )
  3873. {
  3874. //ASSERT( m_hUxTheme != NULL );
  3875. //ASSERT( m_pfnGetThemeBackgroundExtent != NULL );
  3876. if( m_pfnGetThemeBackgroundExtent != NULL ) 
  3877. return m_pfnGetThemeBackgroundExtent( m_hUxTheme, hdc, iPartId, iStateId, pContentRect, pExtentRect );
  3878. return S_FALSE;
  3879. }
  3880. HRESULT CExtUxTheme::GetThemePartSize(
  3881. HDC hdc, 
  3882. int iPartId, 
  3883. int iStateId, 
  3884. OPTIONAL RECT * prc, 
  3885. enum __EXT_UX_THEMESIZE eSize, 
  3886. OUT SIZE * psz
  3887. )
  3888. {
  3889. //ASSERT( m_hUxTheme != NULL );
  3890. //ASSERT( m_pfnGetThemePartSize != NULL );
  3891. if( m_pfnGetThemePartSize != NULL ) 
  3892. return m_pfnGetThemePartSize( m_hUxTheme, hdc, iPartId, iStateId, prc, eSize, psz );
  3893. return S_FALSE;
  3894. }
  3895. HRESULT CExtUxTheme::GetThemeTextExtent(
  3896. HDC hdc, 
  3897. int iPartId, 
  3898. int iStateId, 
  3899. __EXT_UX_LPCWSTR pszText, 
  3900. int iCharCount, 
  3901. DWORD dwTextFlags, 
  3902. OPTIONAL const RECT * pBoundingRect, 
  3903. OUT RECT * pExtentRect
  3904. )
  3905. {
  3906. //ASSERT( m_hUxTheme != NULL );
  3907. //ASSERT( m_pfnGetThemeTextExtent != NULL );
  3908. if( m_pfnGetThemeTextExtent != NULL ) 
  3909. return m_pfnGetThemeTextExtent( m_hUxTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect );
  3910. return S_FALSE;
  3911. }
  3912. HRESULT CExtUxTheme::GetThemeTextExtent(
  3913. HDC hdc, 
  3914. int iPartId, 
  3915. int iStateId, 
  3916. const CExtSafeString & sText, 
  3917. int iCharCount, 
  3918. DWORD dwTextFlags, 
  3919. OPTIONAL const RECT * pBoundingRect, 
  3920. OUT RECT * pExtentRect
  3921. )
  3922. {
  3923. USES_CONVERSION;
  3924. LPCOLESTR wStrText = T2COLE( LPCTSTR( sText ) );
  3925. if( m_pfnGetThemeTextExtent != NULL ) 
  3926. return m_pfnGetThemeTextExtent( m_hUxTheme, hdc, iPartId, iStateId, wStrText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect );
  3927. return S_FALSE;
  3928. }
  3929. HRESULT CExtUxTheme::GetThemeTextMetrics(
  3930. OPTIONAL HDC hdc, 
  3931. int iPartId, 
  3932. int iStateId, 
  3933. OUT TEXTMETRIC * ptm
  3934. )
  3935. {
  3936. //ASSERT( m_hUxTheme != NULL );
  3937. //ASSERT( m_pfnGetThemeTextMetrics != NULL );
  3938. if( m_pfnGetThemeTextMetrics != NULL ) 
  3939. return m_pfnGetThemeTextMetrics( m_hUxTheme, hdc, iPartId, iStateId, ptm );
  3940. return S_FALSE;
  3941. }
  3942. HRESULT CExtUxTheme::GetThemeBackgroundRegion(
  3943. OPTIONAL HDC hdc,  
  3944. int iPartId, 
  3945. int iStateId, 
  3946. const RECT * pRect, 
  3947. OUT HRGN * pRegion
  3948. )
  3949. {
  3950. //ASSERT( m_hUxTheme != NULL );
  3951. //ASSERT( m_pfnGetThemeBackgroundRegion != NULL );
  3952. if( m_pfnGetThemeBackgroundRegion != NULL ) 
  3953. return m_pfnGetThemeBackgroundRegion( m_hUxTheme, hdc, iPartId, iStateId, pRect, pRegion );
  3954. return S_FALSE;
  3955. }
  3956. HRESULT CExtUxTheme::HitTestThemeBackground(
  3957. OPTIONAL HDC hdc, 
  3958. int iPartId, 
  3959. int iStateId, 
  3960. DWORD dwOptions, 
  3961. const RECT * pRect, 
  3962. OPTIONAL HRGN hrgn, 
  3963. POINT ptTest, 
  3964. OUT WORD * pwHitTestCode
  3965. )
  3966. {
  3967. //ASSERT( m_hUxTheme != NULL );
  3968. //ASSERT( m_pfnHitTestThemeBackground != NULL );
  3969. if( m_pfnHitTestThemeBackground != NULL ) 
  3970. return m_pfnHitTestThemeBackground( m_hUxTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode );
  3971. return S_FALSE;
  3972. }
  3973. HRESULT CExtUxTheme::DrawThemeEdge(
  3974. HDC hdc, 
  3975. int iPartId, 
  3976. int iStateId, 
  3977. const RECT * pDestRect, 
  3978. UINT uEdge, UINT uFlags, 
  3979. OPTIONAL OUT RECT * pContentRect
  3980. )
  3981. {
  3982. //ASSERT( m_hUxTheme != NULL );
  3983. //ASSERT( m_pfnDrawThemeEdge != NULL );
  3984. if( m_pfnDrawThemeEdge != NULL ) 
  3985. return m_pfnDrawThemeEdge( m_hUxTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect );
  3986. return S_FALSE;
  3987. }
  3988. HRESULT CExtUxTheme::DrawThemeIcon(
  3989. HDC hdc, 
  3990. int iPartId, 
  3991. int iStateId, 
  3992. const RECT * pRect, 
  3993. HIMAGELIST himl, 
  3994. int iImageIndex
  3995. )
  3996. {
  3997. //ASSERT( m_hUxTheme != NULL );
  3998. //ASSERT( m_pfnDrawThemeIcon != NULL );
  3999. if( m_pfnDrawThemeIcon != NULL ) 
  4000. return m_pfnDrawThemeIcon( m_hUxTheme, hdc, iPartId, iStateId, pRect, himl, iImageIndex );
  4001. return S_FALSE;
  4002. }
  4003. BOOL CExtUxTheme::IsThemePartDefined(
  4004. int iPartId, 
  4005. int iStateId
  4006. )
  4007. {
  4008. //ASSERT( m_hUxTheme != NULL );
  4009. //ASSERT( m_pfnIsThemePartDefined != NULL );
  4010. if( m_pfnIsThemePartDefined != NULL ) 
  4011. return m_pfnIsThemePartDefined( m_hUxTheme, iPartId, iStateId );
  4012. return FALSE;
  4013. }
  4014. BOOL CExtUxTheme::IsThemeBackgroundPartiallyTransparent(
  4015. int iPartId, 
  4016. int iStateId
  4017. )
  4018. {
  4019. //ASSERT( m_hUxTheme != NULL );
  4020. //ASSERT( m_pfnIsThemeBackgroundPartiallyTransparent != NULL );
  4021. if( m_pfnIsThemeBackgroundPartiallyTransparent != NULL ) 
  4022. return m_pfnIsThemeBackgroundPartiallyTransparent( m_hUxTheme, iPartId, iStateId );
  4023. return FALSE;
  4024. }
  4025. HRESULT CExtUxTheme::GetThemeColor(
  4026. int iPartId, 
  4027. int iStateId, 
  4028. int iPropId, 
  4029. OUT COLORREF * pColor
  4030. )
  4031. {
  4032. //ASSERT( m_hUxTheme != NULL );
  4033. //ASSERT( m_pfnGetThemeColor != NULL );
  4034. if( m_pfnGetThemeColor != NULL ) 
  4035. return m_pfnGetThemeColor( m_hUxTheme, iPartId, iStateId, iPropId, pColor );
  4036. return S_FALSE;
  4037. }
  4038. HRESULT CExtUxTheme::GetThemeMetric(
  4039. OPTIONAL HDC hdc, 
  4040. int iPartId, 
  4041. int iStateId, 
  4042. int iPropId, 
  4043. OUT int * piVal
  4044. )
  4045. {
  4046. //ASSERT( m_hUxTheme != NULL );
  4047. //ASSERT( m_pfnGetThemeMetric != NULL );
  4048. if( m_pfnGetThemeMetric != NULL ) 
  4049. return m_pfnGetThemeMetric( m_hUxTheme, hdc, iPartId, iStateId, iPropId, piVal );
  4050. return S_FALSE;
  4051. }