示例#1
0
        //-------------------------------------------------------------------
        public void Add(GuiControlInterface _itf, bool _visible = true)
        {
            if (Children.IndexOf(_itf) != -1)
            {
                return;
            }
            if (_itf.Control == null)
            {
                return;
            }
            if (_itf.Control.Parent != null)
            {
                return;
            }

            _itf.Control.Parent  = this;
            _itf.Control.Anchor  = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            _itf.Control.Left    = 0;
            _itf.Control.Width   = Width;
            _itf.Control.Top     = Theme.Current.TabHeader_Height;
            _itf.Control.Height  = Height - Theme.Current.TabHeader_Height;
            _itf.Control.Visible = false;
            _itf.OwnerContainer  = this;

            Children.Add(_itf);

            if (_visible || _Current == null)
            {
                Current = _itf;
            }
            Invalidate();
        }
示例#2
0
 //-------------------------------------------------------------------
 public void SetFocus(GuiControlInterface _control)
 {
     if (Children.Contains(_control))
     {
         Current = _control as GuiControlInterface;
     }
 }
 //-------------------------------------------------------------------
 public void Remove(GuiControlInterface _control, bool _closeIfEmpty)
 {
     if (Panel1.Controls.Count == 1 && Panel1.Controls[0] is ControlContainerInterface)
     {
         (Panel1.Controls[0] as ControlContainerInterface).Remove(_control, _closeIfEmpty);
     }
     if (Panel2.Controls.Count == 1 && Panel2.Controls[0] is ControlContainerInterface)
     {
         (Panel2.Controls[0] as ControlContainerInterface).Remove(_control, _closeIfEmpty);
     }
 }
示例#4
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (Capture && _MovedTaxonControl != null)
            {
                Rectangle R = _HeaderRect;
                R.Inflate(5, 5);

                if (!R.Contains(e.Location))
                {
                    FormContainer form = FormContainer.GetFormContainer(this);

                    GuiControlInterface tuc = _MovedTaxonControl;
                    Remove(_MovedTaxonControl, false);

                    FormContainer moveForm = new FormContainer(tuc);
                    moveForm.Show();

                    Point global = Cursor.Position;
                    moveForm.Left = global.X - 20;
                    moveForm.Top  = global.Y - 8;

                    FormContainer tempForm = moveForm;
                    SendMessage(this.Handle.ToInt32(), WM_LBUTTONUP, 0, 0);
                    SendMessage(tempForm.Handle.ToInt32(), WM_SYSCOMMAND, SC_MOVE | 0x02, 0);

                    CloseIfEmpty();

                    if (form != null)
                    {
                        form.UpdateName();
                    }
                }
                else
                {
                    for (int i = 0; i < Children.Count; i++)
                    {
                        if (Children[i] == _MovedTaxonControl)
                        {
                            continue;
                        }

                        if (_ChildrenRect[i].Left <e.Location.X && _ChildrenRect[i].Right> e.Location.X)
                        {
                            Children.Remove(_MovedTaxonControl);
                            Children.Insert(i, _MovedTaxonControl);
                            Invalidate();
                            break;
                        }
                    }
                }
            }
        }
示例#5
0
        //-------------------------------------------------------------------
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (Children.Count == 0 || _ChildrenRect == null || _ChildrenRect.Count != Children.Count)
            {
                return;
            }

            if (!_HeaderVisible || e.Location.Y > Theme.Current.TabHeader_Height)
            {
                base.OnMouseDown(e);
                return;
            }

            if (_PrevButtonVisible && _PrevButtonRect.Contains(e.Location))
            {
                int indexCurrent = Children.IndexOf(Current);
                if (indexCurrent >= 1)
                {
                    Current = Children[indexCurrent - 1];
                }
                return;
            }

            if (_NextButtonVisible && _NextButtonRect.Contains(e.Location))
            {
                int indexCurrent = Children.IndexOf(Current);
                if (indexCurrent < Children.Count - 1)
                {
                    Current = Children[indexCurrent + 1];
                }
                return;
            }

            for (int i = 0; i < Children.Count; i++)
            {
                if (_ChildrenRect[i].Contains(e.Location))
                {
                    Current = Children[i];
                    if (Current.CanBeMoved)
                    {
                        _MovedTaxonControl = Current;
                    }
                    Capture      = true;
                    capturePoint = e.Location;
                    return;
                }
            }
        }
示例#6
0
        //-------------------------------------------------------------------
        public void Remove(GuiControlInterface _itf, bool _closeIfEmpty)
        {
            int index = Children.IndexOf(_itf);

            if (index == -1)
            {
                return;
            }
            if (_itf.Control == null)
            {
                return;
            }

            if (!_itf.Control.Visible)
            {
                index = -1;
            }
            else
            {
                Current = null;
            }

            Children.Remove(_itf);
            _itf.OwnerContainer = null;

            if (_closeIfEmpty)
            {
                CloseIfEmpty();
            }

            if (index >= Children.Count)
            {
                index--;
            }
            if (index >= 0)
            {
                Current = Children[index];
            }
            Invalidate();
        }
示例#7
0
        //---------------------------------------------------------------------------------
        public FormContainer(GuiControlInterface _itf) : this()
        {
            SetTabsContainer();
            ControlContainerTabs tabControl = GetTabsContainer();

            if (tabControl == null)
            {
                return;
            }
            if (_itf == null || _itf.Control == null)
            {
                return;
            }
            tabControl.Add(_itf);
            UpdateName();

            if (_itf.Control.MinimumSize.Width != 0 && _itf.Control.MinimumSize.Height != 0)
            {
                int addX = Size.Width - ClientRectangle.Width;
                int addY = Size.Height - ClientRectangle.Height;
                MinimumSize = new Size(_itf.Control.MinimumSize.Width + addX, _itf.Control.MinimumSize.Height + addY);
            }
        }
 //-------------------------------------------------------------------
 public void Add(GuiControlInterface _control, bool _visible = true)
 {
     throw new NotImplementedException();
 }
 //-------------------------------------------------------------------
 public void SetFocus(GuiControlInterface _control)
 {
 }
示例#10
0
 //-------------------------------------------------------------------
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     _MovedTaxonControl = null;
 }