aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Interface.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2017-08-27 06:51:36 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2017-08-27 06:51:36 +0200
commit6cbe9f9d2a604cdbb74f46f3710ea3dc60a87e55 (patch)
tree7e3e675b2f6b14d320b124389b25fde003b63ea6 /src/Interface.cs
parent3025ab70f5fc51819f5980908a8a98d5d6426b7e (diff)
first step in implementing a dispose mechanism for graphic objects
Diffstat (limited to 'src/Interface.cs')
-rw-r--r--src/Interface.cs51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/Interface.cs b/src/Interface.cs
index adcb2830..baa46667 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -593,15 +593,40 @@ namespace Crow
public void DeleteWidget(GraphicObject g)
{
if (_hoverWidget != null) {
- if (g.Contains (_hoverWidget))
+ if (_hoverWidget.IsInside(g))
HoverWidget = null;
}
lock (UpdateMutex) {
- g.DataSource = null;
- g.Visible = false;
+ RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
GraphicTree.Remove (g);
+ g.Parent = null;
+ g.Dispose ();
}
}
+ /// <summary> Remove all Graphic objects from top container </summary>
+ public void ClearInterface()
+ {
+ lock (UpdateMutex) {
+ while (GraphicTree.Count > 0) {
+ //TODO:parent is not reset to null because object will be added
+ //to ObjectToRedraw list, and without parent, it fails
+ GraphicObject g = GraphicTree [0];
+ if (_hoverWidget != null) {
+ if (_hoverWidget.IsInside(g))
+ HoverWidget = null;
+ }
+ RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+ GraphicTree.RemoveAt (0);
+ g.Dispose ();
+ }
+ }
+ #if DEBUG_LAYOUTING
+ LQIsTries = new List<LQIList>();
+ curLQIsTries = new LQIList();
+ LQIs = new List<LQIList>();
+ curLQIs = new LQIList();
+ #endif
+ }
/// <summary> Put widget on top of other root widgets</summary>
public void PutOnTop(GraphicObject g, bool isOverlay = false)
{
@@ -626,26 +651,6 @@ namespace Crow
EnqueueForRepaint (g);
}
}
- /// <summary> Remove all Graphic objects from top container </summary>
- public void ClearInterface()
- {
- lock (UpdateMutex) {
- while (GraphicTree.Count > 0) {
- //TODO:parent is not reset to null because object will be added
- //to ObjectToRedraw list, and without parent, it fails
- GraphicObject g = GraphicTree [0];
- g.DataSource = null;
- g.Visible = false;
- GraphicTree.RemoveAt (0);
- }
- }
- #if DEBUG_LAYOUTING
- LQIsTries = new List<LQIList>();
- curLQIsTries = new LQIList();
- LQIs = new List<LQIList>();
- curLQIs = new LQIList();
- #endif
- }
/// <summary>Search a Graphic object in the tree named 'nameToFind'</summary>
public GraphicObject FindByName (string nameToFind)