2 // System.Drawing.SystemBrushes.cs
5 // Dennis Hayes (dennish@Raytek.com)
6 // Ravindra (rkumar@novell.com)
7 // Jordi Mas i Hernandez <jordimash@gmail.com>
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:
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
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.
38 namespace System.Drawing
41 /// Summary description for SystemBrushes.
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 static SolidBrush button_face;
67 static SolidBrush button_highlight;
68 static SolidBrush button_shadow;
69 static SolidBrush gradient_activecaption;
70 static SolidBrush gradient_inactivecaption;
71 static SolidBrush graytext;
72 static SolidBrush inactive_captiontext;
73 static SolidBrush infotext;
74 static SolidBrush menubar;
75 static SolidBrush menu_highlight;
76 static SolidBrush menu_text;
77 static SolidBrush window_fame;
79 private SystemBrushes() { }
81 public static Brush ActiveBorder
84 if (active_border == null) {
85 active_border = new SolidBrush (SystemColors.ActiveBorder);
86 active_border.isModifiable = false;
93 public static Brush ActiveCaption
96 if (active_caption == null) {
97 active_caption = new SolidBrush (SystemColors.ActiveCaption);
98 active_caption.isModifiable = false;
101 return active_caption;
105 public static Brush ActiveCaptionText
108 if (active_caption_text == null) {
109 active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText);
110 active_caption_text.isModifiable = false;
113 return active_caption_text;
117 public static Brush AppWorkspace
120 if (app_workspace == null) {
121 app_workspace = new SolidBrush (SystemColors.AppWorkspace);
122 app_workspace.isModifiable = false;
125 return app_workspace;
129 public static Brush Control {
131 if (control == null) {
132 control = new SolidBrush (SystemColors.Control);
133 control.isModifiable = false;
140 public static Brush ControlLight {
142 if (control_light == null) {
143 control_light = new SolidBrush (SystemColors.ControlLight);
144 control_light.isModifiable = false;
147 return control_light;
151 public static Brush ControlLightLight {
153 if (control_light_light == null) {
154 control_light_light = new SolidBrush (SystemColors.ControlLightLight);
155 control_light_light.isModifiable = false;
158 return control_light_light;
162 public static Brush ControlDark {
164 if (control_dark == null) {
165 control_dark = new SolidBrush (SystemColors.ControlDark);
166 control_dark.isModifiable = false;
173 public static Brush ControlDarkDark {
175 if (control_dark_dark == null) {
176 control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark);
177 control_dark_dark.isModifiable = false;
180 return control_dark_dark;
184 public static Brush ControlText {
186 if (control_text == null) {
187 control_text = new SolidBrush (SystemColors.ControlText);
188 control_text.isModifiable = false;
195 public static Brush Highlight {
197 if (highlight == null) {
198 highlight = new SolidBrush (SystemColors.Highlight);
199 highlight.isModifiable = false;
206 public static Brush HighlightText {
208 if (highlight_text == null) {
209 highlight_text = new SolidBrush (SystemColors.HighlightText);
210 highlight_text.isModifiable = false;
213 return highlight_text;
217 public static Brush Window {
219 if (window == null) {
220 window = new SolidBrush (SystemColors.Window);
221 window.isModifiable = false;
227 public static Brush WindowText {
229 if (window_text == null) {
230 window_text = new SolidBrush (SystemColors.WindowText);
231 window_text.isModifiable = false;
238 public static Brush InactiveBorder {
240 if (inactive_border == null) {
241 inactive_border = new SolidBrush (SystemColors.InactiveBorder);
242 inactive_border.isModifiable = false;
245 return inactive_border;
249 public static Brush Desktop {
251 if (desktop == null) {
252 desktop = new SolidBrush (SystemColors.Desktop);
253 desktop.isModifiable = false;
260 public static Brush HotTrack {
262 if (hot_track == null) {
263 hot_track = new SolidBrush (SystemColors.HotTrack);
264 hot_track.isModifiable = false;
271 public static Brush InactiveCaption {
273 if (inactive_caption == null) {
274 inactive_caption = new SolidBrush (SystemColors.InactiveCaption);
275 inactive_caption.isModifiable = false;
278 return inactive_caption;
282 public static Brush Info {
285 info = new SolidBrush (SystemColors.Info);
286 info.isModifiable = false;
293 public static Brush Menu {
296 menu = new SolidBrush (SystemColors.Menu);
297 menu.isModifiable = false;
304 public static Brush ScrollBar {
306 if (scroll_bar == null) {
307 scroll_bar = new SolidBrush (SystemColors.ScrollBar);
308 scroll_bar.isModifiable = false;
315 public static Brush FromSystemColor (Color c)
317 if (c.IsSystemColor) {
318 SolidBrush newBrush = new SolidBrush (c);
319 newBrush.isModifiable = false;
323 String message = String.Format ("The color {0} is not a system color.", c);
324 throw new ArgumentException (message);
328 public static Brush ButtonFace {
330 if (button_face == null) {
331 button_face = new SolidBrush (SystemColors.ButtonFace);
332 button_face.isModifiable = false;
339 public static Brush ButtonHighlight {
341 if (button_highlight == null) {
342 button_highlight = new SolidBrush (SystemColors.ButtonHighlight);
343 button_highlight.isModifiable = false;
346 return button_highlight;
350 public static Brush ButtonShadow {
352 if (button_shadow == null) {
353 button_shadow = new SolidBrush (SystemColors.ButtonShadow);
354 button_shadow.isModifiable = false;
357 return button_shadow;
361 public static Brush GradientActiveCaption {
363 if (gradient_activecaption == null) {
364 gradient_activecaption = new SolidBrush (SystemColors.GradientActiveCaption);
365 gradient_activecaption.isModifiable = false;
368 return gradient_activecaption;
372 public static Brush GradientInactiveCaption {
374 if (gradient_inactivecaption == null) {
375 gradient_inactivecaption = new SolidBrush (SystemColors.GradientInactiveCaption);
376 gradient_inactivecaption.isModifiable = false;
379 return gradient_inactivecaption;
383 public static Brush GrayText {
385 if (graytext == null) {
386 graytext = new SolidBrush (SystemColors.GrayText);
387 graytext.isModifiable = false;
394 public static Brush InactiveCaptionText {
396 if (inactive_captiontext == null) {
397 inactive_captiontext = new SolidBrush (SystemColors.InactiveCaptionText);
398 inactive_captiontext.isModifiable = false;
401 return inactive_captiontext;
405 public static Brush InfoText {
407 if (infotext == null) {
408 infotext = new SolidBrush (SystemColors.InfoText);
409 infotext.isModifiable = false;
416 public static Brush MenuBar {
418 if (menubar == null) {
419 menubar = new SolidBrush (SystemColors.MenuBar);
420 menubar.isModifiable = false;
427 public static Brush MenuHighlight {
429 if (menu_highlight == null) {
430 menu_highlight = new SolidBrush (SystemColors.MenuHighlight);
431 menu_highlight.isModifiable = false;
434 return menu_highlight;
438 public static Brush MenuText {
440 if (menu_text == null) {
441 menu_text = new SolidBrush (SystemColors.MenuText);
442 menu_text.isModifiable = false;
449 public static Brush WindowFrame {
451 if (window_fame == null) {
452 window_fame = new SolidBrush (SystemColors.WindowFrame);
453 window_fame.isModifiable = false;