]> O.S.I.I.S - jp/crow.git/commitdiff
always on top windows
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 24 Jan 2017 10:21:37 +0000 (11:21 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 24 Jan 2017 10:21:37 +0000 (11:21 +0100)
src/GraphicObjects/Window.cs
src/Interface.cs

index 0b203dfd11e4208bb77cd3fcd24c792ad0a51e91..9c1a0124f495bbbb918e3909d156721822d74311 100644 (file)
@@ -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; }
index efa687ee38d296395d2bddb6bb73f3a37272355a..6b859dbedda4df1e8ce03398407489cfe68d68a6 100644 (file)
@@ -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);
                        }
                }