NSMutableParagraphStyle GetLeftAlignStyle()
        {
            NSMutableParagraphStyle style = new NSMutableParagraphStyle();

            style.Alignment = UITextAlignment.Left;
            return(style);
        }
 /// <summary>
 ///     Set paragraph style.
 /// </summary>
 /// <param name="self">Attributed string.</param>
 /// <param name="style">Paragraph style. Use <see cref="NewParagraphStyle" /> for create custom style.</param>
 /// <returns>An instance of a mutable string.</returns>
 public static NSMutableAttributedString ParagraphStyle(
     this NSMutableAttributedString self,
     NSMutableParagraphStyle style)
 {
     self.AddAttribute(UIStringAttributeKey.ParagraphStyle, style, new NSRange(0, self.Length));
     return(self);
 }
Esempio n. 3
0
        public static NSMutableAttributedString?WithLineHeight(this NSAttributedString attributedString, double lineHeight)
        {
            if (attributedString == null || attributedString.Length == 0)
            {
                return(null);
            }

            var attribute = (NSParagraphStyle)attributedString.GetAttribute(UIStringAttributeKey.ParagraphStyle, 0, out _);

            // if we need to un-set the line height but there is no attribute to modify then we do nothing
            if (lineHeight == -1 && attribute == null)
            {
                return(null);
            }

            var mutableParagraphStyle = new NSMutableParagraphStyle();

            if (attribute != null)
            {
                mutableParagraphStyle.SetParagraphStyle(attribute);
            }

            mutableParagraphStyle.LineHeightMultiple = new nfloat(lineHeight >= 0 ? lineHeight : -1);

            var mutableAttributedString = new NSMutableAttributedString(attributedString);

            mutableAttributedString.AddAttribute
            (
                UIStringAttributeKey.ParagraphStyle,
                mutableParagraphStyle,
                new NSRange(0, mutableAttributedString.Length)
            );

            return(mutableAttributedString);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);

            if (Element != null)
            {
                if (Element.FontFamily == null)
                {
                    Control.Font = GetFont();
                }

                if (Element.Text != null)
                {
                    float lineSpacing = 5;

                    if (Math.Abs(lineSpacing - (-1)) > 0.05)
                    {
                        var paragraphStyle = new NSMutableParagraphStyle
                        {
                            LineSpacing   = lineSpacing,
                            LineBreakMode = (UILineBreakMode)Enum.Parse(typeof(UILineBreakMode), Element.LineBreakMode.ToString())
                        };



                        var text  = new NSMutableAttributedString(Element.Text);
                        var style = UIStringAttributeKey.ParagraphStyle;
                        var range = new NSRange(0, text.Length);

                        text.AddAttribute(style, paragraphStyle, range);
                        Control.AttributedText = text;
                    }
                }
            }
        }
Esempio n. 5
0
        private UIStringAttributes GetLineHeightAttributes()
        {
            var attributes = new UIStringAttributes();

            var paragraphStyle = new NSMutableParagraphStyle()
            {
                MinimumLineHeight = (nfloat)LineHeight,
                Alignment         = TextAlignment.ToNativeTextAlignment(),
                LineBreakMode     = GetLineBreakMode(),
            };

            if (LineStackingStrategy != LineStackingStrategy.MaxHeight)
            {
                paragraphStyle.MaximumLineHeight = (nfloat)LineHeight;
            }
            attributes.ParagraphStyle = paragraphStyle;

            // BaselineOffset calculation is only required when the text's font size does not take up the entire line height
            // Otherwise this calculation will result in invalid values causing the text to be pushed out of the UILabel's rect
            if (Font != null && Font.LineHeight < LineHeight)
            {
                // iOS puts text at the bottom of the line box, whereas Windows puts it at the top. Empirically this offset gives similar positioning to Windows.
                // (Note that Descender is typically a negative value.)
                var verticalOffset = ((float)LineHeight - (float)Font.LineHeight) * .56f + (float)Font.Descender;
                attributes.BaselineOffset = verticalOffset;
            }

            return(attributes);
        }
		public override void AwakeFromNib ()
		{
			ivGravatar.WantsLayer = true;
			ivGravatar.Layer.CornerRadius = ivGravatar.Frame.Width / 2;
			ivGravatar.Layer.MasksToBounds = true;
			DisplayGravatar (XamarinAccountEmail);

			// Change button text color to white and centered (lame that you can't do this in IB)
			var coloredTitle = new NSMutableAttributedString (btnLogin.Title);
			var titleRange = new NSRange (0, coloredTitle.Length);
			coloredTitle.AddAttribute (NSAttributedString.ForegroundColorAttributeName, NSColor.White, titleRange);
			var centeredAttribute = new NSMutableParagraphStyle ();
			centeredAttribute.Alignment = NSTextAlignment.Center;
			coloredTitle.AddAttribute (NSAttributedString.ParagraphStyleAttributeName, centeredAttribute, titleRange);
			btnLogin.AttributedTitle = coloredTitle;

			btnLogin.Activated += (object sender, EventArgs e) => Login();
			var txtDelegate = new CustomNSTextFieldDelegate ();
			txtDelegate.ReturnKeyPressed += () => Login();
			txtPassword.Delegate = txtDelegate;

			txtEmail.StringValue = XamarinAccountEmail;
			txtEmail.FocusRingType = NSFocusRingType.None;
			txtPassword.FocusRingType = NSFocusRingType.None;
			txtPassword.SelectText (this);
			txtPassword.BecomeFirstResponder ();
		}
        /// <summary>
        /// Set maxFontSize for accessibility - large text
        /// </summary>
        /// <param name="label"></param>
        /// <param name="fontType"></param>
        /// <param name="rawText"></param>
        /// <param name="lineHeight"></param>
        /// <param name="fontSize"></param>
        /// <param name="maxFontSize"></param>
        /// <param name="alignment"></param>
        public static void InitLabelWithSpacing(UILabel label, FontType fontType, string rawText, double lineHeight, float fontSize, float maxFontSize, bool centerAlignment = false, bool useHyphenation = false)
        {
            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.LineHeightMultiple = new nfloat(lineHeight);
            if (centerAlignment)
            {
                paragraphStyle.Alignment = UITextAlignment.Center;
            }
            else
            {
                paragraphStyle.Alignment = LayoutUtils.GetTextAlignment();
            }
            if (useHyphenation)
            {
                paragraphStyle.HyphenationFactor = 1.0f;
            }
            NSMutableAttributedString text = new NSMutableAttributedString(rawText);
            NSRange range = new NSRange(0, rawText.Length);

            text.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle, range);
            text.AddAttribute(UIStringAttributeKey.Font, Font(fontType, fontSize, maxFontSize), range);
            label.AttributedText = text;
            label.TextColor      = ColorHelper.TEXT_COLOR_ON_BACKGROUND;
        }
        private NSMutableAttributedString ApplyStylingToText(string text, FontType fontType, double lineHeight = 1.28, int fontSize = 16, int maxFontSize = 22, bool isLink = false)
        {
            //Wraps the string containing HTML, with styling tags inorder to ensure correct font, color, size.
            string html = HtmlWrapper.HtmlForLabelWithText(text, 16, false, false, "#ffffff");

            //Defining document type as HTML, set string encoding and formats an attributed string with these.
            NSAttributedStringDocumentAttributes documentAttributes = new NSAttributedStringDocumentAttributes {
                DocumentType = NSDocumentType.HTML
            };

            documentAttributes.StringEncoding = NSStringEncoding.UTF8;
            NSError            error            = null;
            NSAttributedString attributedString = new NSAttributedString(NSData.FromString(html, NSStringEncoding.UTF8), documentAttributes, ref error);

            NSMutableAttributedString attributedTextToAppend = new NSMutableAttributedString(attributedString);

            attributedTextToAppend.DeleteRange(new NSRange(attributedTextToAppend.Length - 1, 1));
            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle
            {
                LineHeightMultiple = new nfloat(lineHeight)
            };

            NSRange range = new NSRange(0, attributedTextToAppend.Length);

            attributedTextToAppend.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle, range);
            attributedTextToAppend.AddAttribute(UIStringAttributeKey.Font, Font(fontType, fontSize, maxFontSize), range);

            //Add a hyperlink to this text, makes text clickable
            if (isLink)
            {
                attributedTextToAppend.AddAttribute(UIStringAttributeKey.Link, new NSUrl("https://www." + text), range);
            }

            return(attributedTextToAppend);
        }
