示例#1
0
 public MainWindowView(IntPtr handle) : base(handle)
 {
     bottomView = Subviews.First(x => x.Identifier == "PlaybackBar");
     bottomView.AddSubview(new PlaybackBar(bottomView.Bounds));
     topView = Subviews.OfType <NSSplitView> ().First();
     LayoutSubviews();
 }
示例#2
0
 public void SuperCrossViewAppearing()
 {
     if (SubCrossViewModel != null && (this.Subviews == null || !Subviews.Any(view => view == SubCrossViewModel.CrossView)))
     {
         SubCrossViewModel.ShowIn(this);
     }
 }
示例#3
0
 void HideDefaultActivityIndicator()
 {
     if (Subviews.Count() > 0)
     {
         Subviews[0].Hidden = true;
     }
 }
示例#4
0
            public override void LayoutSubviews()
            {
                base.LayoutSubviews();

                var subviews = Subviews.ToList();
                var bounds   = Bounds;

                if (bounds.Size == size)
                {
                    return;
                }
                size = bounds.Size;
                var backButton = subviews.OfType <UIButton>().FirstOrDefault();

                if (backButton != null)
                {
                    Console.WriteLine(backButton);
                    var frame = Bounds;
                    frame.Height    *= (30 / 44);
                    frame.Width      = frame.Height * (37 / 30);
                    backButton.Frame = frame;
                }

                var style = this.GetStyle();

                this.BarStyle = style.BarStyle;
                this.SetTitleVerticalPositionAdjustment(style.MainTextFont.PointSize * -.5f, UIBarMetrics.Default);
                this.TitleTextAttributes = new UIStringAttributes
                {
                    Font            = style.MainTextFont.WithSize(style.MainTextFont.PointSize * 1.5f),
                    ForegroundColor = UIColor.White,
                };
            }
示例#5
0
        public override void DidTransitionToState(UITableViewCellState mask)
        {
            base.DidTransitionToState(mask);

            if (!Theme.IsiOS7)
            {
                //If the "delete" button is appearing, let's reposition it and use a different animation
                if ((mask & UITableViewCellState.ShowingDeleteConfirmationMask) != 0)
                {
                    var deleteButton = Subviews.Last();

                    //Position the button
                    var frame = deleteButton.Frame;
                    frame.X           -= 45;
                    deleteButton.Frame = frame;

                    //Animate the button "fading" in
                    UIView.BeginAnimations("ShowDeleteButton");
                    UIView.SetAnimationDuration(.3);
                    UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    deleteButton.Alpha = 1;
                    UIView.CommitAnimations();
                }
                else
                {
                    //Animate the icon "fading" in
                    UIView.BeginAnimations("ShowIcon");
                    UIView.SetAnimationDuration(.3);
                    UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    icon.Alpha = 1;
                    UIView.CommitAnimations();
                }
            }
        }
示例#6
0
        public override void Layout()
        {
            const int padding            = 10;
            nfloat    availableHeight    = Frame.Height;
            nfloat    availableWidth     = Frame.Width - padding * 2;
            nfloat    imageWidth         = 0;
            nfloat    accessoryViewWidth = 0;

            if (ImageView != null)
            {
                nfloat imageHeight = imageWidth = availableHeight;
                ImageView.Frame = new CGRect(padding, 0, imageWidth, imageHeight);
            }

            if (AccessoryView != null)
            {
                accessoryViewWidth  = _style == NSTableViewCellStyle.Value1 ? 50 : availableWidth - 100;
                AccessoryView.Frame = new CGRect(availableWidth - accessoryViewWidth + padding, 0, accessoryViewWidth,
                                                 availableHeight);
                foreach (var subView in AccessoryView.Subviews)
                {
                    //try to find the size the control wants, if no width use default width
                    var size = subView.FittingSize;
                    if (size.Width == 0)
                    {
                        size.Width = accessoryViewWidth;
                    }

                    var x = AccessoryView.Bounds.Width - size.Width;
                    var y = (AccessoryView.Bounds.Height - size.Height) / 2;
                    subView.Frame = new CGRect(new CGPoint(x, y), size);
                }
            }

            nfloat labelHeights = availableHeight;
            nfloat labelWidth   = availableWidth - imageWidth - accessoryViewWidth;

            if (DetailTextLabel != null)
            {
                if (!string.IsNullOrEmpty(DetailTextLabel?.StringValue))
                {
                    labelHeights = availableHeight / 2;
                    DetailTextLabel.CenterTextVertically(new CGRect(imageWidth + padding, 0, labelWidth, labelHeights));
                }
            }

            TextLabel?.CenterTextVertically(new CGRect(imageWidth + padding, availableHeight - labelHeights, labelWidth,
                                                       labelHeights));

            var topNSView = Subviews.LastOrDefault();

            if (_contexActionsTrackingView != topNSView)
            {
                _contexActionsTrackingView.RemoveFromSuperview();
                _contexActionsTrackingView.Frame = Frame;
                AddSubview(_contexActionsTrackingView, NSWindowOrderingMode.Above, Subviews.LastOrDefault());
            }
            base.Layout();
        }
