2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / CheckBox.cs
index d54093872c5506c553d2351d41d5743d23785482..5d7691b535660ef0406db6de496d96bc0038d7ed 100644 (file)
 //     Dennis Hayes    dennish@raytek.com
 //     Peter Bartok    pbartok@novell.com
 //
-//
-// $Log: CheckBox.cs,v $
-// Revision 1.10  2004/10/15 13:32:45  ravindra
-//     - Renamed Paint() method to Draw() for clarity. Also, moved
-//     DrawImage() to OnPaint().
-//
-// Revision 1.9  2004/10/15 13:25:50  ravindra
-//     - Removed Redraw (), we get it from ButtonBase.
-//     - Implemented Paint (), to do class specific painting.
-//
-// Revision 1.8  2004/10/13 02:46:22  pbartok
-// - Fix from John BouAntoun: Now properly sets the Appearance property
-//
-// Revision 1.7  2004/09/28 18:44:25  pbartok
-// - Streamlined Theme interfaces:
-//   * Each DrawXXX method for a control now is passed the object for the
-//     control to be drawn in order to allow accessing any state the theme
-//     might require
-//
-//   * ControlPaint methods for the theme now have a CP prefix to avoid
-//     name clashes with the Draw methods for controls
-//
-//   * Every control now retrieves it's DefaultSize from the current theme
-//
-// Revision 1.6  2004/09/01 20:01:24  pbartok
-// - Added missing default
-// - Added missing region mark
-//
-// Revision 1.5  2004/09/01 01:55:58  pbartok
-// - Fixed to match the removal of the needs_redraw concept
-//
-// Revision 1.4  2004/08/31 18:48:31  pbartok
-// - Finished (famous last words)
-//
-// Revision 1.3  2004/08/30 20:42:26  pbartok
-// - Implemented CheckBox drawing code
-//
-// Revision 1.2  2004/08/30 15:44:20  pbartok
-// - Updated to fix broken build. Not complete yet.
-//
-// Revision 1.1  2004/07/09 05:21:25  pbartok
-// - Initial check-in
-//
-//
 
 // COMPLETE
 
 using System;
+using System.ComponentModel;
 using System.Drawing;
 
 namespace System.Windows.Forms {
+       [DefaultProperty("Checked")]
+       [DefaultEvent("CheckedChanged")]
        public class CheckBox : ButtonBase {
                #region Local Variables
                internal Appearance             appearance;
                internal bool                   auto_check;
                internal ContentAlignment       check_alignment;
-               internal ContentAlignment       text_alignment;
                internal CheckState             check_state;
                internal bool                   three_state;
                #endregion      // Local Variables
@@ -94,7 +52,22 @@ namespace System.Windows.Forms {
                }
                #endregion      // Public Constructors
 
+               #region Internal Methods
+               internal override void Draw (PaintEventArgs pe) {
+                       if (redraw) {
+                               ThemeEngine.Current.DrawCheckBox (this.DeviceContext, this.ClientRectangle, this);
+                               redraw = false;
+                       }
+               }
+
+               internal override void HaveDoubleClick() {
+                       if (DoubleClick != null) DoubleClick(this, EventArgs.Empty);
+               }
+               #endregion      // Internal Methods
+
                #region Public Instance Properties
+               [DefaultValue(Appearance.Normal)]
+               [Localizable(true)]
                public Appearance Appearance {
                        get {
                                return appearance;
@@ -111,6 +84,7 @@ namespace System.Windows.Forms {
                        }
                }
 
+               [DefaultValue(true)]
                public bool AutoCheck {
                        get {
                                return auto_check;
@@ -121,6 +95,9 @@ namespace System.Windows.Forms {
                        }
                }
 
+               [Bindable(true)]
+               [Localizable(true)]
+               [DefaultValue(ContentAlignment.MiddleLeft)]
                public ContentAlignment CheckAlign {
                        get {
                                return check_alignment;
@@ -135,6 +112,9 @@ namespace System.Windows.Forms {
                        }
                }
 
+               [Bindable(true)]
+               [RefreshProperties(RefreshProperties.All)]
+               [DefaultValue(false)]
                public bool Checked {
                        get {
                                if (check_state != CheckState.Unchecked) {
@@ -156,6 +136,9 @@ namespace System.Windows.Forms {
                        }
                }
 
+               [DefaultValue(CheckState.Unchecked)]
+               [RefreshProperties(RefreshProperties.All)]
+               [Bindable(true)]
                public CheckState CheckState {
                        get {
                                return check_state;
@@ -177,6 +160,8 @@ namespace System.Windows.Forms {
                        }
                }
 
+               [DefaultValue(ContentAlignment.MiddleLeft)]
+               [Localizable(true)]
                public override ContentAlignment TextAlign {
                        get {
                                return text_alignment;
@@ -191,6 +176,7 @@ namespace System.Windows.Forms {
                }
 
 
+               [DefaultValue(false)]
                public bool ThreeState {
                        get {
                                return three_state;
@@ -289,13 +275,10 @@ namespace System.Windows.Forms {
                public event EventHandler       CheckStateChanged;
                #endregion      // Events
 
-               #region Internal drawing code
-               internal override void Draw (PaintEventArgs pe) {
-                       if (redraw) {
-                               ThemeEngine.Current.DrawCheckBox (this.DeviceContext, this.ClientRectangle, this);
-                               redraw = false;
-                       }
-               }
-               #endregion      // Internal drawing code
+               #region Events
+               [Browsable(false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler DoubleClick;
+               #endregion      // Events
        }
 }