public override RectangleF RightViewRect(RectangleF forBounds)
 {
     return(Wrap.Function("RightViewRect", delegate()
     {
         return new RectangleF(new PointF(Bounds.Size.Width - this.RightView.Bounds.Size.Width - 6, Bounds.Size.Height - this.RightView.Bounds.Size.Height - 6), this.RightView.Bounds.Size);
     }));
 }
示例#2
0
        protected virtual CGPath CreateDisclosureIndicatorPath(PointF arrowPointFront, float height, float thickness, out float width)
        {
            float  out_width = 0; // fix for method wrapping
            CGPath result    = Wrap.Function("CreateDisclosureIndicatorPath", delegate()
            {
                thickness  /= (float)Math.Cos(Math.PI / 4);
                CGPath path = new CGPath(); //CGPathCreateMutable();
                path.MoveToPoint(arrowPointFront.X, arrowPointFront.Y);

                PointF bottomPointFront = new PointF(arrowPointFront.X - (float)(height / (2 * Math.Tan(Math.PI / 4))), arrowPointFront.Y - height / 2);
                path.AddLineToPoint(bottomPointFront.X, bottomPointFront.Y);


                PointF bottomPointBack = new PointF(bottomPointFront.X - thickness * (float)Math.Cos(Math.PI / 4), bottomPointFront.Y + thickness * (float)Math.Sin(Math.PI / 4));
                path.AddLineToPoint(bottomPointBack.X, bottomPointBack.Y);

                PointF arrowPointBack = new PointF(arrowPointFront.X - thickness / (float)Math.Cos(Math.PI / 4), arrowPointFront.Y);
                path.AddLineToPoint(arrowPointBack.X, arrowPointBack.Y);

                PointF topPointFront = new PointF(bottomPointFront.X, arrowPointFront.Y + height / 2);
                PointF topPointBack  = new PointF(bottomPointBack.X, topPointFront.Y - thickness * (float)Math.Sin(Math.PI / 4));

                path.AddLineToPoint(topPointBack.X, topPointBack.Y);
                path.AddLineToPoint(topPointFront.X, topPointFront.Y);
                path.AddLineToPoint(arrowPointFront.X, arrowPointFront.Y);

                out_width = (arrowPointFront.X - topPointBack.X);
                return(path);
            });

            width = out_width;
            return(result);
        }
 public override RectangleF PlaceholderRect(RectangleF forBounds)
 {
     return(Wrap.Function("PlaceholderRect", delegate()
     {
         return this.TextRect(forBounds);
     }));
 }
 public override RectangleF LeftViewRect(RectangleF forBounds)
 {
     return(Wrap.Function("LeftViewRect", delegate()
     {
         return new RectangleF(new PointF(8, (float)Math.Ceiling(this.Font.LineHeight * 4 / 7)), this.LeftView.Bounds.Size);
     }));
 }
示例#5
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                return(Wrap.Function("GetCell", delegate()
                {
                    object representedObject = this.Owner.ResultsArray[indexPath.Row];

                    string cellIdentifier = "ResultsCell";
                    UITableViewCell cell = tableView.DequeueReusableCell(cellIdentifier);
                    string subtitle = this.Owner._tokenDelegateShim.SearchResultSubtitleForRepresentedObject(this.Owner.TokenField, representedObject);

                    if (cell == null)
                    {
                        cell = new UITableViewCell((!string.IsNullOrEmpty(subtitle) ? UITableViewCellStyle.Subtitle : UITableViewCellStyle.Default), cellIdentifier);
                    }
                    if (cell.TextLabel != null)
                    {
                        cell.TextLabel.Text = this.Owner._tokenDelegateShim.SearchResultStringForRepresentedObject(this.Owner.TokenField, representedObject);
                    }
                    if (cell.DetailTextLabel != null)
                    {
                        cell.DetailTextLabel.Text = subtitle;
                    }
                    return cell;
                }));
            }
 public override RectangleF EditingRect(RectangleF forBounds)
 {
     return(Wrap.Function("EditingRect", delegate()
     {
         return this.TextRect(forBounds);
     }));
 }
 public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
 {
     return(Wrap.Function("BeginTracking", delegate()
     {
         if (SelectedToken != null && uitouch.View == this)
         {
             this.DeselectSelectedToken();
         }
         return base.BeginTracking(uitouch, uievent);
     }));
 }
 public override bool BecomeFirstResponder()
 {
     return(Wrap.Function("BecomeFirstResponder", delegate()
     {
         if (!this.Editable)
         {
             return false;
         }
         return base.BecomeFirstResponder();
     }));
 }
