Brush.jvm.cs: fixed transform methods, createContext
[mono.git] / mcs / class / System.Drawing / System.Drawing / SystemPens.cs
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 //
10
11 //
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
13 //
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.
32 //
33
34 using System;
35
36 namespace System.Drawing
37 {
38         public sealed class SystemPens
39         {
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;
55                 
56                 private SystemPens () { }
57                 
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;
63                                 }
64                                 
65                                 return active_caption_text;
66                         }
67                 }
68                 
69                 public static Pen Control {
70                         get {
71                                 if (control == null) {
72                                         control = new Pen (SystemColors.Control);
73                                         control.isModifiable = false;
74                                 }
75                                                                 
76                                 return control;
77                         }
78                 }
79                 
80                 public static Pen ControlDark {
81                         get {
82                                 if (control_dark == null) {
83                                         control_dark = new Pen (SystemColors.ControlDark);
84                                         control_dark.isModifiable = false;
85                                 }
86
87                                 return control_dark;
88                         }
89                 }
90                 
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;
96                                 }
97                                 
98                                 return control_dark_dark;
99                         }
100                 }
101                 
102                 public static Pen ControlLight {
103                         get {
104                                 if (control_light == null) {
105                                         control_light = new Pen (SystemColors.ControlLight);
106                                         control_light.isModifiable = false;
107                                 }
108                                 
109                                 return control_light;
110                         }
111                 }
112                 
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;
118                                 }
119                                 
120                                 return control_light_light;
121                         }
122                 }
123                 
124                 public static Pen ControlText {
125                         get {
126                                 if (control_text == null) {
127                                         control_text = new Pen (SystemColors.ControlText);
128                                         control_text.isModifiable = false;
129                                 }
130                                 
131                                 return control_text;
132                         }
133                 }
134                 
135                 public static Pen GrayText {
136                         get {
137                                 if (gray_text == null) {
138                                         gray_text = new Pen (SystemColors.GrayText);
139                                         gray_text.isModifiable = false;
140                                 }
141                                 
142                                 return gray_text;
143                         }
144                 }
145                 
146                 public static Pen Highlight {
147                         get {
148                                 if (highlight == null) {
149                                         highlight = new Pen (SystemColors.Highlight);
150                                         highlight.isModifiable = false;
151                                 }
152                                 
153                                 return highlight;
154                         }
155                 }
156                 
157                 public static Pen HighlightText {
158                         get {
159                                 if (highlight_text == null) {
160                                         highlight_text = new Pen (SystemColors.HighlightText);
161                                         highlight_text.isModifiable = false;
162                                 }
163                                 
164                                 return highlight_text;
165                         }
166                 }
167                 
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;
173                                 }
174                                 
175                                 return inactive_caption_text;
176                         }
177                 }
178                 
179                 public static Pen InfoText {
180                         get {
181                                 if (info_text == null) {
182                                         info_text = new Pen (SystemColors.InfoText);
183                                         info_text.isModifiable = false;
184                                 }
185                                 
186                                 return info_text;
187                         }
188                 }
189                 
190                 public static Pen MenuText {
191                         get {
192                                 if (menu_text == null) {
193                                         menu_text = new Pen (SystemColors.MenuText);
194                                         menu_text.isModifiable = false;
195                                 }
196                                 
197                                 return menu_text;
198                         }
199                 }
200                 
201                 public static Pen WindowFrame {
202                         get {
203                                 if (window_frame == null) {
204                                         window_frame = new Pen (SystemColors.WindowFrame);
205                                         window_frame.isModifiable = false;
206                                 }
207                                 
208                                 return window_frame;
209                         }
210                 }
211                 
212                 public static Pen WindowText {
213                         get {
214                                 if (window_text == null) {
215                                         window_text = new Pen (SystemColors.WindowText);
216                                         window_text.isModifiable = false;
217                                 }
218                                 
219                                 return window_text;
220                         }
221                 }
222                 
223                 public static Pen FromSystemColor (Color c)
224                 {
225                         if (c.IsSystemColor) {
226                                 Pen newPen = new Pen (c);
227                                 newPen.isModifiable = false;
228                                 return newPen;
229                         }
230                         
231                         String message = String.Format ("The color {0} is not a system color.", c);
232                         throw new ArgumentException (message);
233                 }
234                 
235         }
236 }