Beispiel #1
0
 public NSAttributedString(string str,
                           NSFont font                         = null,
                           NSColor foregroundColor             = null,
                           NSColor backgroundColor             = null,
                           NSColor strokeColor                 = null,
                           NSColor underlineColor              = null,
                           NSColor strikethroughColor          = null,
                           NSUnderlineStyle underlineStyle     = NSUnderlineStyle.None,
                           NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None,
                           NSParagraphStyle paragraphStyle     = null,
                           float strokeWidth                   = 0,
                           NSShadow shadow                     = null,
                           NSUrl link                  = null,
                           bool superscript            = false,
                           NSTextAttachment attachment = null,
                           NSLigatureType ligature     = NSLigatureType.Default,
                           float baselineOffset        = 0,
                           float kerningAdjustment     = 0,
                           float obliqueness           = 0,
                           float expansion             = 0,
                           NSCursor cursor             = null,
                           string toolTip              = null,
                           int characterShape          = 0,
                           NSGlyphInfo glyphInfo       = null,
                           NSArray writingDirection    = null,
                           bool markedClauseSegment    = false,
                           NSTextLayoutOrientation verticalGlyphForm = NSTextLayoutOrientation.Horizontal,
                           NSTextAlternatives textAlternatives       = null,
                           NSSpellingState spellingState             = NSSpellingState.None) : this(str, NSStringAttributes.ToDictionary(
                                                                                                        font : font,
                                                                                                        foregroundColor : foregroundColor,
                                                                                                        backgroundColor : backgroundColor,
                                                                                                        strokeColor : strokeColor,
                                                                                                        underlineColor : underlineColor,
                                                                                                        strikethroughColor : strikethroughColor,
                                                                                                        underlineStyle : underlineStyle,
                                                                                                        strikethroughStyle : strikethroughStyle,
                                                                                                        paragraphStyle : paragraphStyle,
                                                                                                        strokeWidth : strokeWidth,
                                                                                                        shadow : shadow,
                                                                                                        link : link,
                                                                                                        superscript : superscript,
                                                                                                        attachment : attachment,
                                                                                                        ligature : ligature,
                                                                                                        baselineOffset : baselineOffset,
                                                                                                        kerningAdjustment : kerningAdjustment,
                                                                                                        obliqueness : obliqueness,
                                                                                                        expansion : expansion,
                                                                                                        cursor : cursor,
                                                                                                        toolTip : toolTip,
                                                                                                        characterShape : characterShape,
                                                                                                        glyphInfo : glyphInfo,
                                                                                                        writingDirection : writingDirection,
                                                                                                        markedClauseSegment : markedClauseSegment,
                                                                                                        verticalGlyphForm : verticalGlyphForm,
                                                                                                        textAlternatives : textAlternatives,
                                                                                                        spellingState : spellingState
                                                                                                        ))
 {
 }
Beispiel #2
0
 /// <summary>
 /// Create an attributed UILabel.
 /// </summary>
 public static UILabel CreateAttrLabel(string text, UIColor textColor, UIFont font, int lines = 0,
                                       UITextAlignment textAlignment = UITextAlignment.Left, UIColor backgroundColor = null, UIColor strokeColor = null,
                                       float lineSpacing             = 0, float kerning = 0, NSUnderlineStyle underlineStyle     = NSUnderlineStyle.None,
                                       NSShadow shadow = null, float strokeWidth        = 0, NSUnderlineStyle strikeThroughStyle = NSUnderlineStyle.None)
 {
     return(new UILabel {
         Lines = lines,
         TextAlignment = textAlignment,
         AttributedText = new NSAttributedString(
             text,
             font,
             textColor,
             backgroundColor,
             strokeColor,
             paragraphStyle: new NSParagraphStyle {
             LineHeightMultiple = 0,
             LineSpacing = lineSpacing
         },
             NSLigatureType.None,
             kerning,
             underlineStyle,
             shadow,
             strokeWidth,
             strikeThroughStyle)
     });
 }
Beispiel #3
0
        private void UpdateUi()
        {
            if (this.Element != null && this.Control != null)
            {
                //Do not create attributed string if it is not necesarry
                if (!this.Element.IsUnderline && !this.Element.IsStrikeThrough)
                {
                    return;
                }

                var underline     = this.Element.IsUnderline ? NSUnderlineStyle.Single : NSUnderlineStyle.None;
                var strikethrough = this.Element.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None;

                NSShadow dropShadow = null;

                // For some reason, if we try and convert Color.Default to a UIColor, the resulting color is
                // either white or transparent. The net result is the ExtendedLabel does not display.
                // Only setting the control's TextColor if is not Color.Default will prevent this issue.
                if (this.Element.TextColor != Color.Default)
                {
                    this.Control.TextColor = this.Element.TextColor.ToUIColor();
                }

                if (this.Control.Text != null)
                {
                    this.Control.AttributedText = new NSMutableAttributedString(this.Control.Text,
                                                                                this.Control.Font,
                                                                                underlineStyle: underline,
                                                                                strikethroughStyle: strikethrough,
                                                                                shadow: dropShadow);
                }
            }
        }
        public static NSShadow TextShadow()
        {
            NSShadow textShadow = new NSShadow();

            textShadow.ShadowColor      = Colors.Black;
            textShadow.ShadowBlurRadius = 1.2f;
            textShadow.ShadowOffset     = new CGSize(0.6f, 0.6f);
            return(textShadow);
        }
Beispiel #5
0
        public void addShadowbg()
        {
            var shadow = new NSShadow();

            shadow.ShadowOffset     = new CoreGraphics.CGSize(width: 50, height: 0);
            shadow.ShadowBlurRadius = 22;
            shadow.ShadowColor      = NSColor.Black;

            bg.Superview.WantsLayer = true;
            bg.Shadow = shadow;
        }
Beispiel #6
0
        public void addShadowBanner()
        {
            var shadow = new NSShadow();

            shadow.ShadowOffset     = new CoreGraphics.CGSize(width: 0, height: 25);
            shadow.ShadowBlurRadius = 20;
            shadow.ShadowColor      = NSColor.Black;

            banner.Superview.WantsLayer = true;
            banner.Shadow = shadow;
        }
Beispiel #7
0
        void Initialize()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            WantsLayer = true;

            shadow = new NSShadow();

            shadow.ShadowOffset     = new CGSize(0, -2);
            shadow.ShadowBlurRadius = 3;
            shadow.ShadowColor      = NSColor.FromWhite(0, 0.55f);
        }
        public static void Initialize(IScheduler dispatcher)
        {
            Effects.Implementation.DropShadow = (content, color, radius, angle, distance) =>
            {
                radius = radius.Select(r => new Points(r * 1.0 / 3.0));
                var offset = angle
                             .Select(d => Math.PI * d / 180.0)
                             .CombineLatest(distance, (r, d) =>
                                            new CGSize(Math.Cos(r) * d, Math.Sin(r) * d));

                var extrudeSize = offset
                                  .CombineLatest(radius, (off, rad) =>
                                                 new Size <Points>(Math.Abs(off.Width) + rad * 2.0, Math.Abs(off.Height) + rad * 2.0))
                                  .Select(s => new Thickness <Points>(s.Width.Round(), s.Height.Round()));

                content = content.WithPadding(extrudeSize);
                var self = Layout.Layer(content).WithSize(content.DesiredSize);

                Fusion.Application.MainThread.Schedule(() =>
                {
                    var contentView = self.NativeHandle as NSView;
                    if (contentView == null)
                    {
                        return;
                    }

                    contentView.WantsLayer = true;

                    var effect = new NSShadow();

                    self.BindNativeProperty(dispatcher, "color", color, c =>
                    {
                        effect.ShadowColor = c.ToNSColor().ShadowWithLevel(0.5f);
                        contentView.Shadow = effect;
                    });

                    self.BindNativeProperty(dispatcher, "radius", radius, c =>
                    {
                        effect.ShadowBlurRadius = (float)c;
                        contentView.Shadow      = effect;
                    });

                    self.BindNativeProperty(dispatcher, "offset", offset, c =>
                    {
                        effect.ShadowOffset = c;
                        contentView.Shadow  = effect;
                    });
                });

                return(self);
            };
        }
		static internal NSDictionary ToDictionary (
						  UIFont font,
						  UIColor foregroundColor,
						  UIColor backgroundColor,
						  UIColor strokeColor,
						  NSParagraphStyle paragraphStyle,
						  NSLigatureType ligature,
						  float kerning,
						  NSUnderlineStyle underlineStyle,
						  NSShadow shadow,
						  float strokeWidth,
						  NSUnderlineStyle strikethroughStyle)
		{
			var attr = new UIStringAttributes ();
			if (font != null){
				attr.Font = font;
			}
			if (foregroundColor != null){
				attr.ForegroundColor = foregroundColor;
			}
			if (backgroundColor != null){
				attr.BackgroundColor = backgroundColor;
			}
			if (strokeColor != null){
				attr.StrokeColor = strokeColor;
			}
			if (paragraphStyle != null){
				attr.ParagraphStyle = paragraphStyle;
			}
			if (ligature != NSLigatureType.Default){
				attr.Ligature = ligature;
			}
			if (kerning != 0){
				attr.KerningAdjustment = kerning;
			}
			if (underlineStyle != NSUnderlineStyle.None){
				attr.UnderlineStyle = underlineStyle;
			}
			if (shadow != null){
				attr.Shadow = shadow;
			}
			if (strokeWidth != 0){
				attr.StrokeWidth = strokeWidth;
			}
			if (strikethroughStyle != NSUnderlineStyle.None){
				attr.StrikethroughStyle = strikethroughStyle;
			}
			var dict = attr.Dictionary;
			return dict.Count == 0 ? null : dict;
		}				
