示例#1
0
        public override void _Ready()
        {
            base._Ready();

            editorInterface = GodotSharpEditor.Instance.GetEditorInterface();

            var editorBaseControl = editorInterface.GetBaseControl();

            SizeFlagsVertical = (int)SizeFlags.ExpandFill;
            SetAnchorsAndMarginsPreset(LayoutPreset.Wide);

            panelTabs = new TabContainer
            {
                TabAlign          = TabContainer.TabAlignEnum.Left,
                RectMinSize       = new Vector2(0, 228) * EditorScale,
                SizeFlagsVertical = (int)SizeFlags.ExpandFill
            };
            panelTabs.AddStyleboxOverride("panel", editorBaseControl.GetStylebox("DebuggerPanel", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_fg", editorBaseControl.GetStylebox("DebuggerTabFG", "EditorStyles"));
            panelTabs.AddStyleboxOverride("tab_bg", editorBaseControl.GetStylebox("DebuggerTabBG", "EditorStyles"));
            AddChild(panelTabs);

            {
                // Builds tab
                panelBuildsTab = new VBoxContainer
                {
                    Name = "Builds".TTR(),
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelTabs.AddChild(panelBuildsTab);

                var toolBarHBox = new HBoxContainer {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(toolBarHBox);

                var buildProjectBtn = new Button
                {
                    Text      = "Build Project".TTR(),
                    FocusMode = FocusModeEnum.None
                };
                buildProjectBtn.Connect("pressed", this, nameof(BuildProjectPressed));
                toolBarHBox.AddChild(buildProjectBtn);

                toolBarHBox.AddSpacer(begin: false);

                warningsBtn = new ToolButton
                {
                    Text       = "Warnings".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                warningsBtn.Connect("toggled", this, nameof(_WarningsToggled));
                toolBarHBox.AddChild(warningsBtn);

                errorsBtn = new ToolButton
                {
                    Text       = "Errors".TTR(),
                    ToggleMode = true,
                    Pressed    = true,
                    Visible    = false,
                    FocusMode  = FocusModeEnum.None
                };
                errorsBtn.Connect("toggled", this, nameof(_ErrorsToggled));
                toolBarHBox.AddChild(errorsBtn);

                toolBarHBox.AddSpacer(begin: false);

                viewLogBtn = new Button
                {
                    Text      = "View log".TTR(),
                    FocusMode = FocusModeEnum.None,
                    Visible   = false
                };
                viewLogBtn.Connect("pressed", this, nameof(_ViewLogPressed));
                toolBarHBox.AddChild(viewLogBtn);

                var hsc = new HSplitContainer
                {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    SizeFlagsVertical   = (int)SizeFlags.ExpandFill
                };
                panelBuildsTab.AddChild(hsc);

                buildTabsList = new ItemList {
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill
                };
                buildTabsList.Connect("item_selected", this, nameof(_BuildTabsItemSelected));
                buildTabsList.Connect("nothing_selected", this, nameof(_BuildTabsNothingSelected));
                hsc.AddChild(buildTabsList);

                buildTabs = new TabContainer
                {
                    TabAlign            = TabContainer.TabAlignEnum.Left,
                    SizeFlagsHorizontal = (int)SizeFlags.ExpandFill,
                    TabsVisible         = false
                };
                hsc.AddChild(buildTabs);
            }
        }