Exemple #1
0
        /// <summary>
        /// Creates and initializes a new instance of a <see cref="FocusControllerView"/> object.
        /// </summary>
        /// <param name="controller">The controller on which the view is attached.</param>
        /// <param name="templateSet">The template set used to describe the view.</param>
        public static FocusControllerView Create(FocusController controller, IFocusTemplateSet templateSet)
        {
            FocusControllerView View = new FocusControllerView(controller, templateSet);

            View.Init();
            return(View);
        }
Exemple #2
0
        /// <summary></summary>
        protected virtual void PasteNode(Node node, out bool isChanged)
        {
            isChanged = false;

            FocusControllerView ControllerView = StateView.ControllerView;

            if (ControllerView.Focus is IFocusTextFocus AsTextFocus)
            {
                IFocusNodeState State = AsTextFocus.CellView.StateView.State;
                if (Type.FromGetType(State.Node).IsAssignableFrom(Type.FromGetType(node)))
                {
                    if (State.ParentIndex is IFocusBrowsingInsertableIndex AsInsertableIndex)
                    {
                        FocusController Controller = StateView.ControllerView.Controller;
                        Node            ParentNode = State.ParentInner.Owner.Node;

                        IFocusInsertionChildIndex ReplaceIndex = (IFocusInsertionChildIndex)AsInsertableIndex.ToInsertionIndex(ParentNode, node);
                        Controller.Replace(State.ParentInner, ReplaceIndex, out IWriteableBrowsingChildIndex NewIndex);

                        isChanged = true;
                    }
                }
            }
        }
Exemple #3
0
        /// <summary></summary>
        protected virtual void PasteNodeList(IList <Node> nodeList, out bool isChanged)
        {
            isChanged = false;

            FocusControllerView ControllerView = StateView.ControllerView;

            if (ControllerView.Focus is IFocusTextFocus AsTextFocus)
            {
                IFocusNodeState State        = AsTextFocus.CellView.StateView.State;
                IFocusNodeState ParentState  = State;
                bool            IsAssignable = false;

                while (!IsAssignable && ParentState != null)
                {
                    State = ParentState;

                    if (State.ParentInner is IFocusCollectionInner AsCollectionInner && (nodeList.Count == 0 || AsCollectionInner.InterfaceType.IsAssignableFrom(Type.FromGetType(nodeList[0]))))
                    {
                        IsAssignable = true;
                    }

                    ParentState = State.ParentState;
                }

                if (IsAssignable)
                {
                    if (State.ParentInner is IFocusListInner AsListInner && State.ParentIndex is IFocusBrowsingListNodeIndex AsListNodeIndex)
                    {
                        PasteNodeListToList(nodeList, AsListInner, AsListNodeIndex, out isChanged);
                    }
                    else if (State.ParentInner is IFocusBlockListInner AsBlockListInner && State.ParentIndex is IFocusBrowsingExistingBlockNodeIndex AsExistingBlockNodeIndex)
                    {
                        PasteNodeListToBlockList(nodeList, AsBlockListInner, AsExistingBlockNodeIndex, out isChanged);
                    }
                }
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusEmptyNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The child node state.</param>
 protected FocusEmptyNodeStateView(FocusControllerView controllerView, IFocusNodeState state)
     : base(controllerView, state)
 {
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusOptionalNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The optional node state.</param>
 public FocusOptionalNodeStateView(FocusControllerView controllerView, IFocusOptionalNodeState state)
     : base(controllerView, state)
 {
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusPatternStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The pattern state.</param>
 public FocusPatternStateView(FocusControllerView controllerView, IFocusPatternState state)
     : base(controllerView, state)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusPlaceholderNodeStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The child node state.</param>
 public FocusPlaceholderNodeStateView(FocusControllerView controllerView, IFocusPlaceholderNodeState state)
     : base(controllerView, state)
 {
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 public FocusBlockStateView(FocusControllerView controllerView, IFocusBlockState blockState)
     : base(controllerView, blockState)
 {
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 /// <param name="template">The frame template.</param>
 protected FocusBlockStateView(FocusControllerView controllerView, IFocusBlockState blockState, IFocusTemplate template)
     : base(controllerView, blockState, template)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusSourceStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="state">The source state.</param>
 public FocusSourceStateView(FocusControllerView controllerView, IFocusSourceState state)
     : base(controllerView, state)
 {
 }