diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-07 16:19:58 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-07 16:19:58 +0200 |
| commit | 967f9bbeca46517f3d94d1eb4b04a3e36c8a31f0 (patch) | |
| tree | d6fb1e98074c85ecdb934c964da8418c16652baf | |
| parent | ac08ff01dbc59628a94a6e09cd0aff07f588f05f (diff) | |
Dynamic layouting debug and improvments
| -rwxr-xr-x | Templates/Window.goml | 2 | ||||
| -rw-r--r-- | Tests/GOLIBTest_4.cs | 3 | ||||
| -rw-r--r-- | Tests/GOLIBTest_stack.cs | 10 | ||||
| -rwxr-xr-x | Tests/Interfaces/test4.goml | 4 | ||||
| -rwxr-xr-x | Tests/Interfaces/testWindow.goml | 23 | ||||
| -rwxr-xr-x | Tests/Interfaces/test_stack.goml | 13 | ||||
| -rw-r--r-- | Tests/Tests.csproj | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/GenericStack.cs | 11 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 6 | ||||
| -rw-r--r-- | src/GraphicObjects/Window.cs | 4 |
10 files changed, 40 insertions, 38 deletions
diff --git a/Templates/Window.goml b/Templates/Window.goml index d082ca02..2ec25987 100755 --- a/Templates/Window.goml +++ b/Templates/Window.goml @@ -9,6 +9,6 @@ MouseEnter="{Background=Red}" MouseLeave="{Background=Transparent}" MouseClick="butQuitPress"/>
</HorizontalStack>
</Border>
- <Container Name="Content" Margin="1" Width="0" Height="0"/>
+ <Container Name="Content" Margin="0" Width="0" Height="0"/>
</VerticalStack>
</Border>
\ No newline at end of file diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs index 8b1c7cd2..141f41d8 100644 --- a/Tests/GOLIBTest_4.cs +++ b/Tests/GOLIBTest_4.cs @@ -83,9 +83,6 @@ namespace test {
base.OnLoad (e);
- this.Cursor = XCursor.NE;
-
-
LoadInterface("Interfaces/test4.goml", out c);
//LoadInterface("golibtests/test4.xml", out c2);
//c2.HorizontalAlignment = HorizontalAlignment.Left;
diff --git a/Tests/GOLIBTest_stack.cs b/Tests/GOLIBTest_stack.cs index 2164c721..18490d6d 100644 --- a/Tests/GOLIBTest_stack.cs +++ b/Tests/GOLIBTest_stack.cs @@ -22,20 +22,12 @@ namespace test : base(1024, 600,"test")
{}
- VerticalStack g;
-
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- LoadInterface("Interfaces/test_stack.goml", out g);
+ LoadInterface("Interfaces/test_stack.goml");
}
- protected override void OnRenderFrame (FrameEventArgs e)
- {
- GL.Clear (ClearBufferMask.ColorBufferBit);
- base.OnRenderFrame (e);
- SwapBuffers ();
- }
protected override void OnUpdateFrame (FrameEventArgs e)
{
diff --git a/Tests/Interfaces/test4.goml b/Tests/Interfaces/test4.goml index 02dadec8..4d824a2e 100755 --- a/Tests/Interfaces/test4.goml +++ b/Tests/Interfaces/test4.goml @@ -134,8 +134,8 @@ TextAlignment="Center" Background="AoEnglish"/>
</HorizontalStack>
</VerticalStack>
- <HorizontalStack Height="350" Width="150">
- <Scroller Name="scroller1" Background="DimGray" Height="0" Width="0"
+ <HorizontalStack Height="350" Width="-1">
+ <Scroller Name="scroller1" Background="DimGray" Height="0" Width="-1"
Margin="5" VerticalScrolling="true" ScrollY="{../scrollbar1.Scroll}">
<VerticalStack Name="colors" VerticalAlignment="Top" Margin="1">
<ProgressBar Name="pbBar2" Width="100" Height="20" Value="50"
diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml index d4246ac2..ae9cbc25 100755 --- a/Tests/Interfaces/testWindow.goml +++ b/Tests/Interfaces/testWindow.goml @@ -2,23 +2,28 @@ <!--<Group>-->
<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,5"
Focusable="True">
- <VerticalStack Height="0" Width="0">
- <Slider Name="slider" Height="10" Width="150"/>
- <Label Text="{fps}" Background="DarkRed"/>
- <Label Text="{fpsMin}" />
- <Label Text="{fpsMax}" />
- <HorizontalStack Width="150" Height="-1" Margin="5" Background="Red">
+ <VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="1" Spacing="10">
+ <Slider Name="slider" Height="20" Width="0"/>
+
+ <HorizontalStack Width="0" Height="-1" Margin="0" Background="Red">
<Checkbox Height="-1" Width="-1"/>
<Checkbox Height="-1" Width="-1"/>
</HorizontalStack>
- <GroupBox Title="test" Height="-1" Width="-1" Margin="5">
- <VerticalStack Width="100">
+ <GroupBox Title="test" Height="0" Width="0" Margin="0">
+ <VerticalStack Width="0">
<RadioButton Caption="Radio 1"/>
<RadioButton Caption="Radio 2" IsChecked="true"/>
<RadioButton Caption="Radio 3"/>
-
+ <RadioButton Caption="Radio 4"/>
+ <RadioButton Caption="Radio 5"/>
+ <RadioButton Caption="Radio 6"/>
+ <RadioButton Caption="Radio 7"/>
</VerticalStack>
</GroupBox>
+<!-- <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
</VerticalStack>
</Window>
<!--</Group>-->
+<!-- <Label Text="{fps}" Background="DarkRed"/>
+ <Label Text="{fpsMin}" />
+ <Label Text="{fpsMax}" />-->
\ No newline at end of file diff --git a/Tests/Interfaces/test_stack.goml b/Tests/Interfaces/test_stack.goml index a1b4b4e0..2991a92e 100755 --- a/Tests/Interfaces/test_stack.goml +++ b/Tests/Interfaces/test_stack.goml @@ -1,7 +1,7 @@ <?xml version="1.0"?>
-<VerticalStack Background="DarkBlue" Height="-1" Width="200">
- <Label Text="label11" Width="0" Background="Green"/>
- <Label Text="label21"/>
+<VerticalStack Background="DarkBlue" Height="300" Width="200">
+<!-- <Label Text="label11" Width="0" Background="Green"/>
+ <Label Text="label21"/>-->
<!-- <HorizontalStack Width="-1" Height="-1" Margin="5"
Focusable="True" Background="Blue">
<Label Text="label12"/>
@@ -11,7 +11,10 @@ <Label Text="label52"/>
</HorizontalStack>
<Label Text="label33" Background="Green" Width="0"/>-->
+<!-- <Label Text="label43"/>-->
+ <Border Margin="10">
+ <Label Text="label53" Background="Red" Height="0" CornerRadius="10"/>
+ </Border>
+ <Label Text="label43"/>
<Label Text="label43"/>
- <Label Text="label53"/>
-
</VerticalStack>
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index c3aca549..a85eadf0 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ <OutputType>Exe</OutputType> <RootNamespace>Tests</RootNamespace> <AssemblyName>Tests</AssemblyName> - <StartupObject>test3.GOLIBTest_HStack</StartupObject> + <StartupObject>test.GOLIBTest_4</StartupObject> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <OutputPath>..\bin\$(configuration)</OutputPath> <IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath> diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index fc7aa247..2f9aede9 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -68,13 +68,13 @@ namespace go if (Orientation == Orientation.Horizontal) {
foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
tmp.Width += c.Slot.Width + Spacing;
- tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom);
+ tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
}
if (tmp.Width > 0)
tmp.Width -= Spacing;
} else {
foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
- tmp.Width = Math.Max (tmp.Width, c.Slot.Right);
+ tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
tmp.Height += c.Slot.Height + Spacing;
}
if (tmp.Height > 0)
@@ -125,13 +125,13 @@ namespace go else if (gobjs.Length == 1) {
int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Width);
if (sz < Slot.Width) {
- gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing;
+ gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing - 2 * Margin;
int idx = Children.IndexOf (gobjs [0]);
if (idx > 0 && idx < Children.Count - 1)
gobjs [0].Slot.Width -= Spacing;
if (gobjs [0].LastSlots.Width != gobjs [0].Slot.Width) {
gobjs [0].bmp = null;
- //gobjs [0].OnLayoutChanges (LayoutingType.Width);
+ gobjs [0].OnLayoutChanges (LayoutingType.Width);
gobjs [0].LastSlots.Width = gobjs [0].Slot.Width;
}
}
@@ -145,12 +145,13 @@ namespace go else if (gobjs.Length == 1) {
int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Height);
if (sz < Slot.Height) {
- gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing;
+ gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing - 2 * Margin;
int idx = Children.IndexOf (gobjs [0]);
if (idx > 0 && idx < Children.Count - 1)
gobjs [0].Slot.Height -= Spacing;
if (gobjs [0].LastSlots.Height != gobjs [0].Slot.Height) {
gobjs [0].bmp = null;
+ gobjs [0].OnLayoutChanges (LayoutingType.Height);
gobjs [0].LastSlots.Height = gobjs [0].Slot.Height;
}
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 41294231..b21598c9 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -125,6 +125,9 @@ namespace go int crw = ClientRectangle.Width;
foreach (GraphicObject c in Children.Where(ch => ch.Slot.Width != crw && ch.Visible))
c.RegisterForLayouting ((int)LayoutingType.X);
+ } else {
+ foreach (GraphicObject c in Children.Where(ch => ch.Width == 0 && ch.Visible))
+ c.RegisterForLayouting ((int)LayoutingType.Width);
}
break;
case LayoutingType.Height:
@@ -132,6 +135,9 @@ namespace go int crh = ClientRectangle.Height;
foreach (GraphicObject c in Children.Where(ch => ch.Slot.Height != crh && ch.Visible))
c.RegisterForLayouting ((int)LayoutingType.Y);
+ } else {
+ foreach (GraphicObject c in Children.Where(ch => ch.Height == 0 && ch.Visible))
+ c.RegisterForLayouting ((int)LayoutingType.Height);
}
break;
}
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index d7988c92..c1a117eb 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -150,9 +150,7 @@ namespace go this.Width += e.XDelta; this.Height += e.YDelta; break; - } - - this.RegisterForLayouting ((int)LayoutingType.All); + } } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { |