示例#1
0
		public bool Run (IWindowFrameBackend parent, string title, bool supportsAlpha)
		{
			if (!String.IsNullOrEmpty (title))
				dlg.Title = title;
			else
				dlg.Title = defaultTitle;

			dlg.ColorSelection.HasOpacityControl = supportsAlpha;
			
			dlg.ColorSelection.CurrentColor = color.ToGtkValue ();
			if (supportsAlpha)
				dlg.ColorSelection.CurrentAlpha = (ushort) (((double)ushort.MaxValue) * color.Alpha);
		
			var p = (WindowFrameBackend) parent;
			int result = MessageService.RunCustomDialog (dlg, p != null ? p.Window : null);
			
			if (result == (int) Gtk.ResponseType.Ok) {
				color = dlg.ColorSelection.CurrentColor.ToXwtValue ();
				if (supportsAlpha)
					color = color.WithAlpha ((double)dlg.ColorSelection.CurrentAlpha / (double)ushort.MaxValue);
				return true;
			}
			else
				return false;
		}
示例#2
0
		public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha)
		{
			//TODO: Support alpha + create custom WPF solution?
			dialog.Title = title;
			if (parent != null)
				return (this.dialog.ShowDialog(new WpfWin32Window(((WindowFrameBackend)parent).Window)) == DialogResult.OK);
			else
				return (this.dialog.ShowDialog() == DialogResult.OK);
		}
示例#3
0
 public void Init(IWindowFrameBackend parent, IWidgetBackend child, Xwt.Popover.Position orientation)
 {
     popover = new PopoverWindow ((Gtk.Widget)child.NativeWidget, orientation);
     popover.TransientFor = ((WindowFrameBackend)parent).Window;
     popover.DestroyWithParent = true;
     popover.Hidden += (o, args) => {
         if (Closed != null)
             Closed (this, EventArgs.Empty);
     };
 }
示例#4
0
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     if (backend.Window is Gtk.Window)
     {
         return(backend.Window);
     }
     if (Platform.IsMac)
     {
         return(GtkMacInterop.GetGtkWindow(backend.Window));
     }
     return(null);
 }
示例#5
0
 public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha)
 {
     //TODO: Support alpha + create custom WPF solution?
     dialog.Title = title;
     if (parent != null)
     {
         return(this.dialog.ShowDialog(new WpfWin32Window(((WindowFrameBackend)parent).Window)) == DialogResult.OK);
     }
     else
     {
         return(this.dialog.ShowDialog() == DialogResult.OK);
     }
 }
示例#6
0
        public bool Run(IWindowFrameBackend parent)
        {
            var returnValue = Panel.RunModal();

            if (parent != null)
            {
                var win = parent as NSWindow ?? Runtime.GetNSObject(parent.NativeHandle) as NSWindow;
                if (win != null)
                {
                    win.MakeKeyAndOrderFront(win);
                }
            }
            return(returnValue == 1);
        }
		public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha, Action<Color> colorChangedCallback) {
			//TODO: Support alpha + create custom WPF solution?
			dialog = new ColorDialogExtension((int)this.ScreenPosition.X, (int)this.ScreenPosition.Y, title);
			dialog.Color = System.Drawing.Color.FromArgb((byte)(this.Color.Alpha * 255), (byte)(this.Color.Red * 255), (byte)(this.Color.Green * 255), (byte)(this.Color.Blue * 255));
			bool output;
			if (parent != null)
				output = (this.dialog.ShowDialog(new WpfWin32Window(((WindowFrameBackend)parent).Window)) == DialogResult.OK);
			else
				output = (this.dialog.ShowDialog() == DialogResult.OK);

			this.Color = Color.FromBytes(this.dialog.Color.R, this.dialog.Color.G, this.dialog.Color.B, this.dialog.Color.A);
			colorChangedCallback.Invoke(this.Color);
			this.Close();
			return output;
		}
