[Agate-svn-commit] SF.net SVN: agate:[1519] trunk
Status: Alpha
Brought to you by:
kanato
From: <ka...@us...> - 2014-09-07 22:49:51
|
Revision: 1519 http://sourceforge.net/p/agate/code/1519 Author: kanato Date: 2014-09-07 22:49:41 +0000 (Sun, 07 Sep 2014) Log Message: ----------- Several CSS fixes and refactorings in the UI portion of the code. Modified Paths: -------------- trunk/AgateLib/AgateLib.csproj trunk/AgateLib/UserInterface/Css/CssAdapter.cs trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs trunk/AgateLib/UserInterface/Css/CssStyleData.cs trunk/AgateLib/UserInterface/Css/Documents/CssDocument.cs trunk/AgateLib/UserInterface/Css/Documents/CssFont.cs trunk/AgateLib/UserInterface/Css/Documents/PropertyEnums.cs trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs trunk/AgateLib/UserInterface/Css/Layout/Defaults/DefaultStyleCollection.cs trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs trunk/AgateLib/UserInterface/Css/Selectors/WidgetMatchParameters.cs trunk/AgateLib/UserInterface/Widgets/Container.cs trunk/AgateLib/UserInterface/Widgets/Label.cs trunk/AgateLib/UserInterface/Widgets/LabelImage.cs trunk/AgateLib/UserInterface/Widgets/Panel.cs trunk/AgateLib/UserInterface/Widgets/ProgressBar.cs trunk/AgateLib/UserInterface/Widgets/Widget.cs trunk/AgateLib/UserInterface/Widgets/WidgetList.cs trunk/AgateLib.Tests/AgateLib.Tests.Portable/AgateLib.Tests.Portable.csproj trunk/AgateLib.Tests/UnitTests/AgateLib.Tests.UnitTests.csproj trunk/AgateLib.Tests/UnitTests/UserInterface/Css/CssLayoutTest.cs trunk/AgateLib.Tests/UnitTests/UserInterface/Widgets/ConversionTests.cs Added Paths: ----------- trunk/AgateLib/UserInterface/Css/Documents/CssText.cs trunk/AgateLib/UserInterface/Css/Layout/Defaults/ProgressBarDefaultStyle.cs trunk/AgateLib/UserInterface/Widgets/Extensions/ trunk/AgateLib/UserInterface/Widgets/Extensions/WidgetExtensions.cs trunk/AgateLib/UserInterface/Widgets/ITextAlignment.cs trunk/AgateLib.Tests/AgateLib.Tests.Portable/Fakes/FakeGuiEngine.cs Modified: trunk/AgateLib/AgateLib.csproj =================================================================== --- trunk/AgateLib/AgateLib.csproj 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/AgateLib.csproj 2014-09-07 22:49:41 UTC (rev 1519) @@ -509,6 +509,8 @@ <Compile Include="UserInterface\Css\Documents\CssBorder.cs" /> <Compile Include="UserInterface\Css\Documents\CssBorderImage.cs" /> <Compile Include="UserInterface\Css\Documents\CssBoxComponent.cs" /> + <Compile Include="UserInterface\Css\Documents\CssText.cs" /> + <Compile Include="UserInterface\Css\Layout\Defaults\ProgressBarDefaultStyle.cs" /> <Compile Include="UserInterface\Css\Selectors\CssMediaSelector.cs" /> <Compile Include="UserInterface\Css\Documents\PropertyEnums.cs" /> <Compile Include="UserInterface\Css\Documents\CssDistance.cs" /> @@ -559,6 +561,7 @@ <Compile Include="UserInterface\ISurfaceProvider.cs" /> <Compile Include="UserInterface\Widgets\Container.cs" /> <Compile Include="UserInterface\Widgets\Desktop.cs" /> + <Compile Include="UserInterface\Widgets\Extensions\WidgetExtensions.cs" /> <Compile Include="UserInterface\Widgets\Gui.cs" /> <Compile Include="UserInterface\Widgets\GuiInput.cs" /> <Compile Include="UserInterface\Widgets\GuiSound.cs" /> @@ -567,6 +570,7 @@ <Compile Include="UserInterface\Widgets\IGuiRenderer.cs" /> <Compile Include="UserInterface\Widgets\ImageBox.cs" /> <Compile Include="UserInterface\Widgets\InputMap.cs" /> + <Compile Include="UserInterface\Widgets\ITextAlignment.cs" /> <Compile Include="UserInterface\Widgets\KeyboardEventArgs.cs" /> <Compile Include="UserInterface\Widgets\Label.cs" /> <Compile Include="UserInterface\Widgets\LabelImage.cs" /> Modified: trunk/AgateLib/UserInterface/Css/CssAdapter.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/CssAdapter.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -40,7 +40,7 @@ internal CssAdapter(CssDocument doc) { Document = doc; - + Document.Updated += Document_Updated; MediumInfo = new CssMediumInfo(); switch (Core.Platform.DeviceType) @@ -114,6 +114,7 @@ { int scale = 1; double amount = distance.Amount; + Font font = null; switch (distance.DistanceUnit) { @@ -134,7 +135,7 @@ break; case DistanceUnit.FontHeight: - var font = style.Widget.Font; + font = style.Widget.Font; if (font != null) scale = font.FontHeight; @@ -143,6 +144,16 @@ break; + case DistanceUnit.FontAverageWidth: + font = style.Widget.Font; + + if (font != null) + scale = font.FontHeight / 2; + else + scale = 0; + + break; + default: throw new NotImplementedException(); } @@ -330,5 +341,26 @@ return false; } + + + void Document_Updated(object sender, EventArgs e) + { + foreach (var widget in mObjectStyles.Keys) + { + widget.LayoutDirty = true; + widget.StyleDirty = true; + + mObjectStyles[widget].AppliedBlocks.Clear(); + } + } + + + public void SetFont(Widget control) + { + var style = GetStyle(control); + + control.Font = style.Font; + control.Font.Style = style.Data.Font.Weight; + } } } Modified: trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/CssRuleBlock.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -52,9 +52,9 @@ public void AddProperty(string name, string value) { - Properties.Add(name, value); + Properties[name] = value; - Bindings.Add(name, new Binding(map, name, value)); + Bindings[name] = new Binding(map, name, value); } Modified: trunk/AgateLib/UserInterface/Css/CssStyleData.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/CssStyleData.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/CssStyleData.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -46,6 +46,7 @@ Border = new CssBorder(); Layout = new CssLayout(); Transition = new CssTransition(); + Text = new CssText(); Display = CssDisplay.Initial; } @@ -77,5 +78,8 @@ [CssPromoteProperties(prefix: "transition")] public CssTransition Transition { get; set; } + + [CssPromoteProperties] + public CssText Text { get; set; } } } Modified: trunk/AgateLib/UserInterface/Css/Documents/CssDocument.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Documents/CssDocument.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Documents/CssDocument.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -32,31 +32,55 @@ public CssDocument() { + Clear(); + } + + public static CssDocument FromText(string css) + { + CssDocument doc = new CssDocument(); + + doc.Parse(css); + + return doc; + } + + public void Clear() + { + mMedia.Clear(); + var defaultMedium = new CssMediaSelector("all"); Media.Add(defaultMedium); } - public static CssDocument Load(string filename) + + public void Load(string filename) { - CssDocument doc = new CssDocument(); CssParser parser = new CssParser(); - parser.Load(doc, filename); + parser.Load(this, filename); - return doc; + OnUpdated(); } - public static CssDocument FromText(string text) + public void Parse(string css) { - CssDocument doc = new CssDocument(); CssParser parser = new CssParser(); - parser.ParseCss(doc, text); + parser.ParseCss(this, css); - return doc; + OnUpdated(); } + private void OnUpdated() + { + if (Updated != null) + Updated(this, EventArgs.Empty); + } + public List<CssMediaSelector> Media { get { return mMedia; } } public CssMediaSelector DefaultMedium { get { return mMedia.First(); } } + + + public event EventHandler Updated; } } Modified: trunk/AgateLib/UserInterface/Css/Documents/CssFont.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Documents/CssFont.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Documents/CssFont.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -1,4 +1,5 @@ -// The contents of this file are subject to the Mozilla Public License +using AgateLib.DisplayLib; +// The contents of this file are subject to the Mozilla Public License // Version 1.1 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // http://www.mozilla.org/MPL/ @@ -40,7 +41,12 @@ [CssAlias("font-size")] public CssDistance Size { get; set; } + [CssAlias("font-weight")] + public FontStyles Weight { get; set; } + public Color Color { get; set; } } + + } Added: trunk/AgateLib/UserInterface/Css/Documents/CssText.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Documents/CssText.cs (rev 0) +++ trunk/AgateLib/UserInterface/Css/Documents/CssText.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -0,0 +1,15 @@ +using AgateLib.UserInterface.Css.Binders; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AgateLib.UserInterface.Css.Documents +{ + public class CssText + { + [CssAlias("text-align")] + public CssTextAlign Align { get; set; } + } +} Modified: trunk/AgateLib/UserInterface/Css/Documents/PropertyEnums.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Documents/PropertyEnums.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Documents/PropertyEnums.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -28,6 +28,7 @@ { Initial, None, + Block, } public enum CssTransitionType @@ -103,4 +104,13 @@ Absolute, Fixed, } + + public enum CssTextAlign + { + Inherit, + Initial, + Left, + Right, + Center, + } } Modified: trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Layout/CssLayoutEngine.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -46,6 +46,7 @@ totalRefresh |= gui.Desktop.Width != renderTargetSize.Width; totalRefresh |= gui.Desktop.Height != renderTargetSize.Height; + totalRefresh |= gui.Desktop.LayoutDirty; gui.Desktop.Width = renderTargetSize.Width; gui.Desktop.Height = renderTargetSize.Height; @@ -54,7 +55,14 @@ RedoLayout(gui.Desktop, totalRefresh); - RedoFixedLayout(gui.Desktop); + if (totalRefresh || gui.Desktop.Descendants.Any(x => x.LayoutDirty)) + { + RedoFixedLayout(gui.Desktop); + + gui.Desktop.LayoutDirty = false; + foreach (var w in gui.Desktop.Descendants) + w.LayoutDirty = false; + } } private void SetDesktopAnimatorProperties(Desktop desktop) @@ -62,12 +70,16 @@ var style = mAdapter.GetStyle(desktop); style.Animator.ClientRect = new Rectangle(0, 0, desktop.Width, desktop.Height); - style.Animator.WidgetSize = new Size(desktop.Width, desktop.Height); } private void RedoFixedLayout(Desktop desktop) { - foreach (var child in desktop.Descendants) + var deskStyle = mAdapter.GetStyle(desktop); + deskStyle.Animator.ClientRect = new Rectangle(0, 0, desktop.Width, desktop.Height); + + foreach (var child in desktop.Descendants.Where(x => { + var pos = mAdapter.GetStyle(x).Data.Position; + return pos == CssPosition.Absolute || pos == CssPosition.Fixed;} )) { var style = mAdapter.GetStyle(child); var sz = style.Animator.ClientRect.Size; @@ -97,7 +109,7 @@ if (position.Right.Automatic == false) { int targetRight = ConvertDistance(style.Widget, position.Right, true, false).Value; - targetRight = parentStyle.Animator.WidgetSize.Width - targetRight; + targetRight = parentStyle.Animator.ClientRect.Width - targetRight; anim.ClientRect.X = targetRight - anim.ClientRect.Width - box.Right; } @@ -110,7 +122,7 @@ if (position.Bottom.Automatic == false) { int targetBottom = ConvertDistance(style.Widget, position.Bottom, false, false).Value; - targetBottom = parentStyle.Animator.WidgetSize.Height - targetBottom; + targetBottom = parentStyle.Animator.ClientRect.Height - targetBottom; anim.ClientRect.Y = targetBottom - anim.ClientRect.Height - box.Bottom; } @@ -123,21 +135,24 @@ var containerAnim = containerStyle.Animator; CssBoxModel containerBox = containerStyle.BoxModel; - containerAnim.ClientRect.X = 0; - containerAnim.ClientRect.Y = 0; - if (forceRefresh == false) { - if (container.Descendants.Any(x => x.LayoutDirty) == false) + if (container.LayoutDirty == false && + container.Descendants.Any(x => x.LayoutDirty) == false) + { return; + } } + containerAnim.ClientRect.X = 0; + containerAnim.ClientRect.Y = 0; + int maxWidth = ComputeMaxWidthForContainer(containerStyle); Point nextPos = Point.Empty; int maxHeight = 0; maxWidth -= containerBox.Left + containerBox.Right; - + int largestWidth = 0; int bottom = 0; @@ -148,12 +163,19 @@ if (fixedContainerWidth != null) maxWidth = (int)fixedContainerWidth; + bool resetNextPosition = false; + foreach (var child in container.Children) { var style = mAdapter.GetStyle(child); child.Font = style.Font; - var sz = ComputeSize(child, containerStyle); + if (child.Visible == false) + continue; + if (style.Data.Display == CssDisplay.None) + continue; + + var sz = ComputeSize(child, containerStyle, forceRefresh); var box = style.BoxModel; int? fixedWidth = ConvertDistance(child, style.Data.PositionData.Width, true); int? fixedHeight = ConvertDistance(child, style.Data.PositionData.Height, false); @@ -161,10 +183,32 @@ if (fixedWidth != null) sz.Width = (int)fixedWidth; if (fixedHeight != null) sz.Height = (int)fixedHeight; + int? minWidth = ConvertDistance(child, style.Data.PositionData.MinWidth, true, true); + int? minHeight = ConvertDistance(child, style.Data.PositionData.MinHeight, true, true); + + if (minWidth != null && sz.Width < (int)minWidth) sz.Width = (int)minWidth; + if (minHeight != null && sz.Height < (int)minHeight) sz.Height = (int)minHeight; + + bool resetPosition = false; + switch (containerStyle.Data.Layout.Kind) { case CssLayoutKind.Flow: + if (resetNextPosition) + { + resetPosition = true; + resetNextPosition = false; + } + if (style.Data.Display == CssDisplay.Block) + { + resetPosition = true; + resetNextPosition = true; + } + if (nextPos.X + sz.Width + style.BoxModel.Left + style.BoxModel.Right > maxWidth) + resetPosition = true; + + if (resetPosition) { nextPos.X = 0; nextPos.Y += maxHeight; @@ -174,11 +218,8 @@ } bool includeInLayout = true; - + var anim = style.Animator; - - anim.ClientRect.X = nextPos.X + box.Left; - anim.ClientRect.Y = nextPos.Y + box.Top; anim.ClientRect.Width = sz.Width; anim.ClientRect.Height = sz.Height; @@ -186,7 +227,7 @@ { case CssPosition.Absolute: includeInLayout = false; - anim.ParentCoordinateSystem = TopLevelWidget(child, x => mAdapter.GetStyle(x).Data.Position == CssPosition.Relative); + anim.ParentCoordinateSystem = TopLevelWidget(child, x => mAdapter.GetStyle(x).Data.Position == CssPosition.Static); break; case CssPosition.Fixed: @@ -195,14 +236,16 @@ break; } + if (includeInLayout) + { + anim.ClientRect.X = nextPos.X + box.Left; + anim.ClientRect.Y = nextPos.Y + box.Top; + } + anim.ClientWidgetOffset = new Point( box.Padding.Left + box.Border.Left, box.Padding.Top + box.Border.Top); - anim.WidgetSize = new Size( - anim.ClientRect.Width + box.Padding.Left + box.Padding.Right + box.Border.Left + box.Border.Right, - anim.ClientRect.Height + box.Padding.Top + box.Padding.Bottom + box.Border.Bottom + box.Border.Top); - if (includeInLayout) { switch (containerStyle.Data.Layout.Kind) @@ -223,7 +266,6 @@ bottom = Math.Max(bottom, anim.ClientRect.Y + anim.ClientRect.Height + box.Bottom); // only add box.Bottom here, because box.Top is taken into account in child.Y. } - child.LayoutDirty = false; } containerAnim.ClientRect.Width = Math.Min(largestWidth, maxWidth); @@ -260,7 +302,6 @@ break; } - container.LayoutDirty = false; } private Widget TopLevelWidget(Widget child) @@ -302,15 +343,16 @@ } } - private Size ComputeSize(Widget control, CssStyle parentStyle) + private Size ComputeSize(Widget control, CssStyle parentStyle, bool forceRefresh) { - return ComputeSize(control, parentStyle.Data); + return ComputeSize(control, parentStyle.Data, forceRefresh); } - private Size ComputeSize(Widget control, CssStyleData parentStyle) + private Size ComputeSize(Widget control, CssStyleData parentStyle, bool forceRefresh) { if (control is Container) - return ComputeContainerSize((Container)control); + return ComputeContainerSize((Container)control, forceRefresh); + mAdapter.SetFont(control); var style = mAdapter.GetStyle(control); return control.ComputeSize( @@ -328,9 +370,9 @@ return mAdapter.CssDistanceToPixels(control, cssDistance, width); } - private Size ComputeContainerSize(Container container) + private Size ComputeContainerSize(Container container, bool forceRefresh) { - RedoLayout(container); + RedoLayout(container, forceRefresh); var anim = mAdapter.GetStyle(container).Animator; return new Size(anim.ClientRect.Width, anim.ClientRect.Height); Modified: trunk/AgateLib/UserInterface/Css/Layout/Defaults/DefaultStyleCollection.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Layout/Defaults/DefaultStyleCollection.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Layout/Defaults/DefaultStyleCollection.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -34,6 +34,7 @@ { mSetters[typeof(Window)] = new WindowDefaultStyle(); mSetters[typeof(Menu)] = new MenuDefaultStyle(); + mSetters[typeof(ProgressBar)] = new ProgressBarDefaultStyle(); } public void Add(IDefaultStyleSetter styleSetter, params Type[] types) Added: trunk/AgateLib/UserInterface/Css/Layout/Defaults/ProgressBarDefaultStyle.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Layout/Defaults/ProgressBarDefaultStyle.cs (rev 0) +++ trunk/AgateLib/UserInterface/Css/Layout/Defaults/ProgressBarDefaultStyle.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -0,0 +1,19 @@ +using AgateLib.UserInterface.Css.Documents; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AgateLib.UserInterface.Css.Layout.Defaults +{ + class ProgressBarDefaultStyle : BlankDefaultStyle + { + public override void SetDefaultStyle(CssStyle style) + { + style.Data.PositionData.MinWidth = CssDistance.FromString("40px"); + style.Data.PositionData.MinHeight = CssDistance.FromString("4px"); + style.Data.Border.SetValueFromText("1px solid black"); + } + } +} Modified: trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Rendering/CssRenderer.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -92,8 +92,15 @@ { CssStyle style = mAdapter.GetStyle(control); - control.Font = style.Font; + mAdapter.SetFont(control); + if (control is ITextAlignment) + { + ITextAlignment txa = (ITextAlignment)control; + + txa.TextAlign = ConvertTextAlign(style.Data.Text.Align); + } + if (style.Animator.Visible == false) return; @@ -104,6 +111,21 @@ control.DrawImpl(); } + private OriginAlignment ConvertTextAlign(CssTextAlign cssTextAlign) + { + switch(cssTextAlign) + { + case CssTextAlign.Right: + return OriginAlignment.TopRight; + + case CssTextAlign.Center: + return OriginAlignment.TopCenter; + + default: + return OriginAlignment.TopLeft; + } + } + private void SetFontProperties(CssStyle style) { style.Widget.FontColor = style.Data.Font.Color; @@ -178,7 +200,6 @@ DrawRepeatedClipped(image, srcRect, startPt, clipRect, repeatX, repeatY); } - private void DrawRepeatedClipped(Surface image, Rectangle srcRect, Point startPt, Rectangle clipRect, bool repeatX, bool repeatY) { int countX = (int)Math.Ceiling(clipRect.Width / (double)srcRect.Width); Modified: trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Rendering/WidgetAnimator.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -31,9 +31,20 @@ { CssStyle mStyle; + public Point ClientWidgetOffset { get; set; } + public Size WidgetSize + { + get + { + var widgetSize = ClientRect.Size; + var box = mStyle.BoxModel; - public Point ClientWidgetOffset { get; set; } - public Size WidgetSize { get; set; } + widgetSize.Width += box.Padding.Left + box.Padding.Right + box.Border.Left + box.Border.Right; + widgetSize.Height += box.Padding.Top + box.Padding.Bottom + box.Border.Bottom + box.Border.Top; + + return widgetSize; + } + } public Rectangle ClientRect; public bool Active { get; private set; } Modified: trunk/AgateLib/UserInterface/Css/Selectors/WidgetMatchParameters.cs =================================================================== --- trunk/AgateLib/UserInterface/Css/Selectors/WidgetMatchParameters.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Css/Selectors/WidgetMatchParameters.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using AgateLib.UserInterface.Widgets.Extensions; namespace AgateLib.UserInterface.Css.Selectors { @@ -40,7 +41,7 @@ { Container container = (Container)control; - if (container.ChildHasMouseIn) + if (container.ChildHasMouseIn()) return CssPseudoClass.Hover; } if (control is MenuItem) Modified: trunk/AgateLib/UserInterface/Widgets/Container.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/Container.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/Container.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -24,7 +24,7 @@ namespace AgateLib.UserInterface.Widgets { - public class Container : Widget + public abstract class Container : Widget { public Container() { @@ -47,25 +47,16 @@ foreach (var w in Children) { yield return w; - } - foreach (var w in Children.OfType<Container>()) - { - foreach (var ww in ((Container)w).Descendants) - yield return ww; + if (w is Container) + { + foreach (var ww in ((Container)w).Descendants) + yield return ww; + } } } } - public bool ChildHasMouseIn - { - get - { - return Children.Any(x => x.MouseIn) || - Children.OfType<Container>().Any(x => x.ChildHasMouseIn); - } - } - public void BringToFront(Widget item) { if (Children.Contains(item) == false) Added: trunk/AgateLib/UserInterface/Widgets/Extensions/WidgetExtensions.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/Extensions/WidgetExtensions.cs (rev 0) +++ trunk/AgateLib/UserInterface/Widgets/Extensions/WidgetExtensions.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AgateLib.UserInterface.Widgets.Extensions +{ + public static class WidgetExtensions + { + public static bool ChildHasMouseIn(this Container c) + { + return c.Descendants.Any(x => x.MouseIn); + } + } +} Added: trunk/AgateLib/UserInterface/Widgets/ITextAlignment.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/ITextAlignment.cs (rev 0) +++ trunk/AgateLib/UserInterface/Widgets/ITextAlignment.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -0,0 +1,14 @@ +using AgateLib.DisplayLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AgateLib.UserInterface.Widgets +{ + public interface ITextAlignment + { + OriginAlignment TextAlign { get; set; } + } +} Modified: trunk/AgateLib/UserInterface/Widgets/Label.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/Label.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/Label.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -25,7 +25,7 @@ namespace AgateLib.UserInterface.Widgets { - public class Label : Widget + public class Label : Widget, ITextAlignment { string mText = string.Empty; bool mWrapText; Modified: trunk/AgateLib/UserInterface/Widgets/LabelImage.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/LabelImage.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/LabelImage.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -7,7 +7,7 @@ namespace AgateLib.UserInterface.Widgets { - public class LabelImage : Container + public class LabelImage : Container, ITextAlignment { Label mLabel; ImageBox mImageBox; @@ -21,7 +21,7 @@ Children.Add(mLabel); } public LabelImage(string text, IDrawable image) - :this() + : this() { Text = text; Image = image; @@ -32,5 +32,7 @@ public Label Label { get { return mLabel; } } public ImageBox ImageBox { get { return mImageBox; } } + + public OriginAlignment TextAlign { get { return Label.TextAlign; } set { Label.TextAlign = value; } } } } Modified: trunk/AgateLib/UserInterface/Widgets/Panel.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/Panel.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/Panel.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -23,7 +23,7 @@ namespace AgateLib.UserInterface.Widgets { - class Panel : Container + public class Panel : Container { } } Modified: trunk/AgateLib/UserInterface/Widgets/ProgressBar.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/ProgressBar.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/ProgressBar.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -47,7 +47,7 @@ public override void DrawImpl() { Rectangle destRect = ClientToScreen( - new Rectangle(X, Y, Width, Height)); + new Rectangle(0, 0, Width, Height)); if (Max > 0) { @@ -56,6 +56,8 @@ int maxBarWidth = Width; int width = (int)(percentage * maxBarWidth); + destRect.Width = width; + var grad = new Gradient(Gradient.TopLeft); grad.TopRight = Gradient.Interpolate(width, 0); grad.BottomRight = grad.TopRight; Modified: trunk/AgateLib/UserInterface/Widgets/Widget.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/Widget.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/Widget.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -29,6 +29,7 @@ { public class Widget { + Container mParentCoordinateSystem; private Point mClientWidgetOffset; private Size mWidgetSize; @@ -38,6 +39,7 @@ private bool mEnabled = true; string mStyle = string.Empty; bool mLayoutDirty; + bool mVisible; public Widget() { @@ -82,7 +84,10 @@ public Size WidgetSize { get { return mWidgetSize; } - set { mWidgetSize = value; } + set + { + mWidgetSize = value; + } } public override string ToString() @@ -106,6 +111,20 @@ public bool AutoSize { get; set; } public virtual Container Parent { get; set; } + protected internal Container ParentCoordinateSystem + { + get + { + if (mParentCoordinateSystem == null) + return Parent; + else + return mParentCoordinateSystem; + } + internal set + { + mParentCoordinateSystem = value; + } + } public Font Font { get @@ -120,7 +139,7 @@ mFont = value; } } - public Color FontColor + public virtual Color FontColor { get { @@ -192,7 +211,7 @@ Point translated = ClientToParent(clientPoint); - return Parent.ClientToScreen(translated); + return ParentCoordinateSystem.ClientToScreen(translated); } public Point ScreenToClient(Point screenPoint) { @@ -261,8 +280,19 @@ public virtual void Refresh() { } - public virtual bool Visible { get; set; } + public virtual bool Visible + { + get { return mVisible; } + set + { + if (value == mVisible) + return; + mVisible = value; + LayoutDirty = true; + } + } + public string Style { get { return mStyle; } @@ -270,8 +300,11 @@ { if (value == null) throw new ArgumentNullException(); + if (value == mStyle) + return; mStyle = value; + LayoutDirty = true; } } @@ -281,7 +314,8 @@ set { mLayoutDirty = value; - StyleDirty = true; + if (value) + StyleDirty = true; } } internal bool StyleDirty { get; set; } Modified: trunk/AgateLib/UserInterface/Widgets/WidgetList.cs =================================================================== --- trunk/AgateLib/UserInterface/Widgets/WidgetList.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib/UserInterface/Widgets/WidgetList.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -96,6 +96,10 @@ OnWidgetAdded(item); } + public void Add(params Widget[] items) + { + AddRange(items); + } public void AddRange(IEnumerable<Widget> items) { if (items == null) throw new ArgumentNullException("item"); Modified: trunk/AgateLib.Tests/AgateLib.Tests.Portable/AgateLib.Tests.Portable.csproj =================================================================== --- trunk/AgateLib.Tests/AgateLib.Tests.Portable/AgateLib.Tests.Portable.csproj 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib.Tests/AgateLib.Tests.Portable/AgateLib.Tests.Portable.csproj 2014-09-07 22:49:41 UTC (rev 1519) @@ -59,6 +59,7 @@ <Compile Include="Fakes\FakeDisplayWindow.cs" /> <Compile Include="Fakes\FakeFontSurface.cs" /> <Compile Include="Fakes\FakeFrameBuffer.cs" /> + <Compile Include="Fakes\FakeGuiEngine.cs" /> <Compile Include="Fakes\FakePlatformFactory.cs" /> <Compile Include="Fakes\FakePlatformInfo.cs" /> <Compile Include="Fakes\FakeRenderTarget.cs" /> Added: trunk/AgateLib.Tests/AgateLib.Tests.Portable/Fakes/FakeGuiEngine.cs =================================================================== --- trunk/AgateLib.Tests/AgateLib.Tests.Portable/Fakes/FakeGuiEngine.cs (rev 0) +++ trunk/AgateLib.Tests/AgateLib.Tests.Portable/Fakes/FakeGuiEngine.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -0,0 +1,24 @@ +using AgateLib.UserInterface.Widgets; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AgateLib.Testing.Fakes +{ + public class FakeRenderer : IGuiRenderer + { + public void Draw(Gui gui) + { + } + public void Update(Gui gui, double deltaTime) + { } + } + public class FakeLayout : IGuiLayoutEngine + { + public void UpdateLayout(Gui gui) + { + } + } +} Modified: trunk/AgateLib.Tests/UnitTests/AgateLib.Tests.UnitTests.csproj =================================================================== --- trunk/AgateLib.Tests/UnitTests/AgateLib.Tests.UnitTests.csproj 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib.Tests/UnitTests/AgateLib.Tests.UnitTests.csproj 2014-09-07 22:49:41 UTC (rev 1519) @@ -19,6 +19,7 @@ <TargetFrameworkProfile /> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> <RestorePackages>true</RestorePackages> + <_ResolveReferenceDependencies>true</_ResolveReferenceDependencies> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> Modified: trunk/AgateLib.Tests/UnitTests/UserInterface/Css/CssLayoutTest.cs =================================================================== --- trunk/AgateLib.Tests/UnitTests/UserInterface/Css/CssLayoutTest.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib.Tests/UnitTests/UserInterface/Css/CssLayoutTest.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -22,6 +22,7 @@ CssLayoutEngine engine; Gui gui; CssAdapter adapter; + CssDocument doc; [TestInitialize] public void CssLInit() @@ -43,18 +44,25 @@ ff.AddFont(new FontSettings(10, FontStyles.Bold), FontSurface.FromImpl(new FakeFontSurface { Height = 10 })); - CssDocument doc = CssDocument.FromText( - "window { layout: column; margin: 6px; padding: 8px;} label { margin-left: 4px; } " + - "window.fixed { position: fixed; right: 4px; bottom: 8px; margin: 14px; padding: 9px; border: 2px; } "+ - "window.fixedleft { position: fixed; left: 4px; top: 8px; margin: 14px; padding: 9px; border: 2px; }"); + doc = new CssDocument(); + doc.Parse(@" +window { layout: column; margin: 6px; padding: 8px;} +label { margin-left: 4px; } +window.fixed { position: fixed; right: 4px; bottom: 8px; margin: 14px; padding: 9px; border: 2px; } +window.fixedleft { position: fixed; left: 4px; top: 8px; margin: 14px; padding: 9px; border: 2px; } +window.minsize { min-width: 500px; min-height: 400px; } +.invisible { display: none; } +.block { display:block; } + "); + adapter = new CssAdapter(doc, ff); engine = new CssLayoutEngine(adapter); - gui = new Gui(new FakeRenderer(), engine); - + gui = new Gui(new FakeRenderer(), engine); + Core.Initialize(new FakeAgateFactory()); Core.InitAssetLocations(new AssetLocations()); } @@ -99,17 +107,28 @@ Assert.AreEqual(new Point(18, 14 + fh), wind.Children[1].ClientToScreen(Point.Empty)); } + [TestMethod] + public void CssLMinSizes() + { + Window wind = new Window { Style = "minsize" }; + gui.Desktop.Children.Add(wind); + RedoLayout(); + + Assert.AreEqual(500, wind.ClientRect.Width, "Failed to set min width"); + Assert.AreEqual(400, wind.ClientRect.Height, "Failed to set min height"); + } + [TestMethod] public void CssLFixedRightBottom() { - Window wind = new Window() { Style = "fixed" }; + Window wind = new Window { Style = "fixed" }; gui.Desktop.Children.Add(wind); RedoLayout(); Assert.AreEqual(1000 - 18, wind.WidgetRect.Right); - Assert.AreEqual(1000 -22, wind.WidgetRect.Bottom); + Assert.AreEqual(1000 - 22, wind.WidgetRect.Bottom); } [TestMethod] @@ -129,13 +148,13 @@ { Window wind = new Window(); Menu mnu = new Menu(); - Container c = new Container(); + Panel pnl = new Panel(); ImageBox ib = new ImageBox(); Label lbl1 = new Label("Test1"); Label lbl2 = new Label("Test2"); - c.Children.AddRange(new Widget[] { ib, lbl1, lbl2 }); - mnu.Children.Add(new MenuItem(c)); + pnl.Children.AddRange(new Widget[] { ib, lbl1, lbl2 }); + mnu.Children.Add(new MenuItem(pnl)); wind.Children.Add(mnu); gui.Desktop.Children.Add(wind); @@ -152,13 +171,13 @@ { Window wind = new Window(); Menu mnu = new Menu(); - Container c = new Container(); + Panel pnl = new Panel(); ImageBox ib = new ImageBox(); Label lbl1 = new Label("Test1"); Label lbl2 = new Label("Test2"); - c.Children.AddRange(new Widget[] { ib, lbl1, lbl2 }); - mnu.Children.Add(new MenuItem(c)); + pnl.Children.AddRange(new Widget[] { ib, lbl1, lbl2 }); + mnu.Children.Add(new MenuItem(pnl)); wind.Children.Add(mnu); gui.Desktop.Children.Add(wind); @@ -171,14 +190,213 @@ Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); lbl1.Text = "Test1Test2Test3"; + Assert.AreEqual(120, ff.MeasureString(lbl1.Text).Width); RedoLayout(); - Assert.AreEqual(120, ff.MeasureString(lbl1.Text).Width); Assert.AreEqual(new Rectangle(100, 0, 120, 8), lbl1.WidgetRect); Assert.AreEqual(new Rectangle(224, 0, 40, 8), lbl2.WidgetRect); Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); + } + [TestMethod] + public void CssLHiddenWidgets() + { + Window wind = new Window(); + Menu mnu = new Menu(); + Panel pnl = new Panel(); + ImageBox ib = new ImageBox(); + Label lbl1 = new Label("Test1"); + Label lbl2 = new Label("Test2"); + + pnl.Children.AddRange(new Widget[] { ib, lbl1, lbl2 }); + mnu.Children.Add(new MenuItem(pnl)); + wind.Children.Add(mnu); + + gui.Desktop.Children.Add(wind); + + RedoLayout(); + + Assert.AreEqual(40, ff.MeasureString(lbl1.Text).Width); + Assert.AreEqual(new Rectangle(100, 0, 40, 8), lbl1.WidgetRect); + Assert.AreEqual(new Rectangle(144, 0, 40, 8), lbl2.WidgetRect); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); + + lbl1.Style = "invisible"; + RedoLayout(); + + Assert.AreEqual(new Rectangle(100, 0, 40, 8), lbl2.WidgetRect, "Failed to exclude display:none from layout."); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); + + lbl1.Style = ""; + RedoLayout(); + + Assert.AreEqual(new Rectangle(144, 0, 40, 8), lbl2.WidgetRect, "Failed to reinclude display:initial in layout."); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); + + lbl1.Visible = false; + RedoLayout(); + + Assert.AreEqual(new Rectangle(100, 0, 40, 8), lbl2.WidgetRect, "Failed to exclude visible=false from layout."); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); } + + [TestMethod] + public void CssLDisplayBlock() + { + Window wind = new Window(); + Menu mnu = new Menu(); + Panel pnl = new Panel(); + ImageBox ib = new ImageBox(); + Label lbl1 = new Label("Test1"); + Label lbl2 = new Label("Test2"); + Label lbl3 = new Label("Test3") { Style = "block" }; + Label lbl4 = new Label("Test4"); + + pnl.Children.AddRange(new Widget[] { ib, lbl1, lbl2, lbl3, lbl4 }); + mnu.Children.Add(new MenuItem(pnl)); + wind.Children.Add(mnu); + + gui.Desktop.Children.Add(wind); + + RedoLayout(); + + Assert.AreEqual(40, ff.MeasureString(lbl1.Text).Width); + Assert.AreEqual(new Rectangle(100, 0, 40, 8), lbl1.WidgetRect); + Assert.AreEqual(new Rectangle(144, 0, 40, 8), lbl2.WidgetRect); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ib.WidgetRect); + Assert.AreEqual(new Rectangle(4, 96, 40, 8), lbl3.WidgetRect); + Assert.AreEqual(new Rectangle(4, 104, 40, 8), lbl4.WidgetRect); + } + + [TestMethod] + public void CssLFixedPositioning() + { + doc.Clear(); + doc.Parse(@" +window { position: absolute; left: 20px; top: 30px; width: 50px; height: 40px; } +label { position: fixed; left: 40px; top: 70px; width: 60px; height: 50px; } +"); + + Window wind = new Window(); + Label lbl = new Label(); + + wind.Children.Add(lbl); + + gui.Desktop.Children.Add(wind); + + RedoLayout(); + + Assert.AreEqual(new Size(50, 40), wind.ClientRect.Size); + Assert.AreEqual(new Point(20, 30), wind.ClientRect.Location); + + Assert.AreEqual(new Point(40, 70), lbl.ClientRect.Location); + } + + [TestMethod] + public void CssLAbsolutePositioning() + { + doc.Clear(); + doc.Parse(@" +window { position: absolute; top: 10px; left: 10px; width: 800px; height: 600px; } +panel { width:50px; height:30px; } +#p1 { position: absolute; top:0; left:0; } +#p2 { position: absolute; top:0; right:0; } +#p3 { position: absolute; bottom:0; left:0; } +#p4 { position: absolute; bottom:0; right:0; } +"); + + Window wind = new Window(); + Panel p1 = new Panel { Name = "p1" }; + Panel p2 = new Panel { Name = "p2" }; + Panel p3 = new Panel { Name = "p3" }; + Panel p4 = new Panel { Name = "p4" }; + + wind.Children.Add(p1, p2, p3, p4); + gui.Desktop.Children.Add(wind); + + RedoLayout(); + + Assert.AreEqual(new Rectangle(10, 10, 800, 600), wind.WidgetRect); + Assert.AreEqual(new Rectangle(0, 0, 50, 30), p1.WidgetRect, "Failed p1"); + Assert.AreEqual(new Rectangle(750, 0, 50, 30), p2.WidgetRect, "Failed p2"); + Assert.AreEqual(new Rectangle(0, 570, 50, 30), p3.WidgetRect, "Failed p3"); + Assert.AreEqual(new Rectangle(750, 570, 50, 30), p4.WidgetRect, "Failed p4"); + } + + [TestMethod] + public void CssLAbsPositionTree() + { + doc.Clear(); + doc.Parse(@" +window { position: absolute; left: 130px; top: 40px; } +.statdisplay { layout: flow; width: 400px; height: 100px; } +.statpanel { height: 100px; position: absolute; left: 105px; width:295px; } +.levelstatus { position: absolute; top: 0; right: 0; width: 100px; height: 45px; } +.hppanel { position: absolute; top: 1em; left: 0px; } +"); + var window = new Window(); + var statdisplay = new Panel { Style = "statdisplay" }; + var ibFace = new ImageBox { Style = "face" }; + var lblName = new Label { Style = "name", Text = "Name" }; + var lblLevelLabel = new Label { Style = "levelLabel", Text = "Level" }; + var lblLevel = new Label { Style = "level" }; + var pbExp = new ProgressBar { Style = "expBar" }; + + var lblHPLabel = new Label { Style = "hplabel", Text = "HP" }; + var blHP = new Panel { Style = "hp" }; + + var lblMPLabel = new Label { Style = "mplabel", Text = "MP" }; + var blMP = new Panel { Style = "mp" }; + + var statpanel = new Panel { Style = "statpanel" }; + var pnlHP = new Panel { Style = "hppanel" }; + pnlHP.Children.AddRange(new Widget[] { lblHPLabel, blHP }); + + var pnlMP = new Panel { Style = "mppanel" }; + pnlMP.Children.AddRange(new Widget[] { lblMPLabel, blMP }); + + var levelstatus = new Panel { Style = "levelstatus" }; + levelstatus.Children.Add(lblLevelLabel, lblLevel, pbExp); + + statpanel.Children.Add(lblName, levelstatus, pnlHP, pnlMP); + statdisplay.Children.Add(ibFace, statpanel); + window.Children.Add(statdisplay); + + gui.Desktop.Children.Add(window); + + RedoLayout(); + + Assert.AreEqual(new Rectangle(130, 40, 400, 100), window.WidgetRect); + Assert.AreEqual(new Rectangle(0, 0, 96, 96), ibFace.WidgetRect); + Assert.AreEqual(new Rectangle(105, 0, 295, 100), statpanel.WidgetRect); + Assert.AreEqual(new Rectangle(195, 0, 100, 45), levelstatus.WidgetRect); + Assert.AreEqual(new Rectangle(0, 0, 32, 8), lblName.WidgetRect); + Assert.AreEqual(new Rectangle(0, 8, 16, 8), pnlHP.WidgetRect); + } + + [TestMethod] + public void CssLAbsolutePositioningBoxModel() + { + doc.Clear(); + doc.Parse(@" +window { position: absolute; left: 130px; top: 40px; width: 500px; height: 400px; border: 3px solid black; } +panel { position: absolute; top: 0px; right: 0px; width: 50px; height: 40px; } +.statpanel { height: 100px; position: absolute; left: 105px; width:295px; } +.levelstatus { position: absolute; top: 0; right: 0; width: 100px; height: 45px; } +.hppanel { position: absolute; top: 1em; left: 0px; } +"); + var window = new Window(); + var panel = new Panel(); + + window.Children.Add(panel); + gui.Desktop.Children.Add(window); + + RedoLayout(); + + Assert.AreEqual(new Rectangle(130, 40, 506, 406), window.WidgetRect); + Assert.AreEqual(new Rectangle(133, 43, 500, 400), window.ClientRect); + Assert.AreEqual(new Rectangle(450, 0, 50, 40), panel.WidgetRect); + } } } Modified: trunk/AgateLib.Tests/UnitTests/UserInterface/Widgets/ConversionTests.cs =================================================================== --- trunk/AgateLib.Tests/UnitTests/UserInterface/Widgets/ConversionTests.cs 2014-09-06 07:37:48 UTC (rev 1518) +++ trunk/AgateLib.Tests/UnitTests/UserInterface/Widgets/ConversionTests.cs 2014-09-07 22:49:41 UTC (rev 1519) @@ -5,25 +5,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using AgateLib.Testing.Fakes; namespace AgateLib.UserInterface.Widgets.Tests { - - class FakeRenderer : IGuiRenderer - { - public void Draw(Gui gui) - { - } - public void Update(Gui gui, double deltaTime) - { } - } - class FakeLayout : IGuiLayoutEngine - { - public void UpdateLayout(Gui gui) - { - } - } - [TestClass] public class ConversionTests { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |