コード例 #1
0
 public AlertButtonWrapper(NSButton nsbutton, MessageDescription message, AlertButton alertButton, NSAlert alert)
 {
     this.nsbutton    = nsbutton;
     this.message     = message;
     this.alertButton = alertButton;
     this.alert       = alert;
     oldAction        = nsbutton.Action;
 }
コード例 #2
0
        public static bool IsSelectorExcludedFromWebScript(MonoMac.ObjCRuntime.Selector aSelector)
        {
            // For security, you must explicitly allow a selector to be called from JavaScript.
            if (aSelector.Name == "showMessage:")
            {
                return(false);                // i.e. showMessage: is NOT _excluded_ from scripting, so it can be called.
            }
            if (aSelector.Name == "alert:")
            {
                return(false);
            }

            return(true);            // disallow everything else
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
ファイル: MyDocument.cs プロジェクト: Dynalon/tomboy.osx
        partial void StartSearch(NSSearchField sender)
        {
            var    noteResults    = AppDelegate.NoteEngine.GetNotes(sender.StringValue, true);
            NSMenu noteSearchMenu = new NSMenu("Search Results");
            var    action         = new MonoMac.ObjCRuntime.Selector("searchResultSelected");

            foreach (var name in noteResults.Values.Select(n => n.Title))
            {
                noteSearchMenu.AddItem(name, action, string.Empty);
            }
            Logger.Debug(sender.Frame.ToString());
            Logger.Debug(sender.Superview.Frame.ToString());
            Logger.Debug(sender.Superview.Superview.Frame.ToString());
            NSEvent evt = NSEvent.OtherEvent(NSEventType.ApplicationDefined,
                                             new PointF(sender.Frame.Left, sender.Frame.Top),
                                             (NSEventModifierMask)0,
                                             0,
                                             sender.Window.WindowNumber,
                                             sender.Window.GraphicsContext,
                                             (short)NSEventType.ApplicationDefined,
                                             0, 0);

            NSMenu.PopUpContextMenu(noteSearchMenu, evt, searchField);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Text.TextViewModel+FontManagerController"/> class.
 /// </summary>
 /// <param name="window">Window.</param>
 /// <param name="fontFaceName">Font face name.</param>
 /// <param name="fontSize">Font size.</param>
 /// <param name="fontChangedCallback">Font changed callback.</param>
 public FontManagerController(RhinoMac.Window window, string fontFaceName, float fontSize, FontChangedEvent fontChangedCallback)
 {
     // Need the window to get the responder chain working
       _window = window;
       // Call this function when the selected font changes
       _fontChangedCallback = fontChangedCallback;
       // The close flag defaults to ture, set it to false if the
       // shared font manager panel is currently open so it will
       // be left open when this window closes otherwise the
       // font panel will close when this form does.
       if (null != MonoMac.AppKit.NSFontPanel.SharedFontPanel && MonoMac.AppKit.NSFontPanel.SharedFontPanel.IsVisible)
     _closeFontManager = false;
       // Get an instance of the font manager panel
       _fontManager = MonoMac.AppKit.NSFontManager.SharedFontManager;
       // Create an instance of the font we want to change when
       // the font manger selection changes, the font face name
       // will be extracted from this font and passed to the
       // associated view model.
       _font = MonoMac.AppKit.NSFont.FromFontName(fontFaceName, fontSize);
       // Set the font manager panel target to this object so the
       // ChangeFont() method will get called when the current font
       // selection changes
       //_fontManager.Target = this;
       //
       // Save the responder chain
       //
       _resetResponderChain = true;
       _thisNextResponder = NextResponder;
       _windowNextResponder = _window.NextResponder;
       _action = _fontManager.Action;
       //
       // Redirect the responder chain
       this.NextResponder = _window.NextResponder;
       _window.NextResponder = this;
       _fontManager.Action = new MonoMac.ObjCRuntime.Selector("changeFontAction:");
       // Set the currently selected font in the font manger panel
       _fontManager.SetSelectedFont(_font, false);
 }
コード例 #6
0
ファイル: MyDocument.cs プロジェクト: garuma/Macboy
partial         void StartSearch(MonoMac.AppKit.NSSearchField sender)
        {
            var noteResults = AppDelegate.NoteEngine.GetNotes (sender.StringValue, true);
            NSMenu noteSearchMenu = new NSMenu ("Search Results");
            var action = new MonoMac.ObjCRuntime.Selector ("searchResultSelected");
            foreach (var name in noteResults.Values.Select (n => n.Title))
                noteSearchMenu.AddItem (name, action, string.Empty);
            Console.WriteLine (sender.Frame);
            Console.WriteLine (sender.Superview.Frame);
            Console.WriteLine (sender.Superview.Superview.Frame);
            NSEvent evt = NSEvent.OtherEvent (NSEventType.ApplicationDefined,
                                              new PointF (sender.Frame.Left, sender.Frame.Top),
                                              (NSEventModifierMask)0,
                                              0,
                                              sender.Window.WindowNumber,
                                              sender.Window.GraphicsContext,
                                              (short)NSEventType.ApplicationDefined,
                                              0, 0);
            NSMenu.PopUpContextMenu (noteSearchMenu, evt, searchField);
        }
コード例 #7
0
		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;
			}
		}
コード例 #8
0
 public VerticalScrollBarWrapper()
 {
     //Orientation = Orientation.Horizontal;
     Continuous = true;
     Action = new MonoMac.ObjCRuntime.Selector("scrollAction:");
 }
コード例 #9
0
		public AlertButtonWrapper (NSButton nsbutton, MessageDescription message, AlertButton alertButton, NSAlert alert)
		{
			this.nsbutton = nsbutton;
			this.message = message;
			this.alertButton = alertButton;
			this.alert = alert;
			oldAction = nsbutton.Action;
		}
コード例 #10
0
ファイル: MyDocument.cs プロジェクト: Dynalon/tomboy.osx
 public override void CanCloseDocument(NSObject delegateObject, MonoMac.ObjCRuntime.Selector shouldCloseSelector, IntPtr contextInfo)
 {
     SaveData();
     // we must call the base class again otherwise the Window will not close.
     base.CanCloseDocument(delegateObject, shouldCloseSelector, contextInfo);
 }
コード例 #11
0
ファイル: MyDocument.cs プロジェクト: Dynalon/tomboy.osx
 public override void SaveDocument(NSObject delegateObject, MonoMac.ObjCRuntime.Selector didSaveSelector, IntPtr contextInfo)
 {
     Logger.Debug("Not sure what this is doing yet SaveDocument {0}", delegateObject.GetType());
     SaveData();
 }