示例#7
0
 public override void MovedToWindow()
 {
     base.MovedToWindow();
     if (SubCrossViewModel != null && (this.Subviews.Length == 0 && !Subviews.Any(view => view == SubCrossViewModel.CrossView)))
     {
         SubCrossViewModel.ShowIn(this);
     }
 }
示例#8
0
 void RemoveActivityIndicators()
 {
     //existing acitvity indicators
     foreach (var ai in Subviews.Where(c => c.GetType() == typeof(UIActivityIndicatorView)))
     {
         ai.RemoveFromSuperview();
     }
 }
示例#9
0
    public void removeLastBox(NSObject sender)
    {
        NSObject last = Subviews.LastObject().To <NSObject>();

        last.Call("removeFromSuperview");

        DoLayout();
    }
示例#10
0
 public void Clear()
 {
     completed = false;
     Subviews.ForEach(x => {
         x.RemoveFromSuperview();
         x.Dispose();
     });
 }
示例#11
0
 public override void AddSubview(UIView view)
 {
     base.AddSubview(view);
     if (_attributionPanel != null && Subviews.Contains(_attributionPanel))
     {
         BringSubviewToFront(_attributionPanel);
     }
 }
示例#12
0
        public override void DidAddSubview(NSView NSView)
        {
            base.DidAddSubview(NSView);

            // Reference the list as we don't know where
            // the items has been added other than by getting the complete list.
            // Subviews materializes a new array at every call, which makes it safe to
            // reference.
            _shadowChildren = Subviews.ToList();
        }
示例#13
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            DimmedView.Frame = Bounds;

            foreach (var ai in Subviews.Where(c => c.GetType() == typeof(UIActivityIndicatorView)))
            {
                ai.Frame = Bounds;
            }
        }
示例#14
0
        public override void WillTransitionToState(UITableViewCellState mask)
        {
            base.WillTransitionToState(mask);

            //If the "delete" button is appearing, set the alpha to 0 so it is invisible
            if (!Theme.IsiOS7 && (mask & UITableViewCellState.ShowingDeleteConfirmationMask) != 0)
            {
                var deleteButton = Subviews.Last();
                deleteButton.Alpha = 0f;
            }
        }
示例#15
0
 public virtual void Clear()
 {
     foreach (var field in Subviews.OfType <UITextField>())
     {
         field.Text = String.Empty;
     }
     foreach (var field in bubbleViews.Keys.ToArray())
     {
         HideBubbleFor(field);
     }
 }
示例#16
0
        public override bool PointInside(CGPoint point, UIEvent uievent)
        {
            OnPointInside?.Invoke(this, EventArgs.Empty);

            if (PassThroughTouchEvents)
            {
                return(Subviews.Any(s => !s.Hidden && s.PointInside(point, uievent)));
            }

            return(base.PointInside(point, uievent));
        }
示例#17
0
 public override bool PointInside(CGPoint point, UIEvent uievent)
 {
     foreach (var view in Subviews.Reverse())
     {
         if (view.PointInside(view.ConvertPointFromView(point, this), uievent))
         {
             return(true);
         }
     }
     return(base.PointInside(point, uievent));
 }
