Skip to content

Commit

Permalink
Added "More" menu (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Sep 4, 2023
1 parent 6560f87 commit 0c118b3
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 75 deletions.
357 changes: 283 additions & 74 deletions PermaTop/UserControls/WindowPropertyItem.xaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,287 @@
<UserControl x:Class="PermaTop.UserControls.WindowPropertyItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PermaTop.UserControls"
xmlns:lang="clr-namespace:PermaTop.Properties"
mc:Ignorable="d" FontFamily="..\Fonts\#Hauora"
Height="50" d:DesignWidth="800" Foreground="{DynamicResource Foreground1}">
<Border CornerRadius="10" Padding="5" Margin="5" Background="{DynamicResource CardBackground}">
<Border.Effect>
<DropShadowEffect BlurRadius="10" Color="#1F1F1F" Direction="270" Opacity="0.1" ShadowDepth="0"/>
</Border.Effect>
<UserControl
x:Class="PermaTop.UserControls.WindowPropertyItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lang="clr-namespace:PermaTop.Properties"
xmlns:local="clr-namespace:PermaTop.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Height="50"
d:DesignWidth="800"
FontFamily="..\Fonts\#Hauora"
Foreground="{DynamicResource Foreground1}"
mc:Ignorable="d">
<Border
Margin="5"
Padding="5"
Background="{DynamicResource CardBackground}"
CornerRadius="10">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Direction="270"
Opacity="0.1"
ShadowDepth="0"
Color="#1F1F1F" />
</Border.Effect>

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image x:Name="IconImg" Grid.Column="0" Margin="5 0" MaxWidth="15" MaxHeight="15"/>
<TextBlock x:Name="TitleTxt" FontWeight="ExtraBold" d:Text="WindowTItle" FontSize="14" VerticalAlignment="Center" Grid.Column="1">
<TextBlock.ToolTip>
<ToolTip x:Name="TitleToolTip" Foreground="{DynamicResource Foreground1}" Background="{DynamicResource Background1}" />
</TextBlock.ToolTip>
</TextBlock>
<Button Foreground="{DynamicResource Foreground1}" x:Name="MoreBtn" Click="MoreBtn_Click" Width="30" Grid.Column="3" Style="{DynamicResource DefaultButton}" Background="{DynamicResource Background2}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xFC2E;" FontSize="14" Margin="0 0 5 0"/>
<Button Foreground="{DynamicResource Foreground1}" x:Name="FavBtn" Click="FavBtn_Click" Width="30" Grid.Column="4" Style="{DynamicResource DefaultButton}" Background="{DynamicResource Background2}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xF710;" FontSize="14" Margin="0 0 5 0"/>
<Button Foreground="{DynamicResource Foreground1}" x:Name="PinBtn" Click="PinBtn_Click" Width="30" Grid.Column="5" Style="{DynamicResource DefaultButton}" Background="{DynamicResource Background2}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xF602;" FontSize="14" Margin="0 0 5 0"/>
<Button Foreground="{DynamicResource Foreground1}" x:Name="MinBtn" Click="MinBtn_Click" Width="30" Grid.Column="6" Style="{DynamicResource DefaultButton}" Background="{DynamicResource CardBackground}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xF4E0;" FontSize="14" Margin="0 0 5 0"/>
<Button Foreground="{DynamicResource Foreground1}" x:Name="MaxRestoreBtn" Click="MaxRestoreBtn_Click" Width="30" Grid.Column="7" Style="{DynamicResource DefaultButton}" Background="{DynamicResource CardBackground}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xFA41;" FontSize="14" Margin="0 0 5 0"/>
<Button Foreground="{DynamicResource Foreground1}" x:Name="CloseBtn" Click="CloseBtn_Click" Width="30" Grid.Column="8" Style="{DynamicResource DefaultButton}" Background="{DynamicResource CardBackground}" FontFamily="..\Fonts\#FluentSystemIcons-Regular" Content="&#xF36A;" FontSize="14"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image
x:Name="IconImg"
Grid.Column="0"
MaxWidth="15"
MaxHeight="15"
Margin="5 0" />
<TextBlock
x:Name="TitleTxt"
Grid.Column="1"
VerticalAlignment="Center"
d:Text="WindowTItle"
FontSize="14"
FontWeight="ExtraBold">
<TextBlock.ToolTip>
<ToolTip
x:Name="TitleToolTip"
Background="{DynamicResource Background1}"
Foreground="{DynamicResource Foreground1}" />
</TextBlock.ToolTip>
</TextBlock>
<Button
x:Name="MoreBtn"
Grid.Column="3"
Width="30"
Margin="0 0 5 0"
Background="{DynamicResource Background2}"
Click="MoreBtn_Click"
Content="&#xFC2E;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="FavBtn"
Grid.Column="4"
Width="30"
Margin="0 0 5 0"
Background="{DynamicResource Background2}"
Click="FavBtn_Click"
Content="&#xF710;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="PinBtn"
Grid.Column="5"
Width="30"
Margin="0 0 5 0"
Background="{DynamicResource Background2}"
Click="PinBtn_Click"
Content="&#xF602;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="MinBtn"
Grid.Column="6"
Width="30"
Margin="0 0 5 0"
Background="{DynamicResource CardBackground}"
Click="MinBtn_Click"
Content="&#xF4E0;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="MaxRestoreBtn"
Grid.Column="7"
Width="30"
Margin="0 0 5 0"
Background="{DynamicResource CardBackground}"
Click="MaxRestoreBtn_Click"
Content="&#xFA41;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="CloseBtn"
Grid.Column="8"
Width="30"
Background="{DynamicResource CardBackground}"
Click="CloseBtn_Click"
Content="&#xF36A;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
FontSize="14"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />

<Popup StaysOpen="False" x:Name="MorePopup" Placement="Bottom" PlacementTarget="{Binding ElementName=MoreBtn}" AllowsTransparency="True">
<Border Background="{DynamicResource Background1}" Padding="10" CornerRadius="10" Margin="10">
<Border.Effect>
<DropShadowEffect BlurRadius="10" Color="#1F1F1F" Direction="270" Opacity="0.1" ShadowDepth="0"/>
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Popup
x:Name="SizePopup"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=MoreBtn}"
StaysOpen="False">
<Border
Margin="10"
Padding="10"
Background="{DynamicResource Background1}"
CornerRadius="10">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Direction="270"
Opacity="0.1"
ShadowDepth="0"
Color="#1F1F1F" />
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock Text="{x:Static lang:Resources.Position}" FontWeight="Bold"/>
<TextBlock Text="{x:Static lang:Resources.X}" Grid.Row="1" VerticalAlignment="Center" Margin="10" FontWeight="Bold"/>
<TextBlock Text="{x:Static lang:Resources.Y}" Grid.Row="2" VerticalAlignment="Center" Margin="10" FontWeight="Bold"/>
<Border Grid.Row="1" Background="{DynamicResource CardBackground}" Width="50" CornerRadius="5" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect Color="{DynamicResource LightAccentColor}" BlurRadius="15" Opacity="0.2" ShadowDepth="0"/>
</Border.Effect>
<TextBox x:Name="XTxt" Padding="3" Margin="3" BorderThickness="0" FontWeight="Bold" Foreground="{DynamicResource DarkGray}" d:Text="123" Background="Transparent" TextAlignment="Center"/>
</Border>
<Border Grid.Row="2" Background="{DynamicResource CardBackground}" Width="50" CornerRadius="5" HorizontalAlignment="Center" Grid.Column="1" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect Color="{DynamicResource LightAccentColor}" BlurRadius="15" Opacity="0.2" ShadowDepth="0"/>
</Border.Effect>
<TextBox x:Name="YTxt" Padding="3" Margin="3" BorderThickness="0" FontWeight="Bold" Foreground="{DynamicResource DarkGray}" d:Text="123" Background="Transparent" TextAlignment="Center"/>
</Border>
<Button Content="{x:Static lang:Resources.Apply}" x:Name="ApplyBtn" Style="{DynamicResource PrimaryButton}" Click="ApplyBtn_Click" Grid.ColumnSpan="2" Grid.Row="3" HorizontalAlignment="Center" Margin="5" Padding="5" Background="{DynamicResource Accent}" FontWeight="Bold" Foreground="{DynamicResource WindowButtonsHoverForeground1}"/>
</Grid>
</Border>
</Popup>
</Grid>
</Border>
<TextBlock FontWeight="Bold" Text="{x:Static lang:Resources.Position}" />
<TextBlock
Grid.Row="1"
Margin="10"
VerticalAlignment="Center"
FontWeight="Bold"
Text="{x:Static lang:Resources.X}" />
<TextBlock
Grid.Row="2"
Margin="10"
VerticalAlignment="Center"
FontWeight="Bold"
Text="{x:Static lang:Resources.Y}" />
<Border
Grid.Row="1"
Grid.Column="1"
Width="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource LightAccentColor}" />
</Border.Effect>
<TextBox
x:Name="XTxt"
Margin="3"
Padding="3"
d:Text="123"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
TextAlignment="Center" />
</Border>
<Border
Grid.Row="2"
Grid.Column="1"
Width="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource CardBackground}"
CornerRadius="5">
<Border.Effect>
<DropShadowEffect
BlurRadius="15"
Opacity="0.2"
ShadowDepth="0"
Color="{DynamicResource LightAccentColor}" />
</Border.Effect>
<TextBox
x:Name="YTxt"
Margin="3"
Padding="3"
d:Text="123"
Background="Transparent"
BorderThickness="0"
FontWeight="Bold"
Foreground="{DynamicResource DarkGray}"
TextAlignment="Center" />
</Border>
<Button
x:Name="ApplyBtn"
Grid.Row="3"
Grid.ColumnSpan="2"
Margin="5"
Padding="5"
HorizontalAlignment="Center"
Background="{DynamicResource Accent}"
Click="ApplyBtn_Click"
Content="{x:Static lang:Resources.Apply}"
FontWeight="Bold"
Foreground="{DynamicResource WindowButtonsHoverForeground1}"
Style="{DynamicResource PrimaryButton}" />
</Grid>
</Border>
</Popup>
<Popup
x:Name="ContextMenu"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=MoreBtn}"
StaysOpen="False">
<Border
Margin="10"
Padding="10"
Background="{DynamicResource Background1}"
CornerRadius="10">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Direction="270"
Opacity="0.1"
ShadowDepth="0"
Color="#1F1F1F" />
</Border.Effect>

