예제 #1
0
        internal virtual IAbcVisual CreateVisual(Type abcVisualType)
        {
            Func <IAbcVisual> creator = visualCreator[abcVisualType];
            IAbcVisual        visual  = creator();

            return(visual);
        }
예제 #2
0
        protected virtual void OnVisualParentChanged(IAbcVisual oldVisualParent)
        {
            //// TODO: Consider changing this behavior - right now an element adds itself to a parent, but perhaps
            //// an element should only add its children. In essence this code could be moved inside the visuals container.

            this.RemoveFromParent(oldVisualParent);
            this.AddToParent();
        }
예제 #3
0
        private void Children_ItemAdded(object sender, ObservableItemCollectionChangedEventArgs <IAbcVisual> args)
        {
            args.Item.VisualParent = this;

            IAbcVisual abcVisual = this;

            if (abcVisual.VisualTree != null)
            {
                args.Item.VisualTree = abcVisual.VisualTree;
            }
        }
예제 #4
0
        private void RemoveFromParent(IAbcVisual oldVisualParent)
        {
            if (oldVisualParent == null)
            {
                return;
            }

            WpfVisual wpfVisualParent = (WpfVisual)oldVisualParent;
            Panel     parentPanel     = (Panel)wpfVisualParent.uiElement;

            parentPanel.Children.Remove(this.uiElement);
        }
예제 #5
0
        private void RemoveFromParent(IAbcVisual oldVisualParent)
        {
            if (oldVisualParent == null)
            {
                return;
            }

            var androidVisualParent = (AndroidVisual)oldVisualParent;
            var parentPanel         = (ViewGroup)androidVisualParent.view;

            parentPanel.RemoveView(this.view);
        }
예제 #6
0
        internal override void PaintOverride(AbcArrangeContext context)
        {
            base.PaintOverride(context);

            IAbcVisual abcVisual   = this;
            AbcRect    arrangeSlot = abcVisual.ArrangeSlot;

            object drawingContextObject;

            context.Bag.TryGetBagObject(WpfRenderingVisualTree.DrawingContextIdentifier, out drawingContextObject);
            DrawingContext drawingContext = (DrawingContext)drawingContextObject;

            drawingContext.DrawRectangle(Brushes.Black, null, new Rect(arrangeSlot.x, arrangeSlot.y, arrangeSlot.size.width, arrangeSlot.size.height));
        }
예제 #7
0
        void IAbcVisual.Measure(AbcMeasureContext context)
        {
            IAbcVisual abcVisual = this;

            if (!abcVisual.IsVisible)
            {
                return;
            }

            this.isMeasurePhase = true;
            this.MeasureOverride(context);
            this.isMeasurePhase = false;
            this.isMeasureValid = true;
        }
예제 #8
0
 private void PropagateUpInvalidationRequest(InvalidationRequestFlag flag)
 {
     if (this.visualParent != null)
     {
         this.visualParent.InvalidationRequestFromChild(flag, this);
     }
     else
     {
         IAbcVisual abcVisual = this;
         AbcContextualPropertyValue controlPropertyValue = abcVisual.GetContextualPropertyValue(AbcControlContextualProperties.ControlPropertyKey);
         IAbcControl control = (IAbcControl)(controlPropertyValue != null ? ((AbcContextualPropertyValue.AbcObject)controlPropertyValue).value : null);
         control?.RaiseInvalidationRequest(flag);
     }
 }
예제 #9
0
        private void AddToParent()
        {
            IAbcVisual abcVisual       = this;
            IAbcVisual abcVisualParent = abcVisual.VisualParent;

            if (abcVisualParent == null)
            {
                return;
            }

            WpfVisual wpfVisualParent = (WpfVisual)abcVisualParent;
            Panel     parentPanel     = (Panel)wpfVisualParent.uiElement;

            parentPanel.Children.Add(this.uiElement);
        }
