public void RunLoop(IWindowFrameBackend parent) { if (parent != null) { StyleMask &= ~NSWindowStyle.Miniaturizable; } else { StyleMask |= NSWindowStyle.Miniaturizable; } Visible = true; modalSessionRunning = true; var win = parent as NSWindow ?? ApplicationContext.Toolkit.GetNativeWindow(parent) as NSWindow; if (win != null) { win.AddChildWindow(this, NSWindowOrderingMode.Above); // always use NSWindow for alignment when running in guest mode and // don't rely on AddChildWindow to position the window correctly if (!(parent is WindowBackend)) { var parentBounds = MacDesktopBackend.ToDesktopRect(win.ContentRectFor(win.Frame)); var bounds = ((IWindowFrameBackend)this).Bounds; bounds.X = parentBounds.Center.X - (Frame.Width / 2); bounds.Y = parentBounds.Center.Y - (Frame.Height / 2); ((IWindowFrameBackend)this).Bounds = bounds; } } NSApplication.SharedApplication.RunModalForWindow(this); }
void IWindowFrameBackend.Move(double x, double y) { var r = MacDesktopBackend.FromDesktopRect(new Rectangle(x, y, Frame.Width, Frame.Height)); r = FrameRectFor(r); SetFrameOrigin(r.Location); }
internal void InternalShow() { MakeKeyAndOrderFront(MacEngine.App); if (ParentWindow != null) { if (!ParentWindow.ChildWindows.Contains(this)) { ParentWindow.AddChildWindow(this, NSWindowOrderingMode.Above); } // always use NSWindow for alignment when running in guest mode and // don't rely on AddChildWindow to position the window correctly if (frontend.InitialLocation == WindowLocation.CenterParent && !(ParentWindow is WindowBackend)) { var parentBounds = MacDesktopBackend.ToDesktopRect(ParentWindow.ContentRectFor(ParentWindow.Frame)); var bounds = ((IWindowFrameBackend)this).Bounds; bounds.X = parentBounds.Center.X - (Frame.Width / 2); bounds.Y = parentBounds.Center.Y - (Frame.Height / 2); ((IWindowFrameBackend)this).Bounds = bounds; } if (AccessibilityFocusedWindow == ParentWindow) { AccessibilityFocusedWindow = this; } } }
public override Rectangle GetScreenBounds(object nativeWidget) { var widget = nativeWidget as NSView; if (widget == null) { throw new InvalidOperationException("Widget belongs to a different toolkit"); } var lo = widget.ConvertPointToView(new CGPoint(0, 0), null); lo = widget.Window.ConvertRectToScreen(new CGRect(lo, CGSize.Empty)).Location; return(MacDesktopBackend.ToDesktopRect(new CGRect(lo.X, lo.Y, widget.Frame.Width, widget.Frame.Height))); }
internal void InternalShow() { Window.MakeKeyAndOrderFront(MacEngine.App); if (Window.ParentWindow != null) { if (!Window.ParentWindow.ChildWindows.Contains(Window)) { Window.ParentWindow.AddChildWindow(Window, NSWindowOrderingMode.Above); } // always use NSWindow for alignment when running in guest mode and // don't rely on AddChildWindow to position the window correctly if (!(Window.ParentWindow is WindowBackend)) { var parentBounds = MacDesktopBackend.ToDesktopRect(Window.ParentWindow.ContentRectFor(Window.ParentWindow.Frame)); var bounds = ((IWindowFrameBackend)this).Bounds; bounds.X = parentBounds.Center.X - (Window.Frame.Width / 2); bounds.Y = parentBounds.Center.Y - (Window.Frame.Height / 2); ((IWindowFrameBackend)this).Bounds = bounds; } } }
public MacDesktopBackend() { Instance = this; CalcDesktopBounds (); }
public MacDesktopBackend() { Instance = this; CalcDesktopBounds(); }