forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockablePanel.cs
More file actions
68 lines (60 loc) · 2.08 KB
/
Copy pathDockablePanel.cs
File metadata and controls
68 lines (60 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using PluginCore.Helpers;
using PluginCore.Utilities;
using System.Drawing;
using System.Windows.Forms;
using PluginCore;
using WeifenLuo.WinFormsUI.Docking;
namespace FlashDevelop.Docking
{
public class DockablePanel : DockContent
{
Image image;
readonly string pluginGuid;
public DockablePanel(Control ctrl, string pluginGuid)
{
Text = ctrl.Text;
ctrl.Dock = DockStyle.Fill;
DockPanel = PluginBase.MainForm.DockPanel;
if (ctrl.Tag != null) TabText = ctrl.Tag.ToString();
DockAreas = DockAreas.DockBottom | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop |
DockAreas.Float;
// Restrict docking on Wine/CrossOver as you can't dock panels back if undocked...
DockPanel.AllowEndUserFloatChange = !PlatformHelper.isRunningOnWine();
DockPanel.AllowEndUserDocking = !PlatformHelper.isRunningOnWine();
Font = PluginBase.Settings.DefaultFont;
this.pluginGuid = pluginGuid;
HideOnClose = true;
Controls.Add(ctrl);
PluginBase.MainForm.ThemeControls(this);
}
/// <summary>
/// Gets or sets the icon for the <see cref="DockablePanel"/>
/// </summary>
public Image Image
{
get => image;
set
{
image = value;
RefreshIcon();
}
}
/// <summary>
/// Refreshes the icon.
/// </summary>
public void RefreshIcon()
{
if (image != null) Icon = ImageKonverter.ImageToIcon(image);
}
/// <summary>
/// Retrieves the guid of the document
/// </summary>
public override string GetPersistString() => pluginGuid;
internal class Template : DockContent
{
readonly string persistString;
internal Template(string persistString) => this.persistString = persistString;
public override string GetPersistString() => persistString;
}
}
}