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);
		}
示例#2
0
		public void BeginSheet (NSWindow window, NSAction onEnded)
		{
			BeginSheetForResponse (window, r => {
				if (onEnded != null)
					onEnded ();
			});
		}
示例#3
0
文件: MacModal.cs 项目: mhusen/Eto
		public ModalEventArgs(IntPtr session, Window window, NSWindow nativeWindow, bool isModal = false, bool isSheet = false)
		{
			Session = session;
			EtoWindow = window;
			NativeWindow = nativeWindow;
			IsModal = isModal;
			IsSheet = isSheet;
		}
示例#4
0
文件: hello.cs 项目: sichy/monomac
    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);
    }
示例#5
0
        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 ();
				
			}
		}
示例#7
0
        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;
        }
示例#8
0
		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;

		}
示例#9
0
		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 ();
				}


			});

		}
示例#10
0
        /// <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);
            }
        }
示例#11
0
		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;
		}
示例#12
0
		public int RunSheetModal (NSWindow window)
		{
			return RunSheetModal (window, NSApplication.SharedApplication);
		}
示例#13
0
 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);
		}
示例#16
0
		public static void Run (NSWindow mainForm)
		{
			MonoMacInit();
			NSApplication.Main (new string[]{});
		}
示例#17
0
		// 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);
		}
示例#18
0
 public void BeginSheet(NSWindow sheet, NSWindow docWindow)
 {
     BeginSheet(sheet, docWindow, null, null, IntPtr.Zero);
 }
示例#19
0
        public void BeginSheet(NSWindow sheet, NSWindow docWindow, NSAction onEnded)
        {
            var obj = OneShotTracker.Create(onEnded);

            BeginSheet(sheet, docWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero);
        }
示例#20
0
 public void BeginSheet(string directory, string fileName, string [] fileTypes, NSWindow modalForWindow)
 {
     BeginSheet(directory, fileName, fileTypes, modalForWindow, null, null, IntPtr.Zero);
 }
示例#21
0
 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 ();
			}
		}
示例#23
0
文件: Game.cs 项目: Clancey/MonoGame
        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 ();
        }
示例#24
0
		public void BeginSheet (string directory, string fileName, string []fileTypes, NSWindow modalForWindow)
		{
			BeginSheet (directory, fileName, fileTypes, modalForWindow, null, null, IntPtr.Zero);
		}
示例#25
0
 public void BeginSheet(NSPrintInfo printInfo, NSWindow docWindow)
 {
     BeginSheet(printInfo, docWindow, null, null, IntPtr.Zero);
 }
示例#26
0
		public void BeginSheet (NSPrintInfo printInfo, NSWindow docWindow)
		{
			BeginSheet (printInfo, docWindow, null, null, IntPtr.Zero);
		}
示例#27
0
			public override bool ShouldZoom (NSWindow window, RectangleF newFrame)
			{
				return _owner.AllowUserResizing;
			}
示例#28
0
        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;
			}
		}
示例#31
0
		public void BeginSheet (NSWindow sheet, NSWindow docWindow)
		{
			BeginSheet (sheet, docWindow, null, null, IntPtr.Zero);
		}
示例#32
0
文件: Game.cs 项目: simsod/MonoGame
        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 ();
        }
示例#33
0
		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);
		}
示例#34
0
		public void BeginSheet (NSWindow window)
		{
			BeginSheet (window, null, null, IntPtr.Zero);
		}
示例#35
0
		public void BeginSheet (NSPrintInfo printInfo, NSWindow docWindow, NSAction onEnded)
		{
			var obj = OneShotTracker.Create (onEnded);
			BeginSheet (printInfo, docWindow, obj, NSActionDispatcher.Selector, IntPtr.Zero);
		}
示例#36
0
		public void BeginSheetForResponse (NSWindow window, Action<int> onEnded)
		{
			BeginSheet (window, new NSAlertDidEndDispatcher (onEnded), NSAlertDidEndDispatcher.Selector, IntPtr.Zero);
		}
示例#37
0
		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);

		}
示例#38
0
 public void BeginSheetForResponse(NSWindow window, Action <int> onEnded)
 {
     BeginSheet(window, new NSAlertDidEndDispatcher(onEnded), NSAlertDidEndDispatcher.Selector, IntPtr.Zero);
 }