**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Windows.Forms / WINELib / Label.cs
blob3784481e9ae497723b8bf917220d3b3a4788d0ff
1 //
2 // System.Windows.Forms.Label.cs
3 //
4 // Author:
5 // stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
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 //
10 // (C) 2002 Ximian, Inc
13 namespace System.Windows.Forms {
14 using System.ComponentModel;
15 using System.Drawing;
17 // <summary>
19 // </summary>
21 public class Label : Control {
23 Image backgroundImage;
24 BorderStyle borderStyle;
25 bool autoSize;
26 Image image;
27 ContentAlignment imageAlign;
28 ImeMode defaultImeMode;
29 bool renderTransparent;
30 FlatStyle flatStyle;
31 int preferredHeight;
32 int preferredWidth;
33 bool tabStop;
34 ContentAlignment textAlign;
35 bool useMnemonic;
38 // --- Constructor
40 public Label () : base ()
46 // --- Public Properties
48 public virtual bool AutoSize {
49 get {
50 return autoSize;
52 set {
53 autoSize = value;
57 public override Image BackgroundImage {
58 get {
59 return backgroundImage;
61 set {
62 backgroundImage = value;
63 // FIXME: force redraw
67 public virtual BorderStyle BorderStyle {
68 get {
69 return borderStyle;
71 set {
72 borderStyle = value;
77 public FlatStyle FlatStyle {
78 get {
79 return flatStyle;
81 set {
82 flatStyle = value;
86 public Image Image {
87 get {
88 return image;
90 set {
91 image = value;
95 public ContentAlignment ImageAlign {
96 get {
97 return imageAlign;
99 set {
100 imageAlign = value;
105 [MonoTODO]
106 public int ImageIndex {
107 get {
108 throw new NotImplementedException ();
110 set {
111 throw new NotImplementedException ();
115 [MonoTODO]
116 public ImageList ImageList {
117 get {
118 throw new NotImplementedException ();
120 set {
121 throw new NotImplementedException ();
125 [MonoTODO]
126 public new ImeMode ImeMode {
127 get {
128 throw new NotImplementedException ();
130 set {
131 throw new NotImplementedException ();
135 public int PreferredHeight {
136 get {
137 return preferredHeight;
141 public int PreferredWidth {
142 get {
143 return preferredWidth;
147 public new bool TabStop {
148 get {
149 return tabStop;
151 set {
152 tabStop = value;
156 //Compact Framework
157 public virtual ContentAlignment TextAlign {
158 get {
159 return textAlign;
161 set {
162 textAlign = value;
166 public bool UseMnemonic {
167 get {
168 return useMnemonic;
170 set {
171 useMnemonic = value;
176 // --- Protected Properties
179 protected override CreateParams CreateParams {
180 get {
181 CreateParams createParams = new CreateParams ();
182 window = new ControlNativeWindow (this);
184 createParams.Caption = Text;
185 createParams.ClassName = "STATIC";
186 createParams.X = Left;
187 createParams.Y = Top;
188 createParams.Width = Width;
189 createParams.Height = Height;
190 createParams.ClassStyle = 0;
191 createParams.ExStyle = 0;
192 createParams.Param = 0;
193 createParams.Parent = Parent.Handle;
194 createParams.Style = (int) (
195 Win32.WS_CHILD |
196 Win32.WS_VISIBLE | Win32.SS_LEFT );
197 window.CreateHandle (createParams);
198 return createParams;
202 protected override Size DefaultSize {
203 get {
204 // FIXME: use GetSystemMetrics?
205 throw new NotImplementedException ();
209 protected virtual bool RenderTransparent {
210 get {
211 return renderTransparent;
213 set {
214 renderTransparent = value;
218 protected override ImeMode DefaultImeMode {
219 get {
220 return defaultImeMode;
225 // --- Public Methods
227 [MonoTODO]
228 public override bool Equals(object o)
230 throw new NotImplementedException ();
233 public override int GetHashCode() {
234 //FIXME add our proprities
235 return base.GetHashCode();
238 public new void Select()
240 base.Select ();
243 //Compact Framework
244 [MonoTODO]
245 public override string ToString()
247 throw new NotImplementedException ();
251 // --- Public Events
253 public event EventHandler AutoSizeChanged; // {
254 // add {
255 // throw new NotImplementedException ();
256 // }
257 // remove {
258 // throw new NotImplementedException ();
259 // }
260 // }
262 public event EventHandler TextAlignChanged; // {
263 // add {
264 // throw new NotImplementedException ();
265 // }
266 // remove {
267 // throw new NotImplementedException ();
268 // }
269 // }
272 // --- Protected Methods
274 [MonoTODO]
275 protected Rectangle CalcImageRenderBounds (
276 Image image, Rectangle rect, ContentAlignment align)
278 throw new NotImplementedException ();
281 // [MonoTODO]
282 // protected override AccessibleObject CreateAccessibilityInstance()
283 // {
284 // throw new NotImplementedException ();
285 // }
287 protected new virtual void Dispose()
289 //throw new NotImplementedException ();
292 protected override void Dispose(bool disposing)
294 //throw new NotImplementedException ();
297 [MonoTODO]
298 protected void DrawImage (Graphics g, Image img,
299 Rectangle r, ContentAlignment align)
301 throw new NotImplementedException ();
304 protected virtual void OnAutoSizeChanged (EventArgs e) {
305 if (AutoSizeChanged != null)
306 AutoSizeChanged (this, e);
310 protected override void OnEnabledChanged (EventArgs e)
312 base.OnEnabledChanged (e);
315 protected override void OnFontChanged (EventArgs e)
317 base.OnFontChanged (e);
320 protected override void OnPaint (PaintEventArgs e)
325 //Compact Framework
326 protected override void OnParentChanged (EventArgs e)
328 base.OnParentChanged (e);
331 protected virtual void OnTextAlignChanged (EventArgs e) {
332 if (TextAlignChanged != null)
333 TextAlignChanged (this, e);
336 //Compact Framework
337 protected override void OnTextChanged (EventArgs e) {
338 base.OnTextChanged (e);
341 protected override void OnVisibleChanged (EventArgs e)
343 base.OnVisibleChanged (e);
346 protected override bool ProcessMnemonic(char charCode)
348 return base.ProcessMnemonic (charCode);
351 [MonoTODO]
352 protected new ContentAlignment RtlTranslateAlignment (
353 ContentAlignment alignment)
355 throw new NotImplementedException ();
358 [MonoTODO]
359 protected new HorizontalAlignment RtlTranslateAlignment (
360 HorizontalAlignment alignment)
362 throw new NotImplementedException ();
365 [MonoTODO]
366 protected new LeftRightAlignment RtlTranslateAlignment (
367 LeftRightAlignment align)
369 throw new NotImplementedException ();
372 [MonoTODO]
373 protected new virtual void Select (bool directed, bool forward)
375 throw new NotImplementedException ();
378 protected override void SetBoundsCore (
379 int x, int y, int width, int height,
380 BoundsSpecified specified)
382 base.SetBoundsCore (x, y, width, height, specified);
385 protected new void UpdateBounds()
387 base.UpdateBounds ();
390 protected new void UpdateBounds (int x, int y,
391 int width, int height)
393 base.UpdateBounds (x, y, width, height);
397 protected new void UpdateBounds (int x, int y, int width,
398 int height, int clientWidth,
399 int clientHeight)
401 base.UpdateBounds (x, y, width, height, clientWidth,
402 clientHeight);
405 protected override void WndProc(ref Message m)
407 base.WndProc (ref m);