]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/propgrid/propgridpagestate.h
more fixes
[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 license
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 /** @section propgrid_iterator_class wxPropertyGridIterator
103
104 Preferable way to iterate through contents of wxPropertyGrid,
105 wxPropertyGridManager, and wxPropertyGridPage.
106
107 See wxPropertyGridInterface::GetIterator() for more information about usage.
108
109 @library{wxpropgrid}
110 @category{propgrid}
111 */
112 class wxPropertyGridIterator : public wxPropertyGridIteratorBase
113 {
114 public:
115
116 void Assign( const wxPropertyGridIteratorBase& it );
117
118 bool AtEnd() const { return m_property == NULL; }
119
120 /** Get current property.
121 */
122 wxPGProperty* GetProperty() const { return m_property; }
123
124 /** Iterate to the next property.
125 */
126 void Next( bool iterateChildren = true );
127
128 /** Iterate to the previous property.
129 */
130 void Prev();
131
132 protected:
133 };
134
135 // -----------------------------------------------------------------------
136
137 /** @section propgrid_viterator_class wxPGVIterator
138
139 Abstract implementation of a simple iterator. Can only be used
140 to iterate in forward order, and only through the entire container.
141 Used to have functions dealing with all properties work with both
142 wxPropertyGrid and wxPropertyGridManager.
143 */
144 class wxPGVIterator
145 {
146 public:
147 wxPGVIterator() { m_pIt = NULL; }
148 wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; }
149 ~wxPGVIterator() { UnRef(); }
150 void UnRef() { if (m_pIt) m_pIt->DecRef(); }
151 wxPGVIterator( const wxPGVIterator& it )
152 {
153 m_pIt = it.m_pIt;
154 m_pIt->IncRef();
155 }
156 const wxPGVIterator& operator=( const wxPGVIterator& it )
157 {
158 UnRef();
159 m_pIt = it.m_pIt;
160 m_pIt->IncRef();
161 return *this;
162 }
163 void Next() { m_pIt->Next(); }
164 bool AtEnd() const { return m_pIt->m_it.AtEnd(); }
165 wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); }
166 protected:
167 wxPGVIteratorBase* m_pIt;
168 };
169
170