Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="form">form</param>
        /// <param name="allowedDock">allowed dock mode</param>
        /// <param name="identifier">identifier of the form info</param>
        internal DockableFormInfo(Form form, zAllowedDock allowedDock, Guid identifier)
        {
            if (identifier == Guid.Empty)
             {
            throw new ArgumentException("Err");
             }

             _identifier    = identifier;
             _dockableForm  = form;
             _allowedDock   = allowedDock;
             _button        = new TabButton(form);
             _button.ExplicitDisposing += OnButtonDisposing;

             form.GotFocus += OnFormGotFocus;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// End mouse action
        /// </summary>
        /// <param name="cancel">cancel</param>
        private void EndMouseAction(bool cancel)
        {
            _isMouseDownInTabButton = false;

            if (_isMovingTabButton)
            {
                if (_isDraggingTabButton)
                {
                    EndButtonDrag(cancel);
                }

                _isMovingTabButton = false;
                _buttonDisplaced   = null;
            }

            IsMouseDownInScrollBackButton = false;
            IsMouseDownInScrollNextButton = false;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Remove button
        /// </summary>
        /// <param name="button">button</param>
        /// <returns>true if button was removed</returns>
        protected bool RemoveButton(TabButton button)
        {
            if (_buttons.Contains(button) == false)
            {
                return(false);
            }

            // If the selected index is the last button index, must decrement the selected index
            // to prevent index out of range exception after the count of buttons is updated.
            if (SelectedIndex > 0 && SelectedIndex == ButtonsCount - 1)
            {
                SelectedIndex--;
            }

            _buttons.Remove(button);
            OnButtonRemoved(button);

            button.TextChanged       -= OnButtonTextChanged;
            button.ExplicitDisposing -= OnButtonDisposing;

            if (_buttons.Count == 0)
            {
                if (Disposing == false && IsDisposed == false)
                {
                    using (Graphics graphics = CreateGraphics())
                    {
                        UpdatePositions(graphics, false);
                    }
                }
            }
            else
            {
                _updatePositionsOnDraw = true;
            }

            if (Disposing == false && IsDisposed == false)
            {
                UpdateSize();
                Invalidate();
            }

            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Occurs when the mouse id down
        /// </summary>
        /// <param name="e">event argument</param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            _isMouseDownInTabButton = false;
            _isMovingTabButton      = false;

            if (IsMouseOverScrollBackButton)
            {
                IsMouseDownInScrollBackButton = true;
                ScrollBack();
            }
            else if (IsMouseOverScrollNextButton)
            {
                IsMouseDownInScrollNextButton = true;
                ScrollNext();
            }
            else if (_captionButtonsBounds.Contains(e.Location))
            {
                int captionIndex = ButtonsRenderer.GetCaptionButtonIndex(_captionButtonsBounds, e.Location);
                OnMouseDownInCaptionButton(captionIndex, e);
            }
            else
            {
                int       index  = 0;
                TabButton button = GetButtonFromPoint(e.Location, out index);
                if (button != null)
                {
                    SelectedIndex = index;

                    Invalidate();

                    _isMouseDownInTabButton = e.Button == MouseButtons.Left;

                    OnMouseDownInTabButton(button);
                }
            }


            base.OnMouseDown(e);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Occurs when tab button is added
 /// </summary>
 /// <param name="button">button added</param>
 protected override void OnButtonAdded(TabButton button)
 {
     EventHandler<FormEventArgs> handler = FormAdded;
      if (handler != null)
      {
     FormEventArgs args = new FormEventArgs((Form)button.Page);
     handler(this, args);
      }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Occurs when tab button is added
 /// </summary>
 /// <param name="button">button added</param>
 protected override void OnButtonAdded(TabButton button)
 {
    EventHandler<FormEventArgs> handler = FormAdded;
    if (handler != null)
    {
       DockableFormInfo info = GetPageInfo((Form)button.Page);
       FormEventArgs args    = new FormEventArgs(info.DockableForm, info.Id);
       handler(this, args);
    }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal override bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds)
 {
     return(lastButton.Left + lastButton.Width > scrollNextBounds.Left);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Can undo the displacement of the next button (the next button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceNext(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return(true);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Begin button drag
 /// </summary>
 /// <param name="selected">selected button</param>
 /// <param name="mousePosition">mouse position</param>
 /// <param name="cursor">cursor</param>
 /// <returns>true if button drag is started</returns>
 protected virtual bool BeginButtonDrag(TabButton selected, Point mousePosition, ref Cursor cursor)
 {
    return false;
 }
Ejemplo n.º 10
0
      /// <summary>
      /// Insert a button 
      /// </summary>
      /// <param name="button">button to insert</param>
      /// <param name="insertIndex">zero based insert index</param>
      protected void InsertButton(TabButton button, int insertIndex)
      {
         if (button != null && insertIndex >= 0 && insertIndex <= _buttons.Count)
         {
            _buttons.Insert(insertIndex, button);
            OnButtonAdded(button);

            button.TextChanged         += OnButtonTextChanged;
            button.ExplicitDisposing   += OnButtonDisposing;

            SelectedIndex = insertIndex;

            if (_buttons.Count == 1)
            {
               using (Graphics graphics = CreateGraphics())
               {
                  UpdatePositions(graphics, true);
               }
            }
            else
            {
               _updatePositionsOnDraw = true;
            }

            UpdateSize();
            Invalidate();
         }
      }
Ejemplo n.º 11
0
        /// <summary>
        /// Occurs when mouse cursor is moved over the panel
        /// </summary>
        /// <param name="e">event argument</param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            Cursor cursor = Cursors.Default;

            if (_isMouseDownInTabButton && e.Button == MouseButtons.Left)
            {
                cursor = Cursors.Hand;

                if (_isMovingTabButton)
                {
                    TabButton selected = _buttons[SelectedIndex];
                    if (selected.Contains(e.Location) == false)
                    {
                        if (_isDraggingTabButton)
                        {
                            ContinueButtonDrag(e.Location, ref cursor);
                        }
                        else
                        {
                            int       index      = -1;
                            TabButton underMouse = GetButtonFromPoint(e.Location, true, out index);
                            if (underMouse != null)
                            {
                                bool displace = false;
                                if (underMouse == _buttonDisplaced)
                                {
                                    if (index < SelectedIndex)
                                    {
                                        displace = ButtonsRenderer.CanUndoDisplaceBack(underMouse, selected, e.Location);
                                    }
                                    else if (index > SelectedIndex)
                                    {
                                        displace = ButtonsRenderer.CanUndoDisplaceNext(underMouse, selected, e.Location);
                                    }
                                }

                                _buttonDisplaced = underMouse;

                                if (displace)
                                {
                                    _buttons[index]         = selected;
                                    _buttons[SelectedIndex] = underMouse;
                                    _updatePositionsOnDraw  = true;
                                    SelectedIndex           = index;
                                }
                            }
                            else
                            {
                                _isDraggingTabButton = BeginButtonDrag(selected, e.Location, ref cursor);
                            }
                        }
                    }
                }
                else
                {
                    _isMovingTabButton   = _buttons[SelectedIndex].Contains(e.Location);
                    _isDraggingTabButton = false;
                }
            }
            else if (GetButtonFromPoint(e.Location) != null)
            {
                cursor = Cursors.Hand;
            }

            CheckIfIsMouseOverScrollButtons(e.Location);
            if (IsMouseOverScrollBackButton && _firstShownButtonIndex > 0)
            {
                cursor = Cursors.Hand;
            }
            else if (IsMouseOverScrollNextButton && _canScrollNext)
            {
                cursor = Cursors.Hand;
            }

            int captionIndex = ButtonsRenderer.GetCaptionButtonIndex(_captionButtonsBounds, e.Location);

            if (captionIndex < 0 || captionIndex >= ButtonsCount)
            {
                captionIndex = -1;
            }
            else
            {
                cursor = Cursors.Hand;
            }

            if (_captionButtonIndexUnderMouse != captionIndex)
            {
                _captionButtonIndexUnderMouse = captionIndex;
                OnMouseMoveOverCaptionButton(captionIndex, e);

                Invalidate();
            }

            int       buttonIndex      = -1;
            TabButton buttonUnderMouse = GetButtonFromPoint(e.Location, false, out buttonIndex);

            if (buttonUnderMouse != null)
            {
                OnMouseMoveOverTabButton(buttonUnderMouse);
            }


            Cursor = cursor;

            base.OnMouseMove(e);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Occurs when mouse button was moved over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected override void OnMouseMoveOverTabButton(TabButton buttonUnderMouse)
 {
     EventHandler<PreviewEventArgs> handler = ShowPreview;
      if (handler != null)
      {
     PreviewEventArgs args = new PreviewEventArgs(new Point(buttonUnderMouse.Left, buttonUnderMouse.Top), (Form)buttonUnderMouse.Page);
     handler(this, args);
      }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Add button
 /// </summary>
 /// <param name="button">button</param>
 protected void AddButton(TabButton button)
 {
     InsertButton(button, _buttons.Count);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Occurs when tab button is added
 /// </summary>
 /// <param name="button">button added</param>
 protected virtual void OnButtonAdded(TabButton button)
 {
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Occurs when tab button is removed
 /// </summary>
 /// <param name="button">button removed</param>
 protected virtual void OnButtonRemoved(TabButton button)
 {
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Occurs when mouse button was pressed while the cursor was over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected virtual void OnMouseDownInTabButton(TabButton buttonUnderMouse)
 {
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Occurs when mouse button was moved over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected virtual void OnMouseMoveOverTabButton(TabButton buttonUnderMouse)
 {
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal override bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds)
 {
     return lastButton.Top + lastButton.Height > scrollNextBounds.Top;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Can undo the displacement of the next button (the next button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceNext(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return true;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal abstract bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds);
Ejemplo n.º 21
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal abstract bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds);
Ejemplo n.º 22
0
 /// <summary>
 /// Begin button drag
 /// </summary>
 /// <param name="selected">selected button</param>
 /// <param name="mousePosition">mouse position</param>
 /// <param name="cursor">cursor</param>
 /// <returns>true if button drag is started</returns>
 protected virtual bool BeginButtonDrag(TabButton selected, Point mousePosition, ref Cursor cursor)
 {
     return(false);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Remove button
        /// </summary>
        /// <param name="button">button</param>
        /// <returns>true if button was removed</returns>
        protected bool RemoveButton(TabButton button)
        {
            if (_buttons.Contains(button) == false)
             {
            return false;
             }

             if (SelectedIndex >= 0 && SelectedIndex < ButtonsCount)
             {
            if (_buttons[SelectedIndex] == button && (SelectedIndex == ButtonsCount - 1 && SelectedIndex > 0))
            {
               SelectedIndex--;
            }
             }

             _buttons.Remove(button);
             OnButtonRemoved(button);

             button.TextChanged -= OnButtonTextChanged;

             if (_buttons.Count == 0)
             {
            using (Graphics graphics = CreateGraphics())
            {
               UpdatePositions(graphics, false);
            }
             }
             else
             {
            _updatePositionsOnDraw = true;
             }

             UpdateSize();
             Invalidate();

             return true;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TabPageView()
        {
            InitializeComponent();

            _button = new TabButton(this);
        }
Ejemplo n.º 25
0
      /// <summary>
      /// Remove button
      /// </summary>
      /// <param name="button">button</param>
      /// <returns>true if button was removed</returns>
      protected bool RemoveButton(TabButton button)
      {
         if (_buttons.Contains(button) == false)
         {
            return false;
         }

         // If the selected index is the last button index, must decrement the selected index
         // to prevent index out of range exception after the count of buttons is updated.
         if (SelectedIndex > 0 && SelectedIndex == ButtonsCount - 1)
         {
            SelectedIndex--;
         }

         _buttons.Remove(button);
         OnButtonRemoved(button);

         button.TextChanged       -= OnButtonTextChanged;
         button.ExplicitDisposing -= OnButtonDisposing;

         if (_buttons.Count == 0)
         {
            if (Disposing == false && IsDisposed == false)
            {
               using (Graphics graphics = CreateGraphics())
               {
                  UpdatePositions(graphics, false);
               }
            }
         }
         else
         {
            _updatePositionsOnDraw = true;
         }

         if (Disposing == false && IsDisposed == false)
         {
            UpdateSize();
            Invalidate();
         }

         return true;
      }
Ejemplo n.º 26
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal override bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds)
 {
     return lastButton.Left + lastButton.Width > scrollNextBounds.Left;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TabPageView()
        {
            InitializeComponent();

             _button = new TabButton(this);
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return mouseLocation.X < displacedButton.Left + selectedButton.Width;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return(mouseLocation.X < displacedButton.Left + selectedButton.Width);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return(mouseLocation.Y < displacedButton.Top + selectedButton.Height);
 }
Ejemplo n.º 31
0
      /// <summary>
      /// Occurs when tab button is removed
      /// </summary>
      /// <param name="button">button removed</param>
      protected override void OnButtonRemoved(TabButton button)
      {
         Form page = (Form)button.Page;
         page.FormClosing    -= OnPageClosing;
         page.FormClosed     -= OnPageClosed;
         page.ParentChanged  -= OnPageParentChanged;

         PagesPanel.Remove(page);

         DockableFormInfo info = null;
         for (int index = _cachedInfos.Count - 1; index >= 0; index--)
         {
            if (_cachedInfos[index].Button == button)
            {
               info = _cachedInfos[index];
               _cachedInfos.RemoveAt(index);

               info.ExplicitDisposing -= OnInfoDisposing;
               info.SelectedChanged   -= OnInfoSelectedChanged;

               break;
            }
         }

         EventHandler<FormEventArgs> handler = FormRemoved;
         if (handler != null)
         {
            FormEventArgs args = new FormEventArgs(page, info.Id);
            handler(this, args);
         }
      }
Ejemplo n.º 32
0
 /// <summary>
 /// Checks if can scroll next
 /// </summary>
 /// <param name="lastButton">last button</param>
 /// <param name="scrollNextBounds">scroll-next bounds</param>
 /// <returns>true if can scroll next</returns>
 internal override bool CanScrollNext(TabButton lastButton, Rectangle scrollNextBounds)
 {
     return(lastButton.Top + lastButton.Height > scrollNextBounds.Top);
 }
Ejemplo n.º 33
0
        /// <summary>
        /// Begin button drag
        /// </summary>
        /// <param name="selected">selected button</param>
        /// <param name="mousePosition">mouse position</param>
        /// <param name="cursor">cursor</param>
        /// <returns>true if button drag is started</returns>
        protected override bool BeginButtonDrag(TabButton selected, Point mousePosition, ref Cursor cursor)
        {
            EventHandler<FormEventArgs> handler = UndockForm;
             if (handler != null)
             {
            _movedButton   = selected;
            _movedForm     = (Form)_movedButton.Page;
            _movedIndex    = SelectedIndex;

            Point mouseScreenPosition = Control.MousePosition;
            FormEventArgs args  = new FormEventArgs(_movedForm);
            handler(this, args);

            RemoveButton(_movedButton);

            _movedDecorator = HierarchyUtility.GetFormsDecorator(_movedForm);
            _movedDecorator.BeginMovementByMouse(mouseScreenPosition);

            cursor = Cursors.SizeAll;
             }

             return true;
        }
Ejemplo n.º 34
0
      /// <summary>
      /// End mouse action
      /// </summary>
      /// <param name="cancel">cancel</param>
      private void EndMouseAction(bool cancel)
      {
         _isMouseDownInTabButton = false;

         if (_isMovingTabButton)
         {
            if (_isDraggingTabButton)
            {
               EndButtonDrag(cancel);
            }

            _isMovingTabButton = false;
            _buttonDisplaced = null;
         }

         IsMouseDownInScrollBackButton = false;
         IsMouseDownInScrollNextButton = false;
      }
Ejemplo n.º 35
0
        /// <summary>
        /// Occurs when tab button is removed
        /// </summary>
        /// <param name="button">button removed</param>
        protected override void OnButtonRemoved(TabButton button)
        {
            PagesPanel.Remove((Form)button.Page);

             for (int index = _cachedInfos.Count - 1; index >= 0; index--)
             {
            if (_cachedInfos[index].Button == button)
            {
               _cachedInfos.RemoveAt(index);
               break;
            }
             }

             EventHandler<FormEventArgs> handler = FormRemoved;
             if (handler != null)
             {
            FormEventArgs args = new FormEventArgs((Form)button.Page);
            handler(this, args);
             }
        }
Ejemplo n.º 36
0
      /// <summary>
      /// Occurs when mouse cursor is moved over the panel
      /// </summary>
      /// <param name="e">event argument</param>
      protected override void OnMouseMove(MouseEventArgs e)
      {
         Cursor cursor = Cursors.Default;

         if (_isMouseDownInTabButton && e.Button == MouseButtons.Left)
         {
            cursor = Cursors.Hand;

            if (_isMovingTabButton)
            {
               TabButton selected = _buttons[SelectedIndex];
               if (selected.Contains(e.Location) == false)
               {
                  if (_isDraggingTabButton)
                  {
                     ContinueButtonDrag(e.Location, ref cursor);
                  }
                  else
                  {
                     int index = -1;
                     TabButton underMouse = GetButtonFromPoint(e.Location, true, out index);
                     if (underMouse != null)
                     {
                        bool displace  = false;
                        if (underMouse == _buttonDisplaced)
                        {
                           if (index < SelectedIndex)
                           {
                              displace = ButtonsRenderer.CanUndoDisplaceBack(underMouse, selected, e.Location);
                           }
                           else if (index > SelectedIndex)
                           {
                              displace = ButtonsRenderer.CanUndoDisplaceNext(underMouse, selected, e.Location);
                           }
                        }

                        _buttonDisplaced = underMouse;

                        if (displace)
                        {
                           _buttons[index]         = selected;
                           _buttons[SelectedIndex] = underMouse;
                           _updatePositionsOnDraw  = true;
                           SelectedIndex           = index;
                        }
                     }
                     else
                     {
                        _isDraggingTabButton = BeginButtonDrag(selected, e.Location, ref cursor);
                     }
                  }
               }
            }
            else
            {
               _isMovingTabButton   = _buttons[SelectedIndex].Contains(e.Location);
               _isDraggingTabButton = false;
            }
         }
         else if (GetButtonFromPoint(e.Location) != null)
         {
            cursor = Cursors.Hand;
         }

         CheckIfIsMouseOverScrollButtons(e.Location);
         if (IsMouseOverScrollBackButton && _firstShownButtonIndex > 0)
         {
            cursor = Cursors.Hand;
         }
         else if (IsMouseOverScrollNextButton && _canScrollNext)
         {
            cursor = Cursors.Hand;
         }

         int captionIndex = ButtonsRenderer.GetCaptionButtonIndex(_captionButtonsBounds, e.Location);
         if (captionIndex < 0 || captionIndex >= ButtonsCount)
         {
            captionIndex = -1;
         }
         else
         {
            cursor = Cursors.Hand;
         }

         if (_captionButtonIndexUnderMouse != captionIndex)
         {
            _captionButtonIndexUnderMouse = captionIndex;
            OnMouseMoveOverCaptionButton(captionIndex, e);

            Invalidate();
         }

         int buttonIndex = -1;
         TabButton buttonUnderMouse = GetButtonFromPoint(e.Location, false, out buttonIndex);
         if (buttonUnderMouse != null)
         {
            OnMouseMoveOverTabButton(buttonUnderMouse);
         }


         Cursor = cursor;

         base.OnMouseMove(e);
      }
Ejemplo n.º 37
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal override bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation)
 {
     return mouseLocation.Y < displacedButton.Top + selectedButton.Height;
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Occurs when mouse button was moved over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected virtual void OnMouseMoveOverTabButton(TabButton buttonUnderMouse)
 {
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Occurs when mouse button was pressed while the cursor was over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected override void OnMouseDownInTabButton(TabButton buttonUnderMouse)
 {
     EventHandler<ControlEventArgs> handler = SelectButton;
      if (handler != null)
      {
     ControlEventArgs args = new ControlEventArgs(buttonUnderMouse.Page);
     handler(this, args);
      }
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Occurs when mouse button was pressed while the cursor was over a tab button
 /// </summary>
 /// <param name="buttonUnderMouse">button under mouse</param>
 protected virtual void OnMouseDownInTabButton(TabButton buttonUnderMouse)
 {
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal abstract bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation);
Ejemplo n.º 42
0
 /// <summary>
 /// Occurs when tab button is removed
 /// </summary>
 /// <param name="button">button removed</param>
 protected virtual void OnButtonRemoved(TabButton button)
 {
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Can undo the displacement of the previous button (the previous button was displaced before)
 /// </summary>
 /// <param name="displacedButton">displaced button</param>
 /// <param name="selectedButton">selected button</param>
 /// <param name="mouseLocation">current mouse location</param>
 /// <returns>true if can undo</returns>
 internal abstract bool CanUndoDisplaceBack(TabButton displacedButton, TabButton selectedButton, Point mouseLocation);
Ejemplo n.º 44
0
 /// <summary>
 /// Occurs when tab button is added
 /// </summary>
 /// <param name="button">button added</param>
 protected virtual void OnButtonAdded(TabButton button)
 {
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Add button
 /// </summary>
 /// <param name="button">button</param>
 protected void AddButton(TabButton button)
 {
    InsertButton(button, _buttons.Count);
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Get the page at given index
        /// </summary>
        /// <param name="pageIndex">zero based page index</param>
        /// <returns>page at given index</returns>
        public TabPageView GetPageAt(int pageIndex)
        {
            TabButton buton = GetButtonAt(pageIndex);

            return((TabPageView)buton.Page);
        }