示例#8
0
		public bool Run (IWindowFrameBackend parent)
		{
			fontPanel.Delegate = new FontPanelDelegate ();

			if (SelectedFont != null) {
				NSFontManager.SharedFontManager.SetSelectedFont (((FontData)Toolkit.GetBackend (SelectedFont)).Font, false);
			}

			NSApplication.SharedApplication.RunModalForWindow (fontPanel);

			var font = NSFontPanel.SharedFontPanel.PanelConvertFont (NSFont.SystemFontOfSize (0));
			SelectedFont = Font.FromName (FontData.FromFont (font).ToString ());

			return true;
		}
		// Important note: The dialog was originally modaless. It was switched to be modal.
		//				   You can see the file history in GIT to see the changes. (Eugene) 


		public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha, Action<Color> colorChangedCallback)
		{
			colorPanel.Delegate = new SelectColorDialogDelegate();
			colorPanel.ShowsAlpha = supportsAlpha;

			this.callback = colorChangedCallback;
			colorPanel.AnimationBehavior = NSWindowAnimationBehavior.None;

#if !MONOMAC // NSColorPanel.ColorChangedNotification is not defined for MonoMac
			observer = NSNotificationCenter.DefaultCenter.AddObserver(NSColorPanel.ColorChangedNotification, OnColorChanged);
#endif

			NSApplication.SharedApplication.RunModalForWindow(colorPanel);

			return true;
		}
示例#10
0
文件: MacEngine.cs 项目: TelsaV/xwt
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     if (backend == null)
     {
         return(null);
     }
     if (backend.Window is NSWindow)
     {
         return(backend.Window);
     }
     if (Desktop.DesktopType == DesktopType.Mac && Toolkit.NativeEngine == ApplicationContext.Toolkit)
     {
         return(Runtime.GetNSObject(backend.NativeHandle) as NSWindow);
     }
     return(null);
 }
示例#11
0
        public bool Run(IWindowFrameBackend parent)
        {
            bool?ok;

            WindowBackend windowBackend = parent as WindowBackend;

            if (windowBackend != null)
            {
                ok = this.dialog.ShowDialog(windowBackend.Window);
            }
            else
            {
                ok = this.dialog.ShowDialog();
            }

            return(ok.HasValue && ok.Value);
        }
示例#12
0
        public void SetTransientFor(IWindowFrameBackend window)
        {
            var wpfBackend = window as WindowFrameBackend;

            if (wpfBackend != null)
            {
                Window.Owner = wpfBackend.Window;
            }
            else if (window != null)
            {
                interopHelper.Owner = window.NativeHandle;
            }
            else
            {
                Window.Owner = null;
            }
        }
        public bool Run(IWindowFrameBackend parent)
        {
            fontPanel.Delegate = new FontPanelDelegate();

            if (SelectedFont != null)
            {
                NSFontManager.SharedFontManager.SetSelectedFont(((FontData)Toolkit.GetBackend(SelectedFont)).Font, false);
            }

            NSApplication.SharedApplication.RunModalForWindow(fontPanel);

            var font = NSFontPanel.SharedFontPanel.PanelConvertFont(NSFont.SystemFontOfSize(0));

            SelectedFont = Font.FromName(FontData.FromFont(font).ToString());

            return(true);
        }
示例#14
0
        public void RunLoop(IWindowFrameBackend parent)
        {
            // GTK adds a border to the root widget, for some unknown reason
            ((Gtk.Container)Window.Child).BorderWidth = 0;
            var p = (WindowFrameBackend)parent;

            bool keepRunning;

            do
            {
                var res = MessageService.RunCustomDialog(Window, p != null ? p.Window : null);
                keepRunning = false;
                if (res == (int)Gtk.ResponseType.DeleteEvent)
                {
                    keepRunning = !PerformClose(false);
                }
            } while (keepRunning);
        }
示例#15
0
        public void RunLoop(IWindowFrameBackend parent)
        {
            // GTK adds a border to the root widget, for some unknown reason
            ((Gtk.Container)Window.Child).BorderWidth = 0;
            Gtk.Window p = parent != null?ApplicationContext.Toolkit.GetNativeWindow(parent) as Gtk.Window : null;

            bool keepRunning;

            do
            {
                var res = MessageService.RunCustomDialog(Window, p);
                keepRunning = false;
                if (res == (int)Gtk.ResponseType.DeleteEvent)
                {
                    keepRunning = !PerformClose(false);
                }
            } while (keepRunning);
        }
