]> O.S.I.I.S - jp/crow.git/commitdiff
resolved Checkbox bug (template was modified), adjust several layout registering
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 16:01:28 +0000 (17:01 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 16:01:28 +0000 (17:01 +0100)
Templates/CheckBox.goml
Tests/Interfaces/testWindow.goml
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs

index 799bde1eadebf7809941930bef5522f2e0b29d96..b1b224d8edb4223875f477db8b139efbb771e849 100755 (executable)
@@ -3,8 +3,8 @@
        <Image Margin="2" Width="14" Height="14" Path="{../../Image}"  SvgSub="{../../SvgSub}"/>
        <Label Text="{../../Caption}" Height="80" Width="200"/>
 </HorizontalStack>-->
-<!--<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
+<HorizontalStack Spacing="1" Height="{../TemplatedHeight}" Width="{../TemplatedWidth}">
        <Image Margin="2" Width="14" Height="14" Path="{../../Image}" SvgSub="{../../SvgSub}"/>
        <Label Text="{../../Caption}" Height="{../../TemplatedHeight}" Width="{../../TemplatedWidth}"/>
-</HorizontalStack>-->
-<GraphicObject Text="{../Caption}" Height="20" Width="{../TemplatedWidth}"/>
\ No newline at end of file
+</HorizontalStack>
+<!--<GraphicObject Text="{../Caption}" Height="20" Width="{../TemplatedWidth}"/>-->
\ No newline at end of file
index 5a1e7a9787325b23d8ff2cca595f7604d81fc842..4febd81fbde1d5b78ced12a875533882cbf321bd 100755 (executable)
                                <RadioButton  Caption="Radio 1" Background="SkyBlue" Width="0"/>
                        </VerticalStack>
                </GroupBox>
+               <HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5" Background="SkyBlue">
+<!--                   <VerticalStack  Height="-1" Width="-1" >
+                               <RadioButton  Caption="Radio 2" IsChecked="true" />
+                               <RadioButton  Caption="Radio 3" />
+                       </VerticalStack>
+                       <VerticalStack  Height="-1" Width="-1" >
+                               <RadioButton  Caption="Radio 2" IsChecked="true" />
+                               <RadioButton  Caption="Radio 3" />
+                       </VerticalStack>-->
+                       <RadioButton Width="80" Height="-1"  Caption="Radio 2" IsChecked="true" />
+                       <GraphicObject Width="0"/>
+                       <RadioButton Width="80" Height="-1" Caption="Radio 3" />
+               </HorizontalStack>
+
                <HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5" 
                                Background="vgradient|0:White|0,1:SteelBlue|0,9:SteelBlue|1:Transparent">
                        <CheckBox Height="-1" Width="80"/>
index 5de21fac2272b2dfa8be55cd16f539569858a6da..291d300dcc780f65fe9bc4b3a8aaefb5df9cb0a2 100644 (file)
@@ -66,14 +66,18 @@ namespace Crow
                        Size tmp = new Size ();
 
                        if (Orientation == Orientation.Horizontal) {
-                               foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;                                       
                                        tmp.Width += c.Slot.Width + Spacing;
                                        tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height));
                                }
                                if (tmp.Width > 0)
                                        tmp.Width -= Spacing;
                        } else {
-                               foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;                                       
                                        tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width));
                                        tmp.Height += c.Slot.Height + Spacing;
                                }
@@ -93,18 +97,20 @@ namespace Crow
                        #endif
                        int d = 0;
                        if (Orientation == Orientation.Horizontal) {
-                               foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;
                                        c.Slot.X = d;
                                        d += c.Slot.Width + Spacing;
-                                       if (c.Height != 0)
-                                               c.RegisterForLayouting (LayoutingType.Y);
+                                       c.RegisterForLayouting (LayoutingType.Y);
                                }
                        } else {
-                               foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) {
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;                                       
                                        c.Slot.Y = d;
                                        d += c.Slot.Height + Spacing;
-                                       if (c.Width != 0)
-                                               c.RegisterForLayouting (LayoutingType.X);
+                                       c.RegisterForLayouting (LayoutingType.X);
                                }
                        }
                        bmp = null;
