void IMauiContainerElementHandler.AddChild(MC.Element child, int physicalSiblingIndex)
        {
            var index = Math.Min(physicalSiblingIndex, Elements.Count);

            Elements.Insert(index, child);
            ChildAdded?.Invoke(child);
        }
Exemplo n.º 2
0
    public static void GiveBirthToChild()
    {
        Child child = Children[currentChildIndex];

        child.State = Child.ChildState.kAlive;

        if (ChildAdded != null)
        {
            ChildAdded.Invoke(child);
        }

        currentChildIndex++;
    }
Exemplo n.º 3
0
        /// <summary>
        /// Calls the <see cref="AddElement"/> method with the specified parameters.
        /// </summary>
        /// <param name="child">The <see cref="SvgElement"/> that has been added.</param>
        /// <param name="index">An <see cref="int"/> representing the index where the element was added to the collection.</param>
        internal void OnElementAdded(SvgElement child, int index)
        {
            this.AddElement(child, index);
            SvgElement sibling = null;

            if (index < (Children.Count - 1))
            {
                sibling = Children[index + 1];
            }
            ChildAdded?.Invoke(this, new ChildAddedEventArgs {
                NewChild = child, BeforeSibling = sibling
            });
        }
Exemplo n.º 4
0
        protected virtual void OnChildAdded(Element child)
        {
            child.Parent = this;

            child.ApplyBindings(skipBindingContext: false, fromBindingContextChanged: true);

            ChildAdded?.Invoke(this, new ElementEventArgs(child));

            OnDescendantAdded(child);
            foreach (Element element in child.Descendants())
            {
                OnDescendantAdded(element);
            }
        }
Exemplo n.º 5
0
        private void HandlePut(ServerEvent serverEvent)
        {
            lock (CacheLock)
            {
                var token = Cache.SelectToken(serverEvent.ChildKey, false);
                if (token != null && token.Parent == null)
                {
                    var newChildren = serverEvent.Data.Children().Except(Cache.Children());
                    foreach (var child in newChildren)
                    {
                        ChildAdded?.Invoke(child.GetType() == typeof(JValue) ? child : child.First);
                    }

                    var removedChildren = Cache.Children().Except(serverEvent.Data.Children());
                    foreach (var child in removedChildren)
                    {
                        ChildRemoved?.Invoke(child.First);
                    }

                    Cache = serverEvent.Data as JObject ?? new JObject();
                }
                else
                {
                    if (token == null)
                    {
                        Cache[serverEvent.Path] = serverEvent.Data as JToken;
                        ChildAdded?.Invoke(Cache[serverEvent.Path]);
                    }
                    else
                    {
                        if (serverEvent.Data.ToObject <object>() == null)
                        {
                            var removedChild = Cache.SelectToken(serverEvent.Path, false);
                            Cache.SelectToken(serverEvent.Path, false)?.Parent?.Remove();
                            ChildRemoved?.Invoke(removedChild);
                        }
                        else
                        {
                            var subChildPath = string.Join(".", serverEvent.Path.Split('.').Skip(1));
                            token[subChildPath] = serverEvent.Data as JToken;
                            ChildChanged?.Invoke(Cache.SelectToken(serverEvent.ChildKey, false));
                        }
                    }
                }

                ValueChanged?.Invoke(Cache);
            }
        }
Exemplo n.º 6
0
        protected virtual void OnChildAdded(Element child)
        {
            if (child == null)
            {
                throw new ArgumentNullException(nameof(child));
            }

            child.Parent = this;

            child.ApplyBindings(skipBindingContext: false, fromBindingContextChanged: true);

            ChildAdded?.Invoke(this, new ElementEventArgs(child));

            OnDescendantAdded(child);
            foreach (Element element in child.Descendants())
            {
                OnDescendantAdded(element);
            }
        }
Exemplo n.º 7
0
    public override bool DragAndDrop_HandleDrop(Gwen.DragDrop.Package pPackage, int x, int y)
    {
	    var pPos = CanvasPosToLocal( new Point( x, y ) );

	    m_SelectionLayer.Hide();
	    var pDroppedOn = GetControlAt( pPos.X, pPos.Y );
	   // pDroppedOn = FindParentControlFactoryControl( pDroppedOn );
	    m_SelectionLayer.Show();

	    if ( pDroppedOn == null ) 
            pDroppedOn = this;

	    pPos = pDroppedOn.CanvasPosToLocal( new Point( x, y ) );
	

	    if ( pPackage.Name == "ControlSpawn" )
	    {
		    //ControlFactory::Base* pControlFactory = static_cast<ControlFactory::Base*>(pPackage->userdata);

            var type = pPackage.data as Type;
            if (type == null)
                return false; //TODO LOG

            var constructor = type.GetConstructor(new Type[] { typeof(Gwen.Control.Base) });
            if (constructor == null)
                return false; //TODO LOG

            var pControl = (Gwen.Control.Base) constructor.Invoke(new object[] { pDroppedOn });
            if (pControl == null)
                return false; //TODO LOG

            pControl.SetPosition(pPos.X, pPos.Y);
		    pControl.MouseInputEnabled = true ;

            if (ChildAdded != null)
		        ChildAdded.Invoke(pControl);

		    return true;
	    }
        
	    return false;
    }
