]> O.S.I.I.S - jp/crow.git/commitdiff
splitted measure with fault checking, changing default template sizing to 0, lots...
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 16 Feb 2016 23:53:59 +0000 (00:53 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 16 Feb 2016 23:53:59 +0000 (00:53 +0100)
40 files changed:
Crow.csproj
Templates/ArrowButTemplate.crow
Templates/Button.crow
Templates/CheckBox.goml
Templates/ComboBox.goml
Templates/Dummy.goml [new file with mode: 0755]
Templates/Expandable.goml
Templates/GroupBox.goml
Templates/ListBox.goml
Templates/MessageBox.goml
Templates/Popper.goml
Templates/RadioButton.goml
Templates/ScrollBar.goml
Templates/ScrollingListBox.goml
Templates/Spinner.goml
Templates/TreeItem.crow
Templates/TreeView.crow
Templates/Window.goml
Tests/GOLIBTests.cs
Tests/Interfaces/TmpExpandable.goml
Tests/Interfaces/testAll.goml
Tests/Interfaces/testCheckbox.goml
Tests/Interfaces/testColorList.crow
Tests/Interfaces/testDirViewer.goml
Tests/Interfaces/testExpandable.goml
Tests/Interfaces/testRadioButton2.goml
Tests/Interfaces/testTabView.crow
Tests/Interfaces/testWindow2.goml
Tests/Interfaces/testWindow3.goml
Tests/Interfaces/test_Listbox.goml
src/GraphicObjects/Border.cs
src/GraphicObjects/DummyTemplate.cs [new file with mode: 0644]
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/Image.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/TemplatedControl.cs
src/GraphicObjects/TextRun.cs

index 6d0c6d3a4a9d7a74aa2ad8b6aa24793d424d160a..05f0841d91b0e41e8a3dfba14bf184b9f5b83f92 100644 (file)
     <Compile Include="src\GraphicObjects\TreeView.cs" />
     <Compile Include="src\GraphicObjects\TabView.cs" />
     <Compile Include="src\GraphicObjects\TabItem.cs" />
+    <Compile Include="src\GraphicObjects\DummyTemplate.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <EmbeddedResource Include="Templates\TreeView.crow" />
     <EmbeddedResource Include="Templates\TabItem.crow" />
     <EmbeddedResource Include="Templates\TreeItem.crow" />
+    <EmbeddedResource Include="Templates\Dummy.goml" />
   </ItemGroup>
   <ItemGroup>
     <None Include="README.md" />
index c90f1b60ddd91a249497e1dac9246f76b17b2cbe..942c9f7541c49d253fa9e39b3028752c27c94ac3 100755 (executable)
@@ -5,7 +5,7 @@
 </HorizontalStack>-->
 <Border Name="Content"
        Background="vgradient|0:White|0,1:LightGray|0,9:LightGray|1:Black" Foreground="DarkGray" 
-       Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+       Height="{../HeightPolicy}" Width="{../WidthPolicy}"
        MouseEnter="{Foreground=White}"
        MouseLeave="{Foreground=DarkGray}"
        MouseDown="{Background=vgradient|0:Black|0,1:LightGray|0,9:LightGray|1:White}"
index 75decb217c5584df42cb3cefd09abefb4017ce62..76d5dd8e7946450129e65eac142f4fe8e488d7c8 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Border Background="{../Background}" MinimumSize="50;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Border Background="{../Background}" MinimumSize="50;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
                Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1" 
        MouseEnter="{Foreground=vgradient|0:White|0,2:Gray|0,9:Gray|1:Black;caption.Foreground=White}"
        MouseLeave="{Foreground=Transparent;caption.Foreground=DimGray}"
index 5f5807aa2c1154cdc698d46000c48eec8b86306b..ffdb2202c62703222609d98badc6dc2f254f8938 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-       <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
-       <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+<HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+       <Image Background="Red" Margin="2" Width="14"  Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+       <Label Background="Blue" Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </HorizontalStack>
\ No newline at end of file
index 7af1e2d3c2a1151fc81d0474848c67fe627768d5..7a735307b16f371a47172804f801eafef9530420 100755 (executable)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<Popper Name="popper" PopDirection="Bottom" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<Popper Name="popper" PopDirection="Bottom" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
        <Template>
-               <Border CornerRadius="0" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-                       <HorizontalStack Margin="1" Spacing="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+               <Border CornerRadius="0" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                       <HorizontalStack Margin="1" Spacing="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                                <TextBox MinimumSize="80;10" Margin="1" Foreground="Black" Background="White"
                                        Text="{../../../../SelectedItem}" Focusable="true"
-                                       Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}"/>
+                                       Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}"/>
                                <Button Width="14" Height="14" MouseClick="../../../onMouseClick"
                                        Template="#Crow.Templates.ArrowButTemplate.crow">
                                        <Image Margin="0"  Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
diff --git a/Templates/Dummy.goml b/Templates/Dummy.goml
new file mode 100755 (executable)
index 0000000..cfd8286
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!--<Group Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+<Label Margin="0" Text="DUMMY2" Background="Green" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+</Group>-->
+<HorizontalStack Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+       <Label Margin="0" Text="DUMMY" Background="Blue" Height="{../../HeightPolicy}" Width="20"/>
+       <Label Margin="0" Text="DUMMY2" Background="Green" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+</HorizontalStack>
index 427c188079f5aee38324b30dc773d978ce633ec9..b2465abb3f56dfeb6c187e3a94bbc84a8ee23f2c 100755 (executable)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" 
+<Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" 
                MouseClick="../onMouseClick">
-       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-               <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">
+       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+               <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">
                        <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
-                       <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>
+                       <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
                </HorizontalStack>
-               <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+               <Container Background="Red" Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
index b92ee8b260ab65d60f23cd17988200a979bef842..5b0424297c30acb8d52fe447f02a04974697c416 100755 (executable)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
-<Group Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<Group Height="{../HeightPolicy}" Width="{../WidthPolicy}">
        <Border CornerRadius="5" BorderWidth="1" Margin="6" Foreground="{../../Foreground}"
-               Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+               Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                <Container Name="Content" Margin="10"
-                               Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+                               Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
        </Border>
        <Label Text="{../../Caption}" VerticalAlignment="Top" Left="15"
                Background="Clear" Margin="1"/>
index 5d8122e06eefab9460cb859d94eb6bf33b07a16d..fa8d514e6d255e76b0d943676e49acbe91ae9079 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >
+<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}" >
        <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"
-               Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+               Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                <VerticalStack LayoutChanged="../../../_list_LayoutChanged"
-                       Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
+                       Height="-1" Width="{../../../WidthPolicy}" Name="List" Margin="0" VerticalAlignment="Top"/>
        </Scroller>
 </Border>
\ No newline at end of file
index 7620645ae4bdf0f8c4d491bddd04b06c78526507..fe6ce620e403f4b8d68b673a0f3f6cdc87fa4121 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
-<Border Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" BorderWidth="1" Foreground="White" CornerRadius="10" >
-       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" Background="0,4;0,4;0,4;0,4">
-               <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" 
+<Border Height="{../HeightPolicy}" Width="{../WidthPolicy}" BorderWidth="1" Foreground="White" CornerRadius="10" >
+       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" Background="0,4;0,4;0,4;0,4">
+               <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1" 
                                Background="0,1;0,5;1,0;0,5">
-                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
                                <GraphicObject Width="5" Height="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
-                               <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+                               <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
                                <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
                                <GraphicObject Width="5" Height="5"/>
                        </HorizontalStack>
                </Border>
-               <HorizontalStack Spacing="3" Margin="3" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}">
+               <HorizontalStack Spacing="3" Margin="3" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}">
                        <Image Name="Image" Width="24" Height="24"
                                Path="#Crow.Images.Icons.iconInfo.svg" />
-                       <TextRun Font="serif, 12" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Text="{../../../../Message}"
+                       <TextRun Font="serif, 12" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Text="{../../../../Message}"
                                Multiline="true" WordWrap="true"/>              
                </HorizontalStack>
-               <HorizontalStack Height="-1" Width="{../../../TemplatedWidth}" Margin="3">
+               <HorizontalStack Height="-1" Width="{../../../WidthPolicy}" Margin="3">
                        <GraphicObject Height="5"/>
                        <Button Caption="Ok"/>
                        <Button Caption="Cancel"/>
index 42a81d1d371d23258dd657ae6e6508232a25abd8..9fd80681d9dbb6cc956cf9f0367ee2978282b00b 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../TemplatedWidth}">
-       <HorizontalStack Spacing="1" Height="-1"  Width="{../../TemplatedWidth}">
+<Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../WidthPolicy}">
+       <HorizontalStack Spacing="1" Height="-1"  Width="{../../WidthPolicy}">
                <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
-               <Label Text="{../../../Caption}"  Width="{../../../TemplatedWidth}"/>
+               <Label Text="{../../../Caption}"  Width="{../../../WidthPolicy}"/>
        </HorizontalStack>
 </Border>
\ No newline at end of file
index 5f5807aa2c1154cdc698d46000c48eec8b86306b..b69331bec592fb7a32aa95d062d7ac1bcb058aa2 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
        <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
-       <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+       <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </HorizontalStack>
\ No newline at end of file
index b643c36bd939de68b5e6c7a5265e92ef2038acfc..ffcc121e0db3f50fc4a46ef0a7b787fa609d19b4 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">
+<Border BorderWidth="1" Foreground="LightGray" Width="{../WidthPolicy}" Height="{../HeightPolicy}">
        <GenericStack Orientation="{../../Orientation}" Spacing="0"
-               Width="{../../TemplatedWidth}" Height="{../../TemplatedHeight}">
+               Width="{../../WidthPolicy}" Height="{../../HeightPolicy}">
                <Button MouseRepeat="true" Width="12" Height="12" MouseClick="../../../onScrollBack"
                        Template="#Crow.Templates.ArrowButTemplate.crow">
                        <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
@@ -13,7 +13,7 @@
                        LargeIncrement="{../../../LargeIncrement}"
                        SmallIncrement="{../../../SmallIncrement}"
                        Background="hgradient|0:DimGray|0,1:Gray|0,95:Gray|1:White"
-                       Width="{../../../TemplatedWidth}" Height="{../../../TemplatedHeight}"
+                       Width="{../../../WidthPolicy}" Height="{../../../HeightPolicy}"
                        ValueChanged="../../../onSliderValueChange"/>
                <Button MouseRepeat="true" Width="12" Height="12" MouseClick="../../../onScrollForth"
                        Template="#Crow.Templates.ArrowButTemplate.crow">
index 0de4bf26e47857ebba241ca8d76e75ba7629fe7b..5f50929f88b4ad21be6fa2d246d83d9a86453c35 100644 (file)
@@ -1,15 +1,15 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-       <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
-               <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
+<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+               <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                                Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
                                ValueChanged="../../../_scroller_ValueChanged">
-                       <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+                       <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
                                Name="List" Margin="0" VerticalAlignment="Top"
                                LayoutChanged="../../../../_list_LayoutChanged"/>
                </Scroller>
                <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" 
                        Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" 
-                       Width="14" Height="{../../../TemplatedHeight}" />
+                       Width="14" Height="{../../../HeightPolicy}" />
        </HorizontalStack>
 </Border>
\ No newline at end of file
index bd202c1aceae2cbb5ae1e13c6a5f8276ca350cdc..b8fbf8321f222307f4196c3dd3c2c0e99c3d7320 100755 (executable)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
        Foreground="Gray"
        Background="White">
-       <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-               <Label Foreground="DimGray" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
+       <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+               <Label Foreground="DimGray" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                        Text="{../../../Value}" Margin="1" TextAlignment="Right"/>
-               <VerticalStack Width="-1" Height="{../../../TemplatedHeight}" Spacing="0" >
+               <VerticalStack Width="-1" Height="{../../../HeightPolicy}" Spacing="0" >
                        <Button MouseRepeat="true" Width="12" Height="8" MouseClick="../../../../onUp"
                                Template="#Crow.Templates.ArrowButTemplate.crow">
                                <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
index 037736a963e304c6a2a9481cfb09d7d7744bf277..b3458ec1ed5c6504a629d982cc499a90e20e407c 100644 (file)
@@ -6,26 +6,26 @@
 </Container>-->\r
 <Expandable Caption="{}">\r
        <Template>\r
-               <Border BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" \r
+               <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" \r
                        MouseClick="../onMouseClick">\r
-                       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">\r
-                               <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">\r
+                       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">\r
+                               <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">\r
                                        <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>\r
-                                       <Label Text="{../../../../Caption}" Width="{../../../../TemplatedWidth}"/>\r
+                                       <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>\r
                                </HorizontalStack>\r
-                               <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>\r
+                               <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>\r
                        </VerticalStack>\r
                </Border>\r
        </Template>\r
 </Expandable>\r
 <!--           <VerticalStack\r
-                       Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"\r
+                       Height="{../HeightPolicy}" Width="{../WidthPolicy}"\r
                        MouseClick="../onMouseClick">\r
-                       <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">\r
+                       <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">\r
                                <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>\r
-                               <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>\r
+                               <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>\r
                        </HorizontalStack>\r
                        <ListBox Name="Content" Visible="false"\r
-                               Height="-1" Width="{../../TemplatedWidth}"/>\r
+                               Height="-1" Width="{../../WidthPolicy}"/>\r
                </VerticalStack>-->\r
 \r
index 132c7eb63f767b0ae77fce41d134529e507232a7..165cea1c91f20ae33b2811b65c5fff329d7e122e 100644 (file)
@@ -1,5 +1,5 @@
 <Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100;100"
-               Width="{../TemplatedWidth}" Height="{../TemplatedHeight}">
+               Width="{../WidthPolicy}" Height="{../HeightPolicy}">
        <VerticalStack
                        Height="0" Width="0" Name="List" Margin="0" VerticalAlignment="Top"/>
 
index dd3fec7dc3d15736211bd5f9ae9b4b3074be1b27..1aa20a844d9a85c483acc1d2ea3fb8fa1dc89c7e 100755 (executable)
@@ -1,13 +1,13 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-               <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" 
+<Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+               <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1" 
                                Background="vgradient|0:0,1;0,5;1,0;0,5|1:0,0;0,1;0,3;0,9">
 <!--                           Background="0,1;0,5;1,0;0,5"-->
-                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
                                <GraphicObject Width="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
-                               <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+                               <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
                                <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
@@ -16,6 +16,6 @@
                                <GraphicObject Width="5"/>
                        </HorizontalStack>
                </Border>
