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