Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.7.0/WinFormsUI-2.7.0/Docking/DockPanelSkin.cs

Last change on this file was 8616, checked in by mkommend, 12 years ago

#1939: Added DockPanelSuite 2.7.0 to ExtLibs.

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