]> O.S.I.I.S - jp/crow.git/commitdiff
remove Bounds rectangle as private field for dims
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 21 Mar 2016 07:53:31 +0000 (08:53 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 14 Apr 2016 10:44:46 +0000 (12:44 +0200)
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ILayoutable.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/TextRun.cs
src/Interface.cs

index 362143fac50e3f8bd7f8f385796a5a37a3ef9e0f..925f908a49cac3b0ab9926e15cca4e174ec2670c 100644 (file)
@@ -221,14 +221,14 @@ namespace Crow
                        switch (arg.LayoutType) {
                        case LayoutingType.Width:
                                if (Orientation == Orientation.Horizontal) {
-                                       if (this.Bounds.Width < 0)
+                                       if (Width < 0)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                        this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                                }
                                break;
                        case LayoutingType.Height:
                                if (Orientation == Orientation.Vertical) {
-                                       if (this.Bounds.Height < 0)
+                                       if (Height < 0)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                        this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                                }
index 81ec72a69bd7fbae96f506dc2c1a28a7e809af14..7b58f652260fee78d55bee118b5bde5b5d1021a6 100644 (file)
@@ -60,7 +60,10 @@ namespace Crow
                                return;
 
                        loadDefaultValues ();
-                       Bounds = _bounds;
+                       Left = _bounds.Left;
+                       Top = _bounds.Top;
+                       Width = _bounds.Width;
+                       Height = _bounds.Height;
                }
                #endregion
 
@@ -92,7 +95,7 @@ namespace Crow
                /// <summary>
                /// Original size and position 0=Stretched; -1=Fit
                /// </summary>
-               public Rectangle Bounds;
+               int _width, _height, _left, _top;
                /// <summary>
                /// Current size and position computed during layouting pass
                /// </summary>
@@ -151,7 +154,6 @@ namespace Crow
                                Parent.ScreenCoordinates(r) + Parent.getSlot().Position + Parent.ClientRectangle.Position;
                }
                public virtual Rectangle getSlot() => Slot;
-               public virtual Rectangle getBounds() => Bounds;
                #endregion
 
                #region EVENT HANDLERS
