aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rw-r--r--Templates/TreeView.crow2
-rw-r--r--Tests/BasicTests.cs10
-rwxr-xr-xTests/Interfaces/Divers/testWindow2.goml55
-rw-r--r--Tests/Interfaces/Divers/welcome.crow7
-rwxr-xr-xTests/Interfaces/Unsorted/test4.crow169
-rwxr-xr-xTests/Interfaces/Unsorted/testDirViewer.crow6
-rwxr-xr-xTests/Interfaces/Unsorted/testTreeView.crow37
-rw-r--r--Tests/OpenTKGameWindow.cs5
-rw-r--r--Tests/Tests.csproj4
-rw-r--r--Tests/test.style13
-rw-r--r--src/GraphicObjects/ListBox.cs89
-rw-r--r--src/GraphicObjects/TemplatedControl.cs27
-rw-r--r--src/IMLStream.cs4
-rw-r--r--src/Interface.cs10
14 files changed, 147 insertions, 291 deletions
diff --git a/Templates/TreeView.crow b/Templates/TreeView.crow
index 82d2c3e9..8915e154 100644
--- a/Templates/TreeView.crow
+++ b/Templates/TreeView.crow
@@ -1,6 +1,6 @@
<Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100,100"
Width="{../WidthPolicy}" Height="{../HeightPolicy}">
- <VerticalStack Width="{../WidthPolicy}" Height="{../HeightPolicy}"
+ <VerticalStack Width="{../../WidthPolicy}" Height="{../../HeightPolicy}"
Name="List" Margin="0" VerticalAlignment="Top"/>
</Border>
diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs
index 0733f189..0c515aa6 100644
--- a/Tests/BasicTests.cs
+++ b/Tests/BasicTests.cs
@@ -3,6 +3,7 @@ using Crow;
using System.Collections.Generic;
using System.Linq;
using System.IO;
+using System.Reflection;
namespace Tests
@@ -19,7 +20,10 @@ namespace Tests
#region Test values for Binding
public int intValue = 25;
-
+ DirectoryInfo curDir = new DirectoryInfo (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
+ public FileSystemInfo[] CurDirectory {
+ get { return curDir.GetFileSystemInfos (); }
+ }
public int IntValue {
get {
return intValue;
@@ -105,6 +109,10 @@ namespace Tests
GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow.goml");
w.DataSource = this;
return;
+ } else if (e.Key == OpenTK.Input.Key.F5) {
+ GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow2.goml");
+ w.DataSource = this;
+ return;
} else if (e.Key == OpenTK.Input.Key.F2)
idx--;
else if (e.Key == OpenTK.Input.Key.F3)
diff --git a/Tests/Interfaces/Divers/testWindow2.goml b/Tests/Interfaces/Divers/testWindow2.goml
index 6fb61db0..7f0caf31 100755
--- a/Tests/Interfaces/Divers/testWindow2.goml
+++ b/Tests/Interfaces/Divers/testWindow2.goml
@@ -1,26 +1,33 @@
<?xml version="1.0"?>
-<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="{../HeightPolicy}" Width="{../WidthPolicy}">
- <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <Border BorderWidth="1" Foreground="White" Width="{../../../WidthPolicy}" Height="Fit"
- Background="0.1,0.5;1,0,0.5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../WidthPolicy}" 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}" />
- <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"
- MouseClick="../../../../../../butQuitPress"/>
- </Border>
- <GraphicObject Width="5"/>
- </HorizontalStack>
- </Border>
- <Container Name="Content" Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
- </VerticalStack>
- </Border>
- </Template>
- <GraphicObject Height="50" Width="50" Background="Green"/>
+<Window Focusable="true" Title="Measures" Width="30%" Height="Fit" MinimumSize="100,100">
+ <VerticalStack Width="90%" Height="Fit" Spacing="1" Margin="10">
+ <HorizontalStack Height="Fit">
+ <Label Text="Fps:" Style="FpsLabel"/>
+ <Label Text="{fps}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Min:" Style="FpsLabel"/>
+ <Label Text="{fpsMin}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Max:" Style="FpsLabel"/>
+ <Label Text="{fpsMax}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Update:" Style="FpsLabel"/>
+ <Label Text="{update}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Layouting:" Style="FpsLabel"/>
+ <Label Text="{layouting}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Clipping:" Style="FpsLabel"/>
+ <Label Text="{clipping}" Style="FpsDisp"/>
+ </HorizontalStack>
+ <HorizontalStack Height="Fit">
+ <Label Text="Drawing:" Style="FpsLabel"/>
+ <Label Text="{drawing}" Style="FpsDisp"/>
+ </HorizontalStack>
+ </VerticalStack>
</Window>
diff --git a/Tests/Interfaces/Divers/welcome.crow b/Tests/Interfaces/Divers/welcome.crow
index 8a98b380..65fc3577 100644
--- a/Tests/Interfaces/Divers/welcome.crow
+++ b/Tests/Interfaces/Divers/welcome.crow
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<VerticalStack>
- <Label Text="Press &lt;F3&gt; to cycle into the examples"/>
- <Label Text="Those are basic tests used to validate changes"/>
+<VerticalStack Fit="true" VerticalAlignment="Top" Background="0.7,0.7,0.7,0.5"
+ Margin="10" CornerRadius="10">
+ <Label Font="20" Text="Press &lt;F3&gt; to cycle into the examples"/>
+ <Label Font="20" Text="Those are basic tests used to validate changes"/>
</VerticalStack> \ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/test4.crow b/Tests/Interfaces/Unsorted/test4.crow
deleted file mode 100755
index 06476f31..00000000
--- a/Tests/Interfaces/Unsorted/test4.crow
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0"?>
-<Group Name="MainGrp"
- Width="800" Height="500"
- Background="0.5,0.5,0.5,0.5" Foreground="White"
- Margin="10" >
- <Border Margin="10" CornerRadius="10"
- Name="mainBorder"
- BorderWidth="2" Foreground="Transparent"
- Focusable="True"
- MouseEnter="{Foreground = White}"
- MouseLeave="{Foreground = Transparent}">
- <HorizontalStack WidgetSpacing="1">
- <VerticalStack Width="Fit">
- <HorizontalStack WidgetSpacing="1" Fit="true">
- <VerticalStack Fit="true">
- <Label Text="{MousePosition}"/>
- <HorizontalStack Name="hsFocus" Fit="true">
- <Label Text="Focused:"/>
- <Label Name="labFocus"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Active:" Name="hsActive"/>
- <Label Name="labActive"/>
- </HorizontalStack>
- <HorizontalStack Fit="true">
- <Label Text="Hover:" Name="hsHover"/>
- <Label Name="labHover"/>
- </HorizontalStack>
- </VerticalStack>
- <VerticalStack Fit="true">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
-
- </VerticalStack>
- <VerticalStack Fit="true">
- <RadioButton IsChecked="true"/>
- <RadioButton/>
- <Button MouseClick="onButClick"/>
- </VerticalStack>
- </HorizontalStack>
- <TextBox Name="textbox1" TextAlignment="Left" Font="droid,14"
- Width="200" Height="Fit" Margin="2" Background="White"
- Forground="Black"
- Foreground="DimGray" BorderWidth="1"
- Text="editable text"/>
- <Popper Width="100">
- <Border Fit="True" Background="ArmyGreen">
- <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
- </Border>
- </Popper>
-
- </VerticalStack>
- <VerticalStack Fit="true" Margin="0" WidgetSpacing="1">
- <Button Margin="1" Width="150" Height="100">
- <Image Path="#Tests.image.tetra.png"/>
- </Button>
- <Popper Width="100">
- <Border Fit="True" Background="ArmyGreen">
- <Image Margin="10" Fit="true" Path="#Crow.Images.Icons.tetra.png"/>
- </Border>
- </Popper>
- <Expandable Name="expander" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
- <CheckBox Name="chk3"/>
- <CheckBox Name="chk4"/>
- </VerticalStack>
- </Expandable>
- <Expandable Name="expander2" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1"/>
- <CheckBox Name="chk2" IsChecked="true"/>
- </VerticalStack>
- </Expandable>
- <Expandable Name="expander3" Width="150" Height="Fit">
- <VerticalStack Name="vsExpanded" Width="100">
- <CheckBox Name="chk1" IsChecked="true"/>
- <CheckBox Name="chk2"/>
- </VerticalStack>
- </Expandable>
- <HorizontalStack>
- <Label Text="Update" FontColor="White"/>
- <Label Name="labUpdate" Text="{update}" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Fps:" Width = "30"/>
- <Label Name="labFps" Text="{fps}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Min:" Width = "30"/>
- <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- <HorizontalStack>
- <Label Text="Max:" Width = "30"/>
- <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"
- TextAlignment="Center" Background="AoEnglish"/>
- </HorizontalStack>
- </VerticalStack>
- <HorizontalStack Width="Fit">
- <Scroller Name="scroller1" Background="DimGray" Width="Fit"
- Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
- <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1" Fit="true">
-<!-- <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
- BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
- Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/> -->
- </VerticalStack>
- </Scroller>
- <ScrollBar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
- Orientation="Vertical" Width="10" Height="Stretched"/>
- </HorizontalStack>
- </HorizontalStack>
-<!-- <HorizontalStack Name="hs0"
- WidgetSpacing="1"
- VerticalAlignment="Top">
- <Slider Orientation="Vertical" Height="300" Width="10" Background="Transparent" />
- <VerticalStack Name="vs1" Spacing="5">
- <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
- <HorizontalStack WidgetSpacing="10">
-
-
- <Spinner Width="50" Value="5"></Spinner>
- </HorizontalStack>
- <HorizontalStack Name="hsPbar" Margin="5">
- <ProgressBar Name="pbBar"
- Width="200" Height="20"
- Minimum="0"
- Maximum="200"
- Value="{fps}"
- Foreground="BlueCrayola" Background="DarkGray"
- BorderWidth="2" Foreground="White"/>
- </HorizontalStack>
-
- <Button Margin="5" BorderWidth="Stretched" Width="Fit" Height="Fit" HorizontalAlignment="Center">
- <Label FontSize="18" Text="This is a test" Margin="5" Foreground="Black" />
- </Button>
-
- <GroupBox Title="Group Box" Width="300" Height="100"
- Foreground="White" BorderWidth="2" Margin="3">
- <Label Name="labValue" FontSize="14" Text="{../../slider.Value}" TextAlignment="Center"/>
- </GroupBox>
- <Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />
- <GraduatedSlider Name="slider" Height="30" Width="300" Foreground="BlueBell"/>
- </VerticalStack>
-
- <HorizontalStack Height="350" Width="Fit">
- <Scroller Name="scroller1" Background="DimGray" Height="Stretched" Width="Fit"
- Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
- <VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">
- <ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
- BorderWidth="2" Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- <ProgressBar Width="100" Height="20" Value="{fps}" BorderWidth="2"
- Foreground="White" Foreground="BlueCrayola" Background="DarkGray"/>
- </VerticalStack>
- </Scroller>
- <Scrollbar Name="scrollbar1" Scroll="{../scroller1.ScrollY}" MaximumScroll="{../scroller1.MaximumScroll}"
- Orientation="Vertical" Width="16" />
- </HorizontalStack>
- </HorizontalStack>
--->
-<!-- <Slider
- Height="20" Width="100"
- Background="Transparent"
- VerticalAlignment="Bottom" />-->
- </Border>
-</Group> \ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/testDirViewer.crow b/Tests/Interfaces/Unsorted/testDirViewer.crow
index af170947..bc25428e 100755
--- a/Tests/Interfaces/Unsorted/testDirViewer.crow
+++ b/Tests/Interfaces/Unsorted/testDirViewer.crow
@@ -1,17 +1,17 @@
<?xml version="1.0"?>
<VerticalStack Height="Fit" Width="Fit" Name="hstack" Margin="0" Spacing="0">
- <Border Height="Fit" Width="200" BorderWidth="2" CornerRadius="10">
+ <Border Height="100%" Width="50%" BorderWidth="2" CornerRadius="10">
<Label Name="labName" Text="{Name}" Width="Stretched" Height="Fit"/>
</Border>
<ListBox Data="{GetFileSystemInfos}" Width="Fit" Height="400"
Background="0.5,0.5,0.5,0.5"
- SelectedItemChanged="OnSelectedItemChanged"
+ SelectedItemChanged="OnSelectedItemChanged"
ItemTemplate="Interfaces/tmpDirItem.goml" >
<Template>
<Border BorderWidth="1" MinimumSize="20,20" 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.Scroll}">
<VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
diff --git a/Tests/Interfaces/Unsorted/testTreeView.crow b/Tests/Interfaces/Unsorted/testTreeView.crow
index 9504c958..c998af39 100755
--- a/Tests/Interfaces/Unsorted/testTreeView.crow
+++ b/Tests/Interfaces/Unsorted/testTreeView.crow
@@ -1,2 +1,37 @@
<?xml version="1.0"?>
-<TreeView Height="400" Width="200" Data="{List2}" ItemTemplate="#Crow.Templates.TreeItem.crow"/> \ No newline at end of file
+<TreeView Height="90%" Width="90%" Data="{CurDirectory}">
+ <ItemTemplate DataType="System.IO.FileInfo">
+ <Label Background="Mantis" Text="{}" Width="Stretched"/>
+<!-- <Expandable Caption="{}">
+ <Template>
+ <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
+ MouseClick="../onMouseClick">
+ <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
+ <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
+ <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+ </VerticalStack>
+ </Border>
+ </Template>
+ </Expandable>-->
+ </ItemTemplate>
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
+ <Expandable Caption="{Name}" >
+ <Template>
+ <VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
+ <Image Margin="2" Width="12" Height="12"
+ Visible="{../../../HasContent}"
+ Path="{../../../Image}"
+ SvgSub="{../../../IsExpanded}"/>
+ <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false"
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+ </VerticalStack>
+ </Template>
+ </Expandable>
+ </ItemTemplate>
+</TreeView> \ No newline at end of file
diff --git a/Tests/OpenTKGameWindow.cs b/Tests/OpenTKGameWindow.cs
index 2b3bdb24..9b4d0a06 100644
--- a/Tests/OpenTKGameWindow.cs
+++ b/Tests/OpenTKGameWindow.cs
@@ -61,11 +61,13 @@ namespace Crow
ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps));
#if MEASURE_TIME
ValueChanged.Raise (this, new ValueChangeEventArgs ("update",
- this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
+ this.CrowInterface.updateTime.ElapsedTicks.ToString () + " ticks"));
ValueChanged.Raise (this, new ValueChangeEventArgs ("layouting",
this.CrowInterface.layoutTime.ElapsedTicks.ToString () + " ticks"));
ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing",
this.CrowInterface.drawingTime.ElapsedTicks.ToString () + " ticks"));
+ ValueChanged.Raise (this, new ValueChangeEventArgs ("clipping",
+ this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks"));
#endif
}
}
@@ -82,6 +84,7 @@ namespace Crow
public string update = "";
public string drawing = "";
public string layouting = "";
+ public string clipping = "";
#endregion
#region ctor
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index d365c060..56e6a1ec 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -308,9 +308,6 @@
<None Include="Interfaces\Unsorted\testColorList.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\Unsorted\test4.crow">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\Unsorted\test6.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -372,6 +369,7 @@
<EmbeddedResource Include="ui\LabelButton.style" />
<EmbeddedResource Include="ui\Popper.template" />
<EmbeddedResource Include="ui\MenuItem.style" />
+ <EmbeddedResource Include="test.style" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crow.csproj">
diff --git a/Tests/test.style b/Tests/test.style
new file mode 100644
index 00000000..a05c930d
--- /dev/null
+++ b/Tests/test.style
@@ -0,0 +1,13 @@
+FpsLabel {
+ Width = 50%;
+ Font = droid, 10;
+ Margin = 1;
+ TextAlignment = Center;
+ Background = Jet;
+}
+FpsDisp {
+ Font = droid , 12;
+ Width = 50%;
+ TextAlignment = Center;
+ Background = Teal;
+}
diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs
index c315d81d..826eb388 100644
--- a/src/GraphicObjects/ListBox.cs
+++ b/src/GraphicObjects/ListBox.cs
@@ -112,11 +112,11 @@ namespace Crow
}
#endregion
void loading(){
- if (itemTemplates == null) {
+ if (itemTemplates == null)
itemTemplates = new Dictionary<string, IMLStream> ();
- //TODO:check encoding
+ if (!itemTemplates.ContainsKey ("default"))
itemTemplates["default"] = new IMLStream (ItemTemplate);
- }
+
for (int i = 1; i <= (data.Count / itemPerPage) + 1; i++) {
if (cancelLoading)
return;
@@ -160,23 +160,30 @@ namespace Crow
return;
GraphicObject g = null;
+ IMLStream itemStream = null;
Type dataType = data [i].GetType ();
- if (itemTemplates.ContainsKey (dataType.FullName))
- g = Interface.Load (itemTemplates [dataType.FullName]);
- else if (itemTemplates.ContainsKey ("default"))
- g = Interface.Load (itemTemplates ["default"]);
- g.MouseClick += itemClick;
+ if (itemTemplates.ContainsKey (dataType.FullName)) {
+ itemStream = itemTemplates [dataType.FullName];
+ } else {
+ itemStream = itemTemplates ["default"];
+ }
- lock (Interface.CurrentInterface.UpdateMutex)
+ lock (Interface.CurrentInterface.UpdateMutex) {
+ g = Interface.Load (itemStream);
page.AddChild (g);
- g.DataSource = data [i];
+ g.DataSource = data [i];
+ }
+ g.MouseClick += itemClick;
+ if (!string.IsNullOrEmpty (itemStream.Datas)) {
+
+ }
//g.LogicalParent = this;
}
lock (Interface.CurrentInterface.UpdateMutex)
_list.AddChild (page);
-
+
#if DEBUG_LOAD
loadingTime.Stop ();
Debug.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms",
@@ -216,66 +223,6 @@ namespace Crow
void itemClick(object sender, MouseButtonEventArgs e){
SelectedIndex = data.IndexOf((sender as GraphicObject).DataSource);
}
-
- #region IXmlSerializable
-// public override System.Xml.Schema.XmlSchema GetSchema(){ return null; }
-// public override void ReadXml(System.Xml.XmlReader reader)
-// {
-// //Template could be either an attribute containing path or expressed inlined
-// //as a Template Element
-// using (System.Xml.XmlReader subTree = reader.ReadSubtree())
-// {
-// subTree.Read ();
-//
-// string template = reader.GetAttribute ("Template");
-// string tmp = subTree.ReadOuterXml ();
-//
-// //Load template from path set as attribute in templated control
-// if (string.IsNullOrEmpty (template)) {
-// //seek for template tag first
-// using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
-// //load template first if inlined
-//
-// xr.Read (); //skip current node
-//
-// while (!xr.EOF) {
-// xr.Read (); //read first child
-// if (!xr.IsStartElement ())
-// continue;
-// if (xr.Name == "Template") {
-// xr.Read ();
-//
-// Type t = Type.GetType ("Crow." + xr.Name);
-// GraphicObject go = (GraphicObject)Activator.CreateInstance (t);
-// (go as IXmlSerializable).ReadXml (xr);
-//
-// loadTemplate (go);
-//
-// xr.Read ();//go close tag
-// xr.Read ();//Template close tag
-// break;
-// } else {
-// xr.ReadInnerXml ();
-// }
-// }
-// }
-// } else
-// loadTemplate (Interface.Load (template, this));
-//
-//
-// //normal xml read
-// using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
-// xr.Read ();
-// base.ReadXml(xr);
-// }
-// }
-// }
-// public override void WriteXml(System.Xml.XmlWriter writer)
-// {
-// //TODO:
-// throw new NotImplementedException();
-// }
- #endregion
}
}
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index 5b7df01d..590ca84b 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -131,14 +131,16 @@ namespace Crow
using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
//load template first if inlined
- xr.Read (); //skip current node
+ xr.Read (); //read first child
+ xr.Read (); //skip root node
- while (!xr.EOF) {
- xr.Read (); //read first child
- if (!xr.IsStartElement ())
+ while (!xr.EOF) {
+ if (!xr.IsStartElement ()) {
+ xr.Read ();
continue;
+ }
if (xr.Name == "ItemTemplate") {
- string dataType = "default", datas, itemTmp;
+ string dataType = "default", datas = "", itemTmp;
while (xr.MoveToNextAttribute ()) {
if (xr.Name == "DataType")
dataType = xr.Value;
@@ -147,13 +149,16 @@ namespace Crow
}
xr.MoveToElement ();
itemTmp = xr.ReadInnerXml ();
- xr.Read ();//itemTemplate close tag
+
if (itemTemplates == null)
itemTemplates = new Dictionary<string, IMLStream> ();
//TODO:check encoding
itemTemplates[dataType] = new IMLStream (Encoding.UTF8.GetBytes(itemTmp));
+ itemTemplates [dataType].Datas = datas;
- }else if (xr.Name == "Template") {
+ continue;
+ }
+ if (xr.Name == "Template") {
xr.Read ();
Type t = Type.GetType ("Crow." + xr.Name);
@@ -161,11 +166,9 @@ namespace Crow
(go as IXmlSerializable).ReadXml (xr);
loadTemplate (go);
-
- xr.Read ();//go close tag
- //xr.Read ();//Template close tag
- } else
- xr.ReadInnerXml ();
+ continue;
+ }
+ xr.ReadInnerXml ();
}
}
} else
diff --git a/src/IMLStream.cs b/src/IMLStream.cs
index 776a70e7..7207327d 100644
--- a/src/IMLStream.cs
+++ b/src/IMLStream.cs
@@ -25,7 +25,9 @@ namespace Crow
{
public class IMLStream : MemoryStream {
public Type RootType;
- public IMLStream(string path) : base (){
+ //TODO:this has nothing to do in there, I should derive IMLStream
+ public string Datas;
+ public IMLStream(string path) : base (){
using (Stream stream = Interface.GetStreamFromPath (path))
stream.CopyTo (this);
RootType = Interface.GetTopContainerOfXMLStream (this);
diff --git a/src/Interface.cs b/src/Interface.cs
index 208bd2a4..3cfed981 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -284,7 +284,7 @@ namespace Crow
#if MEASURE_TIME
public Stopwatch clippingTime = new Stopwatch ();
public Stopwatch layoutTime = new Stopwatch ();
- public Stopwatch guTime = new Stopwatch ();
+ public Stopwatch updateTime = new Stopwatch ();
public Stopwatch drawingTime = new Stopwatch ();
#endif
@@ -377,12 +377,20 @@ namespace Crow
if (!Monitor.TryEnter (UpdateMutex))
return;
+ #if MEASURE_TIME
+ updateTime.Restart();
+ #endif
+
processLayouting ();
clippingRegistration ();
processDrawing ();
+ #if MEASURE_TIME
+ updateTime.Stop ();
+ #endif
+
Monitor.Exit (UpdateMutex);
}
void processLayouting(){