public override void FinishedLaunching (NSObject notification) { window = new NSWindow(new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), NSBackingStore.Buffered, false); window.MakeKeyAndOrderFront(this); //mainWindowController = new MainWindowController (); //mainWindowController.Window.MakeKeyAndOrderFront (this); }
public void BeginSheet (NSWindow window, NSAction onEnded) { BeginSheetForResponse (window, r => { if (onEnded != null) onEnded (); }); }
public ModalEventArgs(IntPtr session, Window window, NSWindow nativeWindow, bool isModal = false, bool isSheet = false) { Session = session; EtoWindow = window; NativeWindow = nativeWindow; IsModal = isModal; IsSheet = isSheet; }
public override void FinishedLaunching(NSObject notification) { text = new NSTextField (new RectangleF (44, 32, 232, 31)) { StringValue = "Hello Mono Mac!" }; window = new NSWindow (new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), 0, false); window.ContentView.AddSubview (text); window.MakeKeyAndOrderFront (this); }
public void RunModal(NSWindow window) { SetUiToStart(); window.DidBecomeKey -= DidBecomeKey; window.DidBecomeKey += DidBecomeKey; window.WillClose -= WindowWillClose; window.WillClose += WindowWillClose; NSApplication.SharedApplication.RunModalForWindow(window); }
partial void goFullScreen (NSObject sender) { isInFullScreenMode = true; // Pause the non-fullscreen view openGLView.StopAnimation (); RectangleF mainDisplayRect; RectangleF viewRect; // Create a screen-sized window on the display you want to take over // Note, mainDisplayRect has a non-zero origin if the key window is on a secondary display mainDisplayRect = NSScreen.MainScreen.Frame; fullScreenWindow = new NSWindow (mainDisplayRect, NSWindowStyle.Borderless, NSBackingStore.Buffered, true); // Set the window level to be above the menu bar fullScreenWindow.Level = NSWindowLevel.MainMenu + 1; // Perform any other window configuration you desire fullScreenWindow.IsOpaque = true; fullScreenWindow.HidesOnDeactivate = true; // Create a view with a double-buffered OpenGL context and attach it to the window // By specifying the non-fullscreen context as the shareContext, we automatically inherit the // OpenGL objects (textures, etc) it has defined viewRect = new RectangleF (0, 0, mainDisplayRect.Size.Width, mainDisplayRect.Size.Height); fullScreenView = new MyOpenGLView (viewRect, openGLView.OpenGLContext); fullScreenWindow.ContentView = fullScreenView; // Show the window fullScreenWindow.MakeKeyAndOrderFront (this); // Set the scene with the full-screen viewport and viewing transformation camera.init(viewRect); // scene.ResizeGLScene (viewRect); // Assign the view's MainController to self fullScreenView.MainController = this; if (!isAnimating) { // Mark the view as needing drawing to initalize its contents fullScreenView.NeedsDisplay = true; } else { // Start playing the animation fullScreenView.StartAnimation (); } }
public override void DidFinishLaunching(NSNotification notification) { var menu = new NSMenu (); var menuItem = new NSMenuItem (); menu.AddItem (menuItem); var appMenu = new NSMenu (); var quitItem = new NSMenuItem ("Quit " + NSProcessInfo.ProcessInfo.ProcessName, "q", (s, e) => NSApplication.SharedApplication.Terminate (menu)); appMenu.AddItem (quitItem); var window = new NSWindow (); menuItem.Submenu = appMenu; NSApplication.SharedApplication.MainMenu = menu; }
public override void FinishedLaunching (NSObject notification) { _window = new NSWindow (new RectangleF(200,200,400,700), NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled, NSBackingStore.Buffered, false, NSScreen.MainScreen); var setup = new Setup (this, _window); setup.Initialize (); var startup = Mvx.Resolve<IMvxAppStart> (); startup.Start (); _window.MakeKeyAndOrderFront (this); return; }
public static void SelectFile(NSWindow window, NSTextField field) { NSOpenPanel openPanel = new NSOpenPanel (); openPanel.BeginSheet (window, (i) => { try { if (openPanel.Url != null) { string path = openPanel.Url.Path; if (!string.IsNullOrEmpty (path)) field.StringValue = path; } } finally { openPanel.Dispose (); } }); }
/// <summary> /// Log Exception/Error. To display alert requires source NSWindow /// </summary> /// <param name="exception">Exception.</param> /// <param name="message">Message.</param> /// <param name="displayAlert">If set to <c>true</c> display alert.</param> /// <param name="source">Source.</param> public static void AQ_Exception(AQ_EXCEPTION_CODE exception, string message, bool displayAlert = true, NSWindow source = null) { // build entry string sExceptionEntry = string.Format ("{0} {1}{2}Exception: {3}{2}{4}" , DateTime.Now.ToShortDateString() , DateTime.Now.ToShortTimeString() , Environment.NewLine , exception , message); // add to log m_sLog += sExceptionEntry + Environment.NewLine; // display alert if (displayAlert) { // create and display alert NSAlert alert = new NSAlert (); alert.AlertStyle = NSAlertStyle.Warning; alert.MessageText = sExceptionEntry; alert.BeginSheet (source); } }
public int RunSheetModal (NSWindow window, NSApplication application) { if (application == null) throw new ArgumentNullException ("application"); // same behavior as BeginSheet with a null window if (window == null) return RunModal (); int returnCode = -1000; BeginSheetForResponse (window, r => { returnCode = r; application.StopModal (); }); application.RunModalForWindow (Window); return returnCode; }
public int RunSheetModal (NSWindow window) { return RunSheetModal (window, NSApplication.SharedApplication); }
public int RunSheetModal(NSWindow window) { return(RunSheetModal(window, NSApplication.SharedApplication)); }
public override SizeF WillResize(NSWindow sender, SizeF to_frame_size) { if (WindowResized != null) WindowResized (to_frame_size); return to_frame_size; }
public void ShowSheetWithTransaction(NSWindow dockToWindow, Transaction transaction) { Transaction = transaction; ShowSheet(dockToWindow); }
public static void Run (NSWindow mainForm) { MonoMacInit(); NSApplication.Main (new string[]{}); }
// Shared initialization code void Initialize () { //window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, false); window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled, NSBackingStore.Buffered, false); window.HasShadow = true; NSView content = window.ContentView; window.WindowController = this; window.Title = "Sign In"; NSTextField signInLabel = new NSTextField(new RectangleF(17, 190, 109, 17)); signInLabel.StringValue = "Sign In:"; signInLabel.Editable = false; signInLabel.Bordered = false; signInLabel.BackgroundColor = NSColor.Control; content.AddSubview(signInLabel); // Create our select button selectButton = new NSButton(new RectangleF(358,12,96,32)); selectButton.Title = "Select"; selectButton.SetButtonType(NSButtonType.MomentaryPushIn); selectButton.BezelStyle = NSBezelStyle.Rounded; selectButton.Activated += delegate { profileSelected(); }; selectButton.Enabled = false; content.AddSubview(selectButton); // Setup our table view NSScrollView tableContainer = new NSScrollView(new RectangleF(20,60,428, 123)); tableContainer.BorderType = NSBorderType.BezelBorder; tableContainer.AutohidesScrollers = true; tableContainer.HasVerticalScroller = true; tableView = new NSTableView(new RectangleF(0,0,420, 123)); tableView.UsesAlternatingRowBackgroundColors = true; NSTableColumn colGamerTag = new NSTableColumn("Gamer"); tableView.AddColumn(colGamerTag); colGamerTag.Width = 420; colGamerTag.HeaderCell.Title = "Gamer Profile"; tableContainer.DocumentView = tableView; content.AddSubview(tableContainer); // Create our add button NSButton addButton = new NSButton(new RectangleF(20,27,25,25)); //Console.WriteLine(NSImage.AddTemplate); addButton.Image = NSImage.ImageNamed("NSAddTemplate"); addButton.SetButtonType(NSButtonType.MomentaryPushIn); addButton.BezelStyle = NSBezelStyle.SmallSquare; addButton.Activated += delegate { addLocalPlayer(); }; content.AddSubview(addButton); // Create our remove button NSButton removeButton = new NSButton(new RectangleF(44,27,25,25)); removeButton.Image = NSImage.ImageNamed("NSRemoveTemplate"); removeButton.SetButtonType(NSButtonType.MomentaryPushIn); removeButton.BezelStyle = NSBezelStyle.SmallSquare; removeButton.Activated += delegate { removeLocalPlayer(); }; content.AddSubview(removeButton); gamerList = MonoGameGamerServicesHelper.DeserializeProfiles(); // for (int x= 1; x< 25; x++) { // gamerList.Add("Player " + x); // } tableView.DataSource = new GamersDataSource(this); tableView.Delegate = new GamersTableDelegate(this); }
public void BeginSheet(NSWindow sheet, NSWindow docWindow) { BeginSheet(sheet, docWindow, null, null, IntPtr.Zero); }
public void BeginSheet(NSWindow sheet, NSWindow docWindow, NSAction onEnded) { var obj = OneShotTracker.Create(onEnded); BeginSheet(sheet, docWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero); }
public void BeginSheet(string directory, string fileName, string [] fileTypes, NSWindow modalForWindow) { BeginSheet(directory, fileName, fileTypes, modalForWindow, null, null, IntPtr.Zero); }
public void BeginSheet(NSWindow window) { BeginSheet(window, null, null, IntPtr.Zero); }
public void goWindow () { isInFullScreenMode = false; // use OrderOut here instead of Close or nasty things will happen with Garbage Collection and a double free fullScreenWindow.OrderOut (this); fullScreenView.DeAllocate (); fullScreenWindow.Dispose (); fullScreenWindow = null; // Switch to the non-fullscreen context openGLView.OpenGLContext.MakeCurrentContext (); if (!isAnimating) { // Mark the view as needing drawing // The animation has advanced while we were in full-screen mode, so its current contents are stale openGLView.NeedsDisplay = true; } else { // continue playing the animation openGLView.StartAnimation (); } }
public Game() { // Initialize collections _services = new GameServiceContainer (); _gameComponentCollection = new GameComponentCollection (); _gameComponentCollection.ComponentAdded += Handle_gameComponentCollectionComponentAdded; // The default for Windows is 480 x 800 //RectangleF frame = NSScreen.MainScreen.Frame; RectangleF frame = new RectangleF(0,0,Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferWidth, Microsoft.Xna.Framework.Graphics.PresentationParameters._defaultBackBufferHeight); //Create a window _mainWindow = new NSWindow (frame, NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, true); // Perform any other window configuration you desire _mainWindow.IsOpaque = true; _view = new GameWindow (frame); _view.game = this; _mainWindow.ContentView.AddSubview (_view); _mainWindow.AcceptsMouseMovedEvents = false; // Initialize GameTime _updateGameTime = new GameTime (); _drawGameTime = new GameTime (); }
public void BeginSheet (string directory, string fileName, string []fileTypes, NSWindow modalForWindow) { BeginSheet (directory, fileName, fileTypes, modalForWindow, null, null, IntPtr.Zero); }
public void BeginSheet(NSPrintInfo printInfo, NSWindow docWindow) { BeginSheet(printInfo, docWindow, null, null, IntPtr.Zero); }
public void BeginSheet (NSPrintInfo printInfo, NSWindow docWindow) { BeginSheet (printInfo, docWindow, null, null, IntPtr.Zero); }
public override bool ShouldZoom (NSWindow window, RectangleF newFrame) { return _owner.AllowUserResizing; }
public void BeginSheet(string directory, string fileName, string [] fileTypes, NSWindow modalForWindow, NSAction onEnded) { var obj = OneShotTracker.Create(onEnded); BeginSheet(directory, fileName, fileTypes, modalForWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero); }
public virtual void ShowSheet(NSWindow dockToWindow) { NSApplication.SharedApplication.BeginSheet(Window, dockToWindow); DidOpen(this, new EventArgs()); }
public int RunModalSheet (NSWindow parent) { var sel = new MonoMac.ObjCRuntime.Selector ("sheetSel"); NSApplication.SharedApplication.BeginSheet (this, parent, this, sel, IntPtr.Zero); this.DidResignKey += StopSharedAppModal; try { sheet = true; return SaveIfOk (NSApplication.SharedApplication.RunModalForWindow (this)); } finally { sheet = false; this.DidResignKey -= StopSharedAppModal; } }
public void BeginSheet (NSWindow sheet, NSWindow docWindow) { BeginSheet (sheet, docWindow, null, null, IntPtr.Zero); }
public Game() { // Initialize collections _services = new GameServiceContainer (); _gameComponentCollection = new GameComponentCollection (); _gameComponentCollection.ComponentAdded += Handle_gameComponentCollectionComponentAdded; RectangleF frame = NSScreen.MainScreen.Frame; //Create a full-screen window _mainWindow = new NSWindow (frame, NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, true); // Perform any other window configuration you desire _mainWindow.IsOpaque = true; _mainWindow.HidesOnDeactivate = true; _view = new GameWindow (frame); _view.game = this; _mainWindow.ContentView.AddSubview (_view); _mainWindow.AcceptsMouseMovedEvents = true; // Initialize GameTime _updateGameTime = new GameTime (); _drawGameTime = new GameTime (); }
public void BeginSheet (string directory, string fileName, string []fileTypes, NSWindow modalForWindow, NSAction onEnded) { var obj = OneShotTracker.Create (onEnded); BeginSheet (directory, fileName, fileTypes, modalForWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero); }
public void BeginSheet (NSWindow window) { BeginSheet (window, null, null, IntPtr.Zero); }
public void BeginSheet (NSPrintInfo printInfo, NSWindow docWindow, NSAction onEnded) { var obj = OneShotTracker.Create (onEnded); BeginSheet (printInfo, docWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero); }
public void BeginSheetForResponse (NSWindow window, Action<int> onEnded) { BeginSheet (window, new NSAlertDidEndDispatcher (onEnded), NSAlertDidEndDispatcher.Selector, IntPtr.Zero); }
public override void ViewWillMoveToWindow (NSWindow newWindow) { //Console.WriteLine("View will move to window"); if (_trackingArea != null) RemoveTrackingArea(_trackingArea); _trackingArea = new NSTrackingArea(Frame, NSTrackingAreaOptions.MouseMoved | NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.EnabledDuringMouseDrag | NSTrackingAreaOptions.ActiveWhenFirstResponder | NSTrackingAreaOptions.InVisibleRect | NSTrackingAreaOptions.CursorUpdate, this, new NSDictionary()); AddTrackingArea(_trackingArea); }
public void BeginSheetForResponse(NSWindow window, Action <int> onEnded) { BeginSheet(window, new NSAlertDidEndDispatcher(onEnded), NSAlertDidEndDispatcher.Selector, IntPtr.Zero); }