]> O.S.I.I.S - jp/crow.git/commitdiff
Group basic sizing ok
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 23 Apr 2016 14:21:08 +0000 (16:21 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 23 Apr 2016 14:21:08 +0000 (16:21 +0200)
15 files changed:
.gitignore
OTKCrow/OpenTKGameWindow.cs
Tests/GOLIBTestsOTK.cs
Tests/Interfaces/Container/3.crow [new file with mode: 0755]
Tests/Interfaces/Group/0.crow [new file with mode: 0755]
Tests/Interfaces/Group/1.crow [new file with mode: 0755]
Tests/Interfaces/Group/2.crow [new file with mode: 0755]
Tests/Interfaces/Group/3.crow [new file with mode: 0755]
Tests/Interfaces/Group/4.crow [new file with mode: 0755]
Tests/Tests.csproj
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs
src/LayoutingQueueItem.cs
src/Measure.cs

index 7aa58178d1c0f0f90390f5a6e1378d038148de82..ce290fc41b5e8171c08fc1d85c69d1ad9510db4d 100644 (file)
@@ -1,5 +1,5 @@
 Win_x86
-
+.nuget
 Crow.userprefs
 Debug
 packages
index 0b5c8543872cdece1cb01af77e4d37946dbfa692..329f83fb6a01dd21a5fa50b935d522e459e51c11 100644 (file)
@@ -115,6 +115,7 @@ namespace Crow
                                3,3,OpenTK.Graphics.GraphicsContextFlags.Default)
                {
                        CrowInterface = new Interface ();
+
                        Thread t = new Thread (interfaceThread);
                        t.IsBackground = true;
                        t.Start ();
@@ -125,7 +126,9 @@ namespace Crow
                {
                        CrowInterface.Quit += Quit;
                        CrowInterface.MouseCursorChanged += CrowInterface_MouseCursorChanged;
-
+                       while (CrowInterface.ClientRectangle.Size.Width == 0)
+                               Thread.Sleep (5);
+                       
                        while (true) {
                                CrowInterface.Update ();
                                Thread.Sleep (5);
index ec8fd6901ec4da502076f54925adcf7fa65dcabb..bc0d4e03fff1294f2da6f9dc72aa65e54fb72f50 100644 (file)
@@ -91,13 +91,13 @@ namespace testOTK
                        //this.AddWidget(new test4());
                        KeyboardKeyDown += GOLIBTests_KeyboardKeyDown1;;
 
+                       testFiles = Directory.GetFiles(@"Interfaces/Group", "*.crow").ToArray();
+                       //testFiles = Directory.GetFiles(@"Interfaces/Stack", "*.crow").ToArray();
+                       //testFiles = Directory.GetFiles(@"Interfaces/GraphicObject", "*.crow").Concat(testFiles).ToArray();
 
-                       testFiles = Directory.GetFiles(@"Interfaces/Stack", "*.crow").ToArray();
-                       testFiles = Directory.GetFiles(@"Interfaces/GraphicObject", "*.crow").Concat(testFiles).ToArray();
-                       testFiles = Directory.GetFiles(@"Interfaces/Container", "*.crow").Concat(testFiles).ToArray();
                        //testFiles = Directory.GetFiles(@"Interfaces", "*.crow").Concat(testFiles).ToArray();
 
-                       GraphicObject obj = CrowInterface.LoadInterface(testFiles[5]);
+                       GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]);
                        obj.DataSource = this;
 
                }
