]> O.S.I.I.S - jp/crow.git/commitdiff
force measure in containers
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 15 Jun 2020 10:25:50 +0000 (12:25 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 15 Jun 2020 10:25:50 +0000 (12:25 +0200)
17 files changed:
Crow/Default.style
Crow/Templates/FileDialog.template
Crow/Templates/MenuItem.template
Crow/src/2d/Measure.cs
Crow/src/Widgets/CheckBox.cs
Crow/src/Widgets/GenericStack.cs
Crow/src/Widgets/Group.cs
Crow/src/Widgets/PrivateContainer.cs
Crow/src/Widgets/Widget.cs
Crow/src/Widgets/Wrapper.cs
Crow/src/debug/DbgEventTypeColors.cs
Crow/src/debug/DbgLogViewer.cs
Crow/src/debug/DebugLogger.cs
Samples/common/ui/Interfaces/Stack/StretchedInFit2.crow [new file with mode: 0644]
Samples/common/ui/Interfaces/Stack/StretchedInFit3.crow [new file with mode: 0644]
Samples/common/ui/Interfaces/Stack/StretchedInFit4.crow [new file with mode: 0644]
Samples/common/ui/Interfaces/Stack/StretchedInFit5.crow [new file with mode: 0644]

index 3d5c3e7ffd5295fb2b1211b1c15acfffaed0e355..8bc81ea6b70dac4333c006f132673f4e44d3db9b 100644 (file)
@@ -10,12 +10,14 @@ IconSize = "11";
 IconMargin = "1";
 ToggleIconSize = "16";
 
-WindowBackgroundColor = "";
+WindowBackgroundColor = "DarkGrey";
 WindowBorderColor = "Grey";
 WindowBorderWidth = "1";
-WindowTitleBarBackground = "vgradient|0:Onyx|1:SteelBlue";
+WindowTitleBarBackground = "vgradient|0:Onyx|1:RoyalBlue";
 WindowTitleBarForeground = "White";
 
+MenuBackground = "Jet";
+
 Button, CheckBox, RadioButton, ComboBox, Expandable,
 MessageBox, Popper, Slider, Spinner, TextBox {
        Focusable = "true";
@@ -77,23 +79,25 @@ TextBox {
        MouseCursor = "IBeam";
 }
 Menu {
-       Margin = "1";
-       Background = "vgradient|0:DimGrey|1:Black";
-       //Background = "Transparent";
+       Margin = "0";
+       Background = "${MenuBackground}";
        Height = "Fit";
        Width = "Stretched";
        VerticalAlignment = "Top";
        SelectionBackground = "${ControlHighlight}";
+       SelectionColoring = "false";
 }
 MenuItem {
        Caption = "MenuItem";
        Width = "Stretched";
        Height = "Fit";
-       Background = "DimGrey"; 
-       Foreground = "LightGrey";
+       Background = "${MenuBackground}";       
+       Foreground = "${ControlCaptionColor}";
        MouseEnter = "{Background=${ControlHighlight}}";
-       MouseLeave = "{Background=Transparent}";
-       SelectionBackground = "${ControlHighlight}";
+       MouseLeave = "{Background=${MenuBackground}}";
+       //SelectionBackground = "${ControlHighlight}";
+       SelectionBackground = "Transparent";
+       SelectionColoring = "false";
 }
 MessageBox {
        Background = "0.1,0.1,0.2,0.85";
index 419e093ac7acd106062c9f683eeef138ada8d639..5140aae7813b4c4778ee0625ad5c663e350592f2 100644 (file)
@@ -1,14 +1,10 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
-                               Background="{./Background}"
-                               MouseEnter="./onBorderMouseEnter"
-                               MouseLeave="./onBorderMouseLeave">
+<Border Name="SizeHandle" Style="winBorder"  CornerRadius="{./CornerRadius}" Background="{./Background}">
        <VerticalStack Spacing="0">
-               <HorizontalStack Background="{./TitleBarBackground}"
-                               Name="hs" Margin="2" Spacing="0" Height="Fit">
+               <HorizontalStack Background="${WindowTitleBarBackground}" Margin="0" Spacing="0" Height="Fit">
                        <Widget Width="5"/>
                        <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
-                       <Label Width="Stretched" Foreground="{./TitleBarForeground}" Margin="1" TextAlignment="Center" Text="{./Caption}" />
+                       <Label Name="MoveHandle" Width="Stretched" Foreground="${WindowTitleBarForeground" Margin="2" TextAlignment="Center" Text="{./Caption}" />
                        <Border CornerRadius="0" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Icons.exit2.svg"
index b619a8b1c726afd011f4fcd23a7179e6aa206f33..b4e119dced7c7c17c002a19adc1be07d7e866cfc 100644 (file)
@@ -17,7 +17,7 @@
                        </Template>             
                </CheckBox>
        </Template>
-       <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="vgradient|0:DimGrey|1:Black">
+       <Border Foreground="DimGrey" Width="{../PopWidth}" Height="{../PopHeight}" Background="${MenuBackground}">
                <VerticalStack Name="ItemsContainer"/>
        </Border>
 </Popper>
\ No newline at end of file
index c77d66bdd1438b0edccd639bd67dda26ccd88b14..18ab62ce8a0bed1afb34e1455bbcb368488c3a81 100644 (file)
@@ -47,6 +47,9 @@ namespace Crow
                /// </summary>
                public bool IsFixed { get { return Units == Unit.Pixel; }}
                public bool IsFit { get { return Value == -1 && Units == Unit.Percent; }}
+               /// <summary>
+               /// True if width is proportional to parent client rectangle
+               /// </summary>
                public bool IsRelativeToParent { get { return Value >= 0 && Units == Unit.Percent; }}
                #region Operators
                public static implicit operator int(Measure m){
index a5cd39d8adea04d475eeb784906a2afb36ece447..cd0297f7a728d07c38151f80fb1e859309894175 100644 (file)
@@ -46,7 +46,6 @@ namespace Crow
                public override void onMouseClick (object sender, MouseButtonEventArgs e)
                {
                        IsChecked = !IsChecked;
-                       e.Handled = true;
                        base.onMouseClick (sender, e);
                }
        }
index 1d2c0f6aec2045d4b670551c9c80c467ace26a5a..2fd86466e1ce551ae6e47d798a34f5f7ca55a08d 100644 (file)
@@ -5,7 +5,7 @@
 using System;
 using System.ComponentModel;
 using System.Linq;
-
+using static Crow.Logger;
 namespace Crow {
        /// <summary>
        /// group container that stacked its children horizontally or vertically
@@ -118,7 +118,7 @@ namespace Crow {
                                        stretchedGO.Slot.Width = newW;
                                        stretchedGO.IsDirty = true;
 #if DEBUG_LAYOUTING
-                               Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString());
+                                       LOG ($"width: {stretchedGO.ToString()}");
 #endif
                                        stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                                        stretchedGO.OnLayoutChanges (LayoutingType.Width);
@@ -135,7 +135,7 @@ namespace Crow {
                                        stretchedGO.Slot.Height = newH;
                                        stretchedGO.IsDirty = true;
 #if DEBUG_LAYOUTING
-                                       Debug.WriteLine ("\tAdjusting Height of " + stretchedGO.ToString());
+                                       LOG ($"height: {stretchedGO.ToString ()}");
 #endif
                                        stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                                        stretchedGO.OnLayoutChanges (LayoutingType.Height);
index bba4bea9be250614fd5c41f1e4be52d46b836ffd..6731d7bebaf6de3e3496e220cdac1a206640aa39 100644 (file)
@@ -8,6 +8,7 @@ using System.ComponentModel;
 using Crow.Cairo;
 using System.Threading;
 
+using static Crow.Logger;
 
 namespace Crow
 {
@@ -343,6 +344,10 @@ namespace Crow
                {
                        Widget g = sender as Widget;
 
+#if DEBUG_LAYOUTING
+                       LOG ($"{arg.LayoutType}:{g}->{g.Slot}");
+#endif
+
                        switch (arg.LayoutType) {
                        case LayoutingType.Width:
                                if (Width != Measure.Fit)
@@ -377,7 +382,7 @@ namespace Crow
                void searchLargestChild (bool forceMeasure = false)
                {
                        #if DEBUG_LAYOUTING
-                       Debug.WriteLine("\tSearch largest child");
+                       LOG (this.ToString());
                        #endif
                        largestChild = null;
                        contentSize.Width = 0;
@@ -398,9 +403,9 @@ namespace Crow
                        }
                }
                void searchTallestChild (bool forceMeasure = false)
-               { 
+               {
                        #if DEBUG_LAYOUTING
-                       Debug.WriteLine("\tSearch tallest child");
+                       LOG (this.ToString());
                        #endif
                        tallestChild = null;
                        contentSize.Height = 0;
index ee74784ebb33e9f1b75041977eb07e92770852dd..bd49c1b40aa25bb2740b64f3324a4ecb2b22bf3d 100644 (file)
@@ -2,8 +2,9 @@
 //
 // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
 
+using System;
 using Crow.Cairo;
-
+using static Crow.Logger;
 namespace Crow
 {
        /// <summary>
@@ -92,18 +93,36 @@ namespace Crow
                        if (child.localDataSourceIsNull & child.localLogicalParentIsNull)
                                child.OnDataSourceChanged (child, e);
                }
+
+               public override int measureRawSize (LayoutingType lt)
+               {
+                       if (child != null) {
+                               //force measure of child if sizing on children and child has stretched size
+                               switch (lt) {
+                               case LayoutingType.Width:
+                                       if (child.Width.IsRelativeToParent)
+                                               contentSize.Width = child.measureRawSize (LayoutingType.Width);
+                                       break;
+                               case LayoutingType.Height:
+                                       if (child.Height.IsRelativeToParent)
+                                               contentSize.Height = child.measureRawSize (LayoutingType.Width);
+                                       break;
+                               }
+                       }
+                       return base.measureRawSize (lt);
+               }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
                        if (child != null) {
-                               //force sizing to fit if sizing on children and child has stretched size
+                               //force measure of child if sizing on children and child has stretched size
                                switch (layoutType) {
                                case LayoutingType.Width:
                                        if (Width == Measure.Fit && child.Width.IsRelativeToParent)
-                                               child.Width = Measure.Fit;
+                                               contentSize.Width = child.measureRawSize (LayoutingType.Width);
                                        break;
                                case LayoutingType.Height:
                                        if (Height == Measure.Fit && child.Height.IsRelativeToParent)
-                                               child.Height = Measure.Fit;
+                                               contentSize.Height = child.measureRawSize (LayoutingType.Width);
                                        break;
                                }
                        }
@@ -115,7 +134,7 @@ namespace Crow
 
                        if (child == null)
                                return;
-                       
+
                        LayoutingType ltChild = LayoutingType.None;
 
                        if (layoutType == LayoutingType.Width) {
@@ -131,7 +150,7 @@ namespace Crow
                                        if (child.Height.Value < 100 && child.Top == 0)
                                                ltChild |= LayoutingType.Y;
                                } else if (child.Top == 0)
-                                               ltChild |= LayoutingType.Y;
+                                       ltChild |= LayoutingType.Y;
                        }
                        if (ltChild == LayoutingType.None)
                                return;
@@ -140,17 +159,19 @@ namespace Crow
                public virtual void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
                {                       
                        Widget g = sender as Widget;
-
+#if DEBUG_LAYOUTING
+                       LOG ($"{arg.LayoutType}:{g}->{child.Slot}");
+#endif
                        if (arg.LayoutType == LayoutingType.Width) {
+                               contentSize.Width = g.Slot.Width;
                                if (Width != Measure.Fit)
                                        return;
-                               contentSize.Width = g.Slot.Width;
-                               this.RegisterForLayouting (LayoutingType.Width);
-                       }else if (arg.LayoutType == LayoutingType.Height){
+                               RegisterForLayouting (LayoutingType.Width);
+                       } else if (arg.LayoutType == LayoutingType.Height){
+                               contentSize.Height = g.Slot.Height;
                                if (Height != Measure.Fit)
                                        return;
-                               contentSize.Height = g.Slot.Height;
-                               this.RegisterForLayouting (LayoutingType.Height);
+                               RegisterForLayouting (LayoutingType.Height);
                        }
                }
                protected override void onDraw (Context gr)
index 2bff9c41963241344358a0b877fd6e59d7cc3ed3..c98c84ae8d088760e82a42e72a88d1a2346ff6f3 100644 (file)
@@ -1450,6 +1450,21 @@ namespace Crow
                /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
                public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
                }
+
+               internal bool firstUnresolvedFitWidth (out  Widget ancestorInUnresolvedFit)
+               {
+                       ancestorInUnresolvedFit = this.Parent as Widget;
+
+                       while (ancestorInUnresolvedFit != null) {
+                               if (ancestorInUnresolvedFit.width.IsFit)
+                                       return true;
+                               if (!ancestorInUnresolvedFit.Width.IsRelativeToParent || ancestorInUnresolvedFit.Parent is Interface)
+                                       return false;
+                               ancestorInUnresolvedFit = ancestorInUnresolvedFit.Parent as Widget;
+                       }
+                       return false;
+               }
+
                public virtual bool ArrangeChildren { get { return false; } }
                /// <summary> Query a layouting for the type pass as parameter, redraw only if layout changed. </summary>
                public virtual void RegisterForLayouting(LayoutingType layoutType){
@@ -2028,11 +2043,11 @@ namespace Crow
 
                        if (Parent != null)
                                tmp = Parent.ToString () + tmp;
-                       #if DEBUG_LAYOUTING
+                       /*#if DEBUG_LAYOUTING
                        return Name == "unamed" ? tmp + "." + this.GetType ().Name + GraphicObjects.IndexOf(this).ToString(): tmp + "." + Name;
-                       #else
+                       #else*/
                        return string.IsNullOrEmpty(Name) ? tmp + "." + this.GetType ().Name : tmp + "." + Name;
-                       #endif
+                       //#endif
                }
                /// <summary>
                /// Checks to handle when widget is removed from the visible graphic tree
index 7170d1eda051df5ca8f1d29cee6e83b786def571..13443fae3bf91a91d32fdb73bc0f32f72f270aa5 100644 (file)
@@ -1,7 +1,7 @@
 // Copyright (c) 2013-2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
 //
 // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
-
+using static Crow.Logger;
 namespace Crow
 {
        /// <summary>
@@ -192,10 +192,9 @@ namespace Crow
                }
                public override void OnLayoutChanges (LayoutingType layoutType)
                {
-                       #if DEBUG_LAYOUTING
-                       IFace.currentLQI.Slot = LastSlots;
-                       IFace.currentLQI.Slot = Slot;
-                       #endif
+#if DEBUG_LAYOUTING
+                       LOG ($"{layoutType}: {LastSlots}->{Slot}");
+#endif
                        switch (layoutType) {
                        case LayoutingType.Width:
                                foreach (Widget c in Children) {
index fdcfbd94767f1a44e0adff2e9420d4eb9ee99eb5..c05ffbbc1f73ac032bb41f27a6e904a48c3dbe4a 100644 (file)
@@ -64,7 +64,7 @@ namespace Crow
                                gr.Rectangle (rc);
                                gr.StrokePreserve ();
 
-                               gr.SetSourceColor (c);
+                               gr.SetSource (c);
                                gr.Fill ();
 
                                penY += fe.Height;
index baca16bec69aafbae5d86a803b89665a4a468c32..9e862e156dfed4e2af6b6a3a6147a8d5b6407409 100644 (file)
@@ -1,28 +1,7 @@
-//
-// DbgLogViewer.cs
+// Copyright (c) 2013-2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
 //
-// Author:
-//       Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -359,31 +338,31 @@ namespace Crow
                                        //if (x + w > cb.Right)
                                        //      continue;
 
-                                       Color c = Color.Black;
+                                       Color c = Colors.Black;
 
                                        if (evt.type == DbgEvtType.GOProcessLayouting) {
                                                switch (evt.data.result) {
                                                case LayoutingQueueItem.Result.Success:
-                                                       c = Crow.Color.Green;
+                                                       c = Crow.Colors.Green;
                                                        break;
                                                case LayoutingQueueItem.Result.Deleted:
-                                                       c = Crow.Color.Red;
+                                                       c = Crow.Colors.Red;
                                                        break;
                                                case LayoutingQueueItem.Result.Discarded:
-                                                       c = Crow.Color.OrangeRed;
+                                                       c = Crow.Colors.OrangeRed;
                                                        break;
                                                case LayoutingQueueItem.Result.Requeued:
-                                                       c = Crow.Color.Orange;
+                                                       c = Crow.Colors.Orange;
                                                        break;
                                                }
                                        } else if (evt.type.HasFlag (DbgEvtType.GOLock))
-                                               c = Color.BlueViolet;
+                                               c = Colors.BlueViolet;
                                        else if (colors.ContainsKey (evt.type))
                                                c = colors [evt.type];
                                        //else
                                        //      System.Diagnostics.Debugger.Break ();
                                        c = c.AdjustAlpha (0.2);
-                                       gr.SetSourceColor (c);
+                                       gr.SetSource (c);
 
                                        gr.Rectangle (x, penY, w, fe.Height);
                                        gr.Fill ();
@@ -391,7 +370,7 @@ namespace Crow
 
                                penY += fe.Height;
 
-                               gr.SetSourceColor (Crow.Color.Jet);
+                               gr.SetSource (Crow.Colors.Jet);
                                gr.MoveTo (cb.X, penY - 0.5);
                                gr.LineTo (cb.Right, penY - 0.5);
                                gr.Stroke ();
@@ -399,14 +378,14 @@ namespace Crow
                                double penX = 5.0 * g.xLevel + cb.Left;
 
                                if (g.yIndex == 0)
-                                       gr.SetSourceColor (Crow.Color.LightSalmon);
+                                       gr.SetSource (Crow.Colors.LightSalmon);
                                else
                                        Foreground.SetAsSource (gr);
 
                                gr.MoveTo (penX, penY - gr.FontExtents.Descent);
                                gr.ShowText (g.name);
 
-                               gr.SetSourceColor (Crow.Color.White);
+                               gr.SetSource (Crow.Colors.White);
                                gr.MoveTo (cb.X, penY - gr.FontExtents.Descent);
                                gr.ShowText ((i+ ScrollY).ToString());
 
@@ -418,7 +397,7 @@ namespace Crow
 
                        gr.MoveTo (leftMargin + cb.Left, cb.Top);
                        gr.LineTo (leftMargin + cb.Left, cb.Bottom);
-                       gr.SetSourceColor (Crow.Color.Grey);
+                       gr.SetSource (Crow.Colors.Grey);
 
                        penY = topMargin + ClientRectangle.Top;
 
@@ -456,7 +435,7 @@ namespace Crow
                                double x = xScale * (evt.begin - minTicks - ScrollX) ;
                                x += leftMargin + cb.Left;
 
-                               gr.SetSourceColor (Crow.Color.Yellow);
+                               gr.SetSource (Crow.Colors.Yellow);
                                gr.MoveTo (x, penY);
                                gr.LineTo (x, cb.Bottom);
                                gr.Stroke ();
@@ -465,7 +444,7 @@ namespace Crow
                                gr.Rectangle (x - 0.5 * te.Width , penY - te.Height, te.Width, te.Height);
                                gr.Fill ();
                                gr.MoveTo (x- 0.5 * te.Width, penY - gr.FontExtents.Descent);
-                               gr.SetSourceColor (Crow.Color.Jet);
+                               gr.SetSource (Crow.Colors.Jet);
                                gr.ShowText (s);
 
                        }
@@ -480,7 +459,7 @@ namespace Crow
                        Rectangle cb = ClientRectangle;
 
                        ctx.Rectangle (ctxR);
-                       ctx.SetSourceColor (Color.CornflowerBlue);
+                       ctx.SetSource (Colors.CornflowerBlue);
                        ctx.Fill();
 
                        ctx.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
@@ -521,7 +500,7 @@ namespace Crow
                        ctxR.Width = Math.Max (1, ctxR.Width);
                        ctx.Rectangle (ctxR);
                        //ctx.SetSourceColor (Color.LightYellow);
-                       ctx.SetSourceColor (Color.Jet);
+                       ctx.SetSource (Colors.Jet);
                        ctx.Fill();
                        ctx.Operator = Cairo.Operator.Over;
 
@@ -577,7 +556,7 @@ namespace Crow
                        base.onMouseMove (sender, e);
                        updateMouseLocalPos (e.Position);
 
-                       if (selStart >= 0 && IFace.Mouse.IsButtonDown(MouseButton.Left))
+                       if (selStart >= 0 && IFace.IsDown (Glfw.MouseButton.Left))
                                selEnd = currentTick;
 
                        if (RegisteredLayoutings == LayoutingType.None && !IsDirty)
@@ -627,7 +606,7 @@ namespace Crow
                {
                        base.onKeyDown (sender, e);
 
-                       if (e.Key == Key.F3) {
+                       if (e.Key == Glfw.Key.F3) {
                                if (selEnd < 0)
                                        return;
                                if (selEnd < selStart)
index 37842e22d762362097bc4ed03333616a18240887..19c0137893ffcb15eddbe0f30f04a90b3fafb0dd 100644 (file)
@@ -1,28 +1,7 @@
-//
-// CrowDebugger.cs
+// Copyright (c) 2013-2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
 //
-// Author:
-//       Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
 using System;
 using Crow.Cairo;
 using System.Collections.Generic;
diff --git a/Samples/common/ui/Interfaces/Stack/StretchedInFit2.crow b/Samples/common/ui/Interfaces/Stack/StretchedInFit2.crow
new file mode 100644 (file)
index 0000000..57a5760
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<VerticalStack Background="DimGrey" Margin="10" Width="Fit" Height="Fit" >
+       <VerticalStack Width="Stretched" Margin="10" Background="RoyalBlue">
+               <VerticalStack Width="Stretched" Margin="10" Background="FireBrick">
+                       <VerticalStack Width="Stretched" Margin="10" Background="Teal">
+                               <VerticalStack Width="Stretched" Margin="10" Background="CornflowerBlue">
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                               </VerticalStack>
+                       </VerticalStack>
+               </VerticalStack>
+       </VerticalStack>
+</VerticalStack>
\ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Stack/StretchedInFit3.crow b/Samples/common/ui/Interfaces/Stack/StretchedInFit3.crow
new file mode 100644 (file)
index 0000000..84c057f
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<Container Background="DimGrey" Margin="10" Width="Fit" Height="Fit" >
+       <VerticalStack Width="Stretched" Margin="10" Background="RoyalBlue">
+               <VerticalStack Width="Stretched" Margin="10" Background="FireBrick">
+                       <VerticalStack Width="Stretched" Margin="10" Background="Teal">
+                               <VerticalStack Width="Stretched" Margin="10" Background="CornflowerBlue">
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                                       <Label Text="{./Caption}" Width="Stretched"/>
+                               </VerticalStack>
+                       </VerticalStack>
+               </VerticalStack>
+       </VerticalStack>
+</Container>
\ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Stack/StretchedInFit4.crow b/Samples/common/ui/Interfaces/Stack/StretchedInFit4.crow
new file mode 100644 (file)
index 0000000..8026983
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<Container Background="DimGrey" Margin="10" Width="Fit" Height="Fit" >
+       <Popper Width="Stretched" Margin="10" Background="RoyalBlue">
+               <Container Width="Fit" Height="Fit" Margin="10" Background="Blue">
+                       <Container Width="Stretched" Margin="10" Background="Yellow">
+                               <Container Width="Stretched" Margin="10" Background="FireBrick">
+                                       <CheckBox Width="Stretched"/> 
+                               </Container>
+                       </Container>
+               </Container>
+       </Popper>
+</Container>
\ No newline at end of file
diff --git a/Samples/common/ui/Interfaces/Stack/StretchedInFit5.crow b/Samples/common/ui/Interfaces/Stack/StretchedInFit5.crow
new file mode 100644 (file)
index 0000000..8dc06c7
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<VerticalStack Background="DimGrey" Margin="10" Width="Fit" Height="Fit" >
+       <CheckBox Name="cb"/>
+       <CheckBox Name="cb2"/>
+       <Container Visible="{²../cb.IsChecked}" Width="Stretched" Margin="10" Background="RoyalBlue"> 
+               <VerticalStack Width="Stretched" Margin="5" Background="Yellow">
+               <VerticalStack Width="Stretched" Margin="5" Background="Teal">
+               <VerticalStack Width="Stretched" Margin="1">
+                       <VerticalStack Width="Stretched" Margin="10" Background="FireBrick">
+                               <Label Text="{./Caption}" Width="Fit" Visible="{²../../../../../../cb2.IsChecked}"/> 
+                       </VerticalStack>
+               </VerticalStack>
+               </VerticalStack>
+               </VerticalStack>
+       </Container>
+</VerticalStack>
\ No newline at end of file