]> O.S.I.I.S - jp/crow.git/commitdiff
debug and improvments
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 1 Feb 2016 22:31:22 +0000 (23:31 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Mon, 1 Feb 2016 22:31:22 +0000 (23:31 +0100)
52 files changed:
Crow.csproj
Crow.userprefs
Images/Icons/updown.svg
MonoDevelop.GOLib/src/GOLibGtkHost.cs
Templates/ArrowButTemplate.crow [new file with mode: 0755]
Templates/Button.crow [new file with mode: 0755]
Templates/ComboBox.goml
Templates/Expandable.goml
Templates/MessageBox.goml
Templates/Popper.goml
Templates/ScrollBar.goml
Templates/Spinner.goml
Templates/Window.goml
Tests/GOLIBTest_4.cs
Tests/GOLIBTests.cs
Tests/Interfaces/test4.1.goml
Tests/Interfaces/test4.goml
Tests/Interfaces/test5.goml
Tests/Interfaces/test6.goml
Tests/Interfaces/testButton.crow [new file with mode: 0755]
Tests/Interfaces/testImage.crow [new file with mode: 0755]
Tests/Interfaces/testTextBox.crow [new file with mode: 0755]
Tests/Interfaces/testWindow.goml
Tests/Interfaces/testWindow2.goml
Tests/Interfaces/test_Listbox.goml
Tests/Tests.csproj
UnitTest/Interfaces/testButton.crow [new file with mode: 0755]
UnitTest/Interfaces/testImage.crow [new file with mode: 0755]
UnitTest/NUnitCrowWindow.cs
UnitTest/UnitTest.csproj
src/BmpPicture.cs
src/BubblingMouseButtonEventArgs.cs [new file with mode: 0644]
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/Border.cs
src/GraphicObjects/Button.cs
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ILayoutable.cs
src/GraphicObjects/Image.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/NumericControl.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/Scroller.cs
src/GraphicObjects/Slider.cs
src/GraphicObjects/TextBox.cs
src/GraphicObjects/Window.cs
src/Interface.cs
src/OpenTKGameWindow.cs
src/Picture.cs
src/SvgPicture.cs

index b65f3170785effe442a433afacffa829c1206eb5..bc8842f5f8adfa437e45f9ca08ba844c93b8de1a 100644 (file)
@@ -46,7 +46,7 @@
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <OutputPath>bin\Debug</OutputPath>\r
-    <DefineConstants>TRACE;DEBUG;__linux__;DEBUG_LOAD_TIME0;DEBUG_LAYOUTING0;DEBUG_BINDING0</DefineConstants>\r
+    <DefineConstants>TRACE;DEBUG;__linux__;DEBUG_LOAD_TIME0;DEBUG_LAYOUTING;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>\r
   </PropertyGroup>\r
   <!--  <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">\r
     <DefineConstants>__linux__</DefineConstants>\r
     <Compile Include="src\GraphicObjects\ComboBox.cs" />\r
     <Compile Include="src\GraphicObjects\GroupBox.cs" />\r
     <Compile Include="src\GraphicObjects\ScrollBar.cs" />\r
+    <Compile Include="src\BubblingMouseButtonEventArgs.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Reference Include="System" />\r
     <EmbeddedResource Include="Templates\GroupBox.goml" />\r
     <EmbeddedResource Include="Templates\ListBox.goml" />\r
     <EmbeddedResource Include="Templates\ScrollBar.goml" />\r
+    <EmbeddedResource Include="Templates\Button.crow" />\r
+    <EmbeddedResource Include="Templates\ArrowButTemplate.crow" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="README.md" />\r
index b554ec856d61e2ab1b78c4293429d230751b378d..6a3db5211638c2bc33c330ac7d2e8c388a48618d 100644 (file)
@@ -1,16 +1,18 @@
 <Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|Linux_x86" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/TemplatedControl.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/GraphicObject.cs">
     <Files>
-      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="848" Column="39" />
-      <File FileName="Tests/GOLIBTests.cs" Line="41" Column="1" />
-      <File FileName="Tests/Interfaces/testWindow3.goml" Line="10" Column="6" />
-      <File FileName="src/GraphicObjects/TemplatedControl.cs" Line="114" Column="1" />
-      <File FileName="src/GraphicObjects/Window.cs" Line="214" Column="1" />
-      <File FileName="src/GraphicObjects/TemplatedContainer.cs" Line="80" Column="19" />
-      <File FileName="src/GraphicObjects/Container.cs" Line="31" Column="1" />
-      <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="67" Column="1" />
+      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="572" Column="23" />
+      <File FileName="src/GraphicObjects/Label.cs" Line="15" Column="5" />
+      <File FileName="src/OpenTKGameWindow.cs" Line="114" Column="1" />
+      <File FileName="Tests/GOLIBTests.cs" Line="156" Column="32" />
+      <File FileName="src/GraphicObjects/TextBox.cs" Line="15" Column="31" />
     </Files>
+    <Pads>
+      <Pad Id="MonoDevelop.Debugger.WatchPad">
+        <State />
+      </Pad>
+    </Pads>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
index ce0452451f6b023d14e1623d0d8c6012a9f88759..0df817564f09cf39f64c5bd620145d2a92fd080e 100644 (file)
@@ -5,17 +5,13 @@
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   viewBox="0 0 65.480012 51.479989"
-   height="51.479988"
-   width="65.480011"
-   id="svg2"
    version="1.1"
-   inkscape:version="0.91 r13725"
-   sodipodi:docname="updown.svg">
-<!--  <metadata
-     id="metadata13">
+   id="svg2"
+   width="44.717388"
+   height="31.938803"
+   viewBox="0 0 44.717389 31.938803">
+  <metadata
+     id="metadata11">
     <rdf:RDF>
       <cc:Work
          rdf:about="">
       </cc:Work>
     </rdf:RDF>
   </metadata>
-  <sodipodi:namedview
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1"
-     objecttolerance="10"
-     gridtolerance="10"
-     guidetolerance="10"
-     inkscape:pageopacity="0"
-     inkscape:pageshadow="2"
-     inkscape:window-width="1260"
-     inkscape:window-height="644"
-     id="namedview11"
-     showgrid="false"
-     inkscape:zoom="3.2415936"
-     inkscape:cx="30.089585"
-     inkscape:cy="-4.9619855"
-     inkscape:window-x="0"
-     inkscape:window-y="16"
-     inkscape:window-maximized="0"
-     inkscape:current-layer="svg2" />-->
+  <defs
+     id="defs9" />
   <g
-     id="up"
-     transform="matrix(0.88780545,0,0,0.79362094,4.0529638,4.3893292)">
+     transform="matrix(0.81305037,0,0,0.79847006,-3.6589183,-5.1900554)"
+     id="up">
     <path
-       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 32,9 7,44 57,44 Z"
        id="path4144"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="cccc" />
+       d="M 32,9 7,44 57,44 Z"
+       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
   </g>
   <g
-     id="down"
-     transform="matrix(0.88780545,0,0,0.79362094,4.0529638,4.3893292)">
+     transform="matrix(0.81305037,0,0,0.79847006,-3.6589183,-5.1900554)"
+     id="down">
     <path
-       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 7,9 57,9 32,44 Z"
        id="path4144-0"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="cccc" />
+       d="M 7,9 57,9 32,44 Z"
+       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
   </g>
 </svg>
index ea45e67946b2a7f41bd90862063e89d4f0e3b470..f9e7e599e9f1e17a90f4567e5ae9f9e528b16f8f 100644 (file)
@@ -527,7 +527,7 @@ namespace MonoDevelop.GOLib
                        }
                }
 
-               public IGOLibHost TopContainer {
+               public IGOLibHost HostContainer {
                        get { return this as IGOLibHost; }
                }
 
diff --git a/Templates/ArrowButTemplate.crow b/Templates/ArrowButTemplate.crow
new file mode 100755 (executable)
index 0000000..b1ba779
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>\r
+<!--<HorizontalStack Spacing="1" Height="100" Width="300">\r
+       <Image Margin="2" Width="14" Height="14" Path="{../../Image}"  SvgSub="{../../SvgSub}"/>\r
+       <Label Text="{../../Caption}" Height="80" Width="200"/>\r
+</HorizontalStack>-->\r
+<Border Name="Content"\r
+       Background="Gray" Foreground="DarkGray" \r
+       Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"\r
+       MouseEnter="{Foreground=White}"\r
+       MouseLeave="{Foreground=DarkGray}"\r
+       MouseDown="{Background=LightGray}"\r
+       MouseUp="{Background=Gray}"\r
+       >\r
+</Border>
\ No newline at end of file
diff --git a/Templates/Button.crow b/Templates/Button.crow
new file mode 100755 (executable)
index 0000000..f33db83
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>\r
+<!--<HorizontalStack Spacing="1" Height="100" Width="300">\r
+       <Image Margin="2" Width="14" Height="14" Path="{../../Image}"  SvgSub="{../../SvgSub}"/>\r
+       <Label Text="{../../Caption}" Height="80" Width="200"/>\r
+</HorizontalStack>-->\r
+<Border Fit="True" Background="Gray" MinimumSize="50;20" Foreground="Gray" CornerRadius="3" \r
+       MouseEnter="{Foreground=White;caption.Foreground=White}"\r
+       MouseLeave="{Foreground=Gray;caption.Foreground=Black}"\r
+       MouseDown="{Background=LightGray}"\r
+       MouseUp="{Background=Gray}"\r
+       >\r
+<!--   <Image Height="0" Width="0" Margin="0" Path="{../../Image}" SvgSub="{../../SvgSub}"/>-->\r
+       <Label Name="caption" Margin="5" Foreground="Black" Text="{../../Caption}"/>\r
+</Border>
\ No newline at end of file
index f60b1a1aa870389afa144c2b323aeadc87f04c5f..56c4792b44cd225faa13e2a5f1b53ca097bfc437 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>\r
-<Border CornerRadius="0" BorderColor="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
+<Border CornerRadius="0" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
        <HorizontalStack Margin="1" Spacing="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
                <Label Margin="1" Foreground="Black" Background="White" Text="{../../../Caption}" \r
                        Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>\r
index 740200caa419fa97cca6d0051704d4576802e278..49665f99f6c186485794f1c21660b7b49c9efb34 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>\r
-<Border BorderWidth="1" BorderColor="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" \r
+<Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" \r
                MouseClick="../onMouseClick">\r
        <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
                <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">\r
index d6e474c00404a7c65a27d323caae56f943edc858..7620645ae4bdf0f8c4d491bddd04b06c78526507 100644 (file)
@@ -1,14 +1,14 @@
 <?xml version="1.0"?>
-<Border Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" BorderWidth="1" BorderColor="White" CornerRadius="10" >
+<Border Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" BorderWidth="1" Foreground="White" CornerRadius="10" >
        <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" Background="0,4;0,4;0,4;0,4">
-               <Border BorderWidth="1" BorderColor="White" Width="{../../../TemplatedWidth}" Height="-1" 
+               <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" 
                                Background="0,1;0,5;1,0;0,5">
                        <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
                                <GraphicObject Width="5" Height="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
                                <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
-                               <Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent"  Height="12" Width="12"
-                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
+                               <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
+                                       MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
                                                 MouseClick="../../../../../../butQuitPress"/>
                                </Border>
@@ -23,8 +23,8 @@
                </HorizontalStack>
                <HorizontalStack Height="-1" Width="{../../../TemplatedWidth}" Margin="3">
                        <GraphicObject Height="5"/>
-                       <Button Text="Ok"/>
-                       <Button Text="Cancel"/>
+                       <Button Caption="Ok"/>
+                       <Button Caption="Cancel"/>
                </HorizontalStack>
        </VerticalStack>
 </Border>
index f819e351108197efd9c426052c0bbe2e6c55dfc5..4555a47088b10698cfeefae6a02222a470a83fa4 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>\r
-<Border BorderWidth="1" BorderColor="LightGray" Height="-1" Width="{../TemplatedWidth}" MouseClick="../onMouseClick">\r
+<Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../TemplatedWidth}" MouseClick="../onMouseClick">\r
        <HorizontalStack Spacing="1" Height="-1"  Width="{../../TemplatedWidth}">\r
                <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>\r
                <Label Text="{../../../Caption}"  Width="{../../../TemplatedWidth}"/>\r
index b14c90dad61ba0a87d179a4d95a84b3ba276a63f..03e1d3276f907498a8c25f81ad412f624dba1052 100755 (executable)
@@ -1,13 +1,15 @@
 <?xml version="1.0"?>\r
-<Border BorderWidth="1" BorderColor="LightGray" Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">\r
+<Border BorderWidth="1" Foreground="LightGray" Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">\r
        <GenericStack Orientation="{../../Orientation}" Width="{../../TemplatedWidth}" Height="{../../TemplatedHeight}">\r
-               <Button Width="12" Height="12" MouseClick="../../../onScrollBack">\r
+               <Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../onScrollBack"\r
+                       Template="#Crow.Templates.ArrowButTemplate.crow">\r
                        <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>\r
                </Button>\r
                <Slider Name="Slider" Value="{../../../Scroll}" Maximum="{../../../MaximumScroll}" \r
                        Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}" Orientation="{../../../Orientation}"\r
                        ValueChanged="../../../onSliderValueChange"/>\r
-               <Button Width="12" Height="12" MouseClick="../../../onScrollForth">\r
+               <Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../onScrollForth"\r
+                       Template="#Crow.Templates.ArrowButTemplate.crow">\r
                        <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>\r
                </Button>\r
        </GenericStack>\r
index 059456f707caa5a630b7db40aa2b7f74f2229635..b8330fcde4c310d89a1ac07ffe2330bb9b4d4270 100755 (executable)
@@ -1,13 +1,18 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" Background="White">
+<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+       Foreground="Gray"
+       Background="White">
        <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
                <Label Foreground="DimGray" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
                        Text="{../../../Value}" Margin="1" TextAlignment="RightCenter"/>