-               <Container Name="Content" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+               <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
index c508c0e189b15d058a71055ab570265ed0201494..3d6e619ffab722fdf78ba7a63cfee35af62d6c31 100644 (file)
@@ -37,6 +37,7 @@ namespace test
                int frameCpt = 0;
                int idx = 0;
                string[] testFiles = {
+                       "testCheckbox.goml",
                        "testTabView.crow",
                        "testExpandable.goml",
                        "0.crow",
@@ -73,7 +74,6 @@ namespace test
                        "testWindow2.goml",
 
                        "testWindow3.goml",
-                       "testCheckbox.goml",
                        "testLabel.goml",
                        "testAll.goml",
 //                     "testSpinner.goml",
@@ -239,7 +239,13 @@ namespace test
                {
                        Console.WriteLine ("button clicked:" + send.ToString());
                }
-
+               void onAddTabButClick(object sender, MouseButtonEventArgs e){
+                       
+                       TabView tv = this.FindByName("tabview1") as TabView;
+                       if (tv == null)
+                               return;
+                       tv.AddChild (new TabItem () { Caption = "NewTab" });
+               }
                [STAThread]
                static void Main ()
                {
index ee0884ff2a9b3b167d04c42c0f2da79c3c3be9ce..1cd05fd74790842f108d1a352476fc0acbc9daf6 100755 (executable)
@@ -1,12 +1,12 @@
 <?xml version="1.0"?>
-<!--<VerticalStack Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" MouseClick="../onMouseClick">
-       <Label Text="{../../Caption}" Width="{../../TemplatedWidth}"/>
-       <Container Name="Content" Visible="false" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+<!--<VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}" MouseClick="../onMouseClick">
+       <Label Text="{../../Caption}" Width="{../../WidthPolicy}"/>
+       <Container Name="Content" Visible="false" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </VerticalStack>-->
-<Group BorderWidth="1" Foreground="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" 
+<Group BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" 
                MouseClick="../onMouseClick">
-       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-               <Label Text="{../../../Caption}" Width="{../../../TemplatedWidth}"/>
-               <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+               <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
+               <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
        </VerticalStack>
 </Group>
\ No newline at end of file
index 1959bf4a59c3b2b939e0934ebbdbd106e540d413..6f5be081ce6d7ae1e1ba3ea60312b09ffdd0fe93 100755 (executable)
        </Groupbox>-->
        <GroupBox  Background="DarkGreen">              
 <!--           <Template>
-                       <Group Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+                       <Group Height="{../HeightPolicy}" Width="{../WidthPolicy}">
                                <Border CornerRadius="5" BorderWidth="1" Margin="0"
-                                       Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+                                       Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                                        <Container Name="Content" Margin="0"
-                                                       Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
+                                                       Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
                                </Border>
                                <Label Text="{../../Title}" VerticalAlignment="Top" Left="15"
                                        Background="Clear" Margin="1"/>
index a8cc4eeab941f62a1323e80a8712874d42c52305..4db4393b2ea721dd8bf3f6fc54364ad13b6c76ae 100755 (executable)
@@ -1,3 +1,36 @@
 <?xml version="1.0"?>
-<CheckBox Width="-1" Height="-1" Caption="Checkbox" Background="DimGray" IsChecked="true"/>
+<VerticalStack Fit="true" Margin="10" Background="DimGray" >
+<!--   <Label Text="label1" Width="0" Height="0"/>
+       <Label Text="label2" Width="0" Height="0"/>-->
+       <CheckBox Background="Gray"/>
+       <CheckBox Background="Gray"/>
+       <CheckBox Background="Gray"/>
+       <CheckBox Background="Gray"/>
+       <CheckBox Background="Gray"/>
+<!--   <CheckBox Background="Gray"/>-->
+<!--   <HorizontalStack Fit="true" Margin="5" Background="Green">
+               <Label Background="Red"/>
+               <Label Background="Red"/>
+       </HorizontalStack>-->
+       <DummyTemplate Fit="true"/>
+       <DummyTemplate/>
+       <DummyTemplate/>
+       <DummyTemplate/>
+       <DummyTemplate/>
+       <DummyTemplate/>
+       <DummyTemplate Height="-1"/>
+<!--   <Label Margin="5" Background="Red"/>
+       <Label Background="Red"/>
+       <Container Width="100" Height="50" Margin="5" Background="Green">
+               <Label Width="0" Height="0" Background="Red"/>
+       </Container>
+
+       <Container Fit="true" Margin="5" Background="Green">
+               <Label Background="Red" Height="5"/>
+       </Container>
+       <HorizontalStack Margin="5" Background="Red" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+               <Label Background="Green"/>
+               <Label Background="Green"/>
+       </HorizontalStack>-->
+</VerticalStack>
 
index fc5e023d8b1486e59fcc57d79cab60a695109178..76bf8d6e593541524f1b3e1814afb3f6da062766 100755 (executable)
@@ -5,18 +5,18 @@
                                         HorizontalAlignment="Center" Width="-1" Height="350" Margin="5"
                                         ItemTemplate="#Tests.Interfaces.colorItem.crow">
                        <Template>
-                               <Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-                                       <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
-                                               <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
+                               <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                                       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+                                               <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                                                                Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
                                                                ValueChanged="../../../_scroller_ValueChanged">
-                                                       <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
                                                                Name="List" Margin="0" VerticalAlignment="Top"
                                                                LayoutChanged="../../../../_list_LayoutChanged"/>
                                                </Scroller>
                                                <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" 
                                                        Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" 
-                                                       Width="14" Height="{../../../TemplatedHeight}" />
+                                                       Width="14" Height="{../../../HeightPolicy}" />
                                        </HorizontalStack>
                                </Border>
                        </Template>
index 1e3ebd31a88e9f5f420dc9df628f5431fdbef92e..22787c3e47eddf345a74cd1934bb4e9a57c50691 100755 (executable)
@@ -9,14 +9,14 @@
                        SelectedItemChanged="OnSelectedItemChanged" 
                        ItemTemplate="Interfaces/tmpDirItem.goml" >
                        <Template>
-                               <Border BorderWidth="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-                                       <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-                                               <Scroller  Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
+                               <Border BorderWidth="1" MinimumSize="20;20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                                       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+                                               <Scroller  Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                                                 Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
-                                                       <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" Name="List" Margin="0" VerticalAlignment="Top"/>
+                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" Name="List" Margin="0" VerticalAlignment="Top"/>
                                                </Scroller>
                                                <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
-                                                       Orientation="Vertical" Width="10" Height="{../../../TemplatedHeight}" />
+                                                       Orientation="Vertical" Width="10" Height="{../../../HeightPolicy}" />
                                        </HorizontalStack>
                                </Border>
                        </Template>
index d46f4831f0c30f1041acb5a0b355bb47e652c0ec..8c2787fb3d0b3fedb2b52c34b339673e79e11c90 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <Expandable Caption="Test expandable" Background="DimGray">
-               <VerticalStack Width="-1" Height="-1">
+               <VerticalStack Margin="5" Background="Green">
                        <CheckBox Name="chk1" Background="Red"/>
                        <CheckBox Name="chk2" IsChecked="true"/>
                        <CheckBox Name="chk3"/>
index 1c97f16ffe2bb0584c73adfa3012449ca3385db6..d32c46d02317b7a9818e67c5573f6286e6fa21bb 100755 (executable)
@@ -5,9 +5,9 @@
        <RadioButton Caption="Radio3"/>
        <RadioButton Caption="Radio4">
                <Template>
-                       <HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+                       <HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
                                <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
-                               <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
+                               <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
                        </HorizontalStack>
                </Template>
        </RadioButton>
index 953dd8c111eaf10128ec5ae6072c45c08de87c77..3a081597c918b9cf31d650fbb3c23d019464c9a5 100644 (file)
@@ -1,34 +1,38 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <HorizontalStack Fit="true">
-       <TabView Margin="20"
-               Width="400" Height="200" Orientation="Horizontal" Spacing="20">
-               <TabItem Name="TabItem1" Caption="tab item 1" Width="0" Height="0" Margin="0">
-                       <VerticalStack Fit="true">
-                               <CheckBox/>
-                               <CheckBox/>
-                               <CheckBox/>
-                               <CheckBox/>
-                               <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>
-                       </VerticalStack>
-               </TabItem>
-               <TabItem Name="TabItem2" Caption="tab item 2" Width="0" Height="0" Margin="0" Background="Gray">
-                       <VerticalStack Fit="true">
-                               <RadioButton/>
-                               <RadioButton/>
-                               <RadioButton/>
-                               <RadioButton/>
-                               <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>
-                       </VerticalStack>
-               </TabItem>
-               <TabItem Name="TabItem2" Caption="tab item 3" Width="0" Height="0" Margin="0" Background="Gray">
-                       <Container Margin="5" CornerRadius="2" Width="0" Height="0">
-                               <TextBox Margin="5" Width="0" Height="0" Multiline="true" TextAlignment="TopLeft"/>
-                       </Container>
-               </TabItem>
-               <TabItem Name="TabItem2" Caption="tab item 4" Width="0" Height="0" Margin="0" Background="Gray">
-                       <TextBox/>
-               </TabItem>
-       </TabView>
+       <VerticalStack Fit="true">
+               <TabView Name="tabview1"
+                       Width="400" Height="200" Orientation="Horizontal" Spacing="20">
+                       <TabItem Name="TabItem1" Caption="tab item 1" Margin="0">
+                               <VerticalStack Fit="true">
+                                       <CheckBox/>
+                                       <CheckBox/>
+                                       <CheckBox/>
+                                       <CheckBox/>
+<!--                                   <Label Text="{fps}" HorizontalAlignment="Right" Foreground="Black" Background="Yellow"/>-->
+                               </VerticalStack>
+                       </TabItem>
+                       <TabItem Name="TabItem2" Caption="tab item 2" Width="0" Height="0" Margin="0" Background="Gray">
+                               <VerticalStack Fit="true">
+                                       <RadioButton/>
+                                       <RadioButton/>
+                                       <RadioButton/>
+                                       <RadioButton/>
+<!--                                   <Label Text="{fps}" HorizontalAlignment="Left" Background="LimeGreen"/>-->
+                               </VerticalStack>
+                       </TabItem>
+                       <TabItem Name="TabItem2" Caption="tab item 3" Width="0" Height="0" Margin="0" Background="Gray">
+                               <Container Margin="5" CornerRadius="2" Width="0" Height="0">
+                                       <TextBox Margin="5" Width="0" Height="0" Multiline="true" TextAlignment="TopLeft"/>
+                               </Container>
+                       </TabItem>
+                       <TabItem Name="TabItem2" Caption="tab item 4" Width="0" Height="0" Margin="0" Background="Gray">
+                               <TextBox/>
+                       </TabItem>
+               </TabView>
+               <Button Background="vgradient|0:DimGray|1:Black" HorizontalAlignment="Right"
+                       Caption="Add new tab" Width="-1" Height="30" MouseClick="onAddTabButClick"/>
+       </VerticalStack>
        <TabView CacheEnabled="false" Width="200" Height="200" Orientation="Horizontal" Spacing="20" Margin="0">
                <TabItem
                        Name="TabItem1" Caption="tab 1" Width="0" Height="0" Margin="0" Background="Gray">
index 25ea8f30b53f70982d3f85e51f2ec91b841411a1..20d5ba629637aafac70d50062afc0fb09f05a569 100755 (executable)
@@ -2,14 +2,14 @@
 <Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8" 
        Focusable="True"  CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
        <Template>
-               <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-                       <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
-                               <Border BorderWidth="1" Foreground="White" Width="{../../../TemplatedWidth}" Height="-1" 
+               <Border BorderWidth="1" Foreground="White" CornerRadius="20" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+                               <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="-1" 
                                                Background="0,1;0,5;1,0;0,5">
-                                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
+                                       <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" Height="-1" >
                                                <GraphicObject Width="5"/>
                                                <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
-                                               <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
+                                               <Label Foreground="White" Width="{../../../../../WidthPolicy}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
                                                <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                                        <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#Crow.Images.Icons.exit2.svg"
@@ -18,7 +18,7 @@
                                                <GraphicObject Width="5"/>
                                        </HorizontalStack>
                                </Border>
-                               <Container Name="Content" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+                               <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
                        </VerticalStack>
                </Border>
        </Template>
index ffcf462565a3bc34e7b3a663d837d0fc7de79ba6..1c15047108128d91f68761b98db76111785b91cd 100755 (executable)
@@ -2,7 +2,7 @@
 <Window Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8" 
        Focusable="True"  CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">
        <Template>
-               <Container Margin="20" Name="Content" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+               <Container Margin="20" Name="Content" Height="{../HeightPolicy}" Width="{../WidthPolicy}" Background="0,5;0,5;0,5;0,5"/>
        </Template>
 <!--   <Group Background="Green">-->
                <GraphicObject Height="50" Width="50" Background="Red" Margin="5"/>
index 8c9eaa097fa289ad4b7a8f450b715956c9e11178..71afb828e65f7eb1cfaac78b48b2821950a5b7b2 100755 (executable)
@@ -8,16 +8,16 @@
                <ListBox Data="{TestList}" Background="0,5;0,5;0,5;0,5"
                                         HorizontalAlignment="Center" Width="-1" Height="150" Margin="5">
                        <Template>
-                               <Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
-                                       <HorizontalStack Margin="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" >
-                                               <Scroller Name="scroller1" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}" 
+                               <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+                                       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
+                                               <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}" 
                                                                Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
