propgridpagestate.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/propgrid/propgridpagestate.h
  3. // Purpose: wxPropertyGridPageState class
  4. // Author: Jaakko Salli
  5. // Modified by:
  6. // Created: 2008-08-24
  7. // Copyright: (c) Jaakko Salli
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_PROPGRID_PROPGRIDPAGESTATE_H_
  11. #define _WX_PROPGRID_PROPGRIDPAGESTATE_H_
  12. #include "wx/defs.h"
  13. #if wxUSE_PROPGRID
  14. #include "wx/propgrid/property.h"
  15. // -----------------------------------------------------------------------
  16. /** @section propgrid_hittestresult wxPropertyGridHitTestResult
  17. A return value from wxPropertyGrid::HitTest(),
  18. contains all you need to know about an arbitrary location on the grid.
  19. */
  20. class WXDLLIMPEXP_PROPGRID wxPropertyGridHitTestResult
  21. {
  22. friend class wxPropertyGridPageState;
  23. public:
  24. wxPropertyGridHitTestResult()
  25. {
  26. m_property = NULL;
  27. m_column = -1;
  28. m_splitter = -1;
  29. m_splitterHitOffset = 0;
  30. }
  31. ~wxPropertyGridHitTestResult()
  32. {
  33. }
  34. /**
  35. Returns column hit. -1 for margin.
  36. */
  37. int GetColumn() const { return m_column; }
  38. /**
  39. Returns property hit. NULL if empty space below
  40. properties was hit instead.
  41. */
  42. wxPGProperty* GetProperty() const
  43. {
  44. return m_property;
  45. }
  46. /**
  47. Returns index of splitter hit, -1 for none.
  48. */
  49. int GetSplitter() const { return m_splitter; }
  50. /**
  51. If splitter hit, then this member function
  52. returns offset to the exact splitter position.
  53. */
  54. int GetSplitterHitOffset() const { return m_splitterHitOffset; }
  55. private:
  56. /** Property. NULL if empty space below properties was hit */
  57. wxPGProperty* m_property;
  58. /** Column. -1 for margin. */
  59. int m_column;
  60. /** Index of splitter hit, -1 for none. */
  61. int m_splitter;
  62. /** If splitter hit, offset to that */
  63. int m_splitterHitOffset;
  64. };
  65. // -----------------------------------------------------------------------
  66. #define wxPG_IT_CHILDREN(A) ((A)<<16)
  67. /** @section propgrid_iterator_flags wxPropertyGridIterator Flags
  68. @{
  69. NOTES: At lower 16-bits, there are flags to check if item will be included.
  70. At higher 16-bits, there are same flags, but to instead check if children
  71. will be included.
  72. */
  73. enum wxPG_ITERATOR_FLAGS
  74. {
  75. /**
  76. Iterate through 'normal' property items (does not include children of
  77. aggregate or hidden items by default).
  78. */
  79. wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
  80. wxPG_PROP_MISC_PARENT |
  81. wxPG_PROP_AGGREGATE |
  82. wxPG_PROP_COLLAPSED |
  83. wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
  84. wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
  85. /** Iterate children of collapsed parents, and individual items that are hidden.
  86. */
  87. wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
  88. wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
  89. /**
  90. Iterate children of parent that is an aggregate property (ie has fixed
  91. children).
  92. */
  93. wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
  94. wxPG_ITERATE_PROPERTIES,
  95. /** Iterate categories.
  96. Note that even without this flag, children of categories are still iterated
  97. through.
  98. */
  99. wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
  100. wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
  101. wxPG_PROP_COLLAPSED,
  102. wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
  103. wxPG_PROP_AGGREGATE |
  104. wxPG_PROP_CATEGORY,
  105. wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
  106. wxPG_IT_CHILDREN(
  107. wxPG_ITERATE_ALL_PARENTS),
  108. wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
  109. wxPG_PROP_MISC_PARENT |
  110. wxPG_PROP_AGGREGATE |
  111. wxPG_PROP_HIDDEN |
  112. wxPG_PROP_CATEGORY |
  113. wxPG_PROP_COLLAPSED,
  114. wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
  115. // (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
  116. wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
  117. /** Combines all flags needed to iterate through visible properties
  118. (ie hidden properties and children of collapsed parents are skipped).
  119. */
  120. wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
  121. wxPG_PROP_CATEGORY |
  122. wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
  123. /** Iterate all items.
  124. */
  125. wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE |
  126. wxPG_ITERATE_HIDDEN,
  127. /** Iterate through individual properties (ie categories and children of
  128. aggregate properties are skipped).
  129. */
  130. wxPG_ITERATE_NORMAL = wxPG_ITERATE_PROPERTIES |
  131. wxPG_ITERATE_HIDDEN,
  132. /** Default iterator flags.
  133. */
  134. wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
  135. };
  136. /** @}
  137. */
  138. #define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \
  139. A = (FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
  140. wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF; \
  141. B = ((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
  142. wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF;
  143. // Macro to test if children of PWC should be iterated through
  144. #define wxPG_ITERATOR_PARENTEXMASK_TEST(PWC, PARENTMASK) \
  145. ( \
  146. !(PWC->GetFlags() & PARENTMASK) && \
  147. PWC->GetChildCount() \
  148. )
  149. // Base for wxPropertyGridIterator classes.
  150. class WXDLLIMPEXP_PROPGRID wxPropertyGridIteratorBase
  151. {
  152. public:
  153. wxPropertyGridIteratorBase()
  154. {
  155. }
  156. void Assign( const wxPropertyGridIteratorBase& it );
  157. bool AtEnd() const { return m_property == NULL; }
  158. /** Get current property.
  159. */
  160. wxPGProperty* GetProperty() const { return m_property; }
  161. void Init( wxPropertyGridPageState* state,
  162. int flags,
  163. wxPGProperty* property,
  164. int dir = 1 );
  165. void Init( wxPropertyGridPageState* state,
  166. int flags,
  167. int startPos = wxTOP,
  168. int dir = 0 );
  169. /** Iterate to the next property.
  170. */
  171. void Next( bool iterateChildren = true );
  172. /** Iterate to the previous property.
  173. */
  174. void Prev();
  175. /**
  176. Set base parent, ie a property when, in which iteration returns, it
  177. ends.
  178. Default base parent is the root of the used wxPropertyGridPageState.
  179. */
  180. void SetBaseParent( wxPGProperty* baseParent )
  181. { m_baseParent = baseParent; }
  182. protected:
  183. wxPGProperty* m_property;
  184. private:
  185. wxPropertyGridPageState* m_state;
  186. wxPGProperty* m_baseParent;
  187. // Masks are used to quickly exclude items
  188. int m_itemExMask;
  189. int m_parentExMask;
  190. };
  191. #define wxPG_IMPLEMENT_ITERATOR(CLASS, PROPERTY, STATE) \
  192. CLASS( STATE* state, int flags = wxPG_ITERATE_DEFAULT, \
  193. PROPERTY* property = NULL, int dir = 1 ) \
  194. : wxPropertyGridIteratorBase() \
  195. { Init( (wxPropertyGridPageState*)state, flags, \
  196. (wxPGProperty*)property, dir ); } \
  197. CLASS( STATE* state, int flags, int startPos, int dir = 0 ) \
  198. : wxPropertyGridIteratorBase() \
  199. { Init( (wxPropertyGridPageState*)state, flags, startPos, dir ); } \
  200. CLASS() \
  201. : wxPropertyGridIteratorBase() \
  202. { \
  203. m_property = NULL; \
  204. } \
  205. CLASS( const CLASS& it ) \
  206. : wxPropertyGridIteratorBase( ) \
  207. { \
  208. Assign(it); \
  209. } \
  210. ~CLASS() \
  211. { \
  212. } \
  213. const CLASS& operator=( const CLASS& it ) \
  214. { \
  215. if (this != &it) \
  216. Assign(it); \
  217. return *this; \
  218. } \
  219. CLASS& operator++() { Next(); return *this; } \
  220. CLASS operator++(int) { CLASS it=*this;Next();return it; } \
  221. CLASS& operator--() { Prev(); return *this; } \
  222. CLASS operator--(int) { CLASS it=*this;Prev();return it; } \
  223. PROPERTY* operator *() const { return (PROPERTY*)m_property; } \
  224. static PROPERTY* OneStep( STATE* state, \
  225. int flags = wxPG_ITERATE_DEFAULT, \
  226. PROPERTY* property = NULL, \
  227. int dir = 1 ) \
  228. { \
  229. CLASS it( state, flags, property, dir ); \
  230. if ( property ) \
  231. { \
  232. if ( dir == 1 ) it.Next(); \
  233. else it.Prev(); \
  234. } \
  235. return *it; \
  236. }
  237. /** @class wxPropertyGridIterator
  238. Preferable way to iterate through contents of wxPropertyGrid,
  239. wxPropertyGridManager, and wxPropertyGridPage.
  240. See wxPropertyGridInterface::GetIterator() for more information about usage.
  241. @library{wxpropgrid}
  242. @category{propgrid}
  243. */
  244. class WXDLLIMPEXP_PROPGRID
  245. wxPropertyGridIterator : public wxPropertyGridIteratorBase
  246. {
  247. public:
  248. wxPG_IMPLEMENT_ITERATOR(wxPropertyGridIterator,
  249. wxPGProperty,
  250. wxPropertyGridPageState)
  251. protected:
  252. };
  253. // Const version of wxPropertyGridIterator.
  254. class WXDLLIMPEXP_PROPGRID
  255. wxPropertyGridConstIterator : public wxPropertyGridIteratorBase
  256. {
  257. public:
  258. wxPG_IMPLEMENT_ITERATOR(wxPropertyGridConstIterator,
  259. const wxPGProperty,
  260. const wxPropertyGridPageState)
  261. /**
  262. Additional copy constructor.
  263. */
  264. wxPropertyGridConstIterator( const wxPropertyGridIterator& other )
  265. {
  266. Assign(other);
  267. }
  268. /**
  269. Additional assignment operator.
  270. */
  271. const wxPropertyGridConstIterator& operator=( const wxPropertyGridIterator& it )
  272. {
  273. Assign(it);
  274. return *this;
  275. }
  276. protected:
  277. };
  278. // -----------------------------------------------------------------------
  279. /** Base class to derive new viterators.
  280. */
  281. class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase : public wxObjectRefData
  282. {
  283. friend class wxPGVIterator;
  284. public:
  285. wxPGVIteratorBase() { }
  286. virtual void Next() = 0;
  287. protected:
  288. virtual ~wxPGVIteratorBase() { }
  289. wxPropertyGridIterator m_it;
  290. };
  291. /** @class wxPGVIterator
  292. Abstract implementation of a simple iterator. Can only be used
  293. to iterate in forward order, and only through the entire container.
  294. Used to have functions dealing with all properties work with both
  295. wxPropertyGrid and wxPropertyGridManager.
  296. */
  297. class WXDLLIMPEXP_PROPGRID wxPGVIterator
  298. {
  299. public:
  300. wxPGVIterator() { m_pIt = NULL; }
  301. wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; }
  302. ~wxPGVIterator() { UnRef(); }
  303. void UnRef() { if (m_pIt) m_pIt->DecRef(); }
  304. wxPGVIterator( const wxPGVIterator& it )
  305. {
  306. m_pIt = it.m_pIt;
  307. m_pIt->IncRef();
  308. }
  309. const wxPGVIterator& operator=( const wxPGVIterator& it )
  310. {
  311. if (this != &it)
  312. {
  313. UnRef();
  314. m_pIt = it.m_pIt;
  315. m_pIt->IncRef();
  316. }
  317. return *this;
  318. }
  319. void Next() { m_pIt->Next(); }
  320. bool AtEnd() const { return m_pIt->m_it.AtEnd(); }
  321. wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); }
  322. protected:
  323. wxPGVIteratorBase* m_pIt;
  324. };
  325. // -----------------------------------------------------------------------
  326. /** @class wxPropertyGridPageState
  327. Contains low-level property page information (properties, column widths,
  328. etc) of a single wxPropertyGrid or single wxPropertyGridPage. Generally you
  329. should not use this class directly, but instead member functions in
  330. wxPropertyGridInterface, wxPropertyGrid, wxPropertyGridPage, and
  331. wxPropertyGridManager.
  332. @remarks
  333. - In separate wxPropertyGrid component this class was known as
  334. wxPropertyGridState.
  335. - Currently this class is not implemented in wxPython.
  336. @library{wxpropgrid}
  337. @category{propgrid}
  338. */
  339. class WXDLLIMPEXP_PROPGRID wxPropertyGridPageState
  340. {
  341. friend class wxPGProperty;
  342. friend class wxPropertyGrid;
  343. friend class wxPGCanvas;
  344. friend class wxPropertyGridInterface;
  345. friend class wxPropertyGridPage;
  346. friend class wxPropertyGridManager;
  347. public:
  348. /** Default constructor. */
  349. wxPropertyGridPageState();
  350. /** Destructor. */
  351. virtual ~wxPropertyGridPageState();
  352. /** Makes sure all columns have minimum width.
  353. */
  354. void CheckColumnWidths( int widthChange = 0 );
  355. /**
  356. Override this member function to add custom behaviour on property
  357. deletion.
  358. */
  359. virtual void DoDelete( wxPGProperty* item, bool doDelete = true );
  360. wxSize DoFitColumns( bool allowGridResize = false );
  361. wxPGProperty* DoGetItemAtY( int y ) const;
  362. /**
  363. Override this member function to add custom behaviour on property
  364. insertion.
  365. */
  366. virtual wxPGProperty* DoInsert( wxPGProperty* parent,
  367. int index,
  368. wxPGProperty* property );
  369. /**
  370. This needs to be overridden in grid used the manager so that splitter
  371. changes can be propagated to other pages.
  372. */
  373. virtual void DoSetSplitterPosition( int pos,
  374. int splitterColumn = 0,
  375. int flags = 0 );
  376. bool EnableCategories( bool enable );
  377. /** Make sure virtual height is up-to-date.
  378. */
  379. void EnsureVirtualHeight()
  380. {
  381. if ( m_vhCalcPending )
  382. {
  383. RecalculateVirtualHeight();
  384. m_vhCalcPending = 0;
  385. }
  386. }
  387. /** Returns (precalculated) height of contained visible properties.
  388. */
  389. unsigned int GetVirtualHeight() const
  390. {
  391. wxASSERT( !m_vhCalcPending );
  392. return m_virtualHeight;
  393. }
  394. /** Returns (precalculated) height of contained visible properties.
  395. */
  396. unsigned int GetVirtualHeight()
  397. {
  398. EnsureVirtualHeight();
  399. return m_virtualHeight;
  400. }
  401. /** Returns actual height of contained visible properties.
  402. @remarks
  403. Mostly used for internal diagnostic purposes.
  404. */
  405. inline unsigned int GetActualVirtualHeight() const;
  406. unsigned int GetColumnCount() const
  407. {
  408. return (unsigned int) m_colWidths.size();
  409. }
  410. int GetColumnMinWidth( int column ) const;
  411. int GetColumnWidth( unsigned int column ) const
  412. {
  413. return m_colWidths[column];
  414. }
  415. wxPropertyGrid* GetGrid() const { return m_pPropGrid; }
  416. /** Returns last item which could be iterated using given flags.
  417. @param flags
  418. @link iteratorflags List of iterator flags@endlink
  419. */
  420. wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT );
  421. const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
  422. {
  423. return ((wxPropertyGridPageState*)this)->GetLastItem(flags);
  424. }
  425. /**
  426. Returns currently selected property.
  427. */
  428. wxPGProperty* GetSelection() const
  429. {
  430. if ( m_selection.size() == 0 )
  431. return NULL;
  432. return m_selection[0];
  433. }
  434. void DoSetSelection( wxPGProperty* prop )
  435. {
  436. m_selection.clear();
  437. if ( prop )
  438. m_selection.push_back(prop);
  439. }
  440. bool DoClearSelection()
  441. {
  442. return DoSelectProperty(NULL);
  443. }
  444. void DoRemoveFromSelection( wxPGProperty* prop );
  445. void DoSetColumnProportion( unsigned int column, int proportion );
  446. int DoGetColumnProportion( unsigned int column ) const
  447. {
  448. return m_columnProportions[column];
  449. }
  450. void ResetColumnSizes( int setSplitterFlags );
  451. wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const;
  452. wxPGProperty* GetPropertyByLabel( const wxString& name,
  453. wxPGProperty* parent = NULL ) const;
  454. wxVariant DoGetPropertyValues( const wxString& listname,
  455. wxPGProperty* baseparent,
  456. long flags ) const;
  457. wxPGProperty* DoGetRoot() const { return m_properties; }
  458. void DoSetPropertyName( wxPGProperty* p, const wxString& newName );
  459. // Returns combined width of margin and all the columns
  460. int GetVirtualWidth() const
  461. {
  462. return m_width;
  463. }
  464. /**
  465. Returns minimal width for given column so that all images and texts
  466. will fit entirely.
  467. Used by SetSplitterLeft() and DoFitColumns().
  468. */
  469. int GetColumnFitWidth(wxClientDC& dc,
  470. wxPGProperty* pwc,
  471. unsigned int col,
  472. bool subProps) const;
  473. int GetColumnFullWidth(wxClientDC &dc, wxPGProperty *p, unsigned int col);
  474. /**
  475. Returns information about arbitrary position in the grid.
  476. @param pt
  477. Logical coordinates in the virtual grid space. Use
  478. wxScrolled<T>::CalcUnscrolledPosition() if you need to
  479. translate a scrolled position into a logical one.
  480. */
  481. wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
  482. /** Returns true if page is visibly displayed.
  483. */
  484. inline bool IsDisplayed() const;
  485. bool IsInNonCatMode() const { return (bool)(m_properties == m_abcArray); }
  486. void DoLimitPropertyEditing( wxPGProperty* p, bool limit = true )
  487. {
  488. p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
  489. }
  490. bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
  491. /** widthChange is non-client.
  492. */
  493. void OnClientWidthChange( int newWidth,
  494. int widthChange,
  495. bool fromOnResize = false );
  496. /** Recalculates m_virtualHeight.
  497. */
  498. void RecalculateVirtualHeight()
  499. {
  500. m_virtualHeight = GetActualVirtualHeight();
  501. }
  502. void SetColumnCount( int colCount );
  503. void PropagateColSizeDec( int column, int decrease, int dir );
  504. bool DoHideProperty( wxPGProperty* p, bool hide, int flags = wxPG_RECURSE );
  505. bool DoSetPropertyValueString( wxPGProperty* p, const wxString& value );
  506. bool DoSetPropertyValue( wxPGProperty* p, wxVariant& value );
  507. bool DoSetPropertyValueWxObjectPtr( wxPGProperty* p, wxObject* value );
  508. void DoSetPropertyValues( const wxVariantList& list,
  509. wxPGProperty* default_category );
  510. void SetSplitterLeft( bool subProps = false );
  511. /** Set virtual width for this particular page. */
  512. void SetVirtualWidth( int width );
  513. void DoSortChildren( wxPGProperty* p, int flags = 0 );
  514. void DoSort( int flags = 0 );
  515. bool PrepareAfterItemsAdded();
  516. /** Called after virtual height needs to be recalculated.
  517. */
  518. void VirtualHeightChanged()
  519. {
  520. m_vhCalcPending = 1;
  521. }
  522. /** Base append. */
  523. wxPGProperty* DoAppend( wxPGProperty* property );
  524. /** Returns property by its name. */
  525. wxPGProperty* BaseGetPropertyByName( const wxString& name ) const;
  526. /** Called in, for example, wxPropertyGrid::Clear. */
  527. void DoClear();
  528. bool DoIsPropertySelected( wxPGProperty* prop ) const;
  529. bool DoCollapse( wxPGProperty* p );
  530. bool DoExpand( wxPGProperty* p );
  531. void CalculateFontAndBitmapStuff( int vspacing );
  532. protected:
  533. // Utility to check if two properties are visibly next to each other
  534. bool ArePropertiesAdjacent( wxPGProperty* prop1,
  535. wxPGProperty* prop2,
  536. int iterFlags = wxPG_ITERATE_VISIBLE ) const;
  537. int DoGetSplitterPosition( int splitterIndex = 0 ) const;
  538. /** Returns column at x coordinate (in GetGrid()->GetPanel()).
  539. @param pSplitterHit
  540. Give pointer to int that receives index to splitter that is at x.
  541. @param pSplitterHitOffset
  542. Distance from said splitter.
  543. */
  544. int HitTestH( int x, int* pSplitterHit, int* pSplitterHitOffset ) const;
  545. bool PrepareToAddItem( wxPGProperty* property,
  546. wxPGProperty* scheduledParent );
  547. /** If visible, then this is pointer to wxPropertyGrid.
  548. This shall *never* be NULL to indicate that this state is not visible.
  549. */
  550. wxPropertyGrid* m_pPropGrid;
  551. /** Pointer to currently used array. */
  552. wxPGProperty* m_properties;
  553. /** Array for categoric mode. */
  554. wxPGRootProperty m_regularArray;
  555. /** Array for root of non-categoric mode. */
  556. wxPGRootProperty* m_abcArray;
  557. /** Dictionary for name-based access. */
  558. wxPGHashMapS2P m_dictName;
  559. /** List of column widths (first column does not include margin). */
  560. wxArrayInt m_colWidths;
  561. /** List of indices of columns the user can edit by clicking it. */
  562. wxArrayInt m_editableColumns;
  563. /** Column proportions */
  564. wxArrayInt m_columnProportions;
  565. double m_fSplitterX;
  566. /** Most recently added category. */
  567. wxPropertyCategory* m_currentCategory;
  568. /** Array of selected property. */
  569. wxArrayPGProperty m_selection;
  570. /** Virtual width. */
  571. int m_width;
  572. /** Indicates total virtual height of visible properties. */
  573. unsigned int m_virtualHeight;
  574. /** 1 if m_lastCaption is also the bottommost caption. */
  575. unsigned char m_lastCaptionBottomnest;
  576. /** 1 items appended/inserted, so stuff needs to be done before drawing;
  577. If m_virtualHeight == 0, then calcylatey's must be done.
  578. Otherwise just sort.
  579. */
  580. unsigned char m_itemsAdded;
  581. /** 1 if any value is modified. */
  582. unsigned char m_anyModified;
  583. unsigned char m_vhCalcPending;
  584. /** True if splitter has been pre-set by the application. */
  585. bool m_isSplitterPreSet;
  586. /** Used to (temporarily) disable splitter centering. */
  587. bool m_dontCenterSplitter;
  588. private:
  589. /** Only inits arrays, doesn't migrate things or such. */
  590. void InitNonCatMode();
  591. };
  592. // -----------------------------------------------------------------------
  593. #endif // wxUSE_PROPGRID
  594. #endif // _WX_PROPGRID_PROPGRIDPAGESTATE_H_