//
// System.Drawing.SystemBrushes.cs
//
-// Author:
+// Authors:
// Dennis Hayes (dennish@Raytek.com)
+// Ravindra (rkumar@novell.com)
//
-// (C) 2002 Ximian, Inc
+// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
+// Copyright (C) 2004 Novell, Inc. http://www.novell.com
//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
namespace System.Drawing
/// <summary>
/// Summary description for SystemBrushes.
/// </summary>
- public class SystemBrushes
+ public sealed class SystemBrushes
{
- public SystemBrushes()
- {
- //
- // TODO: Add constructor logic here
- //
- }
+ static SolidBrush active_border;
+ static SolidBrush active_caption;
+ static SolidBrush active_caption_text;
+ static SolidBrush app_workspace;
+ static SolidBrush control;
+ static SolidBrush control_dark;
+ static SolidBrush control_dark_dark;
+ static SolidBrush control_light;
+ static SolidBrush control_light_light;
+ static SolidBrush control_text;
+ static SolidBrush desktop;
+ static SolidBrush highlight;
+ static SolidBrush highlight_text;
+ static SolidBrush hot_track;
+ static SolidBrush inactive_border;
+ static SolidBrush inactive_caption;
+ static SolidBrush info;
+ static SolidBrush menu;
+ static SolidBrush scroll_bar;
+ static SolidBrush window;
+ static SolidBrush window_text;
+
+ private SystemBrushes() { }
+
public static Brush ActiveBorder
{
get {
- return new SolidBrush(SystemColors.ActiveBorder);
+ if (active_border == null) {
+ active_border = new SolidBrush (SystemColors.ActiveBorder);
+ active_border.isModifiable = false;
+ }
+
+ return active_border;
}
}
public static Brush ActiveCaption
{
get {
- return new SolidBrush(SystemColors.ActiveCaption);
+ if (active_caption == null) {
+ active_caption = new SolidBrush (SystemColors.ActiveCaption);
+ active_caption.isModifiable = false;
+ }
+
+ return active_caption;
}
}
public static Brush ActiveCaptionText
{
get {
- return new SolidBrush(SystemColors.ActiveCaptionText);
+ if (active_caption_text == null) {
+ active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText);
+ active_caption_text.isModifiable = false;
+ }
+
+ return active_caption_text;
}
}
public static Brush AppWorkspace
{
get {
- return new SolidBrush(SystemColors.AppWorkspace);
+ if (app_workspace == null) {
+ app_workspace = new SolidBrush (SystemColors.AppWorkspace);
+ app_workspace.isModifiable = false;
+ }
+
+ return app_workspace;
}
}
public static Brush Control {
get {
- return new SolidBrush(SystemColors.Control);
+ if (control == null) {
+ control = new SolidBrush (SystemColors.Control);
+ control.isModifiable = false;
+ }
+
+ return control;
}
}
public static Brush ControlLight {
get {
- return new SolidBrush(SystemColors.ControlLight);
+ if (control_light == null) {
+ control_light = new SolidBrush (SystemColors.ControlLight);
+ control_light.isModifiable = false;
+ }
+
+ return control_light;
}
}
public static Brush ControlLightLight {
get {
- return new SolidBrush(SystemColors.ControlLightLight);
+ if (control_light_light == null) {
+ control_light_light = new SolidBrush (SystemColors.ControlLightLight);
+ control_light_light.isModifiable = false;
+ }
+
+ return control_light_light;
+ }
+ }
+
+ public static Brush ControlDark {
+ get {
+ if (control_dark == null) {
+ control_dark = new SolidBrush (SystemColors.ControlDark);
+ control_dark.isModifiable = false;
+ }
+
+ return control_dark;
+ }
+ }
+
+ public static Brush ControlDarkDark {
+ get {
+ if (control_dark_dark == null) {
+ control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark);
+ control_dark_dark.isModifiable = false;
+ }
+
+ return control_dark_dark;
}
}
public static Brush ControlText {
get {
- return new SolidBrush(SystemColors.ControlText);
+ if (control_text == null) {
+ control_text = new SolidBrush (SystemColors.ControlText);
+ control_text.isModifiable = false;
+ }
+
+ return control_text;
}
}
public static Brush Highlight {
get {
- return new SolidBrush(SystemColors.Highlight);
+ if (highlight == null) {
+ highlight = new SolidBrush (SystemColors.Highlight);
+ highlight.isModifiable = false;
+ }
+
+ return highlight;
}
}
public static Brush HighlightText {
get {
- return new SolidBrush(SystemColors.HighlightText);
+ if (highlight_text == null) {
+ highlight_text = new SolidBrush (SystemColors.HighlightText);
+ highlight_text.isModifiable = false;
+ }
+
+ return highlight_text;
}
}
public static Brush Window {
get {
- return new SolidBrush(SystemColors.Window);
+ if (window == null) {
+ window = new SolidBrush (SystemColors.Window);
+ window.isModifiable = false;
+ }
+
+ return window;
+ }
+ }
+ public static Brush WindowText {
+ get {
+ if (window_text == null) {
+ window_text = new SolidBrush (SystemColors.WindowText);
+ window_text.isModifiable = false;
+ }
+
+ return window_text;
+ }
+ }
+
+ public static Brush InactiveBorder {
+ get {
+ if (inactive_border == null) {
+ inactive_border = new SolidBrush (SystemColors.InactiveBorder);
+ inactive_border.isModifiable = false;
+ }
+
+ return inactive_border;
+ }
+ }
+
+ public static Brush Desktop {
+ get {
+ if (desktop == null) {
+ desktop = new SolidBrush (SystemColors.Desktop);
+ desktop.isModifiable = false;
+ }
+
+ return desktop;
}
}
+
+ public static Brush HotTrack {
+ get {
+ if (hot_track == null) {
+ hot_track = new SolidBrush (SystemColors.HotTrack);
+ hot_track.isModifiable = false;
+ }
+
+ return hot_track;
+ }
+ }
+
+ public static Brush InactiveCaption {
+ get {
+ if (inactive_caption == null) {
+ inactive_caption = new SolidBrush (SystemColors.InactiveCaption);
+ inactive_caption.isModifiable = false;
+ }
+
+ return inactive_caption;
+ }
+ }
+
+ public static Brush Info {
+ get {
+ if (info == null) {
+ info = new SolidBrush (SystemColors.Info);
+ info.isModifiable = false;
+ }
+
+ return info;
+ }
+ }
+
+ public static Brush Menu {
+ get {
+ if (menu == null) {
+ menu = new SolidBrush (SystemColors.Menu);
+ menu.isModifiable = false;
+ }
+
+ return menu;
+ }
+ }
+
+ public static Brush ScrollBar {
+ get {
+ if (scroll_bar == null) {
+ scroll_bar = new SolidBrush (SystemColors.ScrollBar);
+ scroll_bar.isModifiable = false;
+ }
+
+ return scroll_bar;
+ }
+ }
+
+ public static Brush FromSystemColor (Color c)
+ {
+ if (c.IsSystemColor) {
+ SolidBrush newBrush = new SolidBrush (c);
+ newBrush.isModifiable = false;
+ return newBrush;
+ }
+
+ String message = String.Format ("The color {0} is not a system color.", c);
+ throw new ArgumentException (message);
+ }
}
}