-                                                       <VerticalStack Width="{../../../../TemplatedWidth}" Height="-1" MinimumSize="100;100"
+                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="-1" MinimumSize="100;100"
                                                                Name="List" Margin="0" VerticalAlignment="Top" />
                                                </Scroller>
                                                <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" 
                                                        Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" 
-                                                       Width="10" Height="{../../../TemplatedHeight}" />
+                                                       Width="10" Height="{../../../HeightPolicy}" />
                                        </HorizontalStack>
                                </Border>
                        </Template>
index 7011690eb04baed3a0cb9dc3d7568b6982d24b7f..be08a7d81683473115050a7cd10267dea11a70ad 100644 (file)
@@ -40,9 +40,10 @@ namespace Crow
                        }
                }
 
-               protected override Size measureRawSize ()
+               protected override int measureRawSize (LayoutingType lt)
                {
-                       return child == null ? Bounds.Size : child.Slot.Size + 2 * (Margin + BorderWidth);
+                       int tmp = base.measureRawSize (lt);
+                       return tmp < 0 ? tmp : tmp + 2 * BorderWidth;
                }
                protected override void onDraw (Cairo.Context gr)
                {
diff --git a/src/GraphicObjects/DummyTemplate.cs b/src/GraphicObjects/DummyTemplate.cs
new file mode 100644 (file)
index 0000000..68597d1
--- /dev/null
@@ -0,0 +1,33 @@
+//
+//  DummyTemplate.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
+{
+       [DefaultTemplate("#Crow.Templates.Dummy.goml")]
+       public class DummyTemplate : TemplatedControl
+       {
+               public DummyTemplate () : base()
+               {
+               }
+       }
+}
+
index bbbc52ecc195596913bfac745456f451b04f073f..2a1da6c311615a79346332a83a9d36e5174db6b0 100644 (file)
@@ -52,34 +52,43 @@ namespace Crow
                        else
                                layoutType &= (~LayoutingType.Y);                       
                }
