2 // System.Drawing.SystemPens.cs
5 // Miguel de Icaza (miguel@ximian.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
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:
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
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.
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 static private Pen active_border;
57 static private Pen active_caption;
58 static private Pen app_workspace;
59 static private Pen button_face;
60 static private Pen button_highlight;
61 static private Pen button_shadow;
62 static private Pen desktop;
63 static private Pen gradient_activecaption;
64 static private Pen gradient_inactivecaption;
65 static private Pen hot_track;
66 static private Pen inactive_border;
67 static private Pen inactive_caption;
68 static private Pen info;
69 static private Pen menu;
70 static private Pen menu_bar;
71 static private Pen menu_highlight;
72 static private Pen scroll_bar;
73 static private Pen window;
75 private SystemPens () { }
77 public static Pen ActiveCaptionText {
79 if (active_caption_text == null) {
80 active_caption_text = new Pen (SystemColors.ActiveCaptionText);
81 active_caption_text.isModifiable = false;
84 return active_caption_text;
88 public static Pen Control {
90 if (control == null) {
91 control = new Pen (SystemColors.Control);
92 control.isModifiable = false;
99 public static Pen ControlDark {
101 if (control_dark == null) {
102 control_dark = new Pen (SystemColors.ControlDark);
103 control_dark.isModifiable = false;
110 public static Pen ControlDarkDark {
112 if (control_dark_dark == null) {
113 control_dark_dark = new Pen (SystemColors.ControlDarkDark);
114 control_dark_dark.isModifiable = false;
117 return control_dark_dark;
121 public static Pen ControlLight {
123 if (control_light == null) {
124 control_light = new Pen (SystemColors.ControlLight);
125 control_light.isModifiable = false;
128 return control_light;
132 public static Pen ControlLightLight {
134 if (control_light_light == null) {
135 control_light_light = new Pen (SystemColors.ControlLightLight);
136 control_light_light.isModifiable = false;
139 return control_light_light;
143 public static Pen ControlText {
145 if (control_text == null) {
146 control_text = new Pen (SystemColors.ControlText);
147 control_text.isModifiable = false;
154 public static Pen GrayText {
156 if (gray_text == null) {
157 gray_text = new Pen (SystemColors.GrayText);
158 gray_text.isModifiable = false;
165 public static Pen Highlight {
167 if (highlight == null) {
168 highlight = new Pen (SystemColors.Highlight);
169 highlight.isModifiable = false;
176 public static Pen HighlightText {
178 if (highlight_text == null) {
179 highlight_text = new Pen (SystemColors.HighlightText);
180 highlight_text.isModifiable = false;
183 return highlight_text;
187 public static Pen InactiveCaptionText {
189 if (inactive_caption_text == null) {
190 inactive_caption_text = new Pen (SystemColors.InactiveCaptionText);
191 inactive_caption_text.isModifiable = false;
194 return inactive_caption_text;
198 public static Pen InfoText {
200 if (info_text == null) {
201 info_text = new Pen (SystemColors.InfoText);
202 info_text.isModifiable = false;
209 public static Pen MenuText {
211 if (menu_text == null) {
212 menu_text = new Pen (SystemColors.MenuText);
213 menu_text.isModifiable = false;
220 public static Pen WindowFrame {
222 if (window_frame == null) {
223 window_frame = new Pen (SystemColors.WindowFrame);
224 window_frame.isModifiable = false;
231 public static Pen WindowText {
233 if (window_text == null) {
234 window_text = new Pen (SystemColors.WindowText);
235 window_text.isModifiable = false;
242 public static Pen FromSystemColor (Color c)
244 if (c.IsSystemColor) {
245 Pen newPen = new Pen (c);
246 newPen.isModifiable = false;
250 String message = String.Format ("The color {0} is not a system color.", c);
251 throw new ArgumentException (message);
255 public static Pen ActiveBorder {
257 if (active_border == null) {
258 active_border = new Pen (SystemColors.ActiveBorder);
259 active_border.isModifiable = false;
262 return active_border;
266 public static Pen ActiveCaption {
268 if (active_caption == null) {
269 active_caption = new Pen (SystemColors.ActiveCaption);
270 active_caption.isModifiable = false;
273 return active_caption;
277 public static Pen AppWorkspace {
279 if (app_workspace == null) {
280 app_workspace = new Pen (SystemColors.AppWorkspace);
281 app_workspace.isModifiable = false;
284 return app_workspace;
288 public static Pen ButtonFace {
290 if (button_face == null) {
291 button_face = new Pen (SystemColors.ButtonFace);
292 button_face.isModifiable = false;
299 public static Pen ButtonHighlight {
301 if (button_highlight == null) {
302 button_highlight = new Pen (SystemColors.ButtonHighlight);
303 button_highlight.isModifiable = false;
306 return button_highlight;
310 public static Pen ButtonShadow {
312 if (button_shadow == null) {
313 button_shadow = new Pen (SystemColors.ButtonShadow);
314 button_shadow.isModifiable = false;
317 return button_shadow;
321 public static Pen Desktop {
323 if (desktop == null) {
324 desktop = new Pen (SystemColors.Desktop);
325 desktop.isModifiable = false;
332 public static Pen GradientActiveCaption {
334 if (gradient_activecaption == null) {
335 gradient_activecaption = new Pen (SystemColors.GradientActiveCaption);
336 gradient_activecaption.isModifiable = false;
339 return gradient_activecaption;
343 public static Pen GradientInactiveCaption {
345 if (gradient_inactivecaption == null) {
346 gradient_inactivecaption = new Pen (SystemColors.GradientInactiveCaption);
347 gradient_inactivecaption.isModifiable = false;
350 return gradient_inactivecaption;
354 public static Pen HotTrack {
356 if (hot_track == null) {
357 hot_track = new Pen (SystemColors.HotTrack);
358 hot_track.isModifiable = false;
365 public static Pen InactiveBorder {
367 if (inactive_border == null) {
368 inactive_border = new Pen (SystemColors.InactiveBorder);
369 inactive_border.isModifiable = false;
372 return inactive_border;
376 public static Pen InactiveCaption {
378 if (inactive_caption == null) {
379 inactive_caption = new Pen (SystemColors.InactiveCaption);
380 inactive_caption.isModifiable = false;
383 return inactive_caption;
387 public static Pen Info {
390 info = new Pen (SystemColors.Info);
391 info.isModifiable = false;
398 public static Pen Menu {
401 menu = new Pen (SystemColors.Menu);
402 menu.isModifiable = false;
409 public static Pen MenuBar {
411 if (menu_bar == null) {
412 menu_bar = new Pen (SystemColors.MenuBar);
413 menu_bar.isModifiable = false;
420 public static Pen MenuHighlight {
422 if (menu_highlight == null) {
423 menu_highlight = new Pen (SystemColors.MenuHighlight);
424 menu_highlight.isModifiable = false;
427 return menu_highlight;
431 public static Pen ScrollBar {
433 if (scroll_bar == null) {
434 scroll_bar = new Pen (SystemColors.ScrollBar);
435 scroll_bar.isModifiable = false;
442 public static Pen Window {
444 if (window == null) {
445 window = new Pen (SystemColors.Window);
446 window.isModifiable = false;