public EditInterfaceTreeNode(EditInterface editInterface, EditInterfaceTreeView editInterfaceTreeView)
            : base(editInterface.getName())
        {
            if (editInterface.IconReferenceTag != null)
            {
                this.ImageResource = editInterface.IconReferenceTag.ToString();
            }

            this.editInterfaceTreeView = editInterfaceTreeView;

            this.editInterface = editInterface;
            editInterface.OnSubInterfaceAdded    += editInterface_OnSubInterfaceAdded;
            editInterface.OnSubInterfaceRemoved  += editInterface_OnSubInterfaceRemoved;
            editInterface.OnBackColorChanged     += editInterface_OnBackColorChanged;
            editInterface.OnForeColorChanged     += editInterface_OnForeColorChanged;
            editInterface.OnIconReferenceChanged += editInterface_OnIconReferenceChanged;
            editInterface.OnNameChanged          += editInterface_OnNameChanged;

            if (editInterface.hasSubEditInterfaces())
            {
                foreach (EditInterface subInterface in editInterface.getSubEditInterfaces())
                {
                    this.Children.add(new EditInterfaceTreeNode(subInterface, editInterfaceTreeView));
                }
            }
        }
        public void setEditInterface(EditInterface editInterface, object editingObject, PropertiesEditorEvent FieldChangedCallback)
        {
            objectEditor.EditInterface = editInterface;
            Caption = editInterface.getName();

            currentEditingObject        = editingObject;
            currentFieldChangedCallback = FieldChangedCallback;

            if (AutoExpand)
            {
                editTreeView.expandAll();
            }

            if (MainInterfaceChanged != null)
            {
                MainInterfaceChanged.Invoke(editInterface, editingObject);
            }

            if (ActiveInterfaceChanged != null)
            {
                ActiveInterfaceChanged.Invoke(editInterface, editingObject);
            }
        }
Beispiel #3
0
        public ExpandingNode(EditInterface editInterface, Widget parentWidget, GuiFrameworkUICallback uiCallback, ExpandingNode parent = null)
            : base("Anomalous.GuiFramework.Editor.GUI.ExpandingEditInterfaceViewer.ExpandingNode.layout")
        {
            this.uiCallback = uiCallback;
            this.parent     = parent;

            widget.attachToWidget(parentWidget);
            defaultHeight = widget.Height;

            caption         = (TextBox)widget.findWidget("Caption");
            caption.Caption = editInterface.getName();

            expandButton = new CheckButton((Button)widget.findWidget("ExpandButton"));
            expandButton.CheckedChanged += new MyGUIEvent(expandButton_CheckedChanged);

            childArea      = widget.findWidget("ChildArea");
            propertiesForm = new PropertiesForm(childArea, uiCallback);
            propertiesForm.LayoutChanged += propertiesForm_LayoutChanged;

            this.editInterface = editInterface;
            editInterface.OnSubInterfaceAdded   += editInterface_OnSubInterfaceAdded;
            editInterface.OnSubInterfaceRemoved += editInterface_OnSubInterfaceRemoved;
        }
        void editInterface_OnSubInterfaceRemoved(EditInterface editInterface)
        {
            EditInterfaceTreeNode matchingNode = null;

            foreach (EditInterfaceTreeNode node in Children)
            {
                if (node.EditInterface == editInterface)
                {
                    matchingNode = node;
                    break;
                }
            }
            if (matchingNode != null)
            {
                editInterfaceTreeView.nodeRemoved(this);
                this.Children.remove(matchingNode);
            }
            else
            {
                Log.Default.sendMessage("Malformed EditInterfaceTreeNodes the EditInterface {0} does not contain a child named {1} when remove was attempted.", LogLevel.Error, "Editor", this.editInterface.getName(), editInterface.getName());
            }
        }
 void editInterface_OnNameChanged(EditInterface editInterface)
 {
     this.Text = editInterface.getName();
 }