Replace macro with inline function in wxPGPropertyGridIterator-related code
Replace wxPG_ITERATOR_CREATE_MASKS macro with inline function to ensure type safety.
This commit is contained in:
parent
6a5b0667b5
commit
5725f0be41
2 changed files with 18 additions and 7 deletions
|
|
@ -276,12 +276,21 @@ wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
|
|||
|
||||
};
|
||||
|
||||
|
||||
#define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \
|
||||
A = static_cast<wxPGPropertyFlags>((FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
|
||||
wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF); \
|
||||
B = static_cast<wxPGPropertyFlags>(((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
|
||||
inline void wxPGCreateIteratorMasks(int flags, wxPGPropertyFlags& itemExMask, wxPGPropertyFlags& parentExMask)
|
||||
{
|
||||
itemExMask = static_cast<wxPGPropertyFlags>((flags ^ wxPG_ITERATOR_MASK_OP_ITEM) &
|
||||
wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF);
|
||||
parentExMask = static_cast<wxPGPropertyFlags>(((flags >> 16) ^ wxPG_ITERATOR_MASK_OP_PARENT) &
|
||||
wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF);
|
||||
}
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_2
|
||||
#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME
|
||||
#pragma deprecated(wxPG_ITERATOR_CREATE_MASKS)
|
||||
#endif
|
||||
#define wxPG_ITERATOR_CREATE_MASKS wxPG_DEPRECATED_MACRO_VALUE(wxPGCreateIteratorMasks,\
|
||||
"wxPG_ITERATOR_CREATE_MASKS is deprecated. Call wxPGCreateIteratorMasks instead.")
|
||||
#endif // WXWIN_COMPATIBILITY_3_2
|
||||
|
||||
// Base for wxPropertyGridIterator classes.
|
||||
class WXDLLIMPEXP_PROPGRID wxPropertyGridIteratorBase
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags
|
|||
|
||||
m_property = property;
|
||||
|
||||
wxPG_ITERATOR_CREATE_MASKS(flags, m_itemExMask, m_parentExMask)
|
||||
wxPGCreateIteratorMasks(flags, m_itemExMask, m_parentExMask);
|
||||
|
||||
// Need to skip first?
|
||||
if ( property && property->HasFlag(m_itemExMask) )
|
||||
|
|
@ -401,7 +401,9 @@ wxPGProperty* wxPropertyGridPageState::GetLastItem( int flags )
|
|||
if ( !m_properties->HasAnyChild() )
|
||||
return nullptr;
|
||||
|
||||
wxPG_ITERATOR_CREATE_MASKS(flags, wxPGPropertyFlags itemExMask, wxPGPropertyFlags parentExMask)
|
||||
wxPGPropertyFlags itemExMask;
|
||||
wxPGPropertyFlags parentExMask;
|
||||
wxPGCreateIteratorMasks(flags, itemExMask, parentExMask);
|
||||
|
||||
// First, get last child of last parent if children of 'pwc' should be iterated through
|
||||
wxPGProperty* pwc = m_properties->Last();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue