From 11dcc340f08a142f807419b85ff07d45f870e8e5 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sat, 12 Sep 2015 21:46:14 +0200 Subject: [PATCH] update template and tests with new sizing policy for stacks (stretched by default) --- Templates/Checkbox.goml | 2 +- Templates/RadioButton.goml | 4 +- Tests/GOLIBTest_4.cs | 74 +++++++------- Tests/Interfaces/fps.goml | 10 +- Tests/Interfaces/test4.goml | 148 +++++++++++++++------------ Tests/Interfaces/testExpandable.goml | 2 +- Tests/Interfaces/testHStack.goml | 6 +- Tests/Interfaces/testWindow.goml | 14 +-- Tests/Tests.csproj | 2 +- src/GraphicObjects/Checkbox.cs | 7 +- src/GraphicObjects/RadioButton.cs | 9 +- 11 files changed, 155 insertions(+), 123 deletions(-) diff --git a/Templates/Checkbox.goml b/Templates/Checkbox.goml index a2f8bb21..b37b15f1 100755 --- a/Templates/Checkbox.goml +++ b/Templates/Checkbox.goml @@ -1,5 +1,5 @@  - \ No newline at end of file diff --git a/Templates/RadioButton.goml b/Templates/RadioButton.goml index 0d8ab32a..ac52ea75 100755 --- a/Templates/RadioButton.goml +++ b/Templates/RadioButton.goml @@ -1,5 +1,5 @@  - + - \ No newline at end of file diff --git a/Tests/GOLIBTest_4.cs b/Tests/GOLIBTest_4.cs index c1f2e0ad..a5cdbb49 100644 --- a/Tests/GOLIBTest_4.cs +++ b/Tests/GOLIBTest_4.cs @@ -33,7 +33,7 @@ namespace test #region FPS - static int _fps = 0; + int _fps = 0; public int fps { get { return _fps; } @@ -52,20 +52,24 @@ namespace test } ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); + ValueChanged.Raise (this, new ValueChangeEventArgs ("update", + this.updateTime.ElapsedMilliseconds.ToString () + " ms")); } } - public static int fpsMin = 0; - public static int fpsMax = 0; + public int fpsMin = int.MaxValue; + public int fpsMax = 0; - static void resetFps () + void resetFps () { fpsMin = int.MaxValue; fpsMax = 0; _fps = 0; } + public string update = ""; #endregion + GraphicObject c; ProgressBar pb, pb2; Label labMousePos, labPb, labF, labA, labH, labFps, labFpsMin, labFpsMax, labV, @@ -88,19 +92,19 @@ namespace test //c2.HorizontalAlignment = HorizontalAlignment.Left; //c2.VerticalAlignment = VerticalAlignment.Top; c.Background.AdjustAlpha (0.5); - labMousePos = c.FindByName ("labMouse") as Label; - //pb = c.FindByName("pbBar") as ProgressBar; - pb2 = c.FindByName("pbBar2") as ProgressBar; - labPb = c.FindByName ("labPb") as Label; +// labMousePos = c.FindByName ("labMouse") as Label; +// //pb = c.FindByName("pbBar") as ProgressBar; +// pb2 = c.FindByName("pbBar2") as ProgressBar; +// labPb = c.FindByName ("labPb") as Label; labF = c.FindByName ("labFocus") as Label; labA = c.FindByName ("labActive") as Label; labH = c.FindByName ("labHover") as Label; - labFps = c.FindByName ("labFps") as Label; - labFpsMin = c.FindByName ("labFpsMin") as Label; - labFpsMax = c.FindByName ("labFpsMax") as Label; - labV = c.FindByName ("labValue") as Label; - labUpdate = c.FindByName ("labUpdate") as Label; - slTest = c.FindByName ("slider") as Slider; +// labFps = c.FindByName ("labFps") as Label; +// labFpsMin = c.FindByName ("labFpsMin") as Label; +// labFpsMax = c.FindByName ("labFpsMax") as Label; +// labV = c.FindByName ("labValue") as Label; +// labUpdate = c.FindByName ("labUpdate") as Label; +// slTest = c.FindByName ("slider") as Slider; colors = c.FindByName ("colors") as Group; @@ -112,7 +116,7 @@ namespace test int i = 0; foreach (Color col in Color.ColorDic) { - HorizontalStack s = colors.addChild (new HorizontalStack ()); + HorizontalStack s = colors.addChild (new HorizontalStack () { Fit = true}); s.HorizontalAlignment = HorizontalAlignment.Left; Border b = new Border () { Bounds = new Size (32, 20), @@ -139,7 +143,7 @@ namespace test if (i > 150) break; } - ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList)); +// ValueChanged.Raise(this, new ValueChangeEventArgs ("TestList", TestList)); } void pFps_mousemove(object sender, MouseMoveEventArgs e) { @@ -158,38 +162,36 @@ namespace test fps = (int)RenderFrequency; - labUpdate.Text = this.updateTime.ElapsedMilliseconds.ToString() + " ms"; if (frameCpt > 200) { resetFps (); frameCpt = 0; - } frameCpt++; - if (pb2.Value == pb2.Maximum) - pb2.Value = 0; - pb2.Value++; - - if (FocusedWidget==null) - labF.Text = "- none -"; - else - labF.Text = FocusedWidget.Name; - if (activeWidget==null) - labA.Text = "- none -"; - else - labA.Text = activeWidget.Name; - - if (hoverWidget==null) - labH.Text = "- none -"; - else - labH.Text = hoverWidget.Name; +// if (FocusedWidget==null) +// labF.Text = "- none -"; +// else +// labF.Text = FocusedWidget.Name; +// +// if (activeWidget==null) +// labA.Text = "- none -"; +// else +// labA.Text = activeWidget.Name; +// +// if (hoverWidget==null) +// labH.Text = "- none -"; +// else +// labH.Text = hoverWidget.Name; } + //public Point MousePosition; + protected override void OnMouseMove (MouseMoveEventArgs e) { base.OnMouseMove (e); - labMousePos.Text = e.Position.ToString (); + //MousePosition = e.Position; + ValueChanged.Raise(this, new ValueChangeEventArgs ("MousePosition", e.Position.ToString())); } [STAThread] static void Main () diff --git a/Tests/Interfaces/fps.goml b/Tests/Interfaces/fps.goml index 151d9905..edc63e70 100755 --- a/Tests/Interfaces/fps.goml +++ b/Tests/Interfaces/fps.goml @@ -3,20 +3,20 @@ HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10" Width="-1" Height="-1" Focusable="True" > - - + + - + - + - + diff --git a/Tests/Interfaces/test4.goml b/Tests/Interfaces/test4.goml index 4d824a2e..d2866bb6 100755 --- a/Tests/Interfaces/test4.goml +++ b/Tests/Interfaces/test4.goml @@ -1,91 +1,64 @@  - - - - - - - - \ No newline at end of file diff --git a/Tests/Interfaces/testExpandable.goml b/Tests/Interfaces/testExpandable.goml index a292cdde..0caf0a32 100755 --- a/Tests/Interfaces/testExpandable.goml +++ b/Tests/Interfaces/testExpandable.goml @@ -3,7 +3,7 @@ Margin="20" Focusable="True" Background="Gray"> - + diff --git a/Tests/Interfaces/testHStack.goml b/Tests/Interfaces/testHStack.goml index 8e4083a0..ac03eac9 100755 --- a/Tests/Interfaces/testHStack.goml +++ b/Tests/Interfaces/testHStack.goml @@ -1,9 +1,9 @@  - + - - + + diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml index efad1d8f..b336a9dc 100755 --- a/Tests/Interfaces/testWindow.goml +++ b/Tests/Interfaces/testWindow.goml @@ -4,9 +4,9 @@ Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500"> - + - - + + - + diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 8694d0e0..ce666004 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -8,7 +8,7 @@ Exe Tests Tests - test.GOLIBTests + test.GOLIBTest_4 v4.5 ..\bin\$(configuration) obj\$(configuration) diff --git a/src/GraphicObjects/Checkbox.cs b/src/GraphicObjects/Checkbox.cs index f6b7bae3..863cae0c 100644 --- a/src/GraphicObjects/Checkbox.cs +++ b/src/GraphicObjects/Checkbox.cs @@ -25,7 +25,7 @@ namespace go public Checkbox() : base() { } - + protected override void loadTemplate(GraphicObject template = null) { base.loadTemplate (template); @@ -64,6 +64,11 @@ namespace go } } + [XmlAttributeAttribute()][DefaultValue(-1)] + public override int Height { + get { return base.Height; } + set { base.Height = value; } + } [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true public override bool Focusable { diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs index 9d7ef83e..245fd2b2 100644 --- a/src/GraphicObjects/RadioButton.cs +++ b/src/GraphicObjects/RadioButton.cs @@ -30,11 +30,16 @@ namespace go { base.loadTemplate (template); - _caption = this.child.FindByName ("Caption") as Label; + _caption = this.child.FindByName ("Caption") as Label;//TODO:should use bindings instead _image = this.child.FindByName ("Image") as Image; _image.SvgSub = "unchecked"; } - + + [XmlAttributeAttribute()][DefaultValue(-1)] + public override int Height { + get { return base.Height; } + set { base.Height = value; } + } [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true public override bool Focusable { -- 2.47.3