public void TrackingStarted(object sender, TrackingEventArgs e)
        {
            var button = (ButtonView)sender;

            UIGraphics.BeginImageContext(button.Bounds.Size);
            button.Layer.RenderInContext(UIGraphics.GetCurrentContext());
            UIImage image = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            if (trackingImageView == null)
            {
                trackingImageView = new UIImageView(CGRect.Empty);
                Superview.AddSubview(trackingImageView);
                trackingImageView.Alpha = 0.5f;
            }

            trackingImageView.Image = image;
            trackingImageView.SizeToFit();
            CGRect frame    = trackingImageView.Frame;
            var    newFrame = new CGRect(Superview.ConvertPointFromView(button.Frame.Location, this), frame.Size);

            trackingImageView.Frame = newFrame;
            if (ButtonSelectedEvent != null)
            {
                ButtonSelectedEvent(button);
            }
        }
Beispiel #2
0
        public override void MouseDown(NSEvent theEvent)
        {
            base.MouseDown(theEvent);

            var locationInSV = Superview.ConvertPointFromView(theEvent.LocationInWindow, null);

            if (theEvent.ClickCount == 2 && HitTest(locationInSV) == this)
            {
                Window.Zoom(this);
            }
        }
Beispiel #3
0
        public override void MouseDown(NSEvent theEvent)
        {
            base.MouseDown(theEvent);

            var locationInSV = Superview.ConvertPointFromView(theEvent.LocationInWindow, null);

            if (theEvent.ClickCount == 2 && HitTest(locationInSV) == this)
            {
                bool miniaturise = false;

                if (MacSystemInformation.OsVersion < MacSystemInformation.ElCapitan)
                {
                    miniaturise = NSUserDefaults.StandardUserDefaults.BoolForKey("AppleMiniaturizeOnDoubleClick");
                }
                else
                {
                    var action = NSUserDefaults.StandardUserDefaults.StringForKey("AppleActionOnDoubleClick");
                    if (action == "None")
                    {
                        return;
                    }
                    else if (action == "Minimize")
                    {
                        miniaturise = true;
                    }
                }

                if (miniaturise)
                {
                    Window.Miniaturize(this);
                }
                else
                {
                    Window.Zoom(this);
                }
            }
        }