Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/WinFormsUI/Docking/DockPaneCaptionBase.cs @ 2476

Last change on this file since 2476 was 2134, checked in by gkronber, 15 years ago

Added up to date source of Weifen Luo dock panel suit in a separate project (and added strong name key). Removed binary versions of Weifen Luo dock panel suite and references to it. #687 (Update AdvancedOptimizationFrontend to use more recent version of Weifen Luo Docking library)

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