]> O.S.I.I.S - jp/crow.git/commitdiff
expandable image visibility <= Expandable.HasContent property
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 15:56:39 +0000 (16:56 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 15:56:39 +0000 (16:56 +0100)
Templates/Expandable.goml
Tests/Interfaces/testExpandable.goml
src/GraphicObjects/Expandable.cs

index 2364eeb5b796ba7c82e752f77a9cf48613412b9d..0174aa6da8247e66e24cece96bacb827965ac462 100755 (executable)
@@ -3,7 +3,10 @@
                MouseClick="../onMouseClick">
        <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
                <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}">
-                       <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../IsExpanded}"/>
+                       <Image Margin="2" Width="12" Height="12"
+                               Visible="{../../../../HasContent}"
+                               Path="{../../../../Image}" 
+                               SvgSub="{../../../../IsExpanded}"/>
                        <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
                </HorizontalStack>
                <Container Name="Content" Visible="false"
index 1a61085b41491019690d1dc965555bf10f4f26f2..60433b252eae22a185b21cace014fa4e51e0622d 100755 (executable)
@@ -1,13 +1,13 @@
 <?xml version="1.0"?>
 <Expandable Fit="true" Caption="Test expandable" Background="DimGray">
-               <VerticalStack Margin="5" Background="Green" Fit="true">
+<!--           <VerticalStack Margin="5" Background="Green" Fit="true">
                        <CheckBox Name="chk1" Background="Red" Fit="true"/>
                        <CheckBox Name="chk2" IsChecked="true" Fit="true"/>
                        <CheckBox Name="chk3" Fit="true"/>
                        <CheckBox Name="chk4" Fit="true"/>
-<!--                   <HorizontalStack Fit="true" Margin="2" Background="Blue">
+                       <HorizontalStack Fit="true" Margin="2" Background="Blue">
                                <Label Name="captionFps" Text="Fps:" Width="30" TextAlignment="Right"/>
                                <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="-1" TextAlignment="Center" Background="AoEnglish"/>
-                       </HorizontalStack>-->
-               </VerticalStack>
+                       </HorizontalStack>
+               </VerticalStack>-->
 </Expandable>
index 3593bf9020b8f113fef9d3f1536a37d08f9a7543..16b3e9749e86cf3b98bab2ac9d74eb4f8ac0884f 100644 (file)
@@ -41,6 +41,7 @@ namespace Crow
                        }
                        set {
                                _contentContainer.SetChild(value);
+                               NotifyValueChanged ("HasContent", HasContent);
                        }
                }
                protected override void loadTemplate(GraphicObject template = null)
@@ -85,8 +86,12 @@ namespace Crow
             {
                                if (value == _isExpanded)
                                        return;
-                               
+
                                _isExpanded = value;
+
+                               if (!HasContent)
+                                       _isExpanded = false;
+
                                NotifyValueChanged ("IsExpanded", _isExpanded);
 
                                if (_isExpanded)
@@ -95,6 +100,10 @@ namespace Crow
                                        onCollapse (this, null);
             }
         }
+               [XmlIgnore]public bool HasContent {
+                       get { return _contentContainer == null ? false : _contentContainer.Child != null; }
+               }
+
                #endregion
 
                public virtual void onExpand(object sender, EventArgs e)