aboutsummaryrefslogtreecommitdiffstatsci
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
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
-rw-r--r--Images/Icons/radiobutton.svg77
-rwxr-xr-xTemplates/Checkbox.goml6
-rwxr-xr-xTemplates/Expandable.goml4
-rwxr-xr-xTemplates/Popper.goml2
-rwxr-xr-xTemplates/RadioButton.goml6
-rw-r--r--Tests/GOLIBTests.cs24
-rwxr-xr-xTests/Interfaces/test1.3.goml14
-rwxr-xr-xTests/Interfaces/test4.1.goml12
-rwxr-xr-xTests/Interfaces/test7.goml (renamed from Tests/Interfaces/Checkbox.goml)8
-rwxr-xr-xTests/Interfaces/testCheckbox.goml3
-rwxr-xr-xTests/Interfaces/testRadioButton.goml8
-rw-r--r--Tests/Tests.csproj14
-rw-r--r--src/GraphicObjects/Checkbox.cs85
-rw-r--r--src/GraphicObjects/Expandable.cs21
-rw-r--r--src/GraphicObjects/Popper.cs28
-rw-r--r--src/GraphicObjects/RadioButton.cs75
16 files changed, 175 insertions, 212 deletions
diff --git a/Images/Icons/radiobutton.svg b/Images/Icons/radiobutton.svg
index d0f81c5d..226d097b 100644
--- a/Images/Icons/radiobutton.svg
+++ b/Images/Icons/radiobutton.svg
@@ -1,77 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="64"
- height="64"
- viewBox="0 0 63.999998 63.999998"
- id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="radiobutton.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="3.9209764"
- inkscape:cx="36.635416"
- inkscape:cy="25.879033"
- inkscape:document-units="px"
- inkscape:current-layer="svg2"
- showgrid="false"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0"
- units="px"
- inkscape:window-width="1280"
- inkscape:window-height="984"
- inkscape:window-x="0"
- inkscape:window-y="16"
- inkscape:window-maximized="1" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
- </cc:Work>
- </rdf:RDF>
- </metadata>
+ viewBox="0 0 64 64"
+ height="64"
+ width="64">
<g
id="checked">
<circle
- r="27.214607"
- cy="35.563198"
- cx="32.071087"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1"
id="path4166"
- style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" />
+ cx="32"
+ cy="32"
+ r="30" />
<circle
- r="20.677874"
- cy="35.563194"
- cx="32.071083"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1"
id="path4166-1"
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" />
+ cx="32"
+ cy="32"
+ r="22" />
</g>
<circle
- style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1"
+ r="30"
+ cy="32"
+ cx="32"
id="unchecked"
- cx="32.071083"
- cy="35.563194"
- r="27.214603" />
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.99999952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" />
</svg>
diff --git a/Templates/Checkbox.goml b/Templates/Checkbox.goml
index b37b15f1..10ec033f 100755
--- a/Templates/Checkbox.goml
+++ b/Templates/Checkbox.goml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<HorizontalStack Width="{Width}" Height="{Height}" Margin="0" Spacing="1">
- <Image Name="Image" Width="16" Height="16" Path="#go.Images.Icons.checkbox.svg"/>
- <Label Name="Caption" Height="{Height}" Width="-1"/>
+<HorizontalStack Spacing="1" Height="-1" Width="0">
+ <Image Margin="2" Width="14" Height="14" Path="{Image}" SvgSub="{SvgSub}"/>
+ <Label Text="{Caption}" Width="0"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Templates/Expandable.goml b/Templates/Expandable.goml
index 877fcdff..79544dbe 100755
--- a/Templates/Expandable.goml
+++ b/Templates/Expandable.goml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Border BorderWidth="1" BorderColor="LightGray" Height="-1" Width="0" MouseClick="onMouseClick">
- <VerticalStack Height="-1" Width="0" Name="vsTemplateExpander">
- <HorizontalStack Spacing="1" Focusable="false" Height="-1" Width="0">
+ <VerticalStack Height="-1" Width="0">
+ <HorizontalStack Spacing="1" Height="-1" Width="0">
<Image Margin="2" Width="12" Height="12" Path="{Image}" SvgSub="{SvgSub}"/>
<Label Text="{Title}" Width="0"/>
</HorizontalStack>
diff --git a/Templates/Popper.goml b/Templates/Popper.goml
index 27dd8c8d..a935404f 100755
--- a/Templates/Popper.goml
+++ b/Templates/Popper.goml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<Border BorderWidth="1" BorderColor="LightGray" Height="-1" MouseClick="onMouseClick">
- <HorizontalStack Spacing="1" Focusable="false" Height="-1" Width="0">
+ <HorizontalStack Spacing="1" Height="-1" >
<Image Margin="2" Width="12" Height="12" Path="{Image}" SvgSub="{SvgSub}"/>
<Label Text="{Title}" Width="0"/>
</HorizontalStack>
diff --git a/Templates/RadioButton.goml b/Templates/RadioButton.goml
index ac52ea75..10ec033f 100755
--- a/Templates/RadioButton.goml
+++ b/Templates/RadioButton.goml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<HorizontalStack Width="{Width}" Height="{Height}" Margin="0" Spacing="1">
- <Image Name="Image" Width="12" Height="12" Path="#go.Images.Icons.radiobutton.svg"/>
- <Label Name="Caption" Height="{Height}" Width="-1"/>
+<HorizontalStack Spacing="1" Height="-1" Width="0">
+ <Image Margin="2" Width="14" Height="14" Path="{Image}" SvgSub="{SvgSub}"/>
+ <Label Text="{Caption}" Width="0"/>
</HorizontalStack> \ No newline at end of file
diff --git a/Tests/GOLIBTests.cs b/Tests/GOLIBTests.cs
index 6dd1909b..2f8eb036 100644
--- a/Tests/GOLIBTests.cs
+++ b/Tests/GOLIBTests.cs
@@ -31,27 +31,29 @@ namespace test
int frameCpt = 0;
int idx = 0;
string[] testFiles = {
- "testPopper.goml",
- "testExpandable.goml",
- "test6.goml",
- "testHStack.goml",
- "testMsgBox.goml",
- "testLabel.goml",
- "testGrid.goml",
"test1.goml",
"test1.1.goml",
"test1.2.goml",
- "test1.3.goml",
- "test2.goml",
+ "testLabel.goml",
"testContainer.goml",
- "test_stack.goml",
- "testScrollbar.goml",
+ "testCheckbox.goml",
+ "testRadioButton.goml",
"testSpinner.goml",
+ "testPopper.goml",
+ "testExpandable.goml",
"testWindow.goml",
+ "testMsgBox.goml",
+ "testGrid.goml",
"fps.goml",
"testMeter.goml",
+ "test6.goml",
+ "testHStack.goml",
+ "test2.goml",
+ "test_stack.goml",
+ "testScrollbar.goml",
"test3.goml",
"test4.1.goml",
+ "test7.goml",
};
#region FPS
diff --git a/Tests/Interfaces/test1.3.goml b/Tests/Interfaces/test1.3.goml
deleted file mode 100755
index c6fffe4e..00000000
--- a/Tests/Interfaces/test1.3.goml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<Container Name="MainMenu"
- Margin="30" Focusable="True" Height="-1" Width="300">
- <Border BorderWidth="1" Margin="40" Background="0,5;0,5;0,5;0,5">
- <VerticalStack WidgetSpacing="10">
- <Button Margin = "10" Text="Start New Game" Height="-1" Width="0"
- MouseClick="onStartNewGame"/>
- <Button Margin = "10" Text="Start New Game" Height="-1" Width="0"/>
- <Button Margin = "10" Text="Start New Game" Height="-1" Width="0"/>
- <Button Margin = "10" Text="Exit" Height="-1" Width="0"
- MouseClick="onButExit_MouseClick" />
- </VerticalStack>
- </Border>
-</Container> \ No newline at end of file
diff --git a/Tests/Interfaces/test4.1.goml b/Tests/Interfaces/test4.1.goml
index a0360eda..bf8dd688 100755
--- a/Tests/Interfaces/test4.1.goml
+++ b/Tests/Interfaces/test4.1.goml
@@ -9,14 +9,14 @@
MouseEnter="{BorderColor = White}"
MouseLeave="{BorderColor = Transparent}">
- <HorizontalStack Name="hs0"
+ <HorizontalStack Name="hs0" Fit="true"
WidgetSpacing="10"
VerticalAlignment="Center"
Background="0,5;0,5;0,5;0,5">
<VerticalStack Name="vs1"
- Margin="20" Width="400">
+ Margin="20" Width="400" Height="-1">
<Label Name="labMouse" Text="MousePos"/>
- <HorizontalStack Name="hsPbar">
+ <HorizontalStack Name="hsPbar" Fit="true">
<ProgressBar Name="pbBar"
Width="100" Height="20"
Value="50"
@@ -29,15 +29,15 @@
Width="100" Height="10"
Value="30"/>-->
</HorizontalStack>
- <HorizontalStack Name="hsFocus">
+ <HorizontalStack Name="hsFocus" Fit="true">
<Label Text="Focused:"/>
<Label Name="labFocus" />
</HorizontalStack>
- <HorizontalStack>
+ <HorizontalStack Fit="true">
<Label Text="Active:" Name="hsActive"/>
<Label Name="labActive"/>
</HorizontalStack>
- <HorizontalStack>
+ <HorizontalStack Fit="true">
<Label Text="Hover:" Name="hsHover"/>
<Label Name="labHover" />
</HorizontalStack>
diff --git a/Tests/Interfaces/Checkbox.goml b/Tests/Interfaces/test7.goml
index 57184eee..97c3d3ee 100755
--- a/Tests/Interfaces/Checkbox.goml
+++ b/Tests/Interfaces/test7.goml
@@ -4,13 +4,13 @@
Top="200" Left="200"
Margin="10" Background="Green"/>-->
<Border CornerRadius="5" Margin="1" BorderWidth="1" Fit="True" Background="SteelBlue">
- <HorizontalStack Name="hstack" Margin="0" Spacing="5">
+ <HorizontalStack Name="hstack" Margin="0" Spacing="5" Fit="True">
<Label Name="labCpt" Text="55"/>
- <VerticalStack Spacing="1" Name="vstack">
- <Button Width="10" Height="8" MouseClick="onUp">
+ <VerticalStack Spacing="1" Name="vstack" Fit="True">
+ <Button Width="10" Height="8" >
<Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="up"/>
</Button>
- <Button Width="10" Height="8" MouseClick="onDown">
+ <Button Width="10" Height="8" >
<Image Margin="1" Path="#go.Images.Icons.updown.svg" SvgSub="down"/>
</Button>
</VerticalStack>
diff --git a/Tests/Interfaces/testCheckbox.goml b/Tests/Interfaces/testCheckbox.goml
new file mode 100755
index 00000000..4a0288cd
--- /dev/null
+++ b/Tests/Interfaces/testCheckbox.goml
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<Checkbox Caption="Checkbox" Background="DimGray"/>
+
diff --git a/Tests/Interfaces/testRadioButton.goml b/Tests/Interfaces/testRadioButton.goml
new file mode 100755
index 00000000..99542dbf
--- /dev/null
+++ b/Tests/Interfaces/testRadioButton.goml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<VerticalStack Width="200" Height="-1" Margin="20" Background="DimGray">
+ <RadioButton Caption="Radio1"/>
+ <RadioButton Caption="Radio2" IsChecked="true"/>
+ <RadioButton Caption="Radio3"/>
+ <RadioButton Caption="Radio4"/>
+</VerticalStack>
+
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index b8a6acc7..210d0c8b 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -83,9 +83,6 @@
<None Include="Interfaces\test4.1.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="Interfaces\test1.3.goml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
<None Include="Interfaces\fps.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -149,6 +146,16 @@
<None Include="Interfaces\testPopper.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\testRadioButton.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\testCheckbox.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\test7.goml">
+ <LogicalName>Tests.Interfaces.test7.goml</LogicalName>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
@@ -162,6 +169,5 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="image\tetra.png" />
- <EmbeddedResource Include="Interfaces\Checkbox.goml" />
</ItemGroup>
</Project>
diff --git a/src/GraphicObjects/Checkbox.cs b/src/GraphicObjects/Checkbox.cs
index 863cae0c..d4deb171 100644
--- a/src/GraphicObjects/Checkbox.cs
+++ b/src/GraphicObjects/Checkbox.cs
@@ -19,51 +19,18 @@ namespace go
[DefaultTemplate("#go.Templates.Checkbox.goml")]
public class Checkbox : TemplatedControl
{
- Label _caption;
- Image _image;
+ string caption;
+ string image;
+ bool isChecked;
+ #region CTOR
public Checkbox() : base()
{
- }
-
- protected override void loadTemplate(GraphicObject template = null)
- {
- base.loadTemplate (template);
-
- _caption = this.child.FindByName ("Caption") as Label;
- _image = this.child.FindByName ("Image") as Image;
- _image.SvgSub = "unchecked";
- }
-
-
- [XmlAttributeAttribute()][DefaultValue("Checkbox")]
- public string Caption {
- get { return _caption == null ? "" : _caption.Text; }
- set {
- if (_caption == null)
- return;
- _caption.Text = value;
- }
- }
- [XmlAttributeAttribute()][DefaultValue(false)]
- public bool IsChecked
- {
- get { return _image == null ? false :_image.SvgSub == "checked"; }
- set
- {
- if (value == IsChecked)
- return;
+ }
+ #endregion
- if (value)
- _image.SvgSub = "checked";
- else
- _image.SvgSub = "unchecked";
-
- NotifyValueChanged("IsChecked", IsChecked);
- //registerForGraphicUpdate();
- }
- }
+ #region GraphicObject overrides
[XmlAttributeAttribute()][DefaultValue(-1)]
public override int Height {
get { return base.Height; }
@@ -75,6 +42,44 @@ namespace go
get { return base.Focusable; }
set { base.Focusable = value; }
}
+ #endregion
+
+ [XmlAttributeAttribute()][DefaultValue("Checkbox")]
+ public string Caption {
+ get { return caption; }
+ set {
+ if (caption == value)
+ return;
+ caption = value;
+ NotifyValueChanged ("Caption", caption);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("#go.Images.Icons.checkbox.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 isChecked; }
+ set
+ {
+ isChecked = value;
+
+ NotifyValueChanged ("IsChecked", value);
+ if (isChecked)
+ NotifyValueChanged ("SvgSub", "checked");
+ else
+ NotifyValueChanged ("SvgSub", "unchecked");
+ }
+ }
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
IsChecked = !IsChecked;
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index c8490cba..f9e81c1a 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -80,30 +80,23 @@ namespace go
image = value;
NotifyValueChanged ("Image", image);
}
- }
- [XmlAttributeAttribute()][DefaultValue("collapsed")]
- public string SvgSub {
- get { return IsExpanded ? "expanded" : "collapsed"; }
- }
-
+ }
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsExpanded
{
get { return _isExpanded; }
set
{
- if (value == _isExpanded)
- return;
-
_isExpanded = value;
- NotifyValueChanged ("SvgSub", SvgSub);
- if (_isExpanded)
+ if (_isExpanded) {
onExpand (this, null);
- else
- onCollapse (this, null);
+ NotifyValueChanged ("SvgSub", "expanded");
+ return;
+ }
- //registerForGraphicUpdate();
+ onCollapse (this, null);
+ NotifyValueChanged ("SvgSub", "collapsed");
}
}
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 41990247..76a12f58 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -69,10 +69,6 @@ namespace go
NotifyValueChanged ("Image", image);
}
}
- [XmlAttributeAttribute()][DefaultValue("collapsed")]
- public string SvgSub {
- get { return IsPopped ? "expanded" : "collapsed"; }
- }
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsPopped
@@ -80,35 +76,39 @@ namespace go
get { return _isPopped; }
set
{
- if (value == _isPopped)
- return;
-
_isPopped = value;
- NotifyValueChanged ("SvgSub", SvgSub);
- if (_isPopped)
+ if (_isPopped) {
onPop (this, null);
- else
- onUnpop (this, null);
+ NotifyValueChanged ("SvgSub", "expanded");
+ return;
+ }
- //registerForGraphicUpdate();
+ onUnpop (this, null);
+ NotifyValueChanged ("SvgSub", "collapsed");
}
}
public virtual void onPop(object sender, EventArgs e)
{
+ IGOLibHost tc = TopContainer;
+ if (tc == null)
+ return;
if (Content != null) {
Rectangle r = this.ScreenCoordinates (this.Slot);
Content.Visible = true;
Content.Left = r.Left;
Content.Top = r.Bottom;
- TopContainer.AddWidget (Content);
+ tc.AddWidget (Content);
}
Pop.Raise (this, e);
}
public virtual void onUnpop(object sender, EventArgs e)
{
- TopContainer.DeleteWidget (Content);
+ IGOLibHost tc = TopContainer;
+ if (tc == null)
+ return;
+ tc.DeleteWidget (Content);
Unpop.Raise (this, e);
}
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);
}