예제 #10
0
        private void AddToParent()
        {
            IAbcVisual abcVisual       = this;
            IAbcVisual abcVisualParent = abcVisual.VisualParent;

            if (abcVisualParent == null)
            {
                return;
            }

            var androidVisualParent = (AndroidVisual)abcVisualParent;
            var parentPanel         = (ViewGroup)androidVisualParent.view;

            parentPanel.AddView(this.view);
        }
예제 #11
0
        private void RemoveFromParent(IAbcVisual oldVisualParent)
        {
            if (this.control == null)
            {
                return;
            }

            if (oldVisualParent == null)
            {
                return;
            }

            WFVisual wfVisualParent = (WFVisual)oldVisualParent;
            Panel    panel          = (Panel)wfVisualParent.control;

            panel.Controls.Remove(this.control);
        }
예제 #12
0
        void IAbcVisual.Paint(AbcArrangeContext context)
        {
            if (!this.isVisible)
            {
                return;
            }

            if (!this.isArrangeValid)
            {
                IAbcVisual abcVisual = this;
                abcVisual.Arrange(context);
            }

            this.isPaintPhase = true;
            this.PaintOverride(context);
            this.isPaintPhase = false;
        }
예제 #13
0
        private void AddToParent()
        {
            if (this.control == null)
            {
                return;
            }

            IAbcVisual abcVisual       = this;
            IAbcVisual abcVisualParent = abcVisual.VisualParent;

            if (abcVisualParent == null)
            {
                return;
            }

            WFVisual wfVisualParent = (WFVisual)abcVisualParent;
            Panel    panel          = (Panel)wfVisualParent.control;

            panel.Controls.Add(this.control);
        }
예제 #14
0
        void IAbcVisual.Arrange(AbcArrangeContext context)
        {
            if (!this.isVisible)
            {
                return;
            }

            if (!this.isMeasureValid)
            {
                IAbcVisual abcVisual = this;
                abcVisual.Measure(new AbcMeasureContext(context.arrangeSlot.size, context));
            }

            this.isArrangePhase = true;
            this.arrangeSlot    = context.arrangeSlot;
            this.ArrangeOverride(context);
            context.arrangeSlot = this.arrangeSlot;
            this.isArrangePhase = false;
            this.isArrangeValid = true;
        }
예제 #15
0
        internal override void PaintOverride(AbcArrangeContext context)
        {
            base.PaintOverride(context);

            if (!this.TryEnsureFormattedText())
            {
                return;
            }

            IAbcVisual abcVisual   = this;
            AbcRect    arrangeSlot = abcVisual.ArrangeSlot;

            object drawingContextObject;

            context.Bag.TryGetBagObject(WpfRenderingVisualTree.DrawingContextIdentifier, out drawingContextObject);
            DrawingContext drawingContext = (DrawingContext)drawingContextObject;

            Point position = new Point(arrangeSlot.x, arrangeSlot.y);

            drawingContext.DrawText(this.nativeFormattedText, position);
        }
예제 #16
0
        void IAbcVisual.InvalidationRequestFromChild(InvalidationRequestFlag flag, IAbcVisual child)
        {
            switch (flag)
            {
            case InvalidationRequestFlag.None:
                break;

            case InvalidationRequestFlag.Measure:
                this.InvalidateMeasure();
                break;

            case InvalidationRequestFlag.Arrange:
                this.InvalidateArrange();
                break;

            case InvalidationRequestFlag.Paint:
                this.InvalidatePaint();
                break;

            default:
                break;
            }
        }
예제 #17
0
 protected void SetRoot(IAbcVisual newRoot)
 {
     this.root = newRoot;
 }
예제 #18
0
 protected virtual void OnVisualParentChanged(IAbcVisual oldVisualParent)
 {
     this.RemoveFromParent(oldVisualParent);
     this.AddToParent();
 }
예제 #19
0
 protected virtual void OnVisualParentChanged(IAbcVisual oldVisualParent)
 {
 }