2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Drawing / System.Drawing / SystemPens.cs
blob81d480ecee7b7198687c6b6b470ed050c00e7159
1 //
2 // System.Drawing.SystemPens.cs
3 //
4 // Authors:
5 // Miguel de Icaza (miguel@ximian.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
8 //
9 // Copyright (C) 2003-2005 Novell, Inc. http://www.novell.com
13 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 //
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 //
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using System;
37 namespace System.Drawing
39 public sealed class SystemPens
41 static private Pen active_caption_text;
42 static private Pen control;
43 static private Pen control_dark;
44 static private Pen control_dark_dark;
45 static private Pen control_light;
46 static private Pen control_light_light;
47 static private Pen control_text;
48 static private Pen gray_text;
49 static private Pen highlight;
50 static private Pen highlight_text;
51 static private Pen inactive_caption_text;
52 static private Pen info_text;
53 static private Pen menu_text;
54 static private Pen window_frame;
55 static private Pen window_text;
56 #if NET_2_0
57 static private Pen active_border;
58 static private Pen active_caption;
59 static private Pen app_workspace;
60 static private Pen button_face;
61 static private Pen button_highlight;
62 static private Pen button_shadow;
63 static private Pen desktop;
64 static private Pen gradient_activecaption;
65 static private Pen gradient_inactivecaption;
66 static private Pen hot_track;
67 static private Pen inactive_border;
68 static private Pen inactive_caption;
69 static private Pen info;
70 static private Pen menu;
71 static private Pen menu_bar;
72 static private Pen menu_highlight;
73 static private Pen scroll_bar;
74 static private Pen window;
75 #endif
77 private SystemPens () { }
79 public static Pen ActiveCaptionText {
80 get {
81 if (active_caption_text == null) {
82 active_caption_text = new Pen (SystemColors.ActiveCaptionText);
83 active_caption_text.isModifiable = false;
86 return active_caption_text;
90 public static Pen Control {
91 get {
92 if (control == null) {
93 control = new Pen (SystemColors.Control);
94 control.isModifiable = false;
97 return control;
101 public static Pen ControlDark {
102 get {
103 if (control_dark == null) {
104 control_dark = new Pen (SystemColors.ControlDark);
105 control_dark.isModifiable = false;
108 return control_dark;
112 public static Pen ControlDarkDark {
113 get {
114 if (control_dark_dark == null) {
115 control_dark_dark = new Pen (SystemColors.ControlDarkDark);
116 control_dark_dark.isModifiable = false;
119 return control_dark_dark;
123 public static Pen ControlLight {
124 get {
125 if (control_light == null) {
126 control_light = new Pen (SystemColors.ControlLight);
127 control_light.isModifiable = false;
130 return control_light;
134 public static Pen ControlLightLight {
135 get {
136 if (control_light_light == null) {
137 control_light_light = new Pen (SystemColors.ControlLightLight);
138 control_light_light.isModifiable = false;
141 return control_light_light;
145 public static Pen ControlText {
146 get {
147 if (control_text == null) {
148 control_text = new Pen (SystemColors.ControlText);
149 control_text.isModifiable = false;
152 return control_text;
156 public static Pen GrayText {
157 get {
158 if (gray_text == null) {
159 gray_text = new Pen (SystemColors.GrayText);
160 gray_text.isModifiable = false;
163 return gray_text;
167 public static Pen Highlight {
168 get {
169 if (highlight == null) {
170 highlight = new Pen (SystemColors.Highlight);
171 highlight.isModifiable = false;
174 return highlight;
178 public static Pen HighlightText {
179 get {
180 if (highlight_text == null) {
181 highlight_text = new Pen (SystemColors.HighlightText);
182 highlight_text.isModifiable = false;
185 return highlight_text;
189 public static Pen InactiveCaptionText {
190 get {
191 if (inactive_caption_text == null) {
192 inactive_caption_text = new Pen (SystemColors.InactiveCaptionText);
193 inactive_caption_text.isModifiable = false;
196 return inactive_caption_text;
200 public static Pen InfoText {
201 get {
202 if (info_text == null) {
203 info_text = new Pen (SystemColors.InfoText);
204 info_text.isModifiable = false;
207 return info_text;
211 public static Pen MenuText {
212 get {
213 if (menu_text == null) {
214 menu_text = new Pen (SystemColors.MenuText);
215 menu_text.isModifiable = false;
218 return menu_text;
222 public static Pen WindowFrame {
223 get {
224 if (window_frame == null) {
225 window_frame = new Pen (SystemColors.WindowFrame);
226 window_frame.isModifiable = false;
229 return window_frame;
233 public static Pen WindowText {
234 get {
235 if (window_text == null) {
236 window_text = new Pen (SystemColors.WindowText);
237 window_text.isModifiable = false;
240 return window_text;
244 public static Pen FromSystemColor (Color c)
246 if (c.IsSystemColor) {
247 Pen newPen = new Pen (c);
248 newPen.isModifiable = false;
249 return newPen;
252 String message = String.Format ("The color {0} is not a system color.", c);
253 throw new ArgumentException (message);
256 #if NET_2_0
257 public static Pen ActiveBorder {
258 get {
259 if (active_border == null) {
260 active_border = new Pen (SystemColors.ActiveBorder);
261 active_border.isModifiable = false;
264 return active_border;
268 public static Pen ActiveCaption {
269 get {
270 if (active_caption == null) {
271 active_caption = new Pen (SystemColors.ActiveCaption);
272 active_caption.isModifiable = false;
275 return active_caption;
279 public static Pen AppWorkspace {
280 get {
281 if (app_workspace == null) {
282 app_workspace = new Pen (SystemColors.AppWorkspace);
283 app_workspace.isModifiable = false;
286 return app_workspace;
290 public static Pen ButtonFace {
291 get {
292 if (button_face == null) {
293 button_face = new Pen (SystemColors.ButtonFace);
294 button_face.isModifiable = false;
297 return button_face;
301 public static Pen ButtonHighlight {
302 get {
303 if (button_highlight == null) {
304 button_highlight = new Pen (SystemColors.ButtonHighlight);
305 button_highlight.isModifiable = false;
308 return button_highlight;
312 public static Pen ButtonShadow {
313 get {
314 if (button_shadow == null) {
315 button_shadow = new Pen (SystemColors.ButtonShadow);
316 button_shadow.isModifiable = false;
319 return button_shadow;
323 public static Pen Desktop {
324 get {
325 if (desktop == null) {
326 desktop = new Pen (SystemColors.Desktop);
327 desktop.isModifiable = false;
330 return desktop;
334 public static Pen GradientActiveCaption {
335 get {
336 if (gradient_activecaption == null) {
337 gradient_activecaption = new Pen (SystemColors.GradientActiveCaption);
338 gradient_activecaption.isModifiable = false;
341 return gradient_activecaption;
345 public static Pen GradientInactiveCaption {
346 get {
347 if (gradient_inactivecaption == null) {
348 gradient_inactivecaption = new Pen (SystemColors.GradientInactiveCaption);
349 gradient_inactivecaption.isModifiable = false;
352 return gradient_inactivecaption;
356 public static Pen HotTrack {
357 get {
358 if (hot_track == null) {
359 hot_track = new Pen (SystemColors.HotTrack);
360 hot_track.isModifiable = false;
363 return hot_track;
367 public static Pen InactiveBorder {
368 get {
369 if (inactive_border == null) {
370 inactive_border = new Pen (SystemColors.InactiveBorder);
371 inactive_border.isModifiable = false;
374 return inactive_border;
378 public static Pen InactiveCaption {
379 get {
380 if (inactive_caption == null) {
381 inactive_caption = new Pen (SystemColors.InactiveCaption);
382 inactive_caption.isModifiable = false;
385 return inactive_caption;
389 public static Pen Info {
390 get {
391 if (info == null) {
392 info = new Pen (SystemColors.Info);
393 info.isModifiable = false;
396 return info;
400 public static Pen Menu {
401 get {
402 if (menu == null) {
403 menu = new Pen (SystemColors.Menu);
404 menu.isModifiable = false;
407 return menu;
411 public static Pen MenuBar {
412 get {
413 if (menu_bar == null) {
414 menu_bar = new Pen (SystemColors.MenuBar);
415 menu_bar.isModifiable = false;
418 return menu_bar;
422 public static Pen MenuHighlight {
423 get {
424 if (menu_highlight == null) {
425 menu_highlight = new Pen (SystemColors.MenuHighlight);
426 menu_highlight.isModifiable = false;
429 return menu_highlight;
433 public static Pen ScrollBar {
434 get {
435 if (scroll_bar == null) {
436 scroll_bar = new Pen (SystemColors.ScrollBar);
437 scroll_bar.isModifiable = false;
440 return scroll_bar;
444 public static Pen Window {
445 get {
446 if (window == null) {
447 window = new Pen (SystemColors.Window);
448 window.isModifiable = false;
451 return window;
454 #endif