示例#16
0
        public bool Run(IWindowFrameBackend parent, string title, bool supportsAlpha)
        {
            if (!String.IsNullOrEmpty(title))
            {
                dlg.Title = title;
            }
            else
            {
                dlg.Title = defaultTitle;
            }

            dlg.ColorSelection.HasOpacityControl = supportsAlpha;

            dlg.ColorSelection.CurrentColor = color.ToGtkValue();
            if (supportsAlpha)
            {
                dlg.ColorSelection.CurrentAlpha = (ushort)(((double)ushort.MaxValue) * color.Alpha);
            }

            var p = parent != null?Toolkit.CurrentEngine.GetNativeWindow(parent) as Gtk.Window : null;

            int result = MessageService.RunCustomDialog(dlg, p);

            if (result == (int)Gtk.ResponseType.Ok)
            {
                color = dlg.ColorSelection.CurrentColor.ToXwtValue();
                if (supportsAlpha)
                {
                    color = color.WithAlpha((double)dlg.ColorSelection.CurrentAlpha / (double)ushort.MaxValue);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#17
0
		public bool Run (IWindowFrameBackend parent)
		{
			if (!String.IsNullOrEmpty (Title))
				dlg.Title = Title;
			else
				dlg.Title = defaultTitle;

			if (!String.IsNullOrEmpty (PreviewText))
				dlg.PreviewText = PreviewText;
			else
				dlg.PreviewText = defaultPreviewText;

			if (SelectedFont != null)
				dlg.SetFontName (SelectedFont.ToString ());

			var p = (WindowFrameBackend)parent;
			int result = MessageService.RunCustomDialog (dlg, p != null ? p.Window : null);

			if (result == (int)Gtk.ResponseType.Ok) {
				SelectedFont = Font.FromName (dlg.FontName);
				return true;
			}
			return false;
		}
示例#18
0
        public bool Run(IWindowFrameBackend parent)
        {
            if (!String.IsNullOrEmpty(Title))
            {
                dlg.Title = Title;
            }
            else
            {
                dlg.Title = defaultTitle;
            }

            if (!String.IsNullOrEmpty(PreviewText))
            {
                dlg.PreviewText = PreviewText;
            }
            else
            {
                dlg.PreviewText = defaultPreviewText;
            }

            if (SelectedFont != null)
            {
                dlg.SetFontName(SelectedFont.ToString());
            }

            var p = parent != null?context.Toolkit.GetNativeWindow(parent) as Gtk.Window : null;

            int result = MessageService.RunCustomDialog(dlg, p);

            if (result == (int)Gtk.ResponseType.Ok)
            {
                SelectedFont = Font.FromName(dlg.FontName);
                return(true);
            }
            return(false);
        }
示例#19
0
		public void RunLoop (IWindowFrameBackend parent)
		{
			if (parent != null)
				StyleMask &= ~NSWindowStyle.Miniaturizable;
			else
				StyleMask |= NSWindowStyle.Miniaturizable;
			Visible = true;
			modalSessionRunning = true;
			var win = parent as NSWindow ?? Toolkit.CurrentEngine.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);
		}
示例#20
0
 void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
 {
     this.Window.Owner = ((WindowFrameBackend)window).Window;
 }
示例#21
0
 public bool Run(IWindowFrameBackend parent)
 {
     var returnValue = this.RunModal();
     return returnValue == 1;
 }
示例#22
0
        public void RunLoop(IWindowFrameBackend parent)
        {
            var p = (WindowFrameBackend)parent;

            MessageService.RunCustomDialog(Window, p != null ? p.Window : null);
        }
示例#23
0
文件: GtkEngine.cs 项目: mono/xwt
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     if (backend.Window is Gtk.Window)
         return backend.Window;
     if (Platform.IsMac)
         return GtkMacInterop.GetGtkWindow (backend.Window);
     return null;
 }
示例#24
0
		void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window)
		{
			Window.TransientFor = ((WindowFrameBackend)window).Window;
		}
示例#25
0
 /// <summary>
 /// Gets a reference to the native platform window used by the specified backend.
 /// </summary>
 /// <returns>The native window currently used by Xwt for the specific window, or null.</returns>
 /// <param name="w">The Xwt window.</param>
 /// <remarks>
 /// If the window backend belongs to a different toolkit and the current toolkit is the
 /// native toolkit for the current platform, GetNativeWindow will return the underlying
 /// native window, or null if the operation is not supported for the current toolkit.
 /// </remarks>
 public object GetNativeWindow(IWindowFrameBackend w)
 {
     return(backend.GetNativeWindow(w));
 }
示例#26
0
文件: WPFEngine.cs 项目: akrisiun/xwt
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     return backend?.Window as System.Windows.Window;
 }