-               <VerticalStack Width="-1" Height="{../../../TemplatedHeight}" Spacing="1" >
-                       <Button Width="12" Height="8" MouseClick="../../../../onUp">
+               <VerticalStack Width="-1" Height="{../../../TemplatedHeight}" Spacing="0" >
+                       <Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../../onUp"
+                               Template="#Crow.Templates.ArrowButTemplate.crow">
                                <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
                        </Button>
-                       <Button Width="12" Height="8" MouseClick="../../../../onDown">
+                               
+                       <Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../../onDown" 
+                               Template="#Crow.Templates.ArrowButTemplate.crow">
                                <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
                        </Button>
                </VerticalStack>
index af04c9af6fad584457776ee02bb4e02320b926b1..cde66a538170a41c8b684645fd0df90ae85ac77e 100755 (executable)
@@ -1,14 +1,14 @@
 <?xml version="1.0"?>\r
-<Border BorderWidth="1" BorderColor="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
+<Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
        <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
-               <Border BorderWidth="1" BorderColor="White" Width="{../../../TemplatedWidth}" Height="-1" \r
+               <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" \r
                                Background="0,1;0,5;1,0;0,5">\r
                        <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >\r
                                <GraphicObject Width="5"/>\r
                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>\r
                                <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />\r
-                               <Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent"  Height="12" Width="12"\r
-                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
+                               <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"\r
+                                       MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">\r
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"\r
                                                 MouseClick="../../../../../../butQuitPress"/>\r
                                </Border>\r
index df6b44f27d91044b7db4dcf8c8f914268b77eedf..426ee388bb98da42d589bacce2dc155c3e65cbec 100644 (file)
@@ -137,14 +137,14 @@ namespace test
                                        CornerRadius = 5,\r
                                        Background = col,\r
                                        BorderWidth = 2,\r
-                                       BorderColor = Color.Transparent,\r
+                                       Foreground = Color.Transparent,\r
                                        Focusable = true\r
                                };\r
                                b.MouseEnter += delegate(object sender, MouseMoveEventArgs ee) {\r
-                                       (sender as Border).BorderColor = Color.White;\r
+                                       (sender as Border).Foreground = Color.White;\r
                                };\r
                                b.MouseLeave += delegate(object sender, MouseMoveEventArgs ee) {\r
-                                       (sender as Border).BorderColor = Color.Transparent;\r
+                                       (sender as Border).Foreground = Color.Transparent;\r
                                };\r
                                s.addChild (b);\r
 \r
@@ -186,14 +186,14 @@ namespace test
                                CornerRadius = 5,\r
                                Background = col,\r
                                BorderWidth = 2,\r
-                               BorderColor = Color.Transparent,\r
+                               Foreground = Color.Transparent,\r
                                Focusable = true\r
                        };\r
                        b.MouseEnter += delegate(object sender, MouseMoveEventArgs ee) {\r
-                               (sender as Border).BorderColor = Color.White;\r
+                               (sender as Border).Foreground = Color.White;\r
                        };\r
                        b.MouseLeave += delegate(object sender, MouseMoveEventArgs ee) {\r
-                               (sender as Border).BorderColor = Color.Transparent;\r
+                               (sender as Border).Foreground = Color.Transparent;\r
                        };\r
                        s.addChild (b);\r
 \r
index 23de6cf00964c91637383eacd1e00017367e5d5a..2006c35cde7c29cfba5e368ec67055f62203a8bd 100644 (file)
@@ -36,6 +36,11 @@ namespace test
                int frameCpt = 0;\r
                int idx = 0;\r
                string[] testFiles = {\r
+                       "testTextBox.crow",\r
+                       "testSpinner.goml",\r
+                       "testImage.crow",\r
+                       "testButton.crow",\r
+                       "fps.goml",\r
                        "test4.goml",\r
                        "testScrollbar.goml",\r
                        "2.crow",\r
@@ -48,7 +53,6 @@ namespace test
                        "testExpandable.goml",\r
                        "testCheckbox.goml",\r
                        "testPopper.goml",\r
-                       "fps.goml",\r
                        "testLabel.goml",\r
                        "testAll.goml",\r
 //                     "testSpinner.goml",\r
@@ -56,7 +60,6 @@ namespace test
                        "testContainer.goml",\r
                        "testBorder.goml",\r
                        "testRadioButton.goml",\r
-                       "testSpinner.goml",\r
                        "testMsgBox.goml",\r
                        "testGrid.goml",\r
                        "testMeter.goml",\r
@@ -85,6 +88,8 @@ namespace test
                                ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));\r
                                ValueChanged.Raise (this, new ValueChangeEventArgs ("update",\r
                                        this.updateTime.ElapsedMilliseconds.ToString () + " ms"));\r
+                               ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing",\r
+                                       this.drawingTime.ElapsedMilliseconds.ToString () + " ms"));\r
                        }\r
                }\r
 \r
@@ -98,6 +103,7 @@ namespace test
                        _fps = 0;\r
                }\r
                public string update = "";\r
+               public string drawing = "";\r
                #endregion\r
 \r
                public int intValue = 25;\r
@@ -147,17 +153,21 @@ namespace test
                }\r
                protected override void OnKeyDown (KeyboardKeyEventArgs e)\r
                {\r
-//                     if (FocusedWidget != null) {\r
-//                             base.OnKeyDown (e);\r
-//                             return;\r
-//                     }\r
+                       if (FocusedWidget is TextBox) {\r
+                               base.OnKeyDown (e);\r
+                               return;\r
+                       }\r
                        if (e.Key == Key.Escape) {\r
                                this.Quit ();\r
                                return;\r
-                       }else if (e.Key == Key.L) {\r
+                       } else if (e.Key == Key.L) {\r
                                TestList.Add ("new string");\r
                                NotifyValueChanged ("TestList", TestList);\r
                                return;\r
+                       } else if (e.Key == Key.W) {\r
+                               GraphicObject w = LoadInterface("Interfaces/testWindow.goml");\r
+                               w.DataSource = this;\r
+                               return;\r
                        }\r
                        ClearInterface ();\r
                        idx++;\r
@@ -168,7 +178,10 @@ namespace test
                        obj.DataSource = this;\r
 \r
                }\r
