aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-01-24 11:21:37 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-01-24 11:21:37 +0100
commit0004f96d68df2cc66717f469cc9151284ed7cea6 (patch)
treef8175ec949c8088705fdc5b46d3aeeebb17bae18 /src
parentaf3dc048f37ef4340feebbfb0a9b612ae99b559b (diff)
always on top windows
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/Window.cs18
-rw-r--r--src/Interface.cs13
2 files changed, 28 insertions, 3 deletions
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index 0b203dfd..9c1a0124 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -46,6 +46,7 @@ namespace Crow
bool _resizable;
bool _movable;
bool hoverBorder = false;
+ bool alwaysOnTop = false;
Rectangle savedBounds;
bool _minimized = false;
@@ -146,6 +147,23 @@ namespace Crow
[XmlIgnore]public bool IsNormal {
get { return !(IsMaximized|_minimized); }
}
+ [XmlAttributeAttribute][DefaultValue(false)]
+ public bool AlwaysOnTop {
+ get {
+ return alwaysOnTop;
+ }
+ set {
+ if (alwaysOnTop == value)
+ return;
+ alwaysOnTop = value;
+ if (alwaysOnTop) {
+ CurrentInterface.PutOnTop (this);
+ CurrentInterface.TopWindows++;
+ }else
+ CurrentInterface.TopWindows--;
+ NotifyValueChanged ("AlwaysOnTop", alwaysOnTop);
+ }
+ }
// [XmlAttributeAttribute()][DefaultValue(WindowState.Normal)]
// public virtual WindowState State {
// get { return _state; }
diff --git a/src/Interface.cs b/src/Interface.cs
index efa687ee..6b859dbe 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -140,6 +140,8 @@ 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
#endregion
#region Private Fields
@@ -536,7 +538,12 @@ namespace Crow
public void AddWidget(GraphicObject g)
{
g.Parent = this;
- GraphicTree.Insert (0, g);
+ int ptr = TopWindows;
+ if (g is Window) {
+ if ((g as Window).AlwaysOnTop)
+ ptr = 0;
+ }
+ GraphicTree.Insert (ptr, g);
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
@@ -549,10 +556,10 @@ namespace Crow
/// <summary> Put widget on top of other root widgets</summary>
public void PutOnTop(GraphicObject g)
{
- if (GraphicTree.IndexOf(g) > 0)
+ if (GraphicTree.IndexOf(g) > TopWindows)
{
GraphicTree.Remove(g);
- GraphicTree.Insert(0, g);
+ GraphicTree.Insert(TopWindows, g);
EnqueueForRepaint (g);
}
}