aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-18 17:26:50 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-09-01 12:44:38 +0200
commit5fc76c5f6234fcdcf208607c434a6d5d8bbf79da (patch)
tree393b14c6c193846d33e7e5842d34250333a4cfaa
parentd4bc4a1aba5df1d5a93474259c5d5a52f993d475 (diff)
tests reorganization
modifié : Crow.csproj modifié : Tests/BasicTests.cs renommé : Tests/Interfaces/Expandable/0.crow -> Tests/Interfaces/TemplatedContainer/0.crow renommé : Tests/Interfaces/Expandable/6.crow -> Tests/Interfaces/TemplatedContainer/6.crow renommé : Tests/Interfaces/Expandable/7.crow -> Tests/Interfaces/TemplatedContainer/7.crow renommé : Tests/Interfaces/Divers/testDirViewer2.crow -> Tests/Interfaces/TemplatedContainer/testDirViewer2.crow renommé : Tests/Interfaces/Divers/testGroupBox.crow -> Tests/Interfaces/TemplatedContainer/testGroupBox.crow renommé : Tests/Interfaces/Divers/testMsgBox.crow -> Tests/Interfaces/TemplatedContainer/testMsgBox.crow renommé : Tests/Interfaces/Divers/testPopper.crow -> Tests/Interfaces/TemplatedContainer/testPopper.crow renommé : Tests/Interfaces/Divers/testTabView.crow -> Tests/Interfaces/TemplatedContainer/testTabView.crow renommé : Tests/Interfaces/Divers/testTreeView.crow -> Tests/Interfaces/TemplatedContainer/testTreeView.crow renommé : Tests/Interfaces/Divers/testWindow.goml -> Tests/Interfaces/TemplatedContainer/testWindow.goml renommé : Tests/Interfaces/Divers/testWindow2.goml -> Tests/Interfaces/TemplatedContainer/testWindow2.goml renommé : Tests/Interfaces/Divers/testWindow3.goml -> Tests/Interfaces/TemplatedContainer/testWindow3.goml renommé : Tests/Interfaces/Divers/test_Listbox.crow -> Tests/Interfaces/TemplatedContainer/test_Listbox.crow renommé : Tests/Interfaces/Divers/testButton.crow -> Tests/Interfaces/TemplatedControl/testButton.crow renommé : Tests/Interfaces/Divers/testCheckbox.crow -> Tests/Interfaces/TemplatedControl/testCheckbox.crow renommé : Tests/Interfaces/Divers/testCombobox.crow -> Tests/Interfaces/TemplatedControl/testCombobox.crow renommé : Tests/Interfaces/Divers/testItemTemplateTag.crow -> Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow renommé : Tests/Interfaces/Divers/testRadioButton.crow -> Tests/Interfaces/TemplatedControl/testRadioButton.crow renommé : Tests/Interfaces/Divers/testScrollbar.goml -> Tests/Interfaces/TemplatedControl/testScrollbar.goml renommé : Tests/Interfaces/Divers/testSpinner.goml -> Tests/Interfaces/TemplatedControl/testSpinner.goml modifié : Tests/Tests.csproj modifié : src/GraphicObjects/Expandable.cs modifié : src/GraphicObjects/Group.cs TemplatedGroup class nouveau fichier : src/GraphicObjects/TemplatedGroup.cs nouveau fichier : Tests/Interfaces/TemplatedGroup/0.crow modifié : src/IMLReader.cs
-rw-r--r--Crow.csproj1
-rw-r--r--Tests/BasicTests.cs4
-rwxr-xr-xTests/Interfaces/TemplatedContainer/0.crow (renamed from Tests/Interfaces/Expandable/0.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/6.crow (renamed from Tests/Interfaces/Expandable/6.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/7.crow (renamed from Tests/Interfaces/Expandable/7.crow)0
-rw-r--r--Tests/Interfaces/TemplatedContainer/testDirViewer2.crow (renamed from Tests/Interfaces/Divers/testDirViewer2.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testGroupBox.crow (renamed from Tests/Interfaces/Divers/testGroupBox.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testMsgBox.crow (renamed from Tests/Interfaces/Divers/testMsgBox.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testPopper.crow (renamed from Tests/Interfaces/Divers/testPopper.crow)0
-rw-r--r--Tests/Interfaces/TemplatedContainer/testTabView.crow (renamed from Tests/Interfaces/Divers/testTabView.crow)1
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testTreeView.crow (renamed from Tests/Interfaces/Divers/testTreeView.crow)4
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testWindow.goml (renamed from Tests/Interfaces/Divers/testWindow.goml)6
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testWindow2.goml (renamed from Tests/Interfaces/Divers/testWindow2.goml)0
-rwxr-xr-xTests/Interfaces/TemplatedContainer/testWindow3.goml (renamed from Tests/Interfaces/Divers/testWindow3.goml)2
-rwxr-xr-xTests/Interfaces/TemplatedContainer/test_Listbox.crow (renamed from Tests/Interfaces/Divers/test_Listbox.crow)6
-rwxr-xr-xTests/Interfaces/TemplatedControl/testButton.crow (renamed from Tests/Interfaces/Divers/testButton.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedControl/testCheckbox.crow (renamed from Tests/Interfaces/Divers/testCheckbox.crow)1
-rwxr-xr-xTests/Interfaces/TemplatedControl/testCombobox.crow (renamed from Tests/Interfaces/Divers/testCombobox.crow)0
-rwxr-xr-xTests/Interfaces/TemplatedControl/testItemTemplateTag.crow (renamed from Tests/Interfaces/Divers/testItemTemplateTag.crow)6
-rwxr-xr-xTests/Interfaces/TemplatedControl/testRadioButton.crow (renamed from Tests/Interfaces/Divers/testRadioButton.crow)1
-rwxr-xr-xTests/Interfaces/TemplatedControl/testScrollbar.goml (renamed from Tests/Interfaces/Divers/testScrollbar.goml)0
-rwxr-xr-xTests/Interfaces/TemplatedControl/testSpinner.goml (renamed from Tests/Interfaces/Divers/testSpinner.goml)0
-rwxr-xr-xTests/Interfaces/TemplatedGroup/0.crow1
-rw-r--r--Tests/Tests.csproj85
-rw-r--r--src/GraphicObjects/Expandable.cs1
-rw-r--r--src/GraphicObjects/Group.cs2
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs144
-rw-r--r--src/IMLReader.cs24
28 files changed, 224 insertions, 65 deletions
diff --git a/Crow.csproj b/Crow.csproj
index 0bebc5f2..570a8941 100644
--- a/Crow.csproj
+++ b/Crow.csproj
@@ -140,6 +140,7 @@
<Compile Include="src\ItemTemplate.cs" />
<Compile Include="src\Style.cs" />
<Compile Include="src\GraphicObjects\Wrapper.cs" />
+ <Compile Include="src\GraphicObjects\TemplatedGroup.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs
index 9717c230..b2299f42 100644
--- a/Tests/BasicTests.cs
+++ b/Tests/BasicTests.cs
@@ -95,14 +95,16 @@ namespace Tests
this.KeyDown += KeyboardKeyDown1;
testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.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 ();
+ testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray ();
+ testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray ();
this.Title = testFiles [idx] + ". Press <F3> to switch example.";
CrowInterface.LoadInterface(testFiles[idx]).DataSource = this;
diff --git a/Tests/Interfaces/Expandable/0.crow b/Tests/Interfaces/TemplatedContainer/0.crow
index 0c37d335..0c37d335 100755
--- a/Tests/Interfaces/Expandable/0.crow
+++ b/Tests/Interfaces/TemplatedContainer/0.crow
diff --git a/Tests/Interfaces/Expandable/6.crow b/Tests/Interfaces/TemplatedContainer/6.crow
index 041bdf52..041bdf52 100755
--- a/Tests/Interfaces/Expandable/6.crow
+++ b/Tests/Interfaces/TemplatedContainer/6.crow
diff --git a/Tests/Interfaces/Expandable/7.crow b/Tests/Interfaces/TemplatedContainer/7.crow
index 0c94b6c4..0c94b6c4 100755
--- a/Tests/Interfaces/Expandable/7.crow
+++ b/Tests/Interfaces/TemplatedContainer/7.crow
diff --git a/Tests/Interfaces/Divers/testDirViewer2.crow b/Tests/Interfaces/TemplatedContainer/testDirViewer2.crow
index c4f0904f..c4f0904f 100644
--- a/Tests/Interfaces/Divers/testDirViewer2.crow
+++ b/Tests/Interfaces/TemplatedContainer/testDirViewer2.crow
diff --git a/Tests/Interfaces/Divers/testGroupBox.crow b/Tests/Interfaces/TemplatedContainer/testGroupBox.crow
index 416bb217..416bb217 100755
--- a/Tests/Interfaces/Divers/testGroupBox.crow
+++ b/Tests/Interfaces/TemplatedContainer/testGroupBox.crow
diff --git a/Tests/Interfaces/Divers/testMsgBox.crow b/Tests/Interfaces/TemplatedContainer/testMsgBox.crow
index 95366377..95366377 100755
--- a/Tests/Interfaces/Divers/testMsgBox.crow
+++ b/Tests/Interfaces/TemplatedContainer/testMsgBox.crow
diff --git a/Tests/Interfaces/Divers/testPopper.crow b/Tests/Interfaces/TemplatedContainer/testPopper.crow
index 0c579d95..0c579d95 100755
--- a/Tests/Interfaces/Divers/testPopper.crow
+++ b/Tests/Interfaces/TemplatedContainer/testPopper.crow
diff --git a/Tests/Interfaces/Divers/testTabView.crow b/Tests/Interfaces/TemplatedContainer/testTabView.crow
index 27c221f4..ca558d14 100644
--- a/Tests/Interfaces/Divers/testTabView.crow
+++ b/Tests/Interfaces/TemplatedContainer/testTabView.crow
@@ -32,4 +32,3 @@
Caption="Add new tab" Width="Fit" Height="30" MouseClick="onAddTabButClick"/>
</VerticalStack>
</HorizontalStack>
-
diff --git a/Tests/Interfaces/Divers/testTreeView.crow b/Tests/Interfaces/TemplatedContainer/testTreeView.crow
index 3ec7ce6a..3a44bf34 100755
--- a/Tests/Interfaces/Divers/testTreeView.crow
+++ b/Tests/Interfaces/TemplatedContainer/testTreeView.crow
@@ -9,7 +9,7 @@
MouseLeave="{Background=Transparent}"/>
</HorizontalStack>
</ItemTemplate>
- <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
<Expandable Caption="{Name}" >
<Template>
<VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
@@ -18,7 +18,7 @@
MouseLeave="{Background=Transparent}">
<Image Margin="2" Width="12" Height="12"
Visible="{./HasContent}"
- Path="{./Image}"
+ Path="{./Image}"
SvgSub="{./IsExpanded}"/>
<Image Margin="2" Width="14" Height="14"
Path="#Crow.Images.Icons.folder.svg"/>
diff --git a/Tests/Interfaces/Divers/testWindow.goml b/Tests/Interfaces/TemplatedContainer/testWindow.goml
index 09db6193..c930d92e 100755
--- a/Tests/Interfaces/Divers/testWindow.goml
+++ b/Tests/Interfaces/TemplatedContainer/testWindow.goml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<Window Left="10" Top="10" Title="Test window"
+<Window Left="10" Top="10" Title="Test window"
Width="250" Height="550" >
<VerticalStack Name="contentVSStack" Margin="10" Spacing="10" Background="0.4,0.4,0.4,0.4">
<Slider Name="slider" Height="12" Width="Stretched" CornerRadius="3"/>
@@ -43,7 +43,7 @@
</HorizontalStack>
<HorizontalStack Fit="true">
<Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="Right"/>
- <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
+ <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center"
Background="vgradient|0:AoEnglish|1:Black"/>
</HorizontalStack>
<HorizontalStack Fit="true">
@@ -56,7 +56,7 @@
<Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
Background="vgradient|0:AoEnglish|1:Black"/>
</HorizontalStack>
- </VerticalStack>
+ </VerticalStack>
</Container>
</Border>
<HorizontalStack Fit="true" Background="BlueCrayola" Margin="3">
diff --git a/Tests/Interfaces/Divers/testWindow2.goml b/Tests/Interfaces/TemplatedContainer/testWindow2.goml
index 7f0caf31..7f0caf31 100755
--- a/Tests/Interfaces/Divers/testWindow2.goml
+++ b/Tests/Interfaces/TemplatedContainer/testWindow2.goml
diff --git a/Tests/Interfaces/Divers/testWindow3.goml b/Tests/Interfaces/TemplatedContainer/testWindow3.goml
index 42459bd5..d66de1d6 100755
--- a/Tests/Interfaces/Divers/testWindow3.goml
+++ b/Tests/Interfaces/TemplatedContainer/testWindow3.goml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<Window Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0.5,0.5,0.5,0.8"
+<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="{../HeightPolicy}" Width="{../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
diff --git a/Tests/Interfaces/Divers/test_Listbox.crow b/Tests/Interfaces/TemplatedContainer/test_Listbox.crow
index 321ea58c..8b12cb8c 100755
--- a/Tests/Interfaces/Divers/test_Listbox.crow
+++ b/Tests/Interfaces/TemplatedContainer/test_Listbox.crow
@@ -12,15 +12,15 @@
<!-- <Template>
<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
- <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="../../../_scroller_ValueChanged">
<VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="100,100"
Name="List" Margin="0" VerticalAlignment="Top"
LayoutChanged="../../../../_list_LayoutChanged"/>
</Scroller>
- <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
Width="12" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
diff --git a/Tests/Interfaces/Divers/testButton.crow b/Tests/Interfaces/TemplatedControl/testButton.crow
index 69367eaa..69367eaa 100755
--- a/Tests/Interfaces/Divers/testButton.crow
+++ b/Tests/Interfaces/TemplatedControl/testButton.crow
diff --git a/Tests/Interfaces/Divers/testCheckbox.crow b/Tests/Interfaces/TemplatedControl/testCheckbox.crow
index ddde673d..5147a151 100755
--- a/Tests/Interfaces/Divers/testCheckbox.crow
+++ b/Tests/Interfaces/TemplatedControl/testCheckbox.crow
@@ -9,4 +9,3 @@
<CheckBox Background="Gray" MouseEnter="{Background=Red}" MouseLeave="{Background=Transparent}"/>
<CheckBox Background="Gray" MouseEnter="{Background=Red}" MouseLeave="{Background=Transparent}"/>
</VerticalStack>
-
diff --git a/Tests/Interfaces/Divers/testCombobox.crow b/Tests/Interfaces/TemplatedControl/testCombobox.crow
index 2ef6d391..2ef6d391 100755
--- a/Tests/Interfaces/Divers/testCombobox.crow
+++ b/Tests/Interfaces/TemplatedControl/testCombobox.crow
diff --git a/Tests/Interfaces/Divers/testItemTemplateTag.crow b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
index e05c2d1e..5f860719 100755
--- a/Tests/Interfaces/Divers/testItemTemplateTag.crow
+++ b/Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
@@ -6,7 +6,7 @@
<Template>
<Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
<HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
- <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
+ <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
ValueChanged="../../../_scroller_ValueChanged">
<VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10,10"
@@ -15,8 +15,8 @@
HorizontalAlignment="Left"
LayoutChanged="../../../../_list_LayoutChanged"/>
</Scroller>
- <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
Width="14" Height="{../../../HeightPolicy}" />
</HorizontalStack>
</Border>
diff --git a/Tests/Interfaces/Divers/testRadioButton.crow b/Tests/Interfaces/TemplatedControl/testRadioButton.crow
index de07e250..905cdeba 100755
--- a/Tests/Interfaces/Divers/testRadioButton.crow
+++ b/Tests/Interfaces/TemplatedControl/testRadioButton.crow
@@ -5,4 +5,3 @@
<RadioButton Caption="Radio3"/>
<RadioButton Caption="Radio4"/>
</VerticalStack>
-
diff --git a/Tests/Interfaces/Divers/testScrollbar.goml b/Tests/Interfaces/TemplatedControl/testScrollbar.goml
index c494e347..c494e347 100755
--- a/Tests/Interfaces/Divers/testScrollbar.goml
+++ b/Tests/Interfaces/TemplatedControl/testScrollbar.goml
diff --git a/Tests/Interfaces/Divers/testSpinner.goml b/Tests/Interfaces/TemplatedControl/testSpinner.goml
index 4efd587a..4efd587a 100755
--- a/Tests/Interfaces/Divers/testSpinner.goml
+++ b/Tests/Interfaces/TemplatedControl/testSpinner.goml
diff --git a/Tests/Interfaces/TemplatedGroup/0.crow b/Tests/Interfaces/TemplatedGroup/0.crow
new file mode 100755
index 00000000..9c7bb705
--- /dev/null
+++ b/Tests/Interfaces/TemplatedGroup/0.crow
@@ -0,0 +1 @@
+<?xml version="1.0"?>
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 10529858..566abf23 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -173,9 +173,6 @@
<None Include="Interfaces\Divers\fps.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\test_Listbox.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\Divers\test_stack.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -188,108 +185,114 @@
<None Include="Interfaces\Divers\test1.2.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testButton.crow">
+ <None Include="Interfaces\Divers\testStacks.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\Divers\testTextBox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testCheckbox.crow">
+ <None Include="Interfaces\Splitter\1.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testCombobox.crow">
+ <None Include="OpenTK.dll.config" />
+ <None Include="image\textest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testGroupBox.crow">
+ <None Include="Interfaces\Divers\welcome.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testPopper.crow">
+ <None Include="packages.config" />
+ <None Include="Interfaces\Unsorted\testFileDialog.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testRadioButton.crow">
+ <None Include="Interfaces\Unsorted\testTypeViewer.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testScrollbar.goml">
+ <None Include="Interfaces\Divers\testPropLess.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testSpinner.goml">
+ <None Include="Interfaces\Wrapper\1.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testStacks.crow">
+ <None Include="Interfaces\Wrapper\2.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testTextBox.crow">
+ <None Include="Interfaces\Divers\testImage.crow">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\Divers\testOutOfClipUpdate.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testWindow.goml">
+ <None Include="Interfaces\Divers\0.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testWindow2.goml">
+ <None Include="Interfaces\Divers\testDisable.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testWindow3.goml">
+ <None Include="Interfaces\Divers\3.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Expandable\0.crow">
+ <None Include="Interfaces\TemplatedContainer\0.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Expandable\7.crow">
+ <None Include="Interfaces\TemplatedContainer\6.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Splitter\1.crow">
+ <None Include="Interfaces\TemplatedContainer\7.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="OpenTK.dll.config" />
- <None Include="image\textest.png">
+ <None Include="Interfaces\TemplatedControl\testButton.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\welcome.crow">
+ <None Include="Interfaces\TemplatedControl\testCheckbox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="packages.config" />
- <None Include="Interfaces\Unsorted\testFileDialog.goml">
+ <None Include="Interfaces\TemplatedControl\testCombobox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Unsorted\testTypeViewer.goml">
+ <None Include="Interfaces\TemplatedControl\testItemTemplateTag.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testDirViewer2.crow">
+ <None Include="Interfaces\TemplatedControl\testRadioButton.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testPropLess.crow">
+ <None Include="Interfaces\TemplatedControl\testScrollbar.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Wrapper\1.crow">
+ <None Include="Interfaces\TemplatedControl\testSpinner.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Wrapper\2.crow">
+ <None Include="Interfaces\TemplatedContainer\test_Listbox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testImage.crow">
+ <None Include="Interfaces\TemplatedContainer\testDirViewer2.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testOutOfClipUpdate.crow">
+ <None Include="Interfaces\TemplatedContainer\testGroupBox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testMsgBox.crow">
+ <None Include="Interfaces\TemplatedContainer\testMsgBox.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testTabView.crow">
+ <None Include="Interfaces\TemplatedContainer\testPopper.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testItemTemplateTag.crow">
+ <None Include="Interfaces\TemplatedContainer\testTabView.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testTreeView.crow">
+ <None Include="Interfaces\TemplatedContainer\testTreeView.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\0.crow">
+ <None Include="Interfaces\TemplatedContainer\testWindow.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Expandable\6.crow">
+ <None Include="Interfaces\TemplatedContainer\testWindow2.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\testDisable.crow">
+ <None Include="Interfaces\TemplatedContainer\testWindow3.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Divers\3.crow">
+ <None Include="Interfaces\TemplatedGroup\0.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
@@ -299,10 +302,12 @@
<Folder Include="Interfaces\GraphicObject\" />
<Folder Include="Interfaces\Group\" />
<Folder Include="Interfaces\Divers\" />
- <Folder Include="Interfaces\Expandable\" />
<Folder Include="Interfaces\Splitter\" />
<Folder Include="Interfaces\Unsorted\" />
<Folder Include="Interfaces\Wrapper\" />
+ <Folder Include="Interfaces\TemplatedControl\" />
+ <Folder Include="Interfaces\TemplatedContainer\" />
+ <Folder Include="Interfaces\TemplatedGroup\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="image\tetra.png">
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index 059cab8b..70451f41 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -63,6 +63,7 @@ namespace Crow
NotifyValueChanged ("HasContent", HasContent);
}
}
+ //TODO: move loadTemplate and ResolveBinding in TemplatedContainer
protected override void loadTemplate(GraphicObject template = null)
{
base.loadTemplate (template);
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 950992e2..402128b0 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -27,8 +27,6 @@ namespace Crow
bool _multiSelect = false;
List<GraphicObject> children = new List<GraphicObject>();
- public GraphicObject activeWidget;
-
public virtual List<GraphicObject> Children {
get { return children; }
}
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
new file mode 100644
index 00000000..12448b82
--- /dev/null
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -0,0 +1,144 @@
+//
+// TemplatedContainer.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2015 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;
+using System.Xml.Serialization;
+using System.Xml;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace Crow
+{
+ public abstract class TemplatedGroup : TemplatedControl
+ {
+ #region CTOR
+ public TemplatedGroup () : base(){}
+ #endregion
+
+ protected Group items;
+
+ public virtual List<GraphicObject> Items{ get { return items.Children; }}
+
+ public virtual void AddItem(GraphicObject g){
+ items.AddChild (g);
+ g.LogicalParent = this;
+ }
+ public virtual void RemoveItem(GraphicObject g)
+ {
+ items.RemoveChild (g);
+ }
+
+ public virtual void ClearItems()
+ {
+ items.ClearChildren ();
+ }
+
+ protected override void loadTemplate(GraphicObject template = null)
+ {
+ base.loadTemplate (template);
+
+ items = this.child.FindByName ("ItemsContainer") as Group;
+ if (items == null)
+ throw new Exception ("TemplatedGroup template Must contain a Group named 'ItemsContainer'");
+ }
+
+ #region GraphicObject overrides
+ public override GraphicObject FindByName (string nameToFind)
+ {
+ if (Name == nameToFind)
+ return this;
+
+ foreach (GraphicObject w in Items) {
+ GraphicObject r = w.FindByName (nameToFind);
+ if (r != null)
+ return r;
+ }
+ return null;
+ }
+ public override bool Contains (GraphicObject goToFind)
+ {
+ foreach (GraphicObject w in Items) {
+ if (w == goToFind)
+ return true;
+ if (w.Contains (goToFind))
+ return true;
+ }
+ return false;
+ }
+ #endregion
+
+ #region IXmlSerialisation Overrides
+ public override void ReadXml(System.Xml.XmlReader reader)
+ {
+ using (System.Xml.XmlReader subTree = reader.ReadSubtree ()) {
+ subTree.Read ();
+ string tmp = subTree.ReadOuterXml ();
+
+ //seek for template tag
+ using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
+ xr.Read ();
+ base.ReadXml (xr);
+ }
+ //process content
+ using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
+ xr.Read (); //skip current node
+
+ while (!xr.EOF) {
+ xr.Read (); //read first child
+
+ if (!xr.IsStartElement ())
+ continue;
+
+ if (xr.Name == "Template" || Name == "ItemTemplate"){
+ xr.Skip ();
+ if (!xr.IsStartElement ())
+ continue;
+ }
+
+ Type t = Type.GetType ("Crow." + xr.Name);
+ if (t == null) {
+ Assembly a = Assembly.GetEntryAssembly ();
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == xr.Name)
+ t = expT;
+ }
+ }
+ if (t == null)
+ throw new Exception (xr.Name + " type not found");
+
+ GraphicObject go = (GraphicObject)Activator.CreateInstance (t);
+
+ (go as IXmlSerializable).ReadXml (xr);
+
+ AddItem (go);
+
+ xr.Read (); //closing tag
+ }
+
+ }
+ }
+ }
+ public override void WriteXml(System.Xml.XmlWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+ }
+}
diff --git a/src/IMLReader.cs b/src/IMLReader.cs
index e4f98ecb..922a48d7 100644
--- a/src/IMLReader.cs
+++ b/src/IMLReader.cs
@@ -107,6 +107,7 @@ namespace Crow
il.Emit (OpCodes.Ldloc_0);//save current go onto the stack if child has to be added
+ #region Template and TemplateItems loading
if (typeof(TemplatedControl).IsAssignableFrom (crowType)) {
//if its a template, first read template elements
using (IMLReader reader = new IMLReader (il, tmpXml)) {
@@ -188,10 +189,12 @@ namespace Crow
}
}
}
+ #endregion
using (IMLReader reader = new IMLReader(il,tmpXml)){
reader.Read ();
+ #region Styling and default values loading
if (reader.HasAttributes) {
string style = reader.GetAttribute ("Style");
if (!string.IsNullOrEmpty (style)) {
@@ -201,7 +204,9 @@ namespace Crow
}
reader.il.Emit (OpCodes.Ldloc_0);
reader.il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetMethod ("loadDefaultValues"));
+ #endregion
+ #region Attributes reading
if (reader.HasAttributes) {
MethodInfo miAddBinding = typeof(GraphicObject).GetMethod ("BindMember");
@@ -229,6 +234,7 @@ namespace Crow
}
reader.MoveToElement ();
}
+ #endregion
if (reader.IsEmptyElement) {
reader.il.Emit (OpCodes.Pop);//pop saved ref to current object
@@ -253,7 +259,7 @@ namespace Crow
case XmlNodeType.Element:
//Templates
if (reader.Name == "Template" ||
- reader.Name == "ItemTemplate") {
+ reader.Name == "ItemTemplate") {
reader.Skip ();
continue;
}
@@ -263,16 +269,18 @@ namespace Crow
miAddChild = typeof(Group).GetMethod ("AddChild");
else if (typeof(Container).IsAssignableFrom (crowType))
miAddChild = typeof(Container).GetMethod ("SetChild");
- else if (typeof(TemplatedContainer).IsAssignableFrom (crowType)&&!templateLoading)
- miAddChild = typeof(TemplatedContainer).GetProperty("Content").GetSetMethod();
+ else if (typeof(TemplatedContainer).IsAssignableFrom (crowType) && !templateLoading)
+ miAddChild = typeof(TemplatedContainer).GetProperty ("Content").GetSetMethod ();
+ else if (typeof(TemplatedGroup).IsAssignableFrom (crowType) && !templateLoading)
+ miAddChild = typeof(TemplatedGroup).GetMethod ("AddItem",
+ BindingFlags.Instance | BindingFlags.Public);
else if (typeof(TemplatedControl).IsAssignableFrom (crowType))
miAddChild = typeof(TemplatedControl).GetMethod ("loadTemplate",
- BindingFlags.Instance | BindingFlags.NonPublic);
+ BindingFlags.Instance | BindingFlags.NonPublic);
else if (typeof(PrivateContainer).IsAssignableFrom (crowType))
miAddChild = typeof(PrivateContainer).GetMethod ("SetChild",
BindingFlags.Instance | BindingFlags.NonPublic);
}
-
//push current instance on stack for parenting
//loc_0 will be used for child
reader.il.Emit (OpCodes.Ldloc_0);
@@ -288,13 +296,15 @@ namespace Crow
if (t == null)
throw new Exception (reader.Name + " type not found");
- reader.il.Emit(OpCodes.Newobj, t.GetConstructors () [0]);//TODO:search parameterless ctor
+ reader.il.Emit (OpCodes.Newobj, t.GetConstructors () [0]);//TODO:search parameterless ctor
reader.il.Emit (OpCodes.Stloc_0);//child is now loc_0
CompilerServices.emitSetCurInterface (il);
- reader.emitLoader(t);
+ reader.emitLoader (t);
reader.il.Emit (OpCodes.Ldloc_0);//load child on stack for parenting
+ if (miAddChild == null)
+ System.Diagnostics.Debugger.Break ();
reader.il.Emit (OpCodes.Callvirt, miAddChild);
reader.il.Emit (OpCodes.Stloc_0); //reset local to current go
reader.il.Emit (OpCodes.Ldloc_0);//save current go onto the stack if child has to be added