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); }
public static void Add(this IComponentTree tree, ITvContainer container) { var layoutManager = tree.Layouts() as LayoutManager; layoutManager.Add(container); tree.Add(container.AsComponent()); }
public ControlsTree() { _controls = new LinkedList <TvControlMetadata>(); _focused = null; _componentTree = null; _indexedControls = new Dictionary <Guid, TvControlMetadata>(); }
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); }
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; }
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; }
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); }
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); }
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; }
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); } } }
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; }
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); }
public WindowState(IComponentTree ownerTree) { _children = new ListComponentTree(ownerTree); }
public static ILayoutManager Layouts(this IComponentTree componentTree) => componentTree.Engine.ServiceProvider.GetService <ILayoutManager>();
public TvGrid(IComponentTree root) : this(root, new GridState(1, 1), null) { }
public KeyedComponentsTree(IComponentTree root) { _myComponents = new Dictionary <T, ListComponentTree>(); _parent = root; }
public static IControlsTree RootControls(this IComponentTree componentTree) => componentTree.Engine.ServiceProvider.GetService <IControlsTree>();
public HookContext(ITuiEngine engine) { ComponentTree = engine.UI; }
public DialogManager(ISkinManager skinManager, ITuiEngine engine) { _skinManager = skinManager; _ui = engine.UI; _outsideDialogControls = new List <TvControlMetadata>(); }
public ListComponentTree(IComponentTree root) { _myComponents = new List <TvComponent>(); _parent = root; }
internal void AttachTo(IComponentTree comtree) { _componentTree = comtree; }