Example #1
0
        public override void OrderWindow(NSWindowOrderingMode place, nint relativeTo)
        {
            var wasVisible = IsVisible;

            base.OrderWindow(place, relativeTo);

            if (place == NSWindowOrderingMode.Out)
            {
                // Remove the window from Windows menu
                NSApplication.SharedApplication.RemoveWindowsItem(this);

                if (IsKeyWindow)
                {
                    NSApplication.SharedApplication.BeginInvokeOnMainThread(() =>
                    {
                        try { ActivateNextWindow(); }
                        catch (Exception e) { Debug.WriteLine("Failed async call ActivateNextWindow(: " + e); }
                    });
                }
            }

            if (wasVisible != IsVisible)
            {
                driver.SendMessage(ContentView.Handle, Msg.WM_SHOWWINDOW, (IntPtr)(wasVisible ? 0 : 1), IntPtr.Zero);
            }
        }
        public override void OrderWindow(NSWindowOrderingMode place, nint relativeTo)
        {
            var wasVisible = IsVisible;

            base.OrderWindow(place, relativeTo);

            if (place == NSWindowOrderingMode.Out)
            {
                // Remove the window from Windows menu
                NSApplication.SharedApplication.RemoveWindowsItem(this);
            }

            if (wasVisible != IsVisible)
            {
                driver.SendMessage(ContentView.Handle, Msg.WM_SHOWWINDOW, (IntPtr)(wasVisible ? 0 : 1), IntPtr.Zero);
            }
        }
Example #3
0
        public override void OrderWindow(NSWindowOrderingMode place, nint relativeTo)
        {
            base.OrderWindow(place, relativeTo);

            if (place == NSWindowOrderingMode.Out)
            {
                // Remove the window from Windows menu
                NSApplication.SharedApplication.RemoveWindowsItem(this);

                if (IsKeyWindow)
                {
                    NSApplication.SharedApplication.BeginInvokeOnMainThread(() =>
                    {
                        try { ActivateNextWindow(); }
                        catch (Exception e) { Debug.WriteLine("Failed async call ActivateNextWindow(: " + e); }
                    });
                }
            }
        }
Example #4
0
        public virtual void AddSubview(NSView aView, NSWindowOrderingMode place, NSView otherView)
        {
            uint index;

            if (aView == null)
            {
                return;
            }
            if (this.IsDescendantOf(aView))
            {
                NSException.Raise(@"NSInvalidArgumentException",
                                  @"addSubview:positioned:relativeTo: creates a loop in the views tree!");
            }

            if (aView == otherView)
                return;

            aView.RemoveFromSuperview();

            // Do this after the removeFromSuperview, as aView may already
            // be a subview and the index could change.
            if (otherView == null)
            {
                index = NS.NotFound;
            }
            else
            {
                index = _sub_views.IndexOfObjectIdenticalTo(otherView);
            }
                if (index == NS.NotFound)
            {
                    if (place == NSWindowOrderingMode.NSWindowBelow)
                    index = 0;
                else
                    index = (uint)_sub_views.Count;
            }
                else if (place != NSWindowOrderingMode.NSWindowBelow)
            {
                index += 1;
            }

            aView._ViewWillMoveToWindow(_window);
            aView._ViewWillMoveToSuperview(this);
            aView.SetNextResponder(this);
            _sub_views.InsertObject(aView,index);
            _rFlags.has_subviews = 1;
            aView.ResetCursorRects();
            aView.SetNeedsDisplay(true);
            aView._ViewDidMoveToWindow();
            aView.ViewDidMoveToSuperview();
            this.DidAddSubview(aView);
        }
Example #5
0
 public GtkNSViewHost(NSView view, NSWindowOrderingMode position) : this(view)
 {
     zOrder = position;
 }