Beispiel #1
0
        public void Dock(DockObject requestor, DockPlacement position, object data)
        {
            if (requestor == null || requestor == this)
            {
                return;
            }

            if (master == null)
            {
                Console.WriteLine("Dock operation requested in a non-bound object {0}.", this);
                Console.WriteLine("This might break.");
            }

            if (!requestor.IsBound)
            {
                requestor.Bind(Master);
            }

            if (requestor.Master != Master)
            {
                Console.WriteLine("Cannot dock {0} to {1} as they belong to different masters.",
                                  requestor, this);
                return;
            }

            /* first, see if we can optimize things by reordering */
            if (position != DockPlacement.None)
            {
                DockObject parent = ParentObject;
                if (OnReorder(requestor, position, data) ||
                    (parent != null && parent.OnReorder(requestor, position, data)))
                {
                    return;
                }
            }

            /* freeze the object, since under some conditions it might
             * be destroyed when detaching the requestor */
            Freeze();

            /* detach the requestor before docking */
            if (requestor.IsAttached)
            {
                requestor.Detach(false);
            }

            /* notify interested parties that an object has been docked. */
            if (position != DockPlacement.None)
            {
                OnDocked(requestor, position, data);
                DockedHandler handler = Docked;
                if (handler != null)
                {
                    DockedArgs args = new DockedArgs(requestor, position);
                    handler(this, args);
                }
            }

            Thaw();
        }
Beispiel #2
0
        private void OnItemDocked(object o, DockedArgs args)
        {
            DockItem requestor = args.Requestor as DockItem;

            // here we are in fact interested in the requestor, since it's
            // assumed that object will not change its visibility... for the
            // requestor, however, could mean that it's being shown
            if (!requestor.InReflow && !requestor.IsAutomatic)
            {
                EmitLayoutChangedEvent();
            }
        }
        void OnHostDocked(object sender, DockedArgs a)
        {
            DockObject obj = sender as DockObject;

            // see if the given position is compatible for the stack's top element
            if (!sticky && placementStack != null)
            {
                DockPlacement pos = NextPlacement;
                if (obj.ChildPlacement(a.Requestor, ref pos))
                {
                    DoExcursion();
                }
            }

            PrintPlacementStack();
        }
        void OnHostDocked(object sender, DockedArgs a)
        {
            DockObject obj = sender as DockObject;
            // see if the given position is compatible for the stack's top element
            if (!sticky && placementStack != null) {
                DockPlacement pos = NextPlacement;
                if (obj.ChildPlacement (a.Requestor, ref pos))
                    DoExcursion ();
            }

            PrintPlacementStack ();
        }
        private void OnItemDocked(object o, DockedArgs args)
        {
            DockItem requestor = args.Requestor as DockItem;

            // here we are in fact interested in the requestor, since it's
            // assumed that object will not change its visibility... for the
            // requestor, however, could mean that it's being shown
            if (!requestor.InReflow && !requestor.IsAutomatic)
                EmitLayoutChangedEvent ();
        }
        public void Dock(DockObject requestor, DockPlacement position, object data)
        {
            if (requestor == null || requestor == this)
                return;

            if (master == null) {
                Console.WriteLine ("Dock operation requested in a non-bound object {0}.", this);
                Console.WriteLine ("This might break.");
            }

            if (!requestor.IsBound)
                requestor.Bind (Master);

            if (requestor.Master != Master) {
                Console.WriteLine ("Cannot dock {0} to {1} as they belong to different masters.",
                           requestor, this);
                return;
            }

            /* first, see if we can optimize things by reordering */
            if (position != DockPlacement.None) {
                DockObject parent = ParentObject;
                if (OnReorder (requestor, position, data) ||
                    (parent != null && parent.OnReorder (requestor, position, data)))
                    return;
            }

            /* freeze the object, since under some conditions it might
               be destroyed when detaching the requestor */
            Freeze ();

            /* detach the requestor before docking */
            if (requestor.IsAttached)
                requestor.Detach (false);

            /* notify interested parties that an object has been docked. */
            if (position != DockPlacement.None) {
                OnDocked (requestor, position, data);
                DockedHandler handler = Docked;
                if (handler != null) {
                    DockedArgs args = new DockedArgs (requestor, position);
                    handler (this, args);
                }
            }

            Thaw ();
        }