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/DockWindow.cs

    r2645 r4068  
    1 using System;
     1using System.ComponentModel;
     2using System.Drawing;
    23using System.Windows.Forms;
    3 using System.Drawing;
    4 using System.Runtime.InteropServices;
    5 using System.ComponentModel;
    64
    7 namespace WeifenLuo.WinFormsUI.Docking
    8 {
    9   [ToolboxItem(false)]
    10   public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSource
    11   {
    12     private DockPanel m_dockPanel;
    13     private DockState m_dockState;
    14     private SplitterControl m_splitter;
    15     private NestedPaneCollection m_nestedPanes;
     5namespace WeifenLuo.WinFormsUI.Docking {
     6  [ToolboxItem(false)]
     7  public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSource {
     8    private DockPanel m_dockPanel;
     9    private DockState m_dockState;
     10    private SplitterControl m_splitter;
     11    private NestedPaneCollection m_nestedPanes;
    1612
    17     internal DockWindow(DockPanel dockPanel, DockState dockState)
    18     {
    19       m_nestedPanes = new NestedPaneCollection(this);
    20       m_dockPanel = dockPanel;
    21       m_dockState = dockState;
    22       Visible = false;
     13    internal DockWindow(DockPanel dockPanel, DockState dockState) {
     14      m_nestedPanes = new NestedPaneCollection(this);
     15      m_dockPanel = dockPanel;
     16      m_dockState = dockState;
     17      Visible = false;
    2318
    24       SuspendLayout();
     19      SuspendLayout();
    2520
    26       if (DockState == DockState.DockLeft || DockState == DockState.DockRight ||
    27         DockState == DockState.DockTop || DockState == DockState.DockBottom)
    28       {
    29         m_splitter = new SplitterControl();
    30         Controls.Add(m_splitter);
    31       }
     21      if (DockState == DockState.DockLeft || DockState == DockState.DockRight ||
     22        DockState == DockState.DockTop || DockState == DockState.DockBottom) {
     23        m_splitter = new SplitterControl();
     24        Controls.Add(m_splitter);
     25      }
    3226
    33       if (DockState == DockState.DockLeft)
    34       {
    35         Dock = DockStyle.Left;
    36         m_splitter.Dock = DockStyle.Right;
    37       }
    38       else if (DockState == DockState.DockRight)
    39       {
    40         Dock = DockStyle.Right;
    41         m_splitter.Dock = DockStyle.Left;
    42       }
    43       else if (DockState == DockState.DockTop)
    44       {
    45         Dock = DockStyle.Top;
    46         m_splitter.Dock = DockStyle.Bottom;
    47       }
    48       else if (DockState == DockState.DockBottom)
    49       {
    50         Dock = DockStyle.Bottom;
    51         m_splitter.Dock = DockStyle.Top;
    52       }
    53       else if (DockState == DockState.Document)
    54       {
    55         Dock = DockStyle.Fill;
    56       }
     27      if (DockState == DockState.DockLeft) {
     28        Dock = DockStyle.Left;
     29        m_splitter.Dock = DockStyle.Right;
     30      } else if (DockState == DockState.DockRight) {
     31        Dock = DockStyle.Right;
     32        m_splitter.Dock = DockStyle.Left;
     33      } else if (DockState == DockState.DockTop) {
     34        Dock = DockStyle.Top;
     35        m_splitter.Dock = DockStyle.Bottom;
     36      } else if (DockState == DockState.DockBottom) {
     37        Dock = DockStyle.Bottom;
     38        m_splitter.Dock = DockStyle.Top;
     39      } else if (DockState == DockState.Document) {
     40        Dock = DockStyle.Fill;
     41      }
    5742
    58       ResumeLayout();
    59     }
     43      ResumeLayout();
     44    }
    6045
    61     public VisibleNestedPaneCollection VisibleNestedPanes
    62     {
    63       get { return NestedPanes.VisibleNestedPanes;  }
    64     }
     46    public VisibleNestedPaneCollection VisibleNestedPanes {
     47      get { return NestedPanes.VisibleNestedPanes; }
     48    }
    6549
    66     public NestedPaneCollection NestedPanes
    67     {
    68       get { return m_nestedPanes; }
    69     }
     50    public NestedPaneCollection NestedPanes {
     51      get { return m_nestedPanes; }
     52    }
    7053
    71     public DockPanel DockPanel
    72     {
    73       get { return m_dockPanel; }
    74     }
     54    public DockPanel DockPanel {
     55      get { return m_dockPanel; }
     56    }
    7557
    76     public DockState DockState
    77     {
    78       get { return m_dockState; }
    79     }
     58    public DockState DockState {
     59      get { return m_dockState; }
     60    }
    8061
    81     public bool IsFloat
    82     {
    83       get { return DockState == DockState.Float;  }
    84     }
     62    public bool IsFloat {
     63      get { return DockState == DockState.Float; }
     64    }
    8565
    86     internal DockPane DefaultPane
    87     {
    88       get { return VisibleNestedPanes.Count == 0 ? null : VisibleNestedPanes[0];  }
    89     }
     66    internal DockPane DefaultPane {
     67      get { return VisibleNestedPanes.Count == 0 ? null : VisibleNestedPanes[0]; }
     68    }
    9069
    91     public virtual Rectangle DisplayingRectangle
    92     {
    93       get
    94       {
    95         Rectangle rect = ClientRectangle;
    96         // if DockWindow is document, exclude the border
    97         if (DockState == DockState.Document)
    98         {
    99           rect.X += 1;
    100           rect.Y += 1;
    101           rect.Width -= 2;
    102           rect.Height -= 2;
    103         }
    104         // exclude the splitter
    105         else if (DockState == DockState.DockLeft)
    106           rect.Width -= Measures.SplitterSize;
    107         else if (DockState == DockState.DockRight)
    108         {
    109           rect.X += Measures.SplitterSize;
    110           rect.Width -= Measures.SplitterSize;
    111         }
    112         else if (DockState == DockState.DockTop)
    113           rect.Height -= Measures.SplitterSize;
    114         else if (DockState == DockState.DockBottom)
    115         {
    116           rect.Y += Measures.SplitterSize;
    117           rect.Height -= Measures.SplitterSize;
    118         }
    119 
    120         return rect;
    121       }
    122     }
    123 
    124     protected override void OnPaint(PaintEventArgs e)
    125     {
    126       // if DockWindow is document, draw the border
    127             if (DockState == DockState.Document)
    128                 e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
    129 
    130       base.OnPaint(e);
    131     }
    132 
    133     protected override void OnLayout(LayoutEventArgs levent)
    134     {
    135       VisibleNestedPanes.Refresh();
    136       if (VisibleNestedPanes.Count == 0)
    137       {
    138                 if (Visible)
    139                     Visible = false;
    140       }
    141       else if (!Visible)
    142       {
    143         Visible = true;
    144         VisibleNestedPanes.Refresh();
    145       }
    146 
    147       base.OnLayout (levent);
    148     }
    149 
    150         #region ISplitterDragSource Members
    151 
    152         void ISplitterDragSource.BeginDrag(Rectangle rectSplitter)
    153         {
     70    public virtual Rectangle DisplayingRectangle {
     71      get {
     72        Rectangle rect = ClientRectangle;
     73        // if DockWindow is document, exclude the border
     74        if (DockState == DockState.Document) {
     75          rect.X += 1;
     76          rect.Y += 1;
     77          rect.Width -= 2;
     78          rect.Height -= 2;
     79        }
     80          // exclude the splitter
     81        else if (DockState == DockState.DockLeft)
     82          rect.Width -= Measures.SplitterSize;
     83        else if (DockState == DockState.DockRight) {
     84          rect.X += Measures.SplitterSize;
     85          rect.Width -= Measures.SplitterSize;
     86        } else if (DockState == DockState.DockTop)
     87          rect.Height -= Measures.SplitterSize;
     88        else if (DockState == DockState.DockBottom) {
     89          rect.Y += Measures.SplitterSize;
     90          rect.Height -= Measures.SplitterSize;
    15491        }
    15592
    156         void ISplitterDragSource.EndDrag()
    157         {
     93        return rect;
     94      }
     95    }
     96
     97    protected override void OnPaint(PaintEventArgs e) {
     98      // if DockWindow is document, draw the border
     99      if (DockState == DockState.Document)
     100        e.Graphics.DrawRectangle(SystemPens.ControlDark, ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1);
     101
     102      base.OnPaint(e);
     103    }
     104
     105    protected override void OnLayout(LayoutEventArgs levent) {
     106      VisibleNestedPanes.Refresh();
     107      if (VisibleNestedPanes.Count == 0) {
     108        if (Visible)
     109          Visible = false;
     110      } else if (!Visible) {
     111        Visible = true;
     112        VisibleNestedPanes.Refresh();
     113      }
     114
     115      base.OnLayout(levent);
     116    }
     117
     118    #region ISplitterDragSource Members
     119
     120    void ISplitterDragSource.BeginDrag(Rectangle rectSplitter) {
     121    }
     122
     123    void ISplitterDragSource.EndDrag() {
     124    }
     125
     126    bool ISplitterDragSource.IsVertical {
     127      get { return (DockState == DockState.DockLeft || DockState == DockState.DockRight); }
     128    }
     129
     130    Rectangle ISplitterDragSource.DragLimitBounds {
     131      get {
     132        Rectangle rectLimit = DockPanel.DockArea;
     133        Point location;
     134        if ((Control.ModifierKeys & Keys.Shift) == 0)
     135          location = Location;
     136        else
     137          location = DockPanel.DockArea.Location;
     138
     139        if (((ISplitterDragSource)this).IsVertical) {
     140          rectLimit.X += MeasurePane.MinSize;
     141          rectLimit.Width -= 2 * MeasurePane.MinSize;
     142          rectLimit.Y = location.Y;
     143          if ((Control.ModifierKeys & Keys.Shift) == 0)
     144            rectLimit.Height = Height;
     145        } else {
     146          rectLimit.Y += MeasurePane.MinSize;
     147          rectLimit.Height -= 2 * MeasurePane.MinSize;
     148          rectLimit.X = location.X;
     149          if ((Control.ModifierKeys & Keys.Shift) == 0)
     150            rectLimit.Width = Width;
    158151        }
    159152
    160         bool ISplitterDragSource.IsVertical
    161         {
    162             get { return (DockState == DockState.DockLeft || DockState == DockState.DockRight); }
    163         }
     153        return DockPanel.RectangleToScreen(rectLimit);
     154      }
     155    }
    164156
    165         Rectangle ISplitterDragSource.DragLimitBounds
    166         {
    167             get
    168             {
    169                 Rectangle rectLimit = DockPanel.DockArea;
    170                 Point location;
    171                 if ((Control.ModifierKeys & Keys.Shift) == 0)
    172                     location = Location;
    173                 else
    174                     location = DockPanel.DockArea.Location;
     157    void ISplitterDragSource.MoveSplitter(int offset) {
     158      if ((Control.ModifierKeys & Keys.Shift) != 0)
     159        SendToBack();
    175160
    176                 if (((ISplitterDragSource)this).IsVertical)
    177                 {
    178                     rectLimit.X += MeasurePane.MinSize;
    179                     rectLimit.Width -= 2 * MeasurePane.MinSize;
    180                     rectLimit.Y = location.Y;
    181                     if ((Control.ModifierKeys & Keys.Shift) == 0)
    182                         rectLimit.Height = Height;
    183                 }
    184                 else
    185                 {
    186                     rectLimit.Y += MeasurePane.MinSize;
    187                     rectLimit.Height -= 2 * MeasurePane.MinSize;
    188                     rectLimit.X = location.X;
    189                     if ((Control.ModifierKeys & Keys.Shift) == 0)
    190                         rectLimit.Width = Width;
    191                 }
     161      Rectangle rectDockArea = DockPanel.DockArea;
     162      if (DockState == DockState.DockLeft && rectDockArea.Width > 0) {
     163        if (DockPanel.DockLeftPortion > 1)
     164          DockPanel.DockLeftPortion = Width + offset;
     165        else
     166          DockPanel.DockLeftPortion += ((double)offset) / (double)rectDockArea.Width;
     167      } else if (DockState == DockState.DockRight && rectDockArea.Width > 0) {
     168        if (DockPanel.DockRightPortion > 1)
     169          DockPanel.DockRightPortion = Width - offset;
     170        else
     171          DockPanel.DockRightPortion -= ((double)offset) / (double)rectDockArea.Width;
     172      } else if (DockState == DockState.DockBottom && rectDockArea.Height > 0) {
     173        if (DockPanel.DockBottomPortion > 1)
     174          DockPanel.DockBottomPortion = Height - offset;
     175        else
     176          DockPanel.DockBottomPortion -= ((double)offset) / (double)rectDockArea.Height;
     177      } else if (DockState == DockState.DockTop && rectDockArea.Height > 0) {
     178        if (DockPanel.DockTopPortion > 1)
     179          DockPanel.DockTopPortion = Height + offset;
     180        else
     181          DockPanel.DockTopPortion += ((double)offset) / (double)rectDockArea.Height;
     182      }
     183    }
    192184
    193                 return DockPanel.RectangleToScreen(rectLimit);
    194             }
    195         }
     185    #region IDragSource Members
    196186
    197         void ISplitterDragSource.MoveSplitter(int offset)
    198         {
    199             if ((Control.ModifierKeys & Keys.Shift) != 0)
    200                 SendToBack();
     187    Control IDragSource.DragControl {
     188      get { return this; }
     189    }
    201190
    202             Rectangle rectDockArea = DockPanel.DockArea;
    203             if (DockState == DockState.DockLeft && rectDockArea.Width > 0)
    204             {
    205                 if (DockPanel.DockLeftPortion > 1)
    206                     DockPanel.DockLeftPortion = Width + offset;
    207                 else
    208                     DockPanel.DockLeftPortion += ((double)offset) / (double)rectDockArea.Width;
    209             }
    210             else if (DockState == DockState.DockRight && rectDockArea.Width > 0)
    211             {
    212                 if (DockPanel.DockRightPortion > 1)
    213                     DockPanel.DockRightPortion = Width - offset;
    214                 else
    215                     DockPanel.DockRightPortion -= ((double)offset) / (double)rectDockArea.Width;
    216             }
    217             else if (DockState == DockState.DockBottom && rectDockArea.Height > 0)
    218             {
    219                 if (DockPanel.DockBottomPortion > 1)
    220                     DockPanel.DockBottomPortion = Height - offset;
    221                 else
    222                     DockPanel.DockBottomPortion -= ((double)offset) / (double)rectDockArea.Height;
    223             }
    224             else if (DockState == DockState.DockTop && rectDockArea.Height > 0)
    225             {
    226                 if (DockPanel.DockTopPortion > 1)
    227                     DockPanel.DockTopPortion = Height + offset;
    228                 else
    229                     DockPanel.DockTopPortion += ((double)offset) / (double)rectDockArea.Height;
    230             }
    231         }
    232 
    233         #region IDragSource Members
    234 
    235         Control IDragSource.DragControl
    236         {
    237             get { return this; }
    238         }
    239 
    240         #endregion
    241         #endregion
    242     }
     191    #endregion
     192    #endregion
     193  }
    243194}
Note: See TracChangeset for help on using the changeset viewer.