Skip to content

Commit

Permalink
Docking draft
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed May 30, 2024
1 parent 1d6dfe3 commit 774b880
Show file tree
Hide file tree
Showing 36 changed files with 2,084 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Suki.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Settings.XamlStyler = Settings.XamlStyler
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SukiUI.Dock", "SukiUI.Dock\SukiUI.Dock.csproj", "{B82306B8-613C-4360-882B-F19FE0F3265B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -29,6 +31,10 @@ Global
{1AF8DFD4-73DA-47FD-A034-635342AD9B9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AF8DFD4-73DA-47FD-A034-635342AD9B9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AF8DFD4-73DA-47FD-A034-635342AD9B9D}.Release|Any CPU.Build.0 = Release|Any CPU
{B82306B8-613C-4360-882B-F19FE0F3265B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B82306B8-613C-4360-882B-F19FE0F3265B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B82306B8-613C-4360-882B-F19FE0F3265B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B82306B8-613C-4360-882B-F19FE0F3265B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions SukiUI.Demo/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
</Application.Resources>
<Application.Styles>
<FluentTheme></FluentTheme>

<StyleInclude Source="avares://SukiUI.Dock/Index.axaml" />

<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
<sukiUi:SukiTheme ThemeColor="Blue"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avaloniaEdit="https://github.com/avaloniaui/avaloniaedit"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.DocumentText">
<avaloniaEdit:TextEditor Margin="15,15,5,5" Name="Editor"
ShowLineNumbers="True"
/>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using AvaloniaEdit;
using AvaloniaEdit.TextMate;
using TextMateSharp.Grammars;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class DocumentText : UserControl
{
public DocumentText()
{
InitializeComponent();


var _textEditor = this.FindControl<TextEditor>("Editor");
_textEditor.Text = @"<UserControl xmlns=""https://github.com/avaloniaui""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
xmlns:mc=""http://schemas.openxmlformats.org/markup-compatibility/2006""
mc:Ignorable=""d"" d:DesignWidth=""800"" d:DesignHeight=""450""
x:Class=""SukiUI.Demo.Features.ControlsLibrary.DockView"">
Welcome to Avalonia!
</UserControl>
";

//Here we initialize RegistryOptions with the theme we want to use.
var _registryOptions = new RegistryOptions(ThemeName.DarkPlus);

//Initial setup of TextMate.
var _textMateInstallation = _textEditor.InstallTextMate(_registryOptions);

//Here we are getting the language by the extension and right after that we are initializing grammar with this language.
//And that's all 😀, you are ready to use AvaloniaEdit with syntax highlighting!
_textMateInstallation.SetGrammar(_registryOptions.GetScopeByLanguageId(_registryOptions.GetLanguageByExtension(".cs").Id));
}
}
}
39 changes: 39 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockControls/ErrorList.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:SukiUI.Controls;assembly=SukiUI"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.ErrorList">
<ScrollViewer Classes="Stack">
<StackPanel Margin="15,15">
<StackPanel Orientation="Horizontal" Spacing="12">

<controls:GlassCard CornerRadius="10" Padding="12,8">
<StackPanel Orientation="Horizontal" Spacing="8">
<avalonia:MaterialIcon Kind="Error" Foreground="Red" Width="16" Height="16" />
<TextBlock FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}" Text="2 Errors"></TextBlock>
</StackPanel>

</controls:GlassCard>
<controls:GlassCard CornerRadius="10" Padding="12,8">
<StackPanel Orientation="Horizontal" Spacing="8">
<avalonia:MaterialIcon Kind="WarningCircle" Foreground="Orange" Width="16" Height="16" />
<TextBlock FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}" Text="2 Warnings"></TextBlock>
</StackPanel>

</controls:GlassCard>
<controls:GlassCard CornerRadius="10" Padding="12,8">
<StackPanel Orientation="Horizontal" Spacing="8">
<avalonia:MaterialIcon Kind="InformationCircle" Foreground="{DynamicResource SukiPrimaryColor}" Width="16" Height="16" />
<TextBlock FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}" Text="0 Messages"></TextBlock>
</StackPanel>

</controls:GlassCard>
</StackPanel>

<DataGrid Name="DG" Margin="0,10" AutoGenerateColumns="True"></DataGrid>
</StackPanel>
</ScrollViewer>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.ObjectModel;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class ErrorList : UserControl
{
public ErrorList()
{
InitializeComponent();
this.Get<DataGrid>("DG").ItemsSource = new ObservableCollection<ErrorD>()
{
new ErrorD(),
new ErrorD()
{
Description = "Unused local variable."
},
new ErrorD()
{
Description = "Type 'Person' not defined."
},
};
}
}
}

