+void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
+ wxPropertyGrid* propgrid )
+{
+ //
+ // Called after property has been added to grid or page
+ // (so propgrid can be NULL, too).
+
+ wxPGProperty* parent = m_parent;
+ bool parentIsRoot = parent->IsKindOf(CLASSINFO(wxPGRootProperty));
+
+ m_parentState = pageState;
+
+#if wxPG_COMPATIBILITY_1_4
+ // Make sure deprecated virtual functions are not implemented
+ wxString s = GetValueAsString( 0xFFFF );
+ wxASSERT_MSG( s == g_invalidStringContent,
+ "Implement ValueToString() instead of GetValueAsString()" );
+#endif
+
+ if ( !parentIsRoot && !parent->IsCategory() )
+ {
+ m_cells = parent->m_cells;
+ }
+
+ // If in hideable adding mode, or if assigned parent is hideable, then
+ // make this one hideable.
+ if (
+ ( !parentIsRoot && parent->HasFlag(wxPG_PROP_HIDDEN) ) ||
+ ( propgrid && (propgrid->HasInternalFlag(wxPG_FL_ADDING_HIDEABLES)) )
+ )
+ SetFlag( wxPG_PROP_HIDDEN );
+
+ // Set custom image flag.
+ int custImgHeight = OnMeasureImage().y;
+ if ( custImgHeight < 0 )
+ {
+ SetFlag(wxPG_PROP_CUSTOMIMAGE);
+ }
+
+ if ( propgrid && (propgrid->HasFlag(wxPG_LIMITED_EDITING)) )
+ SetFlag(wxPG_PROP_NOEDITOR);
+
+ // Make sure parent has some parental flags
+ if ( !parent->HasFlag(wxPG_PROP_PARENTAL_FLAGS) )
+ parent->SetParentalType(wxPG_PROP_MISC_PARENT);
+
+ if ( !IsCategory() )
+ {
+ // This is not a category.
+
+ // Depth.
+ //
+ unsigned char depth = 1;
+ if ( !parentIsRoot )
+ {
+ depth = parent->m_depth;
+ if ( !parent->IsCategory() )
+ depth++;
+ }
+ m_depth = depth;
+ unsigned char greyDepth = depth;
+
+ if ( !parentIsRoot )
+ {
+ wxPropertyCategory* pc;
+
+ if ( parent->IsCategory() )
+ pc = (wxPropertyCategory* ) parent;
+ else
+ // This conditional compile is necessary to
+ // bypass some compiler bug.
+ pc = pageState->GetPropertyCategory(parent);
+
+ if ( pc )
+ greyDepth = pc->GetDepth();
+ else
+ greyDepth = parent->m_depthBgCol;
+ }
+
+ m_depthBgCol = greyDepth;
+ }
+ else
+ {
+ // This is a category.
+
+ // depth
+ unsigned char depth = 1;
+ if ( !parentIsRoot )
+ {
+ depth = parent->m_depth + 1;
+ }
+ m_depth = depth;
+ m_depthBgCol = depth;
+ }
+
+ //
+ // Has initial children
+ if ( GetChildCount() )
+ {
+ // Check parental flags
+ wxASSERT_MSG( (m_flags & wxPG_PROP_PARENTAL_FLAGS),
+ "Call SetFlag(wxPG_PROP_MISC_PARENT) or"
+ "SetFlag(wxPG_PROP_AGGREGATE) before calling"
+ "wxPGProperty::AddChild()." );
+
+ if ( HasFlag(wxPG_PROP_AGGREGATE) )
+ {
+ // Properties with private children are not expanded by default.
+ SetExpanded(false);
+ }
+ else if ( propgrid && propgrid->HasFlag(wxPG_HIDE_MARGIN) )
+ {
+ // ...unless it cannot be expanded by user and therefore must
+ // remain visible at all times
+ SetExpanded(true);
+ }
+
+ //
+ // Prepare children recursively
+ for ( unsigned int i=0; i<GetChildCount(); i++ )
+ {
+ wxPGProperty* child = Item(i);
+ child->InitAfterAdded(pageState, pageState->GetGrid());
+ }
+
+ if ( propgrid && (propgrid->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES) )
+ SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED, true);
+ }
+}
+