Exemplo n.º 1
0
        void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
        {
            if (!((IWindowFrameBackend)this).ShowInTaskbar)
            {
                StyleMask &= ~NSWindowStyle.Miniaturizable;
            }

            var win = window as NSWindow ?? ApplicationContext.Toolkit.GetNativeWindow(window) as NSWindow;

            if (ParentWindow != win)
            {
                // remove from the previous parent
                if (ParentWindow != null)
                {
                    ParentWindow.RemoveChildWindow(this);
                }

                ParentWindow = win;
                // A window must be visible to be added to a parent. See InternalShow().
                if (Visible)
                {
                    ParentWindow.AddChildWindow(this, NSWindowOrderingMode.Above);
                }
            }
        }
Exemplo n.º 2
0
        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;
                }
            }
        }
Exemplo n.º 3
0
        /***
         * protected override void OnKeyDown (KeyboardKeyEventArgs e)
         * {
         *      switch (e.Key) {
         *      case Key.Escape:
         *              OnCancel ();
         *              break;
         *      case Key.Enter:
         *              OnOK ();
         *              break;
         *      default:
         *              base.OnKeyDown (e);
         *              break;
         *      }
         * }
         ****/

        public void Show(SummerGUIWindow parent)
        {
            if (ParentWindow != parent)
            {
                this.LogWarning("Parent should equal ParentWindow");
            }

            if (ParentWindow != null)
            {
                ParentWindow.AddChildWindow(this);
            }
            this.Run();
        }