Beispiel #1
0
 ButtonPosition GetButtonMouseOn(Control sender, int screenX = 0, int screenY = 0)
 {
     for (int i = 0; i < _buttonList.Length; i++)
     {
         if (CoodinateHandling.isEntered(_buttonList[i], screenX, screenY))
         {
             return(_buttonPosList[i]);
         }
     }
     return(ButtonPosition.NotOnTheButton);
 }
Beispiel #2
0
 IconCenter.ButtonPosition checkIfOverCenterBtns()
 {
     // Point pt = CoodinateHandling.FromScreenToClient(, , _iconCenter);
     for (int i = 0; i < _iconCenter._buttonList.Length; i++)
     {
         if (CoodinateHandling.isEntered(_iconCenter._buttonList[i]))
         {
             return(_iconCenter._buttonPosList[i]);
         }
     }
     return(IconCenter.ButtonPosition.NotOnTheButton);
 }
Beispiel #3
0
        internal void Dragging(DockingContainer movingObj, int x, int y)
        {
            int maxDepth = 0;
            int depth;
            DockingContainer selectedSuccessor = null;

            this.Invalidate();
            foreach (DockingContainer d in _successors.Values)
            {
                //for (int i = 0; i < _successors.Count; i++)
                //{

                if (CoodinateHandling.isEntered(d, 0, 0) && d.isInPopup() == false)
                {
                    if ((depth = d.getDepth()) > maxDepth)
                    {
                        maxDepth          = depth;
                        selectedSuccessor = d;
                    }
                }
            }
            if (maxDepth > 0)
            {
                Rectangle rect   = CoodinateHandling.FromClientToClient(selectedSuccessor, this);
                Point     center = CoodinateHandling.getCenter(rect, _iconCenter.Width, _iconCenter.Height);

                ShowSelection(checkIfOverCenterBtns(), selectedSuccessor, movingObj);
                _iconCenter.SetBounds(center.X, center.Y, 0, 0, BoundsSpecified.Location);
                _iconCenter.Show();
                _iconCenter.BringToFront();
                _iconCenter.label1.Text = "" + selectedSuccessor.getDepth() + "/" + selectedSuccessor.Name + "/" + selectedSuccessor.getContainerType().ToString();
            }
            else
            {
                _selection.Hide();
            }
        }
Beispiel #4
0
        void TitleBar_MouseDown(object sender, MouseEventArgs e)
        {
            if (_parent.isInPopup() == false)
            {
                Rectangle rect = CoodinateHandling.GetFormBoundWithControlsBound(_parent, _popup);

                _popup.SetBounds(rect.X, rect.Y, rect.Width + _popup.Padding.Left + _popup.Padding.Right, rect.Height + _popup.Padding.Top + _popup.Padding.Bottom, BoundsSpecified.All);
                _popup.Show();
                _popup.setContent(this._parent);
                _parent.setNowInPopup(true);
                _root.Disconnect(_parent.Name);
                _parent.PopThisFromParent();
                _popup.BringToFront();
            }
            _pressedPt = CoodinateHandling.GetWindowPointFromControlOffset(_popup, this, e.X, e.Y);

            _isDragging     = true;
            _popup.Opacity  = 0.7;
            this.MouseDown -= _mouseDown;
            this.MouseMove += _mouseMove;
            //_popup.MouseMove += _mouseMove;
            this.MouseUp += _mouseUp;
            _root.DragBegin(_parent, Control.MousePosition.X, Control.MousePosition.Y);
        }
Beispiel #5
0
        void ShowSelection(IconCenter.ButtonPosition pos, DockingContainer dockParent, DockingContainer popup)
        {
            if (pos == IconCenter.ButtonPosition.NotOnTheButton)
            {
                _selection.Hide();
                return;
            }
            _selectedDockingContainer = dockParent;
            _posToDock = pos;
            Size      popupSize     = popup.ClientSize;
            Rectangle dockScreen    = CoodinateHandling.GetScreenRect(dockParent);
            Size      parentSize    = dockParent.Parent.ClientSize;
            Rectangle selectionRect = new Rectangle(dockScreen.Location, dockScreen.Size);

            switch (pos)
            {
            case IconCenter.ButtonPosition.B_BottomHalf:
                selectionRect.Y += selectionRect.Height = dockScreen.Height / 2;
                break;

            case IconCenter.ButtonPosition.B_BottomRemain:
                if (dockScreen.Height + popupSize.Height > parentSize.Height)
                {
                    selectionRect.Y += selectionRect.Height = dockScreen.Height / 2;
                }
                else
                {
                    selectionRect.Height = popupSize.Height;
                    selectionRect.Y     += dockScreen.Height - popupSize.Height;
                }
                break;

            case IconCenter.ButtonPosition.B_Center:
                //그대로
                break;

            case IconCenter.ButtonPosition.B_LeftHalf:
                selectionRect.Width /= 2;
                break;

            case IconCenter.ButtonPosition.B_LeftRemain:
                if (dockScreen.Width + popupSize.Width > parentSize.Width)
                {
                    selectionRect.Width /= 2;
                }
                else
                {
                    selectionRect.Width = popupSize.Width;
                }
                break;

            case IconCenter.ButtonPosition.B_RightHalf:
                selectionRect.X += selectionRect.Width = selectionRect.Width / 2;
                break;

            case IconCenter.ButtonPosition.B_RightRemain:
                if (dockScreen.Width + popupSize.Width > parentSize.Width)
                {
                    selectionRect.Width /= 2;
                }
                else
                {
                    selectionRect.Width = popupSize.Width;
                }
                selectionRect.X += dockScreen.Width - selectionRect.Width;
                break;

            case IconCenter.ButtonPosition.B_TopHalf:
                selectionRect.Height /= 2;
                break;

            case IconCenter.ButtonPosition.B_TopRemain:
                if (dockScreen.Height + popupSize.Height > parentSize.Height)
                {
                    selectionRect.Height = selectionRect.Height /= 2;
                }
                else
                {
                    selectionRect.Height = popupSize.Height;
                }
                break;

            case IconCenter.ButtonPosition.NotOnTheButton:
                _selection.Hide();
                break;
            }
            _selection.SetBounds(selectionRect.X, selectionRect.Y, selectionRect.Width, selectionRect.Height);
            _selection.Show();
            _selection.BringToFront();
            this.Refresh();
        }
 internal Boolean isHotArea(int x, int y)
 {
     return(CoodinateHandling.isEntered(this, x, y));
 }