aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rw-r--r--Crow.OpenTK.nuspec2
-rwxr-xr-xTemplates/ArrowButTemplate.crow1
-rwxr-xr-xTemplates/Button.template4
-rwxr-xr-xTemplates/CheckBox.template4
-rwxr-xr-xTemplates/ComboBox.template13
-rwxr-xr-xTemplates/DirectoryView.template14
-rwxr-xr-xTemplates/Expandable.template12
-rwxr-xr-xTemplates/GroupBox.template15
-rwxr-xr-xTemplates/ListBox.template5
-rw-r--r--Templates/Menu.template3
-rw-r--r--Templates/MenuItem.template1
-rw-r--r--Templates/MessageBox.template14
-rwxr-xr-xTemplates/Popper.template6
-rwxr-xr-xTemplates/RadioButton.template4
-rwxr-xr-xTemplates/ScrollBar.template7
-rw-r--r--Templates/ScrollingListBox.goml10
-rwxr-xr-xTemplates/Spinner.template7
-rw-r--r--Templates/TabItem.template4
-rw-r--r--Templates/TreeView.template5
-rwxr-xr-xTemplates/Window.template9
-rwxr-xr-xTemplates/treeList.crow2
-rwxr-xr-xTests/Interfaces/Container/0.crow2
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testTreeView.crow15
-rwxr-xr-xTests/Interfaces/TemplatedControl/testItemTemplateTag.crow10
-rwxr-xr-xTests/Interfaces/TemplatedControl/testScrollbar.crow (renamed from Tests/Interfaces/TemplatedControl/testScrollbar.goml)0
-rwxr-xr-xTests/Interfaces/TemplatedControl/testSpinner.crow (renamed from Tests/Interfaces/TemplatedControl/testSpinner.goml)0
-rwxr-xr-xTests/Interfaces/TmpExpandable.goml8
-rwxr-xr-xTests/Interfaces/treeList.crow3
-rw-r--r--Tests/Tests.csproj12
-rwxr-xr-xTests/ui/Popper.template2
-rwxr-xr-xTests/ui/tmpWindow.crow10
-rw-r--r--src/GraphicObjects/GraphicObject.cs16
-rw-r--r--src/Measure.cs13
33 files changed, 111 insertions, 122 deletions
diff --git a/Crow.OpenTK.nuspec b/Crow.OpenTK.nuspec
index 1a6221f7..40b76980 100644
--- a/Crow.OpenTK.nuspec
+++ b/Crow.OpenTK.nuspec
@@ -2,7 +2,7 @@
<package >
<metadata>
<id>Crow.OpenTK</id>
- <version>0.4.8</version>
+ <version>0.4.10</version>
<title>C# Rapid Open Widget Toolkit</title>
<authors>JP Bruyere</authors>
<owners>Grand Tetras Software</owners>
diff --git a/Templates/ArrowButTemplate.crow b/Templates/ArrowButTemplate.crow
index fe0e122c..819a51ce 100755
--- a/Templates/ArrowButTemplate.crow
+++ b/Templates/ArrowButTemplate.crow
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
<Border Name="Content"
Background="vgradient|0:White|0.1:LightGray|0.9:LightGray|1:Black" Foreground="DarkGray"
- Height="{../HeightPolicy}" Width="{../WidthPolicy}"
MouseEnter="{Foreground=White}"
MouseLeave="{Foreground=DarkGray}"
MouseDown="{Background=vgradient|0:Black|0.1:LightGray|0.9:LightGray|1:White}"
diff --git a/Templates/Button.template b/Templates/Button.template
index 959ad8cc..043f8a29 100755
--- a/Templates/Button.template
+++ b/Templates/Button.template
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<Border Background="{./Background}" MinimumSize="50,20" Height="{./HeightPolicy}" Width="{./WidthPolicy}"
- Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
+<Border Background="{./Background}" MinimumSize="50,20"
+ 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=LightGray}"
MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}"
diff --git a/Templates/CheckBox.template b/Templates/CheckBox.template
index a3c0f23d..070f8e2e 100755
--- a/Templates/CheckBox.template
+++ b/Templates/CheckBox.template
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<HorizontalStack Style="Control" Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack Style="Control" Background="{./Background}">
<Image Style="Icon" Path="#Crow.Images.Icons.checkbox.svg"
SvgSub="{./IsChecked}"/>
- <Label Font="{./Font}" Text="{./Caption}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+ <Label Font="{./Font}" Text="{./Caption}"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Templates/ComboBox.template b/Templates/ComboBox.template
index d28a7b91..906e354d 100755
--- a/Templates/ComboBox.template
+++ b/Templates/ComboBox.template
@@ -1,12 +1,10 @@
<?xml version="1.0"?>
-<Popper Name="popper" PopDirection="Bottom" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+<Popper Name="popper" PopDirection="Bottom">
<Template>
- <Border CornerRadius="0" Foreground="LightGray" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <HorizontalStack Margin="0
- " Spacing="1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}">
+ <Border CornerRadius="0" Foreground="LightGray">
+ <HorizontalStack Margin="0" Spacing="1">
<TextBox MinimumSize="80,10" Margin="1" Foreground="Black" Background="White"
- Text="{../../../../SelectedItem}"
- Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}"/>
+ Text="{../../../../SelectedItem}"/>
<Button Width="14" Height="14" Focusable="false"
Template="#Crow.Templates.ArrowButTemplate.crow">
<Image Margin="0" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
@@ -18,11 +16,10 @@
MinimumSize="{../../MinimumPopupSize}" Fit="true">
<Scroller Name="scroller1" Margin="2" VerticalScrolling="true"
MaximumSize="0,200"
- Height="{../HeightPolicy}" Width="{../WidthPolicy}"
HorizontalAlignment="Left"
ValueChanged="../../../_scroller_ValueChanged">
<VerticalStack LayoutChanged="../../../../_list_LayoutChanged"
- Height="Fit" Width="{../../WidthPolicy}" Name="ItemsContainer" Margin="0"
+ Height="Fit" Name="ItemsContainer" Margin="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"/>
</Scroller>
diff --git a/Templates/DirectoryView.template b/Templates/DirectoryView.template
index 9b80c1e9..a6a29651 100755
--- a/Templates/DirectoryView.template
+++ b/Templates/DirectoryView.template
@@ -13,8 +13,8 @@
<ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
<Expandable Caption="{Name}" >
<Template>
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit"
MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
MouseLeave="{Background=Transparent}">
<Image Margin="2" Width="12" Height="12"
@@ -22,15 +22,15 @@
SvgSub="{./IsExpanded}"/>
<Image Margin="2" Width="14" Height="14"
Path="#Crow.Images.Icons.folder.svg"/>
- <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+
+ <Label Text="{./Caption}"/>
</HorizontalStack>
- <Container Name="Content" Visible="false"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+ <Container Name="Content" Visible="false"/>
</VerticalStack>
</Template>
- <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
+ <HorizontalStack Height="Fit">
<GraphicObject Width="12" Height="10"/>
- <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}"
+ <TreeView Name="List" Height="Fit"
Template="#Crow.Templates.treeList.crow" />
</HorizontalStack>
</Expandable>
diff --git a/Templates/Expandable.template b/Templates/Expandable.template
index 14a59dd9..acae6d81 100755
--- a/Templates/Expandable.template
+++ b/Templates/Expandable.template
@@ -1,15 +1,13 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="{./Foreground}" Background="{./Background}"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}">
+<Border BorderWidth="1" Foreground="{./Foreground}" Background="{./Background}">
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit">
<Image Style="Icon" Margin="2"
Visible="{./HasContent}"
Path="{./Image}"
SvgSub="{./IsExpanded}"/>
- <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+ <Label Text="{./Caption}"/>
</HorizontalStack>
- <Container Name="Content" Visible="false"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+ <Container Name="Content" Visible="false"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/Templates/GroupBox.template b/Templates/GroupBox.template
index 4e70ceae..199cfe9b 100755
--- a/Templates/GroupBox.template
+++ b/Templates/GroupBox.template
@@ -1,13 +1,10 @@
<?xml version="1.0"?>
-<Container Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <Group Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <VerticalStack Spacing="0"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <GraphicObject Height="6" Width="{./WidthPolicy}"/>
- <Border CornerRadius="5" BorderWidth="1" Margin="10" Foreground="{./Foreground}"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <Container Name="Content" Margin="0" MinimumSize="70,10"
- Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+<Container Background="{./Background}">
+ <Group>
+ <VerticalStack Spacing="0">
+ <GraphicObject Height="6"/>
+ <Border CornerRadius="5" BorderWidth="1" Margin="10" Foreground="{./Foreground}">
+ <Container Name="Content" Margin="0" MinimumSize="70,10"/>
</Border>
</VerticalStack>
<Label Text="{./Caption}" VerticalAlignment="Top" Left="8"
diff --git a/Templates/ListBox.template b/Templates/ListBox.template
index 36f2f61e..18f01c9d 100755
--- a/Templates/ListBox.template
+++ b/Templates/ListBox.template
@@ -1,9 +1,8 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Height="{./HeightPolicy}" Width="{./WidthPolicy}" >
+<Border BorderWidth="1" Margin="1" MinimumSize="10,10">
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"
ValueChanged="./_scroller_ValueChanged">
<VerticalStack LayoutChanged="./_list_LayoutChanged"
- Height="Fit" Width="{./WidthPolicy}" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+ Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
</Scroller>
</Border> \ No newline at end of file
diff --git a/Templates/Menu.template b/Templates/Menu.template
index d49e0b31..c560043c 100644
--- a/Templates/Menu.template
+++ b/Templates/Menu.template
@@ -1,3 +1,2 @@
<?xml version="1.0"?>
-<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"
- Width="{./WidthPolicy}" Height="{./HeightPolicy}"/>
+<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"/>
diff --git a/Templates/MenuItem.template b/Templates/MenuItem.template
index c6c545f6..b814e2c6 100644
--- a/Templates/MenuItem.template
+++ b/Templates/MenuItem.template
@@ -8,7 +8,6 @@
MouseLeave="{Foreground=Transparent}"
MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}"
MouseUp="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"
MinimumSize = "60,0"
Foreground="Transparent"
Background="{./Background}">
diff --git a/Templates/MessageBox.template b/Templates/MessageBox.template
index e9dc5148..9c361ea6 100644
--- a/Templates/MessageBox.template
+++ b/Templates/MessageBox.template
@@ -1,14 +1,14 @@
<?xml version="1.0"?>
-<Border Height="{./HeightPolicy}" Width="{./WidthPolicy}" CornerRadius="0"
+<Border CornerRadius="0"
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="{./Background}">
- <Border BorderWidth="0" Foreground="White" Width="{./WidthPolicy}" Height="Fit"
+ <VerticalStack Background="{./Background}">
+ <Border BorderWidth="0" Foreground="White" Height="Fit"
Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">
- <HorizontalStack Name="hs" Margin="2" Spacing="1" Width="{./WidthPolicy}" Height="Fit" >
+ <HorizontalStack Name="hs" Margin="2" Spacing="1" Height="Fit" >
<GraphicObject Width="5" Height="5"/>
<Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
- <Label Foreground="White" Width="{./WidthPolicy}" Margin="1" TextAlignment="Center" Text="{./Title}" />
+ <Label Width="Stretched" Foreground="White" 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" Path="#Crow.Images.Icons.exit2.svg"
@@ -17,9 +17,9 @@
<GraphicObject Width="5" Height="5"/>
</HorizontalStack>
</Border>
- <HorizontalStack Margin="5" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+ <HorizontalStack Margin="5">
<Image Name="Image" Width="20%" Height="20" Path="#Crow.Images.Icons.iconInfo.svg" />
- <Label Margin="5" Font="serif, 10" Height="{./HeightPolicy}" Width="80%" Text="{./Message}"
+ <Label Margin="5" Font="serif, 10" Width="80%" Text="{./Message}"
TextAlignment="Left"
Multiline="true" />
</HorizontalStack>
diff --git a/Templates/Popper.template b/Templates/Popper.template
index a36daaee..c473cecb 100755
--- a/Templates/Popper.template
+++ b/Templates/Popper.template
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit" Width="{./WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}">
+<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit">
+ <HorizontalStack Spacing="1" Height="Fit">
<Image Style="Icon" Margin="2"
Path="#Crow.Images.Icons.expandable.svg" SvgSub="{./IsPopped}"/>
- <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+ <Label Text="{./Caption}" />
</HorizontalStack>
</Border> \ No newline at end of file
diff --git a/Templates/RadioButton.template b/Templates/RadioButton.template
index 6d2e9de4..b96eec2c 100755
--- a/Templates/RadioButton.template
+++ b/Templates/RadioButton.template
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<HorizontalStack Style="Control" Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack Style="Control" Background="{./Background}">
<Image Style="Icon" Path="#Crow.Images.Icons.radiobutton.svg"
SvgSub="{./IsChecked}"/>
- <Label Text="{./Caption}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+ <Label Text="{./Caption}"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Templates/ScrollBar.template b/Templates/ScrollBar.template
index 4164c30d..3cd4d0a4 100755
--- a/Templates/ScrollBar.template
+++ b/Templates/ScrollBar.template
@@ -1,7 +1,6 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Width="{./WidthPolicy}" Height="{./HeightPolicy}">
- <GenericStack Orientation="{./Orientation}" Spacing="0"
- Width="{./WidthPolicy}" Height="{./HeightPolicy}">
+<Border BorderWidth="1" Foreground="LightGray">
+ <GenericStack Orientation="{./Orientation}" Spacing="0">
<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"/>
@@ -10,10 +9,10 @@
Orientation="{./Orientation}"
Value="{./Value}"
Maximum="{./Maximum}"
+ Height="{./HeightPolicy}" Width="{./WidthPolicy}"
LargeIncrement="{./LargeIncrement}"
SmallIncrement="{./SmallIncrement}"
Background="hgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"
- Width="{./WidthPolicy}" Height="{./HeightPolicy}"
ValueChanged="./onSliderValueChange"/>
<Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollForth"
Template="#Crow.Templates.ArrowButTemplate.crow">
diff --git a/Templates/ScrollingListBox.goml b/Templates/ScrollingListBox.goml
index 54e3eb48..2093d4d8 100644
--- a/Templates/ScrollingListBox.goml
+++ b/Templates/ScrollingListBox.goml
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="{./Background}">
- <HorizontalStack Margin="1" Height="{./HeightPolicy}" Width="{./WidthPolicy}" >
- <Scroller Name="scroller1" Height="{./HeightPolicy}" Width="{./WidthPolicy}"
+<Border BorderWidth="1" Background="{./Background}">
+ <HorizontalStack Margin="1">
+ <Scroller Name="scroller1"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="./_scroller_ValueChanged">
- <VerticalStack Width="{./WidthPolicy}" Height="-1" MinimumSize="10,10"
+ <VerticalStack Height="Fit" MinimumSize="10,10"
Name="ItemsContainer" Margin="0" VerticalAlignment="Top"
LayoutChanged="./_list_LayoutChanged"/>
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" Height="{./HeightPolicy}" />
+ Width="14" />
</HorizontalStack>
</Border> \ No newline at end of file
diff --git a/Templates/Spinner.template b/Templates/Spinner.template
index b07e17b3..af22628c 100755
--- a/Templates/Spinner.template
+++ b/Templates/Spinner.template
@@ -1,9 +1,8 @@
<?xml version="1.0"?>
-<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <Border BorderWidth="1" Height="{./HeightPolicy}" Width="80%" Background="White"
+<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0">
+ <Border BorderWidth="1" Width="80%" Background="White"
Foreground="DimGray" Margin="0">
- <Label Foreground="DimGray" Height="{../../../HeightPolicy}" Width="Stretched"
+ <Label Foreground="DimGray" Width="Stretched"
Text="{../../../Value}" TextAlignment="Right" Margin="0"/>
</Border>
<VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
diff --git a/Templates/TabItem.template b/Templates/TabItem.template
index ce2a270e..8028a8e5 100644
--- a/Templates/TabItem.template
+++ b/Templates/TabItem.template
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<GenericStack Orientation="Vertical" Spacing="0"
- Width="{./WidthPolicy}" Height="{./HeightPolicy}"
Background="Onyx"
MouseEnter="{caption.Foreground=White}"
MouseLeave="{caption.Foreground=Gray}">
@@ -16,7 +15,6 @@
MouseClick="../../../../butCloseTabClick"/>
</Border>
</HorizontalStack>
- <Container
- Name="Content" Width="{./WidthPolicy}" Height="{./HeightPolicy}"/>
+ <Container Name="Content"/>
</GenericStack>
diff --git a/Templates/TreeView.template b/Templates/TreeView.template
index 377de50c..25c93f15 100644
--- a/Templates/TreeView.template
+++ b/Templates/TreeView.template
@@ -1,12 +1,11 @@
<?xml version="1.0"?>
-<HorizontalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack>
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
Background="{./Background}"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"
ScrollY="{../scrollbar1.Value}"
ValueChanged="./_scroller_ValueChanged">
<VerticalStack LayoutChanged="./_list_LayoutChanged"
- Height="Fit" Width="{./WidthPolicy}" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+ Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
</Scroller>
<ScrollBar
Name="scrollbar1"
diff --git a/Templates/Window.template b/Templates/Window.template
index 6b3932c1..bbd1e57a 100755
--- a/Templates/Window.template
+++ b/Templates/Window.template
@@ -1,17 +1,16 @@
<?xml version="1.0"?>
<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
Background="{./Background}"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"
MouseEnter="./onBorderMouseEnter"
MouseLeave="./onBorderMouseLeave">
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Spacing="0">
+ <VerticalStack Spacing="0">
<!-- <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit"
Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">-->
<HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
- Name="hs" Margin="2" Spacing="0" Width="{./WidthPolicy}" Height="Fit">
+ Name="hs" Margin="2" Spacing="0" Height="Fit">
<GraphicObject Width="5"/>
<Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
- <Label Foreground="White" Width="{./WidthPolicy}" Margin="1" TextAlignment="Center" Text="{./Title}" />
+ <Label Width="Stretched" Foreground="White" 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="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
@@ -20,6 +19,6 @@
<GraphicObject Width="5"/>
</HorizontalStack>
<!-- </Border>-->
- <Container Name="Content" MinimumSize="50,50" Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
+ <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/Templates/treeList.crow b/Templates/treeList.crow
index 160f351a..fbd47055 100755
--- a/Templates/treeList.crow
+++ b/Templates/treeList.crow
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<VerticalStack
- Height="Fit" Width="{../WidthPolicy}" Name="ItemsContainer"/> \ No newline at end of file
+ Height="Fit" Name="ItemsContainer"/> \ No newline at end of file
diff --git a/Tests/Interfaces/Container/0.crow b/Tests/Interfaces/Container/0.crow
index a69e6f69..be2e16e6 100755
--- a/Tests/Interfaces/Container/0.crow
+++ b/Tests/Interfaces/Container/0.crow
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<Container Background="Onyx" Margin="10" Width="90%" Height="90%">
- <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis"
+ <GraphicObject Margin="10" Background="Mantis"
MinimumSize="50,50"/>
</Container> \ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedContainer/testTreeView.crow b/Tests/Interfaces/TemplatedContainer/testTreeView.crow
index e8e71645..fb4cbe87 100755
--- a/Tests/Interfaces/TemplatedContainer/testTreeView.crow
+++ b/Tests/Interfaces/TemplatedContainer/testTreeView.crow
@@ -12,8 +12,8 @@
<ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
<Expandable Caption="{Name}" >
<Template>
- <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit"
MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
MouseLeave="{Background=Transparent}">
<Image Margin="2" Width="12" Height="12"
@@ -22,17 +22,16 @@
SvgSub="{./IsExpanded}"/>
<Image Margin="2" Width="14" Height="14"
Path="#Crow.Images.Icons.folder.svg"/>
- <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+ <Label Text="{./Caption}"/>
</HorizontalStack>
- <Container Name="Content" Visible="false"
- Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+ <Container Name="Content" Visible="false"/>
</VerticalStack>
</Template>
- <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
+ <HorizontalStack Height="Fit">
<GraphicObject Width="12" Height="10"/>
- <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}">
+ <TreeView Name="List" Height="Fit">
<Template>
- <VerticalStack Height="Fit" Width="{../WidthPolicy}" Name="ItemsContainer"/>
+ <VerticalStack Height="Fit" Name="ItemsContainer"/>
</Template>
</TreeView>
</HorizontalStack>
diff --git a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
index 94625915..f4d37a74 100755
--- a/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
+++ b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
@@ -4,12 +4,12 @@
<ListBox Data="{TestList}" Background="0.5,0.5,0.5,0.7"
HorizontalAlignment="Center" Width="200" Height="200" Margin="5">
<Template>
- <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
- <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
- <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
+ <Border BorderWidth="1">
+ <HorizontalStack Margin="1">
+ <Scroller Name="scroller1"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="../../../_scroller_ValueChanged">
- <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10,10"
+ <VerticalStack Height="Fit" MinimumSize="10,10"
Name="ItemsContainer" Margin="0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
@@ -17,7 +17,7 @@
</Scroller>
<ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
- Width="14" Height="{../../../HeightPolicy}" />
+ Width="14"/>
</HorizontalStack>
</Border>
</Template>
diff --git a/Tests/Interfaces/TemplatedControl/testScrollbar.goml b/Tests/Interfaces/TemplatedControl/testScrollbar.crow
index c494e347..c494e347 100755
--- a/Tests/Interfaces/TemplatedControl/testScrollbar.goml
+++ b/Tests/Interfaces/TemplatedControl/testScrollbar.crow
diff --git a/Tests/Interfaces/TemplatedControl/testSpinner.goml b/Tests/Interfaces/TemplatedControl/testSpinner.crow
index 4efd587a..4efd587a 100755
--- a/Tests/Interfaces/TemplatedControl/testSpinner.goml
+++ b/Tests/Interfaces/TemplatedControl/testSpinner.crow
diff --git a/Tests/Interfaces/TmpExpandable.goml b/Tests/Interfaces/TmpExpandable.goml
index 1cd05fd7..9dddcebb 100755
--- a/Tests/Interfaces/TmpExpandable.goml
+++ b/Tests/Interfaces/TmpExpandable.goml
@@ -3,10 +3,10 @@
<Label Text="{../../Caption}" Width="{../../WidthPolicy}"/>
<Container Name="Content" Visible="false" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</VerticalStack>-->
-<Group BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
+<Group BorderWidth="1" Foreground="LightGray"
MouseClick="../onMouseClick">
- <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
- <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+ <VerticalStack>
+ <Label Text="{../../../Caption}"/>
+ <Container Name="Content" Visible="false"/>
</VerticalStack>
</Group> \ No newline at end of file
diff --git a/Tests/Interfaces/treeList.crow b/Tests/Interfaces/treeList.crow
index 61ee12a4..ca59c17f 100755
--- a/Tests/Interfaces/treeList.crow
+++ b/Tests/Interfaces/treeList.crow
@@ -1,3 +1,2 @@
<?xml version="1.0"?>
-<VerticalStack
- Height="Fit" Width="{../WidthPolicy}" Name="List"/> \ No newline at end of file
+<VerticalStack Height="Fit" Name="List"/> \ No newline at end of file
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 1095bd6a..771c8b4a 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -256,12 +256,6 @@
<None Include="Interfaces\TemplatedControl\testRadioButton.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\TemplatedControl\testScrollbar.goml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Interfaces\TemplatedControl\testSpinner.goml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\TemplatedContainer\test_Listbox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -301,6 +295,12 @@
<None Include="Interfaces\TemplatedGroup\2.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\TemplatedControl\testScrollbar.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\TemplatedControl\testSpinner.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
diff --git a/Tests/ui/Popper.template b/Tests/ui/Popper.template
index ffcd8d45..ae8c63c2 100755
--- a/Tests/ui/Popper.template
+++ b/Tests/ui/Popper.template
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<Label Text="{../Caption}" Style="#Tests.ui.LabelButton.style"
- Height="Fit" Width="{../WidthPolicy}"/>
+ Height="Fit"/>
diff --git a/Tests/ui/tmpWindow.crow b/Tests/ui/tmpWindow.crow
index 824ad704..64c97d55 100755
--- a/Tests/ui/tmpWindow.crow
+++ b/Tests/ui/tmpWindow.crow
@@ -1,11 +1,10 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="15"
- Height="{../HeightPolicy}" Width="{../WidthPolicy}"
+<Border BorderWidth="1" Foreground="White" CornerRadius="15"
MouseEnter="../onBorderMouseEnter"
MouseLeave="../onBorderMouseLeave"
Background="vgradient|0:0.6,0.6,0.6,0.9|1:0.4,0.4,0.4,0.6">
- <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <HorizontalStack Height="Fit" Width="{../../../WidthPolicy}">
+ <VerticalStack>
+ <HorizontalStack Height="Fit">
<Label Margin="2" Font="{../../../../Font}" Text="{../../../../Title}" Width="Stretched"/>
<Border HorizontalAlignment="Right" Margin="0" VerticalAlignment="Top"
CornerRadius="6" BorderWidth="1" Foreground="Transparent"
@@ -15,7 +14,6 @@
MouseClick="../../../../../butQuitPress"/>
</Border>
</HorizontalStack>
- <Container Name="Content"
- Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+ <Container Name="Content"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 093664d1..e69aaaca 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -276,9 +276,13 @@ namespace Crow
Width = Height = Measure.Fit;
}
}
- [XmlAttributeAttribute()][DefaultValue("Stretched")]
+ [XmlAttributeAttribute()][DefaultValue("Inherit")]
public virtual Measure Width {
- get { return width; }
+ get {
+ return width.Units == Unit.Inherit ?
+ Parent is GraphicObject ? (Parent as GraphicObject).WidthPolicy :
+ Measure.Stretched : width;
+ }
set {
if (width == value)
return;
@@ -308,9 +312,13 @@ namespace Crow
this.RegisterForLayouting (LayoutingType.Width);
}
}
- [XmlAttributeAttribute()][DefaultValue("Stretched")]
+ [XmlAttributeAttribute()][DefaultValue("Inherit")]
public virtual Measure Height {
- get { return height; }
+ get {
+ return height.Units == Unit.Inherit ?
+ Parent is GraphicObject ? (Parent as GraphicObject).HeightPolicy :
+ Measure.Stretched : height;
+ }
set {
if (height == value)
return;
diff --git a/src/Measure.cs b/src/Measure.cs
index c9b08f22..26c3bfde 100644
--- a/src/Measure.cs
+++ b/src/Measure.cs
@@ -25,7 +25,7 @@ namespace Crow
/// <summary>
/// Measurement unit
/// </summary>
- public enum Unit { Pixel, Percent }
+ public enum Unit { Pixel, Percent, Inherit }
/// <summary>
/// Measure class allow proportional sizes as well as stretched and fit on content.
/// </summary>
@@ -49,7 +49,7 @@ namespace Crow
/// set to 100 Percents
/// </summary>
public static Measure Stretched = new Measure(100, Unit.Percent);
-
+ public static Measure Inherit = new Measure (0, Unit.Inherit);
#region CTOR
public Measure (int _value, Unit _units = Unit.Pixel)
{
@@ -98,7 +98,8 @@ namespace Crow
}
public override string ToString ()
{
- return Value == -1 ? "Fit" :
+ return Units == Unit.Inherit ? "Inherit" :
+ Value == -1 ? "Fit" :
Units == Unit.Percent ? Value == 100 ? "Stretched" :
Value.ToString () + "%" : Value.ToString ();
}
@@ -111,10 +112,12 @@ namespace Crow
string st = s.Trim ();
int tmp = 0;
- if (string.Equals ("Fit", st, StringComparison.Ordinal))
+ if (string.Equals ("Inherit", st, StringComparison.Ordinal))
+ return Measure.Inherit;
+ else if (string.Equals ("Fit", st, StringComparison.Ordinal))
return Measure.Fit;
else if (string.Equals ("Stretched", s, StringComparison.Ordinal))
- return Measure.Stretched;
+ return Measure.Stretched;
else {
if (st.EndsWith ("%", StringComparison.Ordinal)) {
if (int.TryParse (s.Substring(0, st.Length - 1), out tmp))