]> O.S.I.I.S - jp/crow.git/commitdiff
new layouting update through events
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 19:38:00 +0000 (20:38 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 19:38:00 +0000 (20:38 +0100)
Crow.userprefs
Tests/GOLIBTests.cs
Tests/Interfaces/5.crow [new file with mode: 0755]
Tests/Interfaces/testSpinner.goml
Tests/Interfaces/testWindow.goml
Tests/Tests.csproj
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/Spinner.cs

index a89a8f1f7be11402a66266f6545454a02da085d1..95e9d4fef076b12922ded4689aede63711328206 100644 (file)
@@ -1,17 +1,14 @@
 <Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|Linux_x86" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Tests/GOLIBTests.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/GenericStack.cs">
     <Files>
-      <File FileName="Tests/GOLIBTests.cs" Line="98" Column="2" />
-      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="538" Column="3" />
-      <File FileName="src/GraphicObjects/Group.cs" Line="197" Column="1" />
-      <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="127" Column="1" />
-      <File FileName="src/OpenTKGameWindow.cs" Line="328" Column="10" />
-      <File FileName="src/Rectangles.cs" Line="90" Column="21" />
-      <File FileName="src/GraphicObjects/Scroller.cs" Line="196" Column="1" />
-      <File FileName="src/LayoutingQueue.cs" Line="30" Column="4" />
-      <File FileName="src/Interface.cs" Line="56" Column="1" />
-      <File FileName="UnitTest/NUnitCrowWindow.cs" Line="163" Column="1" />
+      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="627" Column="5" />
+      <File FileName="src/GraphicObjects/Group.cs" Line="165" Column="15" />
+      <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="132" Column="57" />
+      <File FileName="src/GraphicObjects/GenericStack.cs" Line="170" Column="1" />
+      <File FileName="Tests/GOLIBTests.cs" Line="50" Column="11" />
+      <File FileName="Tests/Interfaces/0.crow" Line="1" Column="1" />
+      <File FileName="Tests/Interfaces/testWindow.goml" Line="22" Column="5" />
     </Files>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
index 1ac9bdc3be0a33190498e084eff7c142993eac5f..85d7d1dbe839dae38d58cfbf900717ec8fbba961 100644 (file)
@@ -37,6 +37,8 @@ namespace test
                int frameCpt = 0;
                int idx = 0;
                string[] testFiles = {
+                       "5.crow",
+                       "testSpinner.goml",
                        "testScrollbar.goml",
                        "4.crow",
                        "testColorList.crow",
@@ -48,7 +50,6 @@ namespace test
 //                     "testButton2.crow",
                        "test2WayBinding.crow",
                        "0.crow",
-                       "testSpinner.goml",
                        "fps.goml",
                        "testTextBox.crow",
                        "testImage.crow",
diff --git a/Tests/Interfaces/5.crow b/Tests/Interfaces/5.crow
new file mode 100755 (executable)
index 0000000..9133291
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<HorizontalStack Fit="true" Background="BlueCrayola" Margin="2">
+<!--   <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+       <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+       <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>-->
+       <Spinner Maximum="10000000000" SmallIncrement="100" Value="0"/>
+       <Spinner Maximum="10000000000" SmallIncrement="100" Value="0"/>
+       <GraphicObject Background="Green" Width="30" Height="20"/>
+</HorizontalStack>
+<!--<HorizontalStack Fit="true" Background="BlueCrayola" Margin="5">
+       <GraphicObject Background="Red" Width="30" Height="20"/>
+       <Spinner Maximum="10000000000" SmallIncrement="10" Value="0"/>
+       <GraphicObject Background="Green" Width="30" Height="20"/>
+</HorizontalStack>-->
\ No newline at end of file
index d0c6f076a1a1af3525afed5ef473e54b3668b488..224900af9a800b39da8308487f680c10e1d025f9 100755 (executable)
@@ -2,10 +2,10 @@
 <VerticalStack Name="TopContainer" Width="400" Height="-1"
        Margin="20" Background="DarkGray">
 
-       <HorizontalStack Fit="true">
-       <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
-       <Spinner Value="5"/>
-       <Spinner Value="5"/>
-       <Button></Button>
+       <HorizontalStack Fit="true" Margin="5" Background="SkyBlue">
+               <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
+               <Spinner Value="5"/>
+               <Spinner Value="5"/>
+               <Button/>
        </HorizontalStack>
 </VerticalStack>
\ No newline at end of file
index e32e0826b3eba3da3e9f97d5705803143d03c0a3..9824bf40533dfe130a271633c33d214c09b8f655 100755 (executable)
@@ -4,13 +4,11 @@
        <VerticalStack Name="contentVSStack" Margin="10" Spacing="10" Background="0,4;0,4;0,4;0,4">
                <Slider Name="slider" Height="12" Width="0" CornerRadius="3"/>
                <GroupBox Caption="test"  Height="-1" Width="0" Margin="5">
-                       <GroupBox Caption="test2"  Height="-1" Width="0" Margin="5">
-                               <VerticalStack  Height="-1" Width="0" >
-                                       <RadioButton  Caption="Radio 1" Background="Red" Width="0"/>
-                                       <RadioButton  Caption="Radio 2" IsChecked="true" />
-                                       <RadioButton  Caption="Radio 3" />
-                               </VerticalStack>
-                       </GroupBox>
+                       <VerticalStack  Height="-1" Width="0" >
+                               <RadioButton  Caption="Radio 1" Background="Red" Width="0"/>
+                               <RadioButton  Caption="Radio 2" IsChecked="true" />
+                               <RadioButton  Caption="Radio 3" />
+                       </VerticalStack>
                </GroupBox>
                <HorizontalStack Width="0" Height="-1" Margin="10" CornerRadius="5" 
                                Background="vgradient|0:White|0,1:SteelBlue|0,9:SteelBlue|1:Transparent">
                        <GraphicObject Width="0"/>
                        <CheckBox Height="-1" Width="80" IsChecked="true"/>
                </HorizontalStack>
-<Border Fit="true" CornerRadius="5" BorderWidth="1">
-       <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Width="120" Fit="true"
-               Margin="10" Focusable="True" >
-                       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
-                               <HorizontalStack Fit="true">
-                                       <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                               <HorizontalStack Fit="true">
-                                       <Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                               <HorizontalStack Fit="true">
-                                       <Label Text="Drawing:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                               <HorizontalStack Fit="true">
-                                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" 
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                               <HorizontalStack Fit="true">
-                                       <Label Text="Min:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                               <HorizontalStack Fit="true">
-                                       <Label Text="Max:" Width="50" TextAlignment="RightCenter"/>
-                                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
-                                               Background="vgradient|0:AoEnglish|1:Black"/>
-                               </HorizontalStack>
-                       </VerticalStack>                                
-       </Container>
-</Border>
-               <Border Fit="true" CornerRadius="5" BorderWidth="1">
+               <Border Fit="true" CornerRadius="5" BorderWidth="1" >
+                       <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Width="120" Fit="true"
+                               Margin="10" Focusable="True" >
+                                       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+                                               <HorizontalStack Fit="true">
+                                                       <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                               <HorizontalStack Fit="true">
+                                                       <Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Name="labLayouting" Text="{layouting}" Font="droid,12" Width="80" TextAlignment="Center"
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                               <HorizontalStack Fit="true">
+                                                       <Label Text="Drawing:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Name="labDrawing" Text="{drawing}" Font="droid,12" Width="80" TextAlignment="Center"
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                               <HorizontalStack Fit="true">
+                                                       <Label Name="captionFps" Text="Fps:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="50" TextAlignment="Center" 
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                               <HorizontalStack Fit="true">
+                                                       <Label Text="Min:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Text="{fpsMin}" Font="droid , 12" Width="50" TextAlignment="Center"
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                               <HorizontalStack Fit="true">
+                                                       <Label Text="Max:" Width="50" TextAlignment="RightCenter"/>
+                                                       <Label Text="{fpsMax}" Font="droid , 12" Width="50" TextAlignment="Center"
+                                                               Background="vgradient|0:AoEnglish|1:Black"/>
+                                               </HorizontalStack>
+                                       </VerticalStack>                                
+                       </Container>
+               </Border>
+               <Border Fit="true" CornerRadius="5" BorderWidth="1" >
                        <Container Name="MainGrp" Background="0,5;0,5;0,5;0,4" Fit="true" Margin="10">
                                        <VerticalStack Fit="true" Spacing="10" >
                                                <HorizontalStack Fit="true">
                                                        <Label Text="Layouting:" Width="50" TextAlignment="RightCenter"/>
                                                        <Label Text="{layouting}" Font="droid,12" Background="vgradient|0:AoEnglish|1:Black"/>
                                                </HorizontalStack>
-                                       </VerticalStack>                                
+                                       </VerticalStack>
                        </Container>
                </Border>
+               <HorizontalStack Fit="true" Background="BlueCrayola" Margin="3">
+                       <GraphicObject Margin="10" Background="LimeGreen" Width="5" Height="5"/>
+                       <TextBox Font="droid, 16" Multiline="true" Text="this is a test\nmultiline" Margin="2"/>
+                       <GraphicObject Margin="10" Background="LimeGreen" Width="5" Height="5"/>
+               </HorizontalStack>
 <!--           <Checkbox Height="-1" Width="-1" Background="Red" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
        </VerticalStack>
 </Window>
index 3403568e80ec85b00e80a943e40684257970d47e..b1700f1e988e0d8a87dff9f801f65b4e7d03cc7a 100644 (file)
     <None Include="Interfaces\4.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\5.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
index 92e944bb1c3f6bb413725b2d8039482200ee30a8..d4e3ae5d1186c4c05d4f1819975643d36d87c225 100644 (file)
@@ -105,6 +105,7 @@ namespace Crow
                                        c.RegisterForLayouting ((int)LayoutingType.X);
                                }
                        }