Beispiel #10
0
        public override void Draw(CGRect rect)
        {
            BackgroundColor = UIColor.Clear;
            //// General Declarations
            var context = UIGraphics.GetCurrentContext();

            //// Color Declarations
            var borderColor = UIColor.FromRGBA(0.856f, 0.856f, 0.856f, 1.000f);
            var textColor   = UIColor.FromRGBA(0.404f, 0.404f, 0.404f, 1.000f);

            //// Shadow Declarations
            var shadow = new NSShadow();

            shadow.ShadowColor      = UIColor.Black.ColorWithAlpha(0.07f);
            shadow.ShadowOffset     = new CGSize(0.1f, -0.1f);
            shadow.ShadowBlurRadius = 10.0f;

            //// Rectangle Drawing
            var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 10.0f, rect.GetMinY() + 10.0f, rect.Width - 26.0f, rect.Height - 21.5f), 4.0f);

            context.SaveState();
            context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor);
            UIColor.White.SetFill();
            rectanglePath.Fill();
            context.RestoreState();

            borderColor.SetStroke();
            rectanglePath.LineWidth = 1.0f;
            rectanglePath.Stroke();


            //// Text Drawing
            CGRect textRect = new CGRect(rect.GetMinX() + 28.0f, rect.GetMinY() + 10.0f, rect.Width - 62.0f, rect.Height - 22.0f);

            textColor.SetFill();
            var textStyle = new NSMutableParagraphStyle();

            textStyle.Alignment = UITextAlignment.Center;

            var textFontAttributes = new UIStringAttributes()
            {
                Font = UIFont.FromName("AvenirNext-Regular", UIFont.LabelFontSize), ForegroundColor = textColor, ParagraphStyle = textStyle
            };
            var textTextHeight = new NSString(title).GetBoundingRect(new CGSize(textRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, textFontAttributes, null).Height;

            context.SaveState();
            context.ClipToRect(textRect);
            new NSString(title).DrawString(new CGRect(textRect.GetMinX(), textRect.GetMinY() + (textRect.Height - textTextHeight) / 2.0f, textRect.Width, textTextHeight), UIFont.FromName("AvenirNext-Regular", UIFont.LabelFontSize), UILineBreakMode.WordWrap, UITextAlignment.Center);
            context.RestoreState();
        }
 public NSMutableAttributedString(string str,
                                  UIFont font                         = null,
                                  UIColor foregroundColor             = null,
                                  UIColor backgroundColor             = null,
                                  UIColor strokeColor                 = null,
                                  NSParagraphStyle paragraphStyle     = null,
                                  NSLigatureType ligatures            = NSLigatureType.Default,
                                  float kerning                       = 0,
                                  NSUnderlineStyle underlineStyle     = NSUnderlineStyle.None,
                                  NSShadow shadow                     = null,
                                  float strokeWidth                   = 0,
                                  NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None)
     : this(str, ToDictionary(font, foregroundColor, backgroundColor, strokeColor, paragraphStyle, ligatures, kerning, underlineStyle, shadow, strokeWidth, strikethroughStyle))
 {
 }
		public NSMutableAttributedString (string str,
						  UIFont font = null,
						  UIColor foregroundColor = null,
						  UIColor backgroundColor = null,
						  UIColor strokeColor = null,
						  NSParagraphStyle paragraphStyle = null,
						  NSLigatureType ligatures = NSLigatureType.Default,
						  float kerning = 0,
						  NSUnderlineStyle underlineStyle = NSUnderlineStyle.None,
						  NSShadow shadow = null,
						  float strokeWidth = 0,
						  NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None)
		: this (str, ToDictionary (font, foregroundColor, backgroundColor, strokeColor, paragraphStyle, ligatures, kerning, underlineStyle, shadow, strokeWidth, strikethroughStyle))
		{
		}
Beispiel #13
0
        void DrawStringCenteredInRectangle(string str, CGRect rect)
        {
            NSString drawLetter = new NSString(str);
            CGSize   strSize    = drawLetter.StringSize(mTextAttributes);
            CGPoint  strOrigin  = new CGPoint();

            strOrigin.X = rect.Location.X + (rect.Size.Width - strSize.Width) / 2;
            strOrigin.Y = rect.Location.Y + (rect.Size.Height - strSize.Height) / 2;
            if (LetterShadow)
            {
                NSShadow shadow = new NSShadow();
                shadow.ShadowBlurRadius = 8.0f;
                shadow.ShadowOffset     = new CGSize(5.0f, 5.0f);
                shadow.ShadowColor      = NSColor.Gray;
                shadow.Set();
            }
            drawLetter.DrawString(strOrigin, mTextAttributes);
        }
Beispiel #14
0
        /// <summary>
        /// Updates the UI.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        /// <param name="control">
        /// The control.
        /// </param>
        private void UpdateUi(ExtendedLabel view, UILabel control)
        {
            if (view == null || control == null)
            {
                return;
            }
            //Do not create attributed string if it is not necesarry
            if (!view.IsUnderline && !view.IsStrikeThrough && !view.IsDropShadow)
            {
                return;
            }

            var underline     = view.IsUnderline ? NSUnderlineStyle.Single : NSUnderlineStyle.None;
            var strikethrough = view.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None;

            NSShadow dropShadow = null;

            if (view.IsDropShadow)
            {
                dropShadow = new NSShadow
                {
                    ShadowColor      = UIColor.DarkGray,
                    ShadowBlurRadius = 1.4f,
                    ShadowOffset     = new CoreGraphics.CGSize(new CoreGraphics.CGPoint(0.3f, 0.8f))
                };
            }

            // For some reason, if we try and convert Color.Default to a UIColor, the resulting color is
            // either white or transparent. The net result is the ExtendedLabel does not display.
            // Only setting the control's TextColor if is not Color.Default will prevent this issue.
            if (view.TextColor != Color.Default)
            {
                control.TextColor = view.TextColor.ToUIColor();
            }


            control.AttributedText = new NSMutableAttributedString(control.Text,
                                                                   control.Font,
                                                                   underlineStyle: underline,
                                                                   strikethroughStyle: strikethrough,
                                                                   shadow: dropShadow);
        }
Beispiel #15
0
        public PlaybackBar(CGRect rect) : base(rect)
        {
            BackgroundColor     = NSColor.FromRgba(249, 249, 249, 255);
            AutoresizingMask    = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
            AddSubview(AlbumArt = new NSImageView(new CGRect(0, 0, 67, 67)));
            videoView           = new VideoView {
                WantsLayer = true, Hidden = true
            };

            videoView.MakeBackingLayer();

            AddSubview(previous = CreateButton("SVG/previous.svg", PlaybackManager.Shared.Previous));
            AddSubview(play     = CreateButton("SVG/playButtonBordered.svg", () => {
                if (playing)
                {
                    PlaybackManager.Shared.Pause();
                }
                else
                {
                    PlaybackManager.Shared.Play();
                }
            }));
            AddSubview(next     = CreateButton("SVG/next.svg", () => PlaybackManager.Shared.NextTrack()));
            AddSubview(textView = new TwoLabelView());

            AddSubview(progress = new ProgressView());

            AddSubview(shuffle = CreateButton("SVG/shuffle.svg", 25, PlaybackManager.Shared.ToggleRandom));
            AddSubview(repeat  = CreateButton("SVG/repeat.svg", 25, PlaybackManager.Shared.ToggleRepeat));

            AddSubview(time = new NSTextField {
                StringValue = "0000:00"
            }.StyleAsSubText());
            time.SizeToFit();

            AddSubview(remaining = new NSTextField {
                StringValue = "0000:00", Alignment = NSTextAlignment.Right
            }.StyleAsSubText());
            remaining.SizeToFit();

            AddSubview(volumeSlider = new NSSlider {
                DoubleValue = Settings.CurrentVolume, MinValue = 0, MaxValue = 1
            });
            volumeSlider.Activated += (object sender, EventArgs e) =>
            {
                Settings.CurrentVolume = (float)volumeSlider.DoubleValue;
            };
            volumeSlider.SizeToFit();

            AddSubview(thumbsDown = CreateButton("SVG/thumbsDown.svg", 30, async() =>
            {
                var song = MusicManager.Shared.GetCurrentSong();
                if (song.Rating != 1)
                {
                    await MusicManager.Shared.ThumbsDown(song);
                }
                else
                {
                    await MusicManager.Shared.Unrate(song);
                }
                SetThumbsState(song);
            }));

            AddSubview(thumbsUp = CreateButton("SVG/thumbsUp.svg", 30, async() =>
            {
                var song = MusicManager.Shared.GetCurrentSong();
                if (song.Rating != 5)
                {
                    await MusicManager.Shared.ThumbsUp(song);
                }
                else
                {
                    await MusicManager.Shared.Unrate(song);
                }
                SetThumbsState(song);
            }));

            Update(PlaybackManager.Shared.NativePlayer.CurrentSong);
            var dropShadow = new NSShadow {
                ShadowColor = NSColor.Black,
            };

            this.WantsLayer = true;
            this.Shadow     = dropShadow;
            NotificationManager.Shared.CurrentSongChanged   += (sender, e) => Update(e.Data);
            NotificationManager.Shared.PlaybackStateChanged += (sender, e) => SetState(e.Data);

            NotificationManager.Shared.CurrentTrackPositionChanged += (object sender, SimpleTables.EventArgs <TrackPosition> e) => {
                var data = e.Data;
                //timeLabel.Text = data.CurrentTimeString;
                //remainingTimeLabel.Text = data.RemainingTimeString;
                progress.Progress     = data.Percent;
                time.StringValue      = data.CurrentTimeString;
                remaining.StringValue = data.RemainingTimeString;
            };

            NotificationManager.Shared.ShuffleChanged     += (sender, args) => SetShuffleState(args.Data);
            NotificationManager.Shared.RepeatChanged      += (sender, args) => SetRepeatState(args.Data);
            NotificationManager.Shared.SongDownloadPulsed += (object sender, NotificationManager.SongDowloadEventArgs e) => {
                if (e.SongId != Settings.CurrentSong)
                {
                    return;
                }
                progress.DownloadProgress = e.Percent;
            };

//			NotificationManager.Shared.ToggleFullScreenVideo += (s, a) => ToggleFullScreenVideo();
            SetState(PlaybackState.Stopped);
            SetShuffleState(Settings.ShuffleSongs);
            SetRepeatState(Settings.RepeatMode);
        }
