aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Interface.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-03-21 13:48:50 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-03-21 13:48:50 +0100
commit280ee7ff8429342575b47eff4ab88872399047d3 (patch)
tree8733c3b9be774be6b8f3a667d626d70832c6134e /src/Interface.cs
parent6b96a03d1ac087cbd8c0d7c69699770adf143245 (diff)
Simplify z ordering of root objects in GraphicTree
modifié : src/GraphicObjects/Group.cs modifié : src/GraphicObjects/Window.cs modifié : src/Interface.cs
Diffstat (limited to 'src/Interface.cs')
-rw-r--r--src/Interface.cs45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/Interface.cs b/src/Interface.cs
index b3ff2527..62ac6ce3 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -147,7 +147,6 @@ namespace Crow
/// </summary>
public static Dictionary<String, Instantiator> Instantiators = new Dictionary<string, Instantiator>();
public bool DesignMode = false;
- public int TopWindows = 0;//window always on top count
public List<CrowThread> CrowThreads = new List<CrowThread>();//used to monitor thread finished
#endregion
@@ -550,17 +549,25 @@ namespace Crow
#region GraphicTree handling
/// <summary>Add widget to the Graphic tree of this interface and register it for layouting</summary>
- public void AddWidget(GraphicObject g, bool topMost = false)
+ public void AddWidget(GraphicObject g, bool isOverlay = false)
{
g.Parent = this;
- int ptr = TopWindows;
- if (g is Window) {
- if ((g as Window).AlwaysOnTop)
- ptr = 0;
- } else if (topMost)
- ptr = 0;
+ int ptr = 0;
+ Window newW = g as Window;
+ if (newW != null) {
+ while (ptr < GraphicTree.Count) {
+ Window w = GraphicTree [ptr] as Window;
+ if (w != null) {
+ if (newW.AlwaysOnTop || !w.AlwaysOnTop)
+ break;
+ }
+ ptr++;
+ }
+ }
+
lock (UpdateMutex)
- GraphicTree.Insert (ptr, g);
+ GraphicTree.Insert (ptr, g);
+
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
@@ -572,14 +579,20 @@ namespace Crow
GraphicTree.Remove (g);
}
/// <summary> Put widget on top of other root widgets</summary>
- public void PutOnTop(GraphicObject g, bool topMost = false)
+ public void PutOnTop(GraphicObject g, bool isOverlay = false)
{
- int ptr = TopWindows;
- if (g is Window) {
- if ((g as Window).AlwaysOnTop)
- ptr = 0;
- } else if (topMost)
- ptr = 0;
+ int ptr = 0;
+ Window newW = g as Window;
+ if (newW != null) {
+ while (ptr < GraphicTree.Count) {
+ Window w = GraphicTree [ptr] as Window;
+ if (w != null) {
+ if (newW.AlwaysOnTop || !w.AlwaysOnTop)
+ break;
+ }
+ ptr++;
+ }
+ }
if (GraphicTree.IndexOf(g) > ptr)
{
lock (UpdateMutex) {