**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Drawing / System.Drawing / SystemPens.cs
blobda21a80510b9115f3a61b5680d34d8faa73a37d0
1 //
2 // System.Drawing.SystemPens.cs
3 //
4 // Authors:
5 // Miguel de Icaza (miguel@ximian.com)
6 // Ravindra (rkumar@novell.com)
7 //
8 // Copyright (C) 2003-2004 Novell, Inc. http://www.novell.com
9 //
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 //
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
24 //
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System;
36 namespace System.Drawing
38 public sealed class SystemPens
40 static private Pen active_caption_text;
41 static private Pen control;
42 static private Pen control_dark;
43 static private Pen control_dark_dark;
44 static private Pen control_light;
45 static private Pen control_light_light;
46 static private Pen control_text;
47 static private Pen gray_text;
48 static private Pen highlight;
49 static private Pen highlight_text;
50 static private Pen inactive_caption_text;
51 static private Pen info_text;
52 static private Pen menu_text;
53 static private Pen window_frame;
54 static private Pen window_text;
56 private SystemPens () { }
58 public static Pen ActiveCaptionText {
59 get {
60 if (active_caption_text == null) {
61 active_caption_text = new Pen (SystemColors.ActiveCaptionText);
62 active_caption_text.isModifiable = false;
65 return active_caption_text;
69 public static Pen Control {
70 get {
71 if (control == null) {
72 control = new Pen (SystemColors.Control);
73 control.isModifiable = false;
76 return control;
80 public static Pen ControlDark {
81 get {
82 if (control_dark == null) {
83 control_dark = new Pen (SystemColors.ControlDark);
84 control_dark.isModifiable = false;
87 return control_dark;
91 public static Pen ControlDarkDark {
92 get {
93 if (control_dark_dark == null) {
94 control_dark_dark = new Pen (SystemColors.ControlDarkDark);
95 control_dark_dark.isModifiable = false;
98 return control_dark_dark;
102 public static Pen ControlLight {
103 get {
104 if (control_light == null) {
105 control_light = new Pen (SystemColors.ControlLight);
106 control_light.isModifiable = false;
109 return control_light;
113 public static Pen ControlLightLight {
114 get {
115 if (control_light_light == null) {
116 control_light_light = new Pen (SystemColors.ControlLightLight);
117 control_light_light.isModifiable = false;
120 return control_light_light;
124 public static Pen ControlText {
125 get {
126 if (control_text == null) {
127 control_text = new Pen (SystemColors.ControlText);
128 control_text.isModifiable = false;
131 return control_text;
135 public static Pen GrayText {
136 get {
137 if (gray_text == null) {
138 gray_text = new Pen (SystemColors.GrayText);
139 gray_text.isModifiable = false;
142 return gray_text;
146 public static Pen Highlight {
147 get {
148 if (highlight == null) {
149 highlight = new Pen (SystemColors.Highlight);
150 highlight.isModifiable = false;
153 return highlight;
157 public static Pen HighlightText {
158 get {
159 if (highlight_text == null) {
160 highlight_text = new Pen (SystemColors.HighlightText);
161 highlight_text.isModifiable = false;
164 return highlight_text;
168 public static Pen InactiveCaptionText {
169 get {
170 if (inactive_caption_text == null) {
171 inactive_caption_text = new Pen (SystemColors.InactiveCaptionText);
172 inactive_caption_text.isModifiable = false;
175 return inactive_caption_text;
179 public static Pen InfoText {
180 get {
181 if (info_text == null) {
182 info_text = new Pen (SystemColors.InfoText);
183 info_text.isModifiable = false;
186 return info_text;
190 public static Pen MenuText {
191 get {
192 if (menu_text == null) {
193 menu_text = new Pen (SystemColors.MenuText);
194 menu_text.isModifiable = false;
197 return menu_text;
201 public static Pen WindowFrame {
202 get {
203 if (window_frame == null) {
204 window_frame = new Pen (SystemColors.WindowFrame);
205 window_frame.isModifiable = false;
208 return window_frame;
212 public static Pen WindowText {
213 get {
214 if (window_text == null) {
215 window_text = new Pen (SystemColors.WindowText);
216 window_text.isModifiable = false;
219 return window_text;
223 public static Pen FromSystemColor (Color c)
225 if (c.IsSystemColor) {
226 Pen newPen = new Pen (c);
227 newPen.isModifiable = false;
228 return newPen;
231 String message = String.Format ("The color {0} is not a system color.", c);
232 throw new ArgumentException (message);