-\r
+               void onButClick(object send, MouseButtonEventArgs e)\r
+               {\r
+                       Console.WriteLine ("button clicked:" + send.ToString());\r
+               }\r
                [STAThread]\r
                static void Main ()\r
                {\r
index bf8dd6889bedfb3827c3db9cb1b9315f4a27c9e4..bce87300392f05d3165e04a0c66dc14c3493a172 100755 (executable)
@@ -4,10 +4,10 @@
        Background="0,5;0,5;0,5;0,5" Foreground="White"\r
        Margin="10" >\r
        <Border \r
-               BorderWidth="2" BorderColor="Transparent"\r
+               BorderWidth="2" Foreground="Transparent"\r
                Focusable="True"\r
-               MouseEnter="{BorderColor = White}"\r
-               MouseLeave="{BorderColor = Transparent}">\r
+               MouseEnter="{Foreground = White}"\r
+               MouseLeave="{Foreground = Transparent}">\r
 \r
                <HorizontalStack Name="hs0" Fit="true"\r
                        WidgetSpacing="10" \r
@@ -21,7 +21,7 @@
                                                Width="100" Height="20"\r
                                                Value="50"\r
                                                Foreground="BlueCrayola" Background="DarkGray"\r
-                                               BorderWidth="2" BorderColor="White"/>\r
+                                               BorderWidth="2" Foreground="White"/>\r
 <!--                                   <Label Name="labPb"\r
                                                Width="20"\r
                                                TextAlignment="RightCenter"/>\r
                                </Button>\r
                                <TextBoxWidget  TextAlignment="LeftCenter" Font="droid,14"                                              \r
                                                                Width="300" Height="-1" Margin="2"\r
-                                                               BorderColor="White" BorderWidth="1"\r
+                                                               Foreground="White" BorderWidth="1"\r
                                                                Text="editable text"/>\r
                                <GroupBox Title="Group Box" Width="300" Height="100" \r
-                                       BorderColor="White" BorderWidth="2" Margin="3">\r
+                                       Foreground="White" BorderWidth="2" Margin="3">\r
                                        <Label Name="labValue" FontSize="14" Text="000" TextAlignment="Center"/>\r
                                </GroupBox>\r
                                <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />\r
@@ -84,7 +84,7 @@
                                 Margin="5" VerticalScrolling="true">\r
                                <VerticalStack Name="colors" VerticalAlignment="Top" Margin="5">\r
                                        <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"\r
-                                                               BorderWidth="2" BorderColor="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
+                                                               BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
                                </VerticalStack>\r
                        </Scroller>-->\r
 \r
index 0e7bfda212199a8ef3ac32929e962b612b63dafa..9f8f66a6d89b60017cd4979364b84226de4be0cb 100755 (executable)
@@ -5,10 +5,10 @@
        Margin="10" >\r
        <Border Margin="10" CornerRadius="10"\r
                Name="mainBorder"\r
-               BorderWidth="2" BorderColor="Transparent"\r
+               BorderWidth="2" Foreground="Transparent"\r
                Focusable="True"\r
-               MouseEnter="{BorderColor = White}"\r
-               MouseLeave="{BorderColor = Transparent}">\r
+               MouseEnter="{Foreground = White}"\r
+               MouseLeave="{Foreground = Transparent}">\r
                <HorizontalStack WidgetSpacing="1">\r
                        <VerticalStack Width="-1">\r
                                <HorizontalStack WidgetSpacing="1" Fit="true">\r
@@ -41,7 +41,7 @@
                                <TextBox Name="textbox1" TextAlignment="LeftCenter" Font="droid,14"                                             \r
                                                                Width="200" Height="-1" Margin="2" Background="White"\r
                                                                Forground="Black"\r
-                                                               BorderColor="DimGray" BorderWidth="1"\r
+                                                               Foreground="DimGray" BorderWidth="1"\r
                                                                Text="editable text"/>\r
                                <Popper Width="100">\r
                                        <Border Fit="True" Background="ArmyGreen">\r
                                         Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">\r
                                        <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1" Fit="true">\r
 <!--                                           <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"\r
-                                                                       BorderWidth="2" BorderColor="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
+                                                                       BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
                                                <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"\r
-                                                       BorderColor="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                            -->\r
+                                                       Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                             -->\r
                                        </VerticalStack>\r
                                </Scroller>\r
                                <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"\r
                                                Maximum="200"\r
                                                Value="{fps}"\r
                                                Foreground="BlueCrayola" Background="DarkGray"\r
-                                               BorderWidth="2" BorderColor="White"/>\r
+                                               BorderWidth="2" Foreground="White"/>\r
                                </HorizontalStack>\r
 \r
                                <Button  Margin="5" BorderWidth="0" Width="-1" Height="-1"  HorizontalAlignment="Center">\r
                                </Button>\r
 \r
                                <GroupBox Title="Group Box" Width="300" Height="100" \r
-                                       BorderColor="White" BorderWidth="2" Margin="3">\r
+                                       Foreground="White" BorderWidth="2" Margin="3">\r
                                        <Label Name="labValue" FontSize="14" Text="{../../slider.Value}" TextAlignment="Center"/>\r
                                </GroupBox>\r
                                <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />\r
                                         Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">\r
                                        <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">\r
                                                <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"\r
-                                                                       BorderWidth="2" BorderColor="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
+                                                                       BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>\r
                                                <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"\r
-                                                       BorderColor="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                            \r
+                                                       Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>                                                                                             \r
                                        </VerticalStack>\r
                                </Scroller>\r
                                <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"\r
index 2d23d8ea409454d43afbb675656a9efff7899a79..0526b8ad4d04b03cb79e7eb7b796bdf2a749ad23 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>\r
-<Container Name="container0" BorderColor="White" BorderWidth="2" Margin="100"\r
+<Container Name="container0" Foreground="White" BorderWidth="2" Margin="100"\r
                        CornerRadius="50">\r
        <Group Name="group0" Background="Green" Margin="20">\r
                <HorizontalStack Name="hs0" Background="Blue" Margin="20">\r
@@ -20,7 +20,7 @@
        </Group>\r
 <!--   <Scroller Height="100" Width="300" Background="Green" VerticalScrolling="true" Margin="5">\r
                <Group Name="MainGrp" Background="Red" VerticalAlignment="Top"\r
-                        BorderColor="White" BorderWidth="2" Margin="10" Focusable="True" \r
+                        Foreground="White" BorderWidth="2" Margin="10" Focusable="True" \r
                         Width="400" Height="200">\r
                         <HorizontalStack>\r
                                <Button Width="-1" Height="-1" Margin="5" BorderWidth="2" Background="Gray">\r
index d9edd5654b5c54cc505d60a350003087aec05730..2108226d729eaab9100effb717626965a11b8ea9 100755 (executable)
@@ -1,13 +1,13 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" BorderColor="White" CornerRadius="10" Width="500" Height="300">
+<Border BorderWidth="1" Foreground="White" CornerRadius="10" Width="500" Height="300">
        <VerticalStack Height="0" Background="0,4;0,4;0,4;0,4">
-               <Border BorderWidth="1" BorderColor="White"  Height="20" Background="0,1;0,5;1,0;0,5">
+               <Border BorderWidth="1" Foreground="White"  Height="20" Background="0,1;0,5;1,0;0,5">
                        <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" >
                                <GraphicObject Width="5"/>
                                <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>
                                <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />
-                               <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent"  Height="12" Width="12"
-                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
+                               <Border CornerRadius="6" BorderWidth="1" Margin="0" Foreground="Transparent"  Height="12" Width="12"
+                                       MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" 
                                        Path="#go.Images.Icons.exit2.svg"/>
                                </Border>
diff --git a/Tests/Interfaces/testButton.crow b/Tests/Interfaces/testButton.crow
new file mode 100755 (executable)
index 0000000..5e4c5a5
--- /dev/null
@@ -0,0 +1,322 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true">
+       <HorizontalStack Fit="True">
+               <Button Caption="but" MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>      <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+</VerticalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/testImage.crow b/Tests/Interfaces/testImage.crow
new file mode 100755 (executable)
index 0000000..8a05555
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true">
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED PROPORTIONNAL" Width="150"/>
+               <Image Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
+               <Image KeepProportions="false" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="UNSCALED" Width="150"/>
+               <Image Scaled="false" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED PROPORTIONNAL" Width="150"/>
+               <Image Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
+               <Image KeepProportions="false" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="UNSCALED" Width="150"/>
+               <Image Scaled="false" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+       <HorizontalStack Width="-1" Height="100" Background="Red" Margin="5">
+               <Image Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="White" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="White" Width="20" Height="10" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="1" Background="White" Width="20" Height="10" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+</VerticalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/testTextBox.crow b/Tests/Interfaces/testTextBox.crow
new file mode 100755 (executable)
index 0000000..9e62809
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<VerticalStack Background="Red" Width="-1" Height="-1">        
+       <TextBox Name="tb" Multiline="true" Font="droid,16" Margin="5" Text="A\nBB\nCCC\nDDDD"/>
+       <TextBox Multiline="true" Font="droid,16" Name="tb5" Margin="5" Text="{../tb.SelectedText}"/>
+<!--   <TextBox Font="droid,10" Name="tb1" Margin="5" Text="this is a test of a text box"/>
+       <TextBox Width="300" Height="35" Text="this is a test of a text box"/>-->
+       <TextBox Font="droid,10" Name="tb2" Margin="0" Text="this is a test of a text box"/>
+       <TextBox Font="droid,10" Name="tb3" Margin="5" Text="this is a test of a text box"/>
+       <TextBox Font="droid,10" Name="tb4" Margin="5" Text="this is a test of a text box"/>
+       <TextBox Font="droid,10" Name="tb5" Margin="20" Text="this is a test of a text box"/>
+       <TextBox Multiline="true" Font="droid,10" Name="tb6" Margin="5" Text="this is a test of a text box\nthis is a test of a text box"/>
+       <TextBox Multiline="true" Font="droid,10" Name="tb7" Margin="1" TextAlignment="Center"
+               Text="this is a test of a text box\nthis is a test\nthis is a test when line are centered"/>
+       <TextBox Multiline="true" Font="droid,10" Name="tb8" Margin="1" TextAlignment="Center"
+               Text="this is a test of a text box\n\n\nthis is a test\nthis is a test when line are centered"/>
+</VerticalStack>
\ No newline at end of file
index 4e497fff0e862a14dcb7f9f68993c40d9fe05b6c..09bfb1ae73b047e9b537e3e6f912d0434de77145 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>\r
 <Window Left="10" Top="10" Title="Test window" \r
-               Width="250" Height="300" >\r
-       <VerticalStack Name="contentVSStack" Margin="10" Spacing="10">\r
+               Width="250" Height="550" >\r
+       <VerticalStack Name="contentVSStack" Margin="10" Spacing="10" Background="0,4;0,4;0,4;0,4">\r
                <Slider Name="slider" Height="10" Width="0"/>\r
                <GroupBox Caption="test"  Height="-1" Width="-1" Margin="5">\r
                        <VerticalStack  Height="-1" Width="0" >\r
                        <GraphicObject Width="0"/>\r
                        <CheckBox Height="-1" Width="80" IsChecked="true"/>\r
                </HorizontalStack>\r
-\r
+<Border Fit="true" CornerRadius="5" BorderWidth="1">\r
+       <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Width="120" Fit="true"\r
+               Margin="10" Focusable="True" >\r
+                       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >\r
+                               <HorizontalStack Fit="true">\r
+                                       <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>\r
+                                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Background="AoEnglish" Width="50" TextAlignment="Center"/>\r
+                               </HorizontalStack>\r
+                               <HorizontalStack Fit="true">\r
+                                       <Label Text="Drawing:" Width="50" TextAlignment="RightCenter"/>\r
+                                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Background="AoEnglish" Width="50" TextAlignment="Center"/>\r
+                               </HorizontalStack>\r
+                               <HorizontalStack Fit="true">\r
+                                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>\r
+                                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/>\r
+                               </HorizontalStack>\r
+                               <HorizontalStack Fit="true">\r
+                                       <Label Text="Min:" Width="50" TextAlignment="RightCenter"/>\r
+                                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/>\r
+                               </HorizontalStack>\r
+                               <HorizontalStack Fit="true">\r
+                                       <Label Text="Max:" Width="50" TextAlignment="RightCenter"/>\r
+                                       <Label Text="{fpsMax}" Font="droid , 12" Background="AoEnglish" Width="50" TextAlignment="Center"/>\r
+                               </HorizontalStack>\r
+                       </VerticalStack>                                \r
+       </Container>\r
+</Border>\r
 <!--           <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->\r
        </VerticalStack>\r
 </Window>\r
index 235f08067768c1a91d9b8448df77ce75bc6143c8..fd070bb56ee20fac8e33802015be6e02410b30f2 100755 (executable)
@@ -2,16 +2,16 @@
 <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" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
+               <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">\r
                        <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
-                               <Border BorderWidth="1" BorderColor="White" Width="{../../../TemplatedWidth}" Height="-1" \r
+                               <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" \r
                                                Background="0,1;0,5;1,0;0,5">\r
                                        <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >\r
                                                <GraphicObject Width="5"/>\r
                                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>\r
                                                <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />\r
-                                               <Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent"  Height="12" Width="12"\r
-                                                       MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
+                                               <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"\r
+                                                       MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">\r
                                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"\r
                                                                 MouseClick="../../../../../../butQuitPress"/>\r
                                                </Border>\r
index 4348439d46bc238c7ec345356cbf974c5d150652..1cc3f63020d0c793f6532455c683a50f7ab8260a 100755 (executable)
@@ -4,7 +4,7 @@
        <VerticalStack Fit="true" Margin="50">\r
                <Label Text="{MousePos}" Width="-1" Background="DarkGreen"/>\r
                <Label Text="{Hover}" Width="-1" Background="DarkGreen"/>\r
-               <Button Text="Clear" Width="150" MouseClick="OnClear"/>\r
+               <Button Caption="Clear" Width="150" MouseClick="OnClear"/>\r
                <ListBox Data="{TestList}" Background="0,5;0,5;0,5;0,5"\r
                                         HorizontalAlignment="Center" Width="-1" Height="150" Margin="5">\r
                        <Template>\r
@@ -22,6 +22,6 @@
                                </Border>\r
                        </Template>\r
                </ListBox>\r
-               <Button Text="Load list" Width="0" MouseClick="OnLoadList"/>\r
+               <Button Caption="Load list" Width="0" MouseClick="OnLoadList"/>\r
        </VerticalStack>\r
 </Border>
\ No newline at end of file
index e2b21afeb231a3c878a9a3d188cead77dcb8e060..5919a9d446325cdfc4d79f2692313524ed899e97 100644 (file)
@@ -58,9 +58,6 @@
     <Compile Include="..\bin\Debug\Interfaces\test_stack.goml.cs">
       <Link>Interfaces\test_stack.goml.cs</Link>
     </Compile>
-    <Compile Include="..\bin\Debug\Interfaces\test4.goml.cs">
-      <Link>Interfaces\test4.goml.cs</Link>
-    </Compile>
   </ItemGroup>
   <ItemGroup>
     <None Include="image\u.svg">
     <None Include="Interfaces\1.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\testButton.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\testImage.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\testTextBox.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
diff --git a/UnitTest/Interfaces/testButton.crow b/UnitTest/Interfaces/testButton.crow
new file mode 100755 (executable)
index 0000000..5e4c5a5
--- /dev/null
@@ -0,0 +1,322 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true">
+       <HorizontalStack Fit="True">
+               <Button Caption="but" MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>      <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="True">
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+               <Button MouseClick="onButClick"/>
+       </HorizontalStack>
+</VerticalStack>
\ No newline at end of file
diff --git a/UnitTest/Interfaces/testImage.crow b/UnitTest/Interfaces/testImage.crow
new file mode 100755 (executable)
index 0000000..1939982
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true">
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED PROPORTIONNAL" Width="150"/>
+               <Image Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
+               <Image KeepProportions="false" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="UNSCALED" Width="150"/>
+               <Image Scaled="false" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED PROPORTIONNAL" Width="150"/>
+               <Image Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
+               <Image KeepProportions="false" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+       <HorizontalStack Fit="true" Background="Red" Margin="5">
+               <Label Text="UNSCALED" Width="150"/>
+               <Image Scaled="false" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="2" Background="Blue" Width="20" Height="20" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.tetra.png"/>
+       </HorizontalStack>
+</VerticalStack>
\ No newline at end of file
index 0c73b8e73c9f5bfab715349058097ca6a7863681..5b5ede3fa0fbedca16a09d8a02b18d48754e4407 100644 (file)
@@ -301,7 +301,7 @@ namespace Crow
                {\r
                        if (_activeWidget != null) {\r
                                //first, ensure object is still in the graphic tree\r
-                               if (_activeWidget.TopContainer == null) {\r
+                               if (_activeWidget.HostContainer == null) {\r
                                        activeWidget = null;\r
                                } else {\r
 \r
@@ -313,7 +313,7 @@ namespace Crow
 \r
                        if (_hoverWidget != null) {\r
                                //first, ensure object is still in the graphic tree\r
-                               if (_hoverWidget.TopContainer == null) {\r
+                               if (_hoverWidget.HostContainer == null) {\r
                                        hoverWidget = null;\r
                                } else {\r
                                        //check topmost graphicobject first\r
@@ -374,7 +374,7 @@ namespace Crow
                                return;\r
                        }\r
 \r
-                       _activeWidget.onMouseButtonUp (this, e);\r
+                       _activeWidget.onMouseUp (this, e);\r
                        _activeWidget = null;\r
                }\r
                void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)\r
@@ -393,7 +393,7 @@ namespace Crow
                        }\r
 \r
                        _activeWidget = g;\r
-                       _activeWidget.onMouseButtonDown (this, e);\r
+                       _activeWidget.onMouseDown (this, e);\r
                }\r
 \r
                void Mouse_WheelChanged(object sender, MouseWheelEventArgs e)\r
@@ -439,7 +439,7 @@ namespace Crow
                Rectangle ILayoutable.ClientRectangle {\r
                        get { return new Size(this.ClientRectangle.Size.Width,this.ClientRectangle.Size.Height); }\r
                }\r
-               public IGOLibHost TopContainer {\r
+               public IGOLibHost HostContainer {\r
                        get { return this; }\r
                }\r
 \r
index ddd53b61a7f7b8922606e9bf20afd09eef974835..4ffa61a286e13623a4659d4d8f6bfbb707193f7d 100644 (file)
@@ -10,6 +10,7 @@
     <RootNamespace>UnitTest</RootNamespace>
     <AssemblyName>UnitTest</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <ReleaseVersion>0.2</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <None Include="Interfaces\2.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\testButton.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\testImage.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Crow.csproj">
index 65901694ed477f9c8dbeab5b29437a6ce8dce93f..879329aac67fc9ea8f5199450ce68ea6640bad18 100644 (file)
@@ -66,30 +66,27 @@ namespace Crow
                        float widthRatio = 1f;
                        float heightRatio = 1f;
 
-                       if (Scale){
+                       if (Scaled){
                                widthRatio = (float)rect.Width / Dimensions.Width;
                                heightRatio = (float)rect.Height / Dimensions.Height;
                        }
 
-                       float ratio = Math.Min (widthRatio, heightRatio);
-
-//                     if (KeepProportions)
-//                             widthRatio = heightRatio = ratio;
+                       if (KeepProportions) {
+                               if (widthRatio < heightRatio)
+                                       heightRatio = widthRatio;
+                               else
+                                       widthRatio = heightRatio;
+                       }
 
-                       Rectangle rImg = rect;
                        gr.Save ();
 
-                       if (KeepProportions) {
-                               gr.Translate ((rect.Width - (float)Dimensions.Width * ratio)/2f, 
-                                       (rect.Height - (float)Dimensions.Height * ratio)/2f);
-                               gr.Scale (ratio, ratio);
-                                       
-                       }else
-                               gr.Scale (widthRatio, heightRatio);
+                       gr.Translate (rect.Left,rect.Top);
+                       gr.Scale (widthRatio, heightRatio);
+                       gr.Translate ((rect.Width/widthRatio - Dimensions.Width)/2, (rect.Height/heightRatio - Dimensions.Height)/2);
                        
                        using (ImageSurface imgSurf = new ImageSurface (image, Format.Argb32, 
                                Dimensions.Width, Dimensions.Height, 4 * Dimensions.Width)) {
-                               gr.SetSourceSurface (imgSurf, (int)(rImg.X / widthRatio), (int)(rImg.Y / heightRatio));
+                               gr.SetSourceSurface (imgSurf, 0,0);
                                gr.Paint ();
                        }
                        gr.Restore ();
diff --git a/src/BubblingMouseButtonEventArgs.cs b/src/BubblingMouseButtonEventArgs.cs
new file mode 100644 (file)
index 0000000..863d265
--- /dev/null
@@ -0,0 +1,14 @@
+using System;
+using OpenTK.Input;
+
+namespace Crow
+{
+       public class BubblingMouseButtonEventArg: MouseButtonEventArgs
+       {
+               public GraphicObject Focused;
+               public BubblingMouseButtonEventArg(MouseButtonEventArgs mbe) : base(mbe){
+                       
+               }
+       }
+}
+
index 2085679451c3152f6a42b5fd174522a9713c205e..25d66f4b357a03c276fc02c5cf0dbbe35afcfe44 100644 (file)
@@ -96,7 +96,7 @@ namespace Crow
                                ILayoutable tmp = Source.Instance as ILayoutable;
                                if (string.IsNullOrEmpty (bindingExp [0])) {
                                        //if exp start with '/' => Graphic tree parsing start at top container
-                                       tmp = tmp.TopContainer as ILayoutable;
+                                       tmp = tmp.HostContainer as ILayoutable;
                                        ptr++;
                                }
                                while (ptr < bindingExp.Length - 1) {
index f412268c293808eefcfebf82fc10e281a86a3a7d..d9791050233faee7f9db1fbd5ee1dffab15c10e4 100644 (file)
@@ -12,7 +12,6 @@ namespace Crow
                #endregion
 
                #region private fields
-               Color _borderColor;
                int _borderWidth;
                #endregion
 
@@ -26,12 +25,9 @@ namespace Crow
                        }
                }
                [XmlAttributeAttribute()][DefaultValue("White")]
-               public virtual Color BorderColor {
-                       get { return _borderColor; }
-                       set {
-                               _borderColor = value;
-                               registerForGraphicUpdate ();
-                       }
+               public override Color Foreground {
+                       get { return base.Foreground;}
+                       set {base.Foreground = value;}
                }
                #endregion
 
@@ -62,7 +58,7 @@ namespace Crow
 
                        if (BorderWidth > 0) {
                                gr.LineWidth = BorderWidth;
-                               gr.Color = BorderColor;
+                               gr.Color = Foreground;
                                CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
                                gr.Stroke ();
                        }
index 5d3e81ca93ac85d071e023f086aaf703e13092c4..17fbe328331842fc28930fa9703c867a50982cdd 100644 (file)
@@ -13,71 +13,93 @@ using System.ComponentModel;
 \r
 namespace Crow\r
 {\r
-    public class Button : Container, IXmlSerializable\r
+       [DefaultTemplate("#Crow.Templates.Button.crow")]\r
+    public class Button : TemplatedContainer\r
     {\r
                #region CTOR\r
         public Button() : base()\r
         {\r
                        //MouseEnter += delegate { Background = Color.RedDevil;};\r
                        //MouseLeave += delegate { Background = Color.Transparent;};\r
-                       MouseButtonDown += delegate { BackImgSub = "pressed"; registerForGraphicUpdate();};\r
-                       MouseButtonUp += delegate { BackImgSub = "normal";registerForGraphicUpdate();};\r
+//                     MouseButtonDown += delegate { BackImgSub = "pressed"; registerForGraphicUpdate();};\r
+//                     MouseButtonUp += delegate { BackImgSub = "normal";registerForGraphicUpdate();};\r
                }\r
                #endregion\r
 \r
-               #region GraphicObject Overrides\r
-               [XmlAttributeAttribute()][DefaultValue(50)]\r
-               public override int Width {\r
-                       get { return base.Width; }\r
-                       set { base.Width = value; }\r
-               }\r
-               [XmlAttributeAttribute()][DefaultValue(20)]\r
-               public override int Height {\r
-                       get { return base.Height; }\r
-                       set { base.Height = value; }\r
+               string caption;\r
+               string image;\r
+               Container _contentContainer;\r
+\r
+               public override GraphicObject Content {\r
+                       get {\r
+                               return _contentContainer == null ? null : _contentContainer.Child;\r
+                       }\r
+                       set {\r
+                               if (_contentContainer != null)                                  \r
+                                       _contentContainer.SetChild(value);\r
+                       }\r
                }\r
-               [XmlAttributeAttribute()][DefaultValue("Transparent")]\r
-               public override Color Background {\r
-                       get { return base.Background; }\r
-                       set { base.Background = value; }\r
+               protected override void loadTemplate(GraphicObject template = null)\r
+               {\r
+                       base.loadTemplate (template);\r
+\r
+                       _contentContainer = this.child.FindByName ("Content") as Container;\r
                }\r
+\r
+               #region GraphicObject Overrides\r
+//             [XmlAttributeAttribute()][DefaultValue(50)]\r
+//             public override int Width {\r
+//                     get { return base.Width; }\r
+//                     set { base.Width = value; }\r
+//             }\r
+//             [XmlAttributeAttribute()][DefaultValue(20)]\r
+//             public override int Height {\r
+//                     get { return base.Height; }\r
+//                     set { base.Height = value; }\r
+//             }\r
                [XmlAttributeAttribute()][DefaultValue(true)]\r
         public override bool Focusable\r
         {\r
             get { return base.Focusable; }\r
             set { base.Focusable = value; }\r
                }\r
-               [XmlAttributeAttribute()][DefaultValue("#Crow.Images.button.svg")]\r
-               public override Picture BackgroundImage {\r
-                       get {\r
-                               return base.BackgroundImage;\r
-                       }\r
-                       set {\r
-                               base.BackgroundImage = value;\r
-                               BackImgSub = "normal";\r
-                       }\r
+               public override void ResolveBindings ()\r
+               {\r
+                       base.ResolveBindings ();\r
+                       if (Content != null)\r
+                               Content.ResolveBindings ();\r
+               }\r
+               public override void onMouseDown (object sender, MouseButtonEventArgs e)\r
+               {\r
+                       base.onMouseDown (sender, e);\r
+                       NotifyValueChanged ("State", "pressed");\r
+               }\r
+               public override void onMouseUp (object sender, MouseButtonEventArgs e)\r
+               {\r
+                       base.onMouseUp (sender, e);\r
+                       NotifyValueChanged ("State", "normal");\r
                }\r
                #endregion\r
 \r
-               [XmlAttributeAttribute][DefaultValue("Button")]\r
-               public string Text\r
-               {\r
-                       get {\r
-                               Label l = Child as Label;\r
-                               return l == null ? "" : l.Text; \r
+               [XmlAttributeAttribute()][DefaultValue("Button")]\r
+               public string Caption {\r
+                       get { return caption; } \r
+                       set {\r
+                               if (caption == value)\r
+                                       return;\r
+                               caption = value; \r
+                               NotifyValueChanged ("Caption", caption);\r
                        }\r
-                       set\r
-                       {\r
-                               Label l = Child as Label;\r
-                               if (l == null)\r
-                                       this.SetChild(new Label (value) \r
-                                               { \r
-                                                       TextAlignment = Alignment.Center,\r
-                                                       Foreground = Color.Black\r
-                                               });\r
-                               else\r
-                                       l.Text = value;\r
+               }        \r
+               [XmlAttributeAttribute()][DefaultValue("#Crow.Images.button.svg")]\r
+               public string Image {\r
+                       get { return image; } \r
+                       set {\r
+                               if (image == value)\r
+                                       return;\r
+                               image = value; \r
+                               NotifyValueChanged ("Image", image);\r
                        }\r
-               }       \r
+               }     \r
        }\r
 }\r
index 5d9c8e9765bb83702069bf945fc72dbb6cb2a63b..b958a81b11e65252632564c3116d6af9286152c2 100644 (file)
@@ -316,7 +316,7 @@ namespace Crow
                        \r
                public virtual void onPop(object sender, EventArgs e)\r
                {\r
-                       IGOLibHost tc = TopContainer;\r
+                       IGOLibHost tc = HostContainer;\r
                        if (tc == null)\r
                                return;\r
                        if (Overlay != null) {\r
@@ -329,7 +329,7 @@ namespace Crow
                }\r
                public virtual void onUnpop(object sender, EventArgs e)\r
                {\r
-                       IGOLibHost tc = TopContainer;\r
+                       IGOLibHost tc = HostContainer;\r
                        if (tc == null)\r
                                return;\r
                        Overlay.Visible = false;\r
index 968c76acb76d7d1c61699097554afb5d403abaf1..1624c53009a0cd4d52b316c6610789534a377eb6 100644 (file)
@@ -88,6 +88,9 @@ namespace Crow
                }\r
                public virtual void ComputeChildrenPositions()\r
                {\r
+                       #if DEBUG_LAYOUTING\r
+                       Debug.WriteLine("ComputeChildrenPosition: " + this.ToString());\r
+                       #endif\r
                        int d = 0;\r
                        if (Orientation == Orientation.Horizontal) {\r
                                foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {\r
index ff94392c00078bcb06821c8096e31671748b86f2..69f19ca2d52ca902b7e4d06205151c24519ec546 100644 (file)
@@ -73,6 +73,7 @@ namespace Crow
                int _margin = 0;\r
                bool _focusable = false;\r
                bool _hasFocus = false;\r
+               bool _mouseRepeat;\r
                protected bool _isVisible = true;\r
                VerticalAlignment _verticalAlignment = VerticalAlignment.Center;\r
                HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;\r
@@ -93,6 +94,8 @@ namespace Crow
                #endregion\r
 \r
                #region ILayoutable\r
+               //TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject\r
+               //              or we could add to the interface the mouse events\r
                [XmlIgnore]public ILayoutable Parent { \r
                        get { return _parent; }\r
                        set {\r
@@ -116,8 +119,8 @@ namespace Crow
                                return cb;\r
                        }\r
                }\r
-               [XmlIgnore]public virtual IGOLibHost TopContainer {\r
-                       get { return Parent == null ? null : Parent.TopContainer; }\r
+               [XmlIgnore]public virtual IGOLibHost HostContainer {\r
+                       get { return Parent == null ? null : Parent.HostContainer; }\r
                }\r
                public virtual Rectangle ContextCoordinates(Rectangle r){\r
                        return\r
@@ -141,8 +144,8 @@ namespace Crow
 \r
                #region EVENT HANDLERS\r
                public event EventHandler<MouseWheelEventArgs> MouseWheelChanged;\r
-               public event EventHandler<MouseButtonEventArgs> MouseButtonUp;\r
-               public event EventHandler<MouseButtonEventArgs> MouseButtonDown;\r
+               public event EventHandler<MouseButtonEventArgs> MouseUp;\r
+               public event EventHandler<MouseButtonEventArgs> MouseDown;\r
                public event EventHandler<MouseButtonEventArgs> MouseClick;\r
                public event EventHandler<MouseMoveEventArgs> MouseMove;\r
                public event EventHandler<MouseMoveEventArgs> MouseEnter;\r
@@ -247,35 +250,75 @@ namespace Crow
                }\r
                [XmlAttributeAttribute()][DefaultValue(false)]\r
                public virtual bool Focusable {\r
-                       get { return _focusable | Interface.DesignerMode; }\r
-                       set { _focusable = value; }\r
-               }        \r
+                       get { return _focusable; }\r
+                       set {\r
+                               if (_focusable == value)\r
+                                       return;\r
+                               _focusable = value; \r
+                               NotifyValueChanged ("Focusable", _focusable);\r
+                       }\r
+               }\r
+               [XmlIgnore]public virtual bool HasFocus {\r
+                       get { return _hasFocus; }\r
+                       set { \r
+                               if (value == _hasFocus)\r
+                                       return;\r
+\r
+                               _hasFocus = value; \r
+                               NotifyValueChanged ("HasFocus", _hasFocus);\r
+                       }\r
+               }\r
+               [XmlAttributeAttribute()][DefaultValue(false)]\r
+               public virtual bool MouseRepeat {\r
+                       get { return _mouseRepeat; }\r
+                       set {\r
+                               if (_mouseRepeat == value)\r
+                                       return;\r
+                               _mouseRepeat = value; \r
+                               NotifyValueChanged ("MouseRepeat", _mouseRepeat);\r
+                       }\r
+               } \r
                [XmlAttributeAttribute()][DefaultValue("Transparent")]\r
                public virtual Color Background {\r
                        get { return _background; }\r
                        set {\r
-                               _background = value;\r
+                               if (_background == value)\r
+                                       return;\r
+                               _background = value; \r
+                               NotifyValueChanged ("Background", _background);\r
                                registerForGraphicUpdate ();\r
                        }\r
-               }\r
+               } \r
                [XmlAttributeAttribute()][DefaultValue("White")]\r
                public virtual Color Foreground {\r
                        get { return _foreground; }\r
                        set {\r
-                               _foreground = value;\r
+                               if (_foreground == value)\r
+                                       return;\r
+                               _foreground = value; \r
+                               NotifyValueChanged ("Foreground", _foreground);\r
                                registerForGraphicUpdate ();\r
                        }\r
-               }\r
+               } \r
                [XmlAttributeAttribute()][DefaultValue("droid,10")]\r
                public virtual Font Font {\r
                        get { return _font; }\r
-                       set { _font = value; }\r
+                       set { \r
+                               if (value == _font)\r
+                                       return;                         \r
+                               _font = value; \r
+                               NotifyValueChanged ("Font", _font);\r
+                               registerForGraphicUpdate ();\r
+                       }\r
                }\r
                [XmlAttributeAttribute()][DefaultValue(0.0)]\r
                public virtual double CornerRadius {\r
                        get { return _cornerRadius; }\r
                        set {\r
-                               _cornerRadius = value;\r
+                               if (value == _cornerRadius)\r
+                                       return;                         \r
+                               _cornerRadius = value; \r
+                               NotifyValueChanged ("CornerRadius", _cornerRadius);\r
                                registerForGraphicUpdate ();\r
                        }\r
                }\r
@@ -283,7 +326,10 @@ namespace Crow
                public virtual int Margin {\r
                        get { return _margin; }\r
                        set {\r
-                               _margin = value;\r
+                               if (value == _margin)\r
+                                       return;                         \r
+                               _margin = value; \r
+                               NotifyValueChanged ("Margin", _margin);\r
                                registerForGraphicUpdate ();\r
                        }\r
                }\r
@@ -296,25 +342,20 @@ namespace Crow
 \r
                                _isVisible = value;\r
 \r
-                               if (TopContainer == null)\r
+                               if (HostContainer == null)\r
                                        return;\r
                                //add slot to clipping to redraw\r
-                               TopContainer.gobjsToRedraw.Add (this);\r
+                               HostContainer.gobjsToRedraw.Add (this);\r
 \r
                                //ensure main win doesn't keep hidden childrens ref\r
-                               if (this.Contains (TopContainer.hoverWidget))\r
-                                       TopContainer.hoverWidget = null;\r
+                               if (this.Contains (HostContainer.hoverWidget))\r
+                                       HostContainer.hoverWidget = null;\r
                                if (Parent is GenericStack)\r
                                        Parent.RegisterForLayouting ((int)LayoutingType.Sizing | (int)LayoutingType.PositionChildren);\r
-//                                     Parent.InvalidateLayout ();\r
-                               //else\r
-                               //    registerForRedraw();\r
+\r
+                               NotifyValueChanged ("Visible", _isVisible);\r
                        }\r
                }\r
-               [XmlIgnore]public virtual bool HasFocus {\r
-                       get { return _hasFocus; }\r
-                       set { _hasFocus = value; }\r
-               }\r
                //TODO: only used in group, should be removed from base go object\r
                [XmlIgnore]public virtual bool DrawingIsValid\r
                { get { return bmp == null ? \r
@@ -450,16 +491,16 @@ namespace Crow
                public virtual void registerForGraphicUpdate ()\r
                {\r
                        bmp = null;\r
-                       if (TopContainer != null)\r
-                               TopContainer.gobjsToRedraw.Add (this);\r
+                       if (HostContainer != null)\r
+                               HostContainer.gobjsToRedraw.Add (this);\r
                }\r
                /// <summary>\r
                /// Add clipping region in redraw list of interface, dont update cached object content\r
                /// </summary>\r
                public virtual void RegisterForRedraw ()\r
                {\r
-                       if (TopContainer != null)\r
-                               TopContainer.gobjsToRedraw.Add (this);\r
+                       if (HostContainer != null)\r
+                               HostContainer.gobjsToRedraw.Add (this);\r
                }\r
 \r
                /// <summary>\r
@@ -477,10 +518,10 @@ namespace Crow
 \r
                public virtual void registerClipRect()\r
                {\r
-                       TopContainer.redrawClip.AddRectangle (ScreenCoordinates(Slot));\r
+                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(Slot));\r
                        //this clipping should take only last painted slots in ancestor tree which\r
                        //is not the case for now.\r
-                       TopContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));\r
+                       HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));\r
                }\r
                /// <summary> return size of content + margins </summary>\r
                protected virtual Size measureRawSize ()\r
@@ -782,7 +823,7 @@ namespace Crow
                }\r
                public virtual void checkHoverWidget(MouseMoveEventArgs e)\r
                {\r
-                       IGOLibHost glh = TopContainer;\r
+                       IGOLibHost glh = HostContainer;\r
                        if (glh.hoverWidget != this) {\r
                                glh.hoverWidget = this;\r
                                onMouseEnter (this, e);\r
@@ -799,19 +840,37 @@ namespace Crow
                        \r
                        MouseMove.Raise (sender, e);\r
                }\r
-               public virtual void onMouseButtonUp(object sender, MouseButtonEventArgs e){\r
-                       if (MouseIsIn (e.Position))\r
-                               onMouseClick (sender, e);\r
-\r
-                       MouseButtonUp.Raise (this, e);\r
+               public virtual void onMouseDown(object sender, MouseButtonEventArgs e){\r
+                       IGOLibHost hc = HostContainer;\r
+                       if (hc.activeWidget == null)\r
+                               hc.activeWidget = this;\r
+                       if (this.Focusable && !Interface.FocusOnHover) {\r
+                               BubblingMouseButtonEventArg be = e as BubblingMouseButtonEventArg;\r
+                               if (be.Focused == null) {\r
+                                       be.Focused = this;\r
+                                       hc.FocusedWidget = this;\r
+                               }\r
+                       }\r
+                       //bubble event to the top\r
+                       GraphicObject p = Parent as GraphicObject;\r
+                       if (p != null)\r
+                               p.onMouseDown(sender,e);\r
+                       \r
+                       MouseDown.Raise (this, e);\r
                }\r
-               public virtual void onMouseButtonDown(object sender, MouseButtonEventArgs e){\r
-                       TopContainer.FocusedWidget = this;\r
+               public virtual void onMouseUp(object sender, MouseButtonEventArgs e){\r
+                       //bubble event to the top\r
+                       GraphicObject p = Parent as GraphicObject;\r
+                       if (p != null)\r
+                               p.onMouseUp(sender,e);\r
 \r
-                       MouseButtonDown.Raise (this, e);\r
+                       MouseUp.Raise (this, e);\r
+\r
+                       if (MouseIsIn (e.Position)&&HasFocus)\r
+                               onMouseClick(sender,e);\r
                }\r
-               public virtual void onMouseClick(object sender, MouseButtonEventArgs e){        \r
-                       MouseClick.Raise (this,e);\r
+               public virtual void onMouseClick(object sender, MouseButtonEventArgs e){                                                        \r
+                       MouseClick.Raise (this, e);\r
                }\r
                public virtual void onMouseWheel(object sender, MouseWheelEventArgs e){\r
                        GraphicObject p = Parent as GraphicObject;\r
@@ -1080,24 +1139,28 @@ namespace Crow
                                GraphicObject lopObj = this;    //default left operand base object is \r
                                //the first arg (object sender) of the event handler\r
 \r
+                               il.Emit(OpCodes.Ldarg_0);       //load sender ref onto the stack\r
+\r
                                string[] lopParts = lop.Split (new char[] { '.' });\r
-                               if (lopParts.Length == 2) {//should search also for member of es.Source\r
-                                       lopObj = this.FindByName (lopParts [0]);\r
-                                       if (lopObj==null)\r
-                                               throw new Exception (string.Format("GOML:Unknown name: {0}", lopParts[0]));\r
-                                       //TODO: should create private member holding ref of lopObj, and emit\r
-                                       //a call to FindByName(lopObjName) during #ctor or in a onLoad func or evt handler\r
-                                       throw new Exception (string.Format("GOML:obj tree ref not yet implemented", lopParts[0]));\r
-                               }else\r
-                                       il.Emit(OpCodes.Ldarg_0);       //load sender ref onto the stack\r
+                               if (lopParts.Length > 1) {//should search also for member of es.Source\r
+                                       MethodInfo FindByNameMi = typeof(GraphicObject).GetMethod("FindByName");\r
+                                       for (int j = 0; j < lopParts.Length - 1; j++) {\r
+                                               il.Emit (OpCodes.Ldstr, lopParts[j]);\r
+                                               il.Emit(OpCodes.Callvirt, FindByNameMi);\r
+                                       }\r
+                               }\r
 \r
                                int i = lopParts.Length -1;\r
 \r
-                               MemberInfo lopMbi = lopObj.GetType().GetMember (lopParts[i])[0];\r
+                               MemberInfo[] lopMbis = lopObj.GetType().GetMember (lopParts[i]);\r
+\r
+                               if (lopMbis.Length<1)\r
+                                       throw new Exception (string.Format("CROW BINDING: Member not found '{0}'", lop));\r
+                               \r
                                OpCode lopSetOC;\r
                                dynamic lopSetMbi;\r
                                Type lopT = null;\r
-                               switch (lopMbi.MemberType) {\r
+                               switch (lopMbis[0].MemberType) {\r
                                case MemberTypes.Property:\r
                                        PropertyInfo lopPi = sourceType.GetProperty (lopParts[i]);\r
                                        MethodInfo dstMi = lopPi.GetSetMethod ();\r
index 7f2ce06082128a4be50bc06d930e71d0bf814037..77cb6d646dc52bb8409a7b85d68d59920085efde 100644 (file)
@@ -255,8 +255,8 @@ namespace Crow
                #region Mouse handling\r
                public override void checkHoverWidget (OpenTK.Input.MouseMoveEventArgs e)\r
                {\r
-                       if (TopContainer.hoverWidget != this) {\r
-                               TopContainer.hoverWidget = this;\r
+                       if (HostContainer.hoverWidget != this) {\r
+                               HostContainer.hoverWidget = this;\r
                                onMouseEnter (this, e);\r
                        }\r
                        foreach (GraphicObject g in Children)\r
index 0d4201d9b211480e5c7d116fea3963f58a169d4a..000d377bdd3ae3c37777893a0f451c2fb4684978 100644 (file)
@@ -10,7 +10,7 @@ namespace Crow
                Rectangle getSlot();
                Rectangle getBounds();
 
-               IGOLibHost TopContainer { get; }
+               IGOLibHost HostContainer { get; }
 
                void RegisterForLayouting(int layoutType);
                void UpdateLayout(LayoutingType layoutType);
index 0aa48ac72b6adacf013ee63c711257e095b3e271..e7f75fe88a84ceaf5c49a81ffc75154b14681059 100644 (file)
@@ -15,7 +15,36 @@ namespace Crow
        {\r
                Picture _pic;\r
                string _svgSub;\r
-\r
+               bool scaled;\r
+               [XmlAttributeAttribute()][DefaultValue(true)]\r
+               public virtual bool Scaled {\r
+                       get { return scaled; }\r
+                       set {\r
+                               if (scaled == value)\r
+                                       return;\r
+                               scaled = value; \r
+                               NotifyValueChanged ("Scaled", scaled);\r
+                               if (_pic == null)\r
+                                       return;\r
+                               _pic.Scaled = scaled;\r
+                               registerForGraphicUpdate ();\r
+                       }\r
+               } \r
+               bool keepProps;\r
+               [XmlAttributeAttribute()][DefaultValue(true)]\r
+               public virtual bool KeepProportions {\r
+                       get { return keepProps; }\r
+                       set {\r
+                               if (keepProps == value)\r
+                                       return;\r
+                               keepProps = value; \r
+                               NotifyValueChanged ("KeepProportions", keepProps);\r
+                               if (_pic == null)\r
+                                       return;\r
+                               _pic.KeepProportions = keepProps;\r
+                               registerForGraphicUpdate ();\r
+                       }\r
+               } \r
         [XmlAttributeAttribute("Path")]        \r
                public string Path {\r
                        get { return _pic == null ? null : _pic.Path; }\r
@@ -26,7 +55,8 @@ namespace Crow
                                                return;\r
                                        }\r
                                        LoadImage (value);\r
-                                       _pic.KeepProportions = true;\r
+                                       _pic.Scaled = scaled;\r
+                                       _pic.KeepProportions = keepProps;\r
                                } catch (Exception ex) {\r
                                        Debug.WriteLine (ex.Message);\r
                                        _pic = null;\r
@@ -47,23 +77,6 @@ namespace Crow
                public Image () : base()\r
                {\r
                }\r
-               public Image (string _imgPath, Rectangle _bounds)\r
-            : base(_bounds)\r
-               {                       \r
-            LoadImage(_imgPath);\r
-        }\r
-               public Image (string _imgPath)\r
-            : base()\r
-               {                       \r
-            LoadImage(_imgPath);\r
-               }\r
-//             public Image (System.Drawing.Bitmap _bitmap)\r
-//            : base()\r
-//             {\r
-//                     _pic = new BmpPicture ();\r
-//\r
-//                     LoadImage (_bitmap);\r
-//             }\r
                #endregion\r
 \r
                #region Image Loading\r
index 5ad5474a579b8abedf47431aede7349acdc26fb5..460dcbdc71133e6a003cd45c3c91b85e1d9b4054 100644 (file)
@@ -35,10 +35,11 @@ namespace Crow
                bool _multiline = false;\r
                Color selColor;\r
                Color selFontColor;\r
-               bool _selectable;\r
-               Point mouseLocalPos;    //mouse coord in widget space, filled only when clicked        \r
+               Point mouseLocalPos = -1;//mouse coord in widget space, filled only when clicked        \r
                int _currentCol;        //0 based cursor position in string\r
                int _currentLine;\r
+               Point _selBegin = -1;   //selection start (row,column)\r
+               Point _selRelease = -1; //selection end (row,column)\r
                double textCursorPos;   //cursor position in cairo units in widget client coord.\r
                double SelStartCursorPos = -1;\r
                double SelEndCursorPos = -1;\r
@@ -55,24 +56,24 @@ namespace Crow
                public virtual Color SelectionBackground {\r
                        get { return selColor; }\r
                        set {\r
+                               if (value == selColor)\r
+                                       return;\r
                                selColor = value;\r
+                               NotifyValueChanged ("SelectionBackground", selColor);\r
                                registerForGraphicUpdate ();\r
                        }\r
                }\r
-               [XmlAttributeAttribute()][DefaultValue("Black")]\r
+               [XmlAttributeAttribute()][DefaultValue("DarkGray")]\r
                public virtual Color SelectionForeground {\r
                        get { return selFontColor; }\r
                        set {\r
+                               if (value == selFontColor)\r
+                                       return;\r
                                selFontColor = value;\r
+                               NotifyValueChanged ("SelectionForeground", selFontColor);\r
                                registerForGraphicUpdate ();\r
                        }\r
                }\r
-               [XmlAttributeAttribute()][DefaultValue(false)]\r
-               public virtual bool Selectable {\r
-                       get { return _selectable; }\r
-                       set { _selectable = value; }\r
-               }\r
-\r
         [XmlAttributeAttribute()][DefaultValue(Alignment.LeftCenter)]\r
                public Alignment TextAlignment\r
         {\r
@@ -90,24 +91,19 @@ namespace Crow
             {\r
                 if (_text == value)\r
                     return;\r
-                                                       \r
-                registerForGraphicUpdate();\r
-                               this.RegisterForLayouting ((int)LayoutingType.Sizing);\r
-\r
-\r
+                                                                       \r
                 _text = value;\r
 \r
                                if (string.IsNullOrEmpty(_text))\r
                                        _text = "";\r
 \r
                                lines = getLines;\r
+\r
+                               //registerForGraphicUpdate();\r
+                               this.RegisterForLayouting ((int)LayoutingType.Sizing);\r
+                               NotifyValueChanged ("Text", Text);\r
             }\r
         }\r
-               [XmlAttributeAttribute()][DefaultValue("droid,10")]\r
-               public Font Font {\r
-                       get { return _font; }\r
-                       set { _font = value; }\r
-               }\r
                [XmlAttributeAttribute()][DefaultValue(false)]\r
                public bool Multiline\r
                {\r
@@ -126,7 +122,7 @@ namespace Crow
                                else if (value > lines [_currentLine].Count ())\r
                                        _currentCol = lines [_currentLine].Count ();\r
                                else\r
-                                       _currentCol = value; \r
+                                       _currentCol = value;\r
                        }\r
                }\r
                [XmlIgnore]public int currentLine{\r
@@ -140,40 +136,71 @@ namespace Crow
                                        _currentLine = value; \r
                        }\r
                }\r
-               [XmlIgnore]protected Point selBegin;\r
-               [XmlIgnore]protected Point selRelease;\r
+\r
+               [XmlIgnore]public Point SelBegin {\r
+                       get {\r
+                               return _selBegin;\r
+                       }\r
+                       set {\r
+                               if (value == _selBegin)\r
+                                       return;\r
+                               _selBegin = value;\r
+                               NotifyValueChanged ("SelectedText", SelectedText);\r
+                       }\r
+               }                       \r
+               [XmlIgnore]public Point SelRelease {\r
+                       get {\r
+                               return _selRelease;\r
+                       }\r
+                       set {\r
+                               if (value == _selRelease)\r
+                                       return;\r
+                               _selRelease = value;\r
+                               NotifyValueChanged ("SelectedText", SelectedText);\r
+                       }\r
+               }\r
+\r
                [XmlIgnore]protected Point selectionStart   //ordered selection start and end positions\r
                {\r
                        get { \r
-                               return selRelease < 0 || selBegin.Y < selRelease.Y ? selBegin : \r
-                                       selBegin.Y > selRelease.Y ? selRelease :\r
-                                       selBegin.X < selRelease.X ? selBegin : selRelease;\r
+                               return SelRelease < 0 || SelBegin.Y < SelRelease.Y ? SelBegin : \r
+                                       SelBegin.Y > SelRelease.Y ? SelRelease :\r
+                                       SelBegin.X < SelRelease.X ? SelBegin : SelRelease;\r
                        }\r
                }\r
                [XmlIgnore]public Point selectionEnd\r
                {  \r
                        get { \r
-                               return selRelease < 0 || selBegin.Y > selRelease.Y ? selBegin : \r
-                                       selBegin.Y < selRelease.Y ? selRelease :\r
-                                       selBegin.X > selRelease.X ? selBegin : selRelease;\r
+                               return SelRelease < 0 || SelBegin.Y > SelRelease.Y ? SelBegin : \r
+                                       SelBegin.Y < SelRelease.Y ? SelRelease :\r
+                                       SelBegin.X > SelRelease.X ? SelBegin : SelRelease;\r
                        }               \r
                }\r
-               [XmlIgnore]public string selectedText\r
+               [XmlIgnore]public string SelectedText\r
                { \r
-                       get { \r
-                               return null; \r
-                                       //selectionEnd < 0 ? null : \r
-                                       //Text.Substring(selectionStart, selectionEnd - selectionStart); \r
+                       get {\r
+                               \r
+                               if (SelRelease < 0 || SelBegin < 0)\r
+                                       return "";\r
+                               if (selectionStart.Y == selectionEnd.Y)\r
+                                       return lines [selectionStart.Y].Substring (selectionStart.X, selectionEnd.X - selectionStart.X);\r
+                               string tmp = "";\r
+                               tmp = lines [selectionStart.Y].Substring (selectionStart.X);\r
+                               for (int l = selectionStart.Y + 1; l < selectionEnd.Y; l++) {\r
+                                       tmp += Interface.LineBreak + lines [l];\r
+                               }\r
+                               tmp += Interface.LineBreak + lines [selectionEnd.Y].Substring (0, selectionEnd.X);\r
+                               return tmp;\r
                        }                       \r
                }\r
                [XmlIgnore]public bool selectionIsEmpty\r
-               { get { return selRelease < 0; } }\r
+               { get { return SelRelease < 0; } }\r
 \r
                List<string> lines;\r
                List<string> getLines {\r
                        get {                           \r
                                return _multiline ?\r
-                                       Regex.Split (_text, "\r\n|\r|\n").ToList() :\r
+                                       Regex.Split (_text, "\r\n|\r|\n|" + @"\\n").ToList() :\r
                                        new List<string>(new string[] { _text });\r
                        }\r
                }\r
@@ -208,8 +235,8 @@ namespace Crow
                                } else \r
                                        lines [l] = lines [l].Remove (selectionStart.X, selectionEnd.X - selectionStart.X);\r
                                currentCol = selectionStart.X;\r
-                               selBegin = -1;\r
-                               selRelease = -1;\r
+                               SelBegin = -1;\r
+                               SelRelease = -1;\r
                        }\r
                }\r
                /// <summary>\r
@@ -389,77 +416,94 @@ namespace Crow
                                        break;\r
                                }\r
                        }\r
+                       OpenTKGameWindow.currentWindow.CursorVisible = true;\r
 \r
                        #region draw text cursor\r
-                       if (mouseLocalPos > 0)\r
+                       if (mouseLocalPos >= 0)\r
                        {\r
                                computeTextCursor(gr);\r
 \r
                                if (SelectionInProgress)\r
                                {\r
-                                       selRelease = new Point(currentCol, currentLine);\r
-                                       SelEndCursorPos = textCursorPos;\r
+                                       if (SelBegin < 0){\r
+                                               SelBegin = new Point(currentCol, currentLine);\r
+                                               SelStartCursorPos = textCursorPos;\r
+                                               SelRelease = -1;\r
+                                       }else{\r
+                                               SelRelease = new Point(currentCol, currentLine);\r
+                                               if (SelRelease == SelBegin)\r
+                                                       SelRelease = -1;\r
+                                               else\r
+                                                       SelEndCursorPos = textCursorPos;\r
+                                       }                                               \r
                                }\r
-                               else if (selBegin < 0)\r
-                               {\r
-                                       selBegin = new Point(currentCol, currentLine);\r
-                                       SelStartCursorPos = textCursorPos;\r
-                                       selRelease = -1;\r
-                               }\r
-                               else\r
-                                       computeTextCursorPosition(gr);\r
-                       }\r
-                       else\r
+                       }else\r
                                computeTextCursorPosition(gr);\r
 \r
-                       if (HasFocus && Selectable)\r
+\r
+                       #endregion\r
+\r
+                       //*******************\r
+                       //debug selection\r
+                       if (SelRelease >= 0) {\r
+                               gr.Color = Color.Green;\r
+                               Rectangle R = new Rectangle (\r
+                                                    rText.X + (int)SelEndCursorPos - 2,\r
+                                                    rText.Y + (int)(SelRelease.Y * fe.Height), \r
+                                                    4, \r
+                                                    (int)fe.Height);\r
+                               gr.Rectangle (R);\r
+                               gr.Fill ();\r
+                       }\r
+                       if (SelBegin >= 0) {\r
+                               gr.Color = Color.UnmellowYellow;\r
+                               Rectangle R = new Rectangle (\r
+                                       rText.X + (int)SelStartCursorPos - 2,\r
+                                       rText.Y + (int)(SelBegin.Y * fe.Height), \r
+                                       4, \r
+                                       (int)fe.Height);\r
+                               gr.Rectangle (R);\r
+                               gr.Fill ();\r
+                       }\r
+                       //*******************\r
+                       if (HasFocus )\r
                        {\r
                                //TODO:\r
-                               gr.Color = Foreground;\r
+                               gr.SetSourceColor(Foreground);\r
                                gr.LineWidth = 1.5;\r
                                gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y + currentLine * fe.Height));\r
                                gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (currentLine + 1) * fe.Height));\r
                                gr.Stroke();\r
                        }\r
-                       #endregion\r
-\r
-                       //*******************\r
-                       //debug selection\r
-//                     gr.Color = Color.Green;\r
-//                     Rectangle R = new Rectangle(\r
-//                             rText.X +  (int)SelEndCursorPos-10,\r
-//                             rText.Y + (int)(selRelease.Y * fe.Height), \r
-//                             20, \r
-//                             (int)fe.Height);\r
-//                     gr.Rectangle(R);\r
-//                     gr.Fill();\r
-//                     gr.Color = Color.UnmellowYellow;\r
-//                     R = new Rectangle(\r
-//                             rText.X + (int)SelStartCursorPos-10,\r
-//                             rText.Y + (int)(selBegin.Y * fe.Height), \r
-//                             20, \r
-//                             (int)fe.Height);\r
-//                     gr.Rectangle(R);\r
-//                     gr.Fill();\r
-                       //*******************\r
-\r
                        gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);\r
-\r
+                       OpenTKGameWindow.currentWindow.CursorVisible = true;\r
                        for (int i = 0; i < lines.Count; i++) {                         \r
                                string l = lines [i].Replace ("\t", new String (' ', Interface.TabSize));\r
-                               if (selRelease >= 0 && i >= selectionStart.Y && i <= selectionEnd.Y) {                                  \r
-                                       gr.Color = selColor;\r
-                                       int lineLength = (int)gr.TextExtents (l).XAdvance;\r
-                                       Rectangle selRect = new Rectangle (\r
-                                               rText.X,\r
-                                               rText.Y + (int)(i * fe.Height), \r
-                                               lineLength, \r
-                                               (int)fe.Height);\r
+                               int lineLength = (int)gr.TextExtents (l).XAdvance;\r
+                               Rectangle lineRect = new Rectangle (\r
+                                       rText.X,\r
+                                       rText.Y + (int)(i * fe.Height), \r
+                                       lineLength, \r
+                                       (int)fe.Height);\r
+\r
+//                             if (TextAlignment == Alignment.Center ||\r
+//                                     TextAlignment == Alignment.TopCenter ||\r
+//                                     TextAlignment == Alignment.BottomCenter)\r
+//                                     lineRect.X += (rText.Width - lineLength) / 2;\r
+//                             else if (TextAlignment == Alignment.RightCenter ||\r
+//                                     TextAlignment == Alignment.TopRight ||\r
+//                                     TextAlignment == Alignment.BottomRight)\r
+//                                     lineRect.X += (rText.Width - lineLength);\r
+                               \r
+                               if (SelRelease >= 0 && i >= selectionStart.Y && i <= selectionEnd.Y) {                                  \r
+                                       gr.SetSourceColor(selColor);\r
+\r
+                                       Rectangle selRect = lineRect ;\r
 \r
                                        int cpStart = (int)SelStartCursorPos,\r
                                                cpEnd = (int)SelEndCursorPos;\r
 \r
-                                       if (selBegin.Y > selRelease.Y) {\r
+                                       if (SelBegin.Y > SelRelease.Y) {\r
                                                cpStart = cpEnd;\r
                                                cpEnd = (int)SelStartCursorPos;\r
                                        }\r
@@ -477,27 +521,9 @@ namespace Crow
 \r
                                if (string.IsNullOrWhiteSpace (l))\r
                                        continue;\r
-                       \r
-//                             double t = rText.Y;\r
-//                             gr.LineWidth = 1;\r
-//                             gr.Color = Color.Green;\r
-//                             gr.MoveTo (rText.X, t);\r
-//                             gr.LineTo (rText.X + rText.Width, t);\r
-//                             gr.Stroke ();\r
-//                             gr.MoveTo (rText.X, t + rText.Height);\r
-//                             gr.LineTo (rText.X + rText.Width, t + rText.Height);\r
-//                             gr.Stroke ();\r
-//                             gr.Rectangle (rText);\r
-//                             gr.Fill ();\r
-//\r
-//                             t += fe.Ascent;\r
-//                             gr.Color = Color.Red;\r
-//                             gr.MoveTo (rText.X, t);\r
-//                             gr.LineTo (rText.X + rText.Width, t);\r
-//                             gr.Stroke ();\r
-\r
-                               gr.Color = Foreground;                          \r
-                               gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * i);\r
+\r
+                               gr.SetSourceColor(Foreground);  \r
+                               gr.MoveTo (lineRect.X, rText.Y + fe.Ascent + fe.Height * i);\r
 \r
                                #if _WIN32 || _WIN64\r
                                gr.ShowText(l.ToUtf8());\r
@@ -505,65 +531,81 @@ namespace Crow
                                gr.ShowText (l);\r
                                #endif\r
                                gr.Fill ();\r
-\r
-                       }                                               \r
+                       }\r
                }\r
                #endregion\r
 \r
                #region Mouse handling\r
-               public override void onMouseEnter (object sender, MouseMoveEventArgs e)\r
+               void updatemouseLocalPos(Point mpos){\r
+                       mouseLocalPos = mpos - ScreenCoordinates(Slot).TopLeft - ClientRectangle.TopLeft;\r
+                       if (mouseLocalPos.X < 0)\r
+                               mouseLocalPos.X = 0;\r
+                       if (mouseLocalPos.Y < 0)\r
+                               mouseLocalPos.Y = 0;\r
+               }\r
+               public override void onFocused (object sender, EventArgs e)\r
                {\r
-                       //                      SelectionInProgress = true;                \r
-                       //                      mouseLocalPos = e.Position - ScreenCoordBounds.TopLeft - rText.TopLeft;\r
-                       //                      registerForGraphicUpdate();\r
+                       base.onFocused (sender, e);\r
 \r
-                       base.onMouseEnter (sender, e);\r
+                       SelBegin = new Point(0,0);\r
+                       SelRelease = new Point (lines.LastOrDefault ().Length, lines.Count-1);\r
+                       OpenTKGameWindow.currentWindow.CursorVisible = true;\r
+                       registerForGraphicUpdate ();\r
+                       Debug.WriteLine("focused:", this.ToString());\r
                }\r
-               public override void onMouseLeave (object sender, MouseMoveEventArgs e)\r
+               public override void onUnfocused (object sender, EventArgs e)\r
                {\r
-                       base.onMouseLeave (sender, e);\r
+                       base.onUnfocused (sender, e);\r
+\r
+                       SelBegin = -1;\r
+                       SelRelease = -1;\r
+\r
+                       registerForGraphicUpdate ();\r
+                       Debug.WriteLine("unfocused:", this.ToString());\r
                }\r
                public override void onMouseMove (object sender, MouseMoveEventArgs e)\r
                {\r
                        base.onMouseMove (sender, e);\r
 \r
-                       IGOLibHost glh = TopContainer;\r
-                       if (glh.activeWidget != this)\r
-                               return;\r
-                       if (!Selectable)\r
+                       if (!(SelectionInProgress && HasFocus))\r
                                return;\r
-                       \r
-                       SelectionInProgress = true;\r
-                       mouseLocalPos = e.Position - ScreenCoordinates(ClientRectangle).TopLeft;\r
+\r
+                       updatemouseLocalPos (e.Position);\r
+\r
                        registerForGraphicUpdate();\r
                }\r
-               public override void onMouseButtonDown (object sender, MouseButtonEventArgs e)\r
-               {\r
-                       if (this.HasFocus && Selectable){\r
-                               mouseLocalPos = e.Position - ScreenCoordinates(ClientRectangle).TopLeft;\r
-                               selBegin = -1;\r
-                               selRelease = -1;\r
-                       }else{\r
-//                             selBeginPos = 0;\r
-//                             selReleasePos = new Point(lines[lines.Count].Length-1, lines.Count-1);\r
-                       }            \r
+               public override void onMouseDown (object sender, MouseButtonEventArgs e)\r
+               {                       \r
+                       if (this.HasFocus){\r
+                               updatemouseLocalPos (e.Position);\r
+                               SelBegin = -1;\r
+                               SelRelease = -1;\r
+                               SelectionInProgress = true;\r
+                       }          \r
 \r
                        //done at the end to set 'hasFocus' value after testing it\r
-                       base.onMouseButtonDown (sender, e);\r
+                       base.onMouseDown (sender, e);\r
 \r
                        registerForGraphicUpdate();\r
                }\r
-               public override void onMouseButtonUp (object sender, MouseButtonEventArgs e)\r
+               public override void onMouseUp (object sender, MouseButtonEventArgs e)\r
                {\r
-                       base.onMouseButtonUp (sender, e);\r
+                       base.onMouseUp (sender, e);\r
+\r
+                       if (!SelectionInProgress)\r
+                               return;\r
+                       \r
+                       updatemouseLocalPos (e.Position);\r
                        SelectionInProgress = false;\r
+                       registerForGraphicUpdate ();\r
                }\r
                #endregion\r
-\r
-\r
+               /// <summary>\r
+               /// Update Current Column, line and TextCursorPos\r
+               /// from mouseLocalPos\r
+               /// </summary>\r
                void computeTextCursor(Context gr)\r
-               {\r
-                       //FontExtents fe = gr.FontExtents;\r
+               {                       \r
                        TextExtents te;\r
 \r
                        double cPos = 0f;\r
@@ -604,41 +646,25 @@ namespace Crow
                        //reset mouseLocalPos\r
                        mouseLocalPos = -1;\r
                }\r
+               /// <summary> Computes offsets in cairo units </summary>\r
                void computeTextCursorPosition(Context gr)\r
                {                       \r
-                       TextExtents te;\r
-\r
-                       double cPos = 0f;\r
-\r
-                       int limit = currentCol;\r
-\r
-                       if (selectionEnd > 0)\r
-                               limit = Math.Max(currentCol, selectionEnd.X);\r
-\r
-                       for (int i = 0; i <= limit; i++)\r
-                       {\r
-                               if (i == currentCol)\r
-                                       textCursorPos = cPos;\r
-                               if (i == selectionStart.X)\r
-                                       SelStartCursorPos = cPos;\r
-                               if (i == selectionEnd.X)\r
-                                       SelEndCursorPos = cPos;\r
-\r
-                               if (i < lines[currentLine].Length)\r
-                               {\r
-                                       string c = lines [currentLine].Substring (i, 1);\r
-                                       if (c == "\t")\r
-                                               c = new string (' ', Interface.TabSize);\r
-                                       #if _WIN32 || _WIN64\r
-                                       byte[] c = System.Text.UTF8Encoding.UTF8.GetBytes(Text.Substring(i, 1));\r
-                                       te = gr.TextExtents(c);\r
-                                       #elif __linux__\r
-                                       te = gr.TextExtents(c);\r
-                                       #endif\r
-                                       cPos += te.XAdvance;\r
-                               }\r
+                       if (SelBegin >= 0)\r
+                               SelStartCursorPos = GetXFromTextPointer (gr, SelBegin);\r
+                       if (SelRelease >= 0)\r
+                               SelEndCursorPos = GetXFromTextPointer (gr, SelRelease);\r
+                       textCursorPos = GetXFromTextPointer (gr, new Point(currentCol, currentLine));\r
+               }\r
+               /// <summary> Compute x offset in cairo unit from text position </summary>\r
+               double GetXFromTextPointer(Context gr, Point pos)\r
+               {\r
+                       try {\r
+                               string l = lines [pos.Y].Substring (0, pos.X).\r
+                                       Replace ("\t", new String (' ', Interface.TabSize));\r
+                               return gr.TextExtents (l).XAdvance;\r
+                       } catch (Exception ex) {\r
+                               return -1;\r
                        }\r
-\r
-               }               \r
+               }\r
     }\r
 }\r
index e323ef3e8e1141c3795b3a884f6c10ccbb778a89..3e35f102f9e97e19f1ce4176d9da2aabf2706c89 100644 (file)
@@ -13,10 +13,6 @@ namespace Crow
                public NumericControl(double minimum, double maximum, double step)
                        : base()
                {
-                       minValue = minimum;
-                       maxValue = maximum;
-                       smallStep = step;
-                       bigStep = step * 5;
                }
                #endregion
 
index 15a209ce47015b4aa55df70ed9b3e8887f36fe8f..2ed1c06f27fef783885e8f25d19e6a2466c6fb3f 100644 (file)
@@ -158,7 +158,7 @@ namespace Crow
                        \r
                public virtual void onPop(object sender, EventArgs e)\r
                {\r
-                       IGOLibHost tc = TopContainer;\r
+                       IGOLibHost tc = HostContainer;\r
                        if (tc == null)\r
                                return;\r
                        if (Content != null) {\r
@@ -172,7 +172,7 @@ namespace Crow
                }\r
                public virtual void onUnpop(object sender, EventArgs e)\r
                {\r
-                       IGOLibHost tc = TopContainer;\r
+                       IGOLibHost tc = HostContainer;\r
                        if (tc == null)\r
                                return;\r
                        Content.Visible = false;\r
index ec0def4dc4dbac64066ae2be71aa6a3207758a38..a4eb2a578e50830e14c0f676a5f3afc0028d6b2a 100644 (file)
@@ -202,7 +202,7 @@ namespace Crow
 \r
                public override void registerClipRect ()\r
                {\r
-                       TopContainer.redrawClip.AddRectangle (base.ScreenCoordinates(Slot));\r
+                       HostContainer.redrawClip.AddRectangle (base.ScreenCoordinates(Slot));\r
                }\r
 \r
                public override void Paint(ref Cairo.Context ctx, Rectangles clip = null)\r
index 7b44a93e950671738b806907aa0533573c69117f..2351669c3503cb2336efcc63e6e397f48d22e925 100644 (file)
@@ -158,9 +158,9 @@ namespace Crow
         }\r
         \r
                #region mouse handling\r
-               public override void onMouseButtonDown (object sender, OpenTK.Input.MouseButtonEventArgs e)\r
+               public override void onMouseDown (object sender, OpenTK.Input.MouseButtonEventArgs e)\r
                {\r
-                       base.onMouseButtonDown (sender, e);\r
+                       base.onMouseDown (sender, e);\r
 \r
                        Rectangle cursInScreenCoord = ScreenCoordinates (cursor + Slot.Position);\r
                        if (cursInScreenCoord.ContainsOrIsEqual (e.Position))\r
@@ -177,9 +177,9 @@ namespace Crow
                                        Value += LargeIncrement;\r
                        }\r
                }\r
-               public override void onMouseButtonUp (object sender, OpenTK.Input.MouseButtonEventArgs e)\r
+               public override void onMouseUp (object sender, OpenTK.Input.MouseButtonEventArgs e)\r
                {\r
-                       base.onMouseButtonUp (sender, e);\r
+                       base.onMouseUp (sender, e);\r
 \r
                        holdCursor = false;\r
                }\r
index 9fca2feaf36b10a8511790502bbfa0c6f4b3e84e..f2fdace6b7878ba2b5c13559e8fbb1af3126b574 100644 (file)
@@ -44,11 +44,6 @@ namespace Crow
                        get { return base.Focusable; }\r
                        set { base.Focusable = value; }\r
                }\r
-               [XmlAttributeAttribute()][DefaultValue(true)]\r
-               public override bool Selectable {\r
-                       get { return base.Selectable; }\r
-                       set { base.Selectable = value; }\r
-               }\r
                [XmlAttributeAttribute()][DefaultValue("White")]\r
                public override Color Background {\r
                        get { return base.Background; }\r
@@ -107,7 +102,7 @@ namespace Crow
                        case Key.Escape:\r
                                Text = "";\r
                                currentCol = 0;\r
-                               selRelease = -1;\r
+                               SelRelease = -1;\r
                                break;\r
                        case Key.Home:\r
                                //TODO\r
@@ -195,8 +190,8 @@ namespace Crow
 \r
                                this.Insert (k);\r
 \r
-                               selRelease = -1;\r
-                               selBegin.X = currentCol;\r
+                               SelRelease = -1;\r
+                               SelBegin = new Point(currentCol, SelBegin.Y);\r
 \r
                                break;\r
                        }\r
index 50176d6f5952acb029958368510105dd49236ae3..d98d296c3f5c6cdd14ac4ca5f14bf542f01c6e53 100644 (file)
@@ -83,127 +83,134 @@ namespace Crow
                {
                        base.onMouseMove (sender, e);
 
-                       OpenTKGameWindow otkgw = TopContainer as OpenTKGameWindow;
-
-                       if (otkgw.activeWidget == null) {
-                               if (Resizable) {
-                                       Direction lastDir = currentDirection;
-
-                                       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.V;
-                                                       break;
-                                               case Direction.S:
-                                                       otkgw.Cursor = XCursor.V;
-                                                       break;
-                                               case Direction.E:
-                                                       otkgw.Cursor = XCursor.H;
-                                                       break;
-                                               case Direction.W:
-                                                       otkgw.Cursor = XCursor.H;
-                                                       break;
-                                               case Direction.NW:
-                                                       otkgw.Cursor = XCursor.NW;
-                                                       break;
-                                               case Direction.NE:
-                                                       otkgw.Cursor = XCursor.NE;
-                                                       break;
-                                               case Direction.SW:
-                                                       otkgw.Cursor = XCursor.SW;
-                                                       break;
-                                               case Direction.SE:
-                                                       otkgw.Cursor = XCursor.SE;
-                                                       break;
-                                               }
-                                       }                               
+                       OpenTKGameWindow otkgw = HostContainer as OpenTKGameWindow;
+
+                       if (e.Mouse.IsButtonDown (MouseButton.Left)) {
+                               if (!HasFocus)
+                                       return;
+                               
+                               otkgw.redrawClip.AddRectangle (this.ScreenCoordinates(this.Slot));
+
+                               int currentLeft = this.Left;
+                               int currentTop = this.Top;
+
+                               if (currentLeft == 0)
+                                       currentLeft = this.Slot.Left;
+                               if (currentTop == 0)
+                                       currentTop = this.Slot.Top;
+
+                               switch (currentDirection) {
+                               case Direction.None:
+                                       this.Left = currentLeft + e.XDelta;                             
+                                       this.Top = currentTop + e.YDelta;
+                                       break;
+                               case Direction.N:
+                                       this.Top = currentTop + e.YDelta;
+                                       this.Height -= e.YDelta;
+                                       break;
+                               case Direction.S:
+                                       this.Height += e.YDelta;
+                                       break;
+                               case Direction.W:
+                                       this.Left = currentLeft + e.XDelta;
+                                       this.Width -= e.XDelta;
+                                       break;
+                               case Direction.E:
+                                       this.Width += e.XDelta;
+                                       break;
+                               case Direction.NW:
+                                       this.Left = currentLeft + e.XDelta;
+                                       this.Top = currentTop + e.YDelta;
+                                       this.Width -= e.XDelta;
+                                       this.Height -= e.YDelta;
+                                       break;
+                               case Direction.NE:
+                                       this.Width += e.XDelta;
+                                       this.Top = currentTop + e.YDelta;
+                                       this.Height -= e.YDelta;
+                                       break;
+                               case Direction.SW:
+                                       this.Left = currentLeft + e.XDelta;
+                                       this.Width -= e.XDelta;
+                                       this.Height += e.YDelta;
+                                       break;
+                               case Direction.SE:
+                                       this.Width += e.XDelta;
+                                       this.Height += e.YDelta;
+                                       break;
                                }
                                return;
                        }
+                       GraphicObject firstFocusableAncestor = otkgw.hoverWidget;
+                       while (firstFocusableAncestor != this) {
+                               if (firstFocusableAncestor == null)
+                                       return;
+                               if (firstFocusableAncestor.Focusable)
+                                       return;
+                               firstFocusableAncestor = firstFocusableAncestor.Parent as GraphicObject;
+                       }
+                       if (Resizable) {
+                               Direction lastDir = currentDirection;
 
-                       if (TopContainer.activeWidget != this)
-                               return;
-                               
-                       this.TopContainer.redrawClip.AddRectangle (this.ScreenCoordinates(this.Slot));
-
-                       int currentLeft = this.Left;
-                       int currentTop = this.Top;
-
-                       if (currentLeft == 0)
-                               currentLeft = this.Slot.Left;
-                       if (currentTop == 0)
-                               currentTop = this.Slot.Top;
-
-                       switch (currentDirection) {
-                       case Direction.None:
-                               this.Left = currentLeft + e.XDelta;                             
-                               this.Top = currentTop + e.YDelta;
-                               break;
-                       case Direction.N:
-                               this.Top = currentTop + e.YDelta;
-                               this.Height -= e.YDelta;
-                               break;
-                       case Direction.S:
-                               this.Height += e.YDelta;
-                               break;
-                       case Direction.W:
-                               this.Left = currentLeft + e.XDelta;
-                               this.Width -= e.XDelta;
-                               break;
-                       case Direction.E:
-                               this.Width += e.XDelta;
-                               break;
-                       case Direction.NW:
-                               this.Left = currentLeft + e.XDelta;
-                               this.Top = currentTop + e.YDelta;
-                               this.Width -= e.XDelta;
-                               this.Height -= e.YDelta;
-                               break;
-                       case Direction.NE:
-                               this.Width += e.XDelta;
-                               this.Top = currentTop + e.YDelta;
-                               this.Height -= e.YDelta;
-                               break;
-                       case Direction.SW:
-                               this.Left = currentLeft + e.XDelta;
-                               this.Width -= e.XDelta;
-                               this.Height += e.YDelta;
-                               break;
-                       case Direction.SE:
-                               this.Width += e.XDelta;
-                               this.Height += e.YDelta;
-                               break;
-                       }               
+                               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.V;
+                                               break;
+                                       case Direction.S:
+                                               otkgw.Cursor = XCursor.V;
+                                               break;
+                                       case Direction.E:
+                                               otkgw.Cursor = XCursor.H;
+                                               break;
+                                       case Direction.W:
+                                               otkgw.Cursor = XCursor.H;
+                                               break;
+                                       case Direction.NW:
+                                               otkgw.Cursor = XCursor.NW;
+                                               break;
+                                       case Direction.NE:
+                                               otkgw.Cursor = XCursor.NE;
+                                               break;
+                                       case Direction.SW:
+                                               otkgw.Cursor = XCursor.SW;
+                                               break;
+                                       case Direction.SE:
+                                               otkgw.Cursor = XCursor.SE;
+                                               break;
+                                       }
+                               }                               
+                       }                               
                }
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {
                        base.onMouseLeave (sender, e);
                        currentDirection = Direction.None;
-                       OpenTKGameWindow otkgw = TopContainer as OpenTKGameWindow;
+                       OpenTKGameWindow otkgw = HostContainer as OpenTKGameWindow;
                        otkgw.Cursor = XCursor.Default;
                }
 
@@ -218,7 +225,7 @@ namespace Crow
                        ILayoutable parent = (sender as GraphicObject).Parent;
                        while(!(parent is Window))
                                parent = parent.Parent;
-                       TopContainer.DeleteWidget (parent as GraphicObject);
+                       HostContainer.DeleteWidget (parent as GraphicObject);
                }
 
                public override void ResolveBindings ()
