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 @ 6675

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

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

File size: 13.1 KB
Line 
1using System;
2using System.ComponentModel;
3using System.Drawing;
4using System.Drawing.Drawing2D;
5
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
23    /// <summary>
24    /// The skin used to display the auto hide strips and tabs.
25    /// </summary>
26    public AutoHideStripSkin AutoHideStripSkin {
27      get { return m_autoHideStripSkin; }
28      set { m_autoHideStripSkin = value; }
29    }
30
31    /// <summary>
32    /// The skin used to display the Document and ToolWindow style DockStrips and Tabs.
33    /// </summary>
34    public DockPaneStripSkin DockPaneStripSkin {
35      get { return m_dockPaneStripSkin; }
36      set { m_dockPaneStripSkin = value; }
37    }
38  }
39
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;
47
48    public AutoHideStripSkin() {
49      m_dockStripGradient = new DockPanelGradient();
50      m_dockStripGradient.StartColor = SystemColors.ControlLight;
51      m_dockStripGradient.EndColor = SystemColors.ControlLight;
52
53      m_TabGradient = new TabGradient();
54      m_TabGradient.TextColor = SystemColors.ControlDarkDark;
55    }
56
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; }
63    }
64
65    /// <summary>
66    /// The gradient color skin for the Tabs.
67    /// </summary>
68    public TabGradient TabGradient {
69      get { return m_TabGradient; }
70      set { m_TabGradient = value; }
71    }
72  }
73
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;
81
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;
90
91      m_ToolWindowGradient = new DockPaneStripToolWindowGradient();
92      m_ToolWindowGradient.DockStripGradient.StartColor = SystemColors.ControlLight;
93      m_ToolWindowGradient.DockStripGradient.EndColor = SystemColors.ControlLight;
94
95      m_ToolWindowGradient.ActiveTabGradient.StartColor = SystemColors.Control;
96      m_ToolWindowGradient.ActiveTabGradient.EndColor = SystemColors.Control;
97
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;
111    }
112
113    /// <summary>
114    /// The skin used to display the Document style DockPane strip and tab.
115    /// </summary>
116    public DockPaneStripGradient DocumentGradient {
117      get { return m_DocumentGradient; }
118      set { m_DocumentGradient = value; }
119    }
120
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  }
129
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;
137
138    public DockPaneStripToolWindowGradient() {
139      m_activeCaptionGradient = new TabGradient();
140      m_inactiveCaptionGradient = new TabGradient();
141    }
142
143    /// <summary>
144    /// The skin used to display the active ToolWindow caption.
145    /// </summary>
146    public TabGradient ActiveCaptionGradient {
147      get { return m_activeCaptionGradient; }
148      set { m_activeCaptionGradient = value; }
149    }
150
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  }
159
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;
168
169    public DockPaneStripGradient() {
170      m_dockStripGradient = new DockPanelGradient();
171      m_activeTabGradient = new TabGradient();
172      m_inactiveTabGradient = new TabGradient();
173    }
174
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; }
181    }
182
183    /// <summary>
184    /// The skin used to display the active DockPane tabs.
185    /// </summary>
186    public TabGradient ActiveTabGradient {
187      get { return m_activeTabGradient; }
188      set { m_activeTabGradient = value; }
189    }
190
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  }
199
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;
209    }
210
211    /// <summary>
212    /// The text color.
213    /// </summary>
214    [DefaultValue(typeof(SystemColors), "ControlText")]
215    public Color TextColor {
216      get { return m_textColor; }
217      set { m_textColor = value; }
218    }
219  }
220
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;
229
230    public DockPanelGradient() {
231      m_startColor = SystemColors.Control;
232      m_endColor = SystemColors.Control;
233      m_linearGradientMode = LinearGradientMode.Horizontal;
234    }
235
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    }
244
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; }
252    }
253
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  }
263
264  #endregion
265
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;
271
272      return base.CanConvertTo(context, destinationType);
273    }
274
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  }
282
283  public class DockPanelGradientConverter : ExpandableObjectConverter {
284    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
285      if (destinationType == typeof(DockPanelGradient))
286        return true;
287
288      return base.CanConvertTo(context, destinationType);
289    }
290
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  }
298
299  public class AutoHideStripConverter : ExpandableObjectConverter {
300    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
301      if (destinationType == typeof(AutoHideStripSkin))
302        return true;
303
304      return base.CanConvertTo(context, destinationType);
305    }
306
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  }
314
315  public class DockPaneStripConverter : ExpandableObjectConverter {
316    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
317      if (destinationType == typeof(DockPaneStripSkin))
318        return true;
319
320      return base.CanConvertTo(context, destinationType);
321    }
322
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  }
330
331  public class DockPaneStripGradientConverter : ExpandableObjectConverter {
332    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
333      if (destinationType == typeof(DockPaneStripGradient))
334        return true;
335
336      return base.CanConvertTo(context, destinationType);
337    }
338
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  }
346
347  public class DockPaneTabGradientConverter : ExpandableObjectConverter {
348    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {
349      if (destinationType == typeof(TabGradient))
350        return true;
351
352      return base.CanConvertTo(context, destinationType);
353    }
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
363}
Note: See TracBrowser for help on using the repository browser.