]> O.S.I.I.S - jp/crow.git/commitdiff
binding tests + wip
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Dec 2020 11:53:08 +0000 (12:53 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Dec 2020 11:53:08 +0000 (12:53 +0100)
Samples/BindingTest/BindingTest.csproj [new file with mode: 0644]
Samples/BindingTest/Program.cs [new file with mode: 0644]
Samples/BindingTest/ui/test.crow [new file with mode: 0644]
Samples/DebugLogAnalyzer/DbgEventWidget.cs
Samples/DebugLogAnalyzer/DbgLogViewer.cs
Samples/common/ui/Interfaces/Divers/gauge.crow
Samples/dockableWindows/dockableWindows.cs
Samples/dragNdrop/dragNdrop.cs

diff --git a/Samples/BindingTest/BindingTest.csproj b/Samples/BindingTest/BindingTest.csproj
new file mode 100644 (file)
index 0000000..ed05c67
--- /dev/null
@@ -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 (file)
index 0000000..cf19bf2
--- /dev/null
@@ -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 (file)
index 0000000..d56524a
--- /dev/null
@@ -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>
index 1528e205a1599206f104cfd63311c547a999629c..b2af84dd5e51459047838bc42f279f20e5cf3bf1 100644 (file)
@@ -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 ();
index 4b7a108a7780125d139f9b867437cb7e97618dd3..0d6bdfa96209432d7f73e5b16ad90c9d693a0ffb 100644 (file)
@@ -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 ();
                        }
index db03d8f4441a32bff85ba2280623ea024136c05c..17d69b6716f1fefa8315a2a6392ed246228732ba 100644 (file)
@@ -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">
index 65223acc06d79a74c1d7e884fd1f0f9cd196ba30..4b5a0e11b0596318dab8215d8f32819f749b1ece 100644 (file)
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
 using Crow;
-using Glfw;
 
 namespace tests
 {
index 0c9857470575ce12b1e492e1402a050afab4bdd1..62244bf7dc0d9dff9df25a336bd3b7d1debe22d1 100644 (file)
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
 using Crow;
-using Glfw;
 
 namespace tests
 {