Beispiel #16
0
        /// <summary>
        /// Updates the UI.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        /// <param name="control">
        /// The control.
        /// </param>
        private static void UpdateUi(ExtendedLabel view, UILabel control)
        {
            // Prefer font set through Font property.
            if (view.Font == Font.Default)
            {
                if (view.FontSize > 0)
                {
                    control.Font = UIFont.FromName(control.Font.Name, (float)view.FontSize);
                }

                if (!string.IsNullOrEmpty(view.FontName))
                {
                    string fontName = view.FontName;
                    //if extension given then remove it for iOS
                    if (fontName.LastIndexOf(".", System.StringComparison.Ordinal) == fontName.Length - 4)
                    {
                        fontName = fontName.Substring(0, fontName.Length - 4);
                    }

                    var font = UIFont.FromName(
                        fontName, control.Font.PointSize);

                    if (font != null)
                    {
                        control.Font = font;
                    }
                }

                //======= This is for backward compatability with obsolete attrbute 'FontNameIOS' ========
                if (!string.IsNullOrEmpty(view.FontNameIOS))
                {
                    var font = UIFont.FromName(
                        view.FontNameIOS,
                        (view.FontSize > 0) ? (float)view.FontSize : 12.0f);

                    if (font != null)
                    {
                        control.Font = font;
                    }
                }
                //====== End of obsolete section ==========================================================
            }
            else
            {
                //Font si set by the base class
            }

            //Do not create attributed string if it is not necesarry
            if (view.IsUnderline || view.IsStrikeThrough || view.IsDropShadow)
            {
                var attrString = new NSMutableAttributedString(control.Text);

                if (view.IsUnderline)
                {
                    //control.AttributedText = new NSAttributedString(
                    //    control.Text,
                    //    underlineStyle: NSUnderlineStyle.Single);

                    attrString.AddAttribute(UIStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), new NSRange(0, attrString.Length));
                }

                if (view.IsStrikeThrough)
                {
                    attrString.AddAttribute(UIStringAttributeKey.StrikethroughStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), new NSRange(0, attrString.Length));
                }
                attrString.AddAttribute(UIStringAttributeKey.Font, control.Font, new NSRange(0, attrString.Length));

                if (view.IsDropShadow)
                {
                    var shadow = new NSShadow();
                    shadow.ShadowColor      = UIColor.DarkGray;
                    shadow.ShadowBlurRadius = 1.4f;
                    shadow.ShadowOffset     = new System.Drawing.SizeF(new System.Drawing.PointF(0.3f, 0.8f));

                    attrString.AddAttribute(UIStringAttributeKey.Shadow, shadow, new NSRange(0, attrString.Length));
                }

                control.TextColor      = view.TextColor.ToUIColor();
                control.AttributedText = attrString;
            }
        }
Beispiel #17
0
        static internal NSDictionary ToDictionary(
            UIFont font,
            UIColor foregroundColor,
            UIColor backgroundColor,
            UIColor strokeColor,
            NSParagraphStyle paragraphStyle,
            NSLigatureType ligature,
            float kerning,
            NSUnderlineStyle underlineStyle,
#if !WATCH
            NSShadow shadow,
#endif
            float strokeWidth,
            NSUnderlineStyle strikethroughStyle)
        {
            var attr = new UIStringAttributes();

            if (font != null)
            {
                attr.Font = font;
            }
            if (foregroundColor != null)
            {
                attr.ForegroundColor = foregroundColor;
            }
            if (backgroundColor != null)
            {
                attr.BackgroundColor = backgroundColor;
            }
            if (strokeColor != null)
            {
                attr.StrokeColor = strokeColor;
            }
            if (paragraphStyle != null)
            {
                attr.ParagraphStyle = paragraphStyle;
            }
            if (ligature != NSLigatureType.Default)
            {
                attr.Ligature = ligature;
            }
            if (kerning != 0)
            {
                attr.KerningAdjustment = kerning;
            }
            if (underlineStyle != NSUnderlineStyle.None)
            {
                attr.UnderlineStyle = underlineStyle;
            }
#if !WATCH
            if (shadow != null)
            {
                attr.Shadow = shadow;
            }
#endif
            if (strokeWidth != 0)
            {
                attr.StrokeWidth = strokeWidth;
            }
            if (strikethroughStyle != NSUnderlineStyle.None)
            {
                attr.StrikethroughStyle = strikethroughStyle;
            }
            var dict = attr.Dictionary;
            return(dict.Count == 0 ? null : dict);
        }
Beispiel #18
0
        public override void DrawImage(NSImage image, System.Drawing.RectangleF frame, NSView controlView)
        {
            var context = NSGraphicsContext.CurrentContext.GraphicsPort;

            var darkHighlight = NSColor.FromCalibratedRgba (0.931f, 0.931f, 0.931f, 1.0f);
            var innerBoxShadowColor = NSColor.FromCalibratedRgba (0.896f, 0.896f, 0.896f, 1.0f);
            var switchInnerFillEnabledColor1 = NSColor.FromCalibratedRgba (0.215f, 0.447f, 0.668f, 1.0f);
            var switchInnerFillEnabledColor2 = NSColor.FromCalibratedHsba (switchInnerFillEnabledColor1.HueComponent,
                                                                           switchInnerFillEnabledColor1.SaturationComponent, 1,
                                                                           switchInnerFillEnabledColor1.AlphaComponent);

            var switchInnerFillGradient = new NSGradient (NSColor.DarkGray, NSColor.Gray);
            var buttonFillGradientColors = new NSColor[] { innerBoxShadowColor, NSColor.FromCalibratedRgba(0.948f, 0.948f, 0.948f, 1.0f), NSColor.White };
            var buttonFillGradientPositions = new float[] { 0.0f, 0.25f, 0.51f };
            var switchButtonFillGradient = new NSGradient (buttonFillGradientColors, buttonFillGradientPositions);
            var switchInnerFillEnabledGradient = new NSGradient (new NSColor[] { switchInnerFillEnabledColor1, switchInnerFillEnabledColor2 }, new float[] { 0.0f, 1.0f});

            var switchBoxInnerShadow = new NSShadow ();
            switchBoxInnerShadow.ShadowColor = NSColor.Black;
            switchBoxInnerShadow.ShadowOffset = new SizeF (0.1f, 0.1f);
            switchBoxInnerShadow.ShadowBlurRadius = 5;

            var switchButtonShadow = new NSShadow ();
            switchButtonShadow.ShadowColor = NSColor.DarkGray;
            switchButtonShadow.ShadowOffset = new SizeF (0.1f, 0.1f);
            switchButtonShadow.ShadowBlurRadius = 2;

            var switchFrame =  new RectangleF(frame.X, frame.Y, 69, 28);

            var switchBoxPath = NSBezierPath.FromRoundedRect (new RectangleF (switchFrame.X + 12.5f, switchFrame.Y + switchFrame.Height - 23.5f, 49, 20), 9, 9);

            var gradientToUse = IntValue > 0 ? switchInnerFillEnabledGradient : switchInnerFillGradient;
            gradientToUse.DrawInBezierPath (switchBoxPath, -90);

            var switchBoxBorderRect = switchBoxPath.Bounds;
            switchBoxBorderRect.Inflate (switchBoxInnerShadow.ShadowBlurRadius, switchBoxInnerShadow.ShadowBlurRadius);
            switchBoxBorderRect.Offset (-switchBoxInnerShadow.ShadowOffset.Width, -switchBoxInnerShadow.ShadowOffset.Height);
            switchBoxBorderRect = RectangleF.Union (switchBoxBorderRect, switchBoxPath.Bounds);
            switchBoxBorderRect.Inflate (1, 1);

            var switchBoxNegativePath = NSBezierPath.FromRoundedRect (switchBoxBorderRect, 0, 0);
            switchBoxNegativePath.AppendPath (switchBoxPath);
            switchBoxNegativePath.WindingRule = NSWindingRule.EvenOdd;

            context.SaveState ();

            var switchBoxInnerShadowOffset = new SizeF(0.1f, -1.1f);
            var xOffset = switchBoxInnerShadowOffset.Width + (float)Math.Round(switchBoxBorderRect.Width);
            var yOffset = switchBoxInnerShadowOffset.Height;
            NSShadow switchBoxInnerShadowWithOffset = (NSShadow)switchBoxInnerShadow.Copy ();
            switchBoxInnerShadowWithOffset.ShadowOffset = new SizeF (xOffset + (xOffset >= 0 ? 0.1f : -0.1f), yOffset + (yOffset >= 0 ? 0.1f : -0.1f));
            switchBoxInnerShadowWithOffset.Set ();

            NSColor.Gray.SetFill ();
            switchBoxPath.AddClip ();

            var transform = new NSAffineTransform ();
            transform.Translate (-(float)Math.Round (switchBoxBorderRect.Width), 0);
            transform.TransformBezierPath (switchBoxNegativePath).Fill ();

            context.RestoreState ();

            NSColor.WindowFrame.SetStroke ();
            switchBoxPath.LineWidth = 0.5f;
            switchBoxPath.Stroke ();

            // Switch label drawing

            var labelPosition = IntValue > 0 ? 19 : 32;
            var switchLabelRect = new RectangleF (switchFrame.X + labelPosition, switchFrame.Y + switchFrame.Height - 20, 22, 15);
            NSMutableParagraphStyle switchLabelStyle = (NSMutableParagraphStyle)NSMutableParagraphStyle.DefaultParagraphStyle.MutableCopy ();
            switchLabelStyle.Alignment = NSTextAlignment.Center;
            var switchLabelFontAttributes = NSDictionary.FromObjectsAndKeys (
                new NSObject[] { NSFont.FromFontName("Helvetica-Bold", NSFont.SmallSystemFontSize), darkHighlight, switchLabelStyle },
                new NSObject[] { NSAttributedString.FontAttributeName, NSAttributedString.ForegroundColorAttributeName, NSAttributedString.ParagraphStyleAttributeName });

            var labelText = IntValue > 0 ? "On" : "Off";
            new NSString (labelText).DrawString (switchLabelRect, switchLabelFontAttributes);

            // Switch Button
            var position = this.IntValue > 0 ? 43.0f : 10.0f;
            var switchButtonPath = NSBezierPath.FromOvalInRect (new RectangleF (switchFrame.X + position, switchFrame.Y + switchFrame.Height - 24, 21, 21));

            context.SaveState ();
            switchButtonShadow.Set ();
            context.BeginTransparencyLayer (null);
            switchButtonFillGradient.DrawInBezierPath (switchButtonPath, 135.0f);
            context.EndTransparencyLayer ();
            context.RestoreState ();

            context.SaveState ();
            switchButtonShadow.Set ();
            NSColor.DarkGray.SetStroke ();
            switchButtonPath.LineWidth = 0.5f;
            switchButtonPath.Stroke ();
            context.RestoreState ();
        }