示例#27
0
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     return(backend?.Window as System.Windows.Window);
 }
示例#28
0
 public void RunLoop(IWindowFrameBackend parent)
 {
     // GTK adds a border to the root widget, for some unknown reason
     ((Gtk.Container)Window.Child).BorderWidth = 0;
     var p = (WindowFrameBackend) parent;
     MessageService.RunCustomDialog (Window, p != null ? p.Window : null);
 }
示例#29
0
        public void RunLoop(IWindowFrameBackend parent)
        {
            // GTK adds a border to the root widget, for some unknown reason
            ((Gtk.Container)Window.Child).BorderWidth = 0;
            var p = (WindowFrameBackend) parent;

            bool keepRunning;
            do {
                var res = MessageService.RunCustomDialog (Window, p != null ? p.Window : null);
                keepRunning = false;
                if (res == (int) Gtk.ResponseType.DeleteEvent) {
                    keepRunning = !PerformClose (false);
                }
            } while (keepRunning);
        }
示例#30
0
 void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
 {
     Window.TransientFor = ((WindowFrameBackend)window).Window;
 }
示例#31
0
文件: DialogBackend.cs 项目: neiz/xwt
 public void RunLoop(IWindowFrameBackend parent)
 {
     Visible = true;
     NSApplication.SharedApplication.RunModalForWindow (this);
 }
示例#32
0
		public bool Run (IWindowFrameBackend parent)
		{
			fontSelector.SelectedFont = SelectedFont;
			return fontDialog.Run (this.parent) == Command.Ok;
		}
示例#33
0
 /// <summary>
 /// Gets a native window reference from an Xwt window backend.
 /// </summary>
 /// <returns> The native window object. </returns>
 /// <param name='backend'> The Xwt window backend. </param>
 public abstract object GetNativeWindow(IWindowFrameBackend backend);
示例#34
0
            public override IEnumerable <Tuple <IntPtr, object> > AllForms(IntPtr display, IWindowFrameBackend window)
            {
                var wi = CGWindowListCopyWindowInfo(0x1, 0);

                var count = CFArrayGetCount(wi);

                var app      = XamMac.appkit_nsapplication.GetPropertyValueStatic("SharedApplication");
                var winarray = (Array)app.GetType().GetPropertyValue(app, "Windows");

                var curapp = XamMac.appkit_nsrunningapp.GetPropertyValueStatic("CurrentApplication");
                var appid  = (int)XamMac.appkit_nsrunningapp.GetPropertyValue(curapp, "ProcessIdentifier");

                var kCGWindowIsOnscreen = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowIsOnscreen");
                var name_window         = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowName");
                var id_window           = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowNumber");
                var id_owner            = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowOwnerPID");
                var kCGWindowBounds     = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowBounds");

                for (int nit = 0; nit < count; nit++)
                {
                    var cfdict = CFArrayGetValueAtIndex(wi, nit);

                    var visible = OpenTK.Platform.MacOS.Cocoa.SendBool(CFDictionaryGetValue(cfdict, kCGWindowIsOnscreen), OpenTK.Platform.MacOS.Selector.Get("boolValue"));

                    if (visible)
                    {
                        var windowid = OpenTK.Platform.MacOS.Cocoa.SendInt(CFDictionaryGetValue(cfdict, id_window), OpenTK.Platform.MacOS.Selector.Get("intValue"));
                        var i2       = OpenTK.Platform.MacOS.Cocoa.SendInt(CFDictionaryGetValue(cfdict, id_owner), OpenTK.Platform.MacOS.Selector.Get("intValue"));

                        if (i2 == appid)
                        {
                            foreach (var nswin in winarray) // AppKit.NSApplication.SharedApplication.Windows
                            {
                                object nint = nswin.GetType().GetPropertyValue(nswin, "WindowNumber");
                                if ((nint as System.IConvertible).ToInt32(null) == windowid)
                                {
                                    yield return(new Tuple <IntPtr, object>(new IntPtr(windowid), nswin));
                                }
                            }
                        }
                        else
                        {
                            if (CGRectMakeWithDictionaryRepresentation(CFDictionaryGetValue(cfdict, kCGWindowBounds), out CGRect rr))
                            {
                                var    name = OpenTK.Platform.MacOS.Cocoa.FromNSString(CFDictionaryGetValue(cfdict, name_window));
                                object r2   = Activator.CreateInstance(XamMac.cg_cgrect, new object[] { rr.x, rr.y, rr.w, rr.h });
                                var    r3   = (Xwt.Rectangle)XamMac.xwtmacbackend.InvokeStatic("ToDesktopRect", r2);

                                if (name != "Dock") // todo check with screenbounds
                                {
                                    yield return(new Tuple <IntPtr, object>(new IntPtr(windowid), r3));
                                }
                            }
                        }
                    }
                }
                OpenTK.Platform.MacOS.Cocoa.SendVoid(wi, OpenTK.Platform.MacOS.Selector.Release);
            }
