aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
diff options
context:
space:
mode:
Diffstat (limited to 'Samples')
-rw-r--r--Samples/Directory.Build.props2
-rw-r--r--Samples/ShowCase/ShowCase.cs4
-rw-r--r--Samples/common/samples.style3
-rw-r--r--Samples/common/ui/Interfaces/Divers/2.crow5
-rw-r--r--Samples/common/ui/Interfaces/Experimental/testDock.crow10
-rw-r--r--Samples/common/ui/Interfaces/Experimental/testStack.crow2
-rw-r--r--Samples/dockableWindows/dockableWindows.cs33
-rw-r--r--Samples/dockableWindows/dockableWindows.csproj13
-rw-r--r--Samples/dockableWindows/ui/GTreeExp.itemp32
-rw-r--r--Samples/dockableWindows/ui/test.crow44
-rw-r--r--Samples/dragNdrop/dragNdrop.cs65
-rw-r--r--Samples/dragNdrop/dragNdrop.csproj8
-rw-r--r--Samples/dragNdrop/ui/GTreeExp.itemp32
-rw-r--r--Samples/dragNdrop/ui/test.crow55
14 files changed, 298 insertions, 10 deletions
diff --git a/Samples/Directory.Build.props b/Samples/Directory.Build.props
index 120aa913..190db9dc 100644
--- a/Samples/Directory.Build.props
+++ b/Samples/Directory.Build.props
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
- <TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
+ <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<OutputType>Exe</OutputType>
<SolutionDir>$(MSBuildThisFileDirectory)..\</SolutionDir>
diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs
index d8254317..8af2c002 100644
--- a/Samples/ShowCase/ShowCase.cs
+++ b/Samples/ShowCase/ShowCase.cs
@@ -16,6 +16,7 @@ namespace ShowCase
{
static void Main ()
{
+ Environment.SetEnvironmentVariable ("FONTCONFIG_PATH", @"C:\Users\Jean-Philippe\source\vcpkg\installed\x64-windows\tools\fontconfig\fonts");
using (Showcase app = new Showcase ())
app.Run ();
}
@@ -47,6 +48,7 @@ namespace ShowCase
set {
if (source == value)
return;
+
source = value;
reloadFromSource ();
CMDSave.CanExecute = source != origSource;
@@ -82,7 +84,7 @@ namespace ShowCase
}
public new bool IsDirty {
- get => origSource != source;
+ get => !string.Equals(origSource, source);
}
void onSave ()
{
diff --git a/Samples/common/samples.style b/Samples/common/samples.style
index 124cfcf4..50f91f4a 100644
--- a/Samples/common/samples.style
+++ b/Samples/common/samples.style
@@ -66,4 +66,7 @@ valignStyle2 {
Unchecked = "{Background=Black}";
//Initialized="GetDrawModeIcon";
//Initialized="{Background=Blue}";
+}
+smallLabel {
+ Font="consolas, 8";
} \ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Divers/2.crow b/Samples/common/ui/Interfaces/Divers/2.crow
index b4a06b68..d2c8c370 100644
--- a/Samples/common/ui/Interfaces/Divers/2.crow
+++ b/Samples/common/ui/Interfaces/Divers/2.crow
@@ -2,12 +2,13 @@
<VerticalStack Fit="true">
<TextBox Font="droid, 20" Text="test text box" Width="Stretched"/>
<HorizontalStack Margin="5" Fit="true" MouseEnter="{Background=White}" MouseLeave="{Background=Transparent}">
+ <Label Text="left" Width="80" Height="30" Background="DarkBlue" TextAlignment="Left"/>
<Label Text="centered" Width="80" Height="30" Background="DarkBlue" TextAlignment="Center"/>
<Label Text="top left" Width="80" Height="30" Background="DarkBlue" TextAlignment="TopLeft"/>
<Label Text="top right" Width="80" Height="30" Background="DarkBlue" TextAlignment="TopRight"/>
- <Label Text="right center" Width="80" Height="30" Background="DarkBlue" TextAlignment="Right"/>
+ <Label Text="right" Width="80" Height="30" Background="DarkBlue" TextAlignment="Right"/>
<Label Text="bottom left" Width="80" Height="30" Background="DarkBlue" TextAlignment="BottomLeft"/>
- <Label Text="bottom center" Width="80" Height="30" Background="DarkBlue" TextAlignment="Bottom"/>
+ <Label Text="bottom" Width="80" Height="30" Background="DarkBlue" TextAlignment="Bottom"/>
<Label Text="bottom right" Width="80" Height="30" Background="DarkBlue" TextAlignment="BottomRight"/>
</HorizontalStack>
</VerticalStack> \ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Experimental/testDock.crow b/Samples/common/ui/Interfaces/Experimental/testDock.crow
index b69f8e78..14659f88 100644
--- a/Samples/common/ui/Interfaces/Experimental/testDock.crow
+++ b/Samples/common/ui/Interfaces/Experimental/testDock.crow
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<Window Width="Stretched" Height="Stretched" Background="Jet">
- <DockStack Name="mainDock" Background="DarkRed" Margin="20">
- </DockStack>
-</Window>
+<DockStack Name="mainDock" Background="Jet" Margin="0">
+ <DockWindow Resizable = "true" Top="100" Left="100" Caption="View 1" Width="300" Height="300"/>
+</DockStack>
+
<!---
<DockWindow Left="450" Top="450" Width="150" Height="150" Background="Yellow"/>-->
@@ -14,7 +14,7 @@
<Window Top="400" Left="400" Focusable="true" Caption="View 4" Resizable = "true" Width="300" Height="300"><Widget Focusable="true" Background="Black" MouseEnter="{Background=Grey}" MouseLeave="{Background=Black}"/></Window>
</Group>-->
<!--<Docker >
- <DockWindow Resizable = "true" Top="100" Left="100" Caption="View 1" Width="300" Height="300">
+
<VerticalStack Background="DarkGreen" Focusable="true">
<Label Text="{../../Left}" Background="Black" Width="Stretched"/>
<Label Text="{../../Top}" Background="Black"/>
diff --git a/Samples/common/ui/Interfaces/Experimental/testStack.crow b/Samples/common/ui/Interfaces/Experimental/testStack.crow
index 0348f0b5..97bbe62b 100644
--- a/Samples/common/ui/Interfaces/Experimental/testStack.crow
+++ b/Samples/common/ui/Interfaces/Experimental/testStack.crow
@@ -6,7 +6,7 @@
<HorizontalStack>
<Widget Height="Stretched" Width="100" Background="Red"/>
<Splitter/>
- <Widget Height="Stretched" Width="100" Background="DarkRed"/>
+ <Widget Height="Stretched" Width="Stretched" Background="DarkRed"/>
</HorizontalStack>
<Splitter/>
<Widget Height="100" Width="500" Background="Green"/>
diff --git a/Samples/dockableWindows/dockableWindows.cs b/Samples/dockableWindows/dockableWindows.cs
new file mode 100644
index 00000000..65223acc
--- /dev/null
+++ b/Samples/dockableWindows/dockableWindows.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Crow;
+using Glfw;
+
+namespace tests
+{
+ public class BasicTests : SampleBase
+ {
+ static void Main ()
+ {
+ using (BasicTests app = new BasicTests ()) {
+ app.Run ();
+ }
+ }
+
+ protected override void OnInitialized () {
+ Load ("#ui.test.crow").DataSource = this;
+ AddWidget (new DockWindow (this) { Background = Colors.Blue, Left = 10, Top = 110, Resizable = true });
+ AddWidget (new DockWindow (this) { Background = Colors.Red, Left = 30, Top = 130, Resizable = true });
+ AddWidget (new DockWindow (this) { Background = Colors.Green, Left = 50, Top = 150, Resizable = true });
+ AddWidget (new DockWindow (this) { Background = Colors.Yellow, Left = 70, Top = 170, Resizable = true });
+ AddWidget (new DockWindow (this) { Background = Colors.Grey, Left = 90, Top = 190, Resizable = true });
+ }
+ private void refreshGraphicTree (object sender, MouseButtonEventArgs e) {
+ NotifyValueChanged ("GraphicTree", (object)null);
+ NotifyValueChanged ("GraphicTree", GraphicTree);
+ }
+
+ }
+}
diff --git a/Samples/dockableWindows/dockableWindows.csproj b/Samples/dockableWindows/dockableWindows.csproj
new file mode 100644
index 00000000..3c9729fe
--- /dev/null
+++ b/Samples/dockableWindows/dockableWindows.csproj
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+ <ItemGroup>
+ <EmbeddedResource Include="ui\*.*">
+ <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Update="ui\GTreeExp.itemp">
+ <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+ </EmbeddedResource>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/Samples/dockableWindows/ui/GTreeExp.itemp b/Samples/dockableWindows/ui/GTreeExp.itemp
new file mode 100644
index 00000000..f2a7c2ba
--- /dev/null
+++ b/Samples/dockableWindows/ui/GTreeExp.itemp
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<Expandable IsExpanded="{²IsExpanded}" MouseDoubleClick="/onClickForExpand">
+ <Template>
+ <VerticalStack>
+ <Border CornerRadius="2" Margin="0" Height="Fit"
+ Foreground="Transparent"
+ MouseEnter="{Foreground=DimGrey}"
+ MouseLeave="{Foreground=Transparent}">
+ <HorizontalStack Spacing="1">
+ <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand"
+ Path="{./Image}"
+ Visible="{./IsExpandable}"
+ SvgSub="{./IsExpanded}"
+ MouseEnter="{Background=LightGrey}"
+ MouseLeave="{Background=Transparent}"/>
+ <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
+ <Image Margin="2" Path="{GetIcon}" />
+ </Border>
+ <Widget Width="5" Height="5" Background="Blue" Visible="{IsHover}"/>
+ <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/>
+ <Label Text="{Name}" Width="Fit"/>
+ <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/>
+ </HorizontalStack>
+ </Border>
+ <Container Name="Content" Visible="false"/>
+ </VerticalStack>
+ </Template>
+ <HorizontalStack Height="Fit">
+ <Widget Width="8" Height="10"/>
+ <VerticalStack Height="Fit" Name="ItemsContainer"/>
+ </HorizontalStack>
+</Expandable>
diff --git a/Samples/dockableWindows/ui/test.crow b/Samples/dockableWindows/ui/test.crow
new file mode 100644
index 00000000..3c16376b
--- /dev/null
+++ b/Samples/dockableWindows/ui/test.crow
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<VerticalStack>
+ <VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched">
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="hover:" Width="50"/>
+ <Label Style="smallLabel" Text="{HoverWidget}"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="focus:" Width="50"/>
+ <Label Style="smallLabel" Text="{FocusedWidget}"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="active:" Width="50"/>
+ <Label Style="smallLabel" Text="{ActiveWidget}"/>
+ </HorizontalStack>
+ </VerticalStack>
+ <DockStack Height="70%"/>
+ <Splitter/>
+ <Button Caption="Refresh tree" MouseClick="refreshGraphicTree"/>
+ <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}">
+ <ItemTemplate>
+ <Border Width="Stretched" Focusable="true" Foreground="Transparent">
+ <HorizontalStack Spacing="5">
+ <Widget Width="5" Height="5"/>
+ <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
+ <Image Margin="2" Path="{GetIcon}" />
+ </Border>
+ <Widget Width="2" Height="5" Background="Blue" Visible="{IsHover}"/>
+ <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/>
+ <Label Text="{Name}" Width="Fit"/>
+ <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/>
+ </HorizontalStack>
+ </Border>
+ </ItemTemplate>
+ <ItemTemplate DataType="Crow.Group" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.Container" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.TemplatedContainer" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ </TreeView>
+</VerticalStack>
diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs
new file mode 100644
index 00000000..0c985747
--- /dev/null
+++ b/Samples/dragNdrop/dragNdrop.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Crow;
+using Glfw;
+
+namespace tests
+{
+ public class BasicTests : SampleBase
+ {
+ static void Main ()
+ {
+ using (BasicTests app = new BasicTests ()) {
+ app.Run ();
+ }
+ }
+
+ protected override void OnInitialized ()
+ {
+ Load ("#ui.test.crow").DataSource = this;
+ }
+
+ private void refreshGraphicTree (object sender, MouseButtonEventArgs e) {
+ NotifyValueChanged ("GraphicTree", (object)null);
+ NotifyValueChanged ("GraphicTree", GraphicTree);
+ }
+
+ Group startGroup = null;
+
+
+ private void W_StartDrag (object sender, DragDropEventArgs e) {
+ startGroup = e.DragSource.Parent as Group;
+ DragImageHeight = e.DragSource.LastPaintedSlot.Height;
+ DragImageWidth = e.DragSource.LastPaintedSlot.Width;
+
+ Crow.Cairo.Surface dragImg = surf.CreateSimilar (Crow.Cairo.Content.ColorAlpha, DragImageWidth, DragImageHeight);
+ using (Crow.Cairo.Context gr = new Crow.Cairo.Context(dragImg)) {
+ gr.SetSource (e.DragSource.bmp, 0, 0);
+ gr.Paint ();
+ }
+ DragImage = dragImg;
+ lock (UpdateMutex)
+ startGroup.RemoveChild (e.DragSource);
+ }
+ private void W_EndDrag (object sender, DragDropEventArgs e) {
+ lock (UpdateMutex)
+ startGroup.AddChild (e.DragSource);
+ }
+
+ private void W_DragEnter (object sender, DragDropEventArgs e) {
+ lock (UpdateMutex)
+ (e.DropTarget as Group).AddChild (e.DragSource);
+ }
+ private void W_DragLeave (object sender, DragDropEventArgs e) {
+ lock (UpdateMutex)
+ (e.DragSource.Parent as Group).RemoveChild (e.DragSource);
+ }
+ private void W_Drop (object sender, DragDropEventArgs e) {
+ //(e.DropTarget as Group).AddChild (e.DragSource);
+ }
+
+
+ }
+}
diff --git a/Samples/dragNdrop/dragNdrop.csproj b/Samples/dragNdrop/dragNdrop.csproj
new file mode 100644
index 00000000..9961c6b9
--- /dev/null
+++ b/Samples/dragNdrop/dragNdrop.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/dragNdrop/ui/GTreeExp.itemp b/Samples/dragNdrop/ui/GTreeExp.itemp
new file mode 100644
index 00000000..f2a7c2ba
--- /dev/null
+++ b/Samples/dragNdrop/ui/GTreeExp.itemp
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<Expandable IsExpanded="{²IsExpanded}" MouseDoubleClick="/onClickForExpand">
+ <Template>
+ <VerticalStack>
+ <Border CornerRadius="2" Margin="0" Height="Fit"
+ Foreground="Transparent"
+ MouseEnter="{Foreground=DimGrey}"
+ MouseLeave="{Foreground=Transparent}">
+ <HorizontalStack Spacing="1">
+ <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand"
+ Path="{./Image}"
+ Visible="{./IsExpandable}"
+ SvgSub="{./IsExpanded}"
+ MouseEnter="{Background=LightGrey}"
+ MouseLeave="{Background=Transparent}"/>
+ <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
+ <Image Margin="2" Path="{GetIcon}" />
+ </Border>
+ <Widget Width="5" Height="5" Background="Blue" Visible="{IsHover}"/>
+ <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/>
+ <Label Text="{Name}" Width="Fit"/>
+ <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/>
+ </HorizontalStack>
+ </Border>
+ <Container Name="Content" Visible="false"/>
+ </VerticalStack>
+ </Template>
+ <HorizontalStack Height="Fit">
+ <Widget Width="8" Height="10"/>
+ <VerticalStack Height="Fit" Name="ItemsContainer"/>
+ </HorizontalStack>
+</Expandable>
diff --git a/Samples/dragNdrop/ui/test.crow b/Samples/dragNdrop/ui/test.crow
new file mode 100644
index 00000000..ce49ea71
--- /dev/null
+++ b/Samples/dragNdrop/ui/test.crow
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<VerticalStack Background="Jet" Focusable="true">
+ <VerticalStack Name="Watches" Background="Black" Height="Fit" Width="Stretched">
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="hover:" Width="50"/>
+ <Label Style="smallLabel" Text="{HoverWidget}"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="focus:" Width="50"/>
+ <Label Style="smallLabel" Text="{FocusedWidget}"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Style="smallLabel" Text="active:" Width="50"/>
+ <Label Style="smallLabel" Text="{ActiveWidget}"/>
+ </HorizontalStack>
+ </VerticalStack>
+ <HorizontalStack Margin="20" Name="zone1" Height="100" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave">
+ <Widget Name="w1" Background="Blue" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>
+ <Widget Name="w2" Background="Red" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget Name="w3" Background="Green" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget Name="w4" Background="Yellow" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ <Widget Name="w5" Background="DimGrey" Focusable="true" Width="50" Height="Stretched" AllowDrag="true" StartDrag="W_StartDrag" EndDrag="W_EndDrag" Drop="W_Drop"/>/>
+ </HorizontalStack>
+ <Widget Height="20" Focusable="true"/>
+ <HorizontalStack Margin="20" Name="zone2" Height="150" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave">
+ </HorizontalStack>
+ <Widget Height="20"/>
+ <HorizontalStack Margin="20" Name="zone3" Height="80" Width="Stretched" Background="Grey" AllowDrop="true" DragEnter="W_DragEnter" DragLeave="W_DragLeave">
+ </HorizontalStack>
+ <Button Caption="Refresh tree" MouseClick="refreshGraphicTree"/>
+ <TreeView IsRoot="true" Name="treeView" Data="{GraphicTree}">
+ <ItemTemplate>
+ <Border Width="Stretched" Focusable="true" Foreground="Transparent">
+ <HorizontalStack Spacing="5">
+ <Widget Width="5" Height="5"/>
+ <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
+ <Image Margin="2" Path="{GetIcon}" />
+ </Border>
+ <Widget Width="2" Height="5" Background="Blue" Visible="{IsHover}"/>
+ <Widget Width="5" Height="5" Background="Green" Visible="{Visible}"/>
+ <Label Text="{Name}" Width="Fit"/>
+ <Label Text="{LogicalParent}" Width="Stretched" Foreground="Yellow"/>
+ </HorizontalStack>
+ </Border>
+ </ItemTemplate>
+ <ItemTemplate DataType="Crow.Group" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.Container" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.TemplatedContainer" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ <ItemTemplate DataType="Crow.TemplatedGroup" Data="GetChildren"
+ Path="#ui.GTreeExp.itemp"/>
+ </TreeView>
+</VerticalStack> \ No newline at end of file