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