public UTinyModulePanel(IRegistry registry, UTinyProject.Reference project, UTinyModule.Reference mainModule, State state)
        {
            Registry   = registry;
            Project    = project;
            MainModule = mainModule;

            if (null == state.TreeState)
            {
                state.TreeState = new UTinyTreeState();
            }

            // @TODO Find a way to move this to the base class
            state.TreeState.Init(UTinyModuleTreeView.CreateMultiColumnHeaderState());

            var treeView = new UTinyModuleTreeView(state.TreeState, new UTinyModuleTreeModel(Registry, Project, MainModule));

            // Add an empty toolbar for consistency
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Search
            {
                Alignment    = UTinyToolbar.Alignment.Center,
                SearchString = treeView.SearchString,
                Changed      = searchString =>
                {
                    treeView.SearchString = searchString;
                }
            });

            AddElement(toolbar);
            AddElement(treeView);
        }
        private UTinyToolbar CreateLeftToolbar()
        {
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Menu
            {
                Name  = "Add",
                Items = new []
                {
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Add Explicit Reference",
                        Action = AddExplicitReference
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Remove Explicit Reference",
                        Action = RemoveExplicitReference
                    }
                }
            });

            toolbar.Add(new UTinyToolbar.Search
            {
                Alignment    = UTinyToolbar.Alignment.Center,
                SearchString = m_TreeView.State.SearchString,
                Changed      = searchString =>
                {
                    m_TreeView.State.SearchString = m_TreeView.searchString = searchString;
                }
            });

            return(toolbar);
        }
        private UTinyToolbar CreateToolbar()
        {
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Menu()
            {
                Alignment = UTinyToolbar.Alignment.Left,
                Name      = "Create",
                Items     = new []
                {
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "EntityGroup",
                        Action = CreateEntityGroup
                    }
                }
            });

            toolbar.Add(new UTinyToolbar.Search
            {
                Alignment    = UTinyToolbar.Alignment.Center,
                SearchString = m_TreeView.SearchString,
                Changed      = searchString =>
                {
                    m_TreeView.SearchString = searchString;
                }
            });

            toolbar.Add(new UTinyToolbar.Popup
            {
                Alignment = UTinyToolbar.Alignment.Right,
                Name      = "Filter",
                Content   = new UTinyToolbar.FilterPopup
                {
                    Items = new []
                    {
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Project Only",
                            State   = m_TreeView.State.FilterProjectOnly,
                            Changed = state => {
                                m_TreeView.State.FilterProjectOnly = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        }
                    }
                }
            });

            return(toolbar);
        }
        private UTinyToolbar CreateRightToolbar()
        {
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Button
            {
                Alignment = UTinyToolbar.Alignment.Right,
                Icon      = UTinyIcons.System,
                Action    = () =>
                {
                    var window      = EditorWindow.GetWindow <UTinySystemExecutionGraphWindow>("System Execution");
                    window.Registry = m_Registry;
                    window.Module   = m_MainModule;
                }
            });

            return(toolbar);
        }
        private UTinyToolbar CreateLeftToolbar()
        {
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Menu()
            {
                Alignment = UTinyToolbar.Alignment.Left,
                Name      = "Create",
                Items     = new[]
                {
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "System",
                        Action = CreateSystem
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "System (External)",
                        Action = CreateSystemExternal
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Code",
                        Action = CreateCodeBlock
                    }
                }
            });

            toolbar.Add(new UTinyToolbar.Search
            {
                Alignment    = UTinyToolbar.Alignment.Center,
                SearchString = m_TreeView.SearchString,
                Changed      = searchString => { m_TreeView.SearchString = searchString; }
            });

            toolbar.Add(new UTinyToolbar.Popup
            {
                Alignment = UTinyToolbar.Alignment.Right,
                Name      = "Filter",
                Content   = new UTinyToolbar.FilterPopup
                {
                    Items = new[]
                    {
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Project Only",
                            State   = m_TreeView.State.FilterProjectOnly,
                            Changed = state =>
                            {
                                m_TreeView.State.FilterProjectOnly = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        },
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "System",
                            State   = m_TreeView.State.FilterSystems,
                            Changed = state =>
                            {
                                m_TreeView.State.FilterSystems = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        },
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Code",
                            State   = m_TreeView.State.FilterScripts,
                            Changed = state =>
                            {
                                m_TreeView.State.FilterScripts = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        }
                    }
                }
            });

            return(toolbar);
        }
Ejemplo n.º 6
0
        private UTinyToolbar CreateToolbar()
        {
            var toolbar = new UTinyToolbar();

            toolbar.Add(new UTinyToolbar.Menu
            {
                Alignment = UTinyToolbar.Alignment.Left,
                Name      = "Create",
                Items     = new []
                {
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Component",
                        Action = CreateComponent
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Struct",
                        Action = CreateStruct
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path   = "Enum",
                        Action = CreateEnum
                    },
                    new UTinyToolbar.Menu.Item
                    {
                        Path       = "Field",
                        Action     = CreateField,
                        Validation = () => m_TreeView.GetSelected().Any(i => i is UTinyType.Reference)
                    }
                }
            });

            toolbar.Add(new UTinyToolbar.Search
            {
                Alignment    = UTinyToolbar.Alignment.Center,
                SearchString = m_TreeView.SearchString,
                Changed      = searchString =>
                {
                    m_TreeView.SearchString = searchString;
                }
            });

            toolbar.Add(new UTinyToolbar.Popup
            {
                Alignment = UTinyToolbar.Alignment.Right,
                Name      = "Filter",
                Content   = new UTinyToolbar.FilterPopup
                {
                    Items = new []
                    {
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Project Only",
                            State   = m_TreeView.State.FilterProjectOnly,
                            Changed = state => {
                                m_TreeView.State.FilterProjectOnly = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        },
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Component",
                            State   = m_TreeView.State.FilterComponents,
                            Changed = state => {
                                m_TreeView.State.FilterComponents = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        },
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Struct",
                            State   = m_TreeView.State.FilterStructs,
                            Changed = state => {
                                m_TreeView.State.FilterStructs = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        },
                        new UTinyToolbar.FilterPopup.Item
                        {
                            Name    = "Enum",
                            State   = m_TreeView.State.FilterEnums,
                            Changed = state => {
                                m_TreeView.State.FilterEnums = state;
                                m_TreeView.SetDirty();
                                m_TreeView.Repaint();
                            }
                        }
                    }
                }
            });

            return(toolbar);
        }
        private UTinyToolbar CreateRightToolbar()
        {
            var toolbar = new UTinyToolbar();

            return(toolbar);
        }