Переглянути джерело

Merge remote-tracking branch 'origin/kenric' into frank

frankvandenbos 3 місяців тому
батько
коміт
8ea9d26f39

+ 1 - 1
InABox.Avalonia/Components/MenuPanel/AvaloniaMenuItem.cs

@@ -56,7 +56,7 @@ public partial class AvaloniaMenuItem : ObservableObject
         //LoadMenuItems(build().Items,_contextMenu.Items);
     }
     
-    private void LoadMenuItems(IEnumerable<ICoreMenuItem> sourceItems, ItemCollection targetItems)
+    public static void LoadMenuItems(IEnumerable<ICoreMenuItem> sourceItems, ItemCollection targetItems)
     {
         foreach (var sourceItem in sourceItems)
             if (sourceItem is CoreMenuSeparator)

+ 18 - 0
InABox.Avalonia/Converters/ShellSelectedConverter.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace InABox.Avalonia.Converters
+{
+    public class ShellSelectedConverter : AbstractConverter<IShell, bool>
+    {
+        public static ShellSelectedConverter Instance = new ShellSelectedConverter();
+
+        protected override bool Convert(IShell? value, object? parameter = null)
+        {
+            return value?.Parent?.IsSelected(value) ?? false;
+        }
+    }
+}

+ 49 - 0
InABox.Avalonia/Theme/Classes/CheckBox.axaml

@@ -0,0 +1,49 @@
+<Styles xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+	<Style Selector="CheckBox.small">
+		<Setter Property="Template">
+            <ControlTemplate>
+                <Grid x:Name="RootGrid" ColumnDefinitions="20,*">
+                    <Border x:Name="PART_Border"
+                                    Grid.ColumnSpan="2"
+                                    Background="{TemplateBinding Background}"
+                                    BorderBrush="{TemplateBinding BorderBrush}"
+                                    BorderThickness="{TemplateBinding BorderThickness}"
+                                    CornerRadius="{TemplateBinding CornerRadius}" />
+
+                    <Grid VerticalAlignment="Top" Height="32">
+                        <Border x:Name="NormalRectangle"
+                                        BorderBrush="{DynamicResource CheckBoxCheckBackgroundStrokeUnchecked}"
+                                        Background="{DynamicResource CheckBoxCheckBackgroundFillUnchecked}"
+                                        BorderThickness="{DynamicResource CheckBoxBorderThemeThickness}"
+                                        CornerRadius="{TemplateBinding CornerRadius}"
+                                        UseLayoutRounding="False"
+                                        Height="{TemplateBinding Height}"
+                                        Width="{TemplateBinding Height}" />
+
+                        <Viewbox UseLayoutRounding="False">
+                            <Panel>
+                                <Panel Height="16" Width="16" />
+                                <Path x:Name="CheckGlyph"
+                                            Opacity="0"
+                                            Fill="{DynamicResource CheckBoxCheckGlyphForegroundUnchecked}"
+                                            Stretch="Uniform"
+                                            VerticalAlignment="Center"
+                                            FlowDirection="LeftToRight" />
+                            </Panel>
+                        </Viewbox>
+                    </Grid>
+                    <ContentPresenter x:Name="PART_ContentPresenter"
+                                                    ContentTemplate="{TemplateBinding ContentTemplate}"
+                                                    Content="{TemplateBinding Content}"
+                                                    Margin="{TemplateBinding Padding}"
+                                                    RecognizesAccessKey="True"
+                                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                                    TextWrapping="Wrap"
+                                                    Grid.Column="1" />
+                </Grid>
+            </ControlTemplate>
+        </Setter>
+	</Style>
+</Styles>

+ 44 - 0
InABox.Avalonia/Theme/Classes/TabStrip.axaml

@@ -0,0 +1,44 @@
+<Styles xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+	<Style Selector="TabStrip">
+		<Setter Property="Background" Value="{DynamicResource PrsMenuBackground}"/>
+		<Setter Property="BorderBrush" Value="{DynamicResource PrsMenuBackground}"/>
+		<Setter Property="BorderThickness" Value="2"/>
+		<Setter Property="CornerRadius" Value="{DynamicResource PrsCornerRadius}"/>
+		<Setter Property="ItemsPanel">
+			<Setter.Value>
+				<ItemsPanelTemplate>
+					<UniformGrid Rows="1"/>
+				</ItemsPanelTemplate>
+			</Setter.Value>
+		</Setter>
+	</Style>
+	<Style Selector="TabStripItem">
+		<Setter Property="Height" Value="30"/>
+		<Setter Property="MinHeight" Value="0"/>
+		<Setter Property="FontSize" Value="{DynamicResource PrsFontSizeSmall}"/>
+		
+		<Setter Property="HorizontalContentAlignment" Value="Center"/>
+		
+		<Setter Property="Background" Value="{DynamicResource PrsMenuBackground}"/>
+		<Setter Property="Foreground" Value="White"/>
+		<Setter Property="CornerRadius" Value="{DynamicResource PrsCornerRadius}"/>
+	</Style>
+	
+	<Style Selector="TabStripItem:pointerover /template/ Border#PART_LayoutRoot">
+		<Setter Property="Background" Value="{DynamicResource PrsMenuBackground}"/>
+		<Setter Property="TextElement.Foreground" Value="White"/>
+	</Style>
+	
+	<Style Selector="TabStripItem:selected">
+		<Setter Property="Background" Value="{DynamicResource PrsTileBackground}"/>
+	</Style>
+	<Style Selector="TabStripItem:selected:pointerover /template/ Border#PART_LayoutRoot">
+		<Setter Property="Background" Value="{DynamicResource PrsTileBackground}"/>
+		<Setter Property="TextElement.Foreground" Value="Black"/>
+	</Style>
+	
+	<Style Selector="TabStripItem:selected /template/ Border#PART_SelectedPipe">
+		<Setter Property="IsVisible" Value="False"/>
+	</Style>
+</Styles>

+ 2 - 0
InABox.Avalonia/Theme/Styles.axaml

@@ -4,9 +4,11 @@
 
 	<StyleInclude Source="/Theme/Classes/Border.axaml" />
 	<StyleInclude Source="/Theme/Classes/Button.axaml" />
+	<StyleInclude Source="/Theme/Classes/CheckBox.axaml" />
 	<StyleInclude Source="/Theme/Classes/Image.axaml" />
 	<StyleInclude Source="/Theme/Classes/Label.axaml" />
 	<StyleInclude Source="/Theme/Classes/TextBox.axaml" />
 	<StyleInclude Source="/Theme/Classes/Separator.axaml" />
 	<StyleInclude Source="/Theme/Classes/ListBox.axaml" />
+	<StyleInclude Source="/Theme/Classes/TabStrip.axaml" />
 </Styles>