aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/RadioButton.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-14 17:55:46 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-14 17:55:46 +0200
commit01ec9f5a3fa94df22844e22f47cd4853959fe99e (patch)
tree511fd0caf9ff685ddeb24f4dc4ef63b958c2ad8c /src/GraphicObjects/RadioButton.cs
parente568d1381aba02054acd3e267f42d319f161d59e (diff)
* Tests.csproj:
* GOLIBTests.cs: * Popper.goml: * Checkbox.goml: * Expandable.goml: * RadioButton.goml: * test7.goml: * Popper.cs: * test4.1.goml: * test1.3.goml: * Checkbox.cs: * Expandable.cs: * RadioButton.cs: * testCheckbox.goml: * testRadioButton.goml: improve templates, set SvgSub as PropertyLess binding updated with only * radiobutton.svg: simplify svg
Diffstat (limited to 'src/GraphicObjects/RadioButton.cs')
-rw-r--r--src/GraphicObjects/RadioButton.cs75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs
index 245fd2b2..7aa9370c 100644
--- a/src/GraphicObjects/RadioButton.cs
+++ b/src/GraphicObjects/RadioButton.cs
@@ -19,56 +19,62 @@ namespace go
[DefaultTemplate("#go.Templates.RadioButton.goml")]
public class RadioButton : TemplatedControl
{
- Label _caption;
- Image _image;
+ string caption;
+ string image;
+ bool isChecked;
- public RadioButton() : base()
- {
- }
-
- protected override void loadTemplate(GraphicObject template = null)
+ #region CTOR
+ public RadioButton() : base(){}
+ #endregion
+
+ #region GraphicObject overrides
+ [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
+ public override bool Focusable
{
- base.loadTemplate (template);
-
- _caption = this.child.FindByName ("Caption") as Label;//TODO:should use bindings instead
- _image = this.child.FindByName ("Image") as Image;
- _image.SvgSub = "unchecked";
+ get { return base.Focusable; }
+ set { base.Focusable = value; }
}
-
[XmlAttributeAttribute()][DefaultValue(-1)]
public override int Height {
get { return base.Height; }
set { base.Height = value; }
}
- [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
- public override bool Focusable
- {
- get { return base.Focusable; }
- set { base.Focusable = value; }
- }
+ #endregion
- [XmlAttributeAttribute][DefaultValue("RadioButton")]
+ [XmlAttributeAttribute()][DefaultValue("RadioButton")]
public string Caption {
- get { return _caption.Text; }
- set {
- _caption.Text = value;
+ get { return caption; }
+ set {
+ if (caption == value)
+ return;
+ caption = value;
+ NotifyValueChanged ("Caption", caption);
}
- }
+ }
+ [XmlAttributeAttribute()][DefaultValue("#go.Images.Icons.radiobutton.svg")]
+ public string Image {
+ get { return image; }
+ set {
+ if (image == value)
+ return;
+ image = value;
+ NotifyValueChanged ("Image", image);
+ }
+ }
+
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsChecked
{
- get { return _image == null ? false :_image.SvgSub == "checked"; }
+ get { return isChecked; }
set
{
-// if (value == IsChecked)
-// return;
-//
- if (value)
- _image.SvgSub = "checked";
+ isChecked = value;
+
+ NotifyValueChanged ("IsChecked", value);
+ if (isChecked)
+ NotifyValueChanged ("SvgSub", "checked");
else
- _image.SvgSub = "unchecked";
-
- registerForGraphicUpdate();
+ NotifyValueChanged ("SvgSub", "unchecked");
}
}
@@ -78,7 +84,8 @@ namespace go
if (pg != null) {
foreach (RadioButton c in pg.Children.OfType<RadioButton>())
c.IsChecked = (c == this);
- }
+ } else
+ IsChecked = !IsChecked;
base.onMouseClick (sender, e);
}