示例#9
0
 protected virtual CGPath CreateTokenPath(SizeF size, bool innerPath)
 {
     return(Wrap.Function("CreateTokenPath", delegate()
     {
         CGPath path = new CGPath();
         float arcValue = (size.Height / 2) - 1;
         float radius = arcValue - (innerPath ? (1 / UIScreen.MainScreen.Scale) : 0);
         path.AddArc(arcValue, arcValue, radius, (float)(Math.PI / 2f), (float)(Math.PI * 3 / 2f), false);
         path.AddArc(size.Width - arcValue, arcValue, radius, (float)(Math.PI * 3 / 2), (float)(Math.PI / 2), false);
         path.CloseSubpath();
         return path;
     }));
 }
示例#10
0
            public override int RowsInSection(UITableView tableView, int section)
            {
                return(Wrap.Function("RowsInSection", delegate()
                {
                    if (this.Owner.TokenField.Delegate != null)
                    {
                        this.Owner.TokenField.Delegate.DidFinishSearch(this.Owner.TokenField, this.Owner.ResultsArray);
                    }
                    this.Owner.TokenField.RaiseDidFinishSearch(this.Owner.TokenField, this.Owner.ResultsArray);

                    return this.Owner.ResultsArray.Count;
                }));
            }
        protected virtual float LayoutTokensInternal()
        {
            return(Wrap.Function("LayoutTokensInternal", delegate()
            {
                float topMargin = (float)Math.Floor(this.Font.LineHeight * 4 / 7);
                float leftMargin = this.LeftViewWidth + 12f;
                float hPadding = 8f;
                float rightMargin = this.RightViewWidth + hPadding;
                float lineHeight = this.Font.LineHeight + topMargin + 5f;

                this.NumberOfLines = 1;
                _tokenCaret = new PointF(leftMargin, (topMargin - 1));

                TIToken[] tokens = this.Tokens.ToArray();
                foreach (TIToken token in tokens)
                {
                    token.TintColor = this.TokenTintColor;
                    token.Font = this.Font;
                    int maxWidth = (int)(this.Bounds.Size.Width - rightMargin - (this.NumberOfLines > 1 ? hPadding : leftMargin));

                    if (maxWidth > this.MaxTokenWidth)
                    {
                        maxWidth = this.MaxTokenWidth;
                    }
                    token.MaxWidth = maxWidth;

                    if (token.Superview != null)
                    {
                        if (_tokenCaret.X + token.Bounds.Size.Width + rightMargin > this.Bounds.Size.Width)
                        {
                            this.NumberOfLines++;
                            _tokenCaret.X = (this.NumberOfLines > 1 ? hPadding : leftMargin);
                            _tokenCaret.Y += lineHeight;
                        }

                        token.Frame = new RectangleF(_tokenCaret, token.Bounds.Size);
                        _tokenCaret.X += token.Bounds.Size.Width + 4;

                        if (this.Bounds.Size.Width - _tokenCaret.X - rightMargin < 50)
                        {
                            this.NumberOfLines++;
                            _tokenCaret.X = (this.NumberOfLines > 1 ? hPadding : leftMargin);
                            _tokenCaret.Y += lineHeight;
                        }
                    }
                }

                return _tokenCaret.Y + lineHeight;
            }));
        }
        public override RectangleF TextRect(RectangleF forBounds)
        {
            return(Wrap.Function("TextRect", delegate()
            {
                if (this.Text == kTextHidden)
                {
                    return new RectangleF(0f, -40f, 0f, 0f);
                }

                RectangleF frame = forBounds;
                frame.Offset(_tokenCaret.X + 2f, _tokenCaret.Y + 3f);
                frame.Width -= (_tokenCaret.X + this.RightViewWidth + 10);
                return frame;
            }));
        }
 public virtual List <string> GetTokenTitles()
 {
     return(Wrap.Function("GetTokenTitles", delegate()
     {
         List <string> result = new List <string>();
         TIToken[] tokens = this.Tokens.ToArray();
         foreach (var item in tokens)
         {
             if (!string.IsNullOrEmpty(item.Title))
             {
                 result.Add(item.Title);
             }
         }
         return result;
     }));
 }
        public virtual TIToken AddToken(string title, object representedObject = null)
        {
            return(Wrap.Function("AddToken.Text", delegate()
            {
                if (!string.IsNullOrEmpty(title))
                {
                    TIToken token = new TIToken()
                    {
                        Title = title,
                        RepresentedObject = representedObject,
                        Font = this.Font
                    };
                    this.AddToken(token);
                    return token;
                }

                return null;
            }));
        }
 public virtual List <object> GetTokenObjects()
 {
     return(Wrap.Function("GetTokenObjects", delegate()
     {
         List <object> result = new List <object>();
         TIToken[] tokens = this.Tokens.ToArray();
         foreach (var item in tokens)
         {
             if (item.RepresentedObject != null)
             {
                 result.Add(item.RepresentedObject);
             }
             else if (!string.IsNullOrEmpty(item.Title))
             {
                 result.Add(item.Title);
             }
         }
         return result;
     }));
 }