diff --git a/Tests/Interfaces/Container/3.crow b/Tests/Interfaces/Container/3.crow
new file mode 100755 (executable)
index 0000000..6f21416
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<Container Background="Onyx" Margin="10" Fit="true">
+       <Label Text="{fps}" Margin="10" Fit="true" Background="Mantis"/>
+</Container>
\ No newline at end of file
diff --git a/Tests/Interfaces/Group/0.crow b/Tests/Interfaces/Group/0.crow
new file mode 100755 (executable)
index 0000000..c3cf308
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<Group MinimumSize="50;50" Background="Onyx" Margin="10" Width="90%" Height="90%">
+       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"
+                       VerticalAlignment="Top"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"                   
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="Stretched" Height="Fit" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       MinimumSize="10;10"/>
+</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/Group/1.crow b/Tests/Interfaces/Group/1.crow
new file mode 100755 (executable)
index 0000000..6950a8d
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<Group Background="Onyx" Margin="10" Width="90%" Height="90%">
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/Group/2.crow b/Tests/Interfaces/Group/2.crow
new file mode 100755 (executable)
index 0000000..693e1b0
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<Group Background="Onyx" Margin="10" Fit="true">
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/Group/3.crow b/Tests/Interfaces/Group/3.crow
new file mode 100755 (executable)
index 0000000..321e219
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<Group Background="Onyx" Margin="10" Width="70%" Height="50%">
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="100%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Left"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       MinimumSize="10;10"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Bottom"
+                       HorizontalAlignment="Right"
+                       MinimumSize="10;10"/>
+</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/Group/4.crow b/Tests/Interfaces/Group/4.crow
new file mode 100755 (executable)
index 0000000..25e03bd
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<Group Background="Onyx" Margin="10" Fit="true">
+       <Label Font="droid bold,40" Text="{fps}" Margin="10"  Fit="true"/>
+       <GraphicObject Margin="10" Width="20%" Height="20%" Background="Mantis"
+                       VerticalAlignment="Top"
+                       MinimumSize="10;10"/>
+</Group>
\ No newline at end of file
index 143f80bea5f8b4daa96d17c7b840720d012cccf6..24042c9f63dce020b6a2df68b5b1705bfa1bab2b 100644 (file)
     <None Include="Interfaces\Stack\3.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\Container\3.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Group\0.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Group\1.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Group\2.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Group\3.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Group\3 %28copier%29.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
     <Folder Include="image\" />
     <Folder Include="Interfaces\basicTests\" />
     <Folder Include="Interfaces\GraphicObject\" />
+    <Folder Include="Interfaces\Group\" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="image\tetra.png" />
index e4d17351dcfed28c348649d4fb229e2fdd95a783..30aa4a950749fcfb7b110c685e87725d3c7eb326 100644 (file)
@@ -664,11 +664,11 @@ namespace Crow
                        get { return layoutingTries; }
                        set { layoutingTries = value; }
                }
+               protected Size contentSize;
                /// <summary> return size of content + margins </summary>
                protected virtual int measureRawSize (LayoutingType lt) {
                        return lt == LayoutingType.Width ? 
-                               Width == Measure.Fit ? MinimumSize.Width : (int)Width :
-                               Height == Measure.Fit ? MinimumSize.Height : (int)Height;
+                               contentSize.Width + 2 * Margin: contentSize.Height + 2 * Margin;
                }
                /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
                public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
index 78c5bca3716e5ca713fc833678c6dce64f00ca1b..2b440ac1b50b9a692c13a13cb73d827e17cd92fe 100644 (file)
@@ -21,8 +21,6 @@ namespace Crow
                public event EventHandler<EventArgs> ChildrenCleared;
                #endregion
 
-               internal int maxChildrenWidth = 0;
-               internal int maxChildrenHeight = 0;
                internal GraphicObject largestChild = null;
                internal GraphicObject tallestChild = null;
 
@@ -59,9 +57,9 @@ namespace Crow
                        //child.Parent = null;
             Children.Remove(child);
 
-                       if (child == largestChild)
+                       if (child == largestChild && Width == Measure.Fit)
                                searchLargestChild ();
-                       if (child == tallestChild)
+                       if (child == tallestChild && Height == Measure.Fit)
                                searchTallestChild ();
                        
                        this.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
