diff options
| author | Ac_K <Acoustik666@gmail.com> | 2023-05-04 16:41:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-04 14:41:06 +0000 |
| commit | 3b8ac1641a8a40849915396813e26384b5894911 (patch) | |
| tree | 5355d6601917146809323990a1a0de8f3a7e893b /src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml | |
| parent | 42507323535443ad79be071367f3d4815afca688 (diff) | |
UI: Move ApplicationContextMenu in a separated class (#4755)
* UI: Move ApplicationContextMenu in a separated class
This PR remove duplicated code related to the context menu on the Application list/grid by create a control for the menu which include related handler.
I've renamed "GameList/GameGrid" by "Application" for consistencies. And I've removed all uneeded field from the project file too.
While I cleaned up things, I've found an issue about purging Ptc/Shader cache, both methods list files even if the user say "No", shader cache is purged even if the user say "No". It's fixed.
* Adresses feedbacks
Diffstat (limited to 'src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml')
| -rw-r--r-- | src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml b/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml new file mode 100644 index 00000000..f7a120b1 --- /dev/null +++ b/src/Ryujinx.Ava/UI/Controls/ApplicationGridView.axaml @@ -0,0 +1,102 @@ +<UserControl + x:Class="Ryujinx.Ava.UI.Controls.ApplicationGridView" + xmlns="https://github.com/avaloniaui" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox" + xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" + d:DesignHeight="450" + d:DesignWidth="800" + Focusable="True" + mc:Ignorable="d"> + <UserControl.Resources> + <helpers:BitmapArrayValueConverter x:Key="ByteImage" /> + <controls:ApplicationContextMenu x:Key="ApplicationContextMenu" /> + </UserControl.Resources> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <ListBox + Grid.Row="0" + Padding="8" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + ContextFlyout="{StaticResource ApplicationContextMenu}" + DoubleTapped="GameList_DoubleTapped" + Items="{Binding AppsObservableList}" + SelectionChanged="GameList_SelectionChanged"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <flex:FlexPanel + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + AlignContent="FlexStart" + JustifyContent="Center" /> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + <ListBox.Styles> + <Style Selector="ListBoxItem"> + <Setter Property="Margin" Value="5" /> + <Setter Property="CornerRadius" Value="4" /> + </Style> + <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator"> + <Setter Property="MinHeight" Value="{Binding $parent[UserControl].DataContext.GridItemSelectorSize}" /> + </Style> + </ListBox.Styles> + <ListBox.ItemTemplate> + <DataTemplate> + <Grid> + <Border + Margin="10" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}" + Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}" + Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}" + Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}" + ClipToBounds="True" + CornerRadius="4"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Image + Grid.Row="0" + HorizontalAlignment="Stretch" + VerticalAlignment="Top" + Source="{Binding Icon, Converter={StaticResource ByteImage}}" /> + <Panel + Grid.Row="1" + Height="50" + Margin="0,10,0,0" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}"> + <TextBlock + HorizontalAlignment="Stretch" + VerticalAlignment="Center" + Text="{Binding TitleName}" + TextAlignment="Center" + TextWrapping="Wrap" /> + </Panel> + </Grid> + </Border> + <ui:SymbolIcon + Margin="5,5,0,0" + HorizontalAlignment="Left" + VerticalAlignment="Top" + FontSize="16" + Foreground="{DynamicResource SystemAccentColor}" + IsVisible="{Binding Favorite}" + Symbol="StarFilled" /> + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Grid> +</UserControl>
\ No newline at end of file |