-               protected override Size measureRawSize ()
+               protected override int measureRawSize (LayoutingType lt)
                {
-                       Size tmp = new Size ();
-
-                       if (Orientation == Orientation.Horizontal) {
-                               foreach (GraphicObject c in Children) {
-                                       if (!c.Visible)
-                                               continue;                                       
-                                       tmp.Width += c.Slot.Width + Spacing;
-                                       tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
-                               }
-                               if (tmp.Width > 0)
-                                       tmp.Width -= Spacing;
-                       } else {
-                               foreach (GraphicObject c in Children) {
-                                       if (!c.Visible)
-                                               continue;                                       
-                                       tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
-                                       tmp.Height += c.Slot.Height + Spacing;
+                       int tmp = 0;
+                       switch (lt) {
+                       case LayoutingType.Width:
+                               if (Orientation == Orientation.Horizontal) {
+                                       if (Children.Count > 0) {
+                                               foreach (GraphicObject c in Children) {
+                                                       if (!c.Visible)
+                                                               continue;
+                                                       if (c.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                                               return -1;
+                                                       tmp += c.Slot.Width + Spacing;
+                                               }
+                                               tmp -= Spacing;
+                                       }
+                                       break;
+                               } 
+                               return base.measureRawSize (lt);                                
+                       case LayoutingType.Height:
+                               if (Orientation == Orientation.Vertical) {
+                                       if (Children.Count > 0) {
+                                               foreach (GraphicObject c in Children) {
+                                                       if (!c.Visible)
+                                                               continue;
+                                                       if (c.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                                               return -1;
+                                                       tmp += c.Slot.Height + Spacing;
+                                               }
+                                               tmp -= Spacing;
+                                       }
+                                       break;
                                }
-                               if (tmp.Height > 0)
-                                       tmp.Height -= Spacing;
+                               return base.measureRawSize (lt);
                        }
 
-                       tmp.Width += 2 * Margin;
-                       tmp.Height += 2 * Margin;
-
-                       return tmp;
+                       return tmp + 2 * Margin;
                }
                public virtual void ComputeChildrenPositions()
                {
index f10f2244839dd6a71ebcc05d08ba96333190a9be..9f20fca95f996cc1d5c842b9443009d60d63a788 100644 (file)
@@ -262,12 +262,12 @@ namespace Crow
 
                [XmlAttributeAttribute()][DefaultValue(false)]
                public virtual bool Fit {
-                       get { return Bounds.Width < 0 && Bounds.Height < 0 ? true : false; }
+                       get { return Width < 0 && Height < 0 ? true : false; }
                        set {
                                if (value == Fit)
                                        return;
 
-                               Bounds.Width = Bounds.Height = -1;
+                               Width = Height = -1;
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(false)]
@@ -626,8 +626,8 @@ namespace Crow
                        set { layoutingTries = value; }
                }
                /// <summary> return size of content + margins </summary>
-               protected virtual Size measureRawSize () {
-                       return Bounds.Size;
+               protected virtual int measureRawSize (LayoutingType lt) {
+                       return lt == LayoutingType.Width ? Bounds.Size.Width : Bounds.Size.Height;
                }
                /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
                public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
@@ -704,7 +704,8 @@ namespace Crow
                        case LayoutingType.X:
                                if (Bounds.X == 0) {
 
-                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
+                                               RegisteredLayoutings.HasFlag (LayoutingType.Width))
                                                return false;
                                        
                                        switch (HorizontalAlignment) {
@@ -733,7 +734,8 @@ namespace Crow
                        case LayoutingType.Y:
                                if (Bounds.Y == 0) {
 
-                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                       if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) || 
+                                               RegisteredLayoutings.HasFlag (LayoutingType.Height))
                                                return false;
                                        
                                        switch (VerticalAlignment) {
@@ -762,9 +764,12 @@ namespace Crow
                        case LayoutingType.Width:
                                if (Width > 0)
                                        Slot.Width = Width;
-                               else if (Width < 0)
-                                       Slot.Width = measureRawSize ().Width;
-                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                               else if (Width < 0) {
+                                       int tmp = measureRawSize (LayoutingType.Width);
+                                       if (tmp < 0)
+                                               return false;
+                                       Slot.Width = tmp;
+                               }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width))
                                        return false;
                                else
                                        Slot.Width = Parent.ClientRectangle.Width;
@@ -787,9 +792,12 @@ namespace Crow
                        case LayoutingType.Height:
                                if (Height > 0)
                                        Slot.Height = Height;
-                               else if (Height < 0)
-                                       Slot.Height = measureRawSize ().Height;
-                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                               else if (Height < 0){
+                                       int tmp = measureRawSize (LayoutingType.Height);
+                                       if (tmp < 0)
+                                               return false;
+                                       Slot.Height = tmp;
+                               }else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height))
                                        return false;
                                else
                                        Slot.Height = Parent.ClientRectangle.Height;
index ba65ba0c05c7d14ec2fd0a622302b0f895d47f5e..2a960029ac7549d2762608aed5a1b434280b4ba4 100644 (file)
@@ -125,9 +125,21 @@ namespace Crow
                        }
                        return false;
                }
-               protected override Size measureRawSize ()
+               protected override int measureRawSize (LayoutingType lt)
                {
-                       return new Size(maxChildrenWidth + 2 * Margin, maxChildrenHeight + 2 * Margin);
+                       if (lt == LayoutingType.Width) {
+                               if (largestChild == null)
+                                       searchLargestChild ();
+                               if (largestChild == null)//if still null, not possible to determine a width
+                                       return -1;
+                               return maxChildrenWidth + 2 * Margin;
+                       }else{
+                               if (tallestChild == null)
+                                       searchTallestChild ();
+                               if (tallestChild == null)
+                                       return -1;
+                               return maxChildrenHeight + 2 * Margin;
+                       }
                }
                        
                public override void OnLayoutChanges (LayoutingType layoutType)
@@ -162,8 +174,9 @@ namespace Crow
                                        if (this.Bounds.Width < 0)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                } else if (g == largestChild) {
-                                       
-                                       searchLargestChild ();
+
+                                       largestChild = null;
+                                       maxChildrenWidth = 0;
 
                                        if (this.Bounds.Width < 0)
                                                this.RegisterForLayouting (LayoutingType.Width);
@@ -177,7 +190,8 @@ namespace Crow
                                                this.RegisterForLayouting (LayoutingType.Height);
                                } else if (g == tallestChild) {
 
-                                       searchTallestChild ();
+                                       tallestChild = null;
+                                       maxChildrenHeight = 0;
 
                                        if (this.Bounds.Height < 0)
                                                this.RegisterForLayouting (LayoutingType.Height);
@@ -186,6 +200,7 @@ namespace Crow
                        }
                }
 
