diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-03-21 09:54:13 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-03-21 09:54:13 +0100 |
| commit | a261638fb3b5bf2c18771d5bd09dc0cf5bd13dfd (patch) | |
| tree | d675243160ad466eacfebf1fd71c0a9551020b2d /src/GraphicObjects | |
| parent | 83ad80465a095a9cd62bae550058df1e3981cb0b (diff) | |
add active,focused and hover checks when go is removed from screen, triggger mouse move if go is last hover widget
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index f404b5f1..bc955368 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -154,6 +154,7 @@ namespace Crow GC.SuppressFinalize(this); } ~GraphicObject(){ + Debug.WriteLine(this.ToString() + " not disposed by user"); Dispose(false); } protected virtual void Dispose(bool disposing){ @@ -171,18 +172,8 @@ namespace Crow throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString()); #endif - if (IFace.HoverWidget != null) { - if (IFace.HoverWidget.IsOrIsInside(this)) - IFace.HoverWidget = null; - } - if (IFace.ActiveWidget != null) { - if (IFace.ActiveWidget.IsOrIsInside (this)) - IFace.ActiveWidget = null; - } - if (IFace.FocusedWidget != null) { - if (IFace.FocusedWidget.IsOrIsInside (this)) - IFace.FocusedWidget = null; - } + unshownPostActions (); + if (!localDataSourceIsNull) DataSource = null; @@ -869,8 +860,8 @@ namespace Crow RegisterForLayouting (LayoutingType.Sizing); - //trigger a mouse to handle possible hover changes - //CurrentInterface.ProcessMouseMove (CurrentInterface.Mouse.X, CurrentInterface.Mouse.Y); + if (!isVisible) + unshownPostActions (); NotifyValueChanged ("Visible", isVisible); } @@ -1442,17 +1433,6 @@ namespace Crow /// <summary> trigger dependant sizing component update </summary> public virtual void OnLayoutChanges(LayoutingType layoutType) { - #if DEBUG_LAYOUTING - IFace.currentLQI.Slot = LastSlots; - IFace.currentLQI.NewSlot = Slot; - Debug.WriteLine ("\t\t{0} => {1}",LastSlots,Slot); - #endif -// #if DESIGN_MODE -// if (IFace.GetType().Name == "DesignInterface"){ -// Debug.WriteLine ("\t\t{2}: {0} => {1}",LastSlots,Slot,this.name); -// } -// #endif - switch (layoutType) { case LayoutingType.Width: RegisterForLayouting (LayoutingType.X); @@ -1956,5 +1936,24 @@ namespace Crow return Name == "unamed" ? tmp + "." + this.GetType ().Name : tmp + "." + Name; #endif } + /// <summary> + /// Checks to handle when widget is removed from the visible graphic tree + /// </summary> + void unshownPostActions () { + if (IFace.ActiveWidget != null) { + if (IFace.ActiveWidget.IsOrIsInside (this)) + IFace.ActiveWidget = null; + } + if (IFace.FocusedWidget != null) { + if (IFace.FocusedWidget.IsOrIsInside (this)) + IFace.FocusedWidget = null; + } + if (IFace.HoverWidget != null) { + if (IFace.HoverWidget.IsOrIsInside (this)) { + IFace.HoverWidget = null; + IFace.ProcessMouseMove (IFace.Mouse.X, IFace.Mouse.Y); + } + } + } } } |