aduiGroupCtrl.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  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. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef _aduiGroupCtrl_h
  11. #define _aduiGroupCtrl_h
  12. #pragma pack (push, 8)
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #include "AcArray.h"
  17. ///////////////////////////////////////////////////////////////////////////////
  18. /// CAdUiGroupCtrl class is ownerdrawin group control class that has a header
  19. /// on the top with a title, bitmap buttons and chevron button. Chevron button
  20. /// when clicked, minimizes or maximizes the control. This control can host a
  21. /// CWnd control in the client region. Bitmap button can be used to display
  22. /// different views in the CWnd in the client region or display a different
  23. /// window
  24. ///
  25. /// Callback function that will be called when bitmap button
  26. /// on the header control is clicked.
  27. ///
  28. typedef void (*AdUiBmpBtnFcnPtr)(CWnd*);
  29. // Struct that maintains data related to each window that is
  30. // added to the group control
  31. typedef struct AdUiGroupCtrlData
  32. {
  33. AdUiGroupCtrlData() : nWndIndex(0), title(/*MSG0*/""), pWnd(NULL), dwBtnCookie(-1) {};
  34. int nWndIndex;
  35. CString title;
  36. CWnd* pWnd;
  37. DWORD dwBtnCookie;
  38. } groupData;
  39. typedef AcArray<groupData> ADUIGROUPCTRLDATALIST;
  40. // Struct that bundles all the required information to draw
  41. // a bitmap button and also call its callback funtion when
  42. // the button is clicked
  43. typedef struct AdUiBmpBtnData
  44. {
  45. AdUiBmpBtnData() : pBmp(NULL), pImage(NULL), fcnPtr(NULL),
  46. tooltip(/*MSG0*/""), dwCookie(0) {};
  47. CString strResId;
  48. CBitmap* pBmp;
  49. void* pImage;
  50. AdUiBmpBtnFcnPtr fcnPtr;
  51. CString tooltip;
  52. DWORD dwCookie;
  53. } bmpBtnData;
  54. typedef AcArray<bmpBtnData> ADUIHEADERBTNLIST;
  55. // additional NC hittest codes
  56. #define ADUI_NCHT_BASE (HTHELP + 200)
  57. #define ADUI_NCHT_TITLE ADUI_NCHT_BASE
  58. #define ADUI_NCHT_CHEVRON (ADUI_NCHT_BASE + 1)
  59. #define ADUI_NCHT_BUTTON (ADUI_NCHT_BASE + 2)
  60. // position/size for controls in NC bar
  61. #define ADUI_GROUP_BORDER_SIZE 1
  62. #define ADUI_GROUP_TITLE_HEIGHT 22
  63. #define ADUI_GROUP_TITLE_BEVELSIZE 5
  64. #define ADUI_GROUP_TITLE_TEXTLEFT 8
  65. #define ADUI_GROUP_TITLE_TEXTTOP 1
  66. #define ADUI_GROUP_TITLE_TEXTBOTTOM 5
  67. #define ADUI_GROUP_BUTTON_SIZE 14
  68. #define ADUI_GROUP_BUTTONS_RIGHT 25 //was 18
  69. #define ADUI_GROUP_CHEVRON_TOPPADDING 5
  70. #define ADUI_GROUP_CHEVRON_BOTTOMPADDING 4
  71. #define ADUI_GROUP_BUTTON_TOPPADDING 2
  72. #define ADUI_GROUP_BUTTON_BOTTOMPADDING 2
  73. #define ADUI_GROUP_BUTTON_SPACE 3
  74. #define ADUI_GROUP_CHEVRON_RIGHT 4
  75. #define ADUI_GROUP_EXPANDER_RIGHT_OFFSET 7
  76. #define ADUI_GROUP_CHILD_VERT_SPACE 8
  77. #define ADUI_GROUP_BUTTON_DISABLE_FLAG 0x80000000 //Last bit from left
  78. #define ADUI_GROUP_BUTTON_SELECTED_FLAG 0x40000000 //Last second bit from left, flag whether current button is selected.
  79. #define ADUI_GROUP_BUTTON_ID_MASK 0x0000FFFF //Button Id mask. Note that the lower
  80. //2 bytes are used to ID value, the higher 2 bytes
  81. //are used to flags and could coutinue to extend.(2 bit used currently)
  82. // Group styles
  83. #define ADUI_GROUP_STYLE_CHEVRON 0x00000001
  84. #define ADUI_GROUP_STYLE_SHOWBTNFORCE 0x00000002
  85. #define ADUI_GROUP_STYLE_NONACTIVE 0x00000004
  86. #define ADUI_GROUP_STYLE_NOBORDER 0x00000008
  87. #define ADUI_GROUP_STYLE_TRANSBTN 0x00000010
  88. #define ADUI_GROUP_STYLE_BTNBORDER 0x00000020
  89. #define ADUI_GROUP_STYLE_ACTIVEHEADER 0x00000040
  90. #define ADUI_GROUP_STYLE_OPAQUEIMAGE 0x00000080
  91. // wParam is the CWnd* to be shown/hide, lParam is SW_SHOW or SW_HIDE.
  92. const DWORD WM_ADUI_VISIBILITY_CHANGING = WM_USER + 1936;
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CAdUiGroupCtrl window
  95. #pragma warning(push)
  96. #pragma warning(disable : 4275)
  97. /// <summary>
  98. /// CAdUiGroupCtrl class is ownerdrawin group control class that has a header
  99. /// on the top with a title, bitmap buttons and chevron button. Chevron button
  100. /// when clicked, minimizes or maximizes the control. This control can host a
  101. /// CWnd control in the client region. Bitmap button can be used to display
  102. /// different views in the CWnd in the client region or display a different
  103. /// window.
  104. /// </summary>
  105. ///
  106. class ADUI_PORT CAdUiGroupCtrl : public CStatic {
  107. DECLARE_DYNAMIC(CAdUiGroupCtrl);
  108. public:
  109. /// <summary>
  110. /// Default constructor.
  111. /// </summary>
  112. CAdUiGroupCtrl( );
  113. /// <summary>
  114. /// Destructor.
  115. /// </summary>
  116. virtual ~CAdUiGroupCtrl();
  117. // Method to add your window to the group control
  118. /// <summary>
  119. /// Method to add window and its title to the group control. This method
  120. /// can be called n number of times to add n windows.
  121. /// </summary>
  122. ///
  123. /// <param name="pWnd">
  124. /// Input pointer to a CWnd.
  125. /// </param>
  126. /// <param name="pszTitle">
  127. /// Title for the window.
  128. /// </param>
  129. /// <param name="pBMP">
  130. /// Input pointer to a CBitmap.
  131. /// </param>
  132. /// <returns>
  133. /// Returns true when the window is added to the group control.
  134. /// </returns>
  135. /// <remarks>
  136. /// This method can be called n number of time to add n windows.
  137. /// There is a list of AdUiGroupCtrlData that is created with the CWnd,
  138. /// title and index (based on the order in which windows are added).
  139. /// The use of adding multiple windows is to display different windows
  140. /// when the bitmap buttons are selected on the group control header.
  141. /// </remarks>
  142. ///
  143. virtual bool AddWnd(CWnd* pWnd, LPCTSTR pszTitle, CBitmap* pBMP = NULL);
  144. // Method to add your window to the group control
  145. /// <summary>
  146. /// Method to add window and its title to the group control. This method
  147. /// can be called n number of times to add n windows.
  148. /// </summary>
  149. ///
  150. /// <param name="pWnd">
  151. /// Input pointer to a CWnd.
  152. /// </param>
  153. /// <param name="pszTitle">
  154. /// Title for the window.
  155. /// </param>
  156. /// <param name="pszToolTip">
  157. /// Input string containing the tooltip for the bitmap button.
  158. /// </param>
  159. /// <param name="pBMP">
  160. /// Input pointer to a CBitmap.
  161. /// </param>
  162. /// <returns>
  163. /// Returns true when the window is added to the group control.
  164. /// </returns>
  165. /// <remarks>
  166. /// This method can be called n number of time to add n windows.
  167. /// There is a list of AdUiGroupCtrlData that is created with the CWnd,
  168. /// title and index (based on the order in which windows are added).
  169. /// The use of adding multiple windows is to display different windows
  170. /// when the bitmap buttons are selected on the group control header.
  171. /// </remarks>
  172. ///
  173. virtual bool AddWnd(CWnd* pWnd, LPCTSTR pszTitle, LPCTSTR pszToolTip, CBitmap* pBMP);
  174. // Method to add your window to the group control
  175. /// <summary>
  176. /// Method to add window and its title to the group control. This method
  177. /// can be called n number of times to add n windows.
  178. /// </summary>
  179. ///
  180. /// <param name="pWnd">
  181. /// Input pointer to a CWnd.
  182. /// </param>
  183. /// <param name="pszTitle">
  184. /// Title for the window.
  185. /// </param>
  186. /// <param name="pszResName">
  187. /// Input string specifying the name of the resource for the bitmap.
  188. /// </param>
  189. /// <returns>
  190. /// Returns true when the window is added to the group control.
  191. /// </returns>
  192. /// <remarks>
  193. /// This method can be called n number of time to add n windows.
  194. /// There is a list of AdUiGroupCtrlData that is created with the CWnd,
  195. /// title and index (based on the order in which windows are added).
  196. /// The use of adding multiple windows is to display different windows
  197. /// when the bitmap buttons are selected on the group control header.
  198. /// </remarks>
  199. ///
  200. virtual bool AddWnd(CWnd* pWnd, LPCTSTR pszTitle, LPCTSTR pszResName);
  201. // Method to add your window to the group control
  202. /// <summary>
  203. /// Method to add window and its title to the group control. This method
  204. /// can be called n number of times to add n windows.
  205. /// </summary>
  206. ///
  207. /// <param name="pWnd">
  208. /// Input pointer to a CWnd.
  209. /// </param>
  210. /// <param name="pszTitle">
  211. /// Title for the window.
  212. /// </param>
  213. /// <param name="pszToolTip">
  214. /// Input string containing the tooltip for the bitmap button.
  215. /// </param>
  216. /// <param name="pszResName">
  217. /// Input string specifying the name of the resource for the bitmap.
  218. /// </param>
  219. /// <returns>
  220. /// Returns true when the window is added to the group control.
  221. /// </returns>
  222. /// <remarks>
  223. /// This method can be called n number of time to add n windows.
  224. /// There is a list of AdUiGroupCtrlData that is created with the CWnd,
  225. /// title and index (based on the order in which windows are added).
  226. /// The use of adding multiple windows is to display different windows
  227. /// when the bitmap buttons are selected on the group control header.
  228. /// </remarks>
  229. ///
  230. virtual bool AddWnd(CWnd* pWnd, LPCTSTR pszTitle, LPCTSTR pszToolTip, LPCTSTR pszResName);
  231. /// <summary>
  232. /// Displays the window represented by the input CWnd pointer in the
  233. /// group controls client area.
  234. /// </summary>
  235. ///
  236. /// <param name="pWnd">
  237. /// Input pointer to the CWnd which will be hosted in the client area
  238. /// of the group control.
  239. /// </param>
  240. /// <returns>
  241. /// Returns true if successful, otherwise returns false.
  242. /// </returns>
  243. ///
  244. virtual bool ShowWnd(CWnd* pWnd);
  245. // Methods to add bitmap buttons to header
  246. /// <summary>
  247. /// Method to add bitmap buttons to group control header by specifying
  248. /// the bitmap name, callback function pointer and the tooltip. This
  249. /// function returns a cookie back to the caller, which can be used to
  250. /// delete a bitmap button.
  251. /// </summary>
  252. ///
  253. /// <param name="pszResName">
  254. /// Input string specifying the name of the resource for the bitmap.
  255. /// </param>
  256. /// <param name="fcnPtr">
  257. /// Callback function that will be called when this bitmap button is clicked.
  258. /// Callback function is defined as a typedef as follows:
  259. /// typedef void (*AdUiBmpBtnFcnPtr)()
  260. /// void AdUiBmpBtnFcnPtr() Method
  261. /// A function pointer that a client needs to implement for each of the header
  262. /// buttons, which is called when it's corresponding header button is clicked
  263. /// </param>
  264. /// <param name="dwCookie">
  265. /// Output DWORD value identifying the bitmap that was added.
  266. /// </param>
  267. /// <param name="pszToolTip">
  268. /// Input string containing the tooltip for the bitmap button.
  269. /// </param>
  270. /// <returns>
  271. /// Returns true if successful, otherwise returns false.
  272. /// </returns>
  273. /// <remarks>
  274. /// Callback function is defined as a typedef as follows:
  275. /// typedef void (*AdUiBmpBtnFcnPtr)()
  276. /// void AdUiBmpBtnFcnPtr() Method
  277. /// A function pointer that a client needs to implement for each of the header
  278. /// buttons, which is called when it's corresponding header button is clicked
  279. /// </remarks>
  280. ///
  281. virtual bool AddBmpBtnToHeader(LPCTSTR pszResName,
  282. AdUiBmpBtnFcnPtr fcnPtr,
  283. DWORD& dwCookie,
  284. LPCTSTR pszToolTip);
  285. // Methods to add bitmap buttons to header
  286. /// <summary>
  287. /// Method to add bitmap buttons to group control header by specifying
  288. /// a pointer to the CBitmap, callback function pointer and the tooltip.
  289. /// This function returns a cookie back to the caller, which can be used
  290. /// to delete a bitmap button.
  291. /// </summary>
  292. ///
  293. /// <param name="pBmp">
  294. /// Input pointer to a CBitmap that will be used for the bitmap button.
  295. /// </param>
  296. /// <param name="fcnPtr">
  297. /// Callback function that will be called when this bitmap button is clicked.
  298. /// Callback function is defined as a typedef as follows:
  299. /// typedef void (*AdUiBmpBtnFcnPtr)()
  300. /// void AdUiBmpBtnFcnPtr() Method
  301. /// A function pointer that a client needs to implement for each of the header
  302. /// buttons, which is called when it's corresponding header button is clicked
  303. /// </param>
  304. /// <param name="dwCookie">
  305. /// Output DWORD value identifying the bitmap that was added.
  306. /// </param>
  307. /// <param name="pszToolTip">
  308. /// Input string containing the tooltip for the bitmap button.
  309. /// </param>
  310. /// <returns>
  311. /// Returns true if successful, otherwise returns false.
  312. /// </returns>
  313. /// <remarks>
  314. /// Callback function is defined as a typedef as follows:
  315. /// typedef void (*AdUiBmpBtnFcnPtr)()
  316. /// void AdUiBmpBtnFcnPtr() Method
  317. /// A function pointer that a client needs to implement for each of the header
  318. /// buttons, which is called when it's corresponding header button is clicked
  319. /// </remarks>
  320. ///
  321. virtual bool AddBmpBtnToHeader(CBitmap* pBmp,
  322. AdUiBmpBtnFcnPtr fcnPtr,
  323. DWORD& dwCookie,
  324. LPCTSTR pszToolTip);
  325. // Method to remove a btn from the header of the group control
  326. /// <summary>
  327. /// Method to remove a btn from the header of the group control.
  328. /// </summary>
  329. ///
  330. /// <param name="dwCookie">
  331. /// Input to a cookie identifying the bitmap button that need to be removed
  332. /// from the group control's header.
  333. /// </param>
  334. /// <returns>
  335. /// Returns true if the button is deleted, otherwise returns false.
  336. /// </returns>
  337. ///
  338. virtual bool RemoveBmpBtnFromHeader(DWORD dwCookie);
  339. /// <summary>
  340. /// Function to add or remove styles on the group control.
  341. /// </summary>
  342. ///
  343. /// <param name="styleRemove">
  344. /// Input parameter that defines the window styles that needs be removed.
  345. /// </param>
  346. /// <param name="styleAdd">
  347. /// Input parameter that defines the window styles that need to be added.
  348. /// </param>
  349. ///
  350. virtual void ModGroupStyle(DWORD styleRemove, DWORD styleAdd);
  351. /// <summary>
  352. /// Gets the theme used by the group control
  353. /// </summary>
  354. ///
  355. /// <returns>
  356. /// Pointer to the theme used by the group control
  357. /// </returns>
  358. ///
  359. CAdUiTheme* GetTheme() const;
  360. /// <summary>
  361. /// Sets the theme for the group control based on the theme that is
  362. /// passed in.
  363. /// </summary>
  364. ///
  365. /// <param name="pTheme">
  366. /// Input parameter to a CAdUiTheme pointer, whose theme colors will be
  367. /// used to draw the group control.
  368. /// </param>
  369. ///
  370. virtual void SetTheme(CAdUiTheme* pTheme);
  371. /// <summary>
  372. /// Calls the over-loaded method SetFont with argument redraw set to TRUE.
  373. /// </summary>
  374. ///
  375. /// <param name="pFont">
  376. /// Input pointer to the CFont object.
  377. /// </param>
  378. ///
  379. virtual void SetFont(CFont* pFont);
  380. /// <summary>
  381. /// Set the font style to BOLD and calls the CWnd base class SetFont
  382. /// function. Also calls SetFont on all the child windows that are
  383. /// added to the group control.
  384. /// </summary>
  385. ///
  386. /// <param name="pFont">
  387. /// Input pointer to the CFont object.
  388. /// </param>
  389. /// <param name="bRedraw">
  390. /// Input boolean specifying whether to redraw the control or not.
  391. /// </param>
  392. ///
  393. virtual void SetFont(CFont* pFont, BOOL bRedraw);
  394. /// <summary>
  395. /// Sets the minimized or maximized state on the group control.
  396. /// </summary>
  397. ///
  398. /// <param name="bMinimized">
  399. /// Input parameter to set the minimized or maximized state on the
  400. /// group control.
  401. /// </param>
  402. ///
  403. virtual void SetMinimized(bool bMinimized);
  404. /// <summary>
  405. /// Returns the current group control's minimized or maximized state.
  406. /// </summary>
  407. ///
  408. /// <returns>
  409. /// Returns true if minimized and false if the window is maxmized.
  410. /// </returns>
  411. ///
  412. bool GetMinimized() const;
  413. /// <summary>
  414. /// Sets the title for the group control.
  415. /// </summary>
  416. ///
  417. /// <param name="pszTitle">
  418. /// Input pointer to a const string pointer that will be used as the
  419. /// title for the group control.
  420. /// </param>
  421. ///
  422. void SetTitle(LPCTSTR pszTitle) { m_csTitle = pszTitle; }
  423. /// <summary>
  424. /// Gets the title for the group control.
  425. /// </summary>
  426. ///
  427. CString GetTitle() { return m_csTitle; }
  428. // properties
  429. /// <summary>
  430. /// Sets the height for the group control header.
  431. /// </summary>
  432. ///
  433. /// <param name="nHeight">
  434. /// Input parameter to the group control header height .
  435. /// </param>
  436. /// <remarks>
  437. /// The default value for the height is set to 18 pixels.
  438. /// </remarks>
  439. ///
  440. void SetHeaderHeight(int nHeight) { m_nHeaderHeight = nHeight; }
  441. /// <summary>
  442. /// Returns the group control header height.
  443. /// </summary>
  444. ///
  445. /// <returns>
  446. /// Returns integer value of the group control header height.
  447. /// </returns>
  448. ///
  449. int GetHeaderHeight() { return m_nHeaderHeight; }
  450. /// <summary>
  451. /// Sets the window style for the group control.
  452. /// </summary>
  453. ///
  454. /// <param name="nStyle">
  455. /// Input parameter to set the style .
  456. /// </param>
  457. ///
  458. void SetStyle(DWORD nStyle) { m_nStyle = nStyle; }
  459. /// <summary>
  460. /// Returns the current window style set on the group control.
  461. /// </summary>
  462. ///
  463. /// <returns>
  464. /// Returns a DWORD with the group control current set window style.
  465. /// </returns>
  466. ///
  467. DWORD GetStyle() { return m_nStyle; }
  468. /// <summary>
  469. /// Sets the current window selection to be displayed in the group control.
  470. /// </summary>
  471. ///
  472. /// <param name="nSelIndex">
  473. /// Input parameter for the current window's index.
  474. /// </param>
  475. /// <remarks>
  476. /// When adding multiple windows to the group control, clients can control
  477. /// the current displayed window by setting a different index.
  478. /// </remarks>
  479. ///
  480. void SetSelIndex(int nSelIndex);
  481. /// <summary>
  482. /// Returns the index of the current window that is being displayed in
  483. /// the group control.
  484. /// </summary>
  485. ///
  486. /// <returns>
  487. /// Returns the index of the current window that is being displayed in
  488. /// the group control.
  489. /// </returns>
  490. ///
  491. int GetSelIndex();
  492. /// <summary>
  493. /// Controls the display of the group controls header.
  494. /// </summary>
  495. ///
  496. /// <param name="bHide">
  497. /// Input parameter to hide or show the group controls header.
  498. /// </param>
  499. ///
  500. void SetHideGroupHeader(bool bHide) {
  501. m_bHideGroupHeader = bHide;
  502. }
  503. /// <summary>
  504. /// Returns true or false based on the group control's header is
  505. /// hidden or shown.
  506. /// </summary>
  507. ///
  508. /// <returns>
  509. /// Returns true if header is hidden and false if it is shown.
  510. /// </returns>
  511. ///
  512. bool GetHideGroupHeader() {
  513. return m_bHideGroupHeader;
  514. }
  515. /// <summary>
  516. /// Controls the activated-looking of this group's title bar. If
  517. /// the group has ADUI_GROUP_STYLE_NONACTIVE style, there will be
  518. // visual effect by calling this.
  519. /// </summary>
  520. ///
  521. /// <param name="bActive">
  522. /// Input parameter to make the group look active.
  523. /// </param>
  524. ///
  525. void SetActive(bool bActive);
  526. /// <summary>
  527. /// Returns true or false based on the group control's active
  528. /// status.
  529. /// </summary>
  530. ///
  531. /// <returns>
  532. /// Returns true if the group is active (the input focus is on this control
  533. /// or is on one of the child controls.
  534. /// </returns>
  535. ///
  536. bool GetActive() { return m_bActive; }
  537. /// <summary>
  538. /// Sets whether the group control uses the dialog theme (also known as
  539. /// the light theme) or the current palette theme.
  540. /// </summary>
  541. ///
  542. /// <param name="bUseDialogTheme">
  543. /// Input parameter to set the applied theme of the group control.
  544. /// </param>
  545. ///
  546. void SetUseDialogTheme(bool bUseDialogTheme);
  547. /// <summary>
  548. /// Returns whether the current group control uses the dialog theme (also
  549. /// known as the light theme) or the current palette theme.
  550. /// </summary>
  551. ///
  552. /// <returns>
  553. /// Returns true if the group control is drawn in the dialog theme
  554. /// and false if the group control is drawn in the current palette theme.
  555. /// The default value is false, so the group control will use the
  556. /// current palette theme.
  557. /// </returns>
  558. ///
  559. bool UseDialogTheme() const;
  560. protected:
  561. // Draws the group control border
  562. virtual void DrawGroupContent(CDC* pDC);
  563. // Draws the header (title, chevrons and bitmap buttons)
  564. virtual void DrawGroupHeader(CDC* pDC);
  565. virtual void DeselectGroupHeader() {
  566. CDC* pDC = GetWindowDC();
  567. DrawGroupHeader(pDC);
  568. ReleaseDC(pDC);
  569. }
  570. void OnChevronClicked(); // handle collapse/expand
  571. //non-virtual method added in Raptor to follow the UI-spec
  572. void DrawHeaderBorder(CDC *pDC, CRect &rect);
  573. virtual BOOL PreTranslateMessage(MSG* pMsg);
  574. static CAdToolTipCtrl* GetToolTipControl();
  575. protected:
  576. //{{AFX_MSG(CAdUiGroupCtrl)
  577. afx_msg void OnNcPaint();
  578. afx_msg void OnPaint();
  579. afx_msg void OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS * );
  580. afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
  581. afx_msg void OnSize( UINT nType, int cx, int cy );
  582. afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint );
  583. afx_msg void OnNcLButtonDblClk( UINT nHitTest, CPoint );
  584. #if _MSC_VER<1400
  585. afx_msg UINT OnNcHitTest(CPoint point);
  586. #else
  587. afx_msg LRESULT OnNcHitTest(CPoint point);
  588. #endif
  589. afx_msg void OnSetFocus( CWnd * pOldWnd );
  590. afx_msg void OnKillFocus( CWnd * pNewWnd );
  591. afx_msg BOOL OnEraseBkgnd(CDC*) { return TRUE;};
  592. afx_msg HBRUSH OnCtlColor(CDC*, CWnd*, UINT);
  593. //}}AFX_MSG
  594. DECLARE_MESSAGE_MAP()
  595. protected:
  596. // The cached colors used for owner draw are removed from this class.
  597. // Use the theme instead to get desired colors.
  598. CAdUiTheme* m_pTheme;
  599. // ClassWizard generated virtual function overrides
  600. //{{AFX_VIRTUAL(CAdUiGroupCtrl)
  601. //}}AFX_VIRTUAL
  602. protected:
  603. CString m_csTitle;
  604. bool m_bMinimized;
  605. bool m_bUseDialogTheme;
  606. bool m_bActive;
  607. bool m_bHideGroupHeader;
  608. int m_nHeaderHeight;
  609. int m_nRestoreHeight;
  610. int m_nSelIndex;
  611. DWORD m_nStyle;
  612. DWORD m_dwBtnId;
  613. ADUIHEADERBTNLIST m_bmpBtnList;
  614. ADUIGROUPCTRLDATALIST m_groupList;
  615. static LOGFONT& font();
  616. private:
  617. // Used to make the header font size same as that of Property Inspector
  618. static LOGFONT m_lf;
  619. bool loadResource(LPCTSTR strResId, CBitmap *& bBitmap, void* & pImage);
  620. void* loadRCDATAResource(LPCTSTR strResId, HINSTANCE hInst, const CAdUiTheme* pTheme);
  621. void* loadIconResource(LPCTSTR strResId, HINSTANCE hInst, const CAdUiTheme* pTheme);
  622. virtual bool addWnd(CWnd* pWnd, LPCTSTR pszTitle, LPCTSTR pszToolTip, LPCTSTR pszResId, CBitmap* pBMP, void* pImage);
  623. bool addBmpBtnToHeader(LPCTSTR strResId, CBitmap* pBmp, void* pImage, AdUiBmpBtnFcnPtr fcnPtr,
  624. DWORD& dwCookie, LPCTSTR pszToolTip);
  625. void clearImages(AdUiBmpBtnData & btnData);
  626. };
  627. inline bool CAdUiGroupCtrl::GetMinimized() const
  628. {
  629. return m_bMinimized;
  630. }
  631. inline void CAdUiGroupCtrl::SetMinimized( bool bMinimized )
  632. {
  633. m_bMinimized = bMinimized;
  634. }
  635. inline bool CAdUiGroupCtrl::UseDialogTheme() const
  636. {
  637. return m_bUseDialogTheme;
  638. }
  639. inline CAdUiTheme* CAdUiGroupCtrl::GetTheme() const
  640. {
  641. return m_pTheme;
  642. }
  643. #pragma warning(pop)
  644. /////////////////////////////////////////////////////////////////////////////
  645. //{{AFX_INSERT_LOCATION}}
  646. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  647. #pragma pack (pop)
  648. #endif
  649. //////////////////////////////////////////////////////////////////////////////