public SideBarTool(SideBar sideBar, int height, string name = "Item") : base(sideBar.parent, sideBar.Width - sideBar.Padding * 2, height, sideBar.Pos + new Vector2(sideBar.Padding) + sideBar.GetToolOffset(height), Parameters.None, null, sideBar.TextColor, 1) { Name = name; TextOffset = new Vector2(5, (int)(-TextSize.Y / 2)); GenerateBorder(1); sideBar.parent.inputHandler.MouseLeftPressedEvent += OnMouseLeftPressed; sideBar.parent.inputHandler.MouseLeftReleasedEvent += OnMouseLeftReleased; sideBar.parent.inputHandler.MouseMovedEvent += OnMouseMoved; }
public void InitializeUI() { int topBarHeight = 24; int sideBarWidth = 240; Parameters parameters = Parameters.Filled; TopBar = new TopBar(parent, parent.ScreenWidth / 3, topBarHeight, new Vector2(parent.ScreenWidth / 3, 0), parameters, FillColor); FileMenu fileMenu = new FileMenu(TopBar); TopBar.AddButton(fileMenu); TopBar.AddButton(new EditMenu(TopBar)); parent.objectHandler.InputStateChanged += TopBar.OnInputStateChanged; SideBar leftSideBar = new SideBar(parent, sideBarWidth, parent.ScreenHeight, Vector2.Zero, parameters, FillColor); leftSideBar.AddTool(new TextureCatalog(leftSideBar)); leftSideBar.AddTool(new GridTools(leftSideBar)); SideBar rightSideBar = new SideBar(parent, sideBarWidth, parent.ScreenHeight, new Vector2(parent.ScreenWidth - sideBarWidth, 0), parameters, FillColor); rightSideBar.AddTool(new SpriteScale(rightSideBar)); rightSideBar.AddTool(new SpriteZValue(rightSideBar)); rightSideBar.AddTool(new SpriteColorTint(rightSideBar)); rightSideBar.AddTool(new SpriteRotation(rightSideBar)); rightSideBar.AddTool(new SpriteFlip(rightSideBar)); DialogWindow saveDialog = new SaveDialog(parent); fileMenu.saveButton.ButtonPressed += saveDialog.Show; DialogWindow loadDialog = new LoadDialog(parent); fileMenu.loadButton.ButtonPressed += loadDialog.Show; DialogWindow newProjectDialog = new NewDialog(parent); fileMenu.newProjectButton.ButtonPressed += newProjectDialog.Show; uiObjects.Add(TopBar); uiObjects.Add(leftSideBar); uiObjects.Add(rightSideBar); uiObjects.Add(saveDialog); uiObjects.Add(loadDialog); uiObjects.Add(newProjectDialog); }