Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Scheduling/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/DockOutlineBase.cs @ 6274

Last change on this file since 6274 was 4068, checked in by swagner, 14 years ago

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

File size: 3.4 KB
Line 
1using System.Drawing;
2using System.Windows.Forms;
3
4namespace WeifenLuo.WinFormsUI.Docking {
5  internal abstract class DockOutlineBase {
6    public DockOutlineBase() {
7      Init();
8    }
9
10    private void Init() {
11      SetValues(Rectangle.Empty, null, DockStyle.None, -1);
12      SaveOldValues();
13    }
14
15    private Rectangle m_oldFloatWindowBounds;
16    protected Rectangle OldFloatWindowBounds {
17      get { return m_oldFloatWindowBounds; }
18    }
19
20    private Control m_oldDockTo;
21    protected Control OldDockTo {
22      get { return m_oldDockTo; }
23    }
24
25    private DockStyle m_oldDock;
26    protected DockStyle OldDock {
27      get { return m_oldDock; }
28    }
29
30    private int m_oldContentIndex;
31    protected int OldContentIndex {
32      get { return m_oldContentIndex; }
33    }
34
35    protected bool SameAsOldValue {
36      get {
37        return FloatWindowBounds == OldFloatWindowBounds &&
38            DockTo == OldDockTo &&
39            Dock == OldDock &&
40            ContentIndex == OldContentIndex;
41      }
42    }
43
44    private Rectangle m_floatWindowBounds;
45    public Rectangle FloatWindowBounds {
46      get { return m_floatWindowBounds; }
47    }
48
49    private Control m_dockTo;
50    public Control DockTo {
51      get { return m_dockTo; }
52    }
53
54    private DockStyle m_dock;
55    public DockStyle Dock {
56      get { return m_dock; }
57    }
58
59    private int m_contentIndex;
60    public int ContentIndex {
61      get { return m_contentIndex; }
62    }
63
64    public bool FlagFullEdge {
65      get { return m_contentIndex != 0; }
66    }
67
68    private bool m_flagTestDrop = false;
69    public bool FlagTestDrop {
70      get { return m_flagTestDrop; }
71      set { m_flagTestDrop = value; }
72    }
73
74    private void SaveOldValues() {
75      m_oldDockTo = m_dockTo;
76      m_oldDock = m_dock;
77      m_oldContentIndex = m_contentIndex;
78      m_oldFloatWindowBounds = m_floatWindowBounds;
79    }
80
81    protected abstract void OnShow();
82
83    protected abstract void OnClose();
84
85    private void SetValues(Rectangle floatWindowBounds, Control dockTo, DockStyle dock, int contentIndex) {
86      m_floatWindowBounds = floatWindowBounds;
87      m_dockTo = dockTo;
88      m_dock = dock;
89      m_contentIndex = contentIndex;
90      FlagTestDrop = true;
91    }
92
93    private void TestChange() {
94      if (m_floatWindowBounds != m_oldFloatWindowBounds ||
95          m_dockTo != m_oldDockTo ||
96          m_dock != m_oldDock ||
97          m_contentIndex != m_oldContentIndex)
98        OnShow();
99    }
100
101    public void Show() {
102      SaveOldValues();
103      SetValues(Rectangle.Empty, null, DockStyle.None, -1);
104      TestChange();
105    }
106
107    public void Show(DockPane pane, DockStyle dock) {
108      SaveOldValues();
109      SetValues(Rectangle.Empty, pane, dock, -1);
110      TestChange();
111    }
112
113    public void Show(DockPane pane, int contentIndex) {
114      SaveOldValues();
115      SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex);
116      TestChange();
117    }
118
119    public void Show(DockPanel dockPanel, DockStyle dock, bool fullPanelEdge) {
120      SaveOldValues();
121      SetValues(Rectangle.Empty, dockPanel, dock, fullPanelEdge ? -1 : 0);
122      TestChange();
123    }
124
125    public void Show(Rectangle floatWindowBounds) {
126      SaveOldValues();
127      SetValues(floatWindowBounds, null, DockStyle.None, -1);
128      TestChange();
129    }
130
131    public void Close() {
132      OnClose();
133    }
134  }
135}
Note: See TracBrowser for help on using the repository browser.