public class ErrorD
{
public string Code { get; set; } = "BC30230";
public string Description { get; set; } = "'Inherits' not valid.";
public string Project { get; set; } = "Avalonia.DockDemo";
public string File { get; set; } = "Program.cs";
public string Line { get; set; } = "2";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:dockControls="clr-namespace:SukiUI.Demo.Features.ControlsLibrary.DockControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.SolutionExplore">
<TreeView x:Name="TV">
<TreeView.ItemTemplate>
<DataTemplate>
<TreeViewItem Margin="0,-1" HorizontalAlignment="Left" x:DataType="dockControls:FolderItem" ItemsSource="{Binding Children}">
<TreeViewItem.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<avalonia:MaterialIcon Foreground="Gold" IsVisible="{Binding IsDirectory}" Margin="5,0" Kind="Folder" Height="15" Width="15" VerticalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" FontWeight="DemiBold" FontSize="13" Foreground="{DynamicResource SukiLowText}"></TextBlock>
</StackPanel>
</TreeViewItem.Header>
</TreeViewItem>
</DataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls;

public partial class SolutionExplore : UserControl
{
public SolutionExplore()
{
InitializeComponent();
FolderContents = new ObservableCollection<FolderItem>();
LoadFolderContents("../");
this.FindControl<TreeView>("TV").ItemsSource = FolderContents;
}

public ObservableCollection<FolderItem> FolderContents { get; set; }



private void LoadFolderContents(string path)
{
var dirInfo = new DirectoryInfo(path);
var files = dirInfo.GetFiles();
var directories = dirInfo.GetDirectories();

foreach (var file in files)
{
FolderContents.Add(new FolderItem(file.Name, false));
}

foreach (var directory in directories)
{
var folderItem = new FolderItem(directory.Name, true);
LoadFolderContents(directory.FullName);
folderItem.Children = new ObservableCollection<FolderItem>(GetFolderItems(directory.FullName));
FolderContents.Add(folderItem);
}

FolderContents = new ObservableCollection<FolderItem>(FolderContents.OrderBy(item => !item.IsDirectory).ThenBy(item => item.Name));
}

private IEnumerable<FolderItem> GetFolderItems(string path)
{
var result = new List<FolderItem>();
var dirInfo = new DirectoryInfo(path);
var files = dirInfo.GetFiles();
var directories = dirInfo.GetDirectories();

foreach (var file in files)
{
result.Add(new FolderItem(file.Name, false));
}

foreach (var directory in directories)
{
result.Add(new FolderItem(directory.Name, true));
}

return result;
}
}


public class FolderItem
{
public string Name { get; set; }
public bool IsDirectory { get; set; }
public ObservableCollection<FolderItem> Children { get; set; }

public FolderItem(string name, bool isDirectory)
{
Name = name;
IsDirectory = isDirectory;
Children = new ObservableCollection<FolderItem>();
}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:theme="clr-namespace:SukiUI.Theme;assembly=SukiUI"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.propertiesview">
<StackPanel Margin="15,25,15,0" >
<Expander Header="Window Informations" IsExpanded="True">
<StackPanel Margin="25,0" Spacing="10">
<Panel >
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Window Title" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<TextBox Margin="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" Text="Dock Demo"></TextBox>
</Panel>
<Panel>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Height" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<NumericUpDown VerticalAlignment="Center" HorizontalAlignment="Right" Value="800" theme:NumericUpDownExtensions.Unit="px" ShowButtonSpinner="False"></NumericUpDown>
</Panel>
<Panel>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Width" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<NumericUpDown VerticalAlignment="Center" HorizontalAlignment="Right" Value="1200" theme:NumericUpDownExtensions.Unit="px" ShowButtonSpinner="False"></NumericUpDown>
</Panel>
<Panel>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Maximized" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<ToggleSwitch VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="True"></ToggleSwitch>
</Panel>
</StackPanel>
</Expander>

<Expander Margin="0,35,0,0" Header="Running State" IsExpanded="True">
<StackPanel Margin="25,0" Spacing="10">

<Panel>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Read Only" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<ToggleSwitch VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="False"></ToggleSwitch>
</Panel>


<Panel>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Running" FontWeight="DemiBold" Foreground="{DynamicResource SukiLowText}"></TextBlock>
<ToggleSwitch VerticalAlignment="Center" HorizontalAlignment="Right" IsChecked="True"></ToggleSwitch>
</Panel>
</StackPanel>
</Expander>

</StackPanel>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class propertiesview : UserControl
{
public propertiesview()
{
InitializeComponent();
}
}
}
Loading

0 comments on commit 774b880

Please sign in to comment.