// Dennis Hayes dennish@raytek.com
// Peter Bartok pbartok@novell.com
//
-//
-// $Log: CheckBox.cs,v $
-// 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
}
#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;
set {
if (value != appearance) {
- value = appearance;
+ appearance = value;
if (AppearanceChanged != null) {
AppearanceChanged(this, EventArgs.Empty);
}
}
}
+ [DefaultValue(true)]
public bool AutoCheck {
get {
return auto_check;
}
}
+ [Bindable(true)]
+ [Localizable(true)]
+ [DefaultValue(ContentAlignment.MiddleLeft)]
public ContentAlignment CheckAlign {
get {
return check_alignment;
}
}
+ [Bindable(true)]
+ [RefreshProperties(RefreshProperties.All)]
+ [DefaultValue(false)]
public bool Checked {
get {
if (check_state != CheckState.Unchecked) {
}
}
+ [DefaultValue(CheckState.Unchecked)]
+ [RefreshProperties(RefreshProperties.All)]
+ [Bindable(true)]
public CheckState CheckState {
get {
return check_state;
}
}
+ [DefaultValue(ContentAlignment.MiddleLeft)]
+ [Localizable(true)]
public override ContentAlignment TextAlign {
get {
return text_alignment;
}
+ [DefaultValue(false)]
public bool ThreeState {
get {
return three_state;
public event EventHandler CheckStateChanged;
#endregion // Events
- #region Internal drawing code
- internal override void Redraw() {\r
- ThemeEngine.Current.DrawCheckBox(this.DeviceContext, this.ClientRectangle, this);
- Refresh();
- }\r
- #endregion // Internal drawing code
+ #region Events
+ [Browsable(false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public event EventHandler DoubleClick;
+ #endregion // Events
}
}