Esempio n. 9
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            // sample only; expand, validate and handle edge cases as needed
            //((UILabel)base.Control).Font.LineHeight = ((HACCPCustomLabel)this.Element).LineHeight;


            var lineSpacingLabel = (HACCPLineSpacingLabel)Element;

            if (lineSpacingLabel != null)
            {
                var paragraphStyle = new NSMutableParagraphStyle()
                {
                    //LineSpacing = (nfloat)lineSpacingLabel.LineSpacing

                    LineSpacing = (nfloat)(7.5),
                    Alignment   = UITextAlignment.Center,
                };


                var textstring = new NSMutableAttributedString(lineSpacingLabel.Text);
                var style      = UIStringAttributeKey.ParagraphStyle;

                var range = new NSRange(0, textstring.Length);
                textstring.AddAttribute(style, paragraphStyle, range);
                Control.AttributedText = textstring;
            }
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string appDetailDescription = (string)value;

            if (string.IsNullOrWhiteSpace(appDetailDescription))
            {
                return(null);
            }

            var attributedText = new NSMutableAttributedString("Description\n", new UIStringAttributes {
                Font = UIFont.SystemFontOfSize(14)
            });
            var style = new NSMutableParagraphStyle();

            style.LineSpacing = 10;

            var range = new NSRange(0, attributedText.Length);

            attributedText.AddAttribute(UIStringAttributeKey.ParagraphStyle, style, range);

            attributedText.Append(new NSAttributedString(appDetailDescription, new UIStringAttributes {
                Font = UIFont.SystemFontOfSize(11), ForegroundColor = UIColor.DarkGray
            }));

            return(attributedText);
        }
Esempio n. 11
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            var marin = UIScreen.MainScreen.Bounds.Width * 0.038f;

            CloseButton.ContentEdgeInsets = new UIEdgeInsets(marin, marin, marin, marin);

            CGRect frame = Superview.Frame;

            frame = Frame;
            frame = UIApplication.SharedApplication.KeyWindow.Frame;

            lblRankInfoTitle.Font = UIFont.FromName("ProximaNova-Bold", SizeConstants.ScreenMultiplier * 24);

            NSMutableParagraphStyle paragraph = new NSMutableParagraphStyle();

            paragraph.MinimumLineHeight = SizeConstants.ScreenMultiplier * 24;
            paragraph.MaximumLineHeight = SizeConstants.ScreenMultiplier * 24;
            NSAttributedString attributedString = new NSAttributedString(txtvRankInfoDescription.Text, UIFont.FromName("ProximaNova-Regular", SizeConstants.ScreenMultiplier * 16), paragraphStyle: paragraph);

            txtvRankInfoDescription.TextContainerInset = new UIEdgeInsets(0f, 0, 0, 0);
            txtvRankInfoDescription.AttributedText     = attributedString;

            vScoreInfo.LayoutSubviews();
        }
Esempio n. 12
0
        private void UpdateItemState()
        {
            var paragraphStyle = new NSMutableParagraphStyle {
                LineSpacing = 100
            };

            if (((HighlightLabel)Element).Dash)
            {
                attributes.UnderlineStyle = NSUnderlineStyle.Single;
            }
            else
            {
                attributes.UnderlineStyle = NSUnderlineStyle.None;
            }


            if (((HighlightLabel)Element).Highlight != null)
            {
                var color = Color.FromHex(((HighlightLabel)Element).Highlight).ToUIColor();
                attributes.BackgroundColor = color;
            }
            else
            {
                attributes.BackgroundColor = UIColor.White;
            }
        }
Esempio n. 13
0
        private NSMutableParagraphStyle CreateDefaultParagraph()
        {
            var paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.FirstLineHeadIndent = 42;
            return(paragraphStyle);
        }