index b6e5b3f1c861c9b3642fa45e9075c3e47500496c..9b291a3215faf673bb3bf7db1159aa1e6dd06559 100644 (file)
@@ -42,55 +42,21 @@ namespace Crow
 
                public static int TabSize = 4;
                public static string LineBreak = "\r\n";
+               public static bool FocusOnHover = false;
+               /// <summary> Time to wait in millisecond before starting repeat loop</summary>
+               public static int DeviceRepeatDelay = 1000;
+               /// <summary> Time interval in millisecond between device event repeat</summary>
+               public static int DeviceRepeatInterval = 100;
                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
-               /// </summary>
-               public static List<object> References = new List<object> ();
-               public static Queue<int> FreeRefIndices = new Queue<int> ();
                public static List<ListBox> LoadingLists= new List<ListBox>();
-
-               public static void Unreference (Object o)
-               {
-                       int idxt = Interface.References.IndexOf (o);
-                       if (idxt < 0)
-                               return;
-                       References [idxt] = null;
-                       FreeRefIndices.Enqueue (idxt);
-               }
-
-               /// <summary> register target object reference in an array for binding CIL </summary>
-               public static int Reference (object o)
-               {
-                       
-                       int dstIdx = Interface.References.IndexOf (o);
-
-                       if (dstIdx < 0) {
-                               if (FreeRefIndices.Count == 0) {
-                                       dstIdx = Interface.References.Count ();
-                                       Interface.References.Add (o);
-                               } else {
-                                       dstIdx = FreeRefIndices.Dequeue ();
-                                       Interface.References [dstIdx] = o;
-                               }
-                       }
-                       return dstIdx;
-               }
-
                public static LayoutingQueue LayoutingQueue = new LayoutingQueue ();
 
                #region Load/Save
