]> O.S.I.I.S - jp/crow.git/commitdiff
* GOLib.csproj:
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 9 Sep 2015 08:43:24 +0000 (10:43 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 9 Sep 2015 08:43:24 +0000 (10:43 +0200)
* XCursor.cs:
* OpenTKGameWindow.cs:
* GOLIBTest_Window.cs:
* Window.cs:
* testWindow.goml: Horizontal and vertical Resizing

* Interface.cs: Border threshold

GOLib.csproj
Tests/GOLIBTest_Window.cs
Tests/Interfaces/testWindow.goml
src/GraphicObjects/Window.cs
src/Interface.cs
src/OpenTKGameWindow.cs
src/XCursor.cs

index 70181412072bc0d1891f0784b62e6f1a8740f48c..0cfcf445d5f435728c39d0a64e379088f6ebf713 100644 (file)
     <EmbeddedResource Include="Images\Icons\Cursors\top_left_corner" />\r
     <EmbeddedResource Include="Images\Icons\Cursors\top_right_corner" />\r
     <EmbeddedResource Include="Images\Icons\Cursors\arrow" />\r
+    <EmbeddedResource Include="Images\Icons\exit2.svg" />\r
+    <EmbeddedResource Include="Images\Icons\Cursors\sb_h_double_arrow" />\r
+    <EmbeddedResource Include="Images\Icons\Cursors\sb_v_double_arrow" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="Images\Icons\Cursors\hand" />\r
index 4ce0b65403dd541ba51ddf02290f3ec713d53d3d..8a05c4a46d186c32294ab25dc875993c35cf4a57 100644 (file)
@@ -71,12 +71,12 @@ namespace test
                        : base(800, 600,"test")\r
                {}\r
 \r
-               Window g;\r
 \r
                protected override void OnLoad (EventArgs e)\r
                {\r
                        base.OnLoad (e);\r
-                       LoadInterface("Interfaces/testWindow.goml", out g);\r
+                       LoadInterface("Interfaces/testWindow.goml");\r
+                       LoadInterface("Interfaces/testWindow.goml");\r
 //                     LoadInterface("Interfaces/testWindow.goml", out g);\r
 //                     LoadInterface("Interfaces/testWindow.goml", out g);\r
 //                     LoadInterface("Interfaces/testWindow.goml", out g);\r
@@ -107,6 +107,11 @@ namespace test
                        this.Quit ();\r
                }\r
 \r
+               void butQuitPress (object sender, MouseButtonEventArgs e)\r
+               {\r
+                       DeleteWidget (sender as GraphicObject);\r
+               }\r
+\r
                [STAThread]\r
                static void Main ()\r
                {\r
index dc9dc3dcc359a75b2eec70d0870174676ae5a9dd..efad1d8f8dda2ad1aba685cb4edbdc1086803586 100755 (executable)
@@ -1,7 +1,27 @@
 <?xml version="1.0"?>\r
 <!--<Group>-->\r
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,5" \r
-       Focusable="True">\r
+<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8" \r
+       Focusable="True"  CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">\r
+       <Template>\r
+               <Border BorderWidth="1" BorderColor="White" Margin="0" CornerRadius="20">\r
+                       <VerticalStack Height="0" Width="0" Margin="0">\r
+                               <Border BorderWidth="1" BorderColor="White"  Height="-1" Width="0" Background="0,1;0,5;1,0;0,5">\r
+                                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" Width="0" Focusable="false" >\r
+                                               <GraphicObject Width="5" Height="0"/>\r
+                                               <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>\r
+                                               <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />\r
+                                               <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent"  Height="12" Width="12"\r
+                                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
+                                                       <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"\r
+                                                                MouseClick="butQuitPress"/>\r
+                                               </Border>\r
+                                               <GraphicObject Width="5" Height="0"/>\r
+                                       </HorizontalStack>\r
+                               </Border>\r
+                               <Container Name="Content" Margin="0" Width="0" Height="0"/>\r
+                       </VerticalStack>\r
+               </Border>\r
+       </Template>\r
        <VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="10" Spacing="10">\r
                <Slider Name="slider" Height="10" Width="0"/>\r
 \r
@@ -9,8 +29,8 @@
                        <Checkbox Height="-1" Width="-1"/>\r
                        <Checkbox Height="-1" Width="-1"/>\r
                </HorizontalStack>\r
-               <GroupBox Title="test"  Height="0" Width="0" Margin="0">\r
-                       <VerticalStack Width="0">\r
+               <GroupBox Title="test"  Height="-1" Width="-1" Margin="5">\r
+                       <VerticalStack Width="-1">\r
                                <RadioButton  Caption="Radio 1"/>\r
                                <RadioButton  Caption="Radio 2" IsChecked="true"/>\r
                                <RadioButton  Caption="Radio 3"/>\r
index c1a117ebe2f367fded9a53dac4fffe1ea62b7f6e..0c275f7a86c4d43648742bda63fbdefee2502481 100644 (file)
@@ -33,12 +33,7 @@ namespace go
                public Window () : base()
                {
                }
-
-               void Window_MouseMove (object sender, OpenTK.Input.MouseMoveEventArgs e)
-               {
-
-
-               }
+                       
                enum Direction
                {
                        None,
@@ -49,7 +44,7 @@ namespace go
                        NW,
                        NE,
                        SW,
-                       SE
+                       SE,
                }
                Direction currentDirection = Direction.None;
 
@@ -59,41 +54,46 @@ namespace go
 
                        OpenTKGameWindow otkgw = TopContainer as OpenTKGameWindow;
 
-                       int borderLim = 5;
-
-
-
-                       if (TopContainer.activeWidget == null) {
+                       if (otkgw.activeWidget == null) {
                                Direction lastDir = currentDirection;
 
-                               if ((e.Position - this.Slot.TopLeft).Length < borderLim)
-                                       currentDirection = Direction.NW;
-                               else if ((e.Position - this.Slot.TopRight).Length < borderLim)
-                                       currentDirection = Direction.NE;
-                               else if ((e.Position - this.Slot.BottomLeft).Length < borderLim)
-                                       currentDirection = Direction.SW;
-                               else if ((e.Position - this.Slot.BottomRight).Length < borderLim)
-                                       currentDirection = Direction.SE;
+                               if (Math.Abs (e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) {
+                                       if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+                                               currentDirection = Direction.NW;
+                                       else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+                                               currentDirection = Direction.NE;
+                                       else
+                                               currentDirection = Direction.N;
+                               } else if (Math.Abs (e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) {
+                                       if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+                                               currentDirection = Direction.SW;
+                                       else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+                                               currentDirection = Direction.SE;
+                                       else
+                                               currentDirection = Direction.S;
+                               } else if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+                                       currentDirection = Direction.W;
+                               else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+                                       currentDirection = Direction.E;
                                else
                                        currentDirection = Direction.None;
 
-
                                if (currentDirection != lastDir) {
                                        switch (currentDirection) {
                                        case Direction.None:
                                                otkgw.Cursor = XCursor.Default;
                                                break;
                                        case Direction.N:
-                                               otkgw.Cursor = XCursor.Cross;
+                                               otkgw.Cursor = XCursor.V;
                                                break;
                                        case Direction.S:
-                                               otkgw.Cursor = XCursor.Cross;
+                                               otkgw.Cursor = XCursor.V;
                                                break;
                                        case Direction.E:
-                                               otkgw.Cursor = XCursor.Cross;
+                                               otkgw.Cursor = XCursor.H;
                                                break;
                                        case Direction.W:
-                                               otkgw.Cursor = XCursor.Cross;
+                                               otkgw.Cursor = XCursor.H;
                                                break;
                                        case Direction.NW:
                                                otkgw.Cursor = XCursor.NW;
@@ -123,12 +123,18 @@ namespace go
                                this.Top += e.YDelta;
                                break;
                        case Direction.N:
+                               this.Top += e.YDelta;
+                               this.Height -= e.YDelta;
                                break;
                        case Direction.S:
-                               break;
-                       case Direction.E:
+                               this.Height += e.YDelta;
                                break;
                        case Direction.W:
+                               this.Left += e.XDelta;
+                               this.Width -= e.XDelta;
+                               break;
+                       case Direction.E:
+                               this.Width += e.XDelta;
                                break;
                        case Direction.NW:
                                this.Left += e.XDelta;
index 3e0f8771aef68070042c50858f2e0f3c408eac39..d7a35f81e1d49198e62e2558f12dcc628758e170 100644 (file)
@@ -34,7 +34,10 @@ namespace go
                public static int TabSize = 4;
                public static string LineBreak = "\r\n";
                public static bool ReplaceTabsWithSpace = false;
+               /// <summary> Allow rendering of interface in development environment </summary>
                public static bool DesignerMode = false;
+               /// <summary> Threshold to catch borders for sizing </summary>
+               public static int BorderThreshold = 5;
 
                /// <summary>
                /// Graphic objects References use in dynamic delegates for binding
index 23e72576380139a5ba5772ef6299d2a67f286e2a..d34d6bfa03152ad103f6b7778325ad12db0b6b79 100755 (executable)
@@ -40,7 +40,8 @@ namespace go
                        XCursor.NE = XCursorFile.Load("#go.Images.Icons.Cursors.top_right_corner").Cursors[0];\r
                        XCursor.SW = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_left_corner").Cursors[0];\r
                        XCursor.SE = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_right_corner").Cursors[0];\r
-\r
+                       XCursor.H = XCursorFile.Load("#go.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];\r
+                       XCursor.V = XCursorFile.Load("#go.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];\r
                }        \r
                #endregion\r
 \r
index a186fcfe386f93b9d5920fce306e9df9bae2673e..8120530e158be5a494d63cd1160e1701ca86a6c6 100644 (file)
@@ -151,8 +151,8 @@ namespace go
                public static XCursor NE;
                public static XCursor N;
                public static XCursor S;
-
-
+               public static XCursor V;
+               public static XCursor H;
 
                public uint Width;
                public uint Height;