2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.Drawing / System.Drawing / SystemBrushes.cs
blobe1036dbcb9b8101ac235859d1cbd9922c29ed63e
1 //
2 // System.Drawing.SystemBrushes.cs
3 //
4 // Authors:
5 // Dennis Hayes (dennish@Raytek.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
8 //
9 // Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
10 // Copyright (C) 2004 Novell, Inc. http://www.novell.com
14 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
16 // Permission is hereby granted, free of charge, to any person obtaining
17 // a copy of this software and associated documentation files (the
18 // "Software"), to deal in the Software without restriction, including
19 // without limitation the rights to use, copy, modify, merge, publish,
20 // distribute, sublicense, and/or sell copies of the Software, and to
21 // permit persons to whom the Software is furnished to do so, subject to
22 // the following conditions:
23 //
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
26 //
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 using System;
38 namespace System.Drawing
40 /// <summary>
41 /// Summary description for SystemBrushes.
42 /// </summary>
43 public sealed class SystemBrushes
45 static SolidBrush active_border;
46 static SolidBrush active_caption;
47 static SolidBrush active_caption_text;
48 static SolidBrush app_workspace;
49 static SolidBrush control;
50 static SolidBrush control_dark;
51 static SolidBrush control_dark_dark;
52 static SolidBrush control_light;
53 static SolidBrush control_light_light;
54 static SolidBrush control_text;
55 static SolidBrush desktop;
56 static SolidBrush highlight;
57 static SolidBrush highlight_text;
58 static SolidBrush hot_track;
59 static SolidBrush inactive_border;
60 static SolidBrush inactive_caption;
61 static SolidBrush info;
62 static SolidBrush menu;
63 static SolidBrush scroll_bar;
64 static SolidBrush window;
65 static SolidBrush window_text;
66 #if NET_2_0
67 static SolidBrush button_face;
68 static SolidBrush button_highlight;
69 static SolidBrush button_shadow;
70 static SolidBrush gradient_activecaption;
71 static SolidBrush gradient_inactivecaption;
72 static SolidBrush graytext;
73 static SolidBrush inactive_captiontext;
74 static SolidBrush infotext;
75 static SolidBrush menubar;
76 static SolidBrush menu_highlight;
77 static SolidBrush menu_text;
78 static SolidBrush window_fame;
79 #endif
81 private SystemBrushes() { }
83 public static Brush ActiveBorder
85 get {
86 if (active_border == null) {
87 active_border = new SolidBrush (SystemColors.ActiveBorder);
88 active_border.isModifiable = false;
91 return active_border;
95 public static Brush ActiveCaption
97 get {
98 if (active_caption == null) {
99 active_caption = new SolidBrush (SystemColors.ActiveCaption);
100 active_caption.isModifiable = false;
103 return active_caption;
107 public static Brush ActiveCaptionText
109 get {
110 if (active_caption_text == null) {
111 active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText);
112 active_caption_text.isModifiable = false;
115 return active_caption_text;
119 public static Brush AppWorkspace
121 get {
122 if (app_workspace == null) {
123 app_workspace = new SolidBrush (SystemColors.AppWorkspace);
124 app_workspace.isModifiable = false;
127 return app_workspace;
131 public static Brush Control {
132 get {
133 if (control == null) {
134 control = new SolidBrush (SystemColors.Control);
135 control.isModifiable = false;
138 return control;
142 public static Brush ControlLight {
143 get {
144 if (control_light == null) {
145 control_light = new SolidBrush (SystemColors.ControlLight);
146 control_light.isModifiable = false;
149 return control_light;
153 public static Brush ControlLightLight {
154 get {
155 if (control_light_light == null) {
156 control_light_light = new SolidBrush (SystemColors.ControlLightLight);
157 control_light_light.isModifiable = false;
160 return control_light_light;
164 public static Brush ControlDark {
165 get {
166 if (control_dark == null) {
167 control_dark = new SolidBrush (SystemColors.ControlDark);
168 control_dark.isModifiable = false;
171 return control_dark;
175 public static Brush ControlDarkDark {
176 get {
177 if (control_dark_dark == null) {
178 control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark);
179 control_dark_dark.isModifiable = false;
182 return control_dark_dark;
186 public static Brush ControlText {
187 get {
188 if (control_text == null) {
189 control_text = new SolidBrush (SystemColors.ControlText);
190 control_text.isModifiable = false;
193 return control_text;
197 public static Brush Highlight {
198 get {
199 if (highlight == null) {
200 highlight = new SolidBrush (SystemColors.Highlight);
201 highlight.isModifiable = false;
204 return highlight;
208 public static Brush HighlightText {
209 get {
210 if (highlight_text == null) {
211 highlight_text = new SolidBrush (SystemColors.HighlightText);
212 highlight_text.isModifiable = false;
215 return highlight_text;
219 public static Brush Window {
220 get {
221 if (window == null) {
222 window = new SolidBrush (SystemColors.Window);
223 window.isModifiable = false;
226 return window;
229 public static Brush WindowText {
230 get {
231 if (window_text == null) {
232 window_text = new SolidBrush (SystemColors.WindowText);
233 window_text.isModifiable = false;
236 return window_text;
240 public static Brush InactiveBorder {
241 get {
242 if (inactive_border == null) {
243 inactive_border = new SolidBrush (SystemColors.InactiveBorder);
244 inactive_border.isModifiable = false;
247 return inactive_border;
251 public static Brush Desktop {
252 get {
253 if (desktop == null) {
254 desktop = new SolidBrush (SystemColors.Desktop);
255 desktop.isModifiable = false;
258 return desktop;
262 public static Brush HotTrack {
263 get {
264 if (hot_track == null) {
265 hot_track = new SolidBrush (SystemColors.HotTrack);
266 hot_track.isModifiable = false;
269 return hot_track;
273 public static Brush InactiveCaption {
274 get {
275 if (inactive_caption == null) {
276 inactive_caption = new SolidBrush (SystemColors.InactiveCaption);
277 inactive_caption.isModifiable = false;
280 return inactive_caption;
284 public static Brush Info {
285 get {
286 if (info == null) {
287 info = new SolidBrush (SystemColors.Info);
288 info.isModifiable = false;
291 return info;
295 public static Brush Menu {
296 get {
297 if (menu == null) {
298 menu = new SolidBrush (SystemColors.Menu);
299 menu.isModifiable = false;
302 return menu;
306 public static Brush ScrollBar {
307 get {
308 if (scroll_bar == null) {
309 scroll_bar = new SolidBrush (SystemColors.ScrollBar);
310 scroll_bar.isModifiable = false;
313 return scroll_bar;
317 public static Brush FromSystemColor (Color c)
319 if (c.IsSystemColor) {
320 SolidBrush newBrush = new SolidBrush (c);
321 newBrush.isModifiable = false;
322 return newBrush;
325 String message = String.Format ("The color {0} is not a system color.", c);
326 throw new ArgumentException (message);
329 #if NET_2_0
330 public static Brush ButtonFace {
331 get {
332 if (button_face == null) {
333 button_face = new SolidBrush (SystemColors.ButtonFace);
334 button_face.isModifiable = false;
337 return button_face;
341 public static Brush ButtonHighlight {
342 get {
343 if (button_highlight == null) {
344 button_highlight = new SolidBrush (SystemColors.ButtonHighlight);
345 button_highlight.isModifiable = false;
348 return button_highlight;
352 public static Brush ButtonShadow {
353 get {
354 if (button_shadow == null) {
355 button_shadow = new SolidBrush (SystemColors.ButtonShadow);
356 button_shadow.isModifiable = false;
359 return button_shadow;
363 public static Brush GradientActiveCaption {
364 get {
365 if (gradient_activecaption == null) {
366 gradient_activecaption = new SolidBrush (SystemColors.GradientActiveCaption);
367 gradient_activecaption.isModifiable = false;
370 return gradient_activecaption;
374 public static Brush GradientInactiveCaption {
375 get {
376 if (gradient_inactivecaption == null) {
377 gradient_inactivecaption = new SolidBrush (SystemColors.GradientInactiveCaption);
378 gradient_inactivecaption.isModifiable = false;
381 return gradient_inactivecaption;
385 public static Brush GrayText {
386 get {
387 if (graytext == null) {
388 graytext = new SolidBrush (SystemColors.GrayText);
389 graytext.isModifiable = false;
392 return graytext;
396 public static Brush InactiveCaptionText {
397 get {
398 if (inactive_captiontext == null) {
399 inactive_captiontext = new SolidBrush (SystemColors.InactiveCaptionText);
400 inactive_captiontext.isModifiable = false;
403 return inactive_captiontext;
407 public static Brush InfoText {
408 get {
409 if (infotext == null) {
410 infotext = new SolidBrush (SystemColors.InfoText);
411 infotext.isModifiable = false;
414 return infotext;
418 public static Brush MenuBar {
419 get {
420 if (menubar == null) {
421 menubar = new SolidBrush (SystemColors.MenuBar);
422 menubar.isModifiable = false;
425 return menubar;
429 public static Brush MenuHighlight {
430 get {
431 if (menu_highlight == null) {
432 menu_highlight = new SolidBrush (SystemColors.MenuHighlight);
433 menu_highlight.isModifiable = false;
436 return menu_highlight;
440 public static Brush MenuText {
441 get {
442 if (menu_text == null) {
443 menu_text = new SolidBrush (SystemColors.MenuText);
444 menu_text.isModifiable = false;
447 return menu_text;
451 public static Brush WindowFrame {
452 get {
453 if (window_fame == null) {
454 window_fame = new SolidBrush (SystemColors.WindowFrame);
455 window_fame.isModifiable = false;
458 return window_fame;
461 #endif