+                       bmp = null;
                }
 
                public override void RegisterForLayouting (int layoutType)
@@ -171,6 +172,42 @@ namespace Crow
                        }else
                                base.UpdateLayout(layoutType);
         }
+               public override void OnLayoutChanges (LayoutingType layoutType)
+               {
+                       base.OnLayoutChanges (layoutType);
+
+                       if (Orientation == Orientation.Horizontal){
+                               if(layoutType == LayoutingType.Width)
+                                       this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+                       }else if (layoutType == LayoutingType.Height)
+                               this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+               }
+               public override void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+               {
+                       base.OnChildLayoutChanges (sender, arg);
+
+                       GraphicObject g = sender as GraphicObject;
+                       switch (arg.LayoutType) {
+                       case LayoutingType.X:
+                               break;
+                       case LayoutingType.Y:
+                               break;
+                       case LayoutingType.Width:
+                               if (Orientation == Orientation.Horizontal) {
+                                       if (this.Bounds.Width < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Width);
+                                       this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+                               }
+                               break;
+                       case LayoutingType.Height:
+                               if (Orientation == Orientation.Vertical) {
+                                       if (this.Bounds.Height < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Height);
+                                       this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
+                               }
+                               break;
+                       }
+               }
                #endregion
 
     
index fe010d6ac0042b4a99ceef2e2e24621ad0b24dc1..53dee9cc286c1a4c1d5782936bb6686f956e120e 100644 (file)
@@ -565,44 +565,12 @@ namespace Crow
                        
                        switch (layoutType) {
                        case LayoutingType.Width:                               
-                               if (Parent.getBounds ().Width < 0) {
-                                       Group gw = Parent as Group;
-                                       if (gw != null) {
-                                               if (Slot.Width > gw.maxChildrenWidth)
-                                                       gw.maxChildrenWidth = Slot.Width;
-                                       }
-                                       this.Parent.RegisterForLayouting ((int)LayoutingType.Width);
-                               }else if (Width != 0) //update position in parent
+                               if (Width != 0 && Parent.getBounds().Width >=0) //update position in parent
                                        this.RegisterForLayouting ((int)LayoutingType.X);
-                               GenericStack gsw = Parent as GenericStack;
-                               if (gsw == null)
-                                       break;  
-                               if ((Parent as GenericStack).Orientation == Orientation.Horizontal) {
-//                                     ulong idx = (ulong)gsw.Children.IndexOf (this);
-//                                     if (idx < gsw.stackingUpdateStartIndex)
-//                                             gsw.stackingUpdateStartIndex = idx;
-                                       this.Parent.RegisterForLayouting ((int)LayoutingType.PositionChildren);
-                               }
                                break;
                        case LayoutingType.Height:
-                               if (Parent.getBounds ().Height < 0) {
-                                       Group gh = Parent as Group;
-                                       if (gh != null) {
-                                               if (Slot.Width > gh.maxChildrenHeight)
-                                                       gh.maxChildrenHeight = Slot.Height;
-                                       }
-                                       this.Parent.RegisterForLayouting ((int)LayoutingType.Height);
-                               }else if (Height != 0) //update position in parent
+                               if (Height != 0 && Parent.getBounds().Height >=0) //update position in parent
                                        this.RegisterForLayouting ((int)LayoutingType.Y);
-                               GenericStack gsh = Parent as GenericStack;
-                               if (gsh==null)
-                                       break;                          
-                               if (gsh.Orientation == Orientation.Vertical) {
-//                                     ulong idx = (ulong)gsh.Children.IndexOf (this);
-//                                     if (idx < gsh.stackingUpdateStartIndex)
-//                                             gsh.stackingUpdateStartIndex = idx;
-                                       this.Parent.RegisterForLayouting ((int)LayoutingType.PositionChildren);
-                               }
                                break;
                        }
                        LayoutChanged.Raise (this, new LayoutChangeEventArgs (layoutType));
