fixed tests
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / FlatButtonAppearance.cs
1 //
2 //  FlatButtonAppearance.cs
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23 // Copyright (c) 2006 Daniel Nauck
24 //
25 // Author:
26 //      Daniel Nauck    (dna(at)mono-project(dot)de)
27
28 #if NET_2_0
29
30 using System;
31 using System.ComponentModel;
32 using System.Drawing;
33 using System.Windows.Forms;
34
35 namespace System.Windows.Forms
36 {
37         public class FlatButtonAppearance
38         {
39                 private Color borderColor = Color.Empty;
40                 private int borderSize = 1;
41                 private Color checkedBackColor = Color.Empty;
42                 private Color mouseDownBackColor = Color.Empty;
43                 private Color mouseOverBackColor = Color.Empty;
44                 private ButtonBase owner = null;
45
46                 internal FlatButtonAppearance (ButtonBase owner)
47                 {
48                         this.owner = owner;
49                 }
50
51                 [EditorBrowsable(EditorBrowsableState.Always)]
52                 [DefaultValue(typeof(Color), "")]
53                 [NotifyParentProperty(true)]
54                 [Browsable(true)]
55                 public Color BorderColor
56                 {
57                         get { return borderColor; }
58                         set {
59                                 if(borderColor == value)
60                                         return;
61
62                                 borderColor = value;
63                                 
64                                 if(owner != null)
65                                         owner.Invalidate ();
66                         }
67                 }
68
69                 [EditorBrowsable(EditorBrowsableState.Always)]
70                 [DefaultValue(1)]
71                 [NotifyParentProperty(true)]
72                 [Browsable(true)]
73                 public int BorderSize
74                 {
75                         get { return borderSize; }
76                         set {
77                                 if(borderSize == value)
78                                         return;
79
80                                 if (value < 0)
81                                         throw new ArgumentOutOfRangeException ("value", string.Format ("'{0}' is not a valid value for 'BorderSize'. 'BorderSize' must be greater or equal than {1}.", value, 0));
82
83                                 borderSize = value;
84
85                                 if(owner != null)
86                                         owner.Invalidate ();
87                         }
88                 }
89
90                 [EditorBrowsable(EditorBrowsableState.Always)]
91                 [DefaultValue(typeof(Color), "")]
92                 [NotifyParentProperty(true)]
93                 [Browsable(true)]
94                 public Color CheckedBackColor 
95                 {
96                         get { return checkedBackColor; }
97                         set {
98                                 if(checkedBackColor == value)
99                                         return;
100
101                                 checkedBackColor = value;
102
103                                 if(owner != null)
104                                         owner.Invalidate ();
105                         }
106                 }
107
108                 [EditorBrowsable(EditorBrowsableState.Always)]
109                 [DefaultValue(typeof(Color), "")]
110                 [Browsable(true)]
111                 [NotifyParentProperty(true)]
112                 public Color MouseDownBackColor
113                 {
114                         get { return mouseDownBackColor; }
115                         set {
116                                 if(mouseDownBackColor == value)
117                                         return;
118
119                                 mouseDownBackColor = value;
120
121                                 if(owner != null)
122                                         owner.Invalidate ();
123                         }
124                 }
125
126                 [EditorBrowsable(EditorBrowsableState.Always)]
127                 [DefaultValue(typeof(Color), "")]
128                 [NotifyParentProperty(true)]
129                 [Browsable(true)]
130                 public Color MouseOverBackColor
131                 {
132                         get { return mouseOverBackColor; }
133                         set {
134                                 if(mouseOverBackColor == value)
135                                         return;
136
137                                 mouseOverBackColor = value;
138
139                                 if(owner != null)
140                                         owner.Invalidate ();
141                         }
142                 }
143         }
144 }
145 #endif