Example #1
0
 protected override void ClearVirtualPosition()
 {
     if (prev_virtual_position != Rectangle_.Empty && form.Parent != null)
     {
         XplatUI.DrawReversibleRectangle(form.Parent.Handle,
                                         prev_virtual_position, 2);
     }
     prev_virtual_position = Rectangle_.Empty;
 }
Example #2
0
        protected override void DrawVirtualPosition(Rectangle_ virtual_position)
        {
            ClearVirtualPosition();

            if (form.Parent != null)
            {
                XplatUI.DrawReversibleRectangle(form.Parent.Handle, virtual_position, 2);
            }
            prev_virtual_position = virtual_position;
        }
Example #3
0
        private void SplitterMove(Point location)
        {
            int       currentMove   = orientation == Orientation.Vertical ? location.X : location.Y;
            int       delta         = currentMove - splitter_prev_move;
            Rectangle prev_location = splitter_rectangle_moving;
            bool      moved         = false;

            if (orientation == Orientation.Vertical)
            {
                int min = panel1_min_size;
                int max = panel2.Location.X + (panel2.Width - this.panel2_min_size) - splitter_rectangle_moving.Width;

                if (splitter_rectangle_moving.X + delta > min && splitter_rectangle_moving.X + delta < max)
                {
                    splitter_rectangle_moving.X += delta;
                    moved = true;
                }
                else
                {
                    // Ensure that the splitter is set to minimum or maximum position,
                    // even if the mouse "skips".
                    //
                    if (splitter_rectangle_moving.X + delta <= min && splitter_rectangle_moving.X != min)
                    {
                        splitter_rectangle_moving.X = min;
                        moved = true;
                    }
                    else if (splitter_rectangle_moving.X + delta >= max && splitter_rectangle_moving.X != max)
                    {
                        splitter_rectangle_moving.X = max;
                        moved = true;
                    }
                }
            }
            else if (orientation == Orientation.Horizontal)
            {
                int min = panel1_min_size;
                int max = panel2.Location.Y + (panel2.Height - this.panel2_min_size) - splitter_rectangle_moving.Height;

                if (splitter_rectangle_moving.Y + delta > min && splitter_rectangle_moving.Y + delta < max)
                {
                    splitter_rectangle_moving.Y += delta;
                    moved = true;
                }
                else
                {
                    // Ensure that the splitter is set to minimum or maximum position,
                    // even if the mouse "skips".
                    //
                    if (splitter_rectangle_moving.Y + delta <= min && splitter_rectangle_moving.Y != min)
                    {
                        splitter_rectangle_moving.Y = min;
                        moved = true;
                    }
                    else if (splitter_rectangle_moving.Y + delta >= max && splitter_rectangle_moving.Y != max)
                    {
                        splitter_rectangle_moving.Y = max;
                        moved = true;
                    }
                }
            }

            if (moved)
            {
                splitter_prev_move = currentMove;
                OnSplitterMoving(new SplitterCancelEventArgs(location.X, location.Y,
                                                             splitter_rectangle.X, splitter_rectangle.Y));
                XplatUI.DrawReversibleRectangle(this.Handle, prev_location, 1);
                XplatUI.DrawReversibleRectangle(this.Handle, splitter_rectangle_moving, 1);
            }
        }
Example #4
0
        private void SplitterMove(Point location)
        {
            int       currentMove   = horizontal ? location.Y : location.X;
            int       delta         = currentMove - splitter_prev_move;
            Rectangle prev_location = splitter_rectangle_moving;
            bool      moved         = false;
            int       min           = this.MinSize + moving_offset;
            int       max           = max_size + moving_offset;

            if (horizontal)
            {
                if (splitter_rectangle_moving.Y + delta > min && splitter_rectangle_moving.Y + delta < max)
                {
                    splitter_rectangle_moving.Y += delta;
                    moved = true;
                }
                else
                {
                    // Ensure that the splitter is set to minimum or maximum position,
                    // even if the mouse "skips".
                    //
                    if (splitter_rectangle_moving.Y + delta <= min && splitter_rectangle_moving.Y != min)
                    {
                        splitter_rectangle_moving.Y = min;
                        moved = true;
                    }
                    else if (splitter_rectangle_moving.Y + delta >= max && splitter_rectangle_moving.Y != max)
                    {
                        splitter_rectangle_moving.Y = max;
                        moved = true;
                    }
                }
            }
            else
            {
                if (splitter_rectangle_moving.X + delta > min && splitter_rectangle_moving.X + delta < max)
                {
                    splitter_rectangle_moving.X += delta;
                    moved = true;
                }
                else
                {
                    // Ensure that the splitter is set to minimum or maximum position,
                    // even if the mouse "skips".
                    //
                    if (splitter_rectangle_moving.X + delta <= min && splitter_rectangle_moving.X != min)
                    {
                        splitter_rectangle_moving.X = min;
                        moved = true;
                    }
                    else if (splitter_rectangle_moving.X + delta >= max && splitter_rectangle_moving.X != max)
                    {
                        splitter_rectangle_moving.X = max;
                        moved = true;
                    }
                }
            }

            if (moved)
            {
                splitter_prev_move = currentMove;
                OnSplitterMoving(new SplitterEventArgs(location.X, location.Y,
                                                       splitter_rectangle_moving.X,
                                                       splitter_rectangle_moving.Y));
                XplatUI.DrawReversibleRectangle(this.Parent.Handle, prev_location, 1);
                XplatUI.DrawReversibleRectangle(this.Parent.Handle, splitter_rectangle_moving, 1);
            }
        }