+               //TODO: x,y position should be taken in account for computation of width and height
                void resetChildrenMaxSize(){
                        largestChild = null;
                        tallestChild = null;
@@ -198,6 +213,8 @@ namespace Crow
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
+                               if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                       continue;
                                if (Children [i].Slot.Width > maxChildrenWidth) {
                                        maxChildrenWidth = Children [i].Slot.Width;
                                        largestChild = Children [i];
@@ -210,6 +227,8 @@ namespace Crow
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
+                               if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                       continue;
                                if (Children [i].Slot.Height > maxChildrenHeight) {
                                        maxChildrenHeight = Children [i].Slot.Height;
                                        tallestChild = Children [i];
index bd6a57c983c7f584efb1609904f862552a54e5c8..6755653ebdd387b65c6d95606ec11256d1f81074 100644 (file)
@@ -94,12 +94,15 @@ namespace Crow
                #endregion
 
                #region GraphicObject overrides
-               protected override Size measureRawSize ()
+               protected override int measureRawSize (LayoutingType lt)
                {
                        if (_pic == null)
                                _pic = "#Crow.Images.Icons.IconAlerte.svg";
-
-                       return _pic.Dimensions + Margin * 2;
+                       //TODO:take scalling in account
+                       if (lt == LayoutingType.Width)
+                               return _pic.Dimensions.Width + 2 * Margin;
+                       else
+                               return _pic.Dimensions.Height + 2 * Margin;                     
                }
                protected override void onDraw (Context gr)
                {
index 4c7e700692ba7d1010c78b688de7046a81286765..dd5b89e28f8bb91fe347f472dbb4617682d52f86 100644 (file)
@@ -319,13 +319,11 @@ namespace Crow
                        set { base.Height = value; }
                }
 
-               protected override Size measureRawSize()
-        {
-                       Size size;
-
+               protected override int measureRawSize(LayoutingType lt)
+        {                      
                        if (lines == null)
                                lines = getLines;
-                               
+                                                               
                        using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
                                using (Context gr = new Context (img)) {
                                        //Cairo.FontFace cf = gr.GetContextFontFace ();
@@ -333,8 +331,19 @@ namespace Crow
                                        gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
                                        gr.SetFontSize (Font.Size);
 
+
+                                       fe = gr.FontExtents;
                                        te = new TextExtents();
 
+                                       if (lt == LayoutingType.Height){
+                                               int lc = lines.Count;
+                                               //ensure minimal height = text line height
+                                               if (lc == 0)
+                                                       lc = 1; 
+                                               
+                                               return (int)(fe.Height * lc) + Margin * 2;
+                                       }
+
                                        foreach (string s in lines) {
                                                string l = s.Replace("\t", new String (' ', Interface.TabSize));
 
@@ -346,16 +355,9 @@ namespace Crow
                                                if (tmp.XAdvance > te.XAdvance)
                                                        te = tmp;
                                        }
-                                       fe = gr.FontExtents;
-                                       int lc = lines.Count;
-                                       //ensure minimal height = text line height
-                                       if (lc == 0)
-                                               lc = 1; 
-                                       size = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)(fe.Height * lc) + Margin*2);
+                                       return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
                                }
                        }
-
-            return size;;
         }
                protected override void onDraw (Context gr)
                {
@@ -368,7 +370,8 @@ namespace Crow
                        //gr.FontOptions.Antialias = Antialias.Subpixel;
                        //gr.FontOptions.HintMetrics = HintMetrics.On;
 
-                       rText = new Rectangle(measureRawSize());
+                       rText = new Rectangle(
+                               measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height));
                        rText.Width -= 2 * Margin;
                        rText.Height -= 2 * Margin;
 
index f3c9f43d8c45753cdc2acfb50ba80343eba144c4..640e8d0bbbcf5f89349933d2c3a13b265e190999 100644 (file)
@@ -91,9 +91,16 @@ namespace Crow
                        return child == goToFind ? true : 
                                child == null ? false : child.Contains(goToFind);
                }