index 7f952ac1c0cffa3b7dd6065f5c823c465b9cd7e7..a9870c7842bdea71a0295e34aaf30d5cc6e9ec89 100644 (file)
@@ -25,6 +25,8 @@ namespace Crow
 
                internal int maxChildrenWidth = 0;
                internal int maxChildrenHeight = 0;
+               internal GraphicObject largestChild = null;
+               internal GraphicObject tallestChild = null;
 
         bool _multiSelect = false;
                List<GraphicObject> children = new List<GraphicObject>();
@@ -49,10 +51,12 @@ namespace Crow
             Children.Add(g);
             g.Parent = this as GraphicObject;            
                        g.RegisterForLayouting ((int)LayoutingType.Sizing);
+                       g.LayoutChanged += OnChildLayoutChanges;
             return (T)child;
         }
         public virtual void removeChild(GraphicObject child)        
-               {                       
+               {
+                       child.LayoutChanged -= OnChildLayoutChanges;
                        child.ClearBinding ();
                        child.Parent = null;
             Children.Remove(child);
@@ -60,12 +64,14 @@ namespace Crow
         }
                public virtual void ClearChildren()
                {
-                       int lim = children.Count;
-                       for (int i = 0; i < lim; i++) {
-                               GraphicObject g = Children [0];
+                       int cpt = children.Count;
+                       while(cpt > 0){
+                               GraphicObject g = children[cpt-1];
+                               g.LayoutChanged -= OnChildLayoutChanges;
                                g.ClearBinding ();
                                g.Parent = null;
-                               Children.Remove(g);                             
+                               Children.RemoveAt(cpt-1);
+                               cpt = children.Count;
                        }
                        this.RegisterForLayouting ((int)LayoutingType.Sizing);
                        ChildrenCleared.Raise (this, new EventArgs ());
@@ -86,7 +92,7 @@ namespace Crow
                                Children.Insert(0, w);
                        }
                }
-                       
+
                #region GraphicObject overrides
                [XmlIgnore]public override bool DrawingIsValid {
                        get {
@@ -136,16 +142,9 @@ namespace Crow
                {
                        base.OnLayoutChanges (layoutType);
 
-                       GenericStack gs = this as GenericStack;
                        //position smaller objects in group when group size is fit
                        switch (layoutType) {
                        case LayoutingType.Width:
-                               if (gs != null) {
-                                       if (gs.Orientation == Orientation.Horizontal) {
-                                               this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
-                                               break;
-                                       }
-                               }       
                                foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
                                        if (c.getBounds ().Width == 0)
                                                c.RegisterForLayouting ((int)LayoutingType.Width);
@@ -154,12 +153,6 @@ namespace Crow
                                }
                                break;
                        case LayoutingType.Height:
-                               if (gs != null) {
-                                       if (gs.Orientation == Orientation.Vertical) {
-                                               this.RegisterForLayouting ((int)LayoutingType.PositionChildren);
-                                               break;
-                                       }
-                               }
                                foreach (GraphicObject c in Children.Where(ch => ch.Visible)) {
                                        if (c.getBounds ().Height == 0)
                                                c.RegisterForLayouting ((int)LayoutingType.Height);
@@ -169,7 +162,56 @@ namespace Crow
                                break;
                        }
                }
-
+               public virtual void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+               {
+                       GraphicObject g = sender as GraphicObject;
+                       switch (arg.LayoutType) {
+                       case LayoutingType.X:
+                               break;
+                       case LayoutingType.Y:
+                               break;
+                       case LayoutingType.Width:
+                               if (g.Slot.Width > maxChildrenWidth) {
+                                       maxChildrenWidth = g.Slot.Width;
+                                       largestChild = g;
+                                       if (this.Bounds.Width < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Width);
+                               } else if (g == largestChild) {
+                                       //search for the new largest child
+                                       largestChild = null;
+                                       maxChildrenWidth = 0;
+                                       for (int i = 0; i < children.Count; i++) {
+                                               if (children [i].Slot.Width > maxChildrenWidth) {
+                                                       maxChildrenWidth = children [i].Slot.Width;
+                                                       largestChild = children [i];
+                                               }
+                                       }
+                                       if (this.Bounds.Width < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Width);
+                               }
+                               break;
+                       case LayoutingType.Height:
+                               if (g.Slot.Height > maxChildrenHeight) {
+                                       maxChildrenHeight = g.Slot.Height;
+                                       tallestChild = g;
+                                       if (this.Bounds.Height < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Height);
+                               } else if (g == tallestChild) {
+                                       //search for the new tallest child
+                                       tallestChild = null;
+                                       maxChildrenHeight = 0;
+                                       for (int i = 0; i < children.Count; i++) {
+                                               if (children [i].Slot.Height > maxChildrenHeight) {
+                                                       maxChildrenHeight = children [i].Slot.Height;
+                                                       tallestChild = children [i];
+                                               }
+                                       }
+                                       if (this.Bounds.Height < 0)
+                                               this.RegisterForLayouting ((int)LayoutingType.Height);
+                               }
+                               break;
+                       }
+               }
                public override Rectangle ContextCoordinates(Rectangle r){
                        return r + ClientRectangle.Position;
                }       
index f4190f9bc1c74bc6d0de60f4421d5f4d326a75af..9b312c14c163b9ee8ca5ccf52e7fa7e213287ad3 100644 (file)
@@ -52,6 +52,7 @@ namespace Crow
                {
 
                        if (child != null) {
+                               child.LayoutChanged -= OnChildLayoutChanges;
                                this.RegisterForLayouting ((int)LayoutingType.Sizing);
                                child.Parent = null;
                        }
@@ -60,6 +61,7 @@ namespace Crow
 
                        if (child != null) {
                                child.Parent = this;
+                               child.LayoutChanged += OnChildLayoutChanges;
                                child.RegisterForLayouting ((int)LayoutingType.Sizing);
                        }
 
@@ -117,6 +119,24 @@ namespace Crow
                                break;
                        }                                                       
                }
+               public virtual void OnChildLayoutChanges (object sender, LayoutChangeEventArgs arg)
+               {
+                       GraphicObject g = sender as GraphicObject;
+                       switch (arg.LayoutType) {
+                       case LayoutingType.X:
+                               break;
+                       case LayoutingType.Y:
+                               break;
+                       case LayoutingType.Width:
+                               if (this.Bounds.Width < 0)
+                                       this.RegisterForLayouting ((int)LayoutingType.Width);
+                               break;
+                       case LayoutingType.Height:
+                               if (this.Bounds.Height < 0)
+                                       this.RegisterForLayouting ((int)LayoutingType.Height);
+                               break;
+                       }
+               }
 
                public override Rectangle ContextCoordinates (Rectangle r)
                {
index a44abb1345e814a81d0236a1021ee26dcda5ae59..49d323e0b1c3fcaa84cea4d007a8818f6db93580 100644 (file)
@@ -35,29 +35,12 @@ namespace Crow
                {
                }
 
-               #region implemented abstract members of TemplatedControl
-
-               protected override void loadTemplate (GraphicObject template = null)
-               {
-                       base.loadTemplate (template);                   
-               }
-
-               #endregion
-
                void onUp (object sender, MouseButtonEventArgs e)
                {
-//                     decimal tmp = 0;
-//                     if (!decimal.TryParse (labCpt.Text, out tmp))
-//                             return;
-
                        Value += this.SmallIncrement;
                }
                void onDown (object sender, MouseButtonEventArgs e)
                {
-//                     decimal tmp = 0;
-//                     if (!decimal.TryParse (labCpt.Text, out tmp))
-//                             return;
-
                        Value -= this.SmallIncrement;
                }