Esempio n. 1
0
        public GenericEditorComponent(MyGUIViewHost viewHost, GenericEditorView view, bool horizontalAlignment = true)
            : base(horizontalAlignment ? "Medical.GUI.Editor.GenericEditor.GenericEditorComponent.layout" : "Medical.GUI.Editor.GenericEditor.GenericEditorVerticalComponent.layout", viewHost)
        {
            this.name             = view.Name;
            this.editorController = view.EditorController;
            this.uiCallback       = view.EditUICallback;

            tree         = new Tree((ScrollView)widget.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, view.EditUICallback);

            tableScroller = (ScrollView)widget.findWidget("TableScroller");
            table         = new ResizingTable(tableScroller);

            addRemoveButtons = new AddRemoveButtons((Button)widget.findWidget("Add"), (Button)widget.findWidget("Remove"), widget.findWidget("AddRemovePanel"));
            addRemoveButtons.VisibilityChanged += addRemoveButtons_VisibilityChanged;
            propTable = new PropertiesTable(table, view.EditUICallback, addRemoveButtons);

            objectEditor = new ObjectEditor(editTreeView, propTable, view.EditUICallback);

            gap = tableScroller.Bottom - addRemoveButtons.Top;

            EditInterfaceHandler editInterfaceHandler = viewHost.Context.getModel <EditInterfaceHandler>(EditInterfaceHandler.DefaultName);

            if (editInterfaceHandler != null)
            {
                editInterfaceHandler.setEditInterfaceConsumer(this);
            }

            widget.RootKeyChangeFocus += new MyGUIEvent(widget_RootKeyChangeFocus);

            splitter = new Splitter(widget.findWidget("Splitter"));
            splitter.Widget1Resized += split => tree.layout();
            splitter.Widget2Resized += split => table.layout();
        }
 public ViewHostComponent createViewHostComponent(MyGUIView view, AnomalousMvcContext context, MyGUIViewHost viewHost)
 {
     if (view is GenericEditorView)
     {
         GenericEditorView      genericEditorView = (GenericEditorView)view;
         GenericEditorComponent component         = new GenericEditorComponent(viewHost, genericEditorView, genericEditorView.HorizontalAlignment);
         component.CurrentEditInterface = genericEditorView.EditInterface;
         return(component);
     }
     if (view is GenericPropertiesFormView)
     {
         GenericPropertiesFormComponent component = new GenericPropertiesFormComponent(viewHost, (GenericPropertiesFormView)view);
         return(component);
     }
     if (view is ExpandingGenericEditorView)
     {
         return(new ExpandingGenericEditor(viewHost, (ExpandingGenericEditorView)view));
     }
     return(null);
 }