diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:32:53 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2014-10-21 18:39:14 +0400 |
commit | f73b2a9990495587d514aa1856919c21170a3940 (patch) | |
tree | 9842411ee8644ead5915a715ee7e53984a601df4 /main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs | |
parent | a2046b6331a271e8203df7d3d0f14500d33d60fa (diff) |
Initial drop of the new project model
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs | 91 |
1 files changed, 87 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs index 7cb00af05b..ca29672dcd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/DockFrameTopLevel.cs @@ -32,19 +32,27 @@ using System; using Gtk; +using MonoDevelop.Ide; namespace MonoDevelop.Components.Docking { class DockFrameTopLevel: EventBox { int x, y; + int width, height; + bool repositionRequested; + DockFrame frame; + + public DockFrameTopLevel (DockFrame frame) + { + this.frame = frame; + } public int X { get { return x; } set { x = value; - if (Parent != null) - Parent.QueueResize (); + UpdateWindowPos (); } } @@ -52,10 +60,85 @@ namespace MonoDevelop.Components.Docking get { return y; } set { y = value; - if (Parent != null) - Parent.QueueResize (); + UpdateWindowPos (); } } + + public Gdk.Size Size { + get { + if (ContainerWindow != null) { + int w, h; + ContainerWindow.GetSize (out w, out h); + return new Gdk.Size (w, h); + } else { + return new Gdk.Size (WidthRequest, HeightRequest); + } + } + set { + width = value.Width; + height = value.Height; + if (ContainerWindow != null) + UpdateWindowPos (); + else { + WidthRequest = value.Width; + HeightRequest = value.Height; + } + } + } + + public int Width { + get { + if (ContainerWindow != null) { + int w, h; + ContainerWindow.GetSize (out w, out h); + return w; + } else + return WidthRequest; + } + set { + width = value; + if (ContainerWindow != null) + UpdateWindowPos (); + else + WidthRequest = value; + } + } + + public int Height { + get { + if (ContainerWindow != null) { + int w, h; + ContainerWindow.GetSize (out w, out h); + return h; + } else + return HeightRequest; + } + set { + height = value; + if (ContainerWindow != null) + UpdateWindowPos (); + else + HeightRequest = value; + } + } + + + void UpdateWindowPos () + { + if (ContainerWindow != null) { + if (!repositionRequested && width != 0 && height != 0) { + repositionRequested = true; + Application.Invoke (delegate { + var pos = frame.GetScreenCoordinates (new Gdk.Point (x, y)); + DesktopService.PlaceWindow (ContainerWindow, pos.X, pos.Y, width, height); + repositionRequested = false; + }); + } + } else if (Parent != null) + Parent.QueueResize (); + } + + internal Gtk.Window ContainerWindow { get; set; } } } |