| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // Copyright (c) The Avalonia Project. All rights reserved.
- // Licensed under the MIT license. See licence.md file in the project root for full license information.
- using System;
- using Avalonia.Controls;
- using Avalonia.Controls.Presenters;
- using Avalonia.Controls.Templates;
- using Avalonia.Layout;
- using Avalonia.Platform;
- using Avalonia.Rendering;
- using Avalonia.Styling;
- namespace Avalonia.UnitTests
- {
- public class TestTemplatedRoot : ContentControl, ILayoutRoot, INameScope, IRenderRoot, IStyleRoot
- {
- private readonly NameScope _nameScope = new NameScope();
- public TestTemplatedRoot()
- {
- Template = new FuncControlTemplate<TestTemplatedRoot>(x => new ContentPresenter());
- }
- public event EventHandler<NameScopeEventArgs> Registered
- {
- add { _nameScope.Registered += value; }
- remove { _nameScope.Registered -= value; }
- }
- public event EventHandler<NameScopeEventArgs> Unregistered
- {
- add { _nameScope.Unregistered += value; }
- remove { _nameScope.Unregistered -= value; }
- }
- public Size ClientSize => new Size(100, 100);
- public Size MaxClientSize => Size.Infinity;
- public double LayoutScaling => 1;
- public double RenderScaling => 1;
- public ILayoutManager LayoutManager => AvaloniaLocator.Current.GetService<ILayoutManager>();
- public IRenderTarget RenderTarget => null;
- public IRenderer Renderer => null;
- public IRenderTarget CreateRenderTarget()
- {
- throw new NotImplementedException();
- }
- public void Invalidate(Rect rect)
- {
- throw new NotImplementedException();
- }
- public Point PointToClient(Point p) => p;
- public Point PointToScreen(Point p) => p;
- void INameScope.Register(string name, object element)
- {
- _nameScope.Register(name, element);
- }
- object INameScope.Find(string name)
- {
- return _nameScope.Find(name);
- }
- void INameScope.Unregister(string name)
- {
- _nameScope.Unregister(name);
- }
- }
- }
|