From: jpbruyere Date: Thu, 25 Feb 2016 09:35:40 +0000 (+0100) Subject: use boolean state as svg sub-image in templated controls, solve initial state problem... X-Git-Tag: v0.4~125 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=f927821fd5678a29e6272c7ad4bd95e11957188b;p=jp%2Fcrow.git use boolean state as svg sub-image in templated controls, solve initial state problem with propertyless bindings --- diff --git a/Images/Icons/checkbox.svg b/Images/Icons/checkbox.svg index 0aa8706c..6b6914ae 100644 --- a/Images/Icons/checkbox.svg +++ b/Images/Icons/checkbox.svg @@ -1,46 +1,17 @@ - - + id="svg2" + viewBox="0 0 64 64" + height="64" + width="64"> - @@ -54,29 +25,27 @@ + id="False"> + width="50.832325" + height="50.832325" + x="7.1542463" + y="10.990663" /> + id="True"> + width="50.832333" + height="50.832333" + x="7.1542463" + y="10.990663" /> + id="checkmark" /> diff --git a/Images/Icons/expandable.svg b/Images/Icons/expandable.svg index 43fb3ebc..f8ceb322 100644 --- a/Images/Icons/expandable.svg +++ b/Images/Icons/expandable.svg @@ -1,42 +1,17 @@ - - + id="svg2" + viewBox="0 0 64 64.000002" + height="64" + width="64"> - @@ -50,40 +25,37 @@ + id="False"> + width="55.122551" + height="55.122551" + x="4.4468598" + y="4.3914709" + ry="8.8907347" /> + id="path4177" /> + id="path4181" /> + id="True"> + x="4.4468598" + height="55.122551" + width="55.122551" + id="rect4190" + style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:8.89073467;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1" /> + d="m 12.448521,31.952746 39.119231,0" + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:8.89073467;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/Images/Icons/radiobutton.svg b/Images/Icons/radiobutton.svg index 226d097b..b102b3e1 100644 --- a/Images/Icons/radiobutton.svg +++ b/Images/Icons/radiobutton.svg @@ -1,30 +1,48 @@ + viewBox="0 0 64 64" + version="1.1"> + + + + image/svg+xml + + + + + + + id="True"> - + + cx="32" + 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" /> + cy="32" + r="30" /> diff --git a/Templates/CheckBox.goml b/Templates/CheckBox.goml index 0e55491f..ac4803ed 100755 --- a/Templates/CheckBox.goml +++ b/Templates/CheckBox.goml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Templates/Expandable.goml b/Templates/Expandable.goml index 6757fb68..2364eeb5 100755 --- a/Templates/Expandable.goml +++ b/Templates/Expandable.goml @@ -3,7 +3,7 @@ MouseClick="../onMouseClick"> - + - + \ No newline at end of file diff --git a/Templates/RadioButton.goml b/Templates/RadioButton.goml index b69331be..c44cc1f5 100755 --- a/Templates/RadioButton.goml +++ b/Templates/RadioButton.goml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/Interfaces/testCheckbox.goml b/Tests/Interfaces/testCheckbox.goml index c22a75f8..f1af1b39 100755 --- a/Tests/Interfaces/testCheckbox.goml +++ b/Tests/Interfaces/testCheckbox.goml @@ -1,9 +1,9 @@  + + diff --git a/src/GraphicObjects/CheckBox.cs b/src/GraphicObjects/CheckBox.cs index 74e4bd7c..fa37c70c 100644 --- a/src/GraphicObjects/CheckBox.cs +++ b/src/GraphicObjects/CheckBox.cs @@ -56,16 +56,17 @@ namespace Crow get { return isChecked; } set { + if (isChecked == value) + return; + isChecked = value; NotifyValueChanged ("IsChecked", value); - if (isChecked) { - NotifyValueChanged ("SvgSub", "checked"); + + if (isChecked) Checked.Raise (this, null); - } else { - NotifyValueChanged ("SvgSub", "unchecked"); + else Unchecked.Raise (this, null); - } } } public override void onMouseClick (object sender, MouseButtonEventArgs e) diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index 4214ed93..be4018c9 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -88,16 +88,16 @@ namespace Crow get { return _isExpanded; } set { + if (value == _isExpanded) + return; + _isExpanded = value; + NotifyValueChanged ("IsExpanded", _isExpanded); - if (_isExpanded) { + if (_isExpanded) onExpand (this, null); - NotifyValueChanged ("SvgSub", "expanded"); - return; - } - - onCollapse (this, null); - NotifyValueChanged ("SvgSub", "collapsed"); + else + onCollapse (this, null); } } #endregion diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index c99b0889..be19818f 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -151,16 +151,17 @@ namespace Crow get { return _isPopped; } set { + if (value == _isPopped) + return; + _isPopped = value; + NotifyValueChanged ("IsPopped", _isPopped); - if (_isPopped) { + if (_isPopped) onPop (this, null); - NotifyValueChanged ("SvgSub", "expanded"); - return; - } - - onUnpop (this, null); - NotifyValueChanged ("SvgSub", "collapsed"); + else + onUnpop (this, null); + } } Alignment popDirection; diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs index 4fd45c58..6ca636b1 100644 --- a/src/GraphicObjects/RadioButton.cs +++ b/src/GraphicObjects/RadioButton.cs @@ -61,13 +61,11 @@ namespace Crow isChecked = value; NotifyValueChanged ("IsChecked", value); - if (isChecked) { - NotifyValueChanged ("SvgSub", "checked"); + + if (isChecked) Checked.Raise (this, null); - } else { - NotifyValueChanged ("SvgSub", "unchecked"); + else Unchecked.Raise (this, null); - } } }