Tue Dec 16 12:15:00 GMT+2 2003 Joel Basson <jstrike@mweb.co.za>
[mono.git] / mcs / class / System.Windows.Forms / Gtk / ButtonBase.cs
1 //
2 // System.Windows.Forms.ButtonBase.cs
3 //
4 // Author:
5 //   stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 //        implemented for Gtk+ by Rachel Hestilow (hestilow@ximian.com)
7 //   Dennis Hayes (dennish@Raytek.com)
8 //   WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
9 //   Alexandre Pigokine (pigolkine@gmx.de)
10 //
11 // (C) Ximian, Inc., 2002/3
12 //
13
14 using System.ComponentModel;
15 using System.Drawing;
16
17 namespace System.Windows.Forms {
18
19         /// <summary>
20         /// Implements the basic functionality common to button controls.
21         /// </summary>
22
23         public abstract class ButtonBase : Control {
24
25                 // private fields
26                 FlatStyle flatStyle;
27                 Image image;
28                 ContentAlignment imageAlign;
29                 int imageIndex;
30                 ContentAlignment textAlign;
31                 ImeMode imeMode;
32                 bool isDefault;
33                 bool isPushed;
34                 
35                 protected Label label;
36
37 //              
38 //              // --- Constructor ---
39                 protected ButtonBase() : base(){
40                         label = new Label();
41                         label.Text = Text;
42                         label.Visible = true;
43                         flatStyle = FlatStyle.Standard;
44                         image = null;
45                         imageAlign = ContentAlignment.MiddleCenter;
46                         imageIndex = -1;
47                         textAlign = ContentAlignment.MiddleCenter;
48                         imeMode = ImeMode.Inherit;
49                         isDefault = false;
50                         //isPushed = false;
51                 }
52
53                 // --- Properties ---
54                 //protected override CreateParams CreateParams {
55                 //      get { return base.CreateParams; }
56                 //}
57                 
58                 //protected override ImeMode DefaultImeMode {
59                 //      get {
60                 //              return ImeMode.Inherit;
61                 //      }
62                 //}
63                 
64                 public override String Text{
65                         get { return label.Text; }
66                         set{ label.Text = value;}
67                 }
68                 public override Color ForeColor {
69                         set{label.ForeColor = value;}
70                 }
71                 public override Font Font{
72                         set{label.Font = value;}
73                 }
74                 protected override Size DefaultSize {
75                         get {
76                                 return new Size(75,23);// default size for button.
77                         }
78                 }
79                 [MonoTODO]
80                 public FlatStyle FlatStyle {
81                         get { return flatStyle; }
82                         set { flatStyle = value;}
83                 }
84                 [MonoTODO]
85                 public Image Image {
86                         get { return image; }
87                         set { 
88                                 image = value; 
89                                 Invalidate();
90                         }
91                 }
92                 [MonoTODO]
93                 public ImageList ImageList {
94                         get {throw new NotImplementedException ();}
95                         set{
96                                 //fixme:
97                         }\r
98                 }
99                 [MonoTODO]
100                 public ContentAlignment ImageAlign {
101                         get { return imageAlign; }
102                         set { 
103                                 if( imageAlign != value) {
104                                         imageAlign = value;
105                                         Invalidate();
106                                 }
107                         }
108                 }
109                 [MonoTODO]
110                 public int ImageIndex {
111                         get { return imageIndex; }
112                         set { imageIndex=value; }
113                 }
114                 [MonoTODO]
115                 public new ImeMode ImeMode {
116                         get {return imeMode; }
117                         set {imeMode = value;}
118                 }
119                 [MonoTODO]
120                 protected bool IsDefault {
121                         get {return isDefault;}
122                         set {isDefault = value;}
123                 }
124
125                 //internal bool Pushed {
126                 //      get {return isPushed;}
127                 //}
128                 
129                 [MonoTODO]
130                 public virtual ContentAlignment TextAlign {
131                         get { return textAlign; }
132                         set { 
133                                 if( textAlign != value) {
134                                         textAlign = value;
135                                         Invalidate();
136                                 }
137                         }
138                 }
139
140                 /// --- Methods ---
141                 //protected override void Dispose(bool disposing){
142                 //      base.Dispose(disposing);
143                 //}
144
145                 protected void ResetFlagsandPaint(){
146                 }
147                 
148                 
149                 //protected override AccessibleObject CreateAccessibilityInstance() 
150                 //{
151                 //      return base.CreateAccessibilityInstance();
152                 //}
153                 
154                 /// [methods for events]
155                 //protected override void OnEnabledChanged (EventArgs e) 
156                 //{
157                 //      base.OnEnabledChanged (e);
158                 //}
159                 
160                 //protected override void OnGotFocus (EventArgs e) 
161                 //{
162                 //      base.OnGotFocus (e);
163                 //}
164                 
165                 //protected override void OnKeyDown (KeyEventArgs kevent) 
166                 //{
167                 //      base.OnKeyDown (kevent);
168                 //}
169                 
170                 //protected override void OnKeyUp (KeyEventArgs kevent) 
171                 //{
172                 //      base.OnKeyUp (kevent);
173                 //}
174                 
175                 //protected override void OnLostFocus (EventArgs e) 
176                 //{
177                 //      base.OnLostFocus (e);
178                 //}
179                 
180                 //protected override void OnMouseDown (MouseEventArgs mevent) 
181                 //{
182                 //      if ((mevent.Button & MouseButtons.Left) == MouseButtons.Left) {
183                 //              isPushed = true;
184                 //              Invalidate(); 
185                 //      }
186
187                 //      base.OnMouseDown (mevent);
188                 //}
189                 
190                 //protected override void OnMouseEnter (EventArgs eventargs) 
191                 //{
192                 //              base.OnMouseEnter(eventargs);
193                 //              if( FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup) {
194                 //                      Invalidate();
195                 //              }
196                 //}
197                 
198                 //protected override void OnMouseLeave (EventArgs eventargs) 
199                 //{
200                 //      base.OnMouseLeave(eventargs);
201                 //      if( FlatStyle == FlatStyle.Flat || FlatStyle == FlatStyle.Popup) {
202                 //              Invalidate();
203                 //      }
204                 //}
205                 
206                 //protected override void OnMouseMove (MouseEventArgs mevent) 
207                 //{
208                 //      base.OnMouseMove (mevent);
209                 //}
210                 
211                 //protected override void OnMouseUp (MouseEventArgs mevent) 
212                 //{
213                 //      isPushed = false;
214                 //      Invalidate(); 
215                 //      base.OnMouseUp (mevent);
216                 //}
217                 
218                 //internal virtual void ButtonPaint (PaintEventArgs pevent) {
219                 //}
220
221                 //protected override void OnPaint (PaintEventArgs pevent) 
222                 //{
223                 //      base.OnPaint (pevent);
224                 //      ButtonPaint (pevent);
225                 //}
226                 
227                 //protected override void OnParentChanged (EventArgs e) 
228                 //{
229                 //      base.OnParentChanged (e);
230                 //}
231                 
232                 //protected override void OnTextChanged (EventArgs e) 
233                 //{
234                 //      base.OnTextChanged (e);
235                 //}
236                 
237                 //protected override void OnVisibleChanged (EventArgs e) 
238                 //{
239                 //      base.OnVisibleChanged (e);
240                 //}
241                 /// end of [methods for events]
242                 
243         }
244 }