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; }
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); }
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); }; }
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); }
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); } }
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; }
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; }
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); }
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); }
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); }
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); }
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); }
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); } }
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; }
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); }
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); }
void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window) { this.Window.Owner = ((WindowFrameBackend)window).Window; }
public bool Run(IWindowFrameBackend parent) { var returnValue = this.RunModal(); return returnValue == 1; }
public void RunLoop(IWindowFrameBackend parent) { var p = (WindowFrameBackend)parent; MessageService.RunCustomDialog(Window, p != null ? p.Window : null); }
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; }
void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window) { Window.TransientFor = ((WindowFrameBackend)window).Window; }
/// <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)); }
public override object GetNativeWindow(IWindowFrameBackend backend) { return backend?.Window as System.Windows.Window; }
public override object GetNativeWindow(IWindowFrameBackend backend) { return(backend?.Window as System.Windows.Window); }
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); }
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); }
void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window) { Window.TransientFor = ((WindowFrameBackend)window).Window; }
public void RunLoop(IWindowFrameBackend parent) { Visible = true; NSApplication.SharedApplication.RunModalForWindow (this); }
public bool Run (IWindowFrameBackend parent) { fontSelector.SelectedFont = SelectedFont; return fontDialog.Run (this.parent) == Command.Ok; }
/// <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);
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); }
void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window) { Window.TransientFor = ApplicationContext.Toolkit.GetNativeWindow (window) as Gtk.Window; }
public void RunLoop (IWindowFrameBackend parent) { if (parent != null) Window.Owner = ((WindowFrameBackend) parent).Window; Window.WindowStartupLocation = WindowStartupLocation.CenterOwner; Window.ShowDialog (); }
public void SetTransientFor(IWindowFrameBackend window) { throw new NotImplementedException(); }
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); }
public override object GetNativeWindow(IWindowFrameBackend backend) { throw new NotImplementedException(); }
public void RunLoop(IWindowFrameBackend parent) { Window.Owner = ((WindowFrameBackend) parent).Window; Window.ShowDialog (); }
void IWindowFrameBackend.SetTransientFor (IWindowFrameBackend window) { // Generally, TransientFor is used to implement dialog, we reproduce the assumption here Level = window == null ? NSWindowLevel.Normal : NSWindowLevel.ModalPanel; }
void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window) { // Generally, TransientFor is used to implement dialog, we reproduce the assumption here Level = window == null ? NSWindowLevel.Normal : NSWindowLevel.ModalPanel; }
public NativeWindowFrame(IWindowFrameBackend backend) { BackendHost.SetCustomBackend(backend); }
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); }
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; }
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); }
public bool Run(IWindowFrameBackend parent) { var returnValue = this.RunModal(); return(returnValue == 1); }
void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window) { this.Window.Owner = ((WindowFrameBackend) window).Window; }
void IWindowFrameBackend.SetTransientFor(IWindowFrameBackend window) { Window.TransientFor = ApplicationContext.Toolkit.GetNativeWindow(window) as Gtk.Window; }
public void RunLoop(IWindowFrameBackend parent) { Visible = true; NSApplication.SharedApplication.RunModalForWindow(this); }
public void RunLoop(IWindowFrameBackend parent) { var p = (WindowFrameBackend) parent; MessageService.RunCustomDialog (Window, p != null ? p.Window : null); }
public bool Run(IWindowFrameBackend parent) { fontSelector.SelectedFont = SelectedFont; return(fontDialog.Run(this.parent) == Command.Ok); }
public XwtWin32Window(IWindowFrameBackend window) { this.window = window; }
public NativeWindowFrame(IWindowFrameBackend backend) { this.backend = backend; }
public void RunLoop(IWindowFrameBackend parent) { if (parent != null) SetTransientFor(parent); Window.WindowStartupLocation = WindowStartupLocation.CenterOwner; Window.ShowDialog (); }
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; }
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); }