Inheritance: ControlBase
        public CircleToolPanel()
        {
            Title = "Circle Status";

            statusBox = new DrawingSurface(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 2);
            RedrawBox();
            Controls = new ControlBase[] { statusBox };
        }
        public AnimationFramesPanel(Action<TextSurfaceBasic> frameChangeCallback)
        {
            Title = "Frames";

            removeSelected = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += removeSelected_ButtonClicked;

            moveSelectedUp = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text = "Move Up";
            moveSelectedUp.ButtonClicked += moveSelectedUp_ButtonClicked;

            moveSelectedDown = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text = "Move Down";
            moveSelectedDown.ButtonClicked += moveSelectedDown_ButtonClicked;

            addNewFrame = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            addNewFrame.Text = "Add New";
            addNewFrame.ButtonClicked += addNewFrame_ButtonClicked;

            addNewFrameFromFile = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            addNewFrameFromFile.Text = "Load From File";
            addNewFrameFromFile.ButtonClicked += addNewFrameFromFile_ButtonClicked;

            saveFrameToFile = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            saveFrameToFile.Text = "Save Frame to File";
            saveFrameToFile.ButtonClicked += saveFrameToFile_ButtonClicked;

            clonePreviousFrame = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            clonePreviousFrame.Text = "Copy prev. frame";
            clonePreviousFrame.ButtonClicked += clonePreviousFrame_ButtonClicked;

            // Frames area
            framesCounterBox = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 1);

            nextFrame = new Button(4, 1);
            nextFrame.Text = ">>";
            nextFrame.ShowEnds = false;
            nextFrame.ButtonClicked += nextFrame_ButtonClicked;

            previousFrame = new Button(4, 1);
            previousFrame.Text = "<<";
            previousFrame.ShowEnds = false;
            previousFrame.ButtonClicked += previousFrame_ButtonClicked;

            this.frameChangeCallback = frameChangeCallback;

            Controls = new ControlBase[] { framesCounterBox, previousFrame, nextFrame, removeSelected, addNewFrame, clonePreviousFrame, moveSelectedUp, moveSelectedDown, addNewFrameFromFile, saveFrameToFile};
        }
        public GameObjectManagementPanel()
        {
            Title = "Entities";
            GameObjectList = new ListBox<EntityListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            GameObjectList.HideBorder = true;
            GameObjectList.SelectedItemChanged += GameObject_SelectedItemChanged;
            GameObjectList.CompareByReference = true;

            removeSelected = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += RemoveSelected_ButtonClicked;

            moveSelectedUp = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text = "Move Up";
            moveSelectedUp.ButtonClicked += MoveSelectedUp_ButtonClicked;

            moveSelectedDown = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text = "Move Down";
            moveSelectedDown.ButtonClicked += MoveSelectedDown_ButtonClicked;

            renameLayer = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            renameLayer.Text = "Rename";
            renameLayer.ButtonClicked += RenameEntity_ButtonClicked;

            importGameObject = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            importGameObject.Text = "Import File";
            importGameObject.ButtonClicked += ImportEntity_ButtonClicked;

            drawGameObjectsCheckbox = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawGameObjectsCheckbox.IsSelected = true;
            drawGameObjectsCheckbox.Text = "Draw Objects";

            animationListTitle = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 2);
            animationListTitle.Print(0, 0, "Animations", Settings.Green);

            animationsListBox = new ListBox<AnimationListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            animationsListBox.SelectedItemChanged += AnimationList_SelectedItemChanged;
            animationsListBox.HideBorder = true;
            animationsListBox.CompareByReference = true;

            playAnimationButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            playAnimationButton.Text = "Play Animation";
            playAnimationButton.ButtonClicked += (o, e) => { if (animationsListBox.SelectedItem != null) ((AnimatedTextSurface)animationsListBox.SelectedItem).Restart(); };

            Controls = new ControlBase[] { GameObjectList, removeSelected, moveSelectedUp, moveSelectedDown, renameLayer, importGameObject, null, drawGameObjectsCheckbox, null, animationListTitle,animationsListBox, null, playAnimationButton };

            GameObject_SelectedItemChanged(null, null);
        }
        public RegionManagementPanel()
        {
            Title = "Zones";
            GameObjectList = new ListBox<EntityListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            GameObjectList.HideBorder = true;
            GameObjectList.SelectedItemChanged += GameObject_SelectedItemChanged;
            GameObjectList.CompareByReference = true;

            removeSelected = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += RemoveSelected_ButtonClicked;

            moveSelectedUp = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text = "Move Up";
            moveSelectedUp.ButtonClicked += MoveSelectedUp_ButtonClicked;

            moveSelectedDown = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text = "Move Down";
            moveSelectedDown.ButtonClicked += MoveSelectedDown_ButtonClicked;

            renameZoneButton = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            renameZoneButton.Text = "Rename";
            renameZoneButton.ButtonClicked += RenameZone_ButtonClicked;

            addZoneButton = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            addZoneButton.Text = "Add New";
            addZoneButton.ButtonClicked += AddZone_ButtonClicked;

            editSettings = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            editSettings.Text = "Edit Settings";
            editSettings.ButtonClicked += EditSettings_ButtonClicked;

            zoneColorPresenter = new SadConsoleEditor.Controls.ColorPresenter("Zone Color", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            zoneColorPresenter.SelectedColor = Color.Aqua;
            zoneColorPresenter.IsEnabled = false;
            zoneColorPresenter.ColorChanged += ZoneColorPresenter_ColorChanged;

            drawZonesCheckbox = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawZonesCheckbox.IsSelected = true;
            drawZonesCheckbox.Text = "Draw zones";

            propertySurface = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 2);

            Controls = new ControlBase[] { addZoneButton, null, GameObjectList, removeSelected, moveSelectedUp, moveSelectedDown, renameZoneButton, editSettings, null, drawZonesCheckbox, null, zoneColorPresenter, propertySurface };

            GameObject_SelectedItemChanged(null, null);
        }
        public FilesPanel()
        {
            Title = "File";

            NewButton = new Button(7, 1)
            {
                Text = "New",
                CanUseKeyboard = false,
            };
            NewButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowNewEditorPopup();

            LoadButton = new Button(8, 1)
            {
                Text = "Load",
            };
            LoadButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowLoadEditorPopup();

            SaveButton = new Button(8, 1)
            {
                Text = "Save",
            };
            SaveButton.ButtonClicked += (o, e) => EditorConsoleManager.SaveEditor();

            ResizeButton = new Button(10, 1)
            {
                Text = "Resize",
            };
            ResizeButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowResizeEditorPopup();

            CloseButton = new Button(9, 1)
            {
                Text = "Close",
            };
            CloseButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowCloseConsolePopup();

            DocumentsListbox = new ListBox<EditorListBoxItem>(Consoles.ToolPane.PanelWidthControls, 6);
            DocumentsListbox.HideBorder = true;
            DocumentsListbox.CompareByReference = true;

            DocumentsListbox.SelectedItemChanged += DocumentsListbox_SelectedItemChanged;

            documentsTitle = new DrawingSurface(13, 1);
            documentsTitle.Fill(Settings.Green, Settings.Color_MenuBack, 0, null);
            documentsTitle.Print(0, 0, new ColoredString("Opened Files", Settings.Green, Settings.Color_MenuBack));

            Controls = new ControlBase[] { NewButton, LoadButton, SaveButton, ResizeButton, CloseButton, documentsTitle, DocumentsListbox };
        }
        public GameObjectNamePanel()
        {
            Title = "Game Object";

            nameTitle = new DrawingSurface(Consoles.ToolPane.PanelWidth - 3, 2);

            setName = new Button(3, 1);
            setName.ShowEnds = false;
            setName.Text = "Set";

            setName.ButtonClicked += (s, e) =>
            {
                Windows.RenamePopup rename = new Windows.RenamePopup(entity.Name);
                rename.Closed += (s2, e2) => { if (rename.DialogResult) entity.Name = rename.NewName; PrintName(); };
                rename.Center();
                rename.Show(true);
            };

            Controls = new ControlBase[] { setName, nameTitle };
        }
        public AnimationsPanel(Action<AnimatedTextSurface> animationChangeCallback)
        {
            Title = "Animations";
            animations = new ListBox(Consoles.ToolPane.PanelWidthControls, 4);
            animations.HideBorder = true;
            animations.SelectedItemChanged += animations_SelectedItemChanged;
            animations.CompareByReference = true;

            removeSelected = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += removeAnimation_ButtonClicked;

            addNewAnimation = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            addNewAnimation.Text = "Add New";
            addNewAnimation.ButtonClicked += addNewAnimation_ButtonClicked;

            renameAnimation = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            renameAnimation.Text = "Rename";
            renameAnimation.ButtonClicked += renameAnimation_ButtonClicked;

            addNewAnimationFromFile = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            addNewAnimationFromFile.Text = "Import Anim.";
            addNewAnimationFromFile.ButtonClicked += addNewAnimationFromFile_ButtonClicked;

            saveAnimationToFile = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            saveAnimationToFile.Text = "Export Anim.";
            saveAnimationToFile.ButtonClicked += saveAnimationToFile_ButtonClicked;

            changeSpeedButton = new Button(3, 1);
            changeSpeedButton.ShowEnds = false;
            changeSpeedButton.Text = "Set";
            changeSpeedButton.ButtonClicked += changeSpeedButton_ButtonClicked;

            cloneSelectedAnimationButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            cloneSelectedAnimationButton.Text = "Clone Sel. Anim";
            cloneSelectedAnimationButton.ButtonClicked += cloneSelectedAnimation_ButtonClicked;

            reverseAnimationButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            reverseAnimationButton.Text = "Reverse Animation";
            reverseAnimationButton.ButtonClicked += reverseAnimation_ButtonClicked; ;

            setCenterButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            setCenterButton.Text = "Set Center";
            setCenterButton.ButtonClicked += (s, e) => invokeCustomToolCallback(CustomTool.Center);

            setBoundingBoxButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            setBoundingBoxButton.Text = "Set Collision";
            setBoundingBoxButton.ButtonClicked += (s, e) => invokeCustomToolCallback(CustomTool.CollisionBox);

            animationSpeedLabel = new DrawingSurface(Consoles.ToolPane.PanelWidthControls - changeSpeedButton.Width, 1);

            repeatCheck = new CheckBox(Consoles.ToolPane.PanelWidthControls, 1);
            repeatCheck.Text = "Repeat";
            repeatCheck.IsSelectedChanged += repeatCheck_IsSelectedChanged;

            playPreview = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            playPreview.Text = "Play Preview";
            playPreview.ButtonClicked += playPreview_ButtonClicked; ;

            this.animationChangeCallback = animationChangeCallback;
            //_invokeCustomToolCallback = invokeCustomToolCallback;

            Controls = new ControlBase[] { animations, null, removeSelected, addNewAnimation, renameAnimation, cloneSelectedAnimationButton, null, addNewAnimationFromFile, saveAnimationToFile, null, playPreview, null, animationSpeedLabel, changeSpeedButton, repeatCheck, null, reverseAnimationButton };
        }
        void RebuildProperties(Zone zone)
        {
            if (zone.Settings.Count == 0)
            {
                propertySurface.IsVisible = false;
            }
            else
            {
                propertySurface.IsVisible = true;
            }

            if (propertySurface.IsVisible)
            {
                var drawing = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, (zone.Settings.Count * 2) + 1);

                previousProperties = new Dictionary<string, string>();
                int y = 1;
                drawing.Print(0, 0, "Zone Settings", Settings.Green);
                foreach (var setting in zone.Settings)
                {
                    drawing.Print(0, y, setting.Key.Length > Consoles.ToolPane.PanelWidthControls ? setting.Key.Substring(0, Consoles.ToolPane.PanelWidthControls) : setting.Key, Settings.Yellow);
                    drawing.Print(1, y + 1, setting.Value.Length > Consoles.ToolPane.PanelWidthControls - 1 ? setting.Value.Substring(0, Consoles.ToolPane.PanelWidthControls - 1) : setting.Value, Settings.Grey);
                    previousProperties[setting.Key] = setting.Value;
                    y += 2;
                }

                propertySurface.TextSurface = drawing.TextSurface;
            }
        }