Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/DockPanelSkin.cs @ 4539

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

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

File size: 13.1 KB
RevLine 
[2645]1using System;
[4068]2using System.ComponentModel;
[2645]3using System.Drawing;
4using System.Drawing.Drawing2D;
5
[4068]6namespace WeifenLuo.WinFormsUI.Docking {
7  #region DockPanelSkin classes
8  /// <summary>
9  /// The skin to use when displaying the DockPanel.
10  /// The skin allows custom gradient color schemes to be used when drawing the
11  /// DockStrips and Tabs.
12  /// </summary>
13  [TypeConverter(typeof(DockPanelSkinConverter))]
14  public class DockPanelSkin {
15    private AutoHideStripSkin m_autoHideStripSkin;
16    private DockPaneStripSkin m_dockPaneStripSkin;
17
18    public DockPanelSkin() {
19      m_autoHideStripSkin = new AutoHideStripSkin();
20      m_dockPaneStripSkin = new DockPaneStripSkin();
21    }
22
[2645]23    /// <summary>
[4068]24    /// The skin used to display the auto hide strips and tabs.
[2645]25    /// </summary>
[4068]26    public AutoHideStripSkin AutoHideStripSkin {
27      get { return m_autoHideStripSkin; }
28      set { m_autoHideStripSkin = value; }
[2645]29    }
30
31    /// <summary>
[4068]32    /// The skin used to display the Document and ToolWindow style DockStrips and Tabs.
[2645]33    /// </summary>
[4068]34    public DockPaneStripSkin DockPaneStripSkin {
35      get { return m_dockPaneStripSkin; }
36      set { m_dockPaneStripSkin = value; }
37    }
38  }
[2645]39
[4068]40  /// <summary>
41  /// The skin used to display the auto hide strip and tabs.
42  /// </summary>
43  [TypeConverter(typeof(AutoHideStripConverter))]
44  public class AutoHideStripSkin {
45    private DockPanelGradient m_dockStripGradient;
46    private TabGradient m_TabGradient;
[2645]47
[4068]48    public AutoHideStripSkin() {
49      m_dockStripGradient = new DockPanelGradient();
50      m_dockStripGradient.StartColor = SystemColors.ControlLight;
51      m_dockStripGradient.EndColor = SystemColors.ControlLight;
[2645]52
[4068]53      m_TabGradient = new TabGradient();
54      m_TabGradient.TextColor = SystemColors.ControlDarkDark;
55    }
[2645]56
[4068]57    /// <summary>
58    /// The gradient color skin for the DockStrips.
59    /// </summary>
60    public DockPanelGradient DockStripGradient {
61      get { return m_dockStripGradient; }
62      set { m_dockStripGradient = value; }
[2645]63    }
64
65    /// <summary>
[4068]66    /// The gradient color skin for the Tabs.
[2645]67    /// </summary>
[4068]68    public TabGradient TabGradient {
69      get { return m_TabGradient; }
70      set { m_TabGradient = value; }
71    }
72  }
[2645]73
[4068]74  /// <summary>
75  /// The skin used to display the document and tool strips and tabs.
76  /// </summary>
77  [TypeConverter(typeof(DockPaneStripConverter))]
78  public class DockPaneStripSkin {
79    private DockPaneStripGradient m_DocumentGradient;
80    private DockPaneStripToolWindowGradient m_ToolWindowGradient;
[2645]81
[4068]82    public DockPaneStripSkin() {
83      m_DocumentGradient = new DockPaneStripGradient();
84      m_DocumentGradient.DockStripGradient.StartColor = SystemColors.Control;
85      m_DocumentGradient.DockStripGradient.EndColor = SystemColors.Control;
86      m_DocumentGradient.ActiveTabGradient.StartColor = SystemColors.ControlLightLight;
87      m_DocumentGradient.ActiveTabGradient.EndColor = SystemColors.ControlLightLight;
88      m_DocumentGradient.InactiveTabGradient.StartColor = SystemColors.ControlLight;
89      m_DocumentGradient.InactiveTabGradient.EndColor = SystemColors.ControlLight;
[2645]90
[4068]91      m_ToolWindowGradient = new DockPaneStripToolWindowGradient();
92      m_ToolWindowGradient.DockStripGradient.StartColor = SystemColors.ControlLight;
93      m_ToolWindowGradient.DockStripGradient.EndColor = SystemColors.ControlLight;
[2645]94
[4068]95      m_ToolWindowGradient.ActiveTabGradient.StartColor = SystemColors.Control;
96      m_ToolWindowGradient.ActiveTabGradient.EndColor = SystemColors.Control;
[2645]97
[4068]98      m_ToolWindowGradient.InactiveTabGradient.StartColor = Color.Transparent;
99      m_ToolWindowGradient.InactiveTabGradient.EndColor = Color.Transparent;
100      m_ToolWindowGradient.InactiveTabGradient.TextColor = SystemColors.ControlDarkDark;
101
102      m_ToolWindowGradient.ActiveCaptionGradient.StartColor = SystemColors.GradientActiveCaption;
103      m_ToolWindowGradient.ActiveCaptionGradient.EndColor = SystemColors.ActiveCaption;
104      m_ToolWindowGradient.ActiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
105      m_ToolWindowGradient.ActiveCaptionGradient.TextColor = SystemColors.ActiveCaptionText;
106
107      m_ToolWindowGradient.InactiveCaptionGradient.StartColor = SystemColors.GradientInactiveCaption;
108      m_ToolWindowGradient.InactiveCaptionGradient.EndColor = SystemColors.GradientInactiveCaption;
109      m_ToolWindowGradient.InactiveCaptionGradient.LinearGradientMode = LinearGradientMode.Vertical;
110      m_ToolWindowGradient.InactiveCaptionGradient.TextColor = SystemColors.ControlText;
[2645]111    }
112
113    /// <summary>
[4068]114    /// The skin used to display the Document style DockPane strip and tab.
[2645]115    /// </summary>
[4068]116    public DockPaneStripGradient DocumentGradient {
117      get { return m_DocumentGradient; }
118      set { m_DocumentGradient = value; }
119    }
[2645]120
[4068]121    /// <summary>
122    /// The skin used to display the ToolWindow style DockPane strip and tab.
123    /// </summary>
124    public DockPaneStripToolWindowGradient ToolWindowGradient {
125      get { return m_ToolWindowGradient; }
126      set { m_ToolWindowGradient = value; }
127    }
128  }
[2645]129
[4068]130  /// <summary>
131  /// The skin used to display the DockPane ToolWindow strip and tab.
132  /// </summary>
133  [TypeConverter(typeof(DockPaneStripGradientConverter))]
134  public class DockPaneStripToolWindowGradient : DockPaneStripGradient {
135    private TabGradient m_activeCaptionGradient;
136    private TabGradient m_inactiveCaptionGradient;
[2645]137
[4068]138    public DockPaneStripToolWindowGradient() {
139      m_activeCaptionGradient = new TabGradient();
140      m_inactiveCaptionGradient = new TabGradient();
[2645]141    }
142
143    /// <summary>
[4068]144    /// The skin used to display the active ToolWindow caption.
[2645]145    /// </summary>
[4068]146    public TabGradient ActiveCaptionGradient {
147      get { return m_activeCaptionGradient; }
148      set { m_activeCaptionGradient = value; }
149    }
[2645]150
[4068]151    /// <summary>
152    /// The skin used to display the inactive ToolWindow caption.
153    /// </summary>
154    public TabGradient InactiveCaptionGradient {
155      get { return m_inactiveCaptionGradient; }
156      set { m_inactiveCaptionGradient = value; }
157    }
158  }
[2645]159
[4068]160  /// <summary>
161  /// The skin used to display the DockPane strip and tab.
162  /// </summary>
163  [TypeConverter(typeof(DockPaneStripGradientConverter))]
164  public class DockPaneStripGradient {
165    private DockPanelGradient m_dockStripGradient;
166    private TabGradient m_activeTabGradient;
167    private TabGradient m_inactiveTabGradient;
[2645]168
[4068]169    public DockPaneStripGradient() {
170      m_dockStripGradient = new DockPanelGradient();
171      m_activeTabGradient = new TabGradient();
172      m_inactiveTabGradient = new TabGradient();
173    }
[2645]174
[4068]175    /// <summary>
176    /// The gradient color skin for the DockStrip.
177    /// </summary>
178    public DockPanelGradient DockStripGradient {
179      get { return m_dockStripGradient; }
180      set { m_dockStripGradient = value; }
[2645]181    }
182
183    /// <summary>
[4068]184    /// The skin used to display the active DockPane tabs.
[2645]185    /// </summary>
[4068]186    public TabGradient ActiveTabGradient {
187      get { return m_activeTabGradient; }
188      set { m_activeTabGradient = value; }
189    }
[2645]190
[4068]191    /// <summary>
192    /// The skin used to display the inactive DockPane tabs.
193    /// </summary>
194    public TabGradient InactiveTabGradient {
195      get { return m_inactiveTabGradient; }
196      set { m_inactiveTabGradient = value; }
197    }
198  }
[2645]199
[4068]200  /// <summary>
201  /// The skin used to display the dock pane tab
202  /// </summary>
203  [TypeConverter(typeof(DockPaneTabGradientConverter))]
204  public class TabGradient : DockPanelGradient {
205    private Color m_textColor;
206
207    public TabGradient() {
208      m_textColor = SystemColors.ControlText;
[2645]209    }
210
211    /// <summary>
[4068]212    /// The text color.
[2645]213    /// </summary>
[4068]214    [DefaultValue(typeof(SystemColors), "ControlText")]
215    public Color TextColor {
216      get { return m_textColor; }
217      set { m_textColor = value; }
218    }
219  }
[2645]220
[4068]221  /// <summary>
222  /// The gradient color skin.
223  /// </summary>
224  [TypeConverter(typeof(DockPanelGradientConverter))]
225  public class DockPanelGradient {
226    private Color m_startColor;
227    private Color m_endColor;
228    private LinearGradientMode m_linearGradientMode;
[2645]229
[4068]230    public DockPanelGradient() {
231      m_startColor = SystemColors.Control;
232      m_endColor = SystemColors.Control;
233      m_linearGradientMode = LinearGradientMode.Horizontal;
234    }
[2645]235
[4068]236    /// <summary>
237    /// The beginning gradient color.
238    /// </summary>
239    [DefaultValue(typeof(SystemColors), "Control")]
240    public Color StartColor {
241      get { return m_startColor; }
242      set { m_startColor = value; }
243    }
[2645]244
[4068]245    /// <summary>
246    /// The ending gradient color.
247    /// </summary>
248    [DefaultValue(typeof(SystemColors), "Control")]
249    public Color EndColor {
250      get { return m_endColor; }
251      set { m_endColor = value; }
[2645]252    }
253
[4068]254    /// <summary>
255    /// The gradient mode to display the colors.
256    /// </summary>
257    [DefaultValue(LinearGradientMode.Horizontal)]
258    public LinearGradientMode LinearGradientMode {
259      get { return m_linearGradientMode; }
260      set { m_linearGradientMode = value; }
261    }
262  }
[2645]263
[4068]264  #endregion
[2645]265
[4068]266  #region Converters
267  public class DockPanelSkinConverter : ExpandableObjectConverter {
268    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
269      if (destinationType == typeof(DockPanelSkin))
270        return true;
[2645]271
[4068]272      return base.CanConvertTo(context, destinationType);
[2645]273    }
274
[4068]275    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
276      if (destinationType == typeof(String) && value is DockPanelSkin) {
277        return "DockPanelSkin";
278      }
279      return base.ConvertTo(context, culture, value, destinationType);
280    }
281  }
[2645]282
[4068]283  public class DockPanelGradientConverter : ExpandableObjectConverter {
284    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
285      if (destinationType == typeof(DockPanelGradient))
286        return true;
[2645]287
[4068]288      return base.CanConvertTo(context, destinationType);
[2645]289    }
290
[4068]291    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
292      if (destinationType == typeof(String) && value is DockPanelGradient) {
293        return "DockPanelGradient";
294      }
295      return base.ConvertTo(context, culture, value, destinationType);
296    }
297  }
[2645]298
[4068]299  public class AutoHideStripConverter : ExpandableObjectConverter {
300    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
301      if (destinationType == typeof(AutoHideStripSkin))
302        return true;
[2645]303
[4068]304      return base.CanConvertTo(context, destinationType);
[2645]305    }
306
[4068]307    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
308      if (destinationType == typeof(String) && value is AutoHideStripSkin) {
309        return "AutoHideStripSkin";
310      }
311      return base.ConvertTo(context, culture, value, destinationType);
312    }
313  }
[2645]314
[4068]315  public class DockPaneStripConverter : ExpandableObjectConverter {
316    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
317      if (destinationType == typeof(DockPaneStripSkin))
318        return true;
[2645]319
[4068]320      return base.CanConvertTo(context, destinationType);
[2645]321    }
322
[4068]323    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
324      if (destinationType == typeof(String) && value is DockPaneStripSkin) {
325        return "DockPaneStripSkin";
326      }
327      return base.ConvertTo(context, culture, value, destinationType);
328    }
329  }
[2645]330
[4068]331  public class DockPaneStripGradientConverter : ExpandableObjectConverter {
332    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
333      if (destinationType == typeof(DockPaneStripGradient))
334        return true;
[2645]335
[4068]336      return base.CanConvertTo(context, destinationType);
[2645]337    }
338
[4068]339    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
340      if (destinationType == typeof(String) && value is DockPaneStripGradient) {
341        return "DockPaneStripGradient";
342      }
343      return base.ConvertTo(context, culture, value, destinationType);
344    }
345  }
[2645]346
[4068]347  public class DockPaneTabGradientConverter : ExpandableObjectConverter {
348    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
349      if (destinationType == typeof(TabGradient))
350        return true;
[2645]351
[4068]352      return base.CanConvertTo(context, destinationType);
[2645]353    }
[4068]354
355    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {
356      if (destinationType == typeof(String) && value is TabGradient) {
357        return "DockPaneTabGradient";
358      }
359      return base.ConvertTo(context, culture, value, destinationType);
360    }
361  }
362  #endregion
[2645]363}
Note: See TracBrowser for help on using the repository browser.