Skip to content

Commit

Permalink
add custom title bar to main launcher window (wip #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
foglio1024 authored and alexrp committed Jan 23, 2024
1 parent 1cedd98 commit b167b09
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 7 deletions.
90 changes: 83 additions & 7 deletions src/client/Launcher/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,91 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controllers="using:Arise.Client.Launcher.Controllers"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
x:Class="Arise.Client.Launcher.Windows.MainWindow"
x:DataType="controllers:MainController"
Width="1280"
Height="720">
<Window.Background>
<ImageBrush Source="../../image_background.webp"
Stretch="Fill" />
</Window.Background>
Height="720"
Padding="0"
CanResize="False"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
Background="#222222"
RequestedThemeVariant="Dark">
<Window.Styles>
<Style Selector="#CloseButton:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="DarkRed" />
</Style>
<Style Selector="#CloseButton:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="Red" />
</Style>
<Style Selector="Button">
<Setter Property="Background" Value="#1fff" />
<Setter Property="CornerRadius" Value="8" />
</Style>
</Window.Styles>
<Grid RowDefinitions="40,*"
>

<Image Source="../../image_logo.webp"
Stretch="Uniform" />
<!--Title bar-->
<Grid VerticalAlignment="Stretch"
ColumnDefinitions="Auto,*"
Margin="8">
<Rectangle RadiusX="8"
RadiusY="8"
Height="24"
Width="24"
HorizontalAlignment="Left"
Margin="0 0 8 0">
<Rectangle.Fill>
<ImageBrush Source="../../arise.png"
Stretch="Fill" />
</Rectangle.Fill>
</Rectangle>
<TextBlock Text="TERA Arise"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
<StackPanel Orientation="Horizontal"
Grid.Column="1"
HorizontalAlignment="Right">
<Button x:Name="AccountButton"
Height="24"
FontSize="10"
Margin="0 0 6 0"
Padding="6 0">
<StackPanel Orientation="Horizontal">
<avalonia:MaterialIcon Kind="Account" />
<TextBlock Text="Foglio"
Margin="4 0 0 0"
VerticalAlignment="Center" />
</StackPanel>
</Button>

<Button x:Name="MinimizeButton"
Height="24"
Width="24"
Click="OnMinimizeClick">
<avalonia:MaterialIcon Kind="WindowMinimize" />
</Button>
<Button x:Name="CloseButton"
Height="24"
Width="24"
Margin="6 0 0 0"
Click="OnCloseClick">
<avalonia:MaterialIcon Kind="Close" />
</Button>
</StackPanel>
</Grid>

<Image Source="../../image_background.webp"
Stretch="Fill"
IsHitTestVisible="False"
Grid.Row="1" />
<Image Source="../../image_logo.webp"
IsHitTestVisible="False"
Stretch="Uniform"
Grid.Row="1" />
</Grid>
</Window>
13 changes: 13 additions & 0 deletions src/client/Launcher/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Arise.Client.Launcher.Controllers;
using Avalonia.Interactivity;

namespace Arise.Client.Launcher.Windows;

Expand All @@ -16,4 +17,16 @@ protected override void OnInitialized()

base.OnInitialized();
}

private void OnCloseClick(object? sender, RoutedEventArgs e)
{
// todo: check if something needs to be disposed beforehand
// todo: check if this should just be minimized to tray instead of closing
Close();
}

private void OnMinimizeClick(object? sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
}

0 comments on commit b167b09

Please sign in to comment.