]> O.S.I.I.S - jp/crow.git/commitdiff
use boolean state as svg sub-image in templated controls, solve initial state problem...
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 09:35:40 +0000 (10:35 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 09:35:40 +0000 (10:35 +0100)
12 files changed:
Images/Icons/checkbox.svg
Images/Icons/expandable.svg
Images/Icons/radiobutton.svg
Templates/CheckBox.goml
Templates/Expandable.goml
Templates/Popper.goml
Templates/RadioButton.goml
Tests/Interfaces/testCheckbox.goml
src/GraphicObjects/CheckBox.cs
src/GraphicObjects/Expandable.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/RadioButton.cs

index 0aa8706c5028860d25bfdef54a748cedbc70985b..6b6914aec6a324f42af287581f762d1f1877fb39 100644 (file)
@@ -1,46 +1,17 @@
 <?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="checkbox.svg">
+   id="svg2"
+   viewBox="0 0 64 64"
+   height="64"
+   width="64">
   <defs
      id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="7.8419528"
-     inkscape:cx="21.02804"
-     inkscape:cy="45.98576"
-     inkscape:document-units="px"
-     inkscape:current-layer="checked"
-     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>
     </rdf:RDF>
   </metadata>
   <g
-     id="unchecked">
+     id="False">
     <rect
-       y="10.990663"
-       x="7.1542463"
-       height="50.832325"
-       width="50.832325"
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
        id="background-0"
-       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+       width="50.832325"
+       height="50.832325"
+       x="7.1542463"
+       y="10.990663" />
   </g>
   <g
-     id="checked">
+     id="True">
     <rect
-       y="10.990663"
-       x="7.1542463"
-       height="50.832333"
-       width="50.832333"
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
        id="background"
-       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.38882232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+       width="50.832333"
+       height="50.832333"
+       x="7.1542463"
+       y="10.990663" />
     <path
-       sodipodi:nodetypes="ccccc"
-       inkscape:connector-curvature="0"
-       id="checkmark"
+       style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
        d="m 31.716712,35.071243 c 0,0 -6.596639,-15.24725 -21.446849,-19.472822 C 28.252789,42.42005 32.673128,59.741754 32.673128,59.741754 42.630927,26.54013 47.25986,13.972168 62.050847,1.147331 42.892384,10.522281 37.883684,17.76245 31.716712,35.071243 Z"
-       style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
+       id="checkmark" />
   </g>
 </svg>
index 43fb3ebc2628b877cc1fda733bff3df77f8e9ada..f8ceb32243536f84ed2b6a24feedaf8bd8831494 100644 (file)
@@ -1,42 +1,17 @@
 <?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 64 64.000002"
-   id="svg2"
    version="1.1"
-   inkscape:version="0.91 r13725"
-   sodipodi:docname="expandable.svg">
+   id="svg2"
+   viewBox="0 0 64 64.000002"
+   height="64"
+   width="64">
   <defs
      id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="6.6713043"
-     inkscape:cx="34.688233"
-     inkscape:cy="18.992144"
-     inkscape:document-units="px"
-     inkscape:current-layer="svg2"
-     showgrid="false"
-     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>
     </rdf:RDF>
   </metadata>
   <g
-     id="collapsed">
+     id="False">
     <rect
-       ry="8.8907347"
-       y="4.3914709"
-       x="4.4468598"
-       height="55.122551"
-       width="55.122551"
+       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"
        id="rect4136"
-       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" />
+       width="55.122551"
+       height="55.122551"
+       x="4.4468598"
+       y="4.3914709"
+       ry="8.8907347" />
     <path
-       inkscape:connector-curvature="0"
-       id="path4177"
+       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"
        d="m 32.008136,12.393132 0,39.11923"
-       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" />
+       id="path4177" />
     <path
-       inkscape:connector-curvature="0"
-       id="path4181"
+       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"
        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" />
+       id="path4181" />
   </g>
   <g
-     id="expanded">
+     id="True">
     <rect
-       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"
-       id="rect4190"
-       width="55.122551"
-       height="55.122551"
-       x="4.4468598"
+       ry="8.8907347"
        y="4.3914709"
-       ry="8.8907347" />
+       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" />
     <path
-       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"
-       d="m 12.448521,31.952746 39.119231,0"
        id="path4194"
-       inkscape:connector-curvature="0" />
+       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" />
   </g>
 </svg>
index 226d097b08ab3eb14270a5d34760628a9bbb0609..b102b3e18cc807b8eac36d0b6f11061d3856bd00 100644 (file)
@@ -1,30 +1,48 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <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"
-   version="1.1"
-   viewBox="0 0 64 64"
+   id="svg2"
+   width="64"
    height="64"
-   width="64">
+   viewBox="0 0 64 64"
+   version="1.1">
+  <metadata
+     id="metadata12">
+    <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></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs10" />
   <g
-     id="checked">
+     id="True">
     <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"
-       id="path4166"
-       cx="32"
+       r="30"
        cy="32"
-       r="30" />
-    <circle
-       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"
        cx="32"
+       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" />
+    <circle
+       r="22"
        cy="32"
-       r="22" />
+       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" />
   </g>
   <circle
-     r="30"
-     cy="32"
+     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="False"
      cx="32"
-     id="unchecked"
-     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" />
+     cy="32"
+     r="30" />
 </svg>
index 0e55491fe9c4032bd47f56287c6f4480d0f64db3..ac4803ed3c07497d698fea8ff73ebe3b273cb874 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <HorizontalStack Margin="1" Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
-       <Image Margin="2" Width="14"  Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+       <Image Margin="2" Width="14"  Height="14" Path="{../../Image}" SvgSub="{../../IsChecked}"/>
        <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </HorizontalStack>
\ No newline at end of file
index 6757fb68949e46558fe5cd26787775f16620fe61..2364eeb5b796ba7c82e752f77a9cf48613412b9d 100755 (executable)
@@ -3,7 +3,7 @@
                MouseClick="../onMouseClick">
        <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">
-                       <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
+                       <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../IsExpanded}"/>
                        <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
                </HorizontalStack>
                <Container Name="Content" Visible="false"