Exemplo n.º 8
0
 /// <summary>
 /// Notifies the <see cref="IRenderer"/> about a child added to this element.
 /// </summary>
 /// <param name="element">The element.</param>
 protected void NotifyChildAdded(FrameworkElement element)
 {
     ChildAdded?.Invoke(this, element);
 }
Exemplo n.º 9
0
 public void AddChild(EntityObject child)
 {
     Children.Add(child);
     ChildAdded?.Invoke(this, child);
 }
Exemplo n.º 10
0
 private void OnChildAdded(ExtendedForm parent, ExtendedForm child)
 {
     ChildAdded?.Invoke(parent, child);
     parentForm?.OnChildAdded(parent, child);
 }
Exemplo n.º 11
0
 protected virtual void OnChildAdded(EventArgs e)
 {
     ChildAdded?.Invoke(this, CurrentChild);
 }
Exemplo n.º 12
0
 protected virtual void OnChildAdded(ControlArgs e)
 {
     ChildAdded?.Invoke(this, e);
 }
 private void OnEntityAdded(Entity child)
 {
     ChildAdded?.Invoke(null, child);
 }
Exemplo n.º 14
0
 protected virtual void RaiseChildAdded(Instance child)
 {
     ChildAdded?.Invoke(this, new ChildAddedEventArgs(child));
 }
Exemplo n.º 15
0
 protected virtual void OnChildAdded(IDataStructure sender, IDataStructure datastructure)
 {
     ChildAdded?.Invoke(sender, datastructure);
 }
        protected override bool HandleMessage(WidgetMessage message, Widget widget, IntPtr param1, IntPtr param2)
        {
            bool handled = false;

            switch (message)
            {
            case WidgetMessage.Create:
                Created?.Invoke(widget, param1 != default, ref handled);
                break;

            case WidgetMessage.Destroy:
                Destroyed?.Invoke(widget, param1 != default, ref handled);
                break;

            case WidgetMessage.Paint:
                Paint?.Invoke(widget, ref handled);
                break;

            case WidgetMessage.Draw:
                Draw?.Invoke(widget, ref handled);
                break;

            case WidgetMessage.KeyPress:
                KeyPressed?.Invoke(widget, ref AsRef <KeyState>(param1), ref handled);
                break;

            case WidgetMessage.KeyTakeFocus:
                TakingFocus?.Invoke(widget, param1 != default, ref handled);
                break;

            case WidgetMessage.KeyLoseFocus:
                LostFocus?.Invoke(widget, param1 != default, ref handled);
                break;

            case WidgetMessage.MouseDown:
                MouseDown?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled);
                break;

            case WidgetMessage.MouseDrag:
                MouseDrag?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled);
                break;

            case WidgetMessage.MouseUp:
                MouseUp?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled);
                break;

            case WidgetMessage.Reshape:
                Reshape?.Invoke(widget, Widget.GetOrCreate(param1), ref AsRef <WidgetGeometryChange>(param2), ref handled);
                break;

            case WidgetMessage.ExposedChanged:
                ExposedChanged?.Invoke(widget, ref handled);
                break;

            case WidgetMessage.AcceptChild:
                ChildAdded?.Invoke(widget, Widget.GetOrCreate(param1), ref handled);
                break;

            case WidgetMessage.LoseChild:
                ChildRemoved?.Invoke(widget, Widget.GetOrCreate(param1), ref handled);
                break;

            case WidgetMessage.AcceptParent:
                ParentChanged?.Invoke(widget, param1 != default ? Widget.GetOrCreate(param1) : null, ref handled);
                break;

            case WidgetMessage.Shown:
                Shown?.Invoke(widget, Widget.GetOrCreate(param1), ref handled);
                break;

            case WidgetMessage.Hidden:
                Hidden?.Invoke(widget, Widget.GetOrCreate(param1), ref handled);
                break;

            case WidgetMessage.DescriptorChanged:
                DescriptorChanged?.Invoke(widget, ref handled);
                break;

            case WidgetMessage.PropertyChanged:
                PropertyChanged?.Invoke(widget, param1.ToInt32(), param2, ref handled);
                break;

            case WidgetMessage.MouseWheel:
                MouseWheel?.Invoke(widget, ref AsRef <MouseState>(param1), ref handled);
                break;

            case WidgetMessage.CursorAdjust:
                CursorAdjust?.Invoke(widget, ref AsRef <MouseState>(param1), ref AsRef <CursorStatus>(param2), ref handled);
                break;
            }
            return(handled);
        }