Esempio n. 14
0
        public static float ContentSize(UITextView textView)
        {
            var frame = textView.Bounds;

            var textContainerInsets = textView.TextContainerInset;
            var contentInsents      = textView.ContentInset;

            var leftRightPadding = textContainerInsets.Left + textContainerInsets.Right + textView.TextContainer.LineFragmentPadding * 2 + contentInsents.Left + contentInsents.Right;
            var topBottomPadding = textContainerInsets.Top + textContainerInsets.Bottom + contentInsents.Top + contentInsents.Bottom;

            frame.Size.Width  -= leftRightPadding;
            frame.Size.Height -= topBottomPadding;

            var text           = new NSString(textView.Text);
            var paragraphStyle = new NSMutableParagraphStyle {
                LineBreakMode = UILineBreakMode.WordWrap,
            };

            var attributes = new UIStringAttributes {
                Font = textView.Font
            };

            var   size           = text.GetBoundingRect(new SizeF(frame.Width, float.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, new NSStringDrawingContext());
            float measuredHeight = size.Height + topBottomPadding;

            return(measuredHeight);
        }
        public void Update()
        {
            var text = _formsLabel.Text;

            if (text == null)
            {
                return;
            }

            var multiple    = (float)AlterLineHeight.GetMultiple(_formsLabel);
            var fontSize    = (float)(_formsLabel).FontSize;
            var lineSpacing = (fontSize * multiple) - fontSize;
            var pStyle      = new NSMutableParagraphStyle()
            {
                LineSpacing = lineSpacing,
                Alignment   = _formsLabel.HorizontalTextAlignment.ToNativeTextAlignment()
            };
            var attrString = new NSMutableAttributedString(text);

            attrString.AddAttribute(UIStringAttributeKey.ParagraphStyle,
                                    pStyle,
                                    new NSRange(0, attrString.Length));

            _nativeLabel.AttributedText = attrString;

            ChangeSize();
        }
Esempio n. 16
0
        void UpdateTextOnControl()
        {
            if (Control == null)
            {
                return;
            }

            //define paragraph-style
            var style = new NSMutableParagraphStyle()
            {
                Alignment           = UITextAlignment.Justified,
                FirstLineHeadIndent = 0.001f,
            };

            //define attributes that use both paragraph-style, and font-style
            var uiAttr = new UIStringAttributes()
            {
                ParagraphStyle = style,
                BaselineOffset = 0,

                Font = Control.Font
            };

            //define frame to ensure justify alignment is applied
            Control.Frame = new RectangleF(0, 0, (float)Element.Width, (float)Element.Height);

            //set new text with ui-style-attributes to native control (UILabel)
            var stringToJustify  = Control.Text ?? string.Empty;
            var attributedString = new Foundation.NSAttributedString(stringToJustify, uiAttr.Dictionary);

            Control.AttributedText = attributedString;
            Control.Lines          = 0;
        }
Esempio n. 17
0
        void ConfigureDescriptionLabel(UILabel label, nfloat labelPadding)
        {
            label.Font          = UIFont.FromName("Helvetica", 14);
            label.TextColor     = new UIColor(0.054f, 1f);
            label.LineBreakMode = UILineBreakMode.WordWrap;
            label.Lines         = 5;

            var descParagraphStyle = new NSMutableParagraphStyle();

            descParagraphStyle.LineHeightMultiple = 1.5f;

            var descAttrString = new NSMutableAttributedString(desc);

            descAttrString.AddAttribute(UIStringAttributeKey.ParagraphStyle, descParagraphStyle,
                                        new NSRange(0, descAttrString.Length));
            label.AttributedText = descAttrString;

            label.Frame = new CGRect(labelPadding, 360,
                                     Frame.Size.Width - 2 * labelPadding,
                                     160);

            label.SizeToFit();
            label.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
                                     UIViewAutoresizing.FlexibleHeight;
        }
Esempio n. 18
0
        public static NSAttributedString GetAttributedStringWithImage(string imageName, int imageSize, string text)
        {
            var attrString = new NSMutableAttributedString("");

            if (!string.IsNullOrEmpty(imageName))
            {
                var image = GetImageForSize(imageName, imageSize);
                if (image != null)
                {
                    image.AlignmentRect = new CGRect {
                        X = 0, Y = 5, Width = imageSize - 2, Height = imageSize - 2
                    };
                    var cell = new NSTextAttachmentCell(image);
                    cell.Alignment = NSTextAlignment.Left;
                    attrString.Append(NSAttributedString.FromAttachment(new NSTextAttachment {
                        AttachmentCell = cell
                    }));
                    attrString.Append(new NSAttributedString("  "));
                }
            }

            attrString.Append(new NSAttributedString(text));

            var style = new NSMutableParagraphStyle {
                LineBreakMode = NSLineBreakMode.TruncatingMiddle
            };

            attrString.AddAttribute(NSStringAttributeKey.ParagraphStyle, style, new NSRange(0, attrString.Length));

            return(attrString);
        }
Esempio n. 19
0
        public override void DrawInContext(CGContext ctx)
        {
            UIGraphics.PushContext(ctx);
            CGRect         bounds = this.Bounds;
            TKFill         fill   = this.LabelStyle.Fill;
            TKStroke       stroke = new TKStroke(UIColor.Black);
            TKBalloonShape shape  = new TKBalloonShape(TKBalloonShapeArrowPosition.Bottom, new CGSize(bounds.Size.Width - stroke.Width, bounds.Size.Height - stroke.Width));
            CGRect         textRect;

            if (this.IsOutsideBounds == true)
            {
                shape.ArrowPosition = TKBalloonShapeArrowPosition.Top;
                textRect            = new CGRect(bounds.Left, bounds.Top - this.LabelStyle.Insets.Top + shape.ArrowSize.Height, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
            }
            else
            {
                textRect = new CGRect(bounds.Left, bounds.Top - this.LabelStyle.Insets.Top, bounds.Size.Width, bounds.Size.Height + this.LabelStyle.Insets.Bottom);
            }

            shape.DrawInContext(ctx, new CGPoint(bounds.GetMidX(), bounds.GetMidY()), new TKDrawing[] { fill, stroke });
            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.Alignment = this.LabelStyle.TextAlignment;
            NSDictionary attributes = new NSDictionary(UIStringAttributeKey.Font, UIFont.SystemFontOfSize(18),
                                                       UIStringAttributeKey.ForegroundColor, this.LabelStyle.TextColor,
                                                       UIStringAttributeKey.ParagraphStyle, paragraphStyle);

            NSString text = new NSString(this.Text);

            text.WeakDrawString(textRect, NSStringDrawingOptions.TruncatesLastVisibleLine | NSStringDrawingOptions.UsesLineFragmentOrigin, attributes, null);
            UIGraphics.PopContext();
        }
Esempio n. 20
0
        public static NSAttributedString AttributedTitle(string title, NSColor color, String fontName, float fontSize, NSTextAlignment textAlignment)
        {
            NSMutableParagraphStyle ps = new NSMutableParagraphStyle();

            ps.Alignment   = textAlignment;
            ps.LineSpacing = 0.0f;
            NSColor fontColor = color;
            NSFont  font      = NSFont.FromFontName(fontName, fontSize);

            if (font == null)
            {
                font = NSFont.SystemFontOfSize(fontSize);
            }
            NSString titleObj = new NSString(title);

            NSStringAttributes attributes = new NSStringAttributes();

            attributes.Font            = font;
            attributes.ForegroundColor = fontColor;
            attributes.ParagraphStyle  = ps;
            attributes.ToolTip         = titleObj;
            NSAttributedString buttonString = new NSAttributedString(title, attributes);

            return(buttonString);
        }
Esempio n. 21
0
        public static NSMutableAttributedString BuildAttributedString(this ExtendedFont font, string text, UITextAlignment textAlignment = UITextAlignment.Natural)
        {
            if (font == null)
            {
                return(new NSMutableAttributedString(text));
            }

            var attributes = new UIStringAttributes();

            attributes.Font              = font.ToUIFont();
            attributes.ForegroundColor   = font.Color.ToUIColor();
            attributes.BackgroundColor   = UIColor.Clear;
            attributes.KerningAdjustment = font.Kerning;

            if (font.IsUnderlined)
            {
                attributes.UnderlineStyle = NSUnderlineStyle.Single;
            }

            var attribString = new NSMutableAttributedString(text, attributes);

            if (font.LineSpacing != 0)
            {
                var paragraphStyle = new NSMutableParagraphStyle()
                {
                    LineSpacing = (nfloat)font.LineSpacing,
                    Alignment   = textAlignment
                };

                attribString.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle, new NSRange(0, attribString.Length));
            }

            return(attribString);
        }
        // <summary>
        /// Set maxFontSize for accessibility - large text
        /// </summary>
        /// <param name="label"></param>
        /// <param name="fontType"></param>
        /// <param name="rawText"></param>
        /// <param name="lineHeight"></param>
        /// <param name="fontSize"></param>
        /// <param name="maxFontSize"></param>
        /// <param name="alignment"></param>
        public static void InitUITextViewWithSpacingAndUrl(UITextView label, FontType fontType, string rawText, double lineHeight, float fontSize, float maxFontSize, UITextAlignment alignment = UITextAlignment.Left)
        {
            //Defining attibutes inorder to format the embedded link
            NSAttributedStringDocumentAttributes documentAttributes = new NSAttributedStringDocumentAttributes {
                DocumentType = NSDocumentType.HTML
            };

            documentAttributes.StringEncoding = NSStringEncoding.UTF8;
            NSError            error            = null;
            NSAttributedString attributedString = new NSAttributedString(NSData.FromString(rawText, NSStringEncoding.UTF8), documentAttributes, ref error);

            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.LineHeightMultiple = new nfloat(lineHeight);
            paragraphStyle.Alignment          = alignment;
            NSMutableAttributedString text = new NSMutableAttributedString(attributedString);
            NSRange range = new NSRange(0, text.Length);

            text.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle, range);
            text.AddAttribute(UIStringAttributeKey.Font, Font(fontType, fontSize, maxFontSize), range);
            label.AttributedText = text;

            label.TextColor = UIColor.White;
            label.WeakLinkTextAttributes = new NSDictionary(UIStringAttributeKey.ForegroundColor, "#FADC5D".ToUIColor(), UIStringAttributeKey.UnderlineStyle, new NSNumber(1));
        }
