private void AddNewWidget(UEditorWidgetBase newControl) { //TODO: This functionality is already getting achieved by the onContainerChange() call, work out how to decom this //and still keep the select widget working. //Create a new hierarchy widget UEditorWidgetFoldout __newHierarchyWidget = UWidget.Create <UEditorWidgetFoldout>(); __newHierarchyWidget.BindTo(newControl, "Name"); __newHierarchyWidget.ObjectID = newControl.ObjectID; __newHierarchyWidget.LayoutMode = ePositioningLayout.Layout; //__newHierarchyWidget.OnClick += __newFoldout_OnClick; if (newControl.GetType().IsSubclassOf(typeof(UEditorPanelBase)) == false) { __newHierarchyWidget.BaseStyle = "label"; } Canvas.CurrentContainer.AddChild(newControl); UEditorWidgetFoldout __containerInHierarchy = (UEditorWidgetFoldout)UWidget.FindWidgetById(this.HierarchyContainer, Canvas.CurrentContainer.ObjectID); __newHierarchyWidget.IndentLevel = __containerInHierarchy.IndentLevel + 1; //Select the new control this.__newFoldout_OnClick(__newHierarchyWidget, new System.EventArgs()); }
void Hierarchy_onContainerChange(IWidgetContainer sender) { //Find the widget in the hierarchy UEditorWidgetBase __hierarchyContainer = UWidget.FindWidgetById(this.HierarchyContainer, sender.ObjectID); if (__hierarchyContainer != null) { BuildHericRecursive((UEditorWidgetFoldout)__hierarchyContainer, sender.Children); } }