Beispiel #19
0
        private void UpdateUi(ExtendedLabel view)
        {
            // Prefer font set through Font property.
            if (view.FontAttributes == FontAttributes.None)
            {
                if (view.FontSize > 0)
                {
                    this.Control.Font = UIFont.FromName(this.Control.Font.Name, (float)view.FontSize);
                }

                if (!string.IsNullOrEmpty(view.FontName))
                {
                    var fontName = Path.GetFileNameWithoutExtension(view.FontName);

                    var font = UIFont.FromName(fontName, this.Control.Font.PointSize);

                    if (font != null)
                    {
                        this.Control.Font = font;
                    }
                }
            }
            else
            {
                try
                {
                    var font = UIFont.FromName(view.FontFamily, (float)view.FontSize);
                    if (font != null)
                    {
                        this.Control.Font = font;
                    }
                }
                catch (Exception ex)
                {
                    var x = ex;
                }
            }

            var underline     = view.IsUnderline ? NSUnderlineStyle.Single : NSUnderlineStyle.None;
            var strikethrough = view.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None;

            NSShadow dropShadow = null;

            if (view.IsDropShadow)
            {
                dropShadow = new NSShadow
                {
                    ShadowColor      = view.DropShadowColor.ToUIColor(),
                    ShadowBlurRadius = 1.4f,
                    ShadowOffset     = new CoreGraphics.CGSize(new CoreGraphics.CGPoint(0.3f, 0.8f))
                };
            }

            if (view.TextColor != Color.Default)
            {
                this.Control.TextColor = view.TextColor.ToUIColor();
            }

            this.Control.AttributedText = new NSMutableAttributedString(view.Text,
                                                                        this.Control.Font,
                                                                        underlineStyle: underline,
                                                                        strikethroughStyle: strikethrough,
                                                                        shadow: dropShadow);

            if (view.Lines != -1)
            {
                Control.Lines = view.Lines;
            }
        }
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);
            if (Element == null)
            {
                return;
            }

            var cx = rect.Width / 2f;
            var cy = rect.Height / 2f;

            var colorSpace = CGColorSpace.CreateDeviceRGB();
            var context    = UIGraphics.GetCurrentContext();

            var gradientColors    = new CGColor[] { UIColor.LightGray.CGColor, Element.BackgroundColor.ToCGColor() };
            var gradientLocations = new nfloat[] { 0f, 1f };
            var gradient          = new CGGradient(colorSpace, gradientColors, gradientLocations);

            var shadow = new NSShadow()
            {
                ShadowColor      = UIColor.Gray,
                ShadowOffset     = new CGSize(3, 3),
                ShadowBlurRadius = 3
            };

            // Draw the hexagon (POINTY-TOP ONLY)
            var radius = Element.Radius;

            if (Element.BorderColor.A > 0 &&
                Element.BorderSize > 0)
            {
                radius -= Element.BorderSize / 2f;
            }
            var points = new List <CGPoint>();

            for (int i = 0; i < 6; ++i)
            {
                points.Add(new CGPoint(cx + radius * Math.Cos((i * 60 - 30) * Math.PI / 180f),
                                       cy + radius * Math.Sin((i * 60 - 30) * Math.PI / 180f)));
            }

            var midPoint = new CGPoint(0.5 * (points[0].X + points[1].X), 0.5 * (points[0].Y + points[1].Y));
            var path     = new CGPath();

            path.MoveToPoint(midPoint);
            for (var i = 0; i < points.Count; ++i)
            {
                path.AddLineToPoint(new CGPoint(points[(i + 1) % points.Count].X, points[(i + 1) % points.Count].Y));
            }
            path.CloseSubpath();

            context.AddPath(path);

            //CoreAnimation.CAShapeLayer mask = new CoreAnimation.CAShapeLayer();
            //context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, UIColor.Gray.CGColor);

            context.SetFillColor(Element.BackgroundColor.ToCGColor());
            if (Element.BorderColor.A > 0 &&
                Element.BorderSize > 0)
            {
                context.SetLineWidth((nfloat)Element.BorderSize);
                context.SetStrokeColor(Element.BorderColor.ToCGColor());
                context.DrawPath(CGPathDrawingMode.FillStroke);
            }
            else
            {
                context.DrawPath(CGPathDrawingMode.Fill);
            }
            //context.SaveState();
            //context.BeginTransparencyLayer();
            //path.AddClip();
            //context.DrawLinearGradient(gradient, points[0], points[1], CGGradientDrawingOptions.DrawsAfterEndLocation);
            //context.EndTransparencyLayer();
            //context.RestoreState();

            // Draw Text
            if (!String.IsNullOrEmpty(Element.FAText))
            {
                double eigthHeight   = rect.Height / 8;
                double quarterHeight = rect.Height / 4;
                double threeEights   = eigthHeight * 3;
                if (!String.IsNullOrEmpty(Element.Text))
                {
                    // FAText Icon with Text
                    //CGRect faRect = new CGRect(rect.X, rect.Y + eigthHeight, rect.Width, threeEights);   // no overlap
                    CGRect  faRect  = new CGRect(rect.X, rect.Y + eigthHeight, rect.Width, rect.Height / 2); // bottom of rect slightly overlaps with text-label
                    UILabel faLabel = new UILabel(faRect)
                    {
                        Text          = Element.FAText,
                        TextAlignment = UITextAlignment.Center,
                        TextColor     = Element.TextColor.ToUIColor(),
                        Font          = UIFont.FromName(Element.FAFontFamily,
                                                        (nfloat)Element.FAFontSize)
                    };
                    CGRect  labelRect = new CGRect(rect.X, rect.Height / 2, rect.Width, quarterHeight);
                    UILabel label     = new UILabel(labelRect)
                    {
                        Text          = Element.Text,
                        TextAlignment = UITextAlignment.Center,
                        TextColor     = Element.TextColor.ToUIColor(),
                        Font          = UIFont.FromName(Element.FontFamily,
                                                        (nfloat)Element.FontSize)
                    };
                    NativeView.AddSubviews(new UIView[] { faLabel, label });
                }
                else
                {
                    if (Element.IsMenu)
                    {
                        // FAText Icon only (used for IsMenu property of HexagonLayout)
                        CGRect  faRect  = new CGRect(rect.X, rect.Y + eigthHeight, rect.Width, rect.Height / 2);
                        UILabel faLabel = new UILabel(faRect)
                        {
                            Text          = Element.FAText,
                            TextAlignment = UITextAlignment.Center,
                            TextColor     = Element.TextColor.ToUIColor(),
                            Font          = UIFont.FromName(Element.FAFontFamily,
                                                            (nfloat)Element.FAFontSize)
                        };
                        NativeView.AddSubview(faLabel);
                    }
                    else
                    {
                        // FAText Icon only (centered)
                        CGRect  faRect  = new CGRect(rect.X, rect.Y, rect.Width, rect.Height);
                        UILabel faLabel = new UILabel(faRect)
                        {
                            Text          = Element.FAText,
                            TextAlignment = UITextAlignment.Center,
                            TextColor     = Element.TextColor.ToUIColor(),
                            Font          = UIFont.FromName(Element.FAFontFamily,
                                                            (nfloat)Element.FAFontSize)
                        };
                        NativeView.AddSubview(faLabel);
                    }
                }
            }
            else
            {
                UILabel label = new UILabel(rect)
                {
                    Text          = Element.Text,
                    TextAlignment = UITextAlignment.Center,
                    TextColor     = Element.TextColor.ToUIColor(),
                    Font          = UIFont.FromName(Element.FontFamily,
                                                    (nfloat)Element.FontSize)
                };
                NativeView.AddSubview(label);
            }
        }
Beispiel #21
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  = (float)Math.Ceiling((double)frame.Size.Width * 1.5);
            textureSize.Height = (float)Math.Ceiling((double)frame.Size.Height * 1.5);

            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);
        }
