void OnCreated( wxObject* wxobject, wxWindow* /*wxparent*/ ) { // Get parent sizer wxObject* parent = GetManager()->GetParent( wxobject ); wxSizer* sizer = wxDynamicCast( parent, wxSizer ); if ( NULL == sizer ) { wxLogError( wxT("The parent of a SizerItem is either missing or not a wxSizer - this should not be possible!") ); return; } // Get child window wxObject* child = GetManager()->GetChild( wxobject, 0 ); if ( NULL == child ) { wxLogError( wxT("The SizerItem component has no child - this should not be possible!") ); return; } // Get IObject for property access IObject* obj = GetManager()->GetIObject( wxobject ); IObject* childObj = GetManager()->GetIObject( child ); // Add the spacer if ( _("spacer") == childObj->GetClassName() ) { sizer->Add( childObj->GetPropertyAsInteger( _("width") ), childObj->GetPropertyAsInteger( _("height") ), obj->GetPropertyAsInteger(_("proportion")), obj->GetPropertyAsInteger(_("flag")), obj->GetPropertyAsInteger(_("border")) ); return; } // Add the child ( window or sizer ) to the sizer wxWindow* windowChild = wxDynamicCast( child, wxWindow ); wxSizer* sizerChild = wxDynamicCast( child, wxSizer ); if ( windowChild != NULL ) { sizer->Add( windowChild, obj->GetPropertyAsInteger(_("proportion")), obj->GetPropertyAsInteger(_("flag")), obj->GetPropertyAsInteger(_("border"))); } else if ( sizerChild != NULL ) { sizer->Add( sizerChild, obj->GetPropertyAsInteger(_("proportion")), obj->GetPropertyAsInteger(_("flag")), obj->GetPropertyAsInteger(_("border"))); } else { wxLogError( wxT("The SizerItem component's child is not a wxWindow or a wxSizer or a spacer - this should not be possible!") ); } }
wxGBSizerItem* GetGBSizerItem( IObject* sizeritem, const wxGBPosition& position, const wxGBSpan& span, wxObject* child ) { IObject* childObj = GetManager()->GetIObject( child ); if ( _("spacer") == childObj->GetClassName() ) { return new wxGBSizerItem( childObj->GetPropertyAsInteger( _("width") ), childObj->GetPropertyAsInteger( _("height") ), position, span, sizeritem->GetPropertyAsInteger(_("flag")), sizeritem->GetPropertyAsInteger(_("border")), NULL ); } // Add the child ( window or sizer ) to the sizer wxWindow* windowChild = wxDynamicCast( child, wxWindow ); wxSizer* sizerChild = wxDynamicCast( child, wxSizer ); if ( windowChild != NULL ) { return new wxGBSizerItem( windowChild, position, span, sizeritem->GetPropertyAsInteger(_("flag")), sizeritem->GetPropertyAsInteger(_("border")), NULL ); } else if ( sizerChild != NULL ) { return new wxGBSizerItem( sizerChild, position, span, sizeritem->GetPropertyAsInteger(_("flag")), sizeritem->GetPropertyAsInteger(_("border")), NULL ); } else { wxLogError( wxT("The GBSizerItem component's child is not a wxWindow or a wxSizer or a Spacer - this should not be possible!") ); return NULL; } }