index 9fd80681d9dbb6cc956cf9f0367ee2978282b00b..52a4f9e173d8bf2148a26fa71d9593abafec4f00 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <Border BorderWidth="1" Foreground="LightGray" Height="-1" Width="{../WidthPolicy}">
        <HorizontalStack Spacing="1" Height="-1"  Width="{../../WidthPolicy}">
-               <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../SvgSub}"/>
+               <Image Margin="2" Width="12" Height="12" Path="{../../../Image}" SvgSub="{../../../IsPopped}"/>
                <Label Text="{../../../Caption}"  Width="{../../../WidthPolicy}"/>
        </HorizontalStack>
 </Border>
\ No newline at end of file
index b69331bec592fb7a32aa95d062d7ac1bcb058aa2..c44cc1f52ab879a91ebb8b2eae742cc4c687447d 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <HorizontalStack Spacing="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
-       <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
+       <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../IsChecked}"/>
        <Label Text="{../../Caption}" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </HorizontalStack>
\ No newline at end of file
index c22a75f808074e4bb552a693093efc9ec7b4779b..f1af1b39b91bf9ec331c7bfabebbfbda32efeec6 100755 (executable)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <VerticalStack  Margin="10" Background="DimGray" Style="test">
+       <CheckBox IsChecked="true"/>
        <CheckBox Background="Gray"/>
+<!--   <CheckBox Background="Gray"/>
        <CheckBox Background="Gray"/>
-       <CheckBox Background="Gray"/>
-       <CheckBox Background="Gray"/>
-       <CheckBox Background="Gray"/>
+       <CheckBox Background="Gray"/>-->
 </VerticalStack>
 
index 74e4bd7c4f7ea8ba2fad97a013933d97709d0c9e..fa37c70c8e12d6d15e8845e8919a749f835d8a7a 100644 (file)
@@ -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)
index 4214ed93a65cbc037b3de9c45809316638094d57..be4018c92a9eae2b4095983ecc4ba0b47e5b4446 100644 (file)
@@ -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
index c99b088932e114e5881648cfa0531f7596ccd2fa..be19818f19c93fd3e7fde284619c9203f09152b3 100644 (file)
@@ -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;
index 4fd45c58e408e9f61134a5b505aff2685a0b6d11..6ca636b15edbdf8587f48bc83e17e0e079b55ffc 100644 (file)
@@ -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);
-                               }
             }
         }