Esempio n. 23
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            var label = (CustomLabel)Element;

            if (label == null || Control == null)
            {
                return;
            }
            double fontSize = label.FontSize;
            //iOS LineSpacing is measured in dp, as the FontSize. So, if we need a LineSpacing of 2,
            //this LineSpacing must be set to the same value of the FontSize
            nfloat lineSpacing = ((nfloat)label.LineHeight * (nfloat)fontSize) - (nfloat)fontSize;

            if (lineSpacing > 0)
            {
                var labelString    = new NSMutableAttributedString(label.Text);
                var paragraphStyle = new NSMutableParagraphStyle {
                    LineSpacing = lineSpacing
                };
                var style = UIStringAttributeKey.ParagraphStyle;
                var range = new NSRange(0, labelString.Length);
                labelString.AddAttribute(style, paragraphStyle, range);
                Control.AttributedText = labelString;
            }
        }
Esempio n. 24
0
        void ConfigureTitleLabel(UILabel label, nfloat labelPadding)
        {
            label.Font          = UIFont.FromName("AbrilFatface-Regular", 36);
            label.TextColor     = new UIColor(0.039f, 0.192f, 0.259f, 1f);
            label.LineBreakMode = UILineBreakMode.WordWrap;
            label.Lines         = 2;

            var paragraphStyle = new NSMutableParagraphStyle();

            paragraphStyle.LineHeightMultiple = 0.8f;

            var attrString = new NSMutableAttributedString(title);

            attrString.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle,
                                    new NSRange(0, attrString.Length));
            label.AttributedText = attrString;
            label.SizeToFit();
            label.Frame = new CGRect(labelPadding, 280,
                                     label.Frame.Size.Width,
                                     label.Frame.Size.Height);


            label.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
                                     UIViewAutoresizing.FlexibleHeight;
        }
