From: jpbruyere Date: Sat, 23 Apr 2016 09:44:02 +0000 (+0200) Subject: DEBIG_FOCUS; min size returned for base GraphObj when in Fit mode X-Git-Tag: v0.4~62 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=b3c2c1f21e96418d6b3a91ff75a182e84cb5b6a5;p=jp%2Fcrow.git DEBIG_FOCUS; min size returned for base GraphObj when in Fit mode --- diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 1750e11e..4e230d4f 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -666,7 +666,9 @@ namespace Crow } /// return size of content + margins 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; } /// By default in groups, LayoutingType.ArrangeChildren is reset 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 diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index f4bc3aba..99b85dd2 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -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) { diff --git a/src/Interface.cs b/src/Interface.cs index 939fc560..063a34de 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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 {