-
-               internal static Stack<List<DynAttribute>> GOMLResolutionStack = new Stack<List<DynAttribute>> ();
-
-               internal static List<DynAttribute> GOMLResolver {
-                       get { return GOMLResolutionStack.Peek (); }
-               }
                //internal static List<DynAttribute> Bindings;
 
 
index e29f44c8f6df57f59a8597b912ffd5d8b091db6f..2db35fc784384a572579bd4132222fb3848a1865 100644 (file)
@@ -109,7 +109,7 @@ namespace Crow
                        set \r
                        {\r
                                if (_activeWidget == value)\r
-                                       return;\r
+                                       return;                         \r
                                _activeWidget = value;\r
                        }\r
                }\r
@@ -165,7 +165,6 @@ namespace Crow
                Crow.Shader shader;\r
                int[] viewport = new int[4];\r
 \r
-               Rectangle dirtyZone = Rectangle.Empty;\r
                void createContext()\r
                {                       \r
                        createOpenGLSurface ();\r
@@ -224,23 +223,6 @@ namespace Crow
                        shader.Disable ();\r
                        GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]);\r
                }\r
-//             public void RenderCustomTextureOnUIQuad(int _customTex)\r
-//             {\r
-//                     GL.GetInteger (GetPName.Viewport, viewport);\r
-//                     GL.Viewport (0, 0, ClientRectangle.Width, ClientRectangle.Height);\r
-//\r
-//                     shader.Enable ();\r
-//\r
-//                     GL.ActiveTexture (TextureUnit.Texture0);\r
-//                     GL.BindTexture (TextureTarget.Texture2D, _customTex);\r
-//                     GL.Disable (EnableCap.DepthTest);\r
-//                     uiQuad2.Render (PrimitiveType.TriangleStrip);\r
-//                     GL.Enable (EnableCap.DepthTest);\r
-//                     GL.BindTexture(TextureTarget.Texture2D, 0);\r
-//                     shader.Disable ();\r
-//                     GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]);                   \r
-//             }\r
-                       \r
                #endregion\r
 \r
                #region update\r
