コード例 #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
                                                                                                        ))
 {
 }
コード例 #2
0
        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);
        }
コード例 #3
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
			))
        {
        }