]> O.S.I.I.S - jp/crow.git/commitdiff
adjust spinner properties, compute proportion in Double precision
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 19 Apr 2016 16:22:27 +0000 (18:22 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 19 Apr 2016 16:22:27 +0000 (18:22 +0200)
Templates/Spinner.goml
Tests/Interfaces/testSpinner.goml
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Scroller.cs

index c7b5cfb9ecdc988946028e350320739ecbb21d6e..039861750994d6d0a1412771ac4f2d1df201e30c 100755 (executable)
@@ -1,11 +1,11 @@
 <?xml version="1.0"?>
-<HorizontalStack Name="hstack" Margin="0" Spacing="0" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+<HorizontalStack MinimumSize="40;10" Name="hstack" Margin="0" Spacing="0" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
        <Border BorderWidth="1" Height="{../../HeightPolicy}" Width="80%"  Background="White" 
                Foreground="DimGray" Margin="0">
                <Label Foreground="DimGray" Height="{../../../HeightPolicy}" Width="Stretched"
                        Text="{../../../Value}" TextAlignment="Right" Margin="0"/>
        </Border>
-       <VerticalStack Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
+       <VerticalStack MinimumSize="8;10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
                <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="../../../onUp"
                        Template="#Crow.Templates.ArrowButTemplate.crow">
                        <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="up" Margin="0"/>
index 224900af9a800b39da8308487f680c10e1d025f9..4efd587af5986289f19277ef6290d2f73e2f8de6 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<VerticalStack Name="TopContainer" Width="400" Height="-1"
+<VerticalStack Name="TopContainer" Width="400" Height="Fit"
        Margin="20" Background="DarkGray">
 
        <HorizontalStack Fit="true" Margin="5" Background="SkyBlue">
index 88bb388533570584f56feefb0735d5729147bf30..1750e11e89c2150277c10c21576506cb3179d97d 100644 (file)
@@ -811,7 +811,7 @@ namespace Crow
                                else if (Width == Measure.Stretched)
                                        Slot.Width = Parent.ClientRectangle.Width;
                                else
-                                       Slot.Width = Parent.ClientRectangle.Width * Width / 100;
+                                       Slot.Width = (int)Math.Round((double)(Parent.ClientRectangle.Width * Width) / 100.0);
 
                                if (Slot.Width == int.MinValue)
                                        return false;
@@ -844,7 +844,7 @@ namespace Crow
                                else if (Height == Measure.Stretched)
                                        Slot.Height = Parent.ClientRectangle.Height;
                                else
-                                       Slot.Height = Parent.ClientRectangle.Height * Height.Value / 100;
+                                       Slot.Height = (int)Math.Round((double)(Parent.ClientRectangle.Height * Height) / 100.0);
 
                                if (Slot.Height == int.MinValue)
                                        return false;
index 2fb80033ecb67d90bb171e2fe476661c3c3e8438..22b36fd2d2bde0b6c35fa52cba189fbc92054c6c 100644 (file)
@@ -97,9 +97,13 @@ namespace Crow
                [XmlIgnore]
                public int MaximumScroll {
                        get {
-                               return VerticalScrolling ? 
-                                       child == null ? 0 : Math.Max(Child.Slot.Height - ClientRectangle.Height,0) :
-                                       Math.Max(Child.Slot.Width - ClientRectangle.Width,0);
+                               try {
+                                       return VerticalScrolling ? 
+                                               Math.Max(Child.Slot.Height - ClientRectangle.Height,0) :
+                                               Math.Max(Child.Slot.Width - ClientRectangle.Width,0);                                   
+                               } catch {
+                                       return 0;
+                               }
                        }
                }
 
@@ -117,6 +121,7 @@ namespace Crow
             : base(){}
 
                #region GraphicObject Overrides
+               //TODO:put this override in style
                [XmlAttributeAttribute()][DefaultValue(false)]
                public override bool CacheEnabled {
                        get { return base.CacheEnabled; }