示例#35
0
		void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window)
		{
			Window.TransientFor = ApplicationContext.Toolkit.GetNativeWindow (window) as Gtk.Window;
		}
示例#36
0
		public void RunLoop (IWindowFrameBackend parent)
		{
			if (parent != null)
				Window.Owner = ((WindowFrameBackend) parent).Window;
			Window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
			Window.ShowDialog ();
		}
示例#37
0
 public void SetTransientFor(IWindowFrameBackend window)
 {
     throw new NotImplementedException();
 }
示例#38
0
            public override IEnumerable <Tuple <IntPtr, object> > AllForms(IntPtr _display, IWindowFrameBackend window)
            {
                var wi = CGWindowListCopyWindowInfo(0x1, 0);

                var count = CFArrayGetCount(wi);

                var winarray = CreateGdkLookup();

                var curapp = XamMac.appkit_nsrunningapp.GetPropertyValueStatic("CurrentApplication");
                var appid  = (int)XamMac.appkit_nsrunningapp.GetPropertyValue(curapp, "ProcessIdentifier");

                var kCGWindowIsOnscreen = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowIsOnscreen");
                var name_window         = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowName");
                var id_window           = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowNumber");
                var id_owner            = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowOwnerPID");
                var kCGWindowBounds     = OpenTK.Platform.MacOS.Cocoa.ToNSString("kCGWindowBounds");

                for (int nit = 0; nit < count; nit++)
                {
                    var cfdict = CFArrayGetValueAtIndex(wi, nit);

                    var visible = OpenTK.Platform.MacOS.Cocoa.SendBool(CFDictionaryGetValue(cfdict, kCGWindowIsOnscreen), OpenTK.Platform.MacOS.Selector.Get("boolValue"));

                    if (visible)
                    {
                        var windowid = OpenTK.Platform.MacOS.Cocoa.SendInt(CFDictionaryGetValue(cfdict, id_window), OpenTK.Platform.MacOS.Selector.Get("intValue"));
                        var i2       = OpenTK.Platform.MacOS.Cocoa.SendInt(CFDictionaryGetValue(cfdict, id_owner), OpenTK.Platform.MacOS.Selector.Get("intValue"));

                        if (i2 == appid)
                        {
                            if (winarray.TryGetValue(windowid, out object gtkwin))
                            {
                                yield return(new Tuple <IntPtr, object>(new IntPtr(windowid), gtkwin));
                            }
                        }
                        else
                        {
                            if (CGRectMakeWithDictionaryRepresentation(CFDictionaryGetValue(cfdict, kCGWindowBounds), out CGRect rr))
                            {
                                var name = OpenTK.Platform.MacOS.Cocoa.FromNSString(CFDictionaryGetValue(cfdict, name_window));

                                if (name != "Dock") // todo check with screenbounds
                                {
                                    yield return(new Tuple <IntPtr, object>(new IntPtr(windowid), new  Rectangle(rr.x, rr.y, rr.w, rr.h)));
                                }
                            }
                        }
                    }
                }
                OpenTK.Platform.MacOS.Cocoa.SendVoid(wi, OpenTK.Platform.MacOS.Selector.Release);
            }
示例#39
0
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     throw new NotImplementedException();
 }
示例#40
0
 public void RunLoop(IWindowFrameBackend parent)
 {
     Window.Owner = ((WindowFrameBackend) parent).Window;
     Window.ShowDialog ();
 }
示例#41
0
		void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window)
		{
			// Generally, TransientFor is used to implement dialog, we reproduce the assumption here
			Level = window == null ? NSWindowLevel.Normal : NSWindowLevel.ModalPanel;
		}
