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