diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-13 15:45:46 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-13 15:45:46 +0200 |
| commit | 1af00c6b1b9d0d2990243d4341f7df8d46dbe22e (patch) | |
| tree | 4a384f099f17141369ac5c6cc7b9f432d5300f70 | |
| parent | 80794513b7ec051e9f8a8bc05460609d168f68a2 (diff) | |
wrapper debug and test
| -rw-r--r-- | Default.style | 3 | ||||
| -rw-r--r-- | Tests/BasicTests.cs | 1 | ||||
| -rwxr-xr-x | Tests/Interfaces/Wrapper/1.crow | 14 | ||||
| -rwxr-xr-x | Tests/Interfaces/Wrapper/2.crow | 14 | ||||
| -rw-r--r-- | Tests/Tests.csproj | 7 | ||||
| -rw-r--r-- | src/GraphicObjects/Wrapper.cs | 10 |
6 files changed, 44 insertions, 5 deletions
diff --git a/Default.style b/Default.style index 247219d7..8a63a276 100644 --- a/Default.style +++ b/Default.style @@ -3,6 +3,9 @@ MessageBox, Popper, Slider, Spinner, TextBox { Focusable = true; Height = Fit; } +Wrapper { + Orientation = Vertical; +} Button { Width = Fit; } diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 658cddd8..970480f2 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -100,6 +100,7 @@ namespace Tests testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Expandable", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); diff --git a/Tests/Interfaces/Wrapper/1.crow b/Tests/Interfaces/Wrapper/1.crow new file mode 100755 index 00000000..feddc6ef --- /dev/null +++ b/Tests/Interfaces/Wrapper/1.crow @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<Window Width="50%" Height="50%"> + <Wrapper Orientation="Vertical" Height="Fit" Width="Fit" Margin="5" Background="Teal" Spacing="1" > + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50%" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50%" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + </Wrapper> +</Window>
\ No newline at end of file diff --git a/Tests/Interfaces/Wrapper/2.crow b/Tests/Interfaces/Wrapper/2.crow new file mode 100755 index 00000000..4fa1cd9a --- /dev/null +++ b/Tests/Interfaces/Wrapper/2.crow @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<Window Width="50%" Height="50%"> + <Wrapper Orientation="Horizontal" Height="Fit" Width="Fit" Margin="5" Background="Teal" Spacing="1" > + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50%" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + <GraphicObject Width="50" Height="50%" Background="Mantis"/> + <GraphicObject Width="50" Height="50" Background="Mantis"/> + </Wrapper> +</Window>
\ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 5cf3d6aa..2ab0d54c 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -347,6 +347,12 @@ <None Include="Interfaces\Divers\imlEditor.crow"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="Interfaces\Wrapper\1.crow"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="Interfaces\Wrapper\2.crow"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> </ItemGroup> <ItemGroup> <Folder Include="Interfaces\" /> @@ -358,6 +364,7 @@ <Folder Include="Interfaces\Expandable\" /> <Folder Include="Interfaces\Splitter\" /> <Folder Include="Interfaces\Unsorted\" /> + <Folder Include="Interfaces\Wrapper\" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="image\tetra.png"> diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 9b9f0563..68e8cab6 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -37,7 +37,7 @@ namespace Crow int dx = 0; int dy = 0; - if (Orientation == Orientation.Horizontal) { + if (Orientation == Orientation.Vertical) { int tallestChild = 0; foreach (GraphicObject c in Children) { if (!c.Visible) @@ -85,13 +85,13 @@ namespace Crow //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); switch (arg.LayoutType) { case LayoutingType.Width: - if (Orientation == Orientation.Vertical && go.Width.Units == Unit.Percent) { + if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent) { go.Width = Measure.Fit; return; } break; case LayoutingType.Height: - if (Orientation == Orientation.Horizontal && go.Height.Units == Unit.Percent) { + if (Orientation == Orientation.Vertical && go.Height.Units == Unit.Percent) { go.Height = Measure.Fit; return; } @@ -109,7 +109,7 @@ namespace Crow int tmp = 0; //Wrapper can't fit in the direction of the wrapper if (lt == LayoutingType.Width) { - if (Orientation == Orientation.Horizontal) { + if (Orientation == Orientation.Vertical) { Width = Measure.Stretched; return -1; } else if (RegisteredLayoutings.HasFlag (LayoutingType.Height)) @@ -138,7 +138,7 @@ namespace Crow return tmp + largestChild + 2 * Margin; } } - } else if (Orientation == Orientation.Vertical) { + } else if (Orientation == Orientation.Horizontal) { Height = Measure.Stretched; return -1; } else if (RegisteredLayoutings.HasFlag (LayoutingType.Width)) |