Esempio n. 25
0
        public static UIImage UIImage(this FA fa, CGSize size, UIColor foreground, UIColor background)
        {
            var paragraph = new NSMutableParagraphStyle();

            paragraph.Alignment = UITextAlignment.Center;

            // Taken from FontAwesome.io's Fixed Width Icon CSS
            nfloat fontAspectRatio = 1.28571429f;

            nfloat fontSize   = (nfloat)Math.Min(size.Width / fontAspectRatio, size.Height);
            var    attributes = new UIStringAttributes()
            {
                Font            = fa.Font(fontSize),
                BackgroundColor = background,
                ForegroundColor = foreground,
                ParagraphStyle  = paragraph
            };

            var attributedString = new NSMutableAttributedString(fa.String(), attributes);
            var point            = new CGRect(0, (size.Height - fontSize) / 2, size.Width, fontSize);

            UIGraphics.BeginImageContextWithOptions(size, false, 0f);
            attributedString.DrawString(point);

            UIImage image = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            return(image);
        }
        public StylizedStringAttributes(
            UIFont font,
            UIColor color,
            float letterSpace,
            nfloat lineHeightMultiplier,
            StylizedStringCase stringCase,
            UITextAlignment textAlignment   = UITextAlignment.Left,
            NSUnderlineStyle underlineStyle = NSUnderlineStyle.None)
        {
            _stringCase = stringCase;

            NSMutableParagraphStyle paragraphStyle = null;

            if (lineHeightMultiplier != 1 || textAlignment != UITextAlignment.Left)
            {
                paragraphStyle = new NSMutableParagraphStyle
                {
                    LineHeightMultiple = lineHeightMultiplier,
                    Alignment          = textAlignment
                };
            }

            StringAttributes = new UIStringAttributes
            {
                Font              = font,
                ForegroundColor   = color,
                KerningAdjustment = letterSpace,
                ParagraphStyle    = paragraphStyle,
                UnderlineStyle    = underlineStyle
            };
        }
 public static void SetCustomLabelParagraphStyle(NSMutableParagraphStyle paragraphStyle, CustomLabelBase label)
 {
     if ((label != null) && (paragraphStyle != null))
     {
         if (label.ParagraphStyleAlignment == CustomTextAlignment.Center)
         {
             paragraphStyle.Alignment = UITextAlignment.Center;
         }
         else if (label.ParagraphStyleAlignment == CustomTextAlignment.Justified)
         {
             paragraphStyle.Alignment = UITextAlignment.Justified;
         }
         else if (label.ParagraphStyleAlignment == CustomTextAlignment.Left)
         {
             paragraphStyle.Alignment = UITextAlignment.Left;
         }
         else if (label.ParagraphStyleAlignment == CustomTextAlignment.Right)
         {
             paragraphStyle.Alignment = UITextAlignment.Right;
         }
         else
         {
             paragraphStyle.Alignment = UITextAlignment.Natural;
         }
     }
 }
Esempio n. 28
0
        void SetTextAttribute(MyLabel entity)
        {
            if (entity.Text == null)
            {
                return;
            }

            NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle()
            {
                LineSpacing = (nfloat)entity.LineSpacing,
                Alignment   = this.Control.TextAlignment,
            };

            NSMutableAttributedString attrString = new NSMutableAttributedString(entity.Text);
            NSString style = UIStringAttributeKey.ParagraphStyle;
            NSRange  range = new NSRange(0, attrString.Length);

            attrString.AddAttribute(style, paragraphStyle, range);
            attrString.AddAttribute(UIStringAttributeKey.ForegroundColor, entity.TextColor.ToUIColor(), range);
            if (entity.IsStrikeThrough)
            {
                attrString.AddAttribute(UIStringAttributeKey.StrikethroughStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), range);
            }

            this.Control.Font = UIFont.FromName("Myriad Pro", (nfloat)entity.FontSize);
            // Ширина текста
            CGSize size = new NSString(entity.Text).StringSize(this.Control.Font, UIScreen.MainScreen.Bounds.Width, UILineBreakMode.TailTruncation);

            this.Control.AttributedText = attrString;
        }
Esempio n. 29
0
        public override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            var  mainText   = new NSString(node.ToString());
            var  bounds     = this.Bounds.ToRectangleF();
            bool isSelected = node.IsSelected;

            var mainTextAttrs = new NSMutableDictionary();
            var mainTextPara  = new NSMutableParagraphStyle();

            mainTextPara.LineBreakMode = NSLineBreakMode.TruncatingTail;
            mainTextPara.TighteningFactorForTruncation = 0;
            mainTextAttrs.Add(NSStringAttributeKey.ParagraphStyle, mainTextPara);
            if (isSelected)
            {
                mainTextAttrs.Add(NSStringAttributeKey.ForegroundColor, NSColor.SelectedMenuItemText);
            }
            else
            {
                mainTextAttrs.Add(NSStringAttributeKey.ForegroundColor, NSColor.Text);
            }

            var   mainTextSz = mainText.StringSize(mainTextAttrs).ToSizeF();
            float nodeTextAndPrimaryPropHorzSpacing = 8;
            float spaceAvailableForDefaultPropValue =
                bounds.Width - mainTextSz.Width - nodeTextAndPrimaryPropHorzSpacing;

            var paintInfo = owner.ViewModel.PaintNode(node, spaceAvailableForDefaultPropValue > 30);

            if (paintInfo.PrimaryPropValue != null)
            {
                var r = new RectangleF(
                    bounds.Right - spaceAvailableForDefaultPropValue,
                    bounds.Y,
                    spaceAvailableForDefaultPropValue,
                    bounds.Height);

                // todo: move dict to a static field
                var dict = new NSMutableDictionary();
                var para = new NSMutableParagraphStyle();
                para.Alignment     = NSTextAlignment.Right;
                para.LineBreakMode = NSLineBreakMode.TruncatingTail;
                para.TighteningFactorForTruncation = 0;
                dict.Add(NSStringAttributeKey.ParagraphStyle, para);
                if (isSelected)
                {
                    dict.Add(NSStringAttributeKey.ForegroundColor, NSColor.FromDeviceRgba(0.9f, 0.9f, 0.9f, 1f));
                }
                else
                {
                    dict.Add(NSStringAttributeKey.ForegroundColor, NSColor.Gray);
                }

                new NSString(paintInfo.PrimaryPropValue).DrawString(r.ToCGRect(), dict);
            }

            mainText.DrawString(bounds.ToCGRect(), mainTextAttrs);
        }
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            NSMutableParagraphStyle style = new NSMutableParagraphStyle();

            style.Alignment = UITextAlignment.Center;

            int nummerOfBanners = GetNumberOfBanners();
            int numRows         = GetNumberOfRows();

            float totalBannerHeight = nummerOfBanners * (BannerHeight + GapAfterRows);
            float rowHeight         = IdealRowHeight;

            if (numRows > 0)
            {
                float maxRowHeight = (float)(rect.Size.Height - totalBannerHeight) / numRows;
                rowHeight = Math.Min(rowHeight, maxRowHeight);
            }

            float runningTop = (float)rect.Y;
            var   bannerRect = rect;

            bannerRect.Height = BannerHeight;
            bannerRect.Y      = runningTop;

            var rowRect = rect;

            rowRect.Height = rowHeight;

            rowRect.X           += LeftInsetToMatchTimeSlider;
            rowRect.Width       -= (LeftInsetToMatchTimeSlider + RightInsetToMatchTimeSlider);
            compositionRectWidth = (float)rowRect.Size.Width;

            if (duration.Seconds != 0)
            {
                scaledDurationToWidth = compositionRectWidth / (float)duration.Seconds;
            }
            else
            {
                scaledDurationToWidth = 0;
            }

            if (compositionTracks != null)
            {
                DrawCompositionTracks(bannerRect, rowRect, ref runningTop);
                DrawMarker(rowRect, (float)rect.Y);
            }

            if (videoCompositionStages != null)
            {
                DrawVideoCompositionTracks(bannerRect, rowRect, ref runningTop);
            }

            if (audioMixTracks != null)
            {
                DrawAudioMixTracks(bannerRect, rowRect, ref runningTop);
            }
        }
