]> O.S.I.I.S - jp/crow.git/commitdiff
proportional ui
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 14 Apr 2016 07:36:03 +0000 (09:36 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 14 Apr 2016 10:47:15 +0000 (12:47 +0200)
37 files changed:
Crow.csproj
Styles/CheckBox.style
Styles/ComboBox.style
Styles/Expandable.style
Styles/MessageBox.style
Styles/Popper.style
Styles/RadioButton.style
Styles/Spinner.style
Styles/TextRun.style [new file with mode: 0644]
Templates/TabItem.crow
Templates/TreeItem.crow
Tests/GOLIBTestsOTK.cs
Tests/Interfaces/0.crow
Tests/Interfaces/5.crow
Tests/Interfaces/7.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/0.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/1.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/2.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/4.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/5.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/6.crow [new file with mode: 0755]
Tests/Interfaces/basicTests/7.crow [new file with mode: 0755]
Tests/Interfaces/colorItem.crow
Tests/Interfaces/test1.goml
Tests/Interfaces/testColorList.crow
Tests/Interfaces/testImage.crow
Tests/Interfaces/testStacks.crow
Tests/Interfaces/testTabView.crow
Tests/Tests.csproj
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/TextRun.cs
src/Measure.cs [new file with mode: 0644]

index 1eac17665b33ca95ff6b0b7d6a99a9a5958d8ba8..a9a61f18f10f7eb4a28ab7212a91bbd862b79763 100644 (file)
@@ -22,6 +22,7 @@
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Description>Crow project description</Description>
     <BaseAddress>4194304</BaseAddress>
+    <ReleaseVersion>0.4</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <Compile Include="src\GraphicObjects\IBindable.cs" />
     <Compile Include="src\Input\KeyPressEventArgs.cs" />
     <Compile Include="src\Configuration.cs" />
+    <Compile Include="src\Measure.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Drawing" />
     <Reference Include="cairo-sharp">
       <HintPath>..\..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\cairo-sharp.dll</HintPath>
+      <Package>gtk-sharp-3.0</Package>
     </Reference>
     <Reference Include="gdk-sharp">
       <HintPath>..\..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gdk-sharp.dll</HintPath>
+      <Package>gtk-sharp-2.0</Package>
     </Reference>
     <Reference Include="gio-sharp">
       <HintPath>..\..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\gio-sharp.dll</HintPath>
+      <Package>gio-sharp-3.0</Package>
     </Reference>
     <Reference Include="glib-sharp">
       <HintPath>..\..\packages\gtk-sharp.Linux.3.14.3.14.7\lib\net40\glib-sharp.dll</HintPath>
+      <Package>glib-sharp-3.0</Package>
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     <EmbeddedResource Include="Styles\MessageBox.style" />
     <EmbeddedResource Include="Styles\Window.style" />
     <EmbeddedResource Include="Styles\TextBox.style" />
+    <EmbeddedResource Include="Styles\TextRun.style" />
   </ItemGroup>
   <ItemGroup>
     <None Include="README.md" />
index 06b099d94f77549422e0fa485632b65ec2edb223..13d2224a93a3bfbbce0c92d957d3a6824c2363a8 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height=-1
+Height=Fit
index a5be8e2a0071c89d7d05cba2f73d664875362b71..9fa3b2678895e8360c6ff964ae0b5a74887e04bd 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height = -1
+Height = Fit
index a5be8e2a0071c89d7d05cba2f73d664875362b71..9fa3b2678895e8360c6ff964ae0b5a74887e04bd 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height = -1
+Height = Fit
index 294a996b2a1b9ecc0717ec5a025810bf2342c2e6..ed5cb20f9966f5fcfb572bfdf06c6219e275f17d 100644 (file)
@@ -1,5 +1,5 @@
 Width=200
-Height=-1
+Height=Fit
 Title=MessageBox
 Focusable=true
 MinimumSize=150;80
index a5be8e2a0071c89d7d05cba2f73d664875362b71..9fa3b2678895e8360c6ff964ae0b5a74887e04bd 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height = -1
+Height = Fit
index a5be8e2a0071c89d7d05cba2f73d664875362b71..9fa3b2678895e8360c6ff964ae0b5a74887e04bd 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height = -1
+Height = Fit
index a5be8e2a0071c89d7d05cba2f73d664875362b71..9fa3b2678895e8360c6ff964ae0b5a74887e04bd 100644 (file)
@@ -1,2 +1,2 @@
 Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/TextRun.style b/Styles/TextRun.style
new file mode 100644 (file)
index 0000000..c2eb97f
--- /dev/null
@@ -0,0 +1,2 @@
+Fit = true
+Margin = 2
index a889f4ee813e1039fd0f97c9bc2a9f15b6918a56..c269bbe0589e9cb1f977db597d1fe0e3c38fb3f9 100644 (file)
@@ -8,7 +8,7 @@
                Name="TabTitle"
                HorizontalAlignment="Left"
                Height="{../../../TabThickness}"
-               Width="-1">
+               Width="Fit">
                <Label Text="{../../../Caption}"/>
                <Border CornerRadius="5" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
index b3458ec1ed5c6504a629d982cc499a90e20e407c..97620096349de1ac171193bd185d1ca1fa3cfa91 100644 (file)
@@ -9,7 +9,7 @@
                <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" \r
                        MouseClick="../onMouseClick">\r
                        <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">\r
-                               <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">\r
+                               <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
                                        <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>\r
                                        <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>\r
                                </HorizontalStack>\r
 <!--           <VerticalStack\r
                        Height="{../HeightPolicy}" Width="{../WidthPolicy}"\r
                        MouseClick="../onMouseClick">\r
-                       <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">\r
+                       <HorizontalStack Spacing="1" Height="Fit" Width="{../../WidthPolicy}">
                                <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>\r
                                <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>\r
                        </HorizontalStack>\r
                        <ListBox Name="Content" Visible="false"\r
-                               Height="-1" Width="{../../WidthPolicy}"/>\r
+                               Height="Fit" Width="{../../WidthPolicy}"/>
                </VerticalStack>-->\r
 \r
index 9c522b32169d0b892f246a6fc3576115d5a01e8e..9d3aa6f92b26c049c849ca3fa9da6e66fc9e6c05 100644 (file)
@@ -28,8 +28,17 @@ namespace testOTK
 
                int frameCpt = 0;
                int idx = 0;
+
                string[] testFiles = {
+                       @"basicTests/5.crow",
                        "testColorList.crow",
+                       @"basicTests/0.crow",
+                       @"basicTests/4.crow",
+                       @"basicTests/1.crow",
+                       @"basicTests/2.crow",
+                       "test0.goml",
+                       "test1.goml",
+                       "0.crow",
                        "testCombobox.goml",
                        "0.crow",
                        "testCheckbox.goml",
index 7ed4da83cdcfa41c5b19029bbd3878ef65ead686..1f8f4c7f6258fa8e47b46bc42f897970b8659a95 100755 (executable)
@@ -1,46 +1,4 @@
 <?xml version="1.0"?>
-<VerticalStack Height="-1" Width="-1">
-       <Label Width="0"/>
-       <Expandable  Width="-1" Background="Gray">
-               <Expandable Background="LightBlue">
-                       <Expandable Background="Green">
-                               <Expandable Background="LimeGreen">
-                                       <Expandable Background="DimGray">
-                                               <Expandable Width="0" Background="Yellow">
-                                                       <Expandable Background="NavyBlue">
-                                                               <Expandable Width="0" Background="Blue">
-                                                                       <Expandable Width="0" Background="BlueCrayola">
-                                                                               <Expandable Width="0" Background="Green">
-                                                                                       <Label Background="Red"/>
-                                                                               </Expandable>
-                                                                       </Expandable>
-                                                               </Expandable>
-                                                       </Expandable>
-                                               </Expandable>
-                                       </Expandable>
-                               </Expandable>
-                       </Expandable>
-               </Expandable>
-       </Expandable>
-       <Expandable Width="0"  Background="Gray">
-               <Expandable Width="0" Background="LightBlue">
-                       <Expandable Width="0" Background="Green">
-                               <Expandable Width="0" Background="LimeGreen">
-                                       <Expandable Width="0" Background="DimGray">
-                                               <Expandable Width="0" Background="Yellow">
-                                                       <Expandable Width="0" Background="NavyBlue">
-                                                               <Expandable Width="0" Background="Blue">
-                                                                       <Expandable Width="0" Background="BlueCrayola">
-                                                                               <Expandable Width="0" Background="Green">
-                                                                                       <Label Background="Red"/>
-                                                                               </Expandable>
-                                                                       </Expandable>
-                                                               </Expandable>
-                                                       </Expandable>
-                                               </Expandable>
-                                       </Expandable>
-                               </Expandable>
-                       </Expandable>
-               </Expandable>
-       </Expandable>
-</VerticalStack>
+<Container Background="Green" Margin="10">
+       <GraphicObject Margin="10" Width="{../WidthPolicy}" Height="{../HeightPolicy}" Background="Red"/>
+</Container>
\ No newline at end of file
index c559544d0289769b9b38e43b594c46f4ef7b35bc..4d263508161e9c8a8b921756cae50dba35f5a429 100755 (executable)
@@ -28,7 +28,7 @@
                <ScrollBar Orientation="Horizontal" Maximum="100" Value="50" Height="16" Width="150"/>
                <Spinner Value="100"/>-->
        </VerticalStack>
-<!--   <VerticalStack Width="150" Height="-1" Margin="2" Spacing="2">
+<!--   <VerticalStack Width="150" Height="Fit" Margin="2" Spacing="2">
                <TextRun Text="text run test" Width="0"/>
                <Label Text="label test" Width="0"/>
                <TextBox Text="text box test" Width="0"/>
@@ -48,7 +48,7 @@
                <GroupBox Caption="Group box"  Width="0">
                        <Label Text="border test" Margin="3"/>
                </GroupBox>
-               <Container Height="-1"  Width="0" Background="DimGray" Margin="3">
+               <Container Height="Fit"  Width="0" Background="DimGray" Margin="3">
                        <GraphicObject Width="20" Height="20" Background="LightGray"/>
                </Container>
                <ProgressBar Height="10" Width="0" Background="DimGray" Value="50" />
diff --git a/Tests/Interfaces/7.crow b/Tests/Interfaces/7.crow
new file mode 100755 (executable)
index 0000000..d8e9cd3
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<VerticalStack Height="Fit" Width="Fit">
+       <Label Width="0"/>
+       <Expandable  Width="Fit" Background="Gray">
+               <Expandable Background="LightBlue">
+                       <Expandable Background="Green">
+                               <Expandable Background="LimeGreen">
+                                       <Expandable Background="DimGray">
+                                               <Expandable Width="0" Background="Yellow">
+                                                       <Expandable Background="NavyBlue">
+                                                               <Expandable Width="0" Background="Blue">
+                                                                       <Expandable Width="0" Background="BlueCrayola">
+                                                                               <Expandable Width="0" Background="Green">
+                                                                                       <Label Background="Red"/>
+                                                                               </Expandable>
+                                                                       </Expandable>
+                                                               </Expandable>
+                                                       </Expandable>
+                                               </Expandable>
+                                       </Expandable>
+                               </Expandable>
+                       </Expandable>
+               </Expandable>
+       </Expandable>
+       <Expandable Width="0"  Background="Gray">
+               <Expandable Width="0" Background="LightBlue">
+                       <Expandable Width="0" Background="Green">
+                               <Expandable Width="0" Background="LimeGreen">
+                                       <Expandable Width="0" Background="DimGray">
+                                               <Expandable Width="0" Background="Yellow">
+                                                       <Expandable Width="0" Background="NavyBlue">
+                                                               <Expandable Width="0" Background="Blue">
+                                                                       <Expandable Width="0" Background="BlueCrayola">
+                                                                               <Expandable Width="0" Background="Green">
+                                                                                       <Label Background="Red"/>
+                                                                               </Expandable>
+                                                                       </Expandable>
+                                                               </Expandable>
+                                                       </Expandable>
+                                               </Expandable>
+                                       </Expandable>
+                               </Expandable>
+                       </Expandable>
+               </Expandable>
+       </Expandable>
+</VerticalStack>
diff --git a/Tests/Interfaces/basicTests/0.crow b/Tests/Interfaces/basicTests/0.crow
new file mode 100755 (executable)
index 0000000..486399b
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<Label Margin="50" Width="50%" Height="50%" TextAlignment="BottomRight" Background="Mantis"/>
+<!--<Container Background="Green" Margin="10" Width="Fit" Height="Fit">
+       <GraphicObject Margin="10" Width="{../WidthPolicy}" Height="{../HeightPolicy}" Background="Red"
+               MinimumSize="50;50"/>
+</Container>-->
\ No newline at end of file
diff --git a/Tests/Interfaces/basicTests/1.crow b/Tests/Interfaces/basicTests/1.crow
new file mode 100755 (executable)
index 0000000..7d37018
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<Container Background="Green" Margin="0">
+       <GraphicObject Margin="0" Width="50" Height="50" Background="Red"/>
+</Container>
\ No newline at end of file
diff --git a/Tests/Interfaces/basicTests/2.crow b/Tests/Interfaces/basicTests/2.crow
new file mode 100755 (executable)
index 0000000..ce9448c
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<Container Background="Green" Margin="0">
+       <GraphicObject Margin="0" Width="90" Height="90%" Background="Red"/>
+</Container>
\ No newline at end of file
diff --git a/Tests/Interfaces/basicTests/4.crow b/Tests/Interfaces/basicTests/4.crow
new file mode 100755 (executable)
index 0000000..f696a9e
--- /dev/null
@@ -0,0 +1,377 @@
+<?xml version="1.0"?>
+<HorizontalStack Fit="true">
+       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+               <ProgressBar CornerRadius="5" Background="DimGray" Margin="1" Maximum="1000" Value="{fps}" Width="200" Height="15"/>
+               <HorizontalStack Fit="true">
+                       <Label Text="Memory:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{memory}" Font="droid,12" TextAlignment="Center"
+                               Background="vgradient|0:BlueCrayola|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+       </VerticalStack>
+       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+       </VerticalStack>
+       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+       </VerticalStack>
+       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Update:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Layouting:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Drawing:" Width="50" TextAlignment="Right"/>
+                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
+                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Min:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+               <HorizontalStack Fit="true">
+                       <Label Text="Max:" Width="50" TextAlignment="Right"/>
+                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                               Background="vgradient|0:AoEnglish|1:Black"/>
+               </HorizontalStack>
+       </VerticalStack>
+</HorizontalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/basicTests/5.crow b/Tests/Interfaces/basicTests/5.crow
new file mode 100755 (executable)
index 0000000..40abe0f
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<HorizontalStack Width="Stretched" Height="Stretched" Margin="5" Background="Mantis">
+       <GraphicObject Background="Carmine" Width="40%" Height="20%"/>
+       <GraphicObject Background="Carmine" Width="Stretched" Height="20%"/>
+       <GraphicObject Background="Carmine" Width="40%" Height="20%"/>
+</HorizontalStack>
diff --git a/Tests/Interfaces/basicTests/6.crow b/Tests/Interfaces/basicTests/6.crow
new file mode 100755 (executable)
index 0000000..829c39f
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true" Background="DimGray" Margin="5">
+<!--   <RadioButton/>-->
+       <Label Text="a" Width="0" Background="Red"/>
+       <Label Text="{fps}" HorizontalAlignment="Right" Background="LimeGreen"/>
+</VerticalStack>
diff --git a/Tests/Interfaces/basicTests/7.crow b/Tests/Interfaces/basicTests/7.crow
new file mode 100755 (executable)
index 0000000..d8e9cd3
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<VerticalStack Height="Fit" Width="Fit">
+       <Label Width="0"/>
+       <Expandable  Width="Fit" Background="Gray">
+               <Expandable Background="LightBlue">
+                       <Expandable Background="Green">
+                               <Expandable Background="LimeGreen">
+                                       <Expandable Background="DimGray">
+                                               <Expandable Width="0" Background="Yellow">
+                                                       <Expandable Background="NavyBlue">
+                                                               <Expandable Width="0" Background="Blue">
+                                                                       <Expandable Width="0" Background="BlueCrayola">
+                                                                               <Expandable Width="0" Background="Green">
+                                                                                       <Label Background="Red"/>
+                                                                               </Expandable>
+                                                                       </Expandable>
+                                                               </Expandable>
+                                                       </Expandable>
+                                               </Expandable>
+                                       </Expandable>
+                               </Expandable>
+                       </Expandable>
+               </Expandable>
+       </Expandable>
+       <Expandable Width="0"  Background="Gray">
+               <Expandable Width="0" Background="LightBlue">
+                       <Expandable Width="0" Background="Green">
+                               <Expandable Width="0" Background="LimeGreen">
+                                       <Expandable Width="0" Background="DimGray">
+                                               <Expandable Width="0" Background="Yellow">
+                                                       <Expandable Width="0" Background="NavyBlue">
+                                                               <Expandable Width="0" Background="Blue">
+                                                                       <Expandable Width="0" Background="BlueCrayola">
+                                                                               <Expandable Width="0" Background="Green">
+                                                                                       <Label Background="Red"/>
+                                                                               </Expandable>
+                                                                       </Expandable>
+                                                               </Expandable>
+                                                       </Expandable>
+                                               </Expandable>
+                                       </Expandable>
+                               </Expandable>
+                       </Expandable>
+               </Expandable>
+       </Expandable>
+</VerticalStack>
index da893c825367ad57cc7f8cfe38266e0e9ab2f053..c096e77a0871627b3a0f44e9b07770e4fda2e910 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 <HorizontalStack
                        HorizontalAlignment="Left"
-                       Height="-1" Width="0" Margin="1" Focusable="true"
+                       Height="Fit" Width="Stretched" Margin="1" Focusable="true"
                        MouseEnter="{Background=hgradient|0:DarkRed|1:Transparent}"
                        MouseLeave="{Background=Transparent}">
        <GraphicObject Height="12" Width="20" Background="{}" Margin="0" CornerRadius="3"/>
-       <Label Text="{Name}" Margin="0" Width="0"/>
+       <Label Text="{Name}" Margin="0" Width="Stretched"/>
 </HorizontalStack>
 
index fbf788cf7b0fd17d9ae20b589507aa4044b418cd..74da47265bb262cafa29e35b3e9126f965f88b76 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <Container Name="TopContainer" Width="400" Height="350"
        Margin="20" Focusable="True" Background="Yellow">
-       <Container Name="MiddleContainer" Width="0" Height="0"
+       <Container Name="MiddleContainer" Width="50%" Height="Stretched"
                Margin="20" Focusable="True" Background="Green">
                        <Image VerticalAlignment="Bottom"                       
                                Name="PhaseOverlay" Width="100" Height="100" Path="image/u.svg" Background="Red"/>
index f98ef1348ecfe4a2c7b9cbc08a806b5aff798daf..ccbbb094f2ae7188215b74203f7b40161230192e 100755 (executable)
@@ -10,7 +10,7 @@
                                                <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                                                                Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
                                                                ValueChanged="../../../_scroller_ValueChanged">
-                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="10;10"
+                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10;10"
                                                                Name="List" Margin="0"
                                                                VerticalAlignment="Top"
                                                                HorizontalAlignment="Left"
index d55db72d6f66ee0eaada9496215ca395781e846c..83d9de6a2ba4be413b31022ca6de984369d3eb7c 100755 (executable)
@@ -10,8 +10,8 @@
                <Image Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="100" Path="#Tests.image.crow0.svg" />
                <Image Background="vgradient|0:SkyBlue|1:White" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
                <Image Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
-               <Image Background="vgradient|0:SkyBlue|1:White" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
-               <Image Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
+               <Image Background="vgradient|0:SkyBlue|1:White" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
+               <Image Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
        </HorizontalStack>
        <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
@@ -23,8 +23,8 @@
                <Image KeepProportions="false" Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="100" Path="#Tests.image.crow0.svg" />
                <Image KeepProportions="false" Background="vgradient|0:SkyBlue|1:White" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
                <Image KeepProportions="false" Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
-               <Image KeepProportions="false" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
-               <Image KeepProportions="false" Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
+               <Image KeepProportions="false" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
+               <Image KeepProportions="false" Margin="10" Background="vgradient|0:SkyBlue|1:White" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
        </HorizontalStack>
        <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Label Text="UNSCALED" Width="150"/>
@@ -36,8 +36,8 @@
                <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Tests.image.crow0.svg" />
                <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
                <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Tests.image.crow0.svg" />
-               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
-               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Tests.image.crow0.svg" />
+               <Image Scaled="false" Background="Blue" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="Fit" Path="#Tests.image.crow0.svg" />
        </HorizontalStack>
        <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Label Text="SCALED PROPORTIONNAL" Width="150"/>
@@ -49,8 +49,8 @@
                <Image Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.tetra.png"/>
                <Image Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
                <Image Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image Margin="10" Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
        </HorizontalStack>
        <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Label Text="SCALED NOT PROPORTIONNAL" Width="150"/>
@@ -62,8 +62,8 @@
                <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.tetra.png"/>
                <Image KeepProportions="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
                <Image KeepProportions="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image KeepProportions="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image KeepProportions="false" Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image KeepProportions="false" Margin="10" Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
        </HorizontalStack>
        <HorizontalStack Fit="true" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Label Text="UNSCALED" Width="150"/>
                <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="100" Path="#Crow.Images.Icons.tetra.png"/>
                <Image Scaled="false" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
                <Image Scaled="false" Margin="10" Background="Blue" Width="100" Height="50" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image Scaled="false" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
-               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="-1" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image Scaled="false" Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
+               <Image Scaled="false" Margin="10" Background="Blue" Width="50" Height="Fit" Path="#Crow.Images.Icons.tetra.png"/>
        </HorizontalStack>
-       <HorizontalStack Width="-1" Height="100" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
+       <HorizontalStack Width="Fit" Height="100" Background="hgradient|0:DarkRed|1:Transparent" Margin="5">
                <Image Background="Blue" Path="#Tests.image.crow0.svg" />
                <Image Margin="10" Background="White" Path="#Tests.image.crow0.svg" />
                <Image Background="White" Width="20" Height="10" Path="#Tests.image.crow0.svg" />
index 5283b00a313f5118fb21cdaf3e7aa41f29224f20..5c1be265ccd5f53ded9a39892d9c6d962b559a66 100755 (executable)
@@ -7,7 +7,7 @@
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </VerticalStack>
-               <VerticalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+               <VerticalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue" Width="0"/>
                        <TextRun Background="SkyBlue" Height="0"/>
@@ -17,7 +17,7 @@
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </HorizontalStack>
-               <HorizontalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+               <HorizontalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </HorizontalStack>
-               <HorizontalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+               <HorizontalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </HorizontalStack>
-                       <HorizontalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+                       <HorizontalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue" Width="0"/>
                        <TextRun Background="SkyBlue"/>
                </HorizontalStack>
        </VerticalStack>
-       <VerticalStack Width="-1" Margin="5" Background="Gray">
-               <VerticalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+       <VerticalStack Width="Fit" Margin="5" Background="Gray">
+               <VerticalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue" HorizontalAlignment="Left"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </VerticalStack>
-               <VerticalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+               <VerticalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue" Width="0"/>
                        <TextRun Background="SkyBlue" Height="0"/>
@@ -71,7 +71,7 @@
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                </HorizontalStack>
-               <HorizontalStack Width="0" Height="-1" Background="DimGray" Margin="5">
+               <HorizontalStack Width="0" Height="Fit" Background="DimGray" Margin="5">
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
                        <TextRun Background="SkyBlue"/>
index 3a081597c918b9cf31d650fbb3c23d019464c9a5..14c407ce3899fd8aaca83a57dcc336137f2c96b3 100644 (file)
@@ -31,7 +31,7 @@
                        </TabItem>
                </TabView>
                <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right"
-                       Caption="Add new tab" Width="-1" Height="30" MouseClick="onAddTabButClick"/>
+                       Caption="Add new tab" Width="Fit" Height="30" MouseClick="onAddTabButClick"/>
        </VerticalStack>
        <TabView CacheEnabled="false" Width="200" Height="200" Orientation="Horizontal" Spacing="20" Margin="0">
                <TabItem
index 1c1bf659dd657e233d73c6ce0bbe9dc95b5252f7..3f8087270f5d52c2b6de4081d4ed045bdfa1aec3 100644 (file)
     <None Include="Interfaces\testTextBox.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Include="Interfaces\0.crow">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <None Include="Interfaces\test2WayBinding.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="GOLIBTests.cs" />
+    <None Include="Interfaces\7.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\0.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\0.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\1.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\2.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\4.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\5.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\6.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\basicTests\7.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
     <Folder Include="image\" />
+    <Folder Include="Interfaces\basicTests\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="image\tetra.png" />
index c1d3db6d3227eb5773cb240443681b233311b09d..ea46d439434dc896c724ae16572695b1b98d5114 100644 (file)
@@ -391,15 +391,15 @@ namespace Crow
                                        il.MarkLabel (jumpTable [i]);
                                        il.Emit(OpCodes.Ldloc_1);
 
-                                       //by default, target value type is deducted from source member type to allow
+                                       //by default, source value type is deducted from target member type to allow
                                        //memberless binding, if targetMember exists, it will be used to determine target
                                        //value type for conversion
-                                       Type targetValueType = b.Target.Property.PropertyType;
+                                       Type sourceValueType = b.Target.Property.PropertyType;
                                        if (b.Source.Member != null) {
                                                if (b.Source.Member.MemberType == MemberTypes.Property)
-                                                       targetValueType = b.Source.Property.PropertyType;
+                                                       sourceValueType = b.Source.Property.PropertyType;
                                                else if (b.Source.Member.MemberType == MemberTypes.Field)
-                                                       targetValueType = b.Source.Field.FieldType;
+                                                       sourceValueType = b.Source.Field.FieldType;
                                                else
                                                        throw new Exception ("unhandle target member type in binding");
                                        }
@@ -409,11 +409,11 @@ namespace Crow
                                                if (!tostring.FindMember ("ToString"))
                                                        throw new Exception ("ToString method not found");
                                                il.Emit (OpCodes.Callvirt, tostring.Method);
-                                       }else if (!targetValueType.IsValueType)
-                                               il.Emit(OpCodes.Castclass, targetValueType);
-                                       else if (b.Target.Property.PropertyType != targetValueType)
-                                               il.Emit(OpCodes.Callvirt, CompilerServices.GetConvertMethod( b.Target.Property.PropertyType ));
-                                       else
+                                       } else if (!sourceValueType.IsValueType)
+                                               il.Emit (OpCodes.Castclass, sourceValueType);
+                                       else if (b.Target.Property.PropertyType != sourceValueType) {
+                                               il.Emit (OpCodes.Callvirt, CompilerServices.GetConvertMethod (b.Target.Property.PropertyType));
+                                       }else
                                                il.Emit(OpCodes.Unbox_Any, b.Target.Property.PropertyType);
 
                                        il.Emit(OpCodes.Callvirt, b.Target.Property.GetSetMethod());