@@ -114,6 +120,19 @@ namespace Crow
         {
                        RegisteredLayoutings &= (~layoutType);
 
+                       LayoutingType childSizeToCheck;
+                       if (Orientation == Orientation.Horizontal)
+                               childSizeToCheck = LayoutingType.Width;
+                       else
+                               childSizeToCheck = LayoutingType.Height;
+
+                       foreach (GraphicObject g in Children) {
+                               if (!g.Visible)
+                                       continue;
+                               if (g.RegisteredLayoutings.HasFlag (childSizeToCheck))
+                                       return false;                                           
+                       }
+
                        if (layoutType == LayoutingType.PositionChildren) {
                                //allow 1 child to have size to 0 if stack has fixed or streched size,
                                //this child will occupy remaining space
@@ -170,16 +189,16 @@ namespace Crow
 
                        return base.UpdateLayout(layoutType);
         }
-               public override void OnLayoutChanges (LayoutingType layoutType)
-               {
-                       base.OnLayoutChanges (layoutType);
-
-                       if (Orientation == Orientation.Horizontal){
-                               if(layoutType == LayoutingType.Width)
-                                       this.RegisterForLayouting (LayoutingType.PositionChildren);
-                       }else if (layoutType == LayoutingType.Height)
-                               this.RegisterForLayouting (LayoutingType.PositionChildren);
-               }
+//             public override void OnLayoutChanges (LayoutingType layoutType)
+//             {
+//                     base.OnLayoutChanges (layoutType);
+//
+//                     if (Orientation == Orientation.Horizontal){
+//                             if(layoutType == LayoutingType.Width)
+//                                     this.RegisterForLayouting (LayoutingType.PositionChildren);
+//                     }else if (layoutType == LayoutingType.Height)
+//                             this.RegisterForLayouting (LayoutingType.PositionChildren);
+//             }
                public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg)
                {
                        base.OnChildLayoutChanges (sender, arg);
index 4d00b99aae9361197692b47c244ad0677e9d95a9..40f5dcf71f27e719e88e1d4aaa275d63161dc4b5 100644 (file)
@@ -549,13 +549,11 @@ namespace Crow
                        #endif
 
                        switch (layoutType) {
-                       case LayoutingType.Width:                               
-                               if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
-                                       this.RegisterForLayouting (LayoutingType.X);
+                       case LayoutingType.Width:
+                               this.RegisterForLayouting (LayoutingType.X);
                                break;
                        case LayoutingType.Height:
-                               if (Height != 0 && Parent.getBounds().Height >=0) //update position in parent
-                                       this.RegisterForLayouting (LayoutingType.Y);
+                               this.RegisterForLayouting (LayoutingType.Y);
                                break;
                        }
                        LayoutChanged.Raise (this, new LayoutingEventArgs (layoutType));
index 457187c6a7ebecf45d814f098acfd66cf1b26e8e..9006191d46408836be2236e2f1fd21960e746be7 100644 (file)
@@ -145,20 +145,17 @@ namespace Crow
                        //position smaller objects in group when group size is fit
                        switch (layoutType) {
                        case LayoutingType.Width:
-                               foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
-                                       if (c.getBounds ().Width == 0)
-                                               c.RegisterForLayouting (LayoutingType.Width);
-                                       else
-                                               c.RegisterForLayouting (LayoutingType.X);                                       
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;                                       
+                                       c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
-                               foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
-                                       if (c.getBounds ().Height == 0)
-                                               c.RegisterForLayouting (LayoutingType.Height);
-                                       else
-                                               c.RegisterForLayouting (LayoutingType.Y);
-                               }
+                               foreach (GraphicObject c in Children) {
+                                       if (!c.Visible)
+                                               continue;
+                                       c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);                                }
                                break;
                        }
                }
index 15d3ce060661b4645a67c45d9dd5c9900c049bb5..9f787eac0a7021b24ec23621f2a0a9eed1a34731 100644 (file)
@@ -103,18 +103,14 @@ namespace Crow
                        switch (layoutType) {
                        case LayoutingType.Width:                                                               
                                if (child != null) {
-                                       if (child.getBounds ().Width == 0)
-                                               child.RegisterForLayouting (LayoutingType.Width);
-                                       else
-                                               child.RegisterForLayouting (LayoutingType.X);
+                                       if (child.Visible)
+                                               child.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
                                }
                                break;
                        case LayoutingType.Height:
                                if (child != null) {
-                                       if (child.getBounds ().Height == 0)
-                                               child.RegisterForLayouting (LayoutingType.Height);
-                                       else
-                                               child.RegisterForLayouting (LayoutingType.Y);
+                                       if (child.Visible)
+                                               child.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
                                }
                                break;
                        }