Esempio n. 31
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TKChart chart = new TKChart(this.View.Bounds);

            chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(chart);

            string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
            int[]    values = new int[] { 95, 40, 55, 30, 76, 34 };
            List <TKChartDataPoint> list = new List <TKChartDataPoint> ();

            for (int i = 0; i < months.Length; i++)
            {
                list.Add(new TKChartDataPoint(new NSString(months[i]), new NSNumber(values[i])));
            }

            TKChartLineSeries series = new TKChartLineSeries(list.ToArray());

            // >> chart-point-shape-cs
            series.Style.PointShape = new TKPredefinedShape(TKShapeType.Circle, new SizeF(10, 10));
            // << chart-point-shape-cs

            // >> chart-point-pallete-cs
            var paletteItem = new TKChartPaletteItem();

            paletteItem.Fill = new TKSolidFill(UIColor.Red);
            var palette = new TKChartPalette();

            palette.AddPaletteItem(paletteItem);
            series.Style.ShapePalette = palette;
            // << chart-point-pallete-cs

            chart.AddSeries(series);
            // >> chart-balloon-annotation-cs
            NSMutableParagraphStyle paragraphStyle = (NSMutableParagraphStyle) new NSParagraphStyle().MutableCopy();

            paragraphStyle.Alignment = UITextAlignment.Center;
            NSMutableDictionary attributes = new NSMutableDictionary();

            attributes.Add(UIStringAttributeKey.ForegroundColor, UIColor.White);
            attributes.Add(UIStringAttributeKey.ParagraphStyle, paragraphStyle);
            NSMutableAttributedString attributedText = new NSMutableAttributedString("Important milestone:\n $55000", attributes);

            attributedText.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.Yellow, new NSRange(22, 6));

            TKChartBalloonAnnotation balloon = new TKChartBalloonAnnotation(new NSString("Mar"), new NSNumber(55), series);

            balloon.AttributedText          = attributedText;
            balloon.Style.DistanceFromPoint = 20;
            balloon.Style.ArrowSize         = new Size(10, 10);
            chart.AddAnnotation(balloon);
            // << chart-balloon-annotation-cs

            balloon = new TKChartBalloonAnnotation("The lowest value:\n $30000", new NSString("Apr"), new NSNumber(30), series);
            balloon.Style.VerticalAlign = TKChartBalloonVerticalAlignment.Bottom;
            chart.AddAnnotation(balloon);
        }
		public override void AwakeFromNib ()
		{
			ivStatusImage.WantsLayer = true;
			View.Gear = ivStatusImage;

			btnTryAgain.Hidden = true;
			btnTryAgain.Activated += (object sender, EventArgs e) => ProcessOrder();

			// Change button text color to white and centered (lame that you can't do this in IB)
			var coloredTitle = new NSMutableAttributedString (btnTryAgain.Title);
			var titleRange = new NSRange (0, coloredTitle.Length);
			coloredTitle.AddAttribute (NSAttributedString.ForegroundColorAttributeName, NSColor.White, titleRange);
			var centeredAttribute = new NSMutableParagraphStyle ();
			centeredAttribute.Alignment = NSTextAlignment.Center;
			coloredTitle.AddAttribute (NSAttributedString.ParagraphStyleAttributeName, centeredAttribute, titleRange);
			btnTryAgain.AttributedTitle = coloredTitle;

			ProcessOrder ();
		}
		private float HeightOfText(string text,int width)
		{
			UIFont font = UIFont.SystemFontOfSize(15.0f);

			NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle();
			paragraphStyle.LineBreakMode = UILineBreakMode.WordWrap;

			NSMutableDictionary attributes = new NSMutableDictionary();
			attributes[UIStringAttributeKey.Font] = font;
			attributes[UIStringAttributeKey.ParagraphStyle] = paragraphStyle;

			NSAttributedString attributedText = new NSAttributedString (text, attributes);
			RectangleF paragraphRect = attributedText.GetBoundingRect(
				new System.Drawing.SizeF(width, float.MaxValue),
				NSStringDrawingOptions.UsesLineFragmentOrigin,
				null);

			return paragraphRect.Height;
		}
		public override void AwakeFromNib ()
		{
			viewEmptyBasket.WantsLayer = true;
			viewEmptyBasket.Layer = new CALayer () {BackgroundColor = NSColor.White.CGColor};
			viewBasket.WantsLayer = true;
			viewBasket.Layer = new CALayer () {BackgroundColor = NSColor.White.CGColor};

			// Change button text color to white and centered (lame that you can't do this in IB)
			var coloredTitle = new NSMutableAttributedString (btnCheckout.Title);
			var titleRange = new NSRange (0, coloredTitle.Length);
			coloredTitle.AddAttribute (NSAttributedString.ForegroundColorAttributeName, NSColor.White, titleRange);
			var centeredAttribute = new NSMutableParagraphStyle ();
			centeredAttribute.Alignment = NSTextAlignment.Center;
			coloredTitle.AddAttribute (NSAttributedString.ParagraphStyleAttributeName, centeredAttribute, titleRange);
			btnCheckout.AttributedTitle = coloredTitle;

			tvBasketProducts.Source = new ShoppingBasketTableViewSource ();

			btnCheckout.Activated += (object sender, EventArgs e) => CheckoutInitiated();

			View.ViewController = this;
			RefreshBasket ();
		}
		public override void AwakeFromNib ()
		{
			// Change button text color to white and centered (lame that you can't do this in IB)
			var coloredTitle = new NSMutableAttributedString (btnPlaceOrder.Title);
			var titleRange = new NSRange (0, coloredTitle.Length);
			coloredTitle.AddAttribute (NSAttributedString.ForegroundColorAttributeName, NSColor.White, titleRange);
			var centeredAttribute = new NSMutableParagraphStyle ();
			centeredAttribute.Alignment = NSTextAlignment.Center;
			coloredTitle.AddAttribute (NSAttributedString.ParagraphStyleAttributeName, centeredAttribute, titleRange);
			btnPlaceOrder.AttributedTitle = coloredTitle;

			txtFirstName.StringValue = _user.FirstName;
			txtLastName.StringValue = _user.LastName;

			LoadCountries ();
			cbCountry.Changed += (object sender, EventArgs e) => {
				LoadStates();
			};

			txtAddress1.SelectText (this);
			txtAddress1.BecomeFirstResponder ();

			btnPlaceOrder.Activated += OnBtnPlaceOrder;
		}
