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

对话框与窗口

开发平台:

Visual C++

  1. // XTPPropertyGrid.h interface for the CXTPPropertyGrid class.
  2. //
  3. // This file is a part of the XTREME PROPERTYGRID MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. //{{AFX_CODEJOCK_PRIVATE
  21. #if !defined(__XTPPROPERTYGRID_H__)
  22. #define __XTPPROPERTYGRID_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif // _MSC_VER > 1000
  27. #include "XTPPropertyGridPaintManager.h"
  28. class CXTPToolTipContext;
  29. class CXTPImageManager;
  30. class CXTPMarkupContext;
  31. //-----------------------------------------------------------------------
  32. // Summary:
  33. //     XTPPropertyGridSortOrder is an enumeration used by CXTPPropertyGrid to
  34. //     determine the grouping style.  This will specify how the items
  35. //     in the grid are displayed, I.e. Alphabetical, not sort, and
  36. //     grouped by category.
  37. // See Also: CXTPPropertyGrid::SetPropertySort, CXTPPropertyGrid::GetPropertySort
  38. // Example:
  39. //     <code>XTPPropertyGridSortOrder sort = m_wndPropertyGrid.GetPropertySort();</code>
  40. //
  41. // <KEYWORDS xtpGridSortCategorized, xtpGridSortAlphabetical, xtpGridSortNoSort>
  42. //-----------------------------------------------------------------------
  43. enum XTPPropertyGridSortOrder
  44. {
  45. xtpGridSortCategorized,     // Group items by category.
  46. xtpGridSortAlphabetical,    // Sort items alphabetically.
  47. xtpGridSortNoSort           // Disable sorting and grouping, all items are displayed in
  48.                             // the order that they are added to the grid.
  49. };
  50. #include "XTPPropertyGridView.h"
  51. class CXTPPropertyGridView;
  52. class CXTPPropertyGridPaintManager;
  53. class CXTPPropertyGrid;
  54. //===========================================================================
  55. // Summary:
  56. //     CXTPPropertyGridUpdateContext is a CCmdTarget derived class used
  57. //     to save the state of the property grid such as the currently
  58. //     selected item, XTPPropertyGridSortOrder preference, and the expanding state
  59. //     of each item in the grid.  The property grid state information is
  60. //     stored in the CXTPPropertyGridUpdateContext object when
  61. //     CXTPPropertyGrid::BeginUpdate is called and after CXTPPropertyGrid::EndUpdate
  62. //     the expanding state of each item, selected item, and sort preference
  63. //     will be restored.
  64. // Remarks:
  65. //     Each time you add a new item or category to the grid, The state
  66. //     of the grid is updated the grid is redrawn.
  67. //
  68. //     If you want to delete all items in the grid and then add allot of
  69. //     new items it will be quite slow. To do this, you would call
  70. //     BeginUpdate, then delete all the items.  The property grid will be
  71. //     locked until you call EndUpdate.
  72. //
  73. //     It might be useful to call BeginWaitCursor to indicate that the
  74. //     grid is "busy" updating.
  75. // See Also: CXTPPropertyGrid::BeginUpdate, CXTPPropertyGrid::EndUpdate
  76. //===========================================================================
  77. class _XTP_EXT_CLASS CXTPPropertyGridUpdateContext : public CXTPCmdTarget
  78. {
  79. public:
  80. //-----------------------------------------------------------------------
  81. // Summary:
  82. //     Constructs a CXTPPropertyGridUpdateContext object.
  83. //-----------------------------------------------------------------------
  84. CXTPPropertyGridUpdateContext();
  85. public:
  86. //-----------------------------------------------------------------------
  87. // Summary:
  88. //     Call this member to determine if any items in the grid were
  89. //     expanded before CXTPPropertyGrid::BeginUpdate was called.
  90. //     Only items with children can be expanded.
  91. // Returns:
  92. //     TRUE if no items were expanded before BeginUpdate, FALSE if
  93. //     at least one item was expanded.
  94. //-----------------------------------------------------------------------
  95. BOOL IsEmpty() const;
  96. protected:
  97. CMap<UINT, UINT, BOOL, BOOL&> m_mapState;   // Stores the expanded state of each item in the grid before CXTPPropertyGrid::BeginUpdate.
  98. UINT m_nSelected;                           // Stores the Id of the currently selected item before CXTPPropertyGrid::BeginUpdate.
  99. UINT m_nTopIndex;                           // Stores the Index of the top-most visible item in the property grid.
  100. XTPPropertyGridSortOrder m_propertySort;    // Stores the currently used sort method of the grid before CXTPPropertyGrid::BeginUpdate.
  101. friend class CXTPPropertyGrid;
  102. };
  103. //===========================================================================
  104. // Summary:
  105. //     CXTPPropertyGridToolBar is a CToolBar derived class.
  106. //     It is an internal class used by Property Grid control
  107. //===========================================================================
  108. class _XTP_EXT_CLASS CXTPPropertyGridToolBar : public CToolBar
  109. {
  110. public:
  111. //-----------------------------------------------------------------------
  112. // Summary:
  113. //     Constructs a CXTPPropertyGridToolBar object
  114. //-----------------------------------------------------------------------
  115. CXTPPropertyGridToolBar();
  116. //-------------------------------------------------------------------------
  117. // Summary:
  118. //     Destroys a CXTPPropertyGridToolBar object, handles cleanup and deallocation.
  119. //-------------------------------------------------------------------------
  120. ~CXTPPropertyGridToolBar();
  121. protected:
  122. //{{AFX_CODEJOCK_PRIVATE
  123. DECLARE_MESSAGE_MAP()
  124. //{{AFX_VIRTUAL(CXTPPropertyGridToolBar)
  125. virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  126. virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  127. //}}AFX_VIRTUAL
  128. //{{AFX_MSG(CXTPPropertyGridToolBar)
  129. afx_msg BOOL OnEraseBkgnd(CDC*);
  130. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  131. afx_msg void OnPaint();
  132. afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
  133. //}}AFX_MSG
  134. //}}AFX_CODEJOCK_PRIVATE
  135. };
  136. class CXTPPropertyGridVerbs;
  137. //===========================================================================
  138. // Summary:
  139. //     CXTPPropertyGridVerb is used to create a verb link similar to what is seen
  140. //     in Visual Studio .NET.  For example, when the DataGrid control is selected at
  141. //     design time in VS .NET, an AutoFormat link button appears in the Properties window
  142. //     just below the property grid and above the help panel.
  143. //     Verbs will be displayed in a separate panel just below the property grid.  Verbs
  144. //     are links that can be used to perform actions in your application.  When a verb is
  145. //     clicked, CXTPPropertyGrid::OnVerbClick is called by the framework.
  146. //     If both the verb panel and help panel are visible at the same time, the verb panel
  147. //     is displayed above the help panel.
  148. // See Also: CXTPPropertyGrid::GetVerbs, CXTPPropertyGridVerbs
  149. //===========================================================================
  150. class _XTP_EXT_CLASS CXTPPropertyGridVerb : public CXTPCmdTarget
  151. {
  152. public:
  153. //-----------------------------------------------------------------------
  154. // Summary:
  155. //     Constructs a CXTPPropertyGridVerb object.
  156. //-----------------------------------------------------------------------
  157. CXTPPropertyGridVerb();
  158. public:
  159. //-----------------------------------------------------------------------
  160. // Summary:
  161. //     Call this member to retrieve the text caption of this verb link.
  162. // Returns:
  163. //     Text caption of this verb link.
  164. //-----------------------------------------------------------------------
  165. CString GetCaption() const;
  166. //-----------------------------------------------------------------------
  167. // Summary:
  168. //     Call this member to retrieve the Id assigned to this verb link.
  169. // Returns:
  170. //     The Id of this verb link.
  171. //-----------------------------------------------------------------------
  172. int GetID() const;
  173. //-----------------------------------------------------------------------
  174. // Summary:
  175. //     Call this member to retrieve the Index of this verb link within the
  176. //     collection of verbs.
  177. // Returns:
  178. //     Index of this verb within the collection of verb links.
  179. //-----------------------------------------------------------------------
  180. int GetIndex() const;
  181. //-----------------------------------------------------------------------
  182. // Summary:
  183. //     Call this member to determine if this verb link is currently focused.
  184. //     If focused, a focus rectangle is placed around the text caption of the verb.
  185. // Returns:
  186. //     TRUE if this verb is currently focused, FALSE if this verb is not focused.
  187. //-----------------------------------------------------------------------
  188. BOOL IsFocused() const;
  189. //-----------------------------------------------------------------------
  190. // Summary:
  191. //     Used internally by PaintManager and PropertyGrid to set the
  192. //     bounding rectangle for verbs.  You do not need to call
  193. //     this member.
  194. // Parameters:
  195. //     rc - Bounding rectangle containing the verb text.
  196. //-----------------------------------------------------------------------
  197. void SetPart(CRect rc);
  198. //-----------------------------------------------------------------------
  199. // Summary:
  200. //     Used internally by PaintManager and PropertyGrid to get the
  201. //     bounding rectangle for verbs.  You do not need to call
  202. //     this member.
  203. // Returns:
  204. //     Bounding rectangle of verb.
  205. //-----------------------------------------------------------------------
  206. CRect GetPart() const;
  207. //-----------------------------------------------------------------------
  208. // Summary:
  209. //     Call this member to retrieve the last position that the user
  210. //     clicked.
  211. // Returns:
  212. //     Retrieves the last position the user clicked. If it was "clicked"
  213. //     by pressing the Enter key while a verb has focus, then the
  214. //     BottomLeft position of the "clicked" Verb is returned.
  215. //-----------------------------------------------------------------------
  216. CPoint GetClickPoint() const;
  217. protected:
  218. CString m_strCaption;               // Text caption of this verb link.
  219. int m_nID;                          // Id assigned this verb link.
  220. int m_nIndex;                       // Index of this verb link in the collection of verbs.
  221. CRect m_rcPart;                     // Bounding rectangle of verb.
  222. CPoint m_ptClick;                   // The last position the user clicked.
  223. CXTPPropertyGridVerbs* m_pVerbs;    // Collection of verb links.
  224. friend class CXTPPropertyGridVerbs;
  225. friend class CXTPPropertyGrid;
  226. };
  227. //===========================================================================
  228. // Summary:
  229. //     A collection of CXTPPropertyGridVerb objects that are displayed in the
  230. //     verb panel.  See CXTPPropertyGridVerb for a description of verbs.
  231. // See Also: CXTPPropertyGridVerb
  232. //===========================================================================
  233. class _XTP_EXT_CLASS CXTPPropertyGridVerbs : public CXTPCmdTarget
  234. {
  235. public:
  236. //-------------------------------------------------------------------------
  237. // Summary:
  238. //     Constructs a CXTPPropertyGridVerbs object.
  239. //-------------------------------------------------------------------------
  240. CXTPPropertyGridVerbs();
  241. //-------------------------------------------------------------------------
  242. // Summary:
  243. //     Destroys a CXTPPropertyGridVerbs object, handles cleanup and deallocation.
  244. //-------------------------------------------------------------------------
  245. ~CXTPPropertyGridVerbs();
  246. public:
  247. //-----------------------------------------------------------------------
  248. // Summary:
  249. //     Call this member to determine if any verbs have been added to the
  250. //     collection of verbs.
  251. // Returns:
  252. //     TRUE if there are no verbs in the collection, FALSE if there is at
  253. //     least one verb in the collection.
  254. //-----------------------------------------------------------------------
  255. BOOL IsEmpty() const;
  256. //-----------------------------------------------------------------------
  257. // Summary:
  258. //     Call this member to remove all verbs from the collection of verbs.
  259. //-----------------------------------------------------------------------
  260. void RemoveAll();
  261. //-----------------------------------------------------------------------
  262. // Summary:
  263. //     Call this member to get a pointer to a specific verb in the collection
  264. //     of verbs.
  265. // Parameters:
  266. //     nIndex - Index of the verb withing the collection of verbs.
  267. // Returns:
  268. //     Verb at the specified location in the collection of verbs.
  269. //-----------------------------------------------------------------------
  270. CXTPPropertyGridVerb* GetAt(int nIndex) const;
  271. //-----------------------------------------------------------------------
  272. // Summary:
  273. //     Call this member to retrieve the total number of verb links in the
  274. //     collection of verbs.
  275. // Returns:
  276. //     Total number of verbs in the collection of verbs.
  277. //-----------------------------------------------------------------------
  278. int GetCount() const;
  279. //-----------------------------------------------------------------------
  280. // Summary:
  281. //     Call this member to add a verb link to the verb panel.
  282. // Parameters:
  283. //     lpszCaption - Text caption of the verb link.
  284. //     nID        - Id to assign to the new verb link.
  285. // Remarks:
  286. //     This will add a CXTPPropertyGridVerb object to the collection of
  287. //     verbs.  Verbs are displayed in the verb panel that is located just
  288. //     below the property grid and above the help panel.
  289. //-----------------------------------------------------------------------
  290. void Add(LPCTSTR lpszCaption, UINT nID);
  291. protected:
  292. CArray<CXTPPropertyGridVerb*, CXTPPropertyGridVerb*> m_arrVerbs;    // Collection of verb links.
  293. CXTPPropertyGrid* m_pGrid;                                          // Pointer to the property grid that the verbs are drawn on.
  294. friend class CXTPPropertyGrid;
  295. friend class CXTPPropertyGridVerb;
  296. };
  297. //-----------------------------------------------------------------------
  298. // Summary:
  299. //     XTPPropertyGridUI is an enumeration used by CXTPPropertyGrid
  300. //     during navigation of the Property Grid, items, and verbs
  301. //     that specifies which object should receive focus.
  302. // Remarks:
  303. //     After the Tab key or Shift+Tab key combinations are pressed,
  304. //     focus will be given to the object specified in the XTPPropertyGridUI
  305. //     enumeration.  I.e. If xtpGridUIViewNext is passed into
  306. //     OnNaviagte when an item in the grid has focus, then the next
  307. //     item will receive focus.
  308. // See Also: CXTPPropertyGrid::OnNavigate, CXTPPropertyGrid::NavigateItems
  309. //
  310. // <KEYWORDS xtpGridUIParentPrev, xtpGridUIViewPrev, xtpGridUIView, xtpGridUIInplaceEdit, xtpGridUIInplaceButton, xtpGridUIViewNext, xtpGridUIVerb, xtpGridUIParentNext>
  311. //-----------------------------------------------------------------------
  312. enum XTPPropertyGridUI
  313. {
  314. xtpGridUIParentPrev      = -2,  // Used to indicate that focus should be given to the previous object in the tab order.
  315. xtpGridUIViewPrev        = -1,  // If m_bTabItems is TRUE, Used to indicate that focus should be given to the previous item in the grid.
  316.                                 // This occurs when an item has focus and Shift+Tab is pressed.
  317. xtpGridUIView            =  0,  // Used to indicate that focus should be given to the Property Grid.
  318. xtpGridUIInplaceEdit     =  1,  // Used to indicate that the Tab key is pressed while in an in-place edit box has focus.
  319. xtpGridUIInplaceControl  =  2,  // Used to indicate that the Tab key is pressed while in an in-place edit box has focus.
  320. xtpGridUIInplaceButton   =  3,  // Used to indicate that the Tab key is pressed while an in-place button has focus.
  321. xtpGridUIViewNext        =  4,  // If m_bTabItems is TRUE, Used to indicate that focus should be given to the next item in the grid.
  322.                                 // This occurs when an item has focus and the Tab key is pressed.
  323. xtpGridUIVerb            =  5,  // Used to indicate that the Tab key is pressed while in Verb has focus.
  324. xtpGridUIParentNext      =  6   // Used to indicate that focus should be given to the next object in the tab order.
  325. };
  326. //-----------------------------------------------------------------------
  327. // Summary:
  328. //     XTPPropertyGridHitCode is an enumeration used by CXTPPropertyGrid
  329. //     to determine which part of the property grid is located at a
  330. //     specific point. CXTPPropertyGrid::HitTest is used to test
  331. //     a point when the user clicks on the property grid.
  332. // See Also:
  333. //     CXTPPropertyGrid::HitTest
  334. // Example:
  335. //     See CXTPPropertyGrid::HitTest.
  336. //
  337. // <KEYWORDS xtpGridHitError, xtpGridHitHelpSplitter, xtpGridHitVerbsSplitter, xtpGridHitFirstVerb>
  338. //-----------------------------------------------------------------------
  339. enum XTPPropertyGridHitCode
  340. {
  341. xtpGridHitError         = -1,   // Indicates that the help splitter, verb splitter
  342.                                 // and verbs were not clicked.
  343. xtpGridHitHelpSplitter  =  1,   // Indicates that the help splitter was clicked.
  344. xtpGridHitVerbsSplitter =  2,   // Indicates that the Verb splitter was clicked.
  345. xtpGridHitFirstVerb     =  3    // Determines if the item clicked upon is a verb.
  346. };
  347. //===========================================================================
  348. // Summary:
  349. //     CXTPPropertyGrid is a CWnd derived class. It is used to create a property grid
  350. //     control similar to the property window in VS.NET.
  351. //     See the "PropertyGrid" demo for an example of its usage.
  352. //===========================================================================
  353. class _XTP_EXT_CLASS CXTPPropertyGrid : public CWnd
  354. {
  355. DECLARE_DYNAMIC(CXTPPropertyGrid)
  356. public:
  357. //-----------------------------------------------------------------------
  358. // Summary:
  359. //     Constructs a CXTPPropertyGrid object
  360. //-----------------------------------------------------------------------
  361. CXTPPropertyGrid();
  362. //-----------------------------------------------------------------------
  363. // Summary:
  364. //     Destroys a CXTPPropertyGrid object, handles cleanup and deallocation
  365. //-----------------------------------------------------------------------
  366. virtual ~CXTPPropertyGrid();
  367. //-----------------------------------------------------------------------
  368. // Summary:
  369. //     Call this member function to create the Property Grid control.
  370. // Parameters:
  371. //     rect        - Size of the control.
  372. //     pParentWnd  - Parent of the control.
  373. //     nID         - Identifier of the Property Grid control.
  374. //     dwListStyle - List style of the items in the Property Grid.
  375. // Remarks:
  376. //     Available styles are listed below:
  377. //
  378. //         <p><b>LBS_OWNERDRAWFIXED</b> - The owner of the grid is
  379. //             responsible for drawing its contents; the items in the
  380. //             list box are the same height, should be used with
  381. //             LBS_NOINTEGRALHEIGHT.
  382. //         <p><b>LBS_OWNERDRAWVARIABLE</b> - The owner of the grid is
  383. //             responsible for drawing its contents; the items
  384. //             in the grid are variable in height, should be used with
  385. //             LBS_NOINTEGRALHEIGHT
  386. //         <p><b>XTP_PGS_OWNERDRAW</b> - Apply this style to the property
  387. //             grid to use the owner draw feature. Catch XTP_PGN_DRAWITEM
  388. //             to draw item. Recommended to use custom Paint Manager
  389. //             instead. (SetCustomTheme)
  390. // Returns:
  391. //     TRUE if successful, otherwise returns FALSE.
  392. // See Also: SetCustomTheme, SetTheme
  393. //-----------------------------------------------------------------------
  394. virtual BOOL Create(const RECT& rect, CWnd* pParentWnd, UINT nID, DWORD dwListStyle = 0);
  395. public:
  396. //-----------------------------------------------------------------------
  397. // Summary:
  398. //     Call this member function to add a new category to the Property Grid control.
  399. // Parameters:
  400. //     lpszCaption - Name of the category to add.
  401. // Parameters:
  402. //     nID - Identifier of new category.
  403. // Returns:
  404. //     The pointer to the item object of the newly inserted category.
  405. //-----------------------------------------------------------------------
  406. CXTPPropertyGridItem* AddCategory(LPCTSTR lpszCaption, CXTPPropertyGridItem* pCategory = NULL);
  407. CXTPPropertyGridItem* AddCategory(int nID, CXTPPropertyGridItem* pCategory = NULL);//<COMBINE CXTPPropertyGrid::AddCategory@LPCTSTR>
  408. //-----------------------------------------------------------------------
  409. // Summary:
  410. //     Call this member function to insert a new category to the Property Grid control.
  411. // Parameters:
  412. //     lpszCaption - Name of the category to add.
  413. //     nID    - Identifier of new category.
  414. //     nIndex - Index of category to be inserted
  415. // Returns:
  416. //     The pointer to the item object of the newly inserted category.
  417. //-----------------------------------------------------------------------
  418. CXTPPropertyGridItem* InsertCategory(int nIndex, LPCTSTR lpszCaption, CXTPPropertyGridItem* pCategory = NULL);
  419. CXTPPropertyGridItem* InsertCategory(int nIndex, int nID, CXTPPropertyGridItem* pCategory = NULL);//<COMBINE CXTPPropertyGrid::InsertCategory@int@LPCTSTR>
  420. //-----------------------------------------------------------------------
  421. // Summary:
  422. //     Call this member function to modify the way items are grouped.
  423. // Parameters:
  424. //     sort - style of grouping. Can be any of the values listed in the Remarks section.
  425. // Remarks:
  426. //     sort parameter can be one of the following:
  427. //     * <b>xtpGridSortCategorized</b> Group items by category.
  428. //     * <b>xtpGridSortAlphabetical</b> Sort items alphabetically.
  429. //     * <b>xtpGridSortNoSort</b> Disable sorting.
  430. // See Also: GetPropertySort
  431. //-----------------------------------------------------------------------
  432. void SetPropertySort (XTPPropertyGridSortOrder sort);
  433. //-----------------------------------------------------------------------
  434. // Summary:
  435. //     Call this member function to get the current grouping style for
  436. //     the Property Grid control.
  437. // Returns:
  438. //     An XTPPropertyGridSortOrder value representing the current grouping style.
  439. // See Also: SetPropertySort
  440. //-----------------------------------------------------------------------
  441. XTPPropertyGridSortOrder GetPropertySort() const;
  442. //-----------------------------------------------------------------------
  443. // Summary:
  444. //     Call this member function to show or hide the toolbar control
  445. //     in the Property Grid window.
  446. // Parameters:
  447. //     bShow - TRUE to show the toolbar control, or FALSE to hide it.
  448. //-----------------------------------------------------------------------
  449. void ShowToolBar(BOOL bShow = TRUE);
  450. //-----------------------------------------------------------------------
  451. // Summary:
  452. //     Call this member function to show or hide the description pane
  453. //     in the Property Grid window.
  454. // Parameters:
  455. //     bShow - TRUE to show the description pane, or FALSE to hide it.
  456. //-----------------------------------------------------------------------
  457. void ShowHelp(BOOL bShow = TRUE);
  458. //-----------------------------------------------------------------------
  459. // Summary:
  460. //     Call this member function to enable or disable tooltips under items
  461. // Parameters:
  462. //     bEnable - TRUE to enable tooltips.
  463. //-----------------------------------------------------------------------
  464. void EnableToolTips(BOOL bEnable = TRUE);
  465. //-----------------------------------------------------------------------
  466. // Summary:
  467. //     Call this member function to set the custom colors of the Property
  468. //     Grid control.
  469. // Parameters:
  470. //     clrHelpBack - An RGB value that represents the background color
  471. //                   the of description pane.
  472. //     clrHelpFore - An RGB value that represents the text color of
  473. //                   the description pane.
  474. //     clrViewLine - An RGB value that represents the color of separating
  475. //                   lines in control.
  476. //     clrViewBack - An RGB value that represents the background color
  477. //                   of the Property Grid control.
  478. //     clrViewFore - An RGB value that represents the text color of
  479. //                   the Property Grid control.
  480. //     clrCategoryFore - An RGB value that represents the text color of
  481. //                   the Category item text.
  482. //-----------------------------------------------------------------------
  483. void SetCustomColors(COLORREF clrHelpBack, COLORREF clrHelpFore, COLORREF clrViewLine, COLORREF clrViewBack, COLORREF clrViewFore, COLORREF clrCategoryFore = ::GetSysColor(COLOR_GRAYTEXT));
  484. //-----------------------------------------------------------------------
  485. // Summary:
  486. //     Call this member function to set the default colors of the Property
  487. //     Grid control.
  488. //-----------------------------------------------------------------------
  489. void SetStandardColors();
  490. //-----------------------------------------------------------------------
  491. // Summary:
  492. //     Call this member function to find an item.
  493. // Parameters:
  494. //     strCaption - Caption for the item to find.
  495. //     nID        - Identifier for the item to find.
  496. // Returns:
  497. //     The pointer to the CXTPPropertyGridItem object.
  498. //-----------------------------------------------------------------------
  499. CXTPPropertyGridItem* FindItem(LPCTSTR strCaption) const;
  500. CXTPPropertyGridItem* FindItem(UINT nID) const; // <COMBINE CXTPPropertyGrid::FindItem@LPCTSTR@const>
  501. //-----------------------------------------------------------------------
  502. // Summary:
  503. //     Removes all items from the list box of a property grid control.
  504. //-----------------------------------------------------------------------
  505. void ResetContent();
  506. //-----------------------------------------------------------------------
  507. // Summary:
  508. //     Call this member function to determine if the help pane is visible.
  509. // Returns:
  510. //     TRUE if the help pane is visible, otherwise returns FALSE.
  511. //-----------------------------------------------------------------------
  512. BOOL IsHelpVisible() const;
  513. //-----------------------------------------------------------------------
  514. // Summary:
  515. //     Call this member function to determine if the toolbar is visible.
  516. // Returns:
  517. //     TRUE if the toolbar is visible, otherwise returns FALSE.
  518. //-----------------------------------------------------------------------
  519. BOOL IsBarVisible() const;
  520. //-----------------------------------------------------------------------
  521. // Summary:
  522. //     Call this member function to return the height of the help pane
  523. //     when it is visible.
  524. // Returns:
  525. //     An integer value that represents the height in pixels.
  526. //-----------------------------------------------------------------------
  527. int GetHelpHeight() const;
  528. //-----------------------------------------------------------------------
  529. // Summary:
  530. //     Call this member function to return the background color for
  531. //     the property grid.
  532. // Returns:
  533. //     An RGB value.
  534. //-----------------------------------------------------------------------
  535. COLORREF GetHelpBackColor() const;
  536. //-----------------------------------------------------------------------
  537. // Summary:
  538. //     Call this member function to return the foreground color for
  539. //     the property grid.
  540. // Returns:
  541. //     An RGB value.
  542. //-----------------------------------------------------------------------
  543. COLORREF GetHelpForeColor() const;
  544. //-----------------------------------------------------------------------
  545. // Summary:
  546. //     Call this member function to return the categories of the property
  547. //     grid.
  548. // Returns:
  549. //     The pointer to the CXTPPropertyGridItems object that represents
  550. //     collection of the categories.
  551. //-----------------------------------------------------------------------
  552. CXTPPropertyGridItems* GetCategories() const;
  553. //-----------------------------------------------------------------------
  554. // Summary:
  555. //     Call this member to return a pointer to the collection of verbs that
  556. //     are displayed in the verb panel.
  557. // Returns:
  558. //     The pointer to the CXTPPropertyGridVerbs object that represents
  559. //     the collection of verbs.
  560. //-----------------------------------------------------------------------
  561. CXTPPropertyGridVerbs* GetVerbs() const;
  562. //-----------------------------------------------------------------------
  563. // Summary:
  564. //     Call this method to retrieve reference to the view object.
  565. // Returns:
  566. //     A CXTPPropertyGridView object
  567. //-----------------------------------------------------------------------
  568. CXTPPropertyGridView& GetGridView() const;
  569. //-----------------------------------------------------------------------
  570. // Summary:
  571. //     Call this method to retrieve reference to the toolbar for the
  572. //     property grid.
  573. // Returns:
  574. //     A reference to a CToolBar object
  575. //-----------------------------------------------------------------------
  576. CToolBar& GetToolBar();
  577. //-----------------------------------------------------------------------
  578. // Summary:
  579. //     Call this member function to get selected item.
  580. // Returns:
  581. //     The pointer to the CXTPPropertyGridItem object if the specified
  582. //     item is selected; otherwise, it is NULL.
  583. //-----------------------------------------------------------------------
  584. CXTPPropertyGridItem* GetSelectedItem() const;
  585. CXTPPropertyGridItem* GetItem(int nIndex) const;
  586. //-----------------------------------------------------------------------
  587. // Summary:
  588. //     Call this member function to set the height of the help pane
  589. //     when visible.
  590. // Parameters:
  591. //     nHeight - The integer value represents the height in pixels.
  592. //-----------------------------------------------------------------------
  593. void SetHelpHeight(int nHeight);
  594. //-----------------------------------------------------------------------
  595. // Summary:
  596. //     Call this member function to set the divider position of the grid view.
  597. // Parameters:
  598. //     dDivider - A value between 0 and 1 that represents the location of the divider as
  599. //                a percentage from the left side of the view.  For example, if you wanted
  600. //                the divider to divide at 25% you would pass in .25.
  601. //-----------------------------------------------------------------------
  602. void SetViewDivider(double dDivider);
  603. //-----------------------------------------------------------------------
  604. // Summary:
  605. //     Call this member function to set the divider position of the grid view.
  606. // Parameters:
  607. //     nDivider     - A value in pixels that represents the location of the divider.
  608. //     bLockDivider - TRUE to not scale divider if user resize property grid.
  609. //-----------------------------------------------------------------------
  610. void SetViewDividerPos(int nDivider, BOOL bLockDivider = FALSE);
  611. //-----------------------------------------------------------------------
  612. // Summary:
  613. //     Call this member function to return the divider position of the grid view.
  614. // Returns:
  615. //     A value between 0 and 1 that represents the location of the divider as
  616. //     a percentage from the left side of the view.  For example, if you wanted
  617. //     the divider to divide at 25% you would pass in .25.
  618. //-----------------------------------------------------------------------
  619. double GetViewDivider() const;
  620. //-----------------------------------------------------------------------
  621. // Summary:
  622. //     This method sets the grid's current font to the specified font.
  623. // Parameters:
  624. //     pFont - Pointer to a CFont object.
  625. //-----------------------------------------------------------------------
  626. void SetFont(CFont* pFont);
  627. //-----------------------------------------------------------------------
  628. // Summary:
  629. //     Call this member to set the grid theme.
  630. // Parameters:
  631. //     paintTheme - theme of property grid. Can be one of the values
  632. //                  listed in the Remarks section.
  633. // Remarks:
  634. //     paintTheme can be one of the following values:
  635. //      * <b>xtpGridThemeDefault</b> Enables default theme.
  636. //      * <b>xtpGridThemeNativeWinXP</b> Enables WinXP style theme.
  637. //      * <b>xtpGridThemeOffice2003</b> Enables Office 2003 style theme.
  638. //      * <b>xtpGridThemeCool</b> Enables Cool theme.
  639. //      * <b>xtpGridThemeSimple</b> Enables Visual Basic style theme.
  640. //      * <b>xtpGridThemeDelphi</b> Enables Delphi style theme.
  641. //      * <b>xtpGridThemeWhidbey</b> Enables Visual Studio 2005 "Whidbey" style theme.
  642. //      * <b>xtpGridThemeOfficeXP</b> Enables Visual Office XP style theme.
  643. //      * <b>xtpGridThemeOffice2007</b> Enables Visual  Office 2007 style theme.
  644. //-----------------------------------------------------------------------
  645. void SetTheme(XTPPropertyGridPaintTheme paintTheme);
  646. //-----------------------------------------------------------------------
  647. // Summary:
  648. //     Call this method to set custom theme of the grid.
  649. // Parameters:
  650. //     pPaintManager - Points to a CXTPPropertyGridPaintManager object
  651. //-----------------------------------------------------------------------
  652. void SetCustomTheme(CXTPPropertyGridPaintManager* pPaintManager);
  653. //-----------------------------------------------------------------------
  654. // Summary:
  655. //     Retrieves current theme of the grid.
  656. //-----------------------------------------------------------------------
  657. XTPPropertyGridPaintTheme GetCurrentTheme() const;
  658. //-----------------------------------------------------------------------
  659. // Summary:
  660. //     Call this method to refresh items in the list.
  661. //-----------------------------------------------------------------------
  662. void Refresh();
  663. //-----------------------------------------------------------------------
  664. // Summary:
  665. //     Call this member function to "lock" the property grid.  This
  666. //     should be called when adding or deleting a large number of item.
  667. // Parameters:
  668. //     context - Pointer to a CXTPPropertyGridUpdateContext object.
  669. //     bResetContent - TRUE to delete all items
  670. // Remarks:
  671. //     Each time you add a new item or category to the grid, The state
  672. //     of the grid is updated the grid is redrawn.
  673. //
  674. //           If you want to delete all items in the grid and then add allot of
  675. //           new items it will be quite slow. To do this, you would call
  676. //           BeginUpdate, then delete all the items.  The property grid will be
  677. //           locked until you call EndUpdate.
  678. //
  679. //           It might be useful to call BeginWaitCursor to indicate that the
  680. //           grid is "busy" updating.
  681. // See Also: EndUpdate, CXTPPropertyGridUpdateContext
  682. //-----------------------------------------------------------------------
  683. void BeginUpdate(CXTPPropertyGridUpdateContext& context, BOOL bResetContent = TRUE);
  684. //-----------------------------------------------------------------------
  685. // Summary:
  686. //     This member should be called after BeginUpdate.  You need to call
  687. //     EndUpdate to "unlock" the grid after you have finished adding
  688. //     and deleting a large amount of items.
  689. // Parameters:
  690. //     context - Pointer to a CXTPPropertyGridUpdateContext object.
  691. // See Also: BeginUpdate, CXTPPropertyGridUpdateContext
  692. //-----------------------------------------------------------------------
  693. void EndUpdate(CXTPPropertyGridUpdateContext& context);
  694. //-----------------------------------------------------------------------
  695. // Summary:
  696. //     Call this member to determine if the verb panel is currently visible.
  697. // Returns:
  698. //     TRUE if the verb panel is visible, FALSE otherwise.
  699. // See Also: CXTPPropertyGridVerb, CXTPPropertyGridVerbs
  700. //-----------------------------------------------------------------------
  701. BOOL IsVerbsVisible() const;
  702. //-----------------------------------------------------------------------
  703. // Summary:
  704. //     Returns the currently used control's Paint Manager.
  705. // Remarks:
  706. //     Call this member function to get the paint manager object used
  707. //     for drawing a property grid control window.
  708. // Returns:
  709. //     Pointer to the paint manager object.
  710. //-----------------------------------------------------------------------
  711. CXTPPropertyGridPaintManager* GetPaintManager() const;
  712. //-----------------------------------------------------------------------
  713. // Summary:
  714. //     Creates View of Property grid. Override this member to use custom view.
  715. //-----------------------------------------------------------------------
  716. virtual CXTPPropertyGridView* CreateView() const;
  717. //-----------------------------------------------------------------------
  718. // Summary:
  719. //     This member is called when a user clicks on a verb or when a
  720. //     verb has focus and the enter key is pressed.  Override this
  721. //     member to perform custom actions such as displaying a dialog.
  722. // Parameters:
  723. //     nIndex - Index of the verb within the collection of verbs.
  724. //     pt     - Point on the screen that the user clicked.  This
  725. //              will the position of the mouse cursor over a verb.  This
  726. //              point is stored in the CXTPPropertyGridVerb::m_ptClick
  727. //              member which is a CPoint object.  Coordinates will be
  728. //              relative to the screen and not the client.
  729. //-----------------------------------------------------------------------
  730. virtual void OnVerbClick(int nIndex, CPoint pt);
  731. //-----------------------------------------------------------------------
  732. // Summary:
  733. //     This member is called when items in the property grid are navigated
  734. //     using key on the keyboard.  This includes navigating the built in
  735. //     toolbar, verbs, and items in the property grid.
  736. // Parameters:
  737. //     nUIElement - Indicates which object should receive focus.
  738. //                  Members of XTPPropertyGridUI are used to indicate
  739. //                  which object receives focus.
  740. //     bForward   - TRUE if the Tab key is pressed and items are being
  741. //                  navigated in the forward direction, FALSE if Shift+Tab
  742. //                  is pressed and items are navigated backwards.
  743. //                  TRUE if the Right or Down arrow is used to navigate the items.
  744. //                  FALSE if the Up or Left arrow is used to navigate the items.
  745. //     pItem      - Pointer to the currently selected item.
  746. // See Also: XTPPropertyGridUI
  747. //-----------------------------------------------------------------------
  748. virtual void OnNavigate(XTPPropertyGridUI nUIElement, BOOL bForward, CXTPPropertyGridItem* pItem);
  749. //-----------------------------------------------------------------------
  750. // Summary:
  751. //     Call this method to enable navigate items using Tab key.
  752. // Parameters:
  753. //     bTabItems - TRUE to navigate items in the grid using the tab key.
  754. //         When TRUE, focus will move in this order:
  755. //         Caption, Item Value, Item InPlaceButton (if used), Next item Caption
  756. //         FALSE not to navigate the items in the grid with the tab key.
  757. //-----------------------------------------------------------------------
  758. void NavigateItems(BOOL bTabItems, BOOL bTabCaptions = TRUE);
  759. //-----------------------------------------------------------------------
  760. // Summary:
  761. //     Call this member to show all in-place buttons of all items
  762. // Parameters:
  763. //     bShow - TRUE to always show in-place buttons; FALSE to show buttons only for selected item.
  764. // See Also: GetShowInplaceButtonsAlways
  765. //-----------------------------------------------------------------------
  766. void SetShowInplaceButtonsAlways(BOOL bShow);
  767. //-----------------------------------------------------------------------
  768. // Summary:
  769. //     Determines if in-place buttons are visible for all items.
  770. //-----------------------------------------------------------------------
  771. BOOL GetShowInplaceButtonsAlways() const;
  772. //-----------------------------------------------------------------------
  773. // Summary:
  774. //     Call this member to specify the height of the verb box when visible.
  775. // Parameters:
  776. //     nHeight - Height of the verb box.
  777. // See Also: CXTPPropertyGridVerb, CXTPPropertyGridVerbs, IsVerbsVisible
  778. //-----------------------------------------------------------------------
  779. void SetVerbsHeight(int nHeight);
  780. //-----------------------------------------------------------------------
  781. // Summary:
  782. //     Call this member to determine if changed items highlighter
  783. // See Also: HighlightChangedItems, CXTPPropertyGridItem::IsValueChanged
  784. //-----------------------------------------------------------------------
  785. BOOL IsHighlightChangedItems() const;
  786. //-----------------------------------------------------------------------
  787. // Summary:
  788. //     Call this member to highlight all item with changed values
  789. // Parameters:
  790. //     bHighlightChanged - TRUE to set bold font for all changed items
  791. // See Also: IsHighlightChangedItems, CXTPPropertyGridItem::IsValueChanged
  792. //-----------------------------------------------------------------------
  793. void HighlightChangedItems(BOOL bHighlightChanged);
  794. //-------------------------------------------------------------------------
  795. // Summary:
  796. //     Call this member to redraw control;
  797. //-------------------------------------------------------------------------
  798. void RedrawControl();
  799. //-----------------------------------------------------------------------
  800. // Summary:
  801. //     Retrieves Image manager associated with property grid
  802. // Returns:
  803. //     Pointer to the image manager object that stores the images in
  804. //     the property grid.
  805. //-----------------------------------------------------------------------
  806. CXTPImageManager* GetImageManager() const;
  807. //-----------------------------------------------------------------------
  808. // Summary:
  809. //     Call this method to assign new image manager.
  810. // Parameters:
  811. //     pImageManager - Pointer to the image manager object that stores the
  812. //     images in the property grid.
  813. //-----------------------------------------------------------------------
  814. void SetImageManager(CXTPImageManager* pImageManager);
  815. //-----------------------------------------------------------------------
  816. // Summary:
  817. //     Call this method to allow variable height items
  818. // Parameters:
  819. //     bVariable - TRUE to allow variable height items
  820. // See Also: CXTPPropertyGridItem::SetHeight, CXTPPropertyGridItem::SetMultiLinesCount
  821. //-----------------------------------------------------------------------
  822. void SetVariableItemsHeight(BOOL bVariable = TRUE);
  823. //-----------------------------------------------------------------------
  824. // Summary:
  825. //     Call this method to set custom in-place edit control.
  826. // Parameters:
  827. //     pInplaceEdit - New custom edit control to be set
  828. // Example:
  829. //     <code>m_wndPropertyGrid.SetInplaceEdit(new CMyInplaceEdit());</code>
  830. // See Also: SetInplaceList, CXTPPropertyGridItem::GetInplaceEdit
  831. //-----------------------------------------------------------------------
  832. void SetInplaceEdit(CXTPPropertyGridInplaceEdit*  pInplaceEdit);
  833. //-----------------------------------------------------------------------
  834. // Summary:
  835. //     Call this method to set custom in-place list box control.
  836. // Parameters:
  837. //     pInplaceList - New custom list box control to be set
  838. // Example:
  839. //     <code>m_wndPropertyGrid.SetInplaceList(new CMyInplaceList());</code>
  840. // See Also: SetInplaceEdit, CXTPPropertyGridItem::GetInplaceList
  841. //-----------------------------------------------------------------------
  842. void SetInplaceList(CXTPPropertyGridInplaceList*  pInplaceList);
  843. //-----------------------------------------------------------------------
  844. // Summary:
  845. //     Sends the specified message to the owner window.
  846. // Parameters:
  847. //     wParam - Specifies additional message-dependent information.
  848. //     lParam - Specifies additional message-dependent information
  849. // Returns:
  850. //     The result of the message processing; its value depends on the message sent.
  851. //-----------------------------------------------------------------------
  852. virtual LRESULT SendNotifyMessage(WPARAM wParam = 0, LPARAM lParam = 0);
  853. //-----------------------------------------------------------------------
  854. // Summary:
  855. //     Retrieves the zero-based index of the first visible item in a control.
  856. //     Initially, item 0 is at the top of the property grid, but if the list box is scrolled, another item may be at the top.
  857. // Returns:
  858. //     The zero-based index of the first visible item in a control if successful, -1 otherwise.
  859. //-----------------------------------------------------------------------
  860. int GetTopIndex() const;
  861. //-----------------------------------------------------------------------
  862. // Summary:
  863. //     Ensures that a particular list-box item is visible.
  864. //     Scrolls the property grid until either the item specified by nIndex appears at the top
  865. //     of the control or the maximum scroll range has been reached.
  866. // Parameters:
  867. //     nIndex - Specifies the zero-based index of the item.
  868. //-----------------------------------------------------------------------
  869. void SetTopIndex(int nIndex);
  870. //-------------------------------------------------------------------------
  871. // Summary:
  872. //     Retrieves the number of items in a property grid.
  873. // Returns:
  874. //     The number of items in the property grid, or LB_ERR if an error occurs.
  875. // Remarks:
  876. //     The returned count is one greater than the index value of the last item
  877. //     (the index is zero-based).
  878. //-------------------------------------------------------------------------
  879. int GetCount() const;
  880. //-----------------------------------------------------------------------
  881. // Summary:
  882. //     Register the window class if it has not already been registered.
  883. // Parameters:
  884. //     hInstance - Instance of resource where control is located
  885. // Returns:
  886. //     TRUE if the window class was successfully registered.
  887. //-----------------------------------------------------------------------
  888. BOOL RegisterWindowClass(HINSTANCE hInstance = NULL);
  889. //-----------------------------------------------------------------------
  890. // Summary: Specifies whether the user can move the property grid splitter.
  891. // Parameters:
  892. //               bVariable - TRUE to allow the user to resize the property grid splitter.
  893. // Remarks:
  894. //      SetVariableSplitterPos allows the user to resize the splitter by
  895. //      moving the mouse cursor over the splitter and dragging the mouse.
  896. //      A resize mouse cursor will appear when the mouse if positioned
  897. //      over the splitter.
  898. // See Also: SetViewDividerPos
  899. //-----------------------------------------------------------------------
  900. void SetVariableSplitterPos(BOOL bVariable);
  901. //-----------------------------------------------------------------------
  902. // Summary: Determines whether the user can move the property grid splitter.
  903. // Remarks:
  904. //      SetVariableSplitterPos allows the user to resize the splitter by
  905. //      moving the mouse cursor over the splitter and dragging the mouse.
  906. //      A resize mouse cursor will appear when the mouse if positioned
  907. //      over the splitter.
  908. // Returns:
  909. //      TRUE if the user is allowed to resize the property grid splitter.
  910. // See Also: SetVariableSplitterPos, SetViewDividerPos
  911. //-----------------------------------------------------------------------
  912. BOOL GetVariableSplitterPos() const;
  913. //-----------------------------------------------------------------------
  914. // Summary: Specifies whether the user can resize the help box with the mouse.
  915. // Parameters:
  916. //               bVariable - TRUE to allow the user to resize the help box with the mouse.
  917. // Remarks:
  918. //      SetVariableHelpHeight allows the user to resize the help box by moving
  919. //      the mouse cursor over the help splitter that appears between the
  920. //      bottom of the property grid and the top of the help box.  A resize
  921. //      mouse cursor will appear when the mouse if positioned over the splitter.
  922. // See Also: SetHelpHeight, GetVariableHelpHeight
  923. //-----------------------------------------------------------------------
  924. void SetVariableHelpHeight(BOOL bVariable);
  925. //-----------------------------------------------------------------------
  926. // Summary: Determines whether the user can resize the help box with the mouse.
  927. // Remarks:
  928. //      SetVariableHelpHeight allows the user to resize the help box by moving
  929. //      the mouse cursor over the help splitter that appears between the
  930. //      bottom of the property grid and the top of the help box.  A resize
  931. //      mouse cursor will appear when the mouse if positioned over the splitter.
  932. // Returns:
  933. //      TRUE if the user is allow to resize the help box with the mouse.
  934. // See Also: SetHelpHeight, SetVariableHelpHeight
  935. //-----------------------------------------------------------------------
  936. BOOL GetVariableHelpHeight() const;
  937. //-----------------------------------------------------------------------
  938. // Summary:
  939. //     Call this method to set border style for Property Grid
  940. // Parameters:
  941. //     borderStyle - borders style to be set
  942. // See Also: GetBorderStyle, XTPPropertyGridBorderStyle
  943. //-----------------------------------------------------------------------
  944. void SetBorderStyle(XTPPropertyGridBorderStyle borderStyle);
  945. //-----------------------------------------------------------------------
  946. // Summary:
  947. //     Call this method to get current border style for Property Grid
  948. // See Also: SetBorderStyle, XTPPropertyGridBorderStyle
  949. //-----------------------------------------------------------------------
  950. XTPPropertyGridBorderStyle GetBorderStyle() const;
  951. //-----------------------------------------------------------------------
  952. // Summary:
  953. //     Call this method to get tooltip context pointer.
  954. //-----------------------------------------------------------------------
  955. CXTPToolTipContext* GetToolTipContext() const;
  956. //-----------------------------------------------------------------------
  957. // Summary:
  958. //     Call this method to enable multi select.
  959. //-----------------------------------------------------------------------
  960. void EnableMultiSelect(BOOL bMultiSelect = TRUE);
  961. int GetSelectedItems(CArray<int, int>* pItems) const;
  962. public:
  963. //-----------------------------------------------------------------------
  964. // Summary:
  965. //     Determines if right-to-left mode was set.
  966. // Returns:
  967. //     TRUE if text is displayed using right-to-left reading-order properties.
  968. //-----------------------------------------------------------------------
  969. BOOL IsLayoutRTL() const;
  970. //-----------------------------------------------------------------------
  971. // Summary:
  972. //     Call this member to set right-to-left mode.
  973. // Parameters:
  974. //     bRightToLeft - TRUE to set right-to-left reading-order properties.
  975. //-----------------------------------------------------------------------
  976. void SetLayoutRTL(BOOL bRightToLeft);
  977. //-------------------------------------------------------------------------
  978. // Summary:
  979. //     This method is called to reposition view and help pane inside grid
  980. //-------------------------------------------------------------------------
  981. void Reposition();
  982. public:
  983. //-------------------------------------------------------------------------
  984. // Summary:
  985. //     Call this method to enable markup for tab captions
  986. // Parameters:
  987. //     bEnable - TRUE to enable markup
  988. //-------------------------------------------------------------------------
  989. void EnableMarkup(BOOL bEnable = TRUE);
  990. //-------------------------------------------------------------------------
  991. // Summary:
  992. //     Returns markup context
  993. //-------------------------------------------------------------------------
  994. CXTPMarkupContext* GetMarkupContext() const;
  995. protected:
  996. //-----------------------------------------------------------------------
  997. // Summary:
  998. //     This method is called by the framework during resizing of splitters.
  999. // Parameters:
  1000. //     rc - Specifies the reference to a CRect object specifying
  1001. //          the tracking rectangle.
  1002. //-----------------------------------------------------------------------
  1003. void OnInvertTracker(CRect rc);
  1004. //-----------------------------------------------------------------------
  1005. // Summary:
  1006. //     This member is called to determine if the help splitter,
  1007. //     verb splitter, or a verb was clicked upon.
  1008. // Parameters:
  1009. //     pt - A point to test.
  1010. // Returns:
  1011. //     The HitTest method returns the following values which specify which
  1012. //     part of the property grid located under the coordinates specified
  1013. //     by <i>pt</i>.
  1014. //
  1015. //     * <b>xtpGridHitError</b> Indicates something else was clicked.
  1016. //     * <b>xtpGridHitHelpSplitter</b> Indicates the help splitter was clicked.
  1017. //     * <b>xtpGridHitVerbsSplitter</b> Indicates the verb splitter was clicked.
  1018. //     * <b>xtpGridHitFirstVerb</b> If the return value is greater than or
  1019. //           equal to xtpGridHitFirstVerb then the item clicked upon is
  1020. //           a verb. You can retrieve the verb index by subtracting
  1021. //           xtpGridHitFirstVerb from the return value, for example:
  1022. // <code>
  1023. // int iHit = m_wndPropertyGrid.HitTest(pt);
  1024. // if (iHit >= xtpGridHitFirstVerb)
  1025. // {
  1026. //     // Get the index of the verb.
  1027. //     m_iVerbIndex = (iHit-xtpGridHitFirstVerb);
  1028. // }
  1029. // </code>
  1030. // See Also:
  1031. //     XTPPropertyGridHitCode
  1032. //-----------------------------------------------------------------------
  1033. virtual int HitTest(CPoint pt);
  1034. //-----------------------------------------------------------------------
  1035. // Summary:
  1036. //     This member is called when a new item is selected in the
  1037. //     grid.  Or focus switched from one item to a different item.
  1038. // Parameters:
  1039. //     pItem - Item that the selection has changed too.  This is the
  1040. //             item that just received focus.
  1041. // See Also: GetSelectedItem
  1042. //-----------------------------------------------------------------------
  1043. virtual void OnSelectionChanged(CXTPPropertyGridItem* pItem);
  1044. //-------------------------------------------------------------------------
  1045. // Summary:
  1046. //     This member is called when the sort order has changed.
  1047. // See Also: SetPropertySort
  1048. //-------------------------------------------------------------------------
  1049. virtual void OnSortChanged();
  1050. //-----------------------------------------------------------------------
  1051. // Summary:
  1052. //     This member is called to recalculate the position and size of the
  1053. //     property grid, then it resizes the grid to the specified size.
  1054. //     New size is 0, 0, cx, cy.
  1055. //     This is the area that hold the toolbar and grid, this does not
  1056. //     include the area for the verb and help panel.
  1057. // Parameters:
  1058. //     cx - New bottom-right x coordinate of the grid's bounding rectangle.
  1059. //     cy - New bottom-right y coordinate of the grid's bounding rectangle.
  1060. //-----------------------------------------------------------------------
  1061. virtual void Reposition(int cx, int cy);
  1062. //-------------------------------------------------------------------------
  1063. // Summary:
  1064. //     This member is called when the "built-in" toolbar is created.
  1065. //-------------------------------------------------------------------------
  1066. void CreateToolbar();
  1067. //-------------------------------------------------------------------------
  1068. // Summary:
  1069. //     This member is called when the toolbar buttons need to be redrawn.
  1070. // Remarks:
  1071. //     This occurs when the sort order has changed, and when the toolbar
  1072. //     is shown.  Sort order can be changed by code or by clicking on
  1073. //     a button in the toolbar.
  1074. //-------------------------------------------------------------------------
  1075. void RefreshToolBarButtons();
  1076. //-------------------------------------------------------------------------
  1077. // Summary:
  1078. //     This member is called when a Verb receives focus, and when focus
  1079. //     switches from one verb to a different verb.
  1080. //-------------------------------------------------------------------------
  1081. void OnVerbsChanged();
  1082. //-------------------------------------------------------------------------
  1083. // Summary:
  1084. //     This member is called to create grid view window
  1085. // Parameters:
  1086. //     dwListStyle - Default List style of the view
  1087. // Returns:
  1088. //     TRUE if successful, otherwise returns FALSE.
  1089. //-------------------------------------------------------------------------
  1090. BOOL CreateGridView(DWORD dwListStyle);
  1091. private:
  1092. CWnd* GetNextGridTabItem(BOOL bForward);
  1093. void RestoreExpandingState(CXTPPropertyGridItems* pItems, CXTPPropertyGridUpdateContext& context);
  1094. void SaveExpandingState(CXTPPropertyGridItems* pItems, CXTPPropertyGridUpdateContext& context);
  1095. void RecreateView();
  1096. public:
  1097. int                         m_nHelpHeight;              // Height of the description area (help panel).
  1098. int                         m_nVerbsHeight;             // Height of the verbs panel.
  1099. BOOL                        m_bHideSelection;           // TRUE to hide selection when control doesn't have focus;
  1100. protected:
  1101. BOOL                        m_bHelpVisible;             // TRUE if the help panel is visible.
  1102. BOOL                        m_bEnableTooltips;          // TRUE if tooltips enabled
  1103. BOOL m_bVariableHelpHeight;
  1104. BOOL                        m_bToolBarVisible;          // TRUE if the built in toolbar is visible.
  1105. CXTPPropertyGridToolBar     m_wndToolbar;               // Pointer to the "built-in" PropertyGrid toolbar.
  1106. HCURSOR                     m_hCursorSplit;             // Handle to the cursor when positioned over a splitter.
  1107. HCURSOR                     m_hCursorHand;              // Handle of the cursor.
  1108. BOOL                        m_bTabItems;                // TRUE to navigate items with the tab key.
  1109. BOOL                        m_bTabCaptions;             // TRUE to navigate items with the tab key.
  1110. CXTPPropertyGridVerbs*      m_pVerbs;                   // Collection of verbs (links) displayed in the verb panel when the panel is visible.
  1111. BOOL                        m_bVerbsVisible;            // TRUE if the verb panel is visible.
  1112. XTPPropertyGridPaintTheme   m_themeCurrent;             // Currently set theme.
  1113. CXTPPropertyGridPaintManager* m_pPaintManager;          // Current paint manager.
  1114. int                         m_nFocusedVerb;             // Index of the currently focused verb within the collection of verbs.
  1115. mutable CXTPPropertyGridView* m_pView;                    // View pointer
  1116. BOOL                        m_bHighlightChanged;        // TRUE to highlight changed values
  1117. CXTPImageManager*           m_pImageManager;            // Image manager of property grid
  1118. BOOL                        m_bVariableItemsHeight;     // TRUE to allow variable items height
  1119. BOOL                        m_bPreSubclassWindow;       // 'true' when initialized from PreSubclassWindow.
  1120. CXTPPropertyGridInplaceEdit*   m_pInplaceEdit;          // In-place edit control.
  1121. CXTPPropertyGridInplaceList*   m_pInplaceListBox;       // In-place list control.
  1122. BOOL                       m_bShowInplaceButtonsAlways;         // TRUE to show all inplace buttons
  1123. CXTPToolTipContext*        m_pToolTipContext;           // Tooltip context
  1124. BOOL                       m_bMultiSelect;              // TRUE for MultiSelect;
  1125. CXTPMarkupContext*         m_pMarkupContext;
  1126. private:
  1127. CRect                       m_rectTracker;
  1128. BOOL                        m_bVerbActivate;
  1129. XTPPropertyGridBorderStyle m_borderStyle;
  1130. protected:
  1131. //{{AFX_CODEJOCK_PRIVATE
  1132. //{{AFX_VIRTUAL(CXTPPropertyGrid)
  1133. protected:
  1134. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  1135. virtual void PreSubclassWindow();
  1136. //}}AFX_VIRTUAL
  1137. //{{AFX_MSG(CXTPPropertyGrid)
  1138. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  1139. afx_msg void OnPaint();
  1140. afx_msg LRESULT OnPrintClient(WPARAM wParam, LPARAM /*lParam*/);
  1141. afx_msg void OnSetFocus(CWnd* pOldWnd);
  1142. afx_msg void OnKillFocus(CWnd* pNewWnd);
  1143. afx_msg void OnSize(UINT nType, int cx, int cy);
  1144. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  1145. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  1146. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  1147. afx_msg void OnSortAlphabetic();
  1148. afx_msg void OnSortCategorized();
  1149. afx_msg void OnSysColorChange();
  1150. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  1151. afx_msg UINT OnGetDlgCode();
  1152. //}}AFX_MSG
  1153. afx_msg BOOL OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult);
  1154. DECLARE_MESSAGE_MAP()
  1155. //}}AFX_CODEJOCK_PRIVATE
  1156. private:
  1157. BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  1158. void SetLayoutRTL(CWnd* pWnd, BOOL bRTLLayout);
  1159. friend class CXTPPropertyGridView;
  1160. friend class CPropertyGridCtrl;
  1161. friend class CXTPPropertyGridVerb;
  1162. friend class CXTPPropertyGridVerbs;
  1163. friend class CXTPPropertyGridItem;
  1164. };
  1165. //////////////////////////////////////////////////////////////////////
  1166. AFX_INLINE BOOL CXTPPropertyGridUpdateContext::IsEmpty() const {
  1167. return m_mapState.IsEmpty();
  1168. }
  1169. AFX_INLINE CString CXTPPropertyGridVerb::GetCaption() const {
  1170. return m_strCaption;
  1171. }
  1172. AFX_INLINE int CXTPPropertyGridVerb::GetID() const {
  1173. return m_nID;
  1174. }
  1175. AFX_INLINE int CXTPPropertyGridVerb::GetIndex() const {
  1176. return m_nIndex;
  1177. }
  1178. AFX_INLINE void CXTPPropertyGridVerb::SetPart(CRect rc) {
  1179. m_rcPart = rc;
  1180. }
  1181. AFX_INLINE CRect CXTPPropertyGridVerb::GetPart() const {
  1182. return m_rcPart;
  1183. }
  1184. AFX_INLINE CPoint CXTPPropertyGridVerb::GetClickPoint() const {
  1185. return m_ptClick;
  1186. }
  1187. AFX_INLINE BOOL CXTPPropertyGridVerb::IsFocused() const {
  1188. return (m_nIndex == m_pVerbs->m_pGrid->m_nFocusedVerb) && (::GetFocus() == m_pVerbs->m_pGrid->GetSafeHwnd());
  1189. }
  1190. AFX_INLINE CXTPPropertyGridVerb* CXTPPropertyGridVerbs::GetAt(int nIndex) const {
  1191. return m_arrVerbs.GetAt(nIndex);
  1192. }
  1193. AFX_INLINE BOOL CXTPPropertyGridVerbs::IsEmpty() const {
  1194. return m_arrVerbs.GetSize() == 0;
  1195. }
  1196. AFX_INLINE CXTPPropertyGridItem* CXTPPropertyGrid::FindItem(LPCTSTR strCaption) const {
  1197. return GetGridView().m_pCategories->FindItem(strCaption);
  1198. }
  1199. AFX_INLINE CXTPPropertyGridItem* CXTPPropertyGrid::FindItem(UINT nID) const {
  1200. return GetGridView().m_pCategories->FindItem(nID);
  1201. }
  1202. AFX_INLINE CXTPPropertyGridItem* CXTPPropertyGrid::AddCategory(LPCTSTR strCaption, CXTPPropertyGridItem* pCategory) {
  1203. return GetGridView().AddCategory(strCaption, pCategory);
  1204. }
  1205. AFX_INLINE CXTPPropertyGridItem* CXTPPropertyGrid::InsertCategory(int nIndex, LPCTSTR strCaption, CXTPPropertyGridItem* pCategory) {
  1206. return GetGridView().InsertCategory(nIndex, strCaption, pCategory);
  1207. }
  1208. AFX_INLINE void CXTPPropertyGrid::SetPropertySort (XTPPropertyGridSortOrder sort) {
  1209. GetGridView().SetPropertySort(sort);
  1210. }
  1211. AFX_INLINE XTPPropertyGridSortOrder CXTPPropertyGrid::GetPropertySort () const {
  1212. return GetGridView().m_properetySort;
  1213. }
  1214. AFX_INLINE BOOL CXTPPropertyGrid::IsHelpVisible() const {
  1215. return m_bHelpVisible;
  1216. }
  1217. AFX_INLINE BOOL CXTPPropertyGrid::IsBarVisible() const {
  1218. return m_bToolBarVisible;
  1219. }
  1220. AFX_INLINE int CXTPPropertyGrid::GetHelpHeight() const {
  1221. return m_nHelpHeight;
  1222. }
  1223. AFX_INLINE void CXTPPropertyGrid::EnableToolTips(BOOL bEnable) {
  1224. m_bEnableTooltips = bEnable;
  1225. }
  1226. AFX_INLINE COLORREF CXTPPropertyGrid::GetHelpBackColor() const {
  1227. return m_pPaintManager->GetItemMetrics()->m_clrHelpBack;
  1228. }
  1229. AFX_INLINE COLORREF CXTPPropertyGrid::GetHelpForeColor() const {
  1230. return m_pPaintManager->GetItemMetrics()->m_clrHelpFore;
  1231. }
  1232. AFX_INLINE CToolBar& CXTPPropertyGrid::GetToolBar() {
  1233. return m_wndToolbar;
  1234. }
  1235. AFX_INLINE XTPPropertyGridPaintTheme CXTPPropertyGrid::GetCurrentTheme() const {
  1236. return m_themeCurrent;
  1237. }
  1238. AFX_INLINE CXTPPropertyGridVerbs* CXTPPropertyGrid::GetVerbs() const {
  1239. return m_pVerbs;
  1240. }
  1241. AFX_INLINE BOOL CXTPPropertyGrid::IsVerbsVisible() const {
  1242. return !m_pVerbs->IsEmpty();
  1243. }
  1244. AFX_INLINE CXTPPropertyGridPaintManager* CXTPPropertyGrid::GetPaintManager() const {
  1245. return m_pPaintManager;
  1246. }
  1247. AFX_INLINE BOOL CXTPPropertyGrid::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) {
  1248. return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
  1249. }
  1250. AFX_INLINE void CXTPPropertyGrid::NavigateItems(BOOL bTabItems, BOOL bTabCaptions) {
  1251. m_bTabItems = bTabItems;
  1252. m_bTabCaptions = bTabCaptions;
  1253. }
  1254. AFX_INLINE BOOL CXTPPropertyGrid::IsHighlightChangedItems() const {
  1255. return m_bHighlightChanged;
  1256. }
  1257. AFX_INLINE void CXTPPropertyGrid::HighlightChangedItems(BOOL bHighlightChanged) {
  1258. m_bHighlightChanged = bHighlightChanged;
  1259. RedrawControl();
  1260. }
  1261. AFX_INLINE int CXTPPropertyGrid::GetCount() const {
  1262. return GetGridView().GetCount();
  1263. }
  1264. AFX_INLINE void CXTPPropertyGrid::SetVariableSplitterPos(BOOL bVariable) {
  1265. GetGridView().m_bVariableSplitterPos = bVariable;
  1266. }
  1267. AFX_INLINE BOOL CXTPPropertyGrid::GetVariableSplitterPos() const {
  1268. return GetGridView().m_bVariableSplitterPos;
  1269. }
  1270. AFX_INLINE void CXTPPropertyGrid::SetVariableHelpHeight(BOOL bVariable) {
  1271. m_bVariableHelpHeight = bVariable;
  1272. }
  1273. AFX_INLINE BOOL CXTPPropertyGrid::GetVariableHelpHeight() const {
  1274. return m_bVariableHelpHeight;
  1275. }
  1276. AFX_INLINE BOOL CXTPPropertyGrid::GetShowInplaceButtonsAlways() const {
  1277. return m_bShowInplaceButtonsAlways;
  1278. }
  1279. AFX_INLINE void CXTPPropertyGrid::SetShowInplaceButtonsAlways(BOOL bShow) {
  1280. m_bShowInplaceButtonsAlways = bShow;
  1281. Reposition();
  1282. }
  1283. AFX_INLINE CXTPToolTipContext* CXTPPropertyGrid::GetToolTipContext() const {
  1284. return m_pToolTipContext;
  1285. }
  1286. AFX_INLINE CXTPMarkupContext* CXTPPropertyGrid::GetMarkupContext() const {
  1287. return m_pMarkupContext;
  1288. }
  1289. #endif // #if !defined(__XTPPROPERTYGRID_H__)