-               protected override Size measureRawSize ()
-               {                       
-                       return child == null ? Bounds.Size : child.Slot.Size + 2 * Margin;
+               protected override int measureRawSize (LayoutingType lt)
+               {
+                       if (child == null)
+                               return base.measureRawSize (lt);
+                       if (lt == LayoutingType.Width)
+                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Width) ?
+                                       -1 : child.Slot.Size.Width + 2 * Margin;
+                       else
+                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Height) ?
+                                       -1 : child.Slot.Size.Height + 2 * Margin;                       
                }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
index dd7c742d4b805fdaa2dd0383f3328e3fea326d68..75176c3413f4b75455e42c7b2f5a4bfc9cf07a5e 100644 (file)
@@ -71,38 +71,47 @@ namespace Crow
 
                string _template;
 
-               [XmlAttributeAttribute][DefaultValue("#Crow.Templates.Template.goml")]
+               [XmlAttributeAttribute][DefaultValue(null)]
                public string Template {
                        get { return _template; }
-                       set { _template = value; }
-               }
+                       set {
+                               if (Template == value)
+                                       return;
+                               _template = value;
 
-               #region GraphicObject overrides
-               [XmlAttributeAttribute()][DefaultValue(-1)]
-               public override int Width {
-                       get { return base.Width; }
-                       set { 
-                               base.Width = value; 
-                               //PropertyLess binding for sizing policy in template
-                               if (base.Width < 1) //send size policy to template elements
-                                       NotifyValueChanged ("TemplatedWidth", base.Width);
-                               else //stretched in control if size is fixed
-                                       NotifyValueChanged ("TemplatedWidth", 0);
+                               if (string.IsNullOrEmpty(_template))
+                                       loadTemplate ();
+                               else
+                                       loadTemplate (Interface.Load (_template, this));
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(-1)]
-               public override int Height {
-                       get { return base.Height; }
-                       set { 
-                               base.Height = value; 
 
-                               //PropertyLess binding for sizing policy in template
-                               if (base.Height < 1) //send size policy to template elements
-                                       NotifyValueChanged ("TemplatedHeight", base.Height);
-                               else //stretched in control if size is fixed
-                                       NotifyValueChanged ("TemplatedHeight", 0);
-                       }
-               }
+               #region GraphicObject overrides
+//             [XmlAttributeAttribute()][DefaultValue(-1)]
+//             public override int Width {
+//                     get { return base.Width; }
+//                     set { 
+//                             base.Width = value; 
+//                             //PropertyLess binding for sizing policy in template
+//                             if (base.Width < 1) //send size policy to template elements
+//                                     NotifyValueChanged ("TemplatedWidth", base.Width);
+//                             else //stretched in control if size is fixed
+//                                     NotifyValueChanged ("TemplatedWidth", 0);
+//                     }
+//             }
+//             [XmlAttributeAttribute()][DefaultValue(-1)]
+//             public override int Height {
+//                     get { return base.Height; }
+//                     set { 
+//                             base.Height = value; 
+//
+//                             //PropertyLess binding for sizing policy in template
+//                             if (base.Height < 1) //send size policy to template elements
+//                                     NotifyValueChanged ("TemplatedHeight", base.Height);
+//                             else //stretched in control if size is fixed
+//                                     NotifyValueChanged ("TemplatedHeight", 0);
+//                     }
+//             }
                public override GraphicObject FindByName (string nameToFind)
                {
                        //prevent name searching in template
index a426bdee2cfd5ea249ba6ddaf23498d58d287b88..ef19cb045c1d1507cee1e8d35c95e6e7c2061ed9 100644 (file)
@@ -144,13 +144,11 @@ namespace Crow
                        set { base.Margin = value; }
                }
 
-               protected override Size measureRawSize()
-        {
-                       Size size;
-
+               protected override int measureRawSize(LayoutingType lt)
+               {                       
                        if (lines == null)
                                lines = getLines;
-                               
+
                        using (ImageSurface img = new ImageSurface (Format.Argb32, 10, 10)) {
                                using (Context gr = new Context (img)) {
                                        //Cairo.FontFace cf = gr.GetContextFontFace ();
@@ -158,30 +156,34 @@ namespace Crow
                                        gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
                                        gr.SetFontSize (Font.Size);
 
+
+                                       fe = gr.FontExtents;
                                        te = new TextExtents();
 
+                                       if (lt == LayoutingType.Height){
+                                               int lc = lines.Count;
+                                               //ensure minimal height = text line height
+                                               if (lc == 0)
+                                                       lc = 1; 
+
+                                               return (int)(fe.Height * lc) + Margin * 2;
+                                       }
+
                                        foreach (string s in lines) {
                                                string l = s.Replace("\t", new String (' ', Interface.TabSize));
 
-#if _WIN32 || _WIN64
+                                               #if _WIN32 || _WIN64
                                                TextExtents tmp = gr.TextExtents(str.ToUtf8());
-#elif __linux__
+                                               #elif __linux__
                                                TextExtents tmp = gr.TextExtents (l);
-#endif
+                                               #endif
                                                if (tmp.XAdvance > te.XAdvance)
                                                        te = tmp;
                                        }
-                                       fe = gr.FontExtents;
-                                       int lc = lines.Count;
-                                       //ensure minimal height = text line height
-                                       if (lc == 0)
-                                               lc = 1; 
-                                       size = new Size ((int)Math.Ceiling (te.XAdvance) + Margin * 2, (int)(fe.Height * lc) + Margin*2);
+                                       return (int)Math.Ceiling (te.XAdvance) + Margin * 2;
                                }
                        }
-
-            return size;;
-        }
+               }
                protected override void onDraw (Context gr)
                {
                        base.onDraw (gr);
@@ -193,7 +195,8 @@ namespace Crow
                        //gr.FontOptions.Antialias = Antialias.Subpixel;
                        //gr.FontOptions.HintMetrics = HintMetrics.On;
 
-                       rText = new Rectangle(measureRawSize());
+                       rText = new Rectangle(
+                               measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height));
                        rText.Width -= 2 * Margin;
                        rText.Height -= 2 * Margin;