Пример #1
0
 /// <summary>
 /// This method sets the child up to be a child of this container.
 /// </summary>
 /// <param name="child">The child to setup.</param>
 private void setChildProperties(MDIContainerBase child)
 {
     child.SuppressLayout      = true;
     child.CurrentDockLocation = CurrentDockLocation;
     child.Visible             = visible;
     child.setAlpha(alpha);
     child._setParent(this);
     child._ParentContainer = this;
     child.SuppressLayout   = false;
 }
Пример #2
0
        protected override void separator_MouseButtonPressed(Widget source, EventArgs e)
        {
            int sepIndex = separatorWidgets.IndexOf(source);

            //ignore the last separator and do not allow the drag to happen if it is clicked.
            if (sepIndex != separatorWidgets.Count - 1)
            {
                dragLastPosition = ((MouseEventArgs)e).Position;
                dragLowChild     = parentContainer.getChild(sepIndex);
                dragHighChild    = parentContainer.getChild(sepIndex + 1);
                dragTotalSize    = dragLowChild.ActualSize + dragHighChild.ActualSize;
            }
        }
Пример #3
0
        /// <summary>
        /// Swap one MDIContainerBase for another in the child list. The
        /// oldChild will be removed from the list.
        /// </summary>
        /// <param name="newChild">The child to add.</param>
        /// <param name="oldChild">The child to replace.</param>
        internal override void swapAndRemove(MDIContainerBase newChild, MDIContainerBase oldChild)
        {
            int index = children.IndexOf(oldChild);

            if (index == -1)
            {
                throw new MDIException("Attempted to swap a MDIWindow with a old child window that does not exist in this collection.");
            }
            setChildProperties(newChild);
            children.Insert(index, newChild);
            children.Remove(oldChild);
            newChild.Scale = oldChild.Scale;
        }
Пример #4
0
        private MDIWindow findWindowPositionImpl(float mouseX, float mouseY, MDIContainerBase container)
        {
            float left   = container.Location.x;
            float top    = container.Location.y;
            float right  = left + container.WorkingSize.Width;
            float bottom = top + container.WorkingSize.Height;

            if (mouseX > left && mouseX < right &&
                mouseY > top && mouseY < bottom)
            {
                return(container.findWindowAtPosition(mouseX, mouseY));
            }
            return(null);
        }
        protected override void separator_MouseButtonPressed(Widget source, EventArgs e)
        {
            int sepIndex = separatorWidgets.IndexOf(source);

            //ignore the last separator and do not allow the drag to happen if it is clicked.
            if (sepIndex != separatorWidgets.Count - 1)
            {
                dragStartPosition  = ((MouseEventArgs)e).Position - parentContainer.Location;
                dragLowChild       = parentContainer.getChild(sepIndex);
                dragLowScaleStart  = dragLowChild.Scale;
                dragHighChild      = parentContainer.getChild(sepIndex + 1);
                dragHighScaleStart = dragHighChild.Scale;
                dragTotalScale     = dragLowScaleStart + dragHighScaleStart;
                dragScaleArea      = (IntSize2)(dragTotalScale / parentContainer.TotalScale * parentContainer.WorkingSize);
            }
        }
Пример #6
0
        void separator_MouseDrag(Widget source, EventArgs e)
        {
            if (layoutContainer.ChildCount > 0)
            {
                MouseEventArgs me = (MouseEventArgs)e;
                switch (CurrentDockLocation)
                {
                case DockLocation.Left:
                    MDIContainerBase child      = layoutContainer.getChild(layoutContainer.ChildCount - 1);
                    IntSize2         actualSize = child.ActualSize;
                    actualSize.Width = me.Position.x - child.Location.x;
                    child.ActualSize = actualSize;
                    break;

                case DockLocation.Right:
                    child            = layoutContainer.getChild(0);
                    actualSize       = child.ActualSize;
                    actualSize.Width = (child.Location.x + actualSize.Width) - me.Position.x;
                    child.ActualSize = actualSize;
                    break;

                case DockLocation.Top:
                    child             = layoutContainer.getChild(layoutContainer.ChildCount - 1);
                    actualSize        = child.ActualSize;
                    actualSize.Height = me.Position.y - child.Location.y;
                    child.ActualSize  = actualSize;
                    break;

                case DockLocation.Bottom:
                    child             = layoutContainer.getChild(0);
                    actualSize        = child.ActualSize;
                    actualSize.Height = (child.Location.y + actualSize.Height) - me.Position.y;
                    child.ActualSize  = actualSize;
                    break;
                }
                invalidate();
            }
        }
 protected override void separator_MouseButtonReleased(Widget source, EventArgs e)
 {
     dragLowChild  = null;
     dragHighChild = null;
 }
Пример #8
0
 internal override void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer)
 {
     throw new NotSupportedException();
 }
Пример #9
0
 internal override void swapAndRemove(MDIContainerBase newChild, MDIContainerBase oldChild)
 {
     throw new NotSupportedException();
 }
Пример #10
0
 internal override void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer)
 {
     layoutContainer.promoteChild(mdiContainerBase, mdiLayoutContainer);
 }
Пример #11
0
 internal override void swapAndRemove(MDIContainerBase newChild, MDIContainerBase oldChild)
 {
     layoutContainer.swapAndRemove(newChild, oldChild);
 }
Пример #12
0
 /// <summary>
 /// This is a helper method to promote a child to a parent container. It
 /// will swap the child with the formerParent's location and then
 /// dispose the formerParent.
 /// </summary>
 /// <param name="child">The child to promote.</param>
 /// <param name="formerParent">The former parent of child that will be replaced.</param>
 internal override void promoteChild(MDIContainerBase child, MDILayoutContainer formerParent)
 {
     swapAndRemove(child, formerParent);
     formerParent.Dispose();
     invalidate();
 }
 internal abstract void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer);
 internal abstract void swapAndRemove(MDIContainerBase newChild, MDIContainerBase oldChild);