Beispiel #22
0
        private RectangleF GetTitleFrame(out NSDictionary titleTextStyles, AppStoreWindow window)
        {
            var drawsAsMainWindow = window.DrawsAsMainWindow();
            var titleTextShadow = drawsAsMainWindow ? window.TitleTextShadow : window.InactiveTitleTextShadow;
            if (titleTextShadow == null)
            {
                titleTextShadow = new NSShadow
                {
                    ShadowBlurRadius = 0f,
                    ShadowOffset = new SizeF(0f, -1.0f),
                    ShadowColor = NSColor.FromDeviceWhite(1.0f, 0.5f),
                };
            }

            var titleTextColor = drawsAsMainWindow ? window.TitleTextColor : window.InactiveTitleTextColor;
            if (titleTextColor == default(NSColor))
            {
                titleTextColor = AppStoreWindow.DefaultTitleTextColor(drawsAsMainWindow);
            }
            var titleFont = window.TitleFont ??
                            NSFont.TitleBarFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Regular));

            var titleParagraphStyle = (NSParagraphStyle)NSParagraphStyle.DefaultParagraphStyle.MutableCopy();//new NSParagraphStyle { LineBreakMode = NSLineBreakMode.TruncatingTail };
            titleParagraphStyle.LineBreakMode = NSLineBreakMode.TruncatingTail;

            titleTextStyles = NSDictionary.FromObjectsAndKeys(
                new object[]
                {
                    titleFont, titleTextColor,
                    titleTextShadow, titleParagraphStyle
                },
                new object[]
                {
                    NSAttributedString.FontAttributeName, NSAttributedString.ForegroundColorAttributeName,
                    NSAttributedString.ShadowAttributeName, NSAttributedString.ParagraphStyleAttributeName
                });

            var titleSize = new NSAttributedString(window.Title, titleTextStyles).Size;
            var titleTextRect = new RectangleF(0, 0, titleSize.Width, titleSize.Height);

            var docIconButton = window.StandardWindowButton(NSWindowButton.DocumentIconButton);
            var versionButton = window.StandardWindowButton(NSWindowButton.DocumentVersionsButton);
            var closeButton = window.ButtonToLayout(NSWindowButton.CloseButton);
            var minimizeButton = window.ButtonToLayout(NSWindowButton.MiniaturizeButton);
            var zoomButton = window.ButtonToLayout(NSWindowButton.ZoomButton);

            if (docIconButton != null)
            {
                var docIconButtonFrame = ConvertRectFromView(docIconButton.Frame, docIconButton.Superview);
                titleTextRect.X = docIconButtonFrame.GetMaxX() + TITLE_DOCUMENT_BUTTON_OFFSET.Width;
                titleTextRect.Y = docIconButtonFrame.GetMidY() - titleSize.Height / 2f +
                TITLE_DOCUMENT_BUTTON_OFFSET.Height;
            }
            else if (versionButton != null)
            {
                var versionsButtonFrame = ConvertRectFromView(versionButton.Frame, versionButton.Superview);
                titleTextRect.X = versionsButtonFrame.GetMinX() - titleSize.Width + TITLE_VERSIONS_BUTTON_OFFSET;

                var document = ((NSWindowController)window.WindowController).Document;
                if (document.HasUnautosavedChanges || document.IsDocumentEdited)
                {
                    titleTextRect.X += TITLE_DOCUMENT_STATUS_X_OFFSET;
                }
            }
            else if (closeButton != null || minimizeButton != null || zoomButton != null)
            {
                var closeMaxX = closeButton == null ? 0f : closeButton.Frame.GetMaxX();
                var minimizeMaxX = minimizeButton == null ? 0f : minimizeButton.Frame.GetMaxX();
                var zoomMaxX = zoomButton == null ? 0f : zoomButton.Frame.GetMaxX();

                var adjustedX = Math.Max(Math.Max(closeMaxX, minimizeMaxX), zoomMaxX) + TITLE_MARGINS.Width;
                var proposedX = Bounds.GetMidX() - titleSize.Width / 2f;
                titleTextRect.X = Math.Max(proposedX, adjustedX);
            }
            else
            {
                titleTextRect.X = Bounds.GetMidX() - titleSize.Width / 2f;
            }

            var fullScreenButton = window.ButtonToLayout(NSWindowButton.FullScreenButton);
            if (fullScreenButton != null)
            {
                var fullScreenX = fullScreenButton.Frame.X;
                var maxTitleX = titleTextRect.GetMaxX();
                if ((fullScreenX - TITLE_MARGINS.Width) < titleTextRect.GetMaxX())
                {
                    titleTextRect.Width = titleTextRect.Size.Width - (maxTitleX - fullScreenX) - TITLE_MARGINS.Width;
                }
            }

            titleTextRect.Y = Bounds.GetMaxY() - titleSize.Height - TITLE_MARGINS.Height;

            return titleTextRect;
        }
        //// Drawing Methods

        public static void DrawUISwitch(bool inFocus, bool switchOn)
        {
            //// General Declarations
            var context = UIGraphics.GetCurrentContext();


            //// Shadow Declarations
            var shadow = new NSShadow();

            shadow.ShadowColor      = CustomControlsStyleKit.ShadowColor;
            shadow.ShadowOffset     = new CGSize(0.1f, 5.1f);
            shadow.ShadowBlurRadius = 5.0f;

            //// Variable Declarations
            var thumbHeight = inFocus ? 85.0f : 65.0f;
            var thumbY      = inFocus ? 6.0f : 16.0f;
            var thumbColor  = inFocus ? CustomControlsStyleKit.InFocusThumbColor : CustomControlsStyleKit.UnFocusedThumbColor;
            var textColor   = inFocus ? CustomControlsStyleKit.InFocusTextColor : CustomControlsStyleKit.UnFocusedTextColor;
            var gutterColor = switchOn ? (inFocus ? CustomControlsStyleKit.OnColor : CustomControlsStyleKit.OnColorUnFocused) : (inFocus ? CustomControlsStyleKit.OffColor : CustomControlsStyleKit.OffColorUnFocused);
            var thumbX      = switchOn ? 147.0f : 11.0f;
            var switchOff   = !switchOn;

            //// Gutter Drawing
            var gutterPath = UIBezierPath.FromRoundedRect(new CGRect(11.0f, 16.0f, 227.0f, 67.0f), 4.0f);

            gutterColor.SetFill();
            gutterPath.Fill();

            ////// Gutter Inner Shadow
            context.SaveState();
            context.ClipToRect(gutterPath.Bounds);
            context.SetShadow(new CGSize(0, 0), 0);
            context.SetAlpha(shadow.ShadowColor.CGColor.Alpha);
            context.BeginTransparencyLayer();
            {
                var opaqueShadow = new CGColor(shadow.ShadowColor.CGColor, 1.0f);
                context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, opaqueShadow);
                context.SetBlendMode(CGBlendMode.SourceOut);
                context.BeginTransparencyLayer();

                context.SetFillColor(opaqueShadow);
                gutterPath.Fill();

                context.EndTransparencyLayer();
            }
            context.EndTransparencyLayer();
            context.RestoreState();

            CustomControlsStyleKit.BorderColor.SetStroke();
            gutterPath.LineWidth = 2.0f;
            gutterPath.Stroke();


            //// Rectangle Drawing
            var rectanglePath = UIBezierPath.FromRoundedRect(new CGRect(thumbX, thumbY, 91.0f, thumbHeight), 4.0f);

            context.SaveState();
            context.SetShadow(shadow.ShadowOffset, shadow.ShadowBlurRadius, shadow.ShadowColor.CGColor);
            thumbColor.SetFill();
            rectanglePath.Fill();
            context.RestoreState();

            CustomControlsStyleKit.BorderColor.SetStroke();
            rectanglePath.LineWidth = 2.0f;
            rectanglePath.Stroke();


            if (switchOn)
            {
                //// OnText Drawing
                CGRect onTextRect = new CGRect(26.0f, 27.0f, 99.0f, 49.0f);
                {
                    var textContent = "ON";
                    textColor.SetFill();
                    var onTextStyle = new NSMutableParagraphStyle();
                    onTextStyle.Alignment = UITextAlignment.Center;

                    var onTextFontAttributes = new UIStringAttributes()
                    {
                        Font = UIFont.BoldSystemFontOfSize(27.0f), ForegroundColor = textColor, ParagraphStyle = onTextStyle
                    };
                    var onTextTextHeight = new NSString(textContent).GetBoundingRect(new CGSize(onTextRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, onTextFontAttributes, null).Height + 10;
                    context.SaveState();
                    context.ClipToRect(onTextRect);
                    new NSString(textContent).DrawString(new CGRect(onTextRect.GetMinX(), onTextRect.GetMinY() + (onTextRect.Height - onTextTextHeight) / 2.0f, onTextRect.Width, onTextTextHeight), UIFont.BoldSystemFontOfSize(27.0f), UILineBreakMode.WordWrap, UITextAlignment.Center);
                    context.RestoreState();
                }
            }


            if (switchOff)
            {
                //// OffText Drawing
                CGRect offTextRect = new CGRect(123.0f, 27.0f, 99.0f, 49.0f);
                {
                    var textContent = "OFF";
                    textColor.SetFill();
                    var offTextStyle = new NSMutableParagraphStyle();
                    offTextStyle.Alignment = UITextAlignment.Center;

                    var offTextFontAttributes = new UIStringAttributes()
                    {
                        Font = UIFont.BoldSystemFontOfSize(27.0f), ForegroundColor = textColor, ParagraphStyle = offTextStyle
                    };
                    var offTextTextHeight = new NSString(textContent).GetBoundingRect(new CGSize(offTextRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, offTextFontAttributes, null).Height + 10;
                    context.SaveState();
                    context.ClipToRect(offTextRect);
                    new NSString(textContent).DrawString(new CGRect(offTextRect.GetMinX(), offTextRect.GetMinY() + (offTextRect.Height - offTextTextHeight) / 2.0f, offTextRect.Width, offTextTextHeight), UIFont.BoldSystemFontOfSize(27.0f), UILineBreakMode.WordWrap, UITextAlignment.Center);
                    context.RestoreState();
                }
            }
        }
        static internal NSDictionary ToDictionary(
            NSFont font,
            NSColor foregroundColor,
            NSColor backgroundColor,
            NSColor strokeColor,
            NSColor underlineColor,
            NSColor strikethroughColor,
            NSUnderlineStyle underlineStyle,
            NSUnderlineStyle strikethroughStyle,
            NSParagraphStyle paragraphStyle,
            float strokeWidth,
            NSShadow shadow,
            NSUrl link,
            bool superscript,
            NSTextAttachment attachment,
            NSLigatureType ligature,
            float baselineOffset,
            float kerningAdjustment,
            float obliqueness,
            float expansion,
            NSCursor cursor,
            string toolTip,
            int characterShape,
            NSGlyphInfo glyphInfo,
            NSArray writingDirection,
            bool markedClauseSegment,
            NSTextLayoutOrientation verticalGlyphForm,
            NSTextAlternatives textAlternatives,
            NSSpellingState spellingState)
        {
            var attr = new NSStringAttributes();

            if (font != null)
            {
                attr.Font = font;
            }

            if (paragraphStyle != null)
            {
                attr.ParagraphStyle = paragraphStyle;
            }

            if (foregroundColor != null)
            {
                attr.ForegroundColor = foregroundColor;
            }

            if (underlineStyle != NSUnderlineStyle.None)
            {
                attr.UnderlineStyle = (int?)underlineStyle;
            }

            if (superscript)
            {
                attr.Superscript = true;
            }

            if (backgroundColor != null)
            {
                attr.BackgroundColor = backgroundColor;
            }

            if (attachment != null)
            {
                attr.Attachment = attachment;
            }

            if (ligature != NSLigatureType.Default)
            {
                attr.Ligature = ligature;
            }

            if (baselineOffset != 0)
            {
                attr.BaselineOffset = baselineOffset;
            }

            if (kerningAdjustment != 0)
            {
                attr.KerningAdjustment = kerningAdjustment;
            }

            if (link != null)
            {
                attr.Link = link;
            }

            if (strokeWidth != 0)
            {
                attr.StrokeWidth = strokeWidth;
            }

            if (strokeColor != null)
            {
                attr.StrokeColor = strokeColor;
            }

            if (underlineColor != null)
            {
                attr.UnderlineColor = underlineColor;
            }

            if (strikethroughStyle != NSUnderlineStyle.None)
            {
                attr.StrikethroughStyle = (int?)strikethroughStyle;
            }

            if (strikethroughColor != null)
            {
                attr.StrikethroughColor = strikethroughColor;
            }

            if (shadow != null)
            {
                attr.Shadow = shadow;
            }

            if (obliqueness != 0)
            {
                attr.Obliqueness = obliqueness;
            }

            if (expansion != 0)
            {
                attr.Expansion = expansion;
            }

            if (cursor != null)
            {
                attr.Cursor = cursor;
            }

            if (toolTip != null)
            {
                attr.ToolTip = toolTip;
            }

            if (characterShape != 0)
            {
                attr.CharacterShape = 0;
            }

            if (glyphInfo != null)
            {
                attr.GlyphInfo = glyphInfo;
            }

            if (writingDirection != null)
            {
                attr.WritingDirection = writingDirection;
            }

            if (markedClauseSegment)
            {
                attr.MarkedClauseSegment = true;
            }

            if (verticalGlyphForm != NSTextLayoutOrientation.Horizontal)
            {
                attr.VerticalGlyphForm = verticalGlyphForm;
            }

            if (textAlternatives != null)
            {
                attr.TextAlternatives = textAlternatives;
            }

            if (spellingState != NSSpellingState.None)
            {
                attr.SpellingState = spellingState;
            }

            var dict = attr.Dictionary;

            return(dict.Count == 0 ? null : dict);
        }
Beispiel #25
0
 void DrawStringCenteredInRectangle(string str, CGRect rect)
 {
     NSString drawLetter = new NSString(str);
     CGSize strSize = drawLetter.StringSize(mTextAttributes);
     CGPoint strOrigin = new CGPoint();
     strOrigin.X = rect.Location.X + (rect.Size.Width - strSize.Width)/2;
     strOrigin.Y = rect.Location.Y + (rect.Size.Height - strSize.Height)/2;
     if (LetterShadow) {
         NSShadow shadow = new NSShadow();
         shadow.ShadowBlurRadius = 8.0f;
         shadow.ShadowOffset = new CGSize(5.0f, 5.0f);
         shadow.ShadowColor = NSColor.Gray;
         shadow.Set();
     }
     drawLetter.DrawString(strOrigin, mTextAttributes);
 }
Beispiel #26
0
        public NSAttributedString(string str,
            NSFont font = null,
            NSColor foregroundColor = null,
            NSColor backgroundColor = null,
            NSColor strokeColor = null,
            NSColor underlineColor = null,
            NSColor strikethroughColor = null,
            NSUnderlineStyle underlineStyle = NSUnderlineStyle.None,
            NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None,
            NSParagraphStyle paragraphStyle = null,
            float strokeWidth = 0,
            NSShadow shadow = null,
            NSUrl link = null,
            bool superscript = false,
            NSTextAttachment attachment = null,
            NSLigatureType ligature = NSLigatureType.Default,
            float baselineOffset = 0,
            float kerningAdjustment = 0,
            float obliqueness = 0,
            float expansion = 0,
            NSCursor cursor = null,
            string toolTip = null,
            int characterShape = 0,
            NSGlyphInfo glyphInfo = null,
            NSArray writingDirection = null,
            bool markedClauseSegment = false,
            NSTextLayoutOrientation verticalGlyphForm = NSTextLayoutOrientation.Horizontal,
            NSTextAlternatives textAlternatives = null,
            NSSpellingState spellingState = NSSpellingState.None)
            : this(str, NSStringAttributes.ToDictionary (
				font: font,
				foregroundColor: foregroundColor,
				backgroundColor: backgroundColor,
				strokeColor: strokeColor,
				underlineColor: underlineColor,
				strikethroughColor: strikethroughColor,
				underlineStyle: underlineStyle,
				strikethroughStyle: strikethroughStyle,
				paragraphStyle: paragraphStyle,
				strokeWidth: strokeWidth,
				shadow: shadow,
				link: link,
				superscript: superscript,
				attachment: attachment,
				ligature: ligature,
				baselineOffset: baselineOffset,
				kerningAdjustment: kerningAdjustment,
				obliqueness: obliqueness,
				expansion: expansion,
				cursor: cursor,
				toolTip: toolTip,
				characterShape: characterShape,
				glyphInfo: glyphInfo,
				writingDirection: writingDirection,
				markedClauseSegment: markedClauseSegment,
				verticalGlyphForm: verticalGlyphForm,
				textAlternatives: textAlternatives,
				spellingState: spellingState
			))
        {
        }
        private CGRect GetTitleFrame(out NSDictionary titleTextStyles, AppStoreWindow window)
        {
            var drawsAsMainWindow = window.DrawsAsMainWindow();
            var titleTextShadow   = drawsAsMainWindow ? window.TitleTextShadow : window.InactiveTitleTextShadow;

            if (titleTextShadow == null)
            {
                titleTextShadow = new NSShadow
                {
                    ShadowBlurRadius = 0f,
                    ShadowOffset     = new CGSize(0f, -1.0f),
                    ShadowColor      = NSColor.FromDeviceWhite(1.0f, 0.5f),
                };
            }

            var titleTextColor = drawsAsMainWindow ? window.TitleTextColor : window.InactiveTitleTextColor;

            if (titleTextColor == default(NSColor))
            {
                titleTextColor = AppStoreWindow.DefaultTitleTextColor(drawsAsMainWindow);
            }
            var titleFont = window.TitleFont ??
                            NSFont.TitleBarFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Regular));

            var titleParagraphStyle = (NSParagraphStyle)NSParagraphStyle.DefaultParagraphStyle.MutableCopy();//new NSParagraphStyle { LineBreakMode = NSLineBreakMode.TruncatingTail };

            titleParagraphStyle.LineBreakMode = NSLineBreakMode.TruncatingTail;

            titleTextStyles = NSDictionary.FromObjectsAndKeys(
                new object[]
            {
                titleFont, titleTextColor,
                titleTextShadow, titleParagraphStyle
            },
                new object[]
            {
                NSStringAttributeKey.Font, NSStringAttributeKey.ForegroundColor,
                NSStringAttributeKey.Shadow, NSStringAttributeKey.ParagraphStyle
            });

            var titleSize     = new NSAttributedString(window.Title, titleTextStyles).Size;
            var titleTextRect = new CGRect(0, 0, titleSize.Width, titleSize.Height);

            var docIconButton  = window.StandardWindowButton(NSWindowButton.DocumentIconButton);
            var versionButton  = window.StandardWindowButton(NSWindowButton.DocumentVersionsButton);
            var closeButton    = window.ButtonToLayout(NSWindowButton.CloseButton);
            var minimizeButton = window.ButtonToLayout(NSWindowButton.MiniaturizeButton);
            var zoomButton     = window.ButtonToLayout(NSWindowButton.ZoomButton);

            if (docIconButton != null)
            {
                var docIconButtonFrame = ConvertRectFromView(docIconButton.Frame, docIconButton.Superview);
                titleTextRect.X = docIconButtonFrame.GetMaxX() + TITLE_DOCUMENT_BUTTON_OFFSET.Width;
                titleTextRect.Y = docIconButtonFrame.GetMidY() - titleSize.Height / 2f +
                                  TITLE_DOCUMENT_BUTTON_OFFSET.Height;
            }
            else if (versionButton != null)
            {
                var versionsButtonFrame = ConvertRectFromView(versionButton.Frame, versionButton.Superview);
                titleTextRect.X = versionsButtonFrame.GetMinX() - titleSize.Width + TITLE_VERSIONS_BUTTON_OFFSET;

                var document = ((NSWindowController)window.WindowController).Document;
                if (document.HasUnautosavedChanges || document.IsDocumentEdited)
                {
                    titleTextRect.X += TITLE_DOCUMENT_STATUS_X_OFFSET;
                }
            }
            else if (closeButton != null || minimizeButton != null || zoomButton != null)
            {
                var closeMaxX    = closeButton == null ? 0f : closeButton.Frame.GetMaxX();
                var minimizeMaxX = minimizeButton == null ? 0f : minimizeButton.Frame.GetMaxX();
                var zoomMaxX     = zoomButton == null ? 0f : zoomButton.Frame.GetMaxX();

                var adjustedX = NMath.Max(NMath.Max(closeMaxX, minimizeMaxX), zoomMaxX) + TITLE_MARGINS.Width;
                var proposedX = Bounds.GetMidX() - titleSize.Width / 2f;
                titleTextRect.X = NMath.Max(proposedX, adjustedX);
            }
            else
            {
                titleTextRect.X = Bounds.GetMidX() - titleSize.Width / 2f;
            }

            var fullScreenButton = window.ButtonToLayout(NSWindowButton.FullScreenButton);

            if (fullScreenButton != null)
            {
                var fullScreenX = fullScreenButton.Frame.X;
                var maxTitleX   = titleTextRect.GetMaxX();
                if ((fullScreenX - TITLE_MARGINS.Width) < titleTextRect.GetMaxX())
                {
                    titleTextRect.Width = titleTextRect.Size.Width - (maxTitleX - fullScreenX) - TITLE_MARGINS.Width;
                }
            }

            titleTextRect.Y = Bounds.GetMaxY() - titleSize.Height - TITLE_MARGINS.Height;

            return(titleTextRect);
        }
