aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-04-14 09:36:03 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-04-14 12:47:15 +0200
commit7ff5f14fe6b875dff57b335c4eeeb42397a07c91 (patch)
tree23f80be40c98b4d142894a607c8dd2f43112b523
parent0b005fefe69b67bf335c3c00944bbac73e8b4831 (diff)
proportional ui
-rw-r--r--Crow.csproj7
-rw-r--r--Styles/CheckBox.style2
-rw-r--r--Styles/ComboBox.style2
-rw-r--r--Styles/Expandable.style2
-rw-r--r--Styles/MessageBox.style2
-rw-r--r--Styles/Popper.style2
-rw-r--r--Styles/RadioButton.style2
-rw-r--r--Styles/Spinner.style2
-rw-r--r--Styles/TextRun.style2
-rw-r--r--Templates/TabItem.crow2
-rw-r--r--Templates/TreeItem.crow6
-rw-r--r--Tests/GOLIBTestsOTK.cs9
-rwxr-xr-xTests/Interfaces/0.crow48
-rwxr-xr-xTests/Interfaces/5.crow4
-rwxr-xr-xTests/Interfaces/7.crow46
-rwxr-xr-xTests/Interfaces/basicTests/0.crow6
-rwxr-xr-xTests/Interfaces/basicTests/1.crow4
-rwxr-xr-xTests/Interfaces/basicTests/2.crow4
-rwxr-xr-xTests/Interfaces/basicTests/4.crow377
-rwxr-xr-xTests/Interfaces/basicTests/5.crow6
-rwxr-xr-xTests/Interfaces/basicTests/6.crow6
-rwxr-xr-xTests/Interfaces/basicTests/7.crow46
-rwxr-xr-xTests/Interfaces/colorItem.crow4
-rwxr-xr-xTests/Interfaces/test1.goml2
-rwxr-xr-xTests/Interfaces/testColorList.crow2
-rwxr-xr-xTests/Interfaces/testImage.crow26
-rwxr-xr-xTests/Interfaces/testStacks.crow16
-rw-r--r--Tests/Interfaces/testTabView.crow2
-rw-r--r--Tests/Tests.csproj31
-rw-r--r--src/CompilerServices/CompilerServices.cs20
-rw-r--r--src/GraphicObjects/GenericStack.cs20
-rw-r--r--src/GraphicObjects/GraphicObject.cs47
-rw-r--r--src/GraphicObjects/Group.cs12
-rw-r--r--src/GraphicObjects/Label.cs7
-rw-r--r--src/GraphicObjects/PrivateContainer.cs8
-rw-r--r--src/GraphicObjects/TextRun.cs17
-rw-r--r--src/Measure.cs101
37 files changed, 748 insertions, 154 deletions
diff --git a/Crow.csproj b/Crow.csproj
index 1eac1766..a9a61f18 100644
--- a/Crow.csproj
+++ b/Crow.csproj
@@ -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>
@@ -127,6 +128,7 @@
<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" />
@@ -136,15 +138,19 @@
<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" />
@@ -240,6 +246,7 @@
<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" />
diff --git a/Styles/CheckBox.style b/Styles/CheckBox.style
index 06b099d9..13d2224a 100644
--- a/Styles/CheckBox.style
+++ b/Styles/CheckBox.style
@@ -1,2 +1,2 @@
Focusable = true
-Height=-1
+Height=Fit
diff --git a/Styles/ComboBox.style b/Styles/ComboBox.style
index a5be8e2a..9fa3b267 100644
--- a/Styles/ComboBox.style
+++ b/Styles/ComboBox.style
@@ -1,2 +1,2 @@
Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/Expandable.style b/Styles/Expandable.style
index a5be8e2a..9fa3b267 100644
--- a/Styles/Expandable.style
+++ b/Styles/Expandable.style
@@ -1,2 +1,2 @@
Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/MessageBox.style b/Styles/MessageBox.style
index 294a996b..ed5cb20f 100644
--- a/Styles/MessageBox.style
+++ b/Styles/MessageBox.style
@@ -1,5 +1,5 @@
Width=200
-Height=-1
+Height=Fit
Title=MessageBox
Focusable=true
MinimumSize=150;80
diff --git a/Styles/Popper.style b/Styles/Popper.style
index a5be8e2a..9fa3b267 100644
--- a/Styles/Popper.style
+++ b/Styles/Popper.style
@@ -1,2 +1,2 @@
Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/RadioButton.style b/Styles/RadioButton.style
index a5be8e2a..9fa3b267 100644
--- a/Styles/RadioButton.style
+++ b/Styles/RadioButton.style
@@ -1,2 +1,2 @@
Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/Spinner.style b/Styles/Spinner.style
index a5be8e2a..9fa3b267 100644
--- a/Styles/Spinner.style
+++ b/Styles/Spinner.style
@@ -1,2 +1,2 @@
Focusable = true
-Height = -1
+Height = Fit
diff --git a/Styles/TextRun.style b/Styles/TextRun.style
new file mode 100644
index 00000000..c2eb97fe
--- /dev/null
+++ b/Styles/TextRun.style
@@ -0,0 +1,2 @@
+Fit = true
+Margin = 2
diff --git a/Templates/TabItem.crow b/Templates/TabItem.crow
index a889f4ee..c269bbe0 100644
--- a/Templates/TabItem.crow
+++ b/Templates/TabItem.crow
@@ -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}">
diff --git a/Templates/TreeItem.crow b/Templates/TreeItem.crow
index b3458ec1..97620096 100644
--- a/Templates/TreeItem.crow
+++ b/Templates/TreeItem.crow
@@ -9,7 +9,7 @@
<Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseClick="../onMouseClick">
<VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
<Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
<Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
</HorizontalStack>
@@ -21,11 +21,11 @@
<!-- <VerticalStack
Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseClick="../onMouseClick">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="Fit" Width="{../../WidthPolicy}">
<Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
<Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
</HorizontalStack>
<ListBox Name="Content" Visible="false"
- Height="-1" Width="{../../WidthPolicy}"/>
+ Height="Fit" Width="{../../WidthPolicy}"/>
</VerticalStack>-->
diff --git a/Tests/GOLIBTestsOTK.cs b/Tests/GOLIBTestsOTK.cs
index 9c522b32..9d3aa6f9 100644
--- a/Tests/GOLIBTestsOTK.cs
+++ b/Tests/GOLIBTestsOTK.cs
@@ -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",
diff --git a/Tests/Interfaces/0.crow b/Tests/Interfaces/0.crow
index 7ed4da83..1f8f4c7f 100755
--- a/Tests/Interfaces/0.crow
+++ b/Tests/Interfaces/0.crow
@@ -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
diff --git a/Tests/Interfaces/5.crow b/Tests/Interfaces/5.crow
index c559544d..4d263508 100755
--- a/Tests/Interfaces/5.crow
+++ b/Tests/Interfaces/5.crow
@@ -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
index 00000000..d8e9cd38
--- /dev/null
+++ b/Tests/Interfaces/7.crow
@@ -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
index 00000000..486399b8
--- /dev/null
+++ b/Tests/Interfaces/basicTests/0.crow
@@ -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
index 00000000..7d370189
--- /dev/null
+++ b/Tests/Interfaces/basicTests/1.crow
@@ -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
index 00000000..ce9448c7
--- /dev/null
+++ b/Tests/Interfaces/basicTests/2.crow
@@ -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
index 00000000..f696a9ec
--- /dev/null
+++ b/Tests/Interfaces/basicTests/4.crow
@@ -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
index 00000000..40abe0f0
--- /dev/null
+++ b/Tests/Interfaces/basicTests/5.crow
@@ -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
index 00000000..829c39f4
--- /dev/null
+++ b/Tests/Interfaces/basicTests/6.crow
@@ -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
index 00000000..d8e9cd38
--- /dev/null
+++ b/Tests/Interfaces/basicTests/7.crow
@@ -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/colorItem.crow b/Tests/Interfaces/colorItem.crow
index da893c82..c096e77a 100755
--- a/Tests/Interfaces/colorItem.crow
+++ b/Tests/Interfaces/colorItem.crow
@@ -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>
diff --git a/Tests/Interfaces/test1.goml b/Tests/Interfaces/test1.goml
index fbf788cf..74da4726 100755
--- a/Tests/Interfaces/test1.goml
+++ b/Tests/Interfaces/test1.goml
@@ -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"/>
diff --git a/Tests/Interfaces/testColorList.crow b/Tests/Interfaces/testColorList.crow
index f98ef134..ccbbb094 100755
--- a/Tests/Interfaces/testColorList.crow
+++ b/Tests/Interfaces/testColorList.crow
@@ -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"
diff --git a/Tests/Interfaces/testImage.crow b/Tests/Interfaces/testImage.crow
index d55db72d..83d9de6a 100755
--- a/Tests/Interfaces/testImage.crow
+++ b/Tests/Interfaces/testImage.crow
@@ -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"/>
@@ -75,10 +75,10 @@
<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" />
diff --git a/Tests/Interfaces/testStacks.crow b/Tests/Interfaces/testStacks.crow
index 5283b00a..5c1be265 100755
--- a/Tests/Interfaces/testStacks.crow
+++ b/Tests/Interfaces/testStacks.crow
@@ -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"/>
@@ -44,24 +44,24 @@
<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"/>
diff --git a/Tests/Interfaces/testTabView.crow b/Tests/Interfaces/testTabView.crow
index 3a081597..14c407ce 100644
--- a/Tests/Interfaces/testTabView.crow
+++ b/Tests/Interfaces/testTabView.crow
@@ -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
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 1c1bf659..3f808727 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -213,9 +213,6 @@
<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>
@@ -259,10 +256,38 @@
<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" />
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs
index c1d3db6d..ea46d439 100644
--- a/src/CompilerServices/CompilerServices.cs
+++ b/src/CompilerServices/CompilerServices.cs
@@ -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 );
diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs
index 925f908a..455ed928 100644
--- a/src/GraphicObjects/GenericStack.cs
+++ b/src/GraphicObjects/GenericStack.cs
@@ -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);
}
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 7b58f652..8877c6b2 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -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)
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 47795b06..78c5bca3 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -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;
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs
index c28f090c..0a909b73 100644
--- a/src/GraphicObjects/Label.cs
+++ b/src/GraphicObjects/Label.cs
@@ -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;
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index f3385a88..98e8d4b1 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -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;
}
}
diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs
index 021d5654..7f50a34e 100644
--- a/src/GraphicObjects/TextRun.cs
+++ b/src/GraphicObjects/TextRun.cs
@@ -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
index 00000000..4fbac421
--- /dev/null
+++ b/src/Measure.cs
@@ -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.");
+ }
+
+ }
+}