@@ -251,6 +233,14 @@ namespace Crow
 \r
                void update ()\r
                {\r
+                       if (mouseRepeatCount > 0) {\r
+                               int mc = mouseRepeatCount;\r
+                               mouseRepeatCount -= mc;\r
+                               for (int i = 0; i < mc; i++) {\r
+                                       FocusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true));\r
+                               }\r
+                       }\r
+\r
                        updateTime.Restart ();\r
                        layoutTime.Reset ();\r
                        guTime.Reset ();\r
@@ -295,19 +285,20 @@ namespace Crow
                        foreach (GraphicObject p in gotr) {\r
                                p.registerClipRect ();\r
                        }\r
+                       updateTime.Stop ();\r
 \r
+                       drawingTime.Start ();\r
 \r
                        lock (redrawClip) {\r
                                if (redrawClip.count > 0) {                                     \r
-//                                     #if DEBUG_CLIP_RECTANGLE\r
-//                                     redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));\r
-//                                     #endif\r
+                                       #if DEBUG_CLIP_RECTANGLE\r
+                                       redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));\r
+                                       #endif\r
                                        redrawClip.clearAndClip (ctx);//rajouté après, tester si utile        \r
 \r
                                        //Link.draw (ctx);\r
                                        foreach (GraphicObject p in invGOList) {\r
                                                if (p.Visible) {\r
-                                                       drawingTime.Start ();\r
 \r
                                                        ctx.Save ();\r
                                                        if (redrawClip.count > 0) {\r
@@ -317,18 +308,16 @@ namespace Crow
                                                                        p.Paint (ref ctx, clip);\r
                                                        }\r
                                                        ctx.Restore ();\r
-\r
-                                                       drawingTime.Stop ();\r
                                                }\r
                                        }\r
                                        ctx.ResetClip ();\r