Beispiel #28
0
        public override void DrawRect(RectangleF dirtyRect)
        {
            var context = NSGraphicsContext.CurrentContext.GraphicsPort;

            var innerBoxShadowColor = NSColor.FromCalibratedRgba (0.896f, 0.896f, 0.896f, 1.0f);
            var darkHighlight = NSColor.FromCalibratedRgba (0.931f, 0.931f, 0.931f, 1.0f);
            var boxBackgroundColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f);

            var headingGradient = new NSGradient (
                new NSColor[] { NSColor.White, darkHighlight },
                new float[] { 0.50f, 1.0f });

            var shadow = new NSShadow ();
            shadow.ShadowColor = innerBoxShadowColor;
            shadow.ShadowOffset = new SizeF (0.1f, 0.1f);
            shadow.ShadowBlurRadius = 8.0f;

            var headerShadow = new NSShadow ();
            headerShadow.ShadowColor = innerBoxShadowColor;
            headerShadow.ShadowOffset = new SizeF(1.1f, -1.1f);
            headerShadow.ShadowBlurRadius = 5.0f;

            var drawFrame = Bounds;

            // Main Box Drawing
            var mainBoxRect = new RectangleF(drawFrame.X + 4.5f, (float)(drawFrame.Y + Math.Floor((drawFrame.Height - 36.0f) * 0.02976f) + 0.5f),
                                         	 drawFrame.Width - 9.0f, (float)(drawFrame.Height - 36.5f - Math.Floor((drawFrame.Height - 36) * 0.02976f)));

            var mainBoxCornerRadius = 4.0f;
            var mainBoxInnerRect = new RectangleF(mainBoxRect.X, mainBoxRect.Y, mainBoxRect.Width, mainBoxRect.Height);
            mainBoxInnerRect.Offset (mainBoxCornerRadius, mainBoxCornerRadius);

            var mainBoxPath = new NSBezierPath ();
            mainBoxPath.AppendPathWithArc (new PointF (mainBoxInnerRect.X, mainBoxInnerRect.Y), mainBoxCornerRadius, 180.0f, 270.0f);
            mainBoxPath.AppendPathWithArc (new PointF (mainBoxInnerRect.Width, mainBoxInnerRect.Y), mainBoxCornerRadius, 270.0f, 360.0f);
            mainBoxPath.LineTo (new PointF (mainBoxRect.Right, mainBoxRect.Bottom));
            mainBoxPath.LineTo (new PointF (mainBoxRect.X, mainBoxRect.Bottom));
            mainBoxPath.ClosePath ();

            boxBackgroundColor.SetFill ();
            mainBoxPath.Fill ();

            // Main Box Inner Shadow
            var mainBoxBorderRect = mainBoxPath.Bounds;
            mainBoxBorderRect.Inflate(shadow.ShadowBlurRadius, shadow.ShadowBlurRadius);
            mainBoxBorderRect.Offset(-shadow.ShadowOffset.Width, -shadow.ShadowOffset.Height);
            mainBoxBorderRect = RectangleF.Union(mainBoxBorderRect, mainBoxPath.Bounds);
            mainBoxBorderRect.Inflate(1, 1);

            var mainBoxNegativePath = NSBezierPath.FromRect (mainBoxBorderRect);
            mainBoxNegativePath.AppendPath (mainBoxPath);
            mainBoxNegativePath.WindingRule = NSWindingRule.EvenOdd;

            context.SaveState ();
            NSShadow shadowWithOffset = (NSShadow)shadow.Copy ();
            var xOffset = shadowWithOffset.ShadowOffset.Width + Math.Round (mainBoxBorderRect.Size.Width);
            var yOffset = shadowWithOffset.ShadowOffset.Height;
            shadowWithOffset.ShadowOffset = new SizeF ((float)(xOffset + (xOffset >= 0 ? 0.1f : -0.1f)), (float)(yOffset + (yOffset >= 0 ? 0.1f : -0.1f)));
            shadowWithOffset.Set ();

            NSColor.Gray.SetFill ();
            mainBoxPath.AddClip ();

            var transform = new NSAffineTransform ();
            transform.Translate (-(float)Math.Round (mainBoxBorderRect.Size.Width), 0);
            transform.TransformBezierPath (mainBoxNegativePath).Fill ();
            context.RestoreState ();

            NSColor.Gray.SetStroke ();
            mainBoxPath.LineWidth = 0.5f;
            mainBoxPath.Stroke ();

            // Box Head Drawing
            var headingBoxCornerRadius = 4.0f;
            var headingBoxRect = new RectangleF (drawFrame.X + 4.5f, drawFrame.Y + drawFrame.Height - 36.0f, drawFrame.Width - 9.0f, 25.0f);
            var headingBoxInnerRect = new RectangleF (headingBoxRect.X, headingBoxRect.Y, headingBoxRect.Width, headingBoxRect.Height);
            headingBoxInnerRect.Offset (headingBoxCornerRadius, headingBoxCornerRadius);

            var headingBoxPath = new NSBezierPath ();
            headingBoxPath.MoveTo (new PointF (headingBoxRect.X, headingBoxRect.Y));
            headingBoxPath.LineTo (new PointF (headingBoxRect.Right, headingBoxRect.Y));
            headingBoxPath.AppendPathWithArc (new PointF (headingBoxInnerRect.Width, headingBoxInnerRect.Bottom), headingBoxCornerRadius, 0.0f, 90.0f);
            headingBoxPath.AppendPathWithArc (new PointF (headingBoxInnerRect.X, headingBoxInnerRect.Bottom), headingBoxCornerRadius, 90.0f, 180.0f);
            headingBoxPath.ClosePath ();

            context.SaveState ();
            headerShadow.Set ();
            context.BeginTransparencyLayer (null);
            headingGradient.DrawInBezierPath (headingBoxPath, -90);
            context.EndTransparencyLayer ();
            context.RestoreState ();

            NSColor.Gray.SetStroke ();
            headingBoxPath.LineWidth = 0.5f;
            headingBoxPath.Stroke ();
        }
