Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/DockPanel.SplitterDragHandler.cs

    r2645 r4068  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Text;
     1using System.Drawing;
    42using System.Windows.Forms;
    5 using System.Drawing;
    6 using System.Drawing.Drawing2D;
    7 using System.ComponentModel;
    83
    9 namespace WeifenLuo.WinFormsUI.Docking
    10 {
    11     partial class DockPanel
    12     {
    13         private sealed class SplitterDragHandler : DragHandler
    14         {
    15             private class SplitterOutline
    16             {
    17                 public SplitterOutline()
    18                 {
    19                     m_dragForm = new DragForm();
    20                     SetDragForm(Rectangle.Empty);
    21                     DragForm.BackColor = Color.Black;
    22                     DragForm.Opacity = 0.7;
    23                     DragForm.Show(false);
    24                 }
    25 
    26                 DragForm m_dragForm;
    27                 private DragForm DragForm
    28                 {
    29                     get { return m_dragForm; }
    30                 }
    31 
    32                 public void Show(Rectangle rect)
    33                 {
    34                     SetDragForm(rect);
    35                 }
    36 
    37                 public void Close()
    38                 {
    39                     DragForm.Close();
    40                 }
    41 
    42                 private void SetDragForm(Rectangle rect)
    43                 {
    44                     DragForm.Bounds = rect;
    45                     if (rect == Rectangle.Empty)
    46                         DragForm.Region = new Region(Rectangle.Empty);
    47                     else if (DragForm.Region != null)
    48                         DragForm.Region = null;
    49                 }
    50             }
    51 
    52             public SplitterDragHandler(DockPanel dockPanel)
    53                 : base(dockPanel)
    54             {
    55             }
    56 
    57             public new ISplitterDragSource DragSource
    58             {
    59                 get { return base.DragSource as ISplitterDragSource; }
    60                 private set { base.DragSource = value; }
    61             }
    62 
    63             private SplitterOutline m_outline;
    64             private SplitterOutline Outline
    65             {
    66                 get { return m_outline; }
    67                 set { m_outline = value; }
    68             }
    69 
    70             private Rectangle m_rectSplitter;
    71             private Rectangle RectSplitter
    72             {
    73                 get { return m_rectSplitter; }
    74                 set { m_rectSplitter = value; }
    75             }
    76 
    77             public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
    78             {
    79                 DragSource = dragSource;
    80                 RectSplitter = rectSplitter;
    81 
    82                 if (!BeginDrag())
    83                 {
    84                     DragSource = null;
    85                     return;
    86                 }
    87 
    88                 Outline = new SplitterOutline();
    89                 Outline.Show(rectSplitter);
    90                 DragSource.BeginDrag(rectSplitter);
    91             }
    92 
    93             protected override void OnDragging()
    94             {
    95                 Outline.Show(GetSplitterOutlineBounds(Control.MousePosition));
    96             }
    97 
    98             protected override void OnEndDrag(bool abort)
    99             {
    100                 DockPanel.SuspendLayout(true);
    101 
    102                 Outline.Close();
    103 
    104                 if (!abort)
    105                     DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition));
    106 
    107                 DragSource.EndDrag();
    108                 DockPanel.ResumeLayout(true, true);
    109             }
    110 
    111             private int GetMovingOffset(Point ptMouse)
    112             {
    113                 Rectangle rect = GetSplitterOutlineBounds(ptMouse);
    114                 if (DragSource.IsVertical)
    115                     return rect.X - RectSplitter.X;
    116                 else
    117                     return rect.Y - RectSplitter.Y;
    118             }
    119 
    120             private Rectangle GetSplitterOutlineBounds(Point ptMouse)
    121             {
    122                 Rectangle rectLimit = DragSource.DragLimitBounds;
    123 
    124                 Rectangle rect = RectSplitter;
    125                 if (rectLimit.Width <= 0 || rectLimit.Height <= 0)
    126                     return rect;
    127 
    128                 if (DragSource.IsVertical)
    129                 {
    130                     rect.X += ptMouse.X - StartMousePosition.X;
    131                     rect.Height = rectLimit.Height;
    132                 }
    133                 else
    134                 {
    135                     rect.Y += ptMouse.Y - StartMousePosition.Y;
    136                     rect.Width = rectLimit.Width;
    137                 }
    138 
    139                 if (rect.Left < rectLimit.Left)
    140                     rect.X = rectLimit.X;
    141                 if (rect.Top < rectLimit.Top)
    142                     rect.Y = rectLimit.Y;
    143                 if (rect.Right > rectLimit.Right)
    144                     rect.X -= rect.Right - rectLimit.Right;
    145                 if (rect.Bottom > rectLimit.Bottom)
    146                     rect.Y -= rect.Bottom - rectLimit.Bottom;
    147 
    148                 return rect;
    149             }
     4namespace WeifenLuo.WinFormsUI.Docking {
     5  partial class DockPanel {
     6    private sealed class SplitterDragHandler : DragHandler {
     7      private class SplitterOutline {
     8        public SplitterOutline() {
     9          m_dragForm = new DragForm();
     10          SetDragForm(Rectangle.Empty);
     11          DragForm.BackColor = Color.Black;
     12          DragForm.Opacity = 0.7;
     13          DragForm.Show(false);
    15014        }
    15115
    152         private SplitterDragHandler m_splitterDragHandler = null;
    153         private SplitterDragHandler GetSplitterDragHandler()
    154         {
    155             if (m_splitterDragHandler == null)
    156                 m_splitterDragHandler = new SplitterDragHandler(this);
    157             return m_splitterDragHandler;
     16        DragForm m_dragForm;
     17        private DragForm DragForm {
     18          get { return m_dragForm; }
    15819        }
    15920
    160         internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
    161         {
    162             GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter);
     21        public void Show(Rectangle rect) {
     22          SetDragForm(rect);
    16323        }
     24
     25        public void Close() {
     26          DragForm.Close();
     27        }
     28
     29        private void SetDragForm(Rectangle rect) {
     30          DragForm.Bounds = rect;
     31          if (rect == Rectangle.Empty)
     32            DragForm.Region = new Region(Rectangle.Empty);
     33          else if (DragForm.Region != null)
     34            DragForm.Region = null;
     35        }
     36      }
     37
     38      public SplitterDragHandler(DockPanel dockPanel)
     39        : base(dockPanel) {
     40      }
     41
     42      public new ISplitterDragSource DragSource {
     43        get { return base.DragSource as ISplitterDragSource; }
     44        private set { base.DragSource = value; }
     45      }
     46
     47      private SplitterOutline m_outline;
     48      private SplitterOutline Outline {
     49        get { return m_outline; }
     50        set { m_outline = value; }
     51      }
     52
     53      private Rectangle m_rectSplitter;
     54      private Rectangle RectSplitter {
     55        get { return m_rectSplitter; }
     56        set { m_rectSplitter = value; }
     57      }
     58
     59      public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) {
     60        DragSource = dragSource;
     61        RectSplitter = rectSplitter;
     62
     63        if (!BeginDrag()) {
     64          DragSource = null;
     65          return;
     66        }
     67
     68        Outline = new SplitterOutline();
     69        Outline.Show(rectSplitter);
     70        DragSource.BeginDrag(rectSplitter);
     71      }
     72
     73      protected override void OnDragging() {
     74        Outline.Show(GetSplitterOutlineBounds(Control.MousePosition));
     75      }
     76
     77      protected override void OnEndDrag(bool abort) {
     78        DockPanel.SuspendLayout(true);
     79
     80        Outline.Close();
     81
     82        if (!abort)
     83          DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition));
     84
     85        DragSource.EndDrag();
     86        DockPanel.ResumeLayout(true, true);
     87      }
     88
     89      private int GetMovingOffset(Point ptMouse) {
     90        Rectangle rect = GetSplitterOutlineBounds(ptMouse);
     91        if (DragSource.IsVertical)
     92          return rect.X - RectSplitter.X;
     93        else
     94          return rect.Y - RectSplitter.Y;
     95      }
     96
     97      private Rectangle GetSplitterOutlineBounds(Point ptMouse) {
     98        Rectangle rectLimit = DragSource.DragLimitBounds;
     99
     100        Rectangle rect = RectSplitter;
     101        if (rectLimit.Width <= 0 || rectLimit.Height <= 0)
     102          return rect;
     103
     104        if (DragSource.IsVertical) {
     105          rect.X += ptMouse.X - StartMousePosition.X;
     106          rect.Height = rectLimit.Height;
     107        } else {
     108          rect.Y += ptMouse.Y - StartMousePosition.Y;
     109          rect.Width = rectLimit.Width;
     110        }
     111
     112        if (rect.Left < rectLimit.Left)
     113          rect.X = rectLimit.X;
     114        if (rect.Top < rectLimit.Top)
     115          rect.Y = rectLimit.Y;
     116        if (rect.Right > rectLimit.Right)
     117          rect.X -= rect.Right - rectLimit.Right;
     118        if (rect.Bottom > rectLimit.Bottom)
     119          rect.Y -= rect.Bottom - rectLimit.Bottom;
     120
     121        return rect;
     122      }
    164123    }
     124
     125    private SplitterDragHandler m_splitterDragHandler = null;
     126    private SplitterDragHandler GetSplitterDragHandler() {
     127      if (m_splitterDragHandler == null)
     128        m_splitterDragHandler = new SplitterDragHandler(this);
     129      return m_splitterDragHandler;
     130    }
     131
     132    internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) {
     133      GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter);
     134    }
     135  }
    165136}
Note: See TracChangeset for help on using the changeset viewer.