Esempio n. 36
0
        public override void AwakeFromNib ()
        {
            base.AwakeFromNib ();

            this.AddressLabel.StringValue = Properties_Resources.EnterWebAddress;
            this.UserLabel.StringValue = Properties_Resources.User + ": ";
            this.PasswordLabel.StringValue = Properties_Resources.Password + ": ";

            this.AddressDelegate = new TextFieldDelegate();
            this.AddressText.Delegate = this.AddressDelegate;
            this.UserDelegate = new TextFieldDelegate();
            this.UserText.Delegate = this.UserDelegate;
            this.PasswordDelegate = new TextFieldDelegate();
            this.PasswordText.Delegate = this.PasswordDelegate;

            this.ContinueButton.Title = Properties_Resources.Continue;
            this.CancelButton.Title = Properties_Resources.Cancel;

            this.AddressText.StringValue = (Controller.PreviousAddress == null || String.IsNullOrEmpty (Controller.PreviousAddress.ToString ())) ? "https://" : Controller.PreviousAddress.ToString ();
            this.UserText.StringValue = String.IsNullOrEmpty (Controller.saved_user) ? Environment.UserName : Controller.saved_user;
            //            this.PasswordText.StringValue = String.IsNullOrEmpty (Controller.saved_password) ? "" : Controller.saved_password;
            this.PasswordText.StringValue = "";


            // Cmis server address help link
            string helpLabel = Properties_Resources.Help + ": ";
            string helpLink = Properties_Resources.WhereToFind;
            string addressUrl = @"https://github.com/aegif/CmisSync/wiki/What-address";
            this.AddressHelp.AllowsEditingTextAttributes = true;
            this.AddressHelp.Selectable = true;           
            var attrStr = new NSMutableAttributedString(helpLabel + helpLink);
            var labelRange = new NSRange(0, helpLabel.Length);
            var linkRange = new NSRange(helpLabel.Length, helpLink.Length);
            var url = new NSUrl(addressUrl);
            var font = this.AddressHelp.Font;
            var paragraph = new NSMutableParagraphStyle()
            {
                LineBreakMode = this.AddressHelp.Cell.LineBreakMode,
                Alignment = this.AddressHelp.Alignment
            };
            attrStr.BeginEditing();
            attrStr.AddAttribute(NSAttributedString.LinkAttributeName, url, linkRange);
            attrStr.AddAttribute(NSAttributedString.ForegroundColorAttributeName, NSColor.Blue, linkRange);
            attrStr.AddAttribute(NSAttributedString.ForegroundColorAttributeName, NSColor.Gray, labelRange);
            attrStr.AddAttribute(NSAttributedString.UnderlineStyleAttributeName, new NSNumber(1), linkRange);
            attrStr.AddAttribute(NSAttributedString.FontAttributeName, font, new NSRange(0, attrStr.Length));
            attrStr.AddAttribute(NSAttributedString.ParagraphStyleAttributeName, paragraph, new NSRange(0, attrStr.Length));
            attrStr.EndEditing();
            this.AddressHelp.AttributedStringValue = attrStr;

            InsertEvent ();

            //  Must be called after InsertEvent()
            CheckTextFields ();
        }