示例#18
0
 public override bool PointInside(CGPoint point, UIEvent uievent)
 {
     if (Subviews.Any(subview => !subview.Hidden && subview.UserInteractionEnabled && subview.PointInside(ConvertPointToView(point, subview), uievent)))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#19
0
        public override bool PointInside(CGPoint point, UIEvent uievent)
        {
            bool result = Bounds.Contains(point);
            var  i      = 0;

            while (!result && i < Subviews.Count())
            {
                var frame = Subviews[i++].Frame;
                result = frame.Contains(point);
            }
            return(result);
        }
示例#20
0
 public void ShowDimmedView()
 {
     if (!Subviews.Contains(DimmedView))
     {
         DimmedView.UserInteractionEnabled = false;
         DimmedView.Alpha           = .45f;
         DimmedView.BackgroundColor = UIColor.Black;
         AddSubview(DimmedView);
     }
     DimmedView.Frame  = Frame;
     DimmedView.Hidden = false;
     BringSubviewToFront(DimmedView);
 }
示例#21
0
 // Hit test on our ring views regardless of our own bounds.
 public override UIView HitTest(CGPoint point, UIEvent uievent)
 {
     foreach (var view in Subviews.Reverse())
     {
         var localPoint = view.ConvertPointFromView(point, this);
         if (view.PointInside(localPoint, uievent))
         {
             return(view);
         }
     }
     // Don't hit-test ourself.
     return(null);
 }
示例#22
0
        /// <summary>
        /// The focus has moved to a new control. Track the focused button
        /// if it's one of ours.
        /// </summary>
        /// <param name="context">Focus update context.</param>
        /// <param name="coordinator">Focus animation coordinator.</param>
        public override void DidUpdateFocus(UIFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            base.DidUpdateFocus(context, coordinator);

            var buttons = Subviews.Cast <MenuButton>().ToList();

            for (int i = 0; i < buttons.Count; i++)
            {
                if (context.NextFocusedView == buttons[i])
                {
                    FocusedButtonIndex = i;
                }
            }
        }
示例#23
0
            public override void LayoutSubviews()
            {
                base.LayoutSubviews();

                // man, don't even ask
                var subview = Subviews.LastOrDefault();

                if (subview != null)
                {
                    var frame = subview.Frame;
                    frame.Y       = 90;
                    subview.Frame = frame;
                }
            }
示例#24
0
        void PrepareForNewPosition(FrontViewPosition newPosition)
        {
            if (RearView == null || RightView == null)
            {
                return;
            }

            int symetry = newPosition < FrontViewPosition.FrontViewPositionLeft ? -1 : 1;

            var rearIndex  = Subviews.ToList().IndexOf(RearView);
            var rightIndex = Subviews.ToList().IndexOf(RightView);

            if ((symetry < 0 && rightIndex < rearIndex) || (symetry > 0 && rearIndex < rightIndex))
            {
                ExchangeSubview(rightIndex, rearIndex);
            }
        }
示例#25
0
        /* Dialog close animation then cleaning and removing the view from the parent */
        private void Close()
        {
            var currentTransform = _dialogView.Layer.Transform;

            if (ValueForKeyPath(new NSString(str: "layer.transform.rotation.z")) is NSNumber startRotation)
            {
                var startRotationAngle = startRotation.DoubleValue;

                var rotation = CATransform3D.MakeRotation(
                    (nfloat)(-startRotationAngle + Math.PI * 270 / 180d),
                    x: 0f,
                    y: 0f,
                    z: 0f);

                _dialogView.Layer.Transform = rotation.Concat(CATransform3D.MakeScale(sx: 1, sy: 1, sz: 1));
            }

            _dialogView.Layer.Opacity = 1;

            Animate(
                duration: 0.2,
                delay: 0d,
                UIViewAnimationOptions.TransitionNone,
                animation: () =>
            {
                BackgroundColor = UIColor.FromRGBA(
                    red: 0,
                    green: 0,
                    blue: 0,
                    alpha: 0);

                _dialogView.Layer.Transform = currentTransform.Concat(CATransform3D.MakeScale(sx: 0.6f, sy: 0.6f, sz: 1f));
                _dialogView.Layer.Opacity   = 0;
            },
                completion: () =>
            {
                var subViews = Subviews.ToArray();

                foreach (var v in subViews)
                {
                    v.RemoveFromSuperview();
                }
            });

            RemoveFromSuperview();
        }
示例#26
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            // change position of Legal link on map
            var legalView = Subviews.FirstOrDefault(x => x is UILabel);

            if (legalView != null)
            {
                var leftMargin      = 8;
                var bottomMargin    = 13;
                var menuButtonWidth = 39;
                legalView
                .SetX(leftMargin + menuButtonWidth + 15)
                .SetY(Frame.Bottom - legalView.Frame.Height - bottomMargin);
            }
        }
示例#27
0
        void UpdateContent()
        {
            ClipsToBounds = true;

            if (Element.Content == null)
            {
                _contentView = CreateEmptyContent();
                AddSubview(_contentView);
            }
            else
            {
                var content = Subviews.FirstOrDefault(v => v is Platform.DefaultRenderer);

                if (content != null)
                {
                    _contentView = content;
                }
            }
        }
示例#28
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            if (!Subviews.Any())
            {
                this.SetOverlay(Transparency);
            }

            foreach (var subview in Subviews)
            {
                var frame = subview.Frame;

                frame.Width  = Frame.Width;
                frame.Height = Frame.Height;

                subview.Frame = frame;
            }
        }
示例#29
0
        private void TransformTile(RefreshArguments arguments)
        {
            foreach (var drawnTile in Subviews.OfType <DeepZoomTileView>())
            {
                if (arguments.Scale == 0.0f)
                {
                    drawnTile.Center = new CGPoint(drawnTile.Center.X + arguments.OffsetX, drawnTile.Center.Y + arguments.OffsetY);
                }
                else
                {
                    nfloat left   = (nfloat)Math.Ceiling((drawnTile.Frame.X - currentExtent.X));
                    nfloat top    = (nfloat)Math.Ceiling((drawnTile.Frame.Y - currentExtent.Y));
                    nfloat width  = drawnTile.TileWidth;
                    nfloat height = drawnTile.TileHeight;

                    drawnTile.Frame = new CGRect(left, top, width, height);
                }
            }
        }
示例#30
0
 public SimpleActionSheet()
 {
     Clicked += (object sender, UIButtonEventArgs e) => {
         Action a;
         if (dict.TryGetValue(e.ButtonIndex, out a) && a != null)
         {
             a();
         }
     };
     WillPresent += (object sender, EventArgs e) => {
         foreach (UIButton b in Subviews.Where(x => x is UIButton))
         {
             UIColor color;
             if (!colors.TryGetValue(b.Tag - 1, out color))
             {
                 continue;
             }
             b.SetTitleColor(color, UIControlState.Normal);
         }
     };
 }