Beispiel #1
0
        public Note() : base()
        {
            SetFrame(new CGRect(0, 0, 480, 240), true);
            Center();

            Delegate    = new SparkleNoteDelegate();
            StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
            Title       = "Add Note";
            MaxSize     = new CGSize(480, 240);
            MinSize     = new CGSize(480, 240);
            HasShadow   = true;
            IsOpaque    = false;
            BackingType = NSBackingStore.Buffered;
            Level       = NSWindowLevel.Floating;

            this.hidden_close_button = new NSButton()
            {
                Frame = new CGRect(0, 0, 0, 0),
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            CreateNote();


            this.hidden_close_button.Activated += delegate { Controller.WindowClosed(); };

            Controller.HideWindowEvent += delegate {
                SparkleShare.Controller.Invoke(() => PerformClose(this));
            };

            Controller.ShowWindowEvent += delegate {
                SparkleShare.Controller.Invoke(() => OrderFrontRegardless());
                CreateNote();
            };

            Controller.UpdateTitleEvent += delegate(string title) {
                SparkleShare.Controller.Invoke(() => { Title = title; });
            };


            ContentView.AddSubview(this.hidden_close_button);
        }
Beispiel #2
0
        public Note()
            : base()
        {
            SetFrame (new RectangleF (0, 0, 480, 240), true);
            Center ();

            Delegate    = new SparkleNoteDelegate ();
            StyleMask   = (NSWindowStyle.Closable | NSWindowStyle.Titled);
            Title       = "Add Note";
            MaxSize     = new SizeF (480, 240);
            MinSize     = new SizeF (480, 240);
            HasShadow   = true;
            IsOpaque    = false;
            BackingType = NSBackingStore.Buffered;
            Level       = NSWindowLevel.Floating;

            this.hidden_close_button = new NSButton () {
                Frame                     = new RectangleF (0, 0, 0, 0),
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            CreateNote ();

            this.hidden_close_button.Activated += delegate { Controller.WindowClosed (); };

            Controller.HideWindowEvent += delegate {
                SparkleShare.Controller.Invoke (() => PerformClose (this));
            };

            Controller.ShowWindowEvent += delegate {
                SparkleShare.Controller.Invoke (() => OrderFrontRegardless ());
                CreateNote ();
            };

            Controller.UpdateTitleEvent += delegate (string title) {
                SparkleShare.Controller.Invoke (() => { Title = title; });
            };

            ContentView.AddSubview (this.hidden_close_button);
        }