Пример #1
0
        public static void InsertAfter(this IComponentTree componentTree, ITvControl control, int position)
        {
            var metadata = componentTree.Add(control.AsComponent());
            var ctree    = componentTree.RootControls() as ControlsTree;

            ctree.InsertAfter(control.Metadata, position);
        }
Пример #2
0
        public static void Add(this IComponentTree tree, ITvContainer container)
        {
            var layoutManager = tree.Layouts() as LayoutManager;

            layoutManager.Add(container);
            tree.Add(container.AsComponent());
        }
Пример #3
0
 public ControlsTree()
 {
     _controls        = new LinkedList <TvControlMetadata>();
     _focused         = null;
     _componentTree   = null;
     _indexedControls = new Dictionary <Guid, TvControlMetadata>();
 }
Пример #4
0
        public static void Add(this IComponentTree componentTree, ITvControl control)
        {
            var metadata = componentTree.Add(control.AsComponent());
            var ctree    = componentTree.RootControls() as ControlsTree;

            ctree.Add(control.Metadata);
        }
Пример #5
0
 public TvStackPanel(IComponentTree root, string name = null)
 {
     _childs        = new KeyedComponentsTree <int>(root);
     _thisComponent = new TvComponent <StackLayout>(new StackLayout(), name ?? $"TvStackPanel_{Guid.NewGuid()}");
     Name           = _thisComponent.Name;
     _thisComponent.Metadata.ViewportChanged += OnViewportChange;
     _childs.ComponentAdded   += OnChildAdded;
     _childs.ComponentRemoved += OnChildRemoved;
 }
Пример #6
0
 public TvCanvas(IComponentTree root, string name = null)
 {
     _root          = root;
     _childs        = new ListComponentTree(root);
     _thisComponent = new TvComponent <object>(new Object(), name ?? $"TvCanvas_{Guid.NewGuid()}");
     Name           = _thisComponent.Name;
     _thisComponent.Metadata.ViewportChanged += OnViewportChange;
     _childs.ComponentAdded   += OnChildAdded;
     _childs.ComponentRemoved += OnChildRemoved;
     root.ComponentRemoved    += OnRootRemoved;
 }
Пример #7
0
        public static bool Remove(this IComponentTree componentTree, ITvControl control)
        {
            var removed = componentTree.Remove(control.AsComponent());

            if (removed)
            {
                var ctree = componentTree.RootControls() as ControlsTree;
                ctree.Remove(control.Metadata);
            }

            return(removed);
        }
Пример #8
0
        public static bool Remove(this IComponentTree tree, ITvContainer container)
        {
            var removed = tree.Remove(container.AsComponent());

            if (removed)
            {
                var layoutManager = tree.Layouts() as LayoutManager;
                layoutManager.Remove(container);
            }

            return(removed);
        }
Пример #9
0
 public TvGrid(IComponentTree root, GridState state, string name = null)
 {
     _state     = state;
     _component = new TvComponent <GridState>(_state, name ?? $"TvGrid_{Guid.NewGuid()}");
     Name       = _component.Name;
     _component.Metadata.ViewportChanged += OnViewportChanged;
     _root = root;
     _ui   = new TvGridComponentTree(_root);
     _ui.ComponentAdded     += OnComponentAdded;
     _ui.ComponentRemoved   += OnComponentRemoved;
     _root.ComponentRemoved += OnRootRemoved;
 }
Пример #10
0
        public static IEnumerable <TvControlMetadata> OwnedControls(this IComponentTree componentTree)
        {
            var allControls = componentTree.RootControls();

            foreach (var ctlMetadata in allControls.ControlsMetadata)
            {
                var ownedComponent = componentTree.Components.SingleOrDefault(c => c.ComponentId == ctlMetadata.ControlId);
                if (ownedComponent != null)
                {
                    yield return(ctlMetadata);
                }
            }
        }
Пример #11
0
        internal void Init(TvDialog dialog, IComponentTree owner)
        {
            _myDialog = dialog;
            _buttons.AddOkButton();
            _buttons.AddCancelButton();
            var viewport = _myDialog.AsComponent().Viewport.Layer(ViewportLayer.Top);

            _mainPanel = new TvStackPanel(owner, $"{_prefixNames}_MainPanel");
            _mainPanel.Layout.Add("1", "*");
            _mainPanel.AsComponent().AddViewport(new Viewport(viewport.Position + new TvPoint(1, 1), viewport.Columns - 2, viewport.Rows - 2, viewport.ZIndex));
            _bottomGrid = new TvGrid(owner, new GridState(1, 2), $"{_prefixNames}_BottomGrid");
            _bottomGrid.Use(0, 0).Add(_buttons.OkButton);
            _bottomGrid.Use(0, 1).Add(_buttons.CancelButton);
            _mainCanvas = new TvCanvas(owner, $"{_prefixNames}_BodyCanvas");
            _mainCanvas.AsComponent().AddViewport(Viewport.NullViewport);

            _mainPanel.At(0).Add(_mainCanvas);
            _mainPanel.At(1).Add(_bottomGrid);

            IsDirty = true;
        }
Пример #12
0
 internal TvDialog(ISkin skin, IViewport viewport, IComponentTree owner, string name = null)
     : base(skin, viewport.Layer(ViewportLayer.Top, -1), new DialogState(skin, name ?? $"TvDialog_{Guid.NewGuid()}"))
 {
     Metadata.CanFocus = false;
     State.Init(this, owner);
 }
Пример #13
0
 public WindowState(IComponentTree ownerTree)
 {
     _children = new ListComponentTree(ownerTree);
 }
Пример #14
0
 public static ILayoutManager Layouts(this IComponentTree componentTree) => componentTree.Engine.ServiceProvider.GetService <ILayoutManager>();
Пример #15
0
 public TvGrid(IComponentTree root) : this(root, new GridState(1, 1), null)
 {
 }
Пример #16
0
 public KeyedComponentsTree(IComponentTree root)
 {
     _myComponents = new Dictionary <T, ListComponentTree>();
     _parent       = root;
 }
Пример #17
0
 public static IControlsTree RootControls(this IComponentTree componentTree) => componentTree.Engine.ServiceProvider.GetService <IControlsTree>();
Пример #18
0
 public HookContext(ITuiEngine engine)
 {
     ComponentTree = engine.UI;
 }
Пример #19
0
 public DialogManager(ISkinManager skinManager, ITuiEngine engine)
 {
     _skinManager           = skinManager;
     _ui                    = engine.UI;
     _outsideDialogControls = new List <TvControlMetadata>();
 }
Пример #20
0
 public ListComponentTree(IComponentTree root)
 {
     _myComponents = new List <TvComponent>();
     _parent       = root;
 }
Пример #21
0
 internal void AttachTo(IComponentTree comtree)
 {
     _componentTree = comtree;
 }