From f9a309949cb86c4556ac32e3f1734843f1bd0cac Mon Sep 17 00:00:00 2001 From: jp Date: Sat, 31 Oct 2015 11:10:51 +0100 Subject: [PATCH] putOnTop as IGOLibInterface, popper putontop --- src/GraphicObjects/IGOLibHost.cs | 1 + src/GraphicObjects/Popper.cs | 1 + src/OpenTKGameWindow.cs | 59 +++++++++++++++++--------------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/GraphicObjects/IGOLibHost.cs b/src/GraphicObjects/IGOLibHost.cs index a76500c7..cdf94282 100644 --- a/src/GraphicObjects/IGOLibHost.cs +++ b/src/GraphicObjects/IGOLibHost.cs @@ -12,6 +12,7 @@ namespace go GraphicObject FocusedWidget { get; set; } void AddWidget (GraphicObject g); void DeleteWidget(GraphicObject g); + void PutOnTop (GraphicObject g); void Quit (); } } diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 2ec4396f..381b6281 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -164,6 +164,7 @@ namespace go Content.Visible = true; if (Content.Parent == null) tc.AddWidget (Content); + tc.PutOnTop (Content); } Pop.Raise (this, e); } diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index c23acbe3..0329250a 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -27,7 +27,7 @@ namespace go public OpenTKGameWindow(int _width, int _height, string _title="golib") : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1), _title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second), - 3,2,OpenTK.Graphics.GraphicsContextFlags.Debug|OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible) + 3,3,OpenTK.Graphics.GraphicsContextFlags.Debug) // public OpenTKGameWindow(int _width, int _height, string _title="golib") // : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8), _title) { @@ -59,6 +59,7 @@ namespace go Rectangles _redrawClip = new Rectangles();//should find another way to access it from child List _gobjsToRedraw = new List(); + #region IGOLibHost implementation public Rectangles redrawClip { get { return _redrawClip; @@ -89,15 +90,13 @@ namespace go g.ClearBinding(); GraphicObjects.Remove (g); } - /// Remove all Graphic objects from top container - public void ClearInterface() + public void PutOnTop(GraphicObject g) { - int i = 0; - while (GraphicObjects.Count>0) { - GraphicObject g = GraphicObjects [i]; - g.Visible = false; - g.ClearBinding (); - GraphicObjects.RemoveAt (0); + if (GraphicObjects.IndexOf(g) > 0) + { + GraphicObjects.Remove(g); + GraphicObjects.Insert(0, g); + g.registerClipRect (); } } public void Quit () @@ -105,15 +104,6 @@ namespace go this.Exit (); } - #region Events - //those events are raised only if mouse isn't in a graphic object - public event EventHandler MouseWheelChanged; - public event EventHandler MouseButtonUp; - public event EventHandler MouseButtonDown; - public event EventHandler MouseClick; - public event EventHandler MouseMove; - #endregion - #region focus GraphicObject _activeWidget; //button is pressed on widget GraphicObject _hoverWidget; //mouse is over @@ -148,6 +138,29 @@ namespace go } #endregion + #endregion + + /// Remove all Graphic objects from top container + public void ClearInterface() + { + int i = 0; + while (GraphicObjects.Count>0) { + GraphicObject g = GraphicObjects [i]; + g.Visible = false; + g.ClearBinding (); + GraphicObjects.RemoveAt (0); + } + } + + #region Events + //those events are raised only if mouse isn't in a graphic object + public event EventHandler MouseWheelChanged; + public event EventHandler MouseButtonUp; + public event EventHandler MouseButtonDown; + public event EventHandler MouseClick; + public event EventHandler MouseMove; + #endregion + #region graphic contexte Context ctx; Surface surf; @@ -416,16 +429,6 @@ namespace go } #endregion - public void PutOnTop(GraphicObject g) - { - if (GraphicObjects.IndexOf(g) > 0) - { - GraphicObjects.Remove(g); - GraphicObjects.Insert(0, g); - g.registerClipRect (); - } - } - #region Mouse Handling void Mouse_Move(object sender, MouseMoveEventArgs e) { -- 2.47.3