aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/DockTests
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-07-16 20:08:03 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2025-07-16 20:08:03 +0200
commit149205e8ebe5c4ab1ca52ca700ff754aabdf14aa (patch)
treee0d567ae9a304ec915e49a25e42af1803e3d83ed /Samples/DockTests
parente96fecb4bb512ee47e9df0224e779b24d686bc30 (diff)
DebugLogViewer, DockTests
Diffstat (limited to 'Samples/DockTests')
-rw-r--r--Samples/DockTests/DockTests.csproj8
-rw-r--r--Samples/DockTests/main.cs68
-rw-r--r--Samples/DockTests/ui/main.crow27
3 files changed, 103 insertions, 0 deletions
diff --git a/Samples/DockTests/DockTests.csproj b/Samples/DockTests/DockTests.csproj
new file mode 100644
index 00000000..4c64f057
--- /dev/null
+++ b/Samples/DockTests/DockTests.csproj
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+ <ItemGroup>
+ <EmbeddedResource Include="ui\*.*">
+ <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/Samples/DockTests/main.cs b/Samples/DockTests/main.cs
new file mode 100644
index 00000000..99e58f27
--- /dev/null
+++ b/Samples/DockTests/main.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using Crow;
+using Glfw;
+using Samples;
+
+namespace DockTests
+{
+ class Program : Interface {
+ Program() : base (1400, 1000, true) {}
+ static void Main (string[] args) {
+ //Interface.PreferedBackendType = Drawing2D.BackendType.Egl;
+ using (Program app = new Program ()) {
+ //app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Label Text='Hello World' Background='Red' Top='50' Margin='0'/>");
+ //app.Initialized += (sender, e) => app.LoadIMLFragment (@"<Container Width='Stretched' ><Window Caption='hello world' Background='Jet'/></Container>");
+ //app.Initialized += (sender, e) => app.Load("#ui.helloworld.crow");
+ app.Run ();
+
+ //DbgLogger.Save(app);
+ }
+ }
+ public Command CMDNewDockWin;
+ protected DockStack mainDock;
+
+ static int winCpt = 5;
+ Random rnd = new Random();
+
+ int rndColorComp => (int)(25.5f * rnd.NextInt64(10));
+ Drawing2D.Color randomColor => new Drawing2D.Color(rndColorComp, rndColorComp, rndColorComp);
+
+ protected override void OnInitialized()
+ {
+ base.OnInitialized();
+
+ CMDNewDockWin = new ActionCommand("New Dock Win", ()=>LoadIMLFragment(
+ $"<DockWindow Name='win{winCpt++}' Style='SimpleDockWin' Background='{randomColor}' Width='200' Height='200' MinimumSize='20,20'/> ") );
+
+ Widget w = Load ("#ui.main.crow");
+ w.DataSource = this;
+
+ mainDock = w.FindByName ("mainDock") as DockStack;
+
+
+ LoadIMLFragment(@"<Window Background='Jet'><ListBox Style='ScrollingListBox' Data='{List2}' Height='95%' Width='95%' Background='Black' Foreground='Blue'/></Window>").DataSource = this;
+ LoadIMLFragment(@"<Window Background='Onyx'/>");
+
+
+ }
+ public IEnumerable<String> List2 = new List<string>(new string[]
+ {
+ "string1",
+ "string2",
+ "string3",
+ "string4",
+ "string5",
+ "string6",
+ "string7",
+ "string8",
+ "string8",
+ "string8",
+ "string8",
+ "string8",
+ "string8",
+ "string9"
+ }
+ );
+ }
+}
diff --git a/Samples/DockTests/ui/main.crow b/Samples/DockTests/ui/main.crow
new file mode 100644
index 00000000..85486b39
--- /dev/null
+++ b/Samples/DockTests/ui/main.crow
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<VerticalStack>
+ <HorizontalStack Height="Fit" Width="Stretched" Background="Yellow">
+ <Label Text="Hover:" Width="50" Foreground="Grey"/>
+ <Label Width="Stretched" Text="{HoverWidget}" Font="mono, 10" Foreground="Black"/>
+ </HorizontalStack >
+ <HorizontalStack Height="Fit" Width="Stretched">
+ <Label Text="Focus:" Width="50" Foreground="Grey"/>
+ <Label Width="Stretched" Text="{FocusedWidget}" Font="mono, 10"/>
+ </HorizontalStack >
+ <HorizontalStack Height="Fit">
+ <Label Text="Active:" Width="50" Foreground="Grey"/>
+ <Label Width="Stretched" Text="{ActiveWidget}" Font="mono, 10"/>
+ </HorizontalStack>
+ <Group Width="200" Height="200" Background="Yellow">
+ <Border Top="20" Left="20" Width="70" Height="70" Foreground="Purple" Background="Blue"/>
+ <Border Top="40" Left="40" Width="70" Height="70" Foreground="Purple" Background="Red"/>
+ </Group>
+ <Button Command="{CMDNewDockWin}"/>
+ <Group Name="dockRoot" Margin="20" Focusable="true" Width="Stretched" Height="Stretched">
+ <DockStack CacheEnabled="false" Name="mainDock" Focusable="false" Width="90%" Spacing="10" Background="0.1,0.1,0.1,0.8"/>
+ <!--<DockWindow Name="win1" Style="SimpleDockWin" Top="10" Left="10" Background="Red" Width="200" Height="200"/>
+ <DockWindow Name="win2" Style="SimpleDockWin" Top="30" Left="30" Background="Green" Width="200" Height="200"/>
+ <DockWindow Name="win3" Style="SimpleDockWin" Top="50" Left="50" Background="Pink" Width="200" Height="200"/>
+ <DockWindow Name="win4" Style="SimpleDockWin" Top="70" Left="70" Background="RoyalBlue" Width="200" Height="200"/> -->
+ </Group>
+</VerticalStack> \ No newline at end of file