Beispiel #29
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;
		}
        /// <summary>
        /// Updates the UI.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        /// <param name="control">
        /// The control.
        /// </param>
        private void UpdateUi(ExtendedLabel view, UILabel control)
        {
            // Prefer font set through Font property.
            if (view.Font == Font.Default)
            {
                if (view.FontSize > 0)
                {
                    control.Font = UIFont.FromName(control.Font.Name, (float)view.FontSize);
                }

                if (!string.IsNullOrEmpty(view.FontName))
                {
                    var fontName = Path.GetFileNameWithoutExtension(view.FontName);

                    var font = UIFont.FromName(fontName, control.Font.PointSize);

                    if (font != null)
                    {
                        control.Font = font;
                    }
                }

                #region ======= This is for backward compatability with obsolete attrbute 'FontNameIOS' ========
                if (!string.IsNullOrEmpty(view.FontNameIOS))
                {
                    var font = UIFont.FromName(view.FontNameIOS, (view.FontSize > 0) ? (float)view.FontSize : 12.0f);

                    if (font != null)
                    {
                        control.Font = font;
                    }
                }
                #endregion ====== End of obsolete section ==========================================================
            }

            //Do not create attributed string if it is not necesarry
            if (!view.IsUnderline && !view.IsStrikeThrough && !view.IsDropShadow)
            {
                return;
            }

            var underline     = view.IsUnderline ? NSUnderlineStyle.Single : NSUnderlineStyle.None;
            var strikethrough = view.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None;

            NSShadow dropShadow = null;

            if (view.IsDropShadow)
            {
                dropShadow = new NSShadow
                {
                    ShadowColor      = UIColor.DarkGray,
                    ShadowBlurRadius = 1.4f,
                    ShadowOffset     = new System.Drawing.SizeF(new System.Drawing.PointF(0.3f, 0.8f))
                };
            }

            // For some reason, if we try and convert Color.Default to a UIColor, the resulting color is
            // either white or transparent. The net result is the ExtendedLabel does not display.
            // Only setting the control's TextColor if is not Color.Default will prevent this issue.
            if (view.TextColor != Color.Default)
            {
                control.TextColor = view.TextColor.ToUIColor();
            }

            control.AttributedText = new NSMutableAttributedString(control.Text,
                                                                   control.Font,
                                                                   underlineStyle: underline,
                                                                   strikethroughStyle: strikethrough,
                                                                   shadow: dropShadow);;
        }
Beispiel #31
0
        /// <summary>
        /// Updates the UI.
        /// </summary>
        /// <param name="view">
        /// The view.
        /// </param>
        private void UpdateUi(CustomLabel view)
        {
            // Prefer font set through Font property.
            if (view.Font == Font.Default)
            {
                if (view.FontSize > 0)
                {
                    this.Control.Font = UIFont.FromName(this.Control.Font.Name, (float)view.FontSize);
                }

                if (!string.IsNullOrEmpty(view.FontName))
                {
                    var fontName = Path.GetFileNameWithoutExtension(view.FontName);

                    var font = UIFont.FromName(fontName, this.Control.Font.PointSize);

                    if (font != null)
                    {
                        this.Control.Font = font;
                    }
                }
            }
            else
            {
                try
                {
                    var font = UIFont.FromName(FontHelper.GetFontName(view?.FontName), (float)view?.FontSize);
                    if (font != null)
                    {
                        this.Control.Font = font;
                    }
                }
                catch (Exception ex)
                {
                    var x = ex;
                }
            }

            //Do not create attributed string if it is not necesarry
            //if (!view.IsUnderline && !view.IsStrikeThrough && !view.IsDropShadow)
            //{
            //    return;
            //}

            var underline     = view.IsUnderline ? NSUnderlineStyle.Single : NSUnderlineStyle.None;
            var strikethrough = view.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None;

            NSShadow dropShadow = null;

            if (view.IsDropShadow)
            {
                dropShadow = new NSShadow
                {
                    ShadowColor      = view.DropShadowColor.ToUIColor(),
                    ShadowBlurRadius = 1.4f,
                    ShadowOffset     = new CoreGraphics.CGSize(new CoreGraphics.CGPoint(0.3f, 0.8f))
                };
            }

            // For some reason, if we try and convert Color.Default to a UIColor, the resulting color is
            // either white or transparent. The net result is the ExtendedLabel does not display.
            // Only setting the control's TextColor if is not Color.Default will prevent this issue.
            if (view.TextColor != Color.Default)
            {
                this.Control.TextColor = view.TextColor.ToUIColor();
            }

            this.Control.AttributedText = new NSMutableAttributedString(view.Text,
                                                                        this.Control.Font,
                                                                        underlineStyle: underline,
                                                                        strikethroughStyle: strikethrough,
                                                                        shadow: dropShadow);
        }