-                                       dirtyZone = redrawClip.Bounds;\r
-//                                     #if DEBUG_CLIP_RECTANGLE\r
-//                                     redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));\r
-//                                     #endif\r
+                                       #if DEBUG_CLIP_RECTANGLE\r
+                                       redrawClip.stroke (ctx, Color.Red.AdjustAlpha(0.1));\r
+                                       #endif\r
                                        redrawClip.Reset ();\r
                                }\r
                        }\r
+                       drawingTime.Stop ();\r
                        //surf.WriteToPng (@"/mnt/data/test.png");\r
                        ctx.Dispose ();\r
                        surf.Dispose ();\r
@@ -345,7 +334,7 @@ namespace Crow
 //                         layoutTime.ElapsedMilliseconds,\r
 //                         guTime.ElapsedMilliseconds,\r
 //                         drawingTime.ElapsedMilliseconds);\r
-                       updateTime.Stop ();\r
+\r
 //                     Debug.WriteLine("UPDATE: {0} ticks \t, {1} ms",\r
 //                             updateTime.ElapsedTicks,\r
 //                             updateTime.ElapsedMilliseconds);\r
@@ -428,7 +417,7 @@ namespace Crow
         {\r
                        if (_activeWidget != null) {\r
                                //first, ensure object is still in the graphic tree\r
-                               if (_activeWidget.TopContainer == null) {\r
+                               if (_activeWidget.HostContainer == null) {\r
                                        activeWidget = null;\r
                                } else {\r
                                        \r
@@ -440,7 +429,7 @@ namespace Crow
 \r
                        if (_hoverWidget != null) {\r
                                //first, ensure object is still in the graphic tree\r
-                               if (_hoverWidget.TopContainer == null) {\r
+                               if (_hoverWidget.HostContainer == null) {\r
                                        hoverWidget = null;\r
                                } else {\r
                                        //check topmost graphicobject first\r
@@ -500,9 +489,15 @@ namespace Crow
                                MouseButtonUp.Raise (this, e);\r
                                return;\r
                        }\r
+                               \r
+                       if (mouseRepeatThread != null) {\r
+                               mouseRepeatOn = false;\r
+                               mouseRepeatThread.Abort();\r
+                               mouseRepeatThread.Join ();\r
+                       }\r
 \r
-                       _activeWidget.onMouseButtonUp (this, e);\r
-                       _activeWidget = null;\r
+                       _activeWidget.onMouseUp (this, e);\r
+                       activeWidget = null;\r
         }\r
         void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)\r
         {\r
@@ -511,18 +506,15 @@ namespace Crow
                                return;\r
                        }\r
 \r
-                       GraphicObject g = _hoverWidget;\r
-                       while (!g.Focusable) {                          \r
-                               g = g.Parent as GraphicObject;\r
-                               if (g == null) {                                        \r
-                                       return;\r
-                               }\r
-                       }\r
+                       _hoverWidget.onMouseDown(_hoverWidget,new BubblingMouseButtonEventArg(e));\r
 \r
-                       _activeWidget = g;\r
-                       _activeWidget.onMouseButtonDown (this, e);\r
+                       if (FocusedWidget == null)\r
+                               return;\r
+                       if (!FocusedWidget.MouseRepeat)\r
+                               return;\r
+                       mouseRepeatThread = new Thread (mouseRepeatThreadFunc);\r
+                       mouseRepeatThread.Start ();\r
         }\r
-\r
         void Mouse_WheelChanged(object sender, MouseWheelEventArgs e)\r
         {\r
                        if (_hoverWidget == null) {\r
@@ -530,7 +522,21 @@ namespace Crow
                                return;\r
                        }\r
                        _hoverWidget.onMouseWheel (this, e);\r
-        }        \r
+        }\r
+\r
+               volatile bool mouseRepeatOn;\r
+               volatile int mouseRepeatCount;\r
+               Thread mouseRepeatThread;\r
+               void mouseRepeatThreadFunc()\r
+               {\r
+                       mouseRepeatOn = true;\r
+                       Thread.Sleep (Interface.DeviceRepeatDelay);\r
+                       while (mouseRepeatOn) {\r
+                               mouseRepeatCount++;\r
+                               Thread.Sleep (Interface.DeviceRepeatInterval);\r
+                       }\r
+                       mouseRepeatCount = 0;\r
+               }\r
                #endregion\r
 \r
         #region keyboard Handling\r
@@ -566,7 +572,7 @@ namespace Crow
                Rectangle ILayoutable.ClientRectangle {\r
                        get { return new Size(this.ClientRectangle.Size.Width,this.ClientRectangle.Size.Height); }\r
                }\r
-               public IGOLibHost TopContainer {\r
+               public IGOLibHost HostContainer {\r
                        get { return this; }\r
                }\r
 \r
index 99be57bb1702df5153c2dbd5427d6e3dbb6553ff..c1d830614a064d8134555d4c1ce370f87aece31e 100644 (file)
@@ -29,7 +29,7 @@ namespace Crow
                public string Path;
                public Size Dimensions;
                public bool KeepProportions = false;
-               public bool Scale = true;
+               public bool Scaled = true;
 
                public Picture ()
                {
index 94230311d95b02e36d462b4e3b49a7235abec404..cbe6f2e86daba0db295a97e2dcbdc225878b0818 100644 (file)
@@ -45,20 +45,26 @@ namespace Crow
                        
                public override void Paint (Cairo.Context gr, Rectangle rect, string subPart = "")
                {
-                       float widthRatio = (float)rect.Width / Dimensions.Width;
-                       float heightRatio = (float)rect.Height / Dimensions.Height;
-                       float ratio = Math.Min (widthRatio, heightRatio);
-
-                       Rectangle rImg = rect;
+                       float widthRatio = 1f;
+                       float heightRatio = 1f;
 
+                       if (Scaled) {
+                               widthRatio = (float)rect.Width / Dimensions.Width;
+                               heightRatio = (float)rect.Height / Dimensions.Height;
+                       }
+                       if (KeepProportions) {
+                               if (widthRatio < heightRatio)
+                                       heightRatio = widthRatio;
+                               else
+                                       widthRatio = heightRatio;
+                       }
+                               
                        gr.Save ();
 
-                       if (KeepProportions)
-                               gr.Scale (ratio, ratio);
-                       else
-                               gr.Scale (widthRatio, heightRatio);
+                       gr.Translate (rect.Left,rect.Top);
+                       gr.Scale (widthRatio, heightRatio);
+                       gr.Translate (((float)rect.Width/widthRatio - Dimensions.Width)/2f, ((float)rect.Height/heightRatio - Dimensions.Height)/2f);
 
-                       gr.Translate (rImg.X/widthRatio, rImg.Y/heightRatio);
                        if (string.IsNullOrEmpty (subPart))
                                hSVG.RenderCairo (gr);
                        else