From: jpbruyere Date: Tue, 24 Jan 2017 10:21:37 +0000 (+0100) Subject: always on top windows X-Git-Tag: v0.5.1~28^2~7 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=369a13a0e0e4734afec7dc5e358b483e8e73a8f1;p=jp%2Fcrow.git always on top windows --- 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. /// public static Dictionary Instantiators = new Dictionary(); + 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 /// Put widget on top of other root widgets 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); } }