Esempio n. 37
0
		public static SCNNode SCBoxNode (string title, CGRect frame, NSColor color, float cornerRadius, bool centered)
		{
			NSMutableDictionary titleAttributes = null;
			NSMutableDictionary centeredTitleAttributes = null;

			// create and extrude a bezier path to build the box
			var path = NSBezierPath.FromRoundedRect (frame, cornerRadius, cornerRadius);
			path.Flatness = 0.05f;

			var shape = SCNShape.Create (path, 20);
			shape.ChamferRadius = 0.0f;

			var node = SCNNode.Create ();
			node.Geometry = shape;

			// create an image and fill with the color and text
			var textureSize = new CGSize ();
			textureSize.Width = NMath.Ceiling (frame.Size.Width * 1.5f);
			textureSize.Height = NMath.Ceiling (frame.Size.Height * 1.5f);

			var texture = new NSImage (textureSize);
			texture.LockFocus ();

			var drawFrame = new CGRect (0, 0, textureSize.Width, textureSize.Height);

			nfloat hue, saturation, brightness, alpha;

			(color.UsingColorSpace (NSColorSpace.DeviceRGBColorSpace)).GetHsba (out hue, out saturation, out brightness, out alpha);
			var lightColor = NSColor.FromDeviceHsba (hue, saturation - 0.2f, brightness + 0.3f, alpha);
			lightColor.Set ();

			NSGraphics.RectFill (drawFrame);

			NSBezierPath fillpath = null;

			if (cornerRadius == 0 && centered == false) {
				//special case for the "labs" slide
				drawFrame.Offset (0, -2);
				fillpath = NSBezierPath.FromRoundedRect (drawFrame, cornerRadius, cornerRadius);
			} else {
				drawFrame.Inflate (-3, -3);
				fillpath = NSBezierPath.FromRoundedRect (drawFrame, cornerRadius, cornerRadius);
			}

			color.Set ();
			fillpath.Fill ();

			// draw the title if any
			if (title != null) {
				if (titleAttributes == null) {
					var paraphStyle = new NSMutableParagraphStyle ();
					paraphStyle.LineBreakMode = NSLineBreakMode.ByWordWrapping;
					paraphStyle.Alignment = NSTextAlignment.Center;
					paraphStyle.MinimumLineHeight = 38;
					paraphStyle.MaximumLineHeight = 38;

					var font = NSFont.FromFontName ("Myriad Set Semibold", 34) != null ? NSFont.FromFontName ("Myriad Set Semibold", 34) : NSFont.FromFontName ("Avenir Medium", 34);

					var shadow = new NSShadow ();
					shadow.ShadowOffset = new CGSize (0, -2);
					shadow.ShadowBlurRadius = 4;
					shadow.ShadowColor = NSColor.FromDeviceWhite (0.0f, 0.5f);

					titleAttributes = new NSMutableDictionary ();
					titleAttributes.SetValueForKey (font, NSAttributedString.FontAttributeName);
					titleAttributes.SetValueForKey (NSColor.White, NSAttributedString.ForegroundColorAttributeName);
					titleAttributes.SetValueForKey (shadow, NSAttributedString.ShadowAttributeName);
					titleAttributes.SetValueForKey (paraphStyle, NSAttributedString.ParagraphStyleAttributeName);

					var centeredParaphStyle = (NSMutableParagraphStyle)paraphStyle.MutableCopy ();
					centeredParaphStyle.Alignment = NSTextAlignment.Center;

					centeredTitleAttributes = new NSMutableDictionary ();
					centeredTitleAttributes.SetValueForKey (font, NSAttributedString.FontAttributeName);
					centeredTitleAttributes.SetValueForKey (NSColor.White, NSAttributedString.ForegroundColorAttributeName);
					centeredTitleAttributes.SetValueForKey (shadow, NSAttributedString.ShadowAttributeName);
					centeredTitleAttributes.SetValueForKey (paraphStyle, NSAttributedString.ParagraphStyleAttributeName);
				}

				var attrString = new NSAttributedString (title, centered ? centeredTitleAttributes : titleAttributes);
				var textSize = attrString.Size;

				//check if we need two lines to draw the text
				var twoLines = title.Contains ("\n");
				if (!twoLines)
					twoLines = textSize.Width > frame.Size.Width && title.Contains (" ");

				//if so, we need to adjust the size to center vertically
				if (twoLines)
					textSize.Height += 38;

				if (!centered)
					drawFrame.Inflate (-15, 0);

				//center vertically
				var dy = (drawFrame.Size.Height - textSize.Height) * 0.5f;
				var drawFrameHeight = drawFrame.Size.Height;
				drawFrame.Size = new CGSize (drawFrame.Size.Width, drawFrame.Size.Height - dy);
				attrString.DrawString (drawFrame);
			}

			texture.UnlockFocus ();

			//set the created image as the diffuse texture of our 3D box
			var front = SCNMaterial.Create ();
			front.Diffuse.Contents = texture;
			front.LocksAmbientWithDiffuse = true;

			//use a lighter color for the chamfer and sides
			var sides = SCNMaterial.Create ();
			sides.Diffuse.Contents = lightColor;
			node.Geometry.Materials = new SCNMaterial[] {
				front,
				sides,
				sides,
				sides,
				sides
			};

			return node;
		}
		public override void Draw (RectangleF rect)
		{
			base.Draw (rect);

			NSMutableParagraphStyle style = new NSMutableParagraphStyle ();
			style.Alignment = UITextAlignment.Center;

			int nummerOfBanners = GetNumberOfBanners ();
			int numRows = GetNumberOfRows ();

			float totalBannerHeight = nummerOfBanners * (BannerHeight + GapAfterRows);
			float rowHeight = IdealRowHeight;

			if (numRows > 0) {
				float maxRowHeight = (rect.Size.Height - totalBannerHeight) / numRows;
				rowHeight = Math.Min (rowHeight, maxRowHeight);
			}

			float runningTop = rect.Y;
			var bannerRect = rect;
			bannerRect.Height = BannerHeight;
			bannerRect.Y = runningTop;

			var rowRect = rect;
			rowRect.Height = rowHeight;

			rowRect.X += LeftInsetToMatchTimeSlider;
			rowRect.Width -= (LeftInsetToMatchTimeSlider + RightInsetToMatchTimeSlider);
			compositionRectWidth = rowRect.Size.Width;

			if (duration.Seconds != 0)
				scaledDurationToWidth = compositionRectWidth / (float)duration.Seconds;
			else
				scaledDurationToWidth = 0;

			if (compositionTracks != null) {
				DrawCompositionTracks (bannerRect, rowRect, ref runningTop);
				DrawMarker (rowRect, rect.Y);
			}

			if (videoCompositionStages != null)
				DrawVideoCompositionTracks (bannerRect, rowRect, ref runningTop);

			if (audioMixTracks != null) 
				DrawAudioMixTracks (bannerRect, rowRect, ref runningTop);
		}