internal virtual IAbcVisual CreateVisual(Type abcVisualType) { Func <IAbcVisual> creator = visualCreator[abcVisualType]; IAbcVisual visual = creator(); return(visual); }
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(); }
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; } }
private void RemoveFromParent(IAbcVisual oldVisualParent) { if (oldVisualParent == null) { return; } WpfVisual wpfVisualParent = (WpfVisual)oldVisualParent; Panel parentPanel = (Panel)wpfVisualParent.uiElement; parentPanel.Children.Remove(this.uiElement); }
private void RemoveFromParent(IAbcVisual oldVisualParent) { if (oldVisualParent == null) { return; } var androidVisualParent = (AndroidVisual)oldVisualParent; var parentPanel = (ViewGroup)androidVisualParent.view; parentPanel.RemoveView(this.view); }
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)); }
void IAbcVisual.Measure(AbcMeasureContext context) { IAbcVisual abcVisual = this; if (!abcVisual.IsVisible) { return; } this.isMeasurePhase = true; this.MeasureOverride(context); this.isMeasurePhase = false; this.isMeasureValid = true; }
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); } }
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); }
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); }
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); }
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; }
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); }
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; }
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); }
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; } }
protected void SetRoot(IAbcVisual newRoot) { this.root = newRoot; }
protected virtual void OnVisualParentChanged(IAbcVisual oldVisualParent) { this.RemoveFromParent(oldVisualParent); this.AddToParent(); }
protected virtual void OnVisualParentChanged(IAbcVisual oldVisualParent) { }