Beispiel #32
0
        public override void Draw(CGRect rect)
        {
            //// General Declarations
            var context = UIGraphics.GetCurrentContext();

            //// Color Declarations
            var fillColor    = UIColor.FromRGBA(1.000f, 1.000f, 1.000f, 1.000f);
            var strokeColor3 = UIColor.FromRGBA(0.716f, 0.716f, 0.716f, 1.000f);
            var shadowTint2  = UIColor.FromRGBA(0.000f, 0.000f, 0.000f, 1.000f);
            var strokeColor4 = UIColor.FromRGBA(0.807f, 0.807f, 0.807f, 1.000f);
            var fillColor4   = UIColor.FromRGBA(0.969f, 0.969f, 0.969f, 1.000f);
            var fillColor6   = UIColor.FromRGBA(0.314f, 0.824f, 0.761f, 1.000f);
            var strokeColor5 = UIColor.FromRGBA(0.855f, 0.855f, 0.855f, 1.000f);

            //// Shadow Declarations
            var shadow3 = new NSShadow();

            shadow3.ShadowColor      = shadowTint2.ColorWithAlpha(shadowTint2.CGColor.Alpha * 0.13f);
            shadow3.ShadowOffset     = new CGSize(1450.1f, 2.1f);
            shadow3.ShadowBlurRadius = 4.0f;

            //// Group 5
            {
                context.SaveState();
                context.BeginTransparencyLayer();

                //// Clip Clip 5
                var clip5Path = UIBezierPath.FromRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 248.55f, 686.9f, 265.6f));
                clip5Path.AddClip();


                //// Rectangle 6 Drawing
                var rectangle6Path = UIBezierPath.FromRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 248.55f, 686.9f, 265.6f));
                strokeColor4.SetStroke();
                rectangle6Path.LineWidth = 2.0f;
                rectangle6Path.Stroke();


                context.EndTransparencyLayer();
                context.RestoreState();
            }


            //// Bezier Drawing
            UIBezierPath bezierPath = new UIBezierPath();

            bezierPath.MoveTo(new CGPoint(rect.GetMinX() + 687.41f, rect.GetMinY() + 349.29f));
            bezierPath.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 353.29f));
            bezierPath.LineCapStyle = CGLineCap.Square;

            strokeColor3.SetStroke();
            bezierPath.LineWidth = 1.0f;
            bezierPath.Stroke();


            //// Group
            {
                context.SaveState();
                context.BeginTransparencyLayer();

                //// Clip Clip
                var clipPath = UIBezierPath.FromRect(new CGRect(rect.GetMinX() - 13.0f, rect.GetMinY() - 17.0f, 725.0f, 556.0f));
                clipPath.AddClip();


                //// Bezier 2 Drawing
                UIBezierPath bezier2Path = new UIBezierPath();
                bezier2Path.MoveTo(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 2.0f));
                bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 1444.0f, rect.GetMinY() - 2.0f), new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() - 0.21f), new CGPoint(rect.GetMinX() - 1446.2f, rect.GetMinY() - 2.0f));
                bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 765.08f, rect.GetMinY() - 2.0f));
                bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() - 762.87f, rect.GetMinY() - 2.0f), new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() - 0.21f));
                bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 509.16f));
                bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 765.08f, rect.GetMinY() + 513.16f), new CGPoint(rect.GetMinX() - 761.09f, rect.GetMinY() + 511.37f), new CGPoint(rect.GetMinX() - 762.88f, rect.GetMinY() + 513.16f));
                bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 1444.0f, rect.GetMinY() + 513.16f));
                bezier2Path.AddCurveToPoint(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() - 1446.21f, rect.GetMinY() + 513.16f), new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 511.37f));
                bezier2Path.AddLineTo(new CGPoint(rect.GetMinX() - 1448.0f, rect.GetMinY() + 2.0f));
                bezier2Path.ClosePath();
                bezier2Path.UsesEvenOddFillRule = true;

                context.SaveState();
                context.SetShadow(shadow3.ShadowOffset, shadow3.ShadowBlurRadius, shadow3.ShadowColor.CGColor);
                fillColor.SetFill();
                bezier2Path.Fill();
                context.RestoreState();



                context.EndTransparencyLayer();
                context.RestoreState();
            }


            //// Group 2
            {
                context.SaveState();
                context.BeginTransparencyLayer();

                //// Clip Clip 3
                UIBezierPath clip3Path = new UIBezierPath();
                clip3Path.MoveTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() - 22.5f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 712.41f, rect.GetMinY() - 22.5f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 712.41f, rect.GetMinY() + 533.66f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() + 533.66f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() - 15.49f, rect.GetMinY() - 22.5f));
                clip3Path.ClosePath();
                clip3Path.MoveTo(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 2.0f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() - 1.5f), new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 0.07f), new CGPoint(rect.GetMinX() + 7.07f, rect.GetMinY() - 1.5f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() - 1.5f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() + 689.85f, rect.GetMinY() - 1.5f), new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 0.07f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 509.16f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() + 512.66f), new CGPoint(rect.GetMinX() + 691.41f, rect.GetMinY() + 511.09f), new CGPoint(rect.GetMinX() + 689.85f, rect.GetMinY() + 512.66f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() + 512.66f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() + 7.07f, rect.GetMinY() + 512.66f), new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 511.09f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.51f, rect.GetMinY() + 2.0f));
                clip3Path.ClosePath();
                clip3Path.MoveTo(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 2.0f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 509.16f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 511.65f), new CGPoint(rect.GetMinX() + 6.52f, rect.GetMinY() + 513.66f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() + 513.66f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 509.16f), new CGPoint(rect.GetMinX() + 690.4f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 511.64f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() + 2.0f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 687.92f, rect.GetMinY() - 2.5f), new CGPoint(rect.GetMinX() + 692.41f, rect.GetMinY() - 0.49f), new CGPoint(rect.GetMinX() + 690.4f, rect.GetMinY() - 2.5f));
                clip3Path.AddLineTo(new CGPoint(rect.GetMinX() + 9.0f, rect.GetMinY() - 2.5f));
                clip3Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() + 2.0f), new CGPoint(rect.GetMinX() + 6.52f, rect.GetMinY() - 2.5f), new CGPoint(rect.GetMinX() + 4.51f, rect.GetMinY() - 0.48f));
                clip3Path.ClosePath();
                clip3Path.UsesEvenOddFillRule = true;

                clip3Path.AddClip();


                //// Group 3
                {
                    context.SaveState();
                    context.BeginTransparencyLayer();

                    //// Clip Clip 2
                    var clip2Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 5.0f, rect.GetMinY() - 1.98f, 686.9f, 515.15f), 4.0f);
                    clip2Path.AddClip();


                    //// Rectangle 2 Drawing
                    var rectangle2Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 5.0f, rect.GetMinY() - 1.98f, 686.9f, 515.15f), 4.0f);
                    fillColor.SetFill();
                    rectangle2Path.Fill();


                    context.EndTransparencyLayer();
                    context.RestoreState();
                }


                context.EndTransparencyLayer();
                context.RestoreState();
            }


            //// Group 4
            {
                context.SaveState();
                context.BeginTransparencyLayer();

                //// Clip Clip 4
                var clip4Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 3.02f, 686.9f, 515.15f), 4.0f);
                clip4Path.AddClip();


                //// Rectangle 4 Drawing
                var rectangle4Path = UIBezierPath.FromRoundedRect(new CGRect(rect.GetMinX() + 4.0f, rect.GetMinY() + 3.02f, 686.9f, 515.15f), 4.0f);
                strokeColor4.SetStroke();
                rectangle4Path.LineWidth = 2.0f;
                rectangle4Path.Stroke();


                context.EndTransparencyLayer();
                context.RestoreState();
            }


            //// Bezier 4 Drawing
            UIBezierPath bezier4Path = new UIBezierPath();

            bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.57f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 249.06f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 249.06f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.73f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.56f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 248.57f));
            bezier4Path.ClosePath();
            bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.57f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.56f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.73f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 249.06f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 261.48f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 501.24f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.01f, rect.GetMinY() + 513.66f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 514.16f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.66f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 514.16f), new CGPoint(rect.GetMinX() + 689.51f, rect.GetMinY() + 513.99f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 249.06f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 501.24f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 261.48f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 249.06f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.56f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 248.57f));
            bezier4Path.ClosePath();
            bezier4Path.MoveTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f));
            bezier4Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 514.16f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.99f), new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 514.16f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 513.66f));
            bezier4Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.5f, rect.GetMinY() + 513.66f));
            bezier4Path.ClosePath();
            fillColor4.SetFill();
            bezier4Path.Fill();


            //// Bezier 5 Drawing
            UIBezierPath bezier5Path = new UIBezierPath();

            bezier5Path.MoveTo(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 513.16f));
            bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 513.16f));
            bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 589.34f));
            bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 686.91f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 690.91f, rect.GetMinY() + 591.55f), new CGPoint(rect.GetMinX() + 689.13f, rect.GetMinY() + 593.34f));
            bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 350.63f, rect.GetMinY() + 593.34f));
            bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 342.63f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 348.42f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 344.84f, rect.GetMinY() + 593.34f));
            bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 8.01f, rect.GetMinY() + 593.34f));
            bezier5Path.AddCurveToPoint(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 589.34f), new CGPoint(rect.GetMinX() + 5.8f, rect.GetMinY() + 593.34f), new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 591.55f));
            bezier5Path.AddLineTo(new CGPoint(rect.GetMinX() + 4.01f, rect.GetMinY() + 513.16f));
            bezier5Path.ClosePath();
            bezier5Path.UsesEvenOddFillRule = true;

            fillColor6.SetFill();
            bezier5Path.Fill();


            //// Bezier 6 Drawing
            UIBezierPath bezier6Path = new UIBezierPath();

            bezier6Path.MoveTo(new CGPoint(rect.GetMinX() + 345.0f, rect.GetMinY() + 110.0f));
            bezier6Path.AddLineTo(new CGPoint(rect.GetMinX() + 345.46f, rect.GetMinY() + 4.0f));
            bezier6Path.LineCapStyle = CGLineCap.Square;

            strokeColor5.SetStroke();
            bezier6Path.LineWidth = 2.0f;
            bezier6Path.Stroke();


            //// Bezier 7 Drawing
            UIBezierPath bezier7Path = new UIBezierPath();

            bezier7Path.MoveTo(new CGPoint(rect.GetMinX() + 689.01f, rect.GetMinY() + 399.9f));
            bezier7Path.AddLineTo(new CGPoint(rect.GetMinX() + 5.01f, rect.GetMinY() + 399.9f));
            bezier7Path.LineCapStyle = CGLineCap.Square;

            strokeColor5.SetStroke();
            bezier7Path.LineWidth = 2.0f;
            bezier7Path.Stroke();


            //// Bezier 8 Drawing
            UIBezierPath bezier8Path = new UIBezierPath();

            bezier8Path.MoveTo(new CGPoint(rect.GetMinX() + 688.91f, rect.GetMinY() + 110.25f));
            bezier8Path.AddLineTo(new CGPoint(rect.GetMinX() + 6.01f, rect.GetMinY() + 110.25f));
            bezier8Path.LineCapStyle = CGLineCap.Square;

            strokeColor5.SetStroke();
            bezier8Path.LineWidth = 2.0f;
            bezier8Path.Stroke();
        }