Highlight selected toolbar button
This commit is contained in:
parent
87380b1a18
commit
4e6f8195e7
@ -191,12 +191,8 @@ namespace Sledgemapper
|
||||
_mainWidget.MenuConnectUpload.Enabled = false;
|
||||
_mainWidget.BtnToolbarLine.Click += OnBtnToolbarLinClicked;
|
||||
_mainWidget.BtnToolbarRoom.Click += OnBtnToolbarRoomClicked;
|
||||
_mainWidget.BtnToolbarTile.Click += OnBtnToolbarTileClicked;
|
||||
_mainWidget.BtnToolbarWall.Click += OnBtnToolbarWallClicked;
|
||||
_mainWidget.BtnToolbarDelete.Click += OnBtnToolbarDeleteClicked;
|
||||
|
||||
_mainWidget.BtnToolbarTile.Visible = false;
|
||||
_mainWidget.BtnToolbarWall.Visible = false;
|
||||
_wallsContent = Content.LoadContentFolder<Texture2D>("walls");
|
||||
|
||||
_spriteSheet = new SpriteSheet();
|
||||
@ -221,30 +217,48 @@ namespace Sledgemapper
|
||||
_whiteRectangle.SetData(new[] { Color.White });
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnBtnToolbarDeleteClicked(object sender, EventArgs e)
|
||||
{
|
||||
_state.InsertMode = InsertMode.NewDelete;
|
||||
|
||||
_mainWidget.ClearSelection();
|
||||
((ImageTextButton)sender).Border = new SolidBrush(Color.Red);
|
||||
((ImageTextButton)sender).BorderThickness = new Myra.Graphics2D.Thickness(2);
|
||||
}
|
||||
|
||||
private void OnBtnToolbarWallClicked(object sender, EventArgs e)
|
||||
{
|
||||
_state.InsertMode = InsertMode.NewWall;
|
||||
_mainWidget.ClearSelection();
|
||||
((ImageTextButton)sender).Border = new SolidBrush(Color.Red);
|
||||
((ImageTextButton)sender).BorderThickness = new Myra.Graphics2D.Thickness(2);
|
||||
}
|
||||
|
||||
private void OnBtnToolbarTileClicked(object sender, EventArgs e)
|
||||
{
|
||||
_state.InsertMode = InsertMode.NewTile;
|
||||
_mainWidget.ClearSelection();
|
||||
((ImageTextButton)sender).Border = new SolidBrush(Color.Red);
|
||||
((ImageTextButton)sender).BorderThickness = new Myra.Graphics2D.Thickness(2);
|
||||
}
|
||||
|
||||
private void OnBtnToolbarRoomClicked(object sender, EventArgs e)
|
||||
{
|
||||
_state.InsertMode = InsertMode.NewRoom;
|
||||
_mainWidget.ClearSelection();
|
||||
((ImageTextButton)sender).Border = new SolidBrush(Color.Red);
|
||||
((ImageTextButton)sender).BorderThickness = new Myra.Graphics2D.Thickness(2);
|
||||
|
||||
}
|
||||
|
||||
private void OnBtnToolbarLinClicked(object sender, EventArgs e)
|
||||
{
|
||||
_state.InsertMode = InsertMode.NewLine;
|
||||
_mainWidget.ClearSelection();
|
||||
((ImageTextButton)sender).Border = new SolidBrush(Color.Red);
|
||||
((ImageTextButton)sender).BorderThickness = new Myra.Graphics2D.Thickness(2);
|
||||
}
|
||||
|
||||
private void OneMenuFileSettingsSelected(object sender, EventArgs e)
|
||||
|
@ -8,9 +8,18 @@ namespace Sledgemapper.UI
|
||||
{
|
||||
ClearSelection(GridWalls);
|
||||
ClearSelection(GridOverlays);
|
||||
ClearSelection(Toolbar);
|
||||
}
|
||||
|
||||
private void ClearSelection(Grid grid)
|
||||
{
|
||||
foreach (var widget in grid.Widgets)
|
||||
{
|
||||
widget.Border = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearSelection(HorizontalStackPanel grid)
|
||||
{
|
||||
foreach (var widget in grid.Widgets)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Generated by MyraPad at 18/01/2021 09:38:43 */
|
||||
/* Generated by MyraPad at 03/02/2021 21:43:01 */
|
||||
using Myra;
|
||||
using Myra.Graphics2D;
|
||||
using Myra.Graphics2D.TextureAtlases;
|
||||
@ -127,31 +127,19 @@ namespace Sledgemapper.UI
|
||||
_mainMenu.Items.Add(menuItem2);
|
||||
_mainMenu.Items.Add(menuItem3);
|
||||
|
||||
BtnToolbarTile = new ImageTextButton();
|
||||
BtnToolbarTile.Text = " T";
|
||||
BtnToolbarTile.Width = 40;
|
||||
BtnToolbarTile.Height = 40;
|
||||
BtnToolbarTile.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
BtnToolbarTile.Id = "BtnToolbarTile";
|
||||
|
||||
BtnToolbarLine = new ImageTextButton();
|
||||
BtnToolbarLine.Text = " C";
|
||||
BtnToolbarLine.Width = 40;
|
||||
BtnToolbarLine.Height = 40;
|
||||
BtnToolbarLine.BorderThickness = new Thickness(2);
|
||||
BtnToolbarLine.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
BtnToolbarLine.Id = "BtnToolbarLine";
|
||||
|
||||
BtnToolbarWall = new ImageTextButton();
|
||||
BtnToolbarWall.Text = " W";
|
||||
BtnToolbarWall.Width = 40;
|
||||
BtnToolbarWall.Height = 40;
|
||||
BtnToolbarWall.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
BtnToolbarWall.Id = "BtnToolbarWall";
|
||||
|
||||
BtnToolbarRoom = new ImageTextButton();
|
||||
BtnToolbarRoom.Text = " R";
|
||||
BtnToolbarRoom.Width = 40;
|
||||
BtnToolbarRoom.Height = 40;
|
||||
BtnToolbarRoom.BorderThickness = new Thickness(2);
|
||||
BtnToolbarRoom.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
BtnToolbarRoom.Id = "BtnToolbarRoom";
|
||||
|
||||
@ -159,24 +147,24 @@ namespace Sledgemapper.UI
|
||||
BtnToolbarDelete.Text = " D";
|
||||
BtnToolbarDelete.Width = 40;
|
||||
BtnToolbarDelete.Height = 40;
|
||||
BtnToolbarDelete.BorderThickness = new Thickness(2);
|
||||
BtnToolbarDelete.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
BtnToolbarDelete.Id = "BtnToolbarDelete";
|
||||
|
||||
var horizontalStackPanel1 = new HorizontalStackPanel();
|
||||
horizontalStackPanel1.Spacing = 5;
|
||||
horizontalStackPanel1.Proportions.Add(new Proportion
|
||||
Toolbar = new HorizontalStackPanel();
|
||||
Toolbar.Spacing = 12;
|
||||
Toolbar.Proportions.Add(new Proportion
|
||||
{
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Auto,
|
||||
});
|
||||
horizontalStackPanel1.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
horizontalStackPanel1.Height = 51;
|
||||
horizontalStackPanel1.Padding = new Thickness(4, 0, 0, 0);
|
||||
horizontalStackPanel1.Background = new SolidBrush("#404040FF");
|
||||
horizontalStackPanel1.Widgets.Add(BtnToolbarTile);
|
||||
horizontalStackPanel1.Widgets.Add(BtnToolbarLine);
|
||||
horizontalStackPanel1.Widgets.Add(BtnToolbarWall);
|
||||
horizontalStackPanel1.Widgets.Add(BtnToolbarRoom);
|
||||
horizontalStackPanel1.Widgets.Add(BtnToolbarDelete);
|
||||
Toolbar.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||
Toolbar.Height = 51;
|
||||
Toolbar.Padding = new Thickness(4, 0, 0, 0);
|
||||
Toolbar.Background = new SolidBrush("#404040FF");
|
||||
Toolbar.Id = "Toolbar";
|
||||
Toolbar.Widgets.Add(BtnToolbarLine);
|
||||
Toolbar.Widgets.Add(BtnToolbarRoom);
|
||||
Toolbar.Widgets.Add(BtnToolbarDelete);
|
||||
|
||||
GridWalls = new Grid();
|
||||
GridWalls.ColumnSpacing = 8;
|
||||
@ -262,22 +250,22 @@ namespace Sledgemapper.UI
|
||||
lblSessionName.MinWidth = 100;
|
||||
lblSessionName.Id = "lblSessionName";
|
||||
|
||||
var horizontalStackPanel2 = new HorizontalStackPanel();
|
||||
horizontalStackPanel2.Spacing = 10;
|
||||
horizontalStackPanel2.Proportions.Add(new Proportion
|
||||
var horizontalStackPanel1 = new HorizontalStackPanel();
|
||||
horizontalStackPanel1.Spacing = 10;
|
||||
horizontalStackPanel1.Proportions.Add(new Proportion
|
||||
{
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Auto,
|
||||
});
|
||||
horizontalStackPanel2.Height = 25;
|
||||
horizontalStackPanel2.Background = new SolidBrush("#333333FF");
|
||||
horizontalStackPanel2.Widgets.Add(label1);
|
||||
horizontalStackPanel2.Widgets.Add(lblConnectionStatus);
|
||||
horizontalStackPanel2.Widgets.Add(verticalSeparator1);
|
||||
horizontalStackPanel2.Widgets.Add(label2);
|
||||
horizontalStackPanel2.Widgets.Add(lblUsername);
|
||||
horizontalStackPanel2.Widgets.Add(verticalSeparator2);
|
||||
horizontalStackPanel2.Widgets.Add(label3);
|
||||
horizontalStackPanel2.Widgets.Add(lblSessionName);
|
||||
horizontalStackPanel1.Height = 25;
|
||||
horizontalStackPanel1.Background = new SolidBrush("#333333FF");
|
||||
horizontalStackPanel1.Widgets.Add(label1);
|
||||
horizontalStackPanel1.Widgets.Add(lblConnectionStatus);
|
||||
horizontalStackPanel1.Widgets.Add(verticalSeparator1);
|
||||
horizontalStackPanel1.Widgets.Add(label2);
|
||||
horizontalStackPanel1.Widgets.Add(lblUsername);
|
||||
horizontalStackPanel1.Widgets.Add(verticalSeparator2);
|
||||
horizontalStackPanel1.Widgets.Add(label3);
|
||||
horizontalStackPanel1.Widgets.Add(lblSessionName);
|
||||
|
||||
|
||||
Proportions.Add(new Proportion
|
||||
@ -293,9 +281,9 @@ namespace Sledgemapper.UI
|
||||
Type = Myra.Graphics2D.UI.ProportionType.Fill,
|
||||
});
|
||||
Widgets.Add(_mainMenu);
|
||||
Widgets.Add(horizontalStackPanel1);
|
||||
Widgets.Add(Toolbar);
|
||||
Widgets.Add(verticalSplitPane1);
|
||||
Widgets.Add(horizontalStackPanel2);
|
||||
Widgets.Add(horizontalStackPanel1);
|
||||
}
|
||||
|
||||
|
||||
@ -314,11 +302,10 @@ namespace Sledgemapper.UI
|
||||
public MenuItem MenuViewCenterOnSelection;
|
||||
public MenuItem MenuHelpAbout;
|
||||
public HorizontalMenu _mainMenu;
|
||||
public ImageTextButton BtnToolbarTile;
|
||||
public ImageTextButton BtnToolbarLine;
|
||||
public ImageTextButton BtnToolbarWall;
|
||||
public ImageTextButton BtnToolbarRoom;
|
||||
public ImageTextButton BtnToolbarDelete;
|
||||
public HorizontalStackPanel Toolbar;
|
||||
public Grid GridWalls;
|
||||
public Grid GridOverlays;
|
||||
public Label lblConnectionStatus;
|
||||
|
@ -32,15 +32,13 @@
|
||||
<MenuItem Text="&About" Id="MenuHelpAbout" />
|
||||
</MenuItem>
|
||||
</HorizontalMenu>
|
||||
<HorizontalStackPanel Spacing="5" VerticalAlignment="Center" Height="51" Padding="4, 0, 0, 0" Background="#404040FF">
|
||||
<HorizontalStackPanel Spacing="12" VerticalAlignment="Center" Height="51" Padding="4, 0, 0, 0" Background="#404040FF" Id="Toolbar">
|
||||
<HorizontalStackPanel.Proportions>
|
||||
<Proportion Type="Auto" />
|
||||
</HorizontalStackPanel.Proportions>
|
||||
<ImageTextButton Text=" T" Width="40" Height="40" VerticalAlignment="Center" Id="BtnToolbarTile" />
|
||||
<ImageTextButton Text=" C" Width="40" Height="40" VerticalAlignment="Center" Id="BtnToolbarLine" />
|
||||
<ImageTextButton Text=" W" Width="40" Height="40" VerticalAlignment="Center" Id="BtnToolbarWall" />
|
||||
<ImageTextButton Text=" R" Width="40" Height="40" VerticalAlignment="Center" Id="BtnToolbarRoom" />
|
||||
<ImageTextButton Text=" D" Width="40" Height="40" VerticalAlignment="Center" Id="BtnToolbarDelete" />
|
||||
<ImageTextButton Text=" C" Width="40" Height="40" BorderThickness="2" VerticalAlignment="Center" Id="BtnToolbarLine" />
|
||||
<ImageTextButton Text=" R" Width="40" Height="40" BorderThickness="2" VerticalAlignment="Center" Id="BtnToolbarRoom" />
|
||||
<ImageTextButton Text=" D" Width="40" Height="40" BorderThickness="2" VerticalAlignment="Center" Id="BtnToolbarDelete" />
|
||||
</HorizontalStackPanel>
|
||||
<VerticalSplitPane Width="200" Background="#A1A1A1FF">
|
||||
<VerticalStackPanel>
|
||||
|
Loading…
Reference in New Issue
Block a user