public override void SizeChanged(BaseEventArgs e) { base.SizeChanged(e); RedrawBox(); MainContainer.SetSize(Size.Width - 13, Size.Height - 4); StackPanel.SetWidth(MainContainer.Size.Width); MainContainer.VScrollBar.SetPosition(Size.Width - 10, 2); MainContainer.VScrollBar.SetSize(8, Size.Height - 4); }
public override void SizeChanged(BaseEventArgs e) { base.SizeChanged(e); if (Size.Width == 50 && Size.Height == 50) { return; } EventContainer.SetSize(Size.Width - 13, Size.Height - EventContainer.Position.Y); EventContainer.VScrollBar.SetPosition(Size.Width - 10, 34); EventContainer.VScrollBar.SetSize(8, Size.Height - 36); StackPanel.SetWidth(EventContainer.Size.Width - 2); Sprites["slider"].X = Size.Width - 11; (Sprites["slider"].Bitmap as SolidBitmap).SetSize(10, Size.Height - 34); }
public override void SizeChanged(BaseEventArgs e) { base.SizeChanged(e); ConnectionContainer.SetSize(Size.Width - 13, Size.Height - ConnectionContainer.Position.Y); ConnectionContainer.VScrollBar.SetPosition(Size.Width - 10, 34); ConnectionContainer.VScrollBar.SetSize(8, Size.Height - 36); StackPanel.SetWidth(ConnectionContainer.Size.Width - 2); Sprites["slider"].X = Size.Width - 11; (Sprites["slider"].Bitmap as SolidBitmap).SetSize(10, Size.Height - 34); if (NoConnectionsLabel != null && !NoConnectionsLabel.Disposed) { NoConnectionsLabel.SetWidth(StackPanel.Size.Width); // Forces a redraw NoConnectionsLabel.SetText(""); NoConnectionsLabel.SetText("This map does not have any map connections."); } }
public TilesPanel(IContainer Parent) : base(Parent) { Label Header = new Label(this); Header.SetText("Tiles"); Header.SetFont(Font.Get("Fonts/Ubuntu-B", 16)); Header.SetPosition(5, 5); Sprites["sep"] = new Sprite(this.Viewport, new SolidBitmap(288, 2, new Color(10, 23, 37))); Sprites["sep"].Y = 50; Sprites["slider"] = new Sprite(this.Viewport, new SolidBitmap(10, Size.Height - 34, new Color(10, 23, 37))); Sprites["slider"].Y = 53; this.OnWidgetSelected += WidgetSelected; CursorIM = new MouseInputManager(this); MainContainer = new Container(this); MainContainer.SetPosition(0, 53); MainContainer.VAutoScroll = true; VScrollBar vs = new VScrollBar(this); MainContainer.SetVScrollBar(vs); Cursor = new CursorWidget(MainContainer); Cursor.SetPosition(3, 8); Cursor.SetZIndex(1); MainStackPanel = new VStackPanel(MainContainer); MainStackPanel.SetWidth(264); MainStackPanel.SetPosition(8, 3); DrawToolsContainer = new Container(this); DrawToolsContainer.SetPosition(46, 22); DrawToolsContainer.SetSize(186, 28); DrawToolsContainer.Sprites["line1"] = new Sprite(DrawToolsContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73))); DrawToolsContainer.Sprites["line1"].X = 144; DrawToolsContainer.Sprites["line2"] = new Sprite(DrawToolsContainer.Viewport, new SolidBitmap(1, 26, new Color(28, 50, 73))); DrawToolsContainer.Sprites["line2"].X = 185; PencilButton = new IconButton(DrawToolsContainer); PencilButton.SetIcon(15, 0); PencilButton.SetSelected(true); FillButton = new IconButton(DrawToolsContainer); FillButton.SetIcon(16, 0); FillButton.SetPosition(32, 0); EllipseButton = new IconButton(DrawToolsContainer); EllipseButton.SetIcon(17, 0); EllipseButton.SetPosition(64, 0); RectButton = new IconButton(DrawToolsContainer); RectButton.SetIcon(18, 0); RectButton.SetPosition(96, 0); SelectButton = new IconButton(DrawToolsContainer); SelectButton.SetIcon(19, 0); SelectButton.SetPosition(128, 0); SelectButton.OnSelection += delegate(BaseEventArgs e) { MapViewer.Cursor.SetVisible(false); Cursor.SetPosition(0, 0); Cursor.SetVisible(false); }; SelectButton.OnDeselection += delegate(BaseEventArgs e) { UpdateCursor(); }; EraserButton = new IconButton(DrawToolsContainer); EraserButton.SetIcon(20, 0); EraserButton.SetPosition(160, 0); EraserButton.Toggleable = true; EraserButton.OnSelection += delegate(BaseEventArgs e) { if (AutotileIndex != -1 || TilesetIndex != -1 || TileStartX != -1 || TileEndX != -1 || TileStartY != -1 || TileEndY != -1) { SelectTile(null); } }; EraserButton.OnDeselection += delegate(BaseEventArgs e) { if (AutotileIndex == -1 && TilesetIndex == -1 && TileStartX == -1 && TileEndX == -1 && TileStartY == -1 && TileEndY == -1 && !MapViewer.SelectionOnMap) { SelectTile(0, 0, 0); } else { UpdateCursor(); } }; SetSize(288, 200); // Dummy size so the sprites can be drawn properly }