]> O.S.I.I.S - jp/crow.git/commitdiff
DEBIG_FOCUS; min size returned for base GraphObj when in Fit mode
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 23 Apr 2016 09:44:02 +0000 (11:44 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 23 Apr 2016 09:44:02 +0000 (11:44 +0200)
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/PrivateContainer.cs
src/Interface.cs

index 1750e11e89c2150277c10c21576506cb3179d97d..4e230d4fc19d5858ab30f73fd893d69094742549 100644 (file)
@@ -666,7 +666,9 @@ namespace Crow
                }
                /// <summary> return size of content + margins </summary>
                protected virtual int measureRawSize (LayoutingType lt) {
-                       return lt == LayoutingType.Width ? Width : Height;
+                       return lt == LayoutingType.Width ? 
+                               Width == Measure.Fit ? MinimumSize.Width : (int)Width :
+                               Height == Measure.Fit ? MinimumSize.Height : (int)Height;
                }
                /// <summary> By default in groups, LayoutingType.ArrangeChildren is reset </summary>
                public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){
@@ -813,7 +815,7 @@ namespace Crow
                                else
                                        Slot.Width = (int)Math.Round((double)(Parent.ClientRectangle.Width * Width) / 100.0);
 
-                               if (Slot.Width == int.MinValue)
+                               if (Slot.Width < 0)
                                        return false;
 
                                //size constrain
@@ -846,7 +848,7 @@ namespace Crow
                                else
                                        Slot.Height = (int)Math.Round((double)(Parent.ClientRectangle.Height * Height) / 100.0);
 
-                               if (Slot.Height == int.MinValue)
+                               if (Slot.Height < 0)
                                        return false;
 
                                //size constrain
@@ -1040,19 +1042,32 @@ namespace Crow
                        MouseWheelChanged.Raise (this, e);
                }
                public virtual void onFocused(object sender, EventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("Focused => " + this.ToString());
+                       #endif
                        Focused.Raise (this, e);
                        this.HasFocus = true;
                }
                public virtual void onUnfocused(object sender, EventArgs e){
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("UnFocused => " + this.ToString());
+                       #endif
+
                        Unfocused.Raise (this, e);
                        this.HasFocus = false;
                }
                public virtual void onMouseEnter(object sender, MouseMoveEventArgs e)
                {
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("MouseEnter => " + this.ToString());
+                       #endif
                        MouseEnter.Raise (this, e);
                }
                public virtual void onMouseLeave(object sender, MouseMoveEventArgs e)
                {
+                       #if DEBUG_FOCUS
+                       Debug.WriteLine("MouseLeave => " + this.ToString());
+                       #endif
                        MouseLeave.Raise (this, e);
                }
                #endregion
index f4bc3aba28b684c715c6bec6a58a60ba6ead5b7f..99b85dd22116e5015fed155101f6be9bca7cc5dd 100644 (file)
@@ -96,10 +96,10 @@ namespace Crow
                                return base.measureRawSize (lt);
                        if (lt == LayoutingType.Width)
                                return child.RegisteredLayoutings.HasFlag(LayoutingType.Width) ?
-                                       int.MinValue : child.Slot.Size.Width + 2 * Margin;
+                                       -1 : child.Slot.Size.Width + 2 * Margin;
                        else
                                return child.RegisteredLayoutings.HasFlag(LayoutingType.Height) ?
-                                       int.MinValue : child.Slot.Size.Height + 2 * Margin;
+                                       -1 : child.Slot.Size.Height + 2 * Margin;
                }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
index 939fc5607cc117fddb06ca4bc429c1879843d5b5..063a34dea6584081020cffdd1fd30d355e154173 100644 (file)
@@ -283,7 +283,15 @@ namespace Crow
                                _activeWidget = value;
 
                                if (_activeWidget != null)
+                               {
                                        _activeWidget.IsActive = true;
+                                       #if DEBUG_FOCUS
+                                       Debug.WriteLine("Active => " + _activeWidget.ToString());
+                               }else
+                                       Debug.WriteLine("Active => null");
+                                       #else
+                               }
+                                       #endif
                        }
                }
                public GraphicObject hoverWidget
@@ -293,6 +301,12 @@ namespace Crow
                                if (_hoverWidget == value)
                                        return;
                                _hoverWidget = value;
+                               #if DEBUG_FOCUS
+                               if (_hoverWidget != null)
+                               Debug.WriteLine("Hover => " + _hoverWidget.ToString());
+                               else
+                               Debug.WriteLine("Hover => null");
+                               #endif
                        }
                }
                public GraphicObject FocusedWidget {