]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/propgrid/propgridpagestate.h
cd914c1f90872f0408560b81bc62ca86bc102f2e
[wxWidgets.git] / interface / wx / propgrid / propgridpagestate.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: property.h
3 // Purpose: interface of wxPGProperty
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 /**
11 @section propgrid_hittestresult wxPropertyGridHitTestResult
12
13 A return value from wxPropertyGrid::HitTest(),
14 contains all you need to know about an arbitrary location on the grid.
15 */
16 struct wxPropertyGridHitTestResult
17 {
18 public:
19
20 wxPGProperty* GetProperty() const { return property; }
21
22 /** Column. -1 for margin. */
23 int column;
24
25 /** Index of splitter hit, -1 for none. */
26 int splitter;
27
28 /** If splitter hit, offset to that */
29 int splitterHitOffset;
30
31 private:
32 /** Property. NULL if empty space below properties was hit */
33 wxPGProperty* property;
34 };
35
36 // -----------------------------------------------------------------------
37
38 #define wxPG_IT_CHILDREN(A) (A<<16)
39
40 /** @section propgrid_iterator_flags wxPropertyGridIterator Flags
41 @{
42
43 NOTES: At lower 16-bits, there are flags to check if item will be included. At higher
44 16-bits, there are same flags, but to instead check if children will be included.
45 */
46
47 enum wxPG_ITERATOR_FLAGS
48 {
49
50 /** Iterate through 'normal' property items (does not include children of aggregate or hidden items by default).
51 */
52 wxPG_ITERATE_PROPERTIES = (wxPG_PROP_PROPERTY|wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE| \
53 wxPG_PROP_COLLAPSED|((wxPG_PROP_MISC_PARENT|wxPG_PROP_CATEGORY)<<16)),
54
55 /** Iterate children of collapsed parents, and individual items that are hidden.
56 */
57 wxPG_ITERATE_HIDDEN = (wxPG_PROP_HIDDEN|wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED)),
58
59 /** Iterate children of parent that is an aggregate property (ie. has fixed children).
60 */
61 wxPG_ITERATE_FIXED_CHILDREN = (wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE)|wxPG_ITERATE_PROPERTIES),
62
63 /** Iterate categories. Note that even without this flag, children of categories
64 are still iterated through.
65 */
66 wxPG_ITERATE_CATEGORIES = (wxPG_PROP_CATEGORY|wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY)|wxPG_PROP_COLLAPSED),
67
68 wxPG_ITERATE_ALL_PARENTS = (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY),
69
70 wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = (wxPG_ITERATE_ALL_PARENTS|wxPG_IT_CHILDREN(wxPG_ITERATE_ALL_PARENTS)),
71
72 wxPG_ITERATOR_FLAGS_ALL = (wxPG_PROP_PROPERTY|wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE| \
73 wxPG_PROP_HIDDEN|wxPG_PROP_CATEGORY|wxPG_PROP_COLLAPSED),
74
75 wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
76
77 wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL, // (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
78
79 /** Combines all flags needed to iterate through visible properties
80 (ie. hidden properties and children of collapsed parents are skipped).
81 */
82 wxPG_ITERATE_VISIBLE = (wxPG_ITERATE_PROPERTIES|wxPG_PROP_CATEGORY|wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE)),
83
84 /** Iterate all items.
85 */
86 wxPG_ITERATE_ALL = (wxPG_ITERATE_VISIBLE|wxPG_ITERATE_HIDDEN),
87
88 /** Iterate through individual properties (ie. categories and children of
89 aggregate properties are skipped).
90 */
91 wxPG_ITERATE_NORMAL = (wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_HIDDEN),
92
93 /** Default iterator flags.
94 */
95 wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
96
97 };
98
99 /** @}
100 */
101
102
103 /**
104 @section propgrid_iterator_class wxPropertyGridIterator
105
106 Preferable way to iterate through contents of wxPropertyGrid,
107 wxPropertyGridManager, and wxPropertyGridPage.
108
109 See wxPropertyGridInterface::GetIterator() for more information about usage.
110
111 @library{wxpropgrid}
112 @category{propgrid}
113 */
114 class wxPropertyGridIterator : public wxPropertyGridIteratorBase
115 {
116 public:
117
118 void Assign( const wxPropertyGridIteratorBase& it );
119
120 bool AtEnd() const { return m_property == NULL; }
121
122 /**
123 Get current property.
124 */
125 wxPGProperty* GetProperty() const { return m_property; }
126
127 /**
128 Iterate to the next property.
129 */
130 void Next( bool iterateChildren = true );
131
132 /**
133 Iterate to the previous property.
134 */
135 void Prev();
136
137 protected:
138 };
139
140 // -----------------------------------------------------------------------
141
142 /**
143 @section propgrid_viterator_class wxPGVIterator
144
145 Abstract implementation of a simple iterator. Can only be used
146 to iterate in forward order, and only through the entire container.
147 Used to have functions dealing with all properties work with both
148 wxPropertyGrid and wxPropertyGridManager.
149 */
150 class wxPGVIterator
151 {
152 public:
153 wxPGVIterator() { m_pIt = NULL; }
154 wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; }
155 ~wxPGVIterator() { UnRef(); }
156 void UnRef() { if (m_pIt) m_pIt->DecRef(); }
157 wxPGVIterator( const wxPGVIterator& it )
158 {
159 m_pIt = it.m_pIt;
160 m_pIt->IncRef();
161 }
162 const wxPGVIterator& operator=( const wxPGVIterator& it )
163 {
164 UnRef();
165 m_pIt = it.m_pIt;
166 m_pIt->IncRef();
167 return *this;
168 }
169 void Next() { m_pIt->Next(); }
170 bool AtEnd() const { return m_pIt->m_it.AtEnd(); }
171 wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); }
172 protected:
173 wxPGVIteratorBase* m_pIt;
174 };
175
176