<StackPanel>
<Button
x:Name="SetPosBtn"
Padding="2"
HorizontalContentAlignment="Left"
Background="Transparent"
Click="SetPosBtn_Click"
Content="{x:Static lang:Resources.SetPosition}"
FontWeight="Bold"
Style="{DynamicResource PrimaryButton}" />
<Button
x:Name="SetScreenBtn"
Padding="2"
HorizontalContentAlignment="Left"
Background="Transparent"
Content="{x:Static lang:Resources.MoveToScreen}"
FontWeight="Bold"
Style="{DynamicResource PrimaryButton}" />
</StackPanel>
</Border>
</Popup>
</Grid>
</Border>
</UserControl>
8 changes: 7 additions & 1 deletion PermaTop/UserControls/WindowPropertyItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void MinBtn_Click(object sender, RoutedEventArgs e)

private void MoreBtn_Click(object sender, RoutedEventArgs e)
{
MorePopup.IsOpen = !MorePopup.IsOpen;
ContextMenu.IsOpen = !ContextMenu.IsOpen;
}

private void ApplyBtn_Click(object sender, RoutedEventArgs e)
Expand All @@ -190,4 +190,10 @@ private void ApplyBtn_Click(object sender, RoutedEventArgs e)

MoveWindow(WindowInfo.Hwnd, x, y);
}

private void SetPosBtn_Click(object sender, RoutedEventArgs e)
{
SizePopup.IsOpen = true;
ContextMenu.IsOpen = false;
}
}

0 comments on commit 0c118b3

Please sign in to comment.