]> O.S.I.I.S - jp/crow.git/commitdiff
'/' handling to start at current node in BindingMember, test drag and drop
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Feb 2018 19:03:36 +0000 (20:03 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Feb 2018 19:03:36 +0000 (20:03 +0100)
Tests/BasicTests.cs
Tests/Interfaces/DragAndDrop/0.crow
Tests/Tests.csproj
src/GraphicObjects/GraphicObject.cs
src/IML/BindingMember.cs

index 3bfd16e8ff574fa848c73d16640369366e485200..8c851286cecbeb683cebceef50bc4bea1ee540b6 100644 (file)
@@ -167,8 +167,9 @@ namespace Tests
                        //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
                        //testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
                        //testFiles = new string [] { @"Interfaces/TemplatedControl/testSpinner.crow" };
-                       //testFiles = new string [] { @"Interfaces/GraphicObject/testCtxMenu.crow" };
-                       testFiles = new string [] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
+                       testFiles = new string [] { @"Interfaces/DragAndDrop/0.crow" };
+                       //testFiles = new string [] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/DragAndDrop", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
index 63290f9e6b2327d5c09eaa2f45233c8d245a9a31..a9c113349a5f77ee1fc7a5b7d0ef8ef473085460 100755 (executable)
@@ -1,9 +1,19 @@
 <?xml version="1.0"?>
-<VerticalStack MinimumSize="50,50" Background="Onyx" Margin="10" Width="90%" Height="90%">
-       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"
-                       MinimumSize="10,10"/>
-       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"
-                       MinimumSize="10,10"/>
-       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"
-                       MinimumSize="10,10"/>
-</VerticalStack>
\ No newline at end of file
+<HorizontalStack Background="Onyx" Margin="10" Width="90%" Height="90%" Spacing="100" Focusable="true">
+       <Container StartDrag="{Background=Yellow}" EndDrag="{Background=Mantis}" Focusable="true" Fit="true"
+                       MouseEnter="{/txt.Foreground=Red;Background=Blue}" MouseLeave="{/txt.Foreground=White}"
+                       AllowDrag="true" Width="200" Height="200" Background="Mantis">
+               <VerticalStack Margin="50">
+                       <Label Name="txt" Text="Drag me" Foreground="Gray"/>
+                       <Label Text="Dragged" Visible="{/IsDragged}"/>
+               </VerticalStack>
+       </Container>
+       <Container StartDrag="{Background=Yellow}" EndDrag="{Background=Mantis}" Focusable="true" Fit="true"
+                       MouseEnter="{/txt.Foreground=Red}" MouseLeave="{/txt.Foreground=White}"
+                       AllowDrop="true"  Background="Mantis">
+               <VerticalStack Margin="50">
+                       <Label Name="txt" Text="Drop here" Foreground="Gray"/>
+                       <Label Text="Dragged" Visible="{/IsDragged}"/>
+               </VerticalStack>
+       </Container>
+</HorizontalStack>
\ No newline at end of file
index fb384de9b2b3e9c6c47423697b94dfb29a531c9e..e5cccb5c931f54302a1b3303873bfda37f8a798f 100644 (file)
     <None Include="Interfaces\GraphicObject\testCtxMenu.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\DragAndDrop\0.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
     <Folder Include="Interfaces\TemplatedGroup\" />
     <Folder Include="GraphicObjects\" />
     <Folder Include="Tutorials\" />
+    <Folder Include="Interfaces\DragAndDrop\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="image\tetra.png">
index aca7032e774235f6f56029ac30c6c8db04bd3fde..ef2e019748a4d4ed3d6aa7fb12af8fb846e2d70c 100644 (file)
@@ -317,7 +317,8 @@ namespace Crow
                public event EventHandler Enabled;
                /// <summary>Occurs when the enabled state this object is set to false</summary>
                public event EventHandler Disabled;
-               public event EventHandler Dragged;
+               public event EventHandler StartDrag;
+               public event EventHandler EndDrag;
                public event EventHandler Dropped;
                /// <summary>Occurs when one part of the rendering slot changed</summary>
                public event EventHandler<LayoutingEventArgs> LayoutChanged;
@@ -1100,13 +1101,14 @@ namespace Crow
                /// </summary>
                protected virtual void onStartDrag (object sender, EventArgs e){
                        Debug.WriteLine("DRAG => " + this.ToString());
-                       Dragged.Raise (this, null);
+                       StartDrag.Raise (this, null);
                }
                /// <summary>
                ///  Occured when dragging ends without dropping
                /// </summary>
                protected virtual void onEndDrag (object sender, EventArgs e){
                        IsDragged = false;
+                       EndDrag.Raise (this, null);
                        Debug.WriteLine("END DRAG => " + this.ToString());
                }
                /// <summary>
index 7aaa851cbb8d0ebf17df8ba0e4dabfa7cd0b18bf..4a2b2c61db54cbbe3df58c2cc2e62fbcb5b74b41 100644 (file)
@@ -97,8 +97,10 @@ namespace Crow.IML
                                        IsStringConstant = true;
                                        return;
                                }
+                       } else if (string.IsNullOrEmpty (splitedExp [0])) {
+                               ptr++;
                        } else {
-                               if (string.IsNullOrEmpty (splitedExp [0]) || splitedExp [0] == ".") {//template root
+                                if (splitedExp [0] == ".") {//template root
                                        LevelsUp = -1;
                                        ptr++;
                                } else {