@@ -130,28 +128,26 @@ namespace Crow
                }
                protected override int measureRawSize (LayoutingType lt)
                {
-                       if (Children.Count == 0)
-                               return base.measureRawSize (lt);
-                       
-                       if (lt == LayoutingType.Width) {
-                               if (largestChild == null)
-                                       searchLargestChild ();
-                               if (largestChild == null){
-                                       //if still null, not possible to determine a width
-                                       //because all children are stretched, force first one to fit
-                                       Children[0].Width = Measure.Fit;
-                                       return -1;//cancel actual sizing to let child computation take place
-                               }
-                               return maxChildrenWidth + 2 * Margin;
-                       }else{
-                               if (tallestChild == null)
-                                       searchTallestChild ();
-                               if (tallestChild == null) {
-                                       Children[0].Height = Measure.Fit;
-                                       return -1;
+                       if (Children.Count > 0) {
+                               if (lt == LayoutingType.Width) {
+                                       if (largestChild == null)
+                                               searchLargestChild ();
+                                       if (largestChild == null) {
+                                               //if still null, not possible to determine a width
+                                               //because all children are stretched, force first one to fit
+                                               Children [0].Width = Measure.Fit;
+                                               return -1;//cancel actual sizing to let child computation take place
+                                       }
+                               } else {
+                                       if (tallestChild == null)
+                                               searchTallestChild ();
+                                       if (tallestChild == null) {
+                                               Children [0].Height = Measure.Fit;
+                                               return -1;
+                                       }
                                }
-                               return maxChildrenHeight + 2 * Margin;
                        }
+                       return base.measureRawSize (lt);
                }
                        
                public override void OnLayoutChanges (LayoutingType layoutType)
@@ -173,36 +169,29 @@ namespace Crow
                public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
                {
                        GraphicObject g = sender as GraphicObject;
+
                        switch (arg.LayoutType) {
                        case LayoutingType.Width:
-                               if (g.Slot.Width > maxChildrenWidth) {
-                                       maxChildrenWidth = g.Slot.Width;
+                               if (Width != Measure.Fit)
+                                       return;
+                               if (g.Slot.Width > contentSize.Width) {
                                        largestChild = g;
-                                       if (Width == Measure.Fit)
-                                               this.RegisterForLayouting (LayoutingType.Width);
-                               } else if (g == largestChild) {
-
-                                       largestChild = null;
-                                       maxChildrenWidth = 0;
+                                       contentSize.Width = g.Slot.Width;
+                               } else if (g == largestChild)
+                                       searchLargestChild ();
 
-                                       if (Width == Measure.Fit)
-                                               this.RegisterForLayouting (LayoutingType.Width);
-                               }
+                               this.RegisterForLayouting (LayoutingType.Width);
                                break;
                        case LayoutingType.Height:
-                               if (g.Slot.Height > maxChildrenHeight) {
-                                       maxChildrenHeight = g.Slot.Height;
+                               if (Height != Measure.Fit)
+                                       return;
+                               if (g.Slot.Height > contentSize.Height) {
                                        tallestChild = g;
-                                       if (Height == Measure.Fit)
-                                               this.RegisterForLayouting (LayoutingType.Height);
-                               } else if (g == tallestChild) {
-
-                                       tallestChild = null;
-                                       maxChildrenHeight = 0;
+                                       contentSize.Height = g.Slot.Height;
+                               } else if (g == tallestChild)
+                                       searchTallestChild ();
 
-                                       if (Height == Measure.Fit)
-                                               this.RegisterForLayouting (LayoutingType.Height);
-                               }
+                               this.RegisterForLayouting (LayoutingType.Height);
                                break;
                        }
                }
@@ -211,22 +200,21 @@ namespace Crow
                void resetChildrenMaxSize(){
                        largestChild = null;
                        tallestChild = null;
-                       maxChildrenWidth = 0;
-                       maxChildrenHeight = 0;
+                       contentSize = 0;
                }
                void searchLargestChild(){
                        #if DEBUG_LAYOUTING
                        Debug.WriteLine("\tSearch largest child");
                        #endif
                        largestChild = null;
-                       maxChildrenWidth = 0;
+                       contentSize.Width = 0;
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
                                if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Width))
                                        continue;
-                               if (Children [i].Slot.Width > maxChildrenWidth) {
-                                       maxChildrenWidth = Children [i].Slot.Width;
+                               if (Children [i].Slot.Width > contentSize.Width) {
+                                       contentSize.Width = Children [i].Slot.Width;
                                        largestChild = Children [i];
                                }
                        }
@@ -236,14 +224,14 @@ namespace Crow
                        Debug.WriteLine("\tSearch tallest child");
                        #endif
                        tallestChild = null;
-                       maxChildrenHeight = 0;
+                       contentSize.Height = 0;
                        for (int i = 0; i < Children.Count; i++) {
                                if (!Children [i].Visible)
                                        continue;
                                if (children [i].RegisteredLayoutings.HasFlag (LayoutingType.Height))
                                        continue;
-                               if (Children [i].Slot.Height > maxChildrenHeight) {
-                                       maxChildrenHeight = Children [i].Slot.Height;
+                               if (Children [i].Slot.Height > contentSize.Height) {
+                                       contentSize.Height = Children [i].Slot.Height;
                                        tallestChild = Children [i];
                                }
                        }
index 99b85dd22116e5015fed155101f6be9bca7cc5dd..0ff4beca56bed28ba292fed70a15eeb85ff2908a 100644 (file)
@@ -51,6 +51,7 @@ namespace Crow
                {
 
                        if (child != null) {
+                               contentSize = new Size (0, 0);
                                child.LayoutChanged -= OnChildLayoutChanges;
                                this.RegisterForLayouting (LayoutingType.Sizing);
                                child.Parent = null;
@@ -61,6 +62,7 @@ namespace Crow
                        if (child != null) {
                                child.Parent = this;
                                child.LayoutChanged += OnChildLayoutChanges;
+                               contentSize = child.Slot.Size;
                                child.RegisterForLayouting (LayoutingType.Sizing);
                        }
 
@@ -90,22 +92,10 @@ namespace Crow
                        return child == goToFind ? true : 
                                child == null ? false : child.Contains(goToFind);
                }
-               protected override int measureRawSize (LayoutingType lt)
-               {
-                       if (child == null)
-                               return base.measureRawSize (lt);
-                       if (lt == LayoutingType.Width)
-                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Width) ?
-                                       -1 : child.Slot.Size.Width + 2 * Margin;
-                       else
-                               return child.RegisteredLayoutings.HasFlag(LayoutingType.Height) ?
-                                       -1 : child.Slot.Size.Height + 2 * Margin;
-               }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
                        if (child != null) {
-                               //force sizing to fit if sizing on children and
-                               //child has stretched size
+                               //force sizing to fit if sizing on children and child has stretched size
                                switch (layoutType) {
                                case LayoutingType.Width:
                                        if (Width == Measure.Fit && child.Width.Units == Unit.Percent)
@@ -123,34 +113,46 @@ namespace Crow
                {
                        base.OnLayoutChanges (layoutType);
 
-                       switch (layoutType) {
-                       case LayoutingType.Width:                                                               
-                               if (child != null) {
-                                       child.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
+                       if (child == null)
+                               return;
+                       
+                       LayoutingType ltChild = LayoutingType.None;
+
+                       if (layoutType == LayoutingType.Width) {
+                               if (Width == Measure.Fit)
+                                       return;
+                               if (child.Width.Units == Unit.Percent) {
+                                       ltChild |= LayoutingType.Width;
+                                       if (child.Width.Value < 100 && child.Left == 0)
+                                               ltChild |= LayoutingType.X;
                                }
-                               break;
-                       case LayoutingType.Height:
-                               if (child != null) {
-                                       child.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
+                       } else if (layoutType == LayoutingType.Height) {
+                               if (Height == Measure.Fit)
+                                       return;
+                               if (child.Height.Units == Unit.Percent) {
+                                       ltChild |= LayoutingType.Height;
+                                       if (child.Height.Value < 100 && child.Top == 0)
+                                               ltChild |= LayoutingType.Y;
                                }
-                               break;
-                       }                                                       
+                       }
+                       if (ltChild == LayoutingType.None)
+                               return;
+                       child.RegisterForLayouting (ltChild);
                }
                public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
-               {
-                       switch (arg.LayoutType) {
-                       case LayoutingType.X:
-                               break;
-                       case LayoutingType.Y:
-                               break;
-                       case LayoutingType.Width:
-                               if (Width < 0)
-                                       this.RegisterForLayouting (LayoutingType.Width);
-                               break;
-                       case LayoutingType.Height:
-                               if (Height < 0)
-                                       this.RegisterForLayouting (LayoutingType.Height);
-                               break;
+               {                       
+                       GraphicObject g = sender as GraphicObject;
+
+                       if (arg.LayoutType == LayoutingType.Width) {
+                               if (Width != Measure.Fit)
+                                       return;
+                               contentSize.Width = g.Slot.Width;
+                               this.RegisterForLayouting (LayoutingType.Width);
+                       }else if (arg.LayoutType == LayoutingType.Height){
+                               if (Height != Measure.Fit)
+                                       return;
+                               contentSize.Height = g.Slot.Height;
+                               this.RegisterForLayouting (LayoutingType.Height);
                        }
                }
                protected override void onDraw (Context gr)
index 5fbde09705c54903d05d7cfee5375b411c8ede7a..933fc57cf1b7160f09ed9d5e01d2dbb999ae5f4e 100644 (file)
@@ -24,6 +24,7 @@ using System.Collections.Generic;
 
 namespace Crow
 {
+       [Flags]
        public enum LayoutingType : byte
        {
                None = 0x00,
index 4fbac42100488c7ae2447a08fdee4dcb9285800c..64e5cc98e8e6f2c35ca39f5388db3a2144f88c4f 100644 (file)
@@ -30,7 +30,7 @@ namespace Crow
 
                public static Measure Fit = new Measure(-1);
                //TODO:implement stretching as 100%, not 0%
-               public static Measure Stretched = new Measure(0, Unit.Percent);
+               public static Measure Stretched = new Measure(100, Unit.Percent);
 
                public Measure (int _value, Unit _units = Unit.Pixel)
                {
@@ -72,8 +72,8 @@ namespace Crow
                public override string ToString ()
                {
                        return Value == -1 ? "Fit" :
-                               Value == 0 ? "Stretched" :
-                               Units == Unit.Percent ? Value.ToString () + "%" : Value.ToString ();
+                               Units == Unit.Percent ? Value == 100 ? "Stretched" :
+                               Value.ToString () + "%" : Value.ToString ();
                }
                public static Measure Parse(string s){
                        if (string.IsNullOrEmpty (s))