@@ -215,37 +217,37 @@ namespace Crow
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
                public virtual int Left {
-                       get { return Bounds.X; }
+                       get { return _left; }
                        set {
-                               if (Bounds.X == value)
+                               if (_left == value)
                                        return;
 
-                               Bounds.X = value;
-                               NotifyValueChanged ("Left", Bounds.X);
+                               _left = value;
+                               NotifyValueChanged ("Left", _left);
                                this.RegisterForLayouting (LayoutingType.X);
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
                public virtual int Top {
-                       get { return Bounds.Y; }
+                       get { return _top; }
                        set {
-                               if (Bounds.Y == value)
+                               if (_top == value)
                                        return;
 
-                               Bounds.Y = value;
-                               NotifyValueChanged ("Top", Bounds.Y);
+                               _top = value;
+                               NotifyValueChanged ("Top", _top);
                                this.RegisterForLayouting (LayoutingType.Y);
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
                public virtual int Width {
-                       get { return Bounds.Width; }
+                       get { return _width; }
                        set {
-                               if (Bounds.Width == value)
+                               if (_width == value)
                                        return;
 
-                               Bounds.Width = value;
-                               NotifyValueChanged ("Width", Bounds.Width);
+                               _width = value;
+                               NotifyValueChanged ("Width", _width);
                                NotifyValueChanged ("WidthPolicy", WidthPolicy);
 
                                this.RegisterForLayouting (LayoutingType.Width);
@@ -253,13 +255,13 @@ namespace Crow
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
                public virtual int Height {
-                       get { return Bounds.Height; }
+                       get { return _height; }
                        set {
-                               if (Bounds.Height == value)
+                               if (_height == value)
                                        return;
 
-                               Bounds.Height = value;
-                               NotifyValueChanged ("Height", Bounds.Height);
+                               _height = value;
+                               NotifyValueChanged ("Height", _height);
                                NotifyValueChanged ("HeightPolicy", HeightPolicy);
 
                                this.RegisterForLayouting (LayoutingType.Height);
@@ -662,7 +664,7 @@ namespace Crow
                }
                /// <summary> return size of content + margins </summary>
                protected virtual int measureRawSize (LayoutingType lt) {
-                       return lt == LayoutingType.Width ? Bounds.Size.Width : Bounds.Size.Height;
+                       return lt == LayoutingType.Width ? Width : Height;
                }
                /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
                public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
@@ -738,7 +740,7 @@ namespace Crow
 
                        switch (layoutType) {
                        case LayoutingType.X:
-                               if (Bounds.X == 0) {
+                               if (Left == 0) {
 
                                        if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
                                                RegisteredLayoutings.HasFlag (LayoutingType.Width))
@@ -756,7 +758,7 @@ namespace Crow
                                                break;
                                        }
                                } else
-                                       Slot.X = Bounds.X;
+                                       Slot.X = Left;
 
                                if (LastSlots.X == Slot.X)
                                        break;
@@ -768,7 +770,7 @@ namespace Crow
                                LastSlots.X = Slot.X;
                                break;
                        case LayoutingType.Y:
-                               if (Bounds.Y == 0) {
+                               if (Top == 0) {
 
                                        if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
                                                RegisteredLayoutings.HasFlag (LayoutingType.Height))
@@ -786,7 +788,7 @@ namespace Crow
                                                break;
                                        }
                                }else
-                                       Slot.Y = Bounds.Y;
+                                       Slot.Y = Top;
 
                                if (LastSlots.Y == Slot.Y)
                                        break;
index 7ea37161fecc65f2118be0e80f4471bcafddce63..47795b06b1b1fce1dc0d4da37c9f2c56b5de61fe 100644 (file)
@@ -178,14 +178,14 @@ namespace Crow
                                if (g.Slot.Width > maxChildrenWidth) {
                                        maxChildrenWidth = g.Slot.Width;
                                        largestChild = g;
-                                       if (this.Bounds.Width < 0)
+                                       if (Width < 0)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                } else if (g == largestChild) {
 
                                        largestChild = null;
                                        maxChildrenWidth = 0;
 
-                                       if (this.Bounds.Width < 0)
+                                       if (Width < 0)
                                                this.RegisterForLayouting (LayoutingType.Width);
                                }
                                break;
@@ -193,14 +193,14 @@ namespace Crow
                                if (g.Slot.Height > maxChildrenHeight) {
                                        maxChildrenHeight = g.Slot.Height;
                                        tallestChild = g;
-                                       if (this.Bounds.Height < 0)
+                                       if (Height < 0)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                } else if (g == tallestChild) {
 
                                        tallestChild = null;
                                        maxChildrenHeight = 0;
 
-                                       if (this.Bounds.Height < 0)
+                                       if (Height < 0)
                                                this.RegisterForLayouting (LayoutingType.Height);
                                }
                                break;
index a8df3ae0a453c320a361f54bc316b9970c0c3a75..b48e815a11a6f1cc0607a019118d7a6daf015268 100644 (file)
@@ -15,7 +15,6 @@ namespace Crow
 
                Rectangle ClientRectangle { get; }
                Rectangle getSlot();
-               Rectangle getBounds();
 
                bool ArrangeChildren { get; }
                LayoutingType RegisteredLayoutings { get; set; }
index 6d0bf471f727af31253ae9a8d264e9fbcdc5e79c..c28f090c5be50d62237c5afb66e62f53292c1ae8 100644 (file)
@@ -397,7 +397,7 @@ namespace Crow
                        Rectangle cb = ClientRectangle;
 
                        //ignore text alignment if size to content = true
-                       if (Bounds.Size < 0)
+                       if (Width < 0 || Height < 0)
                        {
                                rText.X = cb.X;
                                rText.Y = cb.Y;
index a399567c8619bf0e2d88cff19d07942ba4c22419..f3385a8840a90fa24320272ba4d4af3d026266bc 100644 (file)
@@ -144,11 +144,11 @@ namespace Crow
                        case LayoutingType.Y:
                                break;
                        case LayoutingType.Width:
-                               if (this.Bounds.Width < 0)
+                               if (Width < 0)
                                        this.RegisterForLayouting (LayoutingType.Width);
                                break;
                        case LayoutingType.Height:
-                               if (this.Bounds.Height < 0)
+                               if (Height < 0)
                                        this.RegisterForLayouting (LayoutingType.Height);
                                break;
                        }
index 15f024afc5f4ec8db0413dbe387d467dc69344d3..021d5654b5f8e98957518a13757124384006945b 100644 (file)
@@ -206,7 +206,7 @@ namespace Crow
 
                        //ignore text alignment if size to content = true
                        //or if text size is larger than client bounds
-                       if (Bounds.Size < 0 || rText.Width > cb.Width)
+                       if (Width < 0 || Height < 0 || rText.Width > cb.Width)
                        {
                                rText.X = cb.X;
                                rText.Y = cb.Y;
index 41199fcc28b42fc49b60952b30e20900927a945e..939fc5607cc117fddb06ca4bc429c1879843d5b5 100644 (file)
@@ -729,7 +729,6 @@ namespace Crow
                        get { return this; }
                }
                public Rectangle getSlot () => ClientRectangle;
-               public Rectangle getBounds () => ClientRectangle;
                #endregion
        }
 }