Free cookie consent management tool by TermsFeed Policy Generator

source: tags/3.3.1/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/DockPaneCaptionBase.cs

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

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

File size: 2.3 KB
Line 
1using System.Drawing;
2using System.Security.Permissions;
3using System.Windows.Forms;
4
5namespace WeifenLuo.WinFormsUI.Docking {
6  public abstract class DockPaneCaptionBase : Control {
7    protected internal DockPaneCaptionBase(DockPane pane) {
8      m_dockPane = pane;
9
10      SetStyle(ControlStyles.OptimizedDoubleBuffer |
11                ControlStyles.ResizeRedraw |
12                ControlStyles.UserPaint |
13                ControlStyles.AllPaintingInWmPaint, true);
14      SetStyle(ControlStyles.Selectable, false);
15    }
16
17    private DockPane m_dockPane;
18    protected DockPane DockPane {
19      get { return m_dockPane; }
20    }
21
22    protected DockPane.AppearanceStyle Appearance {
23      get { return DockPane.Appearance; }
24    }
25
26    protected bool HasTabPageContextMenu {
27      get { return DockPane.HasTabPageContextMenu; }
28    }
29
30    protected void ShowTabPageContextMenu(Point position) {
31      DockPane.ShowTabPageContextMenu(this, position);
32    }
33
34    protected override void OnMouseUp(MouseEventArgs e) {
35      base.OnMouseUp(e);
36
37      if (e.Button == MouseButtons.Right)
38        ShowTabPageContextMenu(new Point(e.X, e.Y));
39    }
40
41    protected override void OnMouseDown(MouseEventArgs e) {
42      base.OnMouseDown(e);
43
44      if (e.Button == MouseButtons.Left &&
45    DockPane.DockPanel.AllowEndUserDocking &&
46          DockPane.AllowDockDragAndDrop &&
47  !DockHelper.IsDockStateAutoHide(DockPane.DockState) &&
48          DockPane.ActiveContent != null)
49        DockPane.DockPanel.BeginDrag(DockPane);
50    }
51
52    [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
53    protected override void WndProc(ref Message m) {
54      if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK) {
55        if (DockHelper.IsDockStateAutoHide(DockPane.DockState)) {
56          DockPane.DockPanel.ActiveAutoHideContent = null;
57          return;
58        }
59
60        if (DockPane.IsFloat)
61          DockPane.RestoreToPanel();
62        else
63          DockPane.Float();
64      }
65      base.WndProc(ref m);
66    }
67
68    internal void RefreshChanges() {
69      if (IsDisposed)
70        return;
71
72      OnRefreshChanges();
73    }
74
75    protected virtual void OnRightToLeftLayoutChanged() {
76    }
77
78    protected virtual void OnRefreshChanges() {
79    }
80
81    protected internal abstract int MeasureHeight();
82  }
83}
Note: See TracBrowser for help on using the repository browser.