diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-12-13 12:53:08 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-12-13 12:53:08 +0100 |
| commit | 8f33514940cfd7dc539ff8a0ca207a029b15a4b9 (patch) | |
| tree | 852c4cad66db863d53b49a2768d2d5c637d23c8c | |
| parent | 035ef61b3233c0a85caf42260f3cd1c1e1a01d54 (diff) | |
binding tests + wip
| -rw-r--r-- | Samples/BindingTest/BindingTest.csproj | 8 | ||||
| -rw-r--r-- | Samples/BindingTest/Program.cs | 38 | ||||
| -rw-r--r-- | Samples/BindingTest/ui/test.crow | 12 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/DbgEventWidget.cs | 2 | ||||
| -rw-r--r-- | Samples/DebugLogAnalyzer/DbgLogViewer.cs | 4 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/gauge.crow | 4 | ||||
| -rw-r--r-- | Samples/dockableWindows/dockableWindows.cs | 5 | ||||
| -rw-r--r-- | Samples/dragNdrop/dragNdrop.cs | 5 |
8 files changed, 63 insertions, 15 deletions
diff --git a/Samples/BindingTest/BindingTest.csproj b/Samples/BindingTest/BindingTest.csproj new file mode 100644 index 00000000..ed05c677 --- /dev/null +++ b/Samples/BindingTest/BindingTest.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/BindingTest/Program.cs b/Samples/BindingTest/Program.cs new file mode 100644 index 00000000..cf19bf26 --- /dev/null +++ b/Samples/BindingTest/Program.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com> +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +using System; +using System.Runtime.CompilerServices; +using Crow; + +namespace BindingTest +{ + class Program : SampleBase + { + + static void Main () + { + using (Program app = new Program ()) + app.Run (); + } + + protected override void OnInitialized () + { + Load ("#ui.test.crow").DataSource = this; + + } + + + void setDataSourceNull (object sender, MouseButtonEventArgs e) + { + TcVCInstance = null; + Console.WriteLine ("set data source null"); + } + void setDataSourceThis (object sender, MouseButtonEventArgs e) + { + TcVCInstance = new TestClassVC () { Prop1 = "instance 1 prop1 value", Prop2 = "instance 1 prop2 value" }; + Console.WriteLine ("set data source not null"); + } + + } +} diff --git a/Samples/BindingTest/ui/test.crow b/Samples/BindingTest/ui/test.crow new file mode 100644 index 00000000..d56524a0 --- /dev/null +++ b/Samples/BindingTest/ui/test.crow @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<VerticalStack Margin="5"> + <VerticalStack Margin="5" Background="Onyx" DataSource="{TcVCInstance}"> + <Label Text="{}"/> + <Label Text="{Prop1}"/> + <Label Text="{Prop2}"/> + </VerticalStack> + <HorizontalStack Height="Fit" Margin="5" Background="DimGrey"> + <Button Background="Jet" Caption="Set DataSource Null" MouseClick="setDataSourceNull"/> + <Button Background="Jet" Caption="Set DataSource This" MouseClick="setDataSourceThis"/> + </HorizontalStack> +</VerticalStack> diff --git a/Samples/DebugLogAnalyzer/DbgEventWidget.cs b/Samples/DebugLogAnalyzer/DbgEventWidget.cs index 1528e205..b2af84dd 100644 --- a/Samples/DebugLogAnalyzer/DbgEventWidget.cs +++ b/Samples/DebugLogAnalyzer/DbgEventWidget.cs @@ -97,7 +97,7 @@ namespace Crow ctx.SetSource (dbge.Color); if (dbge.IsSelected) { ctx.FillPreserve (); - ctx.SetSourceRGB (1, 1, 1); + ctx.SetSource (1, 1, 1); ctx.Stroke (); }else ctx.Fill (); diff --git a/Samples/DebugLogAnalyzer/DbgLogViewer.cs b/Samples/DebugLogAnalyzer/DbgLogViewer.cs index 4b7a108a..0d6bdfa9 100644 --- a/Samples/DebugLogAnalyzer/DbgLogViewer.cs +++ b/Samples/DebugLogAnalyzer/DbgLogViewer.cs @@ -295,7 +295,7 @@ namespace Crow if (g.yIndex == 0) gr.SetSource (Crow.Colors.LightSalmon); else - Foreground.SetAsSource (gr); + Foreground.SetAsSource (IFace, gr); gr.MoveTo (penX, penY - gr.FontExtents.Descent); gr.ShowText (g.name + gIdx); @@ -399,7 +399,7 @@ namespace Crow r = new Rectangle (cb.Left, (int)y, cb.Width, (int)fe.Height); ctx.Operator = Cairo.Operator.Add; - ctx.SetSourceRGBA (0.1, 0.1, 0.1, 0.4); + ctx.SetSource (0.1, 0.1, 0.1, 0.4); ctx.Rectangle (ContextCoordinates (r)); ctx.Fill (); } diff --git a/Samples/common/ui/Interfaces/Divers/gauge.crow b/Samples/common/ui/Interfaces/Divers/gauge.crow index db03d8f4..17d69b67 100644 --- a/Samples/common/ui/Interfaces/Divers/gauge.crow +++ b/Samples/common/ui/Interfaces/Divers/gauge.crow @@ -1,10 +1,10 @@ <?xml version="1.0"?> <Container Background="Onyx"> <VerticalStack Background="Jet" Fit="true" Margin="10" Spacing="10"> - <Gauge Width="200" Height="10" Background="RoyalBlue" Value="50" CornerRadius="5"/> + <Gauge Width="200" Height="10" Background="DimGrey" Foreground="RoyalBlue" Value="50" CornerRadius="5"/> <NumericControl Width="200" Height="10" Value="40"> <Template> - <Gauge Maximum="{./Maximum}" Foreground="Black" BorderWidth="1" Background="RoyalBlue" Value="{./Value}" CornerRadius="5"/> + <Gauge Maximum="{./Maximum}" Background="DimGrey" Foreground="RoyalBlue" Value="{./Value}" CornerRadius="5"/> </Template> </NumericControl> <HorizontalStack Width="200" Height="200"> diff --git a/Samples/dockableWindows/dockableWindows.cs b/Samples/dockableWindows/dockableWindows.cs index 65223acc..4b5a0e11 100644 --- a/Samples/dockableWindows/dockableWindows.cs +++ b/Samples/dockableWindows/dockableWindows.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Crow; -using Glfw; namespace tests { diff --git a/Samples/dragNdrop/dragNdrop.cs b/Samples/dragNdrop/dragNdrop.cs index 0c985747..62244bf7 100644 --- a/Samples/dragNdrop/dragNdrop.cs +++ b/Samples/dragNdrop/dragNdrop.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using Crow; -using Glfw; namespace tests { |