aduiTheme.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. // Purpose:
  10. //
  11. // Encapsulates the theme of the UI elements. It contains the colors of
  12. // different elements of the window, fonts, etc. The palette and other
  13. // window classes can get the UI look from this theme. The theme can contain
  14. // different set of values for different UI windows. For example it can have
  15. // one set of colors and fonts for all the dialogs and another set of colors
  16. // and fonts for all the palettes
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #ifndef _ADUI_THEME_H_
  20. #define _ADUI_THEME_H_
  21. #include "adesk.h"
  22. #ifdef _ADESK_WINDOWS_
  23. #include <afxtempl.h>
  24. #include "AdAChar.h"
  25. #include "AcColorThemeEnum.h"
  26. class CAcColorTheme;
  27. #define PROPERTY_PALETTE_THEME ACRX_T(/*MSG0*/"PropertyPalette")
  28. #define TOOL_PALETTE_THEME ACRX_T(/*MSG0*/"ToolPalette")
  29. #define OWNDERDRAW_BUTTON_THEME ACRX_T(/*MSG0*/"OwnerDrawButton")
  30. #define DIALOG_WORKSHEET_THEME ACRX_T(/*MSG0*/"DialogWorksheet")
  31. #define PALETTE_SET_THEME ACRX_T(/*MSG0*/"PaletteSet")
  32. #define DESIGN_CENTER_THEME ACRX_T(/*MSG0*/"DesignCenter") // Constant theme for all apps, dom't override
  33. #define TOOL_PANEL_THEME ACRX_T(/*MSG0*/"ToolPanel")
  34. #define DOCKBAR_THEME ACRX_T(/*MSG0*/"DockBar")
  35. #define DOCKCONTROLBAR_THEME ACRX_T(/*MSG0*/"DockControlBar")
  36. #define ANCHORBAR_THEME ACRX_T(/*MSG0*/"AnchorBar")
  37. #define ACTIVE_THEME ACRX_T(/*MSG0*/"ACTIVETHEME")
  38. #define DIALOG_THEME ACRX_T(/*MSG0*/"DIALOGTHEME")
  39. typedef enum {
  40. kUnknownElements = -1,
  41. // Theme fonts
  42. kPaletteFontCaption,
  43. kPaletteFontTab,
  44. kPaletteFontToolTip,
  45. kPaletteFont,
  46. kWorksheetFont,
  47. kWorksheetFontCaption,
  48. kInspectorItemFont,
  49. kInspectorRootFont,
  50. // Theme colors
  51. // Palette Set Colors
  52. kPaletteBackground,
  53. kPaletteCaptionBackground,
  54. kPaletteCaptionInactive,
  55. kPaletteCaptionText,
  56. kPaletteCaptionInactiveText,
  57. kPaletteTabText,
  58. kPaletteTabBackground,
  59. kPaletteBorder,
  60. kPaletteTabShadow,
  61. kPaletteTabHighlight,
  62. kPaletteTabTextHilite,
  63. kPaletteTabSelectHilite,
  64. kPaletteToolTip,
  65. kPaletteToolTipText,
  66. kPaletteButtonText,
  67. kPaletteButtonTextDisabled,
  68. kPaletteButtonBorder,
  69. kPaletteItemText,
  70. kPaletteScrollBackground,
  71. kPaletteScrollThumb,
  72. kPaletteScrollArrow,
  73. // Worksheets
  74. kWorksheetBackground,
  75. kWorksheetCaptionBackground,
  76. kWorksheetCaptionText,
  77. kWorksheet3DBtnShadow,
  78. kWorksheetButtonText,
  79. kWorksheetButtonTextDisabled,
  80. kWorksheetScrollBackground,
  81. kWorksheetScrollThumb,
  82. kWorksheetBorder,
  83. kWorksheetGripHighlight,
  84. // Property Inspectors
  85. kInspector,
  86. kInspectorTop,
  87. kInspectorCat,
  88. kInspectorItem,
  89. kInspectorBorder,
  90. kInspectorBorderItem,
  91. kInspectorTextTop,
  92. kInspectorTextCat,
  93. kInspectorTextItem,
  94. kInspectorTextLabel,
  95. kInspectorFGHighlight,
  96. kInspectorBGHighlight,
  97. kInspector3dShadow,
  98. kInspectorControl,
  99. kInspectorCatChevron1,
  100. kInspectorCatChevron2,
  101. kInspectorSubChevron,
  102. kInspectorCellHighlight,
  103. // Panel Colors
  104. kPanelBackground,
  105. kPanelSashBackground,
  106. kPanelBorder,
  107. //General control colors
  108. kControlBorder,
  109. kControlBackground,
  110. kDisabledControlBorder,
  111. kControlSupport,
  112. kControlHighlight,
  113. kControlActiveOuterBorder,
  114. kControlErrorOuterBorder,
  115. kControlActiveText,
  116. kControlText,
  117. kControlInactiveText,
  118. // Extra Palette Set Colors
  119. kPaletteFrameInnerBorder,
  120. kPaletteFrameOuterBorder,
  121. kPaletteFrameBackground,
  122. kPaletteFrameShadow,
  123. kInspectorTopGradient1,
  124. kInspectorTopGradient2,
  125. kPaletteScrollBackgroundBorder,
  126. kPaletteScrollBackgroundGradient1,
  127. kPaletteScrollBackgroundGradient2,
  128. kPaletteScrollSliderInactive,
  129. kPaletteScrollSliderActiveOuterBorder,
  130. kPaletteScrollSliderActiveOuterGradient1,
  131. kPaletteScrollSliderActiveOuterGradient2,
  132. kPaletteScrollSliderActiveOuterGradient3,
  133. kPaletteScrollSliderActiveOuterGradient4,
  134. kPaletteScrollSliderActiveInnerGradient1,
  135. kPaletteScrollSliderActiveInnerGradient2,
  136. kInspectorClosedOuterBorder,
  137. kInspectorOpenOuterBorder,
  138. kInspectorInnerBorder,
  139. kPaletteColumnHeaderBackground,
  140. kPaletteHyperlinkText,
  141. kPaletteTreeOrListBackground,
  142. // Anchor Bar Colors
  143. kAnchorBarOuterBorder,
  144. kAnchorBarEmbossRightBottom,
  145. kAnchorBarEmbossLeftTop,
  146. kAnchorBarInnerHighlight,
  147. kAnchorBarGradient1,
  148. kAnchorBarGradient2,
  149. kAnchorBarActiveTitleBackground,
  150. kAnchorBarCaptionText,
  151. // Other Colors
  152. kGrabBarDotDark,
  153. kGrabBarDotLight,
  154. kControlBarTitleBackground,
  155. // Application Frame Window Colors
  156. kAppFrameBorder,
  157. kAppFrameOuterBorder,
  158. kAppFrameAFGradientTop,
  159. kAppFrameAFGradientBottom,
  160. // Application Frame Caption area
  161. kAppFrameCaptionActiveGradientTop,
  162. kAppFrameCaptionActiveGradientBottom,
  163. kAppFrameCaptionInActiveGradientTop,
  164. kAppFrameCaptionInActiveGradientBottom,
  165. kAppFrameCaptionOuterBorder,
  166. kAppFrameCaptionInnerBorder,
  167. // Application Frame Quick Access Toolbar
  168. kAppFrameQATGradientTop,
  169. kAppFrameQATGradientBottom,
  170. kAppFrameQATOuterBorder,
  171. kAppFrameQATInnerBorder,
  172. kAppFrameQATButtonsBorder,
  173. kAppFrameQATButtonsRolloverBorder,
  174. kAppFrameQATButtonsClickBorder,
  175. kAppFrameQATFlyoutButtonText,
  176. // Application Frame Menu Browser Button
  177. kAppFrameBigMBBGradientFillTop,
  178. kAppFrameBigMBBGradientFillMiddleUpper,
  179. kAppFrameBigMBBGradientFillMiddleLower,
  180. kAppFrameBigMBBGradientFillBottom,
  181. kAppFrameSmallMBBGradientFillTop,
  182. kAppFrameSmallMBBGradientFillMiddleUpper,
  183. kAppFrameSmallMBBGradientFillMiddleLower,
  184. kAppFrameSmallMBBGradientFillBottom,
  185. // Application Frame Document name text
  186. kAppFrameDocNameProductNameText,
  187. kAppFrameDocNameFileNameText,
  188. kAppFrameDocNameInactiveProductNameText,
  189. kAppFrameDocNameInactiveFileNameText,
  190. // Application Frame Menu Bar
  191. kAppFrameMenuBarMenuText,
  192. kAppFrameMenuBarMenuHighlightText,
  193. kAppFrameMenuBarMenuDeHighlightText,
  194. kAppFrameMenuBarRolloverBorder,
  195. kAppFrameMenuBarRolloverFill,
  196. kAppFrameMenuBarClickBorder,
  197. kAppFrameMenuBarClickFill,
  198. // Application Frame application window control buttons
  199. kAppFrameAppWindowControlButtonsRolloverGradientBorderTop,
  200. kAppFrameAppWindowControlButtonsRolloverGradientBorderMiddle,
  201. kAppFrameAppWindowControlButtonsRolloverGradientBorderBottom,
  202. kAppFrameAppWindowControlButtonsRolloverGradientFillTop,
  203. kAppFrameAppWindowControlButtonsRolloverGradientFillMiddleUpper,
  204. kAppFrameAppWindowControlButtonsRolloverGradientFillMiddleLower,
  205. kAppFrameAppWindowControlButtonsRolloverGradientFillBottom,
  206. kAppFrameAppWindowControlButtonsClickGradientBorderTop,
  207. kAppFrameAppWindowControlButtonsClickGradientBorderMiddle,
  208. kAppFrameAppWindowControlButtonsClickGradientBorderBottom,
  209. kAppFrameAppWindowControlButtonsClickGradientFillTop,
  210. kAppFrameAppWindowControlButtonsClickGradientFillMiddleUpper,
  211. kAppFrameAppWindowControlButtonsClickGradientFillMiddleLower,
  212. kAppFrameAppWindowControlButtonsClickGradientFillBottom,
  213. // Application Frame Info Center Toggle Button color
  214. kAppFrameInfoCenterToggleButtonText,
  215. // Application Frame Zero Doc state background
  216. kAppFrameZeroDocBackgroundGradientTop,
  217. kAppFrameZeroDocBackgroundGradientBottom,
  218. //Status bar colors.
  219. kStatusBarPaneUnSelectedTopGradient,
  220. kStatusBarPaneUnSelectedBottomGradient,
  221. kStatusBarPaneRolloverGradient1,
  222. kStatusBarPaneRolloverGradient2,
  223. kStatusBarPaneRolloverGradient3,
  224. kStatusBarPaneRolloverGradient4,
  225. kStatusBarPaneSelectionGradient1,
  226. kStatusBarPaneSelectionGradient2,
  227. kStatusBarPaneSelectionGradient3,
  228. kStatusBarPaneSelectionGradient4,
  229. kStatusBarPaneBorder1,
  230. kStatusBarPaneBorder2,
  231. kStatusBarBkGrdBorder,
  232. kStatusBarBkGrdInnerLine,
  233. kStatusBarBkGrdTopGradient,
  234. kStatusBarBkGrdBottomGradient,
  235. //Toolbar specific colors
  236. kToolbarGripDarkDot,
  237. kToolbarGripLightDot,
  238. kToolbarGripBackground,
  239. kToolbarBorder,
  240. kToolbarBackground,
  241. kToolbarRolloverBorder,
  242. kToolbarCloseButton,
  243. //Square Button colors
  244. kSquareButtonHoverBorder,
  245. kSquareButtonHoverHighlight,
  246. kSquareButtonHoverBackgroundTop,
  247. kSquareButtonHoverBackgroundBottom,
  248. kSquareButtonClickBorder,
  249. kSquareButtonClickHighlight,
  250. kSquareButtonClickBackgroundTop,
  251. kSquareButtonClickBackgroundBottom,
  252. //Combo box colors
  253. kComboBoxBackgroundTop,
  254. kComboBoxBackgroundBottom,
  255. kComboBoxActiveBackgroundTop,
  256. kComboBoxActiveBackgroundBottom,
  257. kComboBoxArrow,
  258. kComboBoxArrowShadow,
  259. kComboBoxHoverText,
  260. kComboBoxSelectText,
  261. kComboBoxHoverBackgroundTop,
  262. kComboBoxHoverBackgroundBottom,
  263. kComboBoxSelectBackgroundTop,
  264. kComboBoxSelectBackgroundBottom,
  265. kComboBoxHoverSelectHighlight,
  266. //Spin control colors
  267. kSpinControlHighlight,
  268. kSpinControlBorder,
  269. kSpinControlClickBackgroundTop,
  270. kSpinControlClickBackgroundBottom,
  271. kSpinControlBackgroundTop,
  272. kSpinControlBackgroundBottom,
  273. //Text input colors
  274. kTextInputInnerShadow,
  275. kTextInputActiveBackgroundTop,
  276. kTextInputActiveBackgroundBottom,
  277. kTextInputActiveHighlight,
  278. kTextInputActiveText,
  279. kTextInputActiveBorder,
  280. //splitter control colors
  281. kCategoryExpander,
  282. kCategoryExpanderShadow,
  283. kGroupGrip,
  284. kGroupGripShadow,
  285. kCategoryBackground,
  286. kCategoryBorder,
  287. kCategoryActiveText,
  288. //List box colors
  289. kListBoxHoverBackgroundTop,
  290. kListBoxHoverBackgroundBottom,
  291. kListBoxHoverBorder,
  292. kListBoxClickBackgroundTop,
  293. kListBoxClickBackgroundBottom,
  294. kListBoxClickBorder,
  295. kListBoxSelectBackgroundTop,
  296. kListBoxSelectBackgroundBottom,
  297. kListBoxSelectBorder,
  298. kListBoxSelectHoverBackgroundTop,
  299. kListBoxSelectHoverBackgroundBottom,
  300. kListBoxSelectHoverBorder,
  301. kListBoxInnerShadow,
  302. kListBoxSelectText,
  303. //Tree and List control colors
  304. kTreeControlLine
  305. } AdUiThemeElement;
  306. /// <summary>
  307. /// CAdUiThemeModifiedReactor is a reactor class which receives theme-modified notifications
  308. /// from CAdUiTheme
  309. /// </summary>
  310. class CAdUiThemeModifiedReactor
  311. {
  312. public:
  313. /// <summary>
  314. /// Virtual method that receives the theme modification event.
  315. /// </summary>
  316. /// <param name="pTheme">
  317. /// The pointer to the theme that was modified.
  318. /// </param>
  319. /// <param name="element">
  320. /// A index of the theme element that was modified.
  321. /// </param>
  322. /// <remarks>
  323. /// This method is also called when the theme uses the active theme colors
  324. /// and the active theme is changed. In that case, element = kUnknownElements
  325. /// </remarks>
  326. virtual void ThemeModified(const CAdUiTheme * pTheme, AdUiThemeElement element) = 0;
  327. };
  328. /// <summary>
  329. /// CAdUiTheme class is collection of ARGB Color, font, and other data for various
  330. /// UI elements of an application (e.g. AutoCAD). Using various methods on this class,
  331. /// a client can query for various types of UI data for the current theme or change them.
  332. /// </summary>
  333. class ADUI_PORT CAdUiTheme
  334. {
  335. friend class CAdUiThemeManager;
  336. public:
  337. /// <summary>
  338. /// Gets the RGB color of the specified display element.
  339. /// </summary>
  340. /// <param name="nDisplayElement">
  341. /// Input display element for a theme color
  342. /// </param>
  343. /// <returns>
  344. /// A RBG color in COLORREF format
  345. /// </returns>
  346. COLORREF GetColor (AdUiThemeElement nDisplayElement) const;
  347. /// <summary>
  348. /// Gets the ARGB color of the specified display element.
  349. /// </summary>
  350. /// <param name="nDisplayElement">
  351. /// Input display element for a theme color
  352. /// </param>
  353. /// <returns>
  354. /// A color in ARGB format
  355. /// </returns>
  356. DWORD GetARGBColor(AdUiThemeElement nDisplayElement) const;
  357. /// <summary>
  358. /// Sets the RGB color of the specified display element.
  359. /// </summary>
  360. /// <param name="nDisplayElement">
  361. /// Input display element for a theme color
  362. /// </param>
  363. /// <param name="crColor">
  364. /// Input RBG color in COLORREF format
  365. /// </param>
  366. /// <returns>
  367. /// TRUE if successful or FALSE otherwise
  368. /// </returns>
  369. BOOL SetColor(AdUiThemeElement nDisplayElement, COLORREF crColor);
  370. /// <summary>
  371. /// Sets the ARGB color of the specified display element.
  372. /// </summary>
  373. /// <param name="nDisplayElement">
  374. /// Input display element for a theme color
  375. /// </param>
  376. /// <param name="dColor">
  377. /// Input color in ARGB format
  378. /// </param>
  379. /// <returns>
  380. /// TRUE if successful or FALSE otherwise
  381. /// </returns>
  382. BOOL SetARGBColor(AdUiThemeElement nDisplayElement, DWORD dColor);
  383. /// <summary>
  384. /// Sets the font of the specified display element.
  385. /// </summary>
  386. /// <param name="nDisplayElement">
  387. /// Input display element for a font
  388. /// </param>
  389. /// <param name="plf">
  390. /// Input pointer to a LOGFONT object. System font is used if the input is a NULL pointer.
  391. /// </param>
  392. /// <returns>
  393. /// TRUE if successful or FALSE otherwise
  394. /// </returns>
  395. BOOL SetFont(AdUiThemeElement nDisplayElement, LOGFONT *plf = NULL);
  396. /// <summary>
  397. /// Gets the font of the specified display element as a LOGFONT pointer
  398. /// </summary>
  399. /// <param name="nDisplayElement">
  400. /// Input display element for a font
  401. /// </param>
  402. /// <param name="plf">
  403. /// Output pointer to a LOGFONT object.
  404. /// </param>
  405. /// <returns>
  406. /// TRUE if successful or FALSE otherwise
  407. /// </returns>
  408. BOOL GetFont(AdUiThemeElement nDisplayElement, LOGFONT *plf) const;
  409. /// <summary>
  410. /// Gets the font of the specified display element as a CFont object
  411. /// </summary>
  412. /// <param name="nDisplayElement">
  413. /// Input display element for a font
  414. /// </param>
  415. /// <param name="pFont">
  416. /// Output pointer to a pFont object.
  417. /// </param>
  418. /// <returns>
  419. /// TRUE if successful or FALSE otherwise
  420. /// </returns>
  421. BOOL GetFont(AdUiThemeElement nDisplayElement, CFont *& pFont) const;
  422. /// <summary>
  423. /// Gets the stored DWORD data of the specified display element
  424. /// </summary>
  425. /// <param name="nElement">
  426. /// Input index of a display element
  427. /// </param>
  428. /// <param name="dwData">
  429. /// Output DWORD data
  430. /// </param>
  431. /// <returns>
  432. /// TRUE if successful or FALSE otherwise
  433. /// </returns>
  434. BOOL GetData(int nElement, DWORD& dwData) const;
  435. /// <summary>
  436. /// Stores DWORD data of the specified display element in the theme
  437. /// </summary>
  438. /// <param name="nElement">
  439. /// Input index of a display element
  440. /// </param>
  441. /// <param name="dwData">
  442. /// Input DWORD data
  443. /// </param>
  444. void SetData(int nElement, const DWORD& dwData);
  445. /// <summary>
  446. /// Gets the stored CString data of the specified display element
  447. /// </summary>
  448. /// <param name="nElement">
  449. /// Input index of a display element
  450. /// </param>
  451. /// <param name="sData">
  452. /// Output CString data
  453. /// </param>
  454. /// <returns>
  455. /// TRUE if successful or FALSE otherwise
  456. /// </returns>
  457. BOOL GetData(int nElement, CString& sData) const;
  458. /// <summary>
  459. /// Stores CString data of the specified display element in the theme
  460. /// </summary>
  461. /// <param name="nElement">
  462. /// Input index of a display element
  463. /// </param>
  464. /// <param name="sData">
  465. /// Input CString data
  466. /// </param>
  467. void SetData(int nElement, const CString& sData);
  468. /// <summary>
  469. /// Gets the stored data pointer of the specified display element
  470. /// </summary>
  471. /// <param name="nElement">
  472. /// Input index of a display element
  473. /// </param>
  474. /// <returns>
  475. /// A void type data pointer
  476. /// </returns>
  477. void* GetDataPtr(int nElement) const;
  478. /// <summary>
  479. /// Stores data of the specified display element in the theme as a void data pointer
  480. /// </summary>
  481. /// <param name="nElement">
  482. /// Input index of a display element
  483. /// </param>
  484. /// <param name="pData">
  485. /// Input data pointer
  486. /// </param>
  487. void SetDataPtr(int nElement, void* pData);
  488. /// <summary>
  489. /// Registers a reactor for a theme client to obtain theme-modified notifications
  490. /// </summary>
  491. /// <param name="pReactor">
  492. /// Input pointer to the reactor instance
  493. /// </param>
  494. /// <returns>
  495. /// TRUE if successful or FALSE otherwise
  496. /// </returns>
  497. BOOL RegisterReactor(CAdUiThemeModifiedReactor * pReactor);
  498. /// <summary>
  499. /// Unregisters a reactor for a theme client to stop obtaining theme-modified notifications
  500. /// </summary>
  501. /// <param name="pReactor">
  502. /// Input pointer to the reactor instance
  503. /// </param>
  504. /// <returns>
  505. /// TRUE if successful or FALSE otherwise
  506. /// </returns>
  507. BOOL UnregisterReactor(CAdUiThemeModifiedReactor * pReactor);
  508. /// <summary>
  509. /// Temporarily suspends sending theme-modified notifications to its reactors. Call this
  510. /// method before making changes to a theme if the reactors do not need to know about these
  511. /// changes. Call ResumeModifiedNotifications after all changes are made.
  512. /// </summary>
  513. void SuspendModifiedNotifications() { m_nModNotificationsSuspended++; }
  514. /// <summary>
  515. /// Resumes sending theme-modified notifications to its reactors
  516. /// </summary>
  517. void ResumeModifiedNotifications();
  518. /// <summary>
  519. /// Sends a theme-modified notification to its theme reactors with kUnknownElements
  520. /// </summary>
  521. void SendModifiedNotification() const;
  522. /// <summary>
  523. /// Gets if the theme uses the colors of the current active theme
  524. /// </summary>
  525. /// <returns>
  526. /// If the theme uses the colors of the current active theme
  527. /// </returns>
  528. bool UsesActiveThemeColors() const { return m_pColorTheme == NULL; }
  529. /// <summary>
  530. /// Gets if the theme has a dark color scheme. This method can help to determine which
  531. /// image is to be used for the theme, if there are two images for the same UI element
  532. /// </summary>
  533. /// <returns>
  534. /// If the theme has a dark color scheme
  535. /// </returns>
  536. bool IsDark() const;
  537. /// <summary>
  538. /// Increaments the reference count of the theme so that the theme will not be deleted
  539. /// </summary>
  540. /// <remarks>
  541. /// The CAdUiThemeManager::ReleaseTheme(CAdUiTheme*) method can be used to decrement
  542. /// the reference count of a theme if it is no longer needed by the client code.
  543. /// </remarks>
  544. void IncrementRefCount() { m_nRefCount++; }
  545. // assignment operator
  546. CAdUiTheme& operator=(const CAdUiTheme& Theme);
  547. // utility methods
  548. /// <summary>
  549. /// Does alpha blending of a translucent foreground color with an opaque background color
  550. /// to produce a new opaque foreground color.
  551. /// </summary>
  552. /// <param name="fgColor">
  553. /// Input translucent foreground color in ARGB format
  554. /// </param>
  555. /// <param name="bgColor">
  556. /// Input opaque background color in COLORREF format
  557. /// </param>
  558. /// <returns>
  559. /// An opaque foreground color in COLORREF format
  560. /// </returns>
  561. static COLORREF GetRGBForeColor(DWORD fgColor, COLORREF bgColor);
  562. private:
  563. CAdUiTheme();
  564. CAdUiTheme(const CAcColorTheme & colorTheme, AcColorThemeEnum themeType);
  565. virtual ~CAdUiTheme();
  566. void commonInitialize();
  567. void SetColorTheme(const CAcColorTheme& colorTheme, AcColorThemeEnum themeType);
  568. void InitializeFont(LOGFONT & sourceLF, LOGFONT & destLF, int fontType = 0);
  569. void InitializeFontsForDialog();
  570. void SendThemeModifiedNotifications(AdUiThemeElement nElement) const;
  571. void CheckXP();
  572. // Are XP themes supported (FUTURE USE!)
  573. BOOL UsesXP() { return m_bUsesXPThemes; };
  574. void DecrementRefCount() { m_nRefCount--; }
  575. int RefCount() { return m_nRefCount; }
  576. int m_nRefCount;
  577. CTypedPtrArray<CPtrArray, CAdUiThemeModifiedReactor*> m_arrayModReactors;
  578. int m_nModNotificationsSuspended;
  579. CMap<int, int, DWORD, DWORD> m_mapDwordValues;
  580. CMap<int, int, CString, CString> m_mapStringValues;
  581. CMap<int, int, void*, void*> m_mapPointerValues;
  582. LOGFONT m_lfWorksheet;
  583. LOGFONT m_lfWorksheetCaption;
  584. LOGFONT m_lfPaletteCaption;
  585. LOGFONT m_lfInspectorItem;
  586. LOGFONT m_lfInspectorRoot;
  587. LOGFONT m_lfPaletteTab;
  588. LOGFONT m_lfPalette;
  589. LOGFONT m_lfPaletteToolTip;
  590. CAcColorTheme* m_pColorTheme;
  591. AcColorThemeEnum m_themeType;
  592. BOOL m_bUsesXPThemes;
  593. };
  594. #endif // _ADESK_WINDOWS_
  595. #endif // ifndef _ADUI_THEME_H_