diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 11:52:35 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 11:52:35 +0100 |
| commit | 54ff9d82e0d195bc335916b8a30a27651f830502 (patch) | |
| tree | d950855da5376bc8bf3f079c8000dd192f39bc41 /src/GraphicObjects | |
| parent | dd6682973fa16921b7ebaf5faa416290c3211c63 (diff) | |
DefaultStyle attribute, loaded in defvalues
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/Button.cs | 17 | ||||
| -rw-r--r-- | src/GraphicObjects/CheckBox.cs | 14 | ||||
| -rw-r--r-- | src/GraphicObjects/ComboBox.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/Expandable.cs | 13 | ||||
| -rw-r--r-- | src/GraphicObjects/GroupBox.cs | 10 | ||||
| -rw-r--r-- | src/GraphicObjects/Popper.cs | 9 | ||||
| -rw-r--r-- | src/GraphicObjects/RadioButton.cs | 36 | ||||
| -rw-r--r-- | src/GraphicObjects/Splitter.cs | 3 |
8 files changed, 29 insertions, 74 deletions
diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs index 9903888b..92d19af6 100644 --- a/src/GraphicObjects/Button.cs +++ b/src/GraphicObjects/Button.cs @@ -13,6 +13,7 @@ using System.ComponentModel; namespace Crow { + [DefaultStyle("#Crow.Styles.Button.style")] [DefaultTemplate("#Crow.Templates.Button.crow")] public class Button : TemplatedContainer { @@ -42,22 +43,6 @@ namespace Crow } #region GraphicObject Overrides -// [XmlAttributeAttribute()][DefaultValue(50)] -// public override int Width { -// get { return base.Width; } -// set { base.Width = value; } -// } -// [XmlAttributeAttribute()][DefaultValue(20)] -// public override int Height { -// get { return base.Height; } -// set { base.Height = value; } -// } - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } public override void ResolveBindings () { base.ResolveBindings (); diff --git a/src/GraphicObjects/CheckBox.cs b/src/GraphicObjects/CheckBox.cs index fa37c70c..edf6650b 100644 --- a/src/GraphicObjects/CheckBox.cs +++ b/src/GraphicObjects/CheckBox.cs @@ -5,6 +5,7 @@ using System.Xml.Serialization; namespace Crow { + [DefaultStyle("#Crow.Styles.CheckBox.style")] [DefaultTemplate("#Crow.Templates.CheckBox.goml")] public class CheckBox : TemplatedControl { @@ -14,21 +15,12 @@ namespace Crow #region CTOR public CheckBox() : base() - { - } + {} #endregion public event EventHandler Checked; public event EventHandler Unchecked; - #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue("#Crow.Style.CheckBox.style")] - public override string Style { - get { return base.Style; } - set { base.Style = value; } - } - #endregion - [XmlAttributeAttribute()][DefaultValue("Checkbox")] public string Caption { get { return caption; } @@ -49,7 +41,6 @@ namespace Crow NotifyValueChanged ("Image", image); } } - [XmlAttributeAttribute()][DefaultValue(false)] public bool IsChecked { @@ -69,6 +60,7 @@ namespace Crow Unchecked.Raise (this, null); } } + public override void onMouseClick (object sender, MouseButtonEventArgs e) { IsChecked = !IsChecked; diff --git a/src/GraphicObjects/ComboBox.cs b/src/GraphicObjects/ComboBox.cs index 7b98ca4f..4f948e5b 100644 --- a/src/GraphicObjects/ComboBox.cs +++ b/src/GraphicObjects/ComboBox.cs @@ -2,6 +2,7 @@ namespace Crow { + [DefaultStyle("#Crow.Styles.ComboBox.style")] [DefaultTemplate("#Crow.Templates.ComboBox.goml")] public class ComboBox : ListBox { diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index be4018c9..3593bf90 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -5,6 +5,7 @@ using System.Xml.Serialization; namespace Crow { + [DefaultStyle("#Crow.Styles.Expandable.style")] [DefaultTemplate("#Crow.Templates.Expandable.goml")] public class Expandable : TemplatedContainer { @@ -27,11 +28,10 @@ namespace Crow #endregion #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable + public override void onMouseClick (object sender, MouseButtonEventArgs e) { - get { return base.Focusable; } - set { base.Focusable = value; } + IsExpanded = !IsExpanded; + base.onMouseClick (sender, e); } #endregion @@ -49,11 +49,6 @@ namespace Crow _contentContainer = this.child.FindByName ("Content") as Container; } - public override void onMouseClick (object sender, MouseButtonEventArgs e) - { - IsExpanded = !IsExpanded; - base.onMouseClick (sender, e); - } public override void ResolveBindings () { base.ResolveBindings (); diff --git a/src/GraphicObjects/GroupBox.cs b/src/GraphicObjects/GroupBox.cs index e3001663..86c659d0 100644 --- a/src/GraphicObjects/GroupBox.cs +++ b/src/GraphicObjects/GroupBox.cs @@ -4,6 +4,7 @@ using System.ComponentModel; namespace Crow { + [DefaultStyle("#Crow.Styles.GroupBox.style")] [DefaultTemplate("#Crow.Templates.GroupBox.goml")] public class GroupBox : TemplatedContainer { @@ -31,15 +32,6 @@ namespace Crow } #endregion - #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } - #endregion - [XmlAttributeAttribute()][DefaultValue("Groupbox")] public string Caption { get { return caption; } diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index be19818f..4c5ca11c 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -5,6 +5,7 @@ using OpenTK.Input; namespace Crow { + [DefaultStyle("#Crow.Styles.Popper.style")] [DefaultTemplate("#Crow.Templates.Popper.goml")] public class Popper : TemplatedContainer { @@ -87,12 +88,6 @@ namespace Crow } #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } - } public override void ClearBinding () { //ensure popped window is cleared @@ -119,8 +114,8 @@ namespace Crow } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { - base.onMouseLeave (sender, e); IsPopped = false; + base.onMouseLeave (sender, e); } #endregion diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs index 6ca636b1..4370d157 100644 --- a/src/GraphicObjects/RadioButton.cs +++ b/src/GraphicObjects/RadioButton.cs @@ -5,6 +5,7 @@ using System.Xml.Serialization; namespace Crow { + [DefaultStyle("#Crow.Styles.RadioButton.style")] [DefaultTemplate("#Crow.Templates.RadioButton.goml")] public class RadioButton : TemplatedControl { @@ -20,11 +21,20 @@ namespace Crow public event EventHandler Unchecked; #region GraphicObject overrides - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable - { - get { return base.Focusable; } - set { base.Focusable = value; } + public override void onMouseClick (object sender, MouseButtonEventArgs e) + { + Group pg = Parent as Group; + if (pg != null) { + for (int i = 0; i < pg.Children.Count; i++) { + RadioButton c = pg.Children [i] as RadioButton; + if (c == null) + continue; + c.IsChecked = (c == this); + } + } else + IsChecked = !IsChecked; + + base.onMouseClick (sender, e); } #endregion @@ -68,21 +78,5 @@ namespace Crow Unchecked.Raise (this, null); } } - - public override void onMouseClick (object sender, MouseButtonEventArgs e) - { - Group pg = Parent as Group; - if (pg != null) { - for (int i = 0; i < pg.Children.Count; i++) { - RadioButton c = pg.Children [i] as RadioButton; - if (c == null) - continue; - c.IsChecked = (c == this); - } - } else - IsChecked = !IsChecked; - - base.onMouseClick (sender, e); - } } } diff --git a/src/GraphicObjects/Splitter.cs b/src/GraphicObjects/Splitter.cs index f3fdb341..97cce52c 100644 --- a/src/GraphicObjects/Splitter.cs +++ b/src/GraphicObjects/Splitter.cs @@ -24,7 +24,7 @@ using System.ComponentModel; namespace Crow { - [StyleAttribute("Background", "DimGray")] + [DefaultStyle("#Crow.Styles.Splitter.style")] public class Splitter : GraphicObject { #region CTOR @@ -32,6 +32,7 @@ namespace Crow #endregion int thickness; + [XmlAttributeAttribute()][DefaultValue(1)] public virtual int Thickness { get { return thickness; } |