示例#42
0
 void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
 {
     // Generally, TransientFor is used to implement dialog, we reproduce the assumption here
     Level = window == null ? NSWindowLevel.Normal : NSWindowLevel.ModalPanel;
 }
示例#43
0
文件: Toolkit.cs 项目: inorton/xwt
 public NativeWindowFrame(IWindowFrameBackend backend)
 {
     BackendHost.SetCustomBackend(backend);
 }
示例#44
0
        public void RunLoop(IWindowFrameBackend parent)
        {
            // GTK adds a border to the root widget, for some unknown reason
            ((Gtk.Container)Window.Child).BorderWidth = 0;
            var p = (WindowFrameBackend) parent;

            bool keepRunning;
            do {
                var res = MessageService.RunCustomDialog (Window, p != null ? p.Window : null);
                keepRunning = false;
                endLoopRequested = false;
                if (res == (int) Gtk.ResponseType.DeleteEvent) {
                    ApplicationContext.InvokeUserCode(delegate {
                        keepRunning = !EventSink.OnCloseRequested ();
                    });
                }
            } while (keepRunning && !endLoopRequested);
        }
示例#45
0
文件: MacEngine.cs 项目: akrisiun/xwt
 public override object GetNativeWindow(IWindowFrameBackend backend)
 {
     if (backend == null)
         return null;
     if (backend.Window is NSWindow)
         return backend.Window;
     if (Desktop.DesktopType == DesktopType.Mac && Toolkit.NativeEngine == ApplicationContext.Toolkit)
         return Runtime.GetNSObject (backend.NativeHandle) as NSWindow;
     return null;
 }
示例#46
0
		public bool Run (IWindowFrameBackend parent)
		{
			if (parent != null)
				return (this.dialog.ShowDialog (new WpfWin32Window (((WindowFrameBackend) parent).Window)) == DialogResult.OK);
			else
				return (this.dialog.ShowDialog () == DialogResult.OK);
		}
示例#47
0
        public bool Run(IWindowFrameBackend parent)
        {
            var returnValue = this.RunModal();

            return(returnValue == 1);
        }
示例#48
0
 void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
 {
     this.Window.Owner = ((WindowFrameBackend) window).Window;
 }
示例#49
0
 void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window)
 {
     Window.TransientFor = ApplicationContext.Toolkit.GetNativeWindow(window) as Gtk.Window;
 }
示例#50
0
 public void RunLoop(IWindowFrameBackend parent)
 {
     Visible = true;
     NSApplication.SharedApplication.RunModalForWindow(this);
 }
示例#51
0
 public void RunLoop(IWindowFrameBackend parent)
 {
     var p = (WindowFrameBackend) parent;
     MessageService.RunCustomDialog (Window, p != null ? p.Window : null);
 }
示例#52
0
 public bool Run(IWindowFrameBackend parent)
 {
     fontSelector.SelectedFont = SelectedFont;
     return(fontDialog.Run(this.parent) == Command.Ok);
 }
示例#53
0
文件: Util.cs 项目: xecrets/xwt
 public XwtWin32Window(IWindowFrameBackend window)
 {
     this.window = window;
 }
示例#54
0
 public NativeWindowFrame(IWindowFrameBackend backend)
 {
     this.backend = backend;
 }
示例#55
0
 public void RunLoop(IWindowFrameBackend parent)
 {
     if (parent != null)
         SetTransientFor(parent);
     Window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     Window.ShowDialog ();
 }
示例#56
0
 public bool Run(IWindowFrameBackend parent)
 {
     var p = (WindowFrameBackend) parent;
     int result = MessageService.RunCustomDialog (dialog, p != null ? p.Window : null);
     return result == (int) Gtk.ResponseType.Ok;
 }
示例#57
0
文件: DialogBackend.cs 项目: mono/xwt
        public void RunLoop(IWindowFrameBackend parent)
        {
            // GTK adds a border to the root widget, for some unknown reason
            ((Gtk.Container)Window.Child).BorderWidth = 0;
            Gtk.Window p = parent != null ? ApplicationContext.Toolkit.GetNativeWindow (parent) as Gtk.Window : null;

            bool keepRunning;
            do {
                var res = MessageService.RunCustomDialog (Window, p);
                keepRunning = false;
                if (res == (int) Gtk.ResponseType.DeleteEvent) {
                    keepRunning = !PerformClose (false);
                }
            } while (keepRunning);
        }