aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-10-13 16:57:26 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-10-13 16:57:26 +0200
commit6bedf8d5d0b78ba0705e37375d8dee016e87ebbb (patch)
tree4dabb643902d9ed30d185f9356bc3a17115011f8
parent97536ca0666ce95a598569afbaa8657e54e48439 (diff)
- GraphicTree parsing bindings in templates instead of using
datasource which could be kept for other uses - ListBox bindings debug - LogicalParent for Popper to get correct DataSource for content
-rwxr-xr-xTemplates/Checkbox.goml10
-rwxr-xr-xTemplates/Combobox.goml8
-rwxr-xr-xTemplates/ComboboxOverlay.goml6
-rwxr-xr-xTemplates/Expandable.goml14
-rwxr-xr-xTemplates/Groupbox.goml8
-rwxr-xr-xTemplates/Listbox.goml6
-rw-r--r--Templates/MessageBox.goml20
-rwxr-xr-xTemplates/Popper.goml8
-rwxr-xr-xTemplates/RadioButton.goml6
-rwxr-xr-xTemplates/Scrollbar.goml16
-rwxr-xr-xTemplates/Spinner.goml14
-rwxr-xr-xTemplates/Window.goml16
-rw-r--r--Tests/GOLIBTests.cs9
-rwxr-xr-xTests/Interfaces/testCheckbox.goml2
-rwxr-xr-xTests/Interfaces/testExpandable.goml4
-rwxr-xr-xTests/Interfaces/testPopper.goml4
-rwxr-xr-xTests/Interfaces/test_Listbox.goml6
-rw-r--r--src/CompilerServices/CompilerServices.cs9
-rw-r--r--src/GraphicObjects/Combobox.cs28
-rw-r--r--src/GraphicObjects/Expandable.cs7
-rw-r--r--src/GraphicObjects/GraphicObject.cs34
-rw-r--r--src/GraphicObjects/ListBox.cs10
-rw-r--r--src/GraphicObjects/Popper.cs9
-rw-r--r--src/GraphicObjects/TemplatedContainer.cs11
-rw-r--r--src/GraphicObjects/TemplatedControl.cs3
-rw-r--r--src/Interface.cs2
26 files changed, 168 insertions, 102 deletions
diff --git a/Templates/Checkbox.goml b/Templates/Checkbox.goml
index 44e66817..80ec112d 100755
--- a/Templates/Checkbox.goml
+++ b/Templates/Checkbox.goml
@@ -1,5 +1,9 @@
<?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <Image Margin="2" Width="14" Height="14" Path="{Image}" SvgSub="{SvgSub}"/>
- <Label Text="{Caption}" Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+<!--<HorizontalStack Spacing="1" Height="100" Width="300">
+ <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+ <Label Text="{../../Caption}" Height="80" Width="200"/>
+</HorizontalStack>-->
+<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+ <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Templates/Combobox.goml b/Templates/Combobox.goml
index 21824049..9abd6361 100755
--- a/Templates/Combobox.goml
+++ b/Templates/Combobox.goml
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<Border CornerRadius="0" BorderColor="LightGray" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <HorizontalStack Margin="1" Spacing="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <Label Margin="1" Foreground="Black" Background="White" Text="{Text}"
- Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+<Border CornerRadius="0" BorderColor="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <HorizontalStack Margin="1" Spacing="1" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <Label Margin="1" Foreground="Black" Background="White" Text="{../../../Text}"
+ Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
<Button Width="14" Height="14" >
<Image Margin="0" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>
</Button>
diff --git a/Templates/ComboboxOverlay.goml b/Templates/ComboboxOverlay.goml
index 349be301..4665846f 100755
--- a/Templates/ComboboxOverlay.goml
+++ b/Templates/ComboboxOverlay.goml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{TemplatedHeight}" Width="{TemplatedWidth}" >
+<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
- Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <VerticalStack Height="-1" Width="{TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
+ Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <VerticalStack Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
</Border> \ No newline at end of file
diff --git a/Templates/Expandable.goml b/Templates/Expandable.goml
index 1f3c5281..4e9a8540 100755
--- a/Templates/Expandable.goml
+++ b/Templates/Expandable.goml
@@ -1,11 +1,11 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" BorderColor="LightGray" Height="{TemplatedHeight}" Width="{TemplatedWidth}"
- MouseClick="onMouseClick">
- <VerticalStack Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <HorizontalStack Spacing="1" Height="-1" Width="{TemplatedWidth}">
- <Image Margin="2" Width="12" Height="12" Path="{Image}" SvgSub="{SvgSub}"/>
- <Label Text="{Title}" Width="{TemplatedWidth}"/>
+<Border BorderWidth="1" BorderColor="LightGray" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}"
+ MouseClick="../onMouseClick">
+ <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../../TemplatedWidth}">
+ <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
+ <Label Text="{../../../../Title}" Width="{../../../../TemplatedWidth}"/>
</HorizontalStack>
- <Container Name="Content" Visible="false" Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+ <Container Name="Content" Visible="false" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/Templates/Groupbox.goml b/Templates/Groupbox.goml
index d804aab8..789cd60f 100755
--- a/Templates/Groupbox.goml
+++ b/Templates/Groupbox.goml
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
-<Group Height="{TemplatedHeight}" Width="{TemplatedWidth}">
+<Group Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
<Border CornerRadius="5" BorderWidth="1" Margin="6"
- Height="{TemplatedHeight}" Width="{TemplatedWidth}">
+ Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
<Container Name="Content" Margin="10"
- Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+ Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"/>
</Border>
- <Label Text="{Title}" VerticalAlignment="Top" Left="15"
+ <Label Text="{../../Title}" VerticalAlignment="Top" Left="15"
Background="Clear" Margin="1"/>
</Group> \ No newline at end of file
diff --git a/Templates/Listbox.goml b/Templates/Listbox.goml
index 50922585..28241e27 100755
--- a/Templates/Listbox.goml
+++ b/Templates/Listbox.goml
@@ -2,9 +2,9 @@
<!--<Border BorderWidth="1" Margin="1" MinimumSize="0;100" Height="{TemplatedHeight}" Width="{TemplatedWidth}" Background="Gray">
<VerticalStack Name="List" Margin="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
</Border>-->
-<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{TemplatedHeight}" Width="{TemplatedWidth}" >
+<Border BorderWidth="1" Margin="1" MinimumSize="20;20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" >
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
- Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <VerticalStack Height="-1" Width="{TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
+ Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <VerticalStack Height="-1" Width="{../../../TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
</Border> \ No newline at end of file
diff --git a/Templates/MessageBox.goml b/Templates/MessageBox.goml
index 6488deb9..e2eccd71 100644
--- a/Templates/MessageBox.goml
+++ b/Templates/MessageBox.goml
@@ -1,27 +1,27 @@
<?xml version="1.0"?>
-<Border Height="{TemplatedHeight}" Width="{TemplatedWidth}" BorderWidth="1" BorderColor="White" CornerRadius="10" >
- <VerticalStack Height="{TemplatedHeight}" Width="{TemplatedWidth}" Background="0,4;0,4;0,4;0,4">
- <Border BorderWidth="1" BorderColor="White" Width="{TemplatedWidth}" Height="-1"
+<Border Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" BorderWidth="1" BorderColor="White" CornerRadius="10" >
+ <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}" Background="0,4;0,4;0,4;0,4">
+ <Border BorderWidth="1" BorderColor="White" Width="{../../../TemplatedWidth}" Height="-1"
Background="0,1;0,5;1,0;0,5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{TemplatedWidth}" Height="-1" >
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
<GraphicObject Width="5" Height="5"/>
- <Image Margin="1" Width="12" Height="12" Path="{Icon}"/>
- <Label Foreground="White" Width="{TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{Title}" />
+ <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
+ <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
<Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent" Height="12" Width="12"
MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"
- MouseClick="butQuitPress"/>
+ MouseClick="../../../../../../butQuitPress"/>
</Border>
<GraphicObject Width="5" Height="5"/>
</HorizontalStack>
</Border>
- <HorizontalStack Spacing="10" Margin="10" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
+ <HorizontalStack Spacing="10" Margin="10" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}">
<Image Name="Image" Width="32" Height="32"
Path="#go.Images.Icons.iconInfo.svg" />
- <TextRun Font="serif, 12" Height="{TemplatedHeight}" Width="{TemplatedWidth}" Text="{Message}"
+ <TextRun Font="serif, 12" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Text="{../../../../Message}"
Multiline="true" WordWrap="true"/>
</HorizontalStack>
- <HorizontalStack Height="-1" Width="{TemplatedWidth}" Margin="5">
+ <HorizontalStack Height="-1" Width="{../../../TemplatedWidth}" Margin="5">
<GraphicObject Height="5"/>
<Button Text="Ok"/>
<Button Text="Cancel"/>
diff --git a/Templates/Popper.goml b/Templates/Popper.goml
index 534c677f..472fe183 100755
--- a/Templates/Popper.goml
+++ b/Templates/Popper.goml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" BorderColor="LightGray" Height="-1" Width="{TemplatedWidth}" MouseClick="onMouseClick">
- <HorizontalStack Spacing="1" Height="-1" Width="{TemplatedWidth}">
- <Image Margin="2" Width="12" Height="12" Path="{Image}" SvgSub="{SvgSub}"/>
- <Label Text="{Title}" Width="{TemplatedWidth}"/>
+<Border BorderWidth="1" BorderColor="LightGray" Height="-1" Width="{../TemplatedWidth}" MouseClick="../onMouseClick">
+ <HorizontalStack Spacing="1" Height="-1" Width="{../../TemplatedWidth}">
+ <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
+ <Label Text="{../../../Title}" Width="{../../../TemplatedWidth}"/>
</HorizontalStack>
</Border> \ No newline at end of file
diff --git a/Templates/RadioButton.goml b/Templates/RadioButton.goml
index 44e66817..94b78e24 100755
--- a/Templates/RadioButton.goml
+++ b/Templates/RadioButton.goml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<HorizontalStack Spacing="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <Image Margin="2" Width="14" Height="14" Path="{Image}" SvgSub="{SvgSub}"/>
- <Label Text="{Caption}" Height="{TemplatedHeight}" Width="{TemplatedWidth}"/>
+<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+ <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Templates/Scrollbar.goml b/Templates/Scrollbar.goml
index 0fe9da3d..8dcadc64 100755
--- a/Templates/Scrollbar.goml
+++ b/Templates/Scrollbar.goml
@@ -1,14 +1,14 @@
<?xml version="1.0"?>
<Border BorderWidth="1" BorderColor="LightGray">
- <GenericStack Orientation="{Orientation}" Width="0" Height="0">
- <Button Width="12" Height="12" MouseClick="onScrollBack">
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>
+ <GenericStack Orientation="{../../Orientation}" Width="0" Height="0">
+ <Button Width="12" Height="12" MouseClick="../../../onScrollBack">
+ <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="../../../../up"/>
</Button>
- <Slider Name="Slider" Value="{Scroll}" Maximum="{MaximumScroll}"
- Width="{Width}" Height="{Height}" Orientation="{Orientation}"
- ValueChanged="onSliderValueChange"/>
- <Button Width="12" Height="12" MouseClick="onScrollForth">
- <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>
+ <Slider Name="Slider" Value="{../../../Scroll}" Maximum="{../../../MaximumScroll}"
+ Width="{../../../Width}" Height="{../../../Height}" Orientation="{../../../Orientation}"
+ ValueChanged="../../../onSliderValueChange"/>
+ <Button Width="12" Height="12" MouseClick="../../../onScrollForth">
+ <Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="../../../../down"/>
</Button>
</GenericStack>
</Border> \ No newline at end of file
diff --git a/Templates/Spinner.goml b/Templates/Spinner.goml
index f9bc82b1..ddfa4991 100755
--- a/Templates/Spinner.goml
+++ b/Templates/Spinner.goml
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" Height="{TemplatedHeight}" Width="{TemplatedWidth}" Background="White">
- <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <Label Foreground="DimGray" Height="{TemplatedHeight}" Width="{TemplatedWidth}"
- Text="{Value}" Margin="1" TextAlignment="RightCenter"/>
- <VerticalStack Width="-1" Height="{TemplatedHeight}" Spacing="1" >
- <Button Width="12" Height="8" MouseClick="onUp">
+<Border BorderWidth="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}" Background="White">
+ <HorizontalStack Name="hstack" Margin="0" Spacing="2" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <Label Foreground="DimGray" Height="{../../../TemplatedHeight}" Width="{../../../TemplatedWidth}"
+ Text="{../../../Value}" Margin="1" TextAlignment="RightCenter"/>
+ <VerticalStack Width="-1" Height="{../../../TemplatedHeight}" Spacing="1" >
+ <Button Width="12" Height="8" MouseClick="../../../../onUp">
<Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>
</Button>
- <Button Width="12" Height="8" MouseClick="onDown">
+ <Button Width="12" Height="8" MouseClick="../../../../onDown">
<Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>
</Button>
</VerticalStack>
diff --git a/Templates/Window.goml b/Templates/Window.goml
index d6f08cde..97bad4ce 100755
--- a/Templates/Window.goml
+++ b/Templates/Window.goml
@@ -1,20 +1,20 @@
<?xml version="1.0"?>
-<Border BorderWidth="1" BorderColor="White" CornerRadius="20" Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <VerticalStack Height="{TemplatedHeight}" Width="{TemplatedWidth}">
- <Border BorderWidth="1" BorderColor="White" Width="{TemplatedWidth}" Height="-1"
+<Border BorderWidth="1" BorderColor="White" CornerRadius="20" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+ <VerticalStack Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}">
+ <Border BorderWidth="1" BorderColor="White" Width="{../../../TemplatedWidth}" Height="-1"
Background="0,1;0,5;1,0;0,5">
- <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{TemplatedWidth}" Height="-1" >
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Width="{../../../../TemplatedWidth}" Height="-1" >
<GraphicObject Width="5"/>
- <Image Margin="1" Width="12" Height="12" Path="{Icon}"/>
- <Label Foreground="White" Width="{TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{Title}" />
+ <Image Margin="1" Width="12" Height="12" Path="{../../../../../Icon}"/>
+ <Label Foreground="White" Width="{../../../../../TemplatedWidth}" Margin="1" TextAlignment="Center" Text="{../../../../../Title}" />
<Border CornerRadius="6" BorderWidth="1" BorderColor="Transparent" Height="12" Width="12"
MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"
- MouseClick="butQuitPress"/>
+ MouseClick="../../../../../../butQuitPress"/>
</Border>
<GraphicObject Width="5"/>
</HorizontalStack>
</Border>
- <Container Name="Content" Height="{TemplatedHeight}" Width="{TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
+ <Container Name="Content" Height="{../../../../TemplatedHeight}" Width="{../../../../TemplatedWidth}" Background="0,5;0,5;0,5;0,5"/>
</VerticalStack>
</Border> \ No newline at end of file
diff --git a/Tests/GOLIBTests.cs b/Tests/GOLIBTests.cs
index 13576b24..5fcbbc38 100644
--- a/Tests/GOLIBTests.cs
+++ b/Tests/GOLIBTests.cs
@@ -34,6 +34,8 @@ namespace test
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
+ "test_Listbox.goml",
+ "testCombobox.goml",
"fps.goml",
"testCheckbox.goml",
"testExpandable.goml",
@@ -48,7 +50,6 @@ namespace test
"testMsgBox.goml",
"testGrid.goml",
"testMeter.goml",
-// "testCombobox.goml",
// "test4.goml",
};
@@ -101,7 +102,8 @@ namespace test
base.OnLoad (e);
//this.AddWidget(new test4());
- LoadInterface("Interfaces/" + testFiles[idx]);
+ GraphicObject obj = LoadInterface("Interfaces/" + testFiles[idx]);
+ obj.DataSource = this;
}
protected override void OnUpdateFrame (FrameEventArgs e)
{
@@ -128,7 +130,8 @@ namespace test
if (idx == testFiles.Length)
idx = 0;
this.Title = testFiles [idx];
- LoadInterface("Interfaces/" + testFiles[idx]);
+ GraphicObject obj = LoadInterface("Interfaces/" + testFiles[idx]);
+ obj.DataSource = this;
}
diff --git a/Tests/Interfaces/testCheckbox.goml b/Tests/Interfaces/testCheckbox.goml
index 999d79f9..966455e6 100755
--- a/Tests/Interfaces/testCheckbox.goml
+++ b/Tests/Interfaces/testCheckbox.goml
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
-<Checkbox Width="100" Height="-1" Caption="Checkbox" Background="DimGray" IsChecked="true"/>
+<Checkbox Width="-1" Height="-1" Caption="Checkbox" Background="DimGray" IsChecked="false"/>
diff --git a/Tests/Interfaces/testExpandable.goml b/Tests/Interfaces/testExpandable.goml
index 5cae7ae6..35cf3d64 100755
--- a/Tests/Interfaces/testExpandable.goml
+++ b/Tests/Interfaces/testExpandable.goml
@@ -5,5 +5,9 @@
<Checkbox Name="chk2" IsChecked="true"/>
<Checkbox Name="chk3"/>
<Checkbox Name="chk4"/>
+ <HorizontalStack Fit="true" Margin="20">
+ <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/>
+ </HorizontalStack>
</VerticalStack>
</Expandable>
diff --git a/Tests/Interfaces/testPopper.goml b/Tests/Interfaces/testPopper.goml
index 4c6ba76b..3686599a 100755
--- a/Tests/Interfaces/testPopper.goml
+++ b/Tests/Interfaces/testPopper.goml
@@ -7,6 +7,10 @@
<Checkbox Name="chk2" IsChecked="true"/>
<Checkbox Name="chk3"/>
<Checkbox Name="chk4"/>
+ <HorizontalStack Fit="true" Margin="20">
+ <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
+ <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" Background="AoEnglish"/>
+ </HorizontalStack>
</VerticalStack>
</Border>
</Popper>
diff --git a/Tests/Interfaces/test_Listbox.goml b/Tests/Interfaces/test_Listbox.goml
index b132a87e..9f7645ab 100755
--- a/Tests/Interfaces/test_Listbox.goml
+++ b/Tests/Interfaces/test_Listbox.goml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--<ListBox Data="{TestList}" Focusable="true"/>-->
<ListBox Data="{TestList}" Background="0,5;0,5;0,5;0,5"
- HorizontalAlignment="Left" Width="0" Height="0" Margin="50">
+ HorizontalAlignment="Left" Width="-1" Height="-1" Margin="50">
<!-- <Template>
<Border BorderWidth="1" Margin="1" MinimumSize="100;100" Width="0" Height="0" >
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
@@ -10,13 +10,13 @@
</Scroller>
</Border>
</Template>-->
- <Template>
+<!-- <Template>
<Border BorderWidth="1" Margin="1" MinimumSize="100;100" Height="{TemplatedHeight}" Width="{TemplatedWidth}" >
<Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
Height="{TemplatedHeight}" Width="{TemplatedWidth}">
<VerticalStack Height="-1" Width="{TemplatedWidth}" Name="List" Margin="0" VerticalAlignment="Top"/>
</Scroller>
</Border>
- </Template>
+ </Template>-->
</ListBox>
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs
index c72137df..e7395383 100644
--- a/src/CompilerServices/CompilerServices.cs
+++ b/src/CompilerServices/CompilerServices.cs
@@ -29,6 +29,8 @@ namespace go
}
public bool FindMember(string _memberName)
{
+ if (Instance == null)
+ return false;
Type t = Instance.GetType ();
Member = t.GetMember (_memberName,BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).FirstOrDefault ();
@@ -79,7 +81,7 @@ namespace go
//if binding exp = '{}' => binding is done on datasource
if (string.IsNullOrEmpty (Expression)) {
- Target = new MemberReference (Source.Instance);
+ Target = new MemberReference ((Source.Instance as GraphicObject).DataSource);
return true;
}
@@ -101,7 +103,7 @@ namespace go
if (tmp == null)
return false;
if (bindingExp [ptr] == "..")
- tmp = tmp.Parent as GraphicObject;
+ tmp = tmp.Parent as ILayoutable;
else if (bindingExp [ptr] == ".") {
if (ptr > 0)
throw new Exception ("Syntax error in binding, './' may only appear in first position");
@@ -111,6 +113,9 @@ namespace go
ptr++;
}
+ if (tmp == null)
+ return false;
+
string[] bindTrg = bindingExp [ptr].Split ('.');
if (bindTrg.Length == 1)
diff --git a/src/GraphicObjects/Combobox.cs b/src/GraphicObjects/Combobox.cs
index 02040570..3e841793 100644
--- a/src/GraphicObjects/Combobox.cs
+++ b/src/GraphicObjects/Combobox.cs
@@ -22,7 +22,7 @@ namespace go
{
[DefaultTemplate("#go.Templates.Combobox.goml")]
[DefaultOverlayTemplate("#go.Templates.ComboboxOverlay.goml")]
- public class Combobox : TemplatedContainer
+ public class Combobox : TemplatedControl
{
#region CTOR
public Combobox() : base(){ }
@@ -48,21 +48,22 @@ namespace go
base.loadTemplate (template);
loadOverlayTemplate (null);
}
- public override GraphicObject Content {
- get {
- throw new NotImplementedException ();
- }
- set {
- throw new NotImplementedException ();
- }
- }
+// public override GraphicObject Content {
+// get {
+// throw new NotImplementedException ();
+// }
+// set {
+// throw new NotImplementedException ();
+// }
+// }
#endregion
protected virtual void loadOverlayTemplate(GraphicObject overlayTemplate)
{
if (overlayTemplate == null) {
DefaultOverlayTemplate dt = (DefaultOverlayTemplate)this.GetType ().GetCustomAttributes (typeof(DefaultOverlayTemplate), true).FirstOrDefault ();
- Overlay = Interface.Load (dt.Path, this, !Interface.DontResoveGOML);
+ Overlay = Interface.Load (dt.Path);
+ Overlay.ResolveBindings ();
} else
Overlay = overlayTemplate;
_list = Overlay.FindByName ("List") as Group;
@@ -173,8 +174,9 @@ namespace go
lock (pendingChildrenAddition) {
if (!threadedLoadingFinished && pendingChildrenAddition.Count < 50)
return;
- while (pendingChildrenAddition.Count > 0)
+ while (pendingChildrenAddition.Count > 0) {
_list.addChild (pendingChildrenAddition.Dequeue ());
+ }
}
}
@@ -198,7 +200,8 @@ namespace go
foreach (var item in data) {
ms.Seek(0,SeekOrigin.Begin);
- GraphicObject g = Interface.Load (ms, t, item);
+ GraphicObject g = Interface.Load (ms, t);
+ g.DataSource = item;
g.MouseClick += itemClick;
lock (pendingChildrenAddition) {
@@ -348,5 +351,6 @@ namespace go
base.ClearBinding ();
}
+
}
}
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index 0bc5d067..3d4ef229 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -116,6 +116,11 @@ namespace go
IsExpanded = !IsExpanded;
base.onMouseClick (sender, e);
}
-
+ public override void ResolveBindings ()
+ {
+ base.ResolveBindings ();
+ if (Content != null)
+ Content.ResolveBindings ();
+ }
}
}
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 5d7e0dae..1496e0e5 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -76,6 +76,7 @@ namespace go
#endregion
#region public fields
+ public GraphicObject LogicalParent;
public Rectangle Bounds;
public Rectangle Slot = new Rectangle ();
public object Tag;
@@ -85,8 +86,20 @@ namespace go
#region ILayoutable
[XmlIgnore]public ILayoutable Parent {
get { return _parent; }
- set { _parent = value; }
+ set {
+// if (_parent == value)
+// return;
+// if (_parent != null)
+// ClearBinding ();
+//
+ _parent = value;
+//
+// if (DataSource != null)
+// ResolveBindings ();
+ }
}
+
+
[XmlIgnore]public virtual Rectangle ClientRectangle {
get {
Rectangle cb = Slot.Size;
@@ -336,7 +349,7 @@ namespace go
}
object dataSource;
- [XmlIgnore]public object DataSource {
+ [XmlIgnore]public virtual object DataSource {
set {
if (dataSource == value)
return;
@@ -351,7 +364,8 @@ namespace go
}
get {
return dataSource == null ?
- Parent is GraphicObject ? (Parent as GraphicObject).DataSource : null : dataSource;
+ LogicalParent == null ?
+ Parent is GraphicObject ? (Parent as GraphicObject).DataSource : null : LogicalParent.DataSource : dataSource;
}
}
#endregion
@@ -799,6 +813,8 @@ namespace go
{
List<Binding> resolved = new List<Binding> ();
foreach (Binding b in Bindings) {
+ if (!string.IsNullOrEmpty (b.DynMethodId))
+ continue;
if (b.Source.Member.MemberType == MemberTypes.Event) {
if (b.Expression.StartsWith("{")){
CompileEventSource(b);
@@ -854,9 +870,13 @@ namespace go
Type[] args = {typeof(object), typeof(object),handlerArgsType};
dm = new DynamicMethod(grouped[0].NewDynMethodId,
- typeof(void),
+ MethodAttributes.Family | MethodAttributes.FamANDAssem | MethodAttributes.NewSlot,
+ CallingConventions.Standard,
+ typeof(void),
args,
- sourceType);
+ sourceType,true);
+
+
il = dm.GetILGenerator(256);
@@ -905,7 +925,7 @@ namespace go
}else
throw new Exception ("unandled source member type for binding");
}else if (string.IsNullOrEmpty(b.Expression))
- targetValue= grouped [0].Target;//empty binding exp=> bound to target object by default
+ targetValue= grouped [0].Target.Instance;//empty binding exp=> bound to target object by default
//TODO: handle other dest type conversions
if (b.Source.Property.PropertyType == typeof(string)){
if (targetValue == null){
@@ -925,7 +945,7 @@ namespace go
if (b.Target.Member != null)
il.Emit (OpCodes.Ldstr, b.Target.Member.Name);
else
- il.Emit (OpCodes.Ldstr, b.Expression);
+ il.Emit (OpCodes.Ldstr, b.Expression.Split('/').LastOrDefault());
il.Emit (OpCodes.Callvirt, stringEquals);
il.Emit (OpCodes.Brtrue, jumpTable[i]);
i++;
diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs
index 9f408b5a..15752f80 100644
--- a/src/GraphicObjects/ListBox.cs
+++ b/src/GraphicObjects/ListBox.cs
@@ -91,10 +91,15 @@ namespace go
Thread t = new Thread (loadingThread);
t.Start ();
+ t.Join ();
}
}
-
+ public override void UpdateLayout (LayoutingType layoutType)
+ {
+ CheckPendingChildrenAddition ();
+ base.UpdateLayout (layoutType);
+ }
internal void CheckPendingChildrenAddition()
{
if (pendingChildrenAddition == null)
@@ -127,7 +132,8 @@ namespace go
foreach (var item in data) {
ms.Seek(0,SeekOrigin.Begin);
- GraphicObject g = Interface.Load (ms, t, item);
+ GraphicObject g = Interface.Load (ms, t);
+ g.DataSource = item;
g.MouseClick += itemClick;
lock (pendingChildrenAddition) {
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index e1a02fc6..2ec4396f 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -38,6 +38,7 @@ namespace go
get { return _content; }
set {
if (_content != null) {
+ _content.LogicalParent = null;
_content.LayoutChanged -= _content_LayoutChanged;
_content.MouseLeave -= _content_MouseLeave;
}
@@ -47,6 +48,7 @@ namespace go
if (_content == null)
return;
+ _content.LogicalParent = this;
_content.Focusable = true;
_content.LayoutChanged += _content_LayoutChanged;
_content.MouseLeave += _content_MouseLeave;
@@ -93,7 +95,12 @@ namespace go
}
}
base.ClearBinding ();
-
+ }
+ public override void ResolveBindings ()
+ {
+ base.ResolveBindings ();
+ if (Content != null)
+ Content.ResolveBindings ();
}
[XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs
index dcea97d7..cef8266b 100644
--- a/src/GraphicObjects/TemplatedContainer.cs
+++ b/src/GraphicObjects/TemplatedContainer.cs
@@ -35,14 +35,17 @@ namespace go
#region GraphicObject overrides
public override void ClearBinding ()
{
- if (Content != null) {
- //fix datasource = null to clear bindings, but it's illogic
- Content.DataSource = this.DataSource;
+ if (Content != null)
Content.ClearBinding ();
- }
base.ClearBinding ();
}
+// public override void ResolveBindings ()
+// {
+// base.ResolveBindings ();
+// if (Content != null)
+// Content.ResolveBindings ();
+// }
public override GraphicObject FindByName (string nameToFind)
{
if (Name == nameToFind)
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index e203c0cf..d6c7243d 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -115,7 +115,8 @@ namespace go
{
if (template == null) {
DefaultTemplate dt = (DefaultTemplate)this.GetType ().GetCustomAttributes (typeof(DefaultTemplate), true).FirstOrDefault();
- this.SetChild (Interface.Load (dt.Path, this,!Interface.DontResoveGOML));
+ this.SetChild (Interface.Load (dt.Path, this));
+ this.child.ResolveBindings ();
}else
this.SetChild (template);
}
diff --git a/src/Interface.cs b/src/Interface.cs
index 2ce0266b..ddd2a008 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -441,7 +441,7 @@ namespace go
XmlSerializer xs = new XmlSerializer (type);
result = (GraphicObject)xs.Deserialize (stream);
- result.DataSource = hostClass;
+ //result.DataSource = hostClass;
#if DEBUG_LOAD_TIME
loadingTime.Stop ();