aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Interface.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-01-29 23:26:46 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-01-29 23:26:46 +0100
commitdc603ff31253879bb8effb6d529f266ff78e9f3e (patch)
treee48f38ac22040da95371f661be482389b21e473e /src/Interface.cs
parent1a4fe8bd37ed4a3e3324a134df4f90c14b315918 (diff)
parent2ec4eeed1d0353c455719aa612a12646ae2d176e (diff)
Merge improvements and debug from 'CrowIDE' branch
Diffstat (limited to 'src/Interface.cs')
-rw-r--r--src/Interface.cs40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/Interface.cs b/src/Interface.cs
index 89ee1b7e..565e6ab4 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -140,6 +140,9 @@ namespace Crow
/// on the first instance creation of a IML item.
/// </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
#region Private Fields
@@ -300,7 +303,7 @@ namespace Crow
/// <summary>Widget is focused and button is down or another perif action is occuring
/// , it can not lose focus while Active</summary>
- public GraphicObject activeWidget
+ public GraphicObject ActiveWidget
{
get { return _activeWidget; }
set
@@ -392,6 +395,13 @@ namespace Crow
_focusedWidget.onKeyDown (this, lastKeyDownEvt);
}
}
+ CrowThread[] tmpThreads;
+ lock (CrowThreads) {
+ tmpThreads = new CrowThread[CrowThreads.Count];
+ Array.Copy (CrowThreads.ToArray (), tmpThreads, CrowThreads.Count);
+ }
+ for (int i = 0; i < tmpThreads.Length; i++)
+ tmpThreads [i].CheckState ();
if (!Monitor.TryEnter (UpdateMutex))
return;
@@ -533,10 +543,16 @@ 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)
+ public void AddWidget(GraphicObject g, bool topMost = false)
{
g.Parent = this;
- GraphicTree.Insert (0, g);
+ int ptr = TopWindows;
+ if (g is Window) {
+ if ((g as Window).AlwaysOnTop)
+ ptr = 0;
+ } else if (topMost)
+ ptr = 0;
+ GraphicTree.Insert (ptr, g);
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
@@ -547,12 +563,18 @@ namespace Crow
GraphicTree.Remove (g);
}
/// <summary> Put widget on top of other root widgets</summary>
- public void PutOnTop(GraphicObject g)
+ public void PutOnTop(GraphicObject g, bool topMost = false)
{
- if (GraphicTree.IndexOf(g) > 0)
+ int ptr = TopWindows;
+ if (g is Window) {
+ if ((g as Window).AlwaysOnTop)
+ ptr = 0;
+ } else if (topMost)
+ ptr = 0;
+ if (GraphicTree.IndexOf(g) > ptr)
{
GraphicTree.Remove(g);
- GraphicTree.Insert(0, g);
+ GraphicTree.Insert(ptr, g);
EnqueueForRepaint (g);
}
}
@@ -627,10 +649,10 @@ namespace Crow
MouseMoveEventArgs e = new MouseMoveEventArgs (x, y, deltaX, deltaY);
e.Mouse = Mouse;
- if (_activeWidget != null) {
+ if (ActiveWidget != null) {
//TODO, ensure object is still in the graphic tree
//send move evt even if mouse move outside bounds
- _activeWidget.onMouseMove (this, e);
+ ActiveWidget.onMouseMove (this, e);
return true;
}
@@ -710,7 +732,7 @@ namespace Crow
}
_activeWidget.onMouseUp (_activeWidget, e);
- activeWidget = null;
+ ActiveWidget = null;
return true;
}
public bool ProcessMouseButtonDown(int button)