@@ -583,7 +583,7 @@ namespace Crow
                                name = "ToSingle";
                        else if (targetType == typeof (string ) )
                                return typeof(object).GetMethod("ToString", Type.EmptyTypes);
-                       else
+                       else //try to find implicit convertion
                                throw new NotImplementedException( string.Format( "Conversion to {0} is not implemented.", targetType.Name ) );
 
                        return typeof( Convert ).GetMethod( name, BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof( object ) }, null );
index 925f908a49cac3b0ab9926e15cca4e174ec2670c..455ed928127c2c768a777f28ea7eb673df4978cc 100644 (file)
@@ -133,10 +133,10 @@ namespace Crow
                                                if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
                                                        return false;
                                                cptChildren++;
-                                               if (Children [i].Width == 0) {
-                                                       if (!(stretchedGO == null && Width >= 0)) {
+                                               if (Children [i].Width == Measure.Stretched) {
+                                                       if (!(stretchedGO == null && Width != Measure.Fit)) {
                                                                //change size policy of other stretched children
-                                                               Children [i].Width = -1;
+                                                               Children [i].Width = Measure.Fit;
                                                                return false;
                                                        }
                                                        stretchedGO = Children [i];
@@ -146,7 +146,7 @@ namespace Crow
                                                }
                                                tmpWidth -= Children [i].Slot.Width + Spacing;
                                        }
-                                       if (stretchedGO != null && Width >= 0) {
+                                       if (stretchedGO != null && Width != Measure.Fit) {
                                                tmpWidth += (Spacing - 2 * Margin);
                                                if (tmpWidth < MinimumSize.Width)
                                                        tmpWidth = MinimumSize.Width;
@@ -172,9 +172,9 @@ namespace Crow
                                                if (Children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
                                                        return false;
                                                cptChildren++;
-                                               if (Children [i].Height == 0) {
-                                                       if (!(stretchedGO == null && Height >= 0)){
-                                                               Children [i].Height = -1;
+                                               if (Children [i].Height == Measure.Stretched) {
+                                                       if (!(stretchedGO == null && Height != Measure.Fit)){
+                                                               Children [i].Height = Measure.Fit;
                                                                return false;
                                                        }
                                                        stretchedGO = Children [i];
@@ -184,7 +184,7 @@ namespace Crow
                                                }
                                                tmpHeight -= Children[i].Slot.Height + Spacing;
                                        }
-                                       if (stretchedGO != null && Height >= 0) {
+                                       if (stretchedGO != null && Height != Measure.Fit) {
                                                tmpHeight += (Spacing - 2 * Margin);
                                                if (tmpHeight < MinimumSize.Height)
                                                        tmpHeight = MinimumSize.Height;
@@ -221,14 +221,14 @@ namespace Crow
                        switch (arg.LayoutType) {
                        case LayoutingType.Width:
                                if (Orientation == Orientation.Horizontal) {
-                                       if (Width < 0)
+                                       if (Width == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                        this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                                }
                                break;
                        case LayoutingType.Height:
                                if (Orientation == Orientation.Vertical) {
-                                       if (Height < 0)
+                                       if (Height == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                        this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                                }
index 7b58f652260fee78d55bee118b5bde5b5d1021a6..8877c6b235f3ccfc0b769f8c31beb630b58c8ef3 100644 (file)
@@ -95,7 +95,8 @@ namespace Crow
                /// <summary>
                /// Original size and position 0=Stretched; -1=Fit
                /// </summary>
-               int _width, _height, _left, _top;
+               Measure _width, _height;
+               int _left, _top;
                /// <summary>
                /// Current size and position computed during layouting pass
                /// </summary>
@@ -239,8 +240,8 @@ namespace Crow
                                this.RegisterForLayouting (LayoutingType.Y);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(0)]
-               public virtual int Width {
+               [XmlAttributeAttribute()][DefaultValue("Stretched")]
+               public virtual Measure Width {
                        get { return _width; }
                        set {
                                if (_width == value)
@@ -253,8 +254,8 @@ namespace Crow
                                this.RegisterForLayouting (LayoutingType.Width);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(0)]
-               public virtual int Height {
+               [XmlAttributeAttribute()][DefaultValue("Stretched")]
+               public virtual Measure Height {
                        get { return _height; }
                        set {
                                if (_height == value)
@@ -267,17 +268,21 @@ namespace Crow
                                this.RegisterForLayouting (LayoutingType.Height);
                        }
                }
-               [XmlIgnore]public virtual int WidthPolicy { get { return Width < 1 ? Width : 0; } }
-               [XmlIgnore]public virtual int HeightPolicy { get { return Height < 1 ? Height : 0; } }
+               [XmlIgnore]public virtual Measure WidthPolicy { get {
+                               return Width.Units == Unit.Percent || Width.IsFixed ?
+                                       Measure.Stretched : Measure.Fit; } }
+               [XmlIgnore]public virtual Measure HeightPolicy { get {
+                               return Height.Units == Unit.Percent || Height.IsFixed ?
+                                       Measure.Stretched : Measure.Fit; } }
 
                [XmlAttributeAttribute()][DefaultValue(false)]
                public virtual bool Fit {
-                       get { return Width < 0 && Height < 0 ? true : false; }
+                       get { return Width == Measure.Fit && Height == Measure.Fit ? true : false; }
                        set {
                                if (value == Fit)
                                        return;
 
-                               Width = Height = -1;
+                               Width = Height = Measure.Fit;
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(false)]
@@ -800,22 +805,24 @@ namespace Crow
                                LastSlots.Y = Slot.Y;
                                break;
                        case LayoutingType.Width:
-                               if (Width > 0)
+                               if (Width.IsFixed)
                                        Slot.Width = Width;
-                               else if (Width < 0) {
+                               else if (Width == Measure.Fit) {
                                        Slot.Width = measureRawSize (LayoutingType.Width);
                                } else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
                                        return false;
-                               else
+                               else if (Width == Measure.Stretched)
                                        Slot.Width = Parent.ClientRectangle.Width;
+                               else
+                                       Slot.Width = Parent.ClientRectangle.Width * Width / 100;
 
                                //size constrain
                                if (Slot.Width < MinimumSize.Width) {
                                        Slot.Width = MinimumSize.Width;
-                                       NotifyValueChanged ("WidthPolicy", 0);
+                                       NotifyValueChanged ("WidthPolicy", Measure.Stretched);
                                } else if (Slot.Width > MaximumSize.Width && MaximumSize.Width > 0) {
                                        Slot.Width = MaximumSize.Width;
-                                       NotifyValueChanged ("WidthPolicy", 0);
+                                       NotifyValueChanged ("WidthPolicy", Measure.Stretched);
                                }
 
                                if (LastSlots.Width == Slot.Width)
@@ -828,22 +835,24 @@ namespace Crow
                                LastSlots.Width = Slot.Width;
                                break;
                        case LayoutingType.Height:
-                               if (Height > 0)
+                               if (Height.IsFixed)
                                        Slot.Height = Height;
-                               else if (Height < 0) {
+                               else if (Height == Measure.Fit) {
                                        Slot.Height = measureRawSize (LayoutingType.Height);
                                } else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
                                        return false;
-                               else
+                               else if (Height == Measure.Stretched)
                                        Slot.Height = Parent.ClientRectangle.Height;
+                               else
+                                       Slot.Height = Parent.ClientRectangle.Height * Height.Value / 100;
 
                                //size constrain
                                if (Slot.Height < MinimumSize.Height) {
                                        Slot.Height = MinimumSize.Height;
-                                       NotifyValueChanged ("HeightPolicy", 0);
+                                       NotifyValueChanged ("HeightPolicy", Measure.Stretched);
                                } else if (Slot.Height > MaximumSize.Height && MaximumSize.Height > 0) {
                                        Slot.Height = MaximumSize.Height;
-                                       NotifyValueChanged ("HeightPolicy", 0);
+                                       NotifyValueChanged ("HeightPolicy", Measure.Stretched);
                                }
 
                                if (LastSlots.Height == Slot.Height)
index 47795b06b1b1fce1dc0d4da37c9f2c56b5de61fe..78c5bca3716e5ca713fc833678c6dce64f00ca1b 100644 (file)
@@ -139,7 +139,7 @@ namespace Crow
                                if (largestChild == null){
                                        //if still null, not possible to determine a width
                                        //because all children are stretched, force first one to fit
-                                       Children[0].Width = -1;
+                                       Children[0].Width = Measure.Fit;
                                        return -1;//cancel actual sizing to let child computation take place
                                }
                                return maxChildrenWidth + 2 * Margin;
@@ -147,7 +147,7 @@ namespace Crow
                                if (tallestChild == null)
                                        searchTallestChild ();
                                if (tallestChild == null) {
-                                       Children[0].Height = -1;
+                                       Children[0].Height = Measure.Fit;
                                        return -1;
                                }
                                return maxChildrenHeight + 2 * Margin;
@@ -178,14 +178,14 @@ namespace Crow
                                if (g.Slot.Width > maxChildrenWidth) {
                                        maxChildrenWidth = g.Slot.Width;
                                        largestChild = g;
-                                       if (Width < 0)
+                                       if (Width == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                } else if (g == largestChild) {
 
                                        largestChild = null;
                                        maxChildrenWidth = 0;
 
-                                       if (Width < 0)
+                                       if (Width == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                }
                                break;
@@ -193,14 +193,14 @@ namespace Crow
                                if (g.Slot.Height > maxChildrenHeight) {
                                        maxChildrenHeight = g.Slot.Height;
                                        tallestChild = g;
-                                       if (Height < 0)
+                                       if (Height == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                } else if (g == tallestChild) {
 
                                        tallestChild = null;
                                        maxChildrenHeight = 0;
 
-                                       if (Height < 0)
+                                       if (Height == Measure.Fit)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                }
                                break;
index c28f090c5be50d62237c5afb66e62f53292c1ae8..0a909b7342f815f3c38d05a6f8a40d4164963f55 100644 (file)
@@ -397,7 +397,8 @@ namespace Crow
                        Rectangle cb = ClientRectangle;
 
                        //ignore text alignment if size to content = true
-                       if (Width < 0 || Height < 0)
+                       //TODO: split horizontal and vertical logic
+                       if (Width == Measure.Fit || Height == Measure.Fit)
                        {
                                rText.X = cb.X;
                                rText.Y = cb.Y;
@@ -406,7 +407,9 @@ namespace Crow
                                        widthRatio = (float)cb.Width / rText.Width;
                                        if (!verticalStretch)
                                                heightRatio = widthRatio;
-                               }if (verticalStretch) {
+                               }
+
+                               if (verticalStretch) {
                                        heightRatio = (float)cb.Height / rText.Height;
                                        if (!horizontalStretch)
                                                widthRatio = heightRatio;
index f3385a8840a90fa24320272ba4d4af3d026266bc..98e8d4b1baa5c7776c25ff6d17794195d6233081 100644 (file)
@@ -108,12 +108,12 @@ namespace Crow
                                //child has stretched size
                                switch (layoutType) {
                                case LayoutingType.Width:
-                                       if (Width < 0 && child.Width == 0)
-                                               child.Width = -1;
+                                       if (Width == Measure.Fit && child.Width.Units == Unit.Percent)
+                                               child.Width = Measure.Fit;
                                        break;
                                case LayoutingType.Height:
-                                       if (Height < 0 && child.Height == 0)
-                                               child.Height = -1;
+                                       if (Height == Measure.Fit && child.Height.Units == Unit.Percent)
+                                               child.Height = Measure.Fit;
                                        break;
                                }
                        }
index 021d5654b5f8e98957518a13757124384006945b..7f50a34ee01c615ec7c5378e9903884e012befe9 100644 (file)
@@ -11,6 +11,7 @@ using System.ComponentModel;
 namespace Crow
 {
     [Serializable]
+       [DefaultStyle("#Crow.Styles.TextRun.style")]
     public class TextRun : GraphicObject
     {
                #region CTOR
@@ -127,22 +128,6 @@ namespace Crow
                }
 
                #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(-1)]
-               public override int Width {
-                       get { return base.Width; }
-                       set { base.Width = value; }
-               }
-               [XmlAttributeAttribute()][DefaultValue(-1)]
-               public override int Height {
-                       get { return base.Height; }
-                       set { base.Height = value; }
-               }
-               [XmlAttributeAttribute()][DefaultValue(2)]
-               public override int Margin {
-                       get { return base.Margin; }
-                       set { base.Margin = value; }
-               }
-
                protected override int measureRawSize(LayoutingType lt)
                {                       
                        if (lines == null)
diff --git a/src/Measure.cs b/src/Measure.cs
new file mode 100644 (file)
index 0000000..4fbac42
--- /dev/null
@@ -0,0 +1,101 @@
+//
+//  Measure.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+
+namespace Crow
+{
+       public enum Unit { Pixel, Percent }
+       public struct Measure
+       {
+               public int Value;
+               public Unit Units;
+
+               public static Measure Fit = new Measure(-1);
+               //TODO:implement stretching as 100%, not 0%
+               public static Measure Stretched = new Measure(0, Unit.Percent);
+
+               public Measure (int _value, Unit _units = Unit.Pixel)
+               {
+                       Value = _value;
+                       Units = _units;
+               }
+               public bool IsFixed { get { return Value > 0 && Units == Unit.Pixel; }}
+               #region Operators
+               public static implicit operator int(Measure m){
+                       return m.Value;
+               }
+               public static implicit operator Measure(int i){
+                       return new Measure(i);
+               }
+               public static implicit operator string(Measure m){
+                       return m.ToString();
+               }
+               public static implicit operator Measure(string s){
+                       return Measure.Parse(s);
+               }
+
+               public static bool operator ==(Measure m1, Measure m2){
+                       return m1.Value == m2.Value && m1.Units == m2.Units;
+               }
+               public static bool operator !=(Measure m1, Measure m2){
+                       return !(m1.Value == m2.Value && m1.Units == m2.Units);
+               }
+               #endregion
+               public override int GetHashCode ()
+               {
+                       return Value.GetHashCode ();
+               }
+               public override bool Equals (object obj)
+               {
+                       return (obj == null || obj.GetType() != typeof(Measure)) ?
+                               false :
+                               this == (Measure)obj;
+               }
+               public override string ToString ()
+               {
+                       return Value == -1 ? "Fit" :
+                               Value == 0 ? "Stretched" :
+                               Units == Unit.Percent ? Value.ToString () + "%" : Value.ToString ();
+               }
+               public static Measure Parse(string s){
+                       if (string.IsNullOrEmpty (s))
+                               return Measure.Stretched;
+
+                       string st = s.Trim ();
+                       int tmp = 0;
+
+                       if (string.Equals ("Fit", st, StringComparison.Ordinal))
+                               return Measure.Fit;
+                       else if (string.Equals ("Stretched", s, StringComparison.Ordinal))
+                               return Measure.Stretched;
+                       else {
+                               if (st.EndsWith ("%", StringComparison.Ordinal)) {
+                                       if (int.TryParse (s.Substring(0, st.Length - 1), out tmp))
+                                               return new Measure (tmp, Unit.Percent);
+                               }else if (int.TryParse (s, out tmp))
+                                       return new Measure (tmp);
+                       }
+
+                       throw new Exception ("Error parsing Measure.");
+               }
+
+       }
+}