summaryrefslogtreecommitdiff
path: root/CocoaSharp/UIKit/Additions/NSAttributedString.cs
blob: b98471300c2e46525a6820055ad01929142af7f8 (plain)
1
using ObjectiveC;
using System;
using SharpSwift.Attributes;
using System.Collections.Generic;
using Foundation;
using CoreGraphics;

namespace UIKit
{
    /// <summary>
    /// The UIKit framework adds methods to NSAttributedString to support the drawing of styled strings and to compute the size and metrics of a string prior to drawing. None of these methods affects the contents of the object itself, only how it is drawn on screen.
    /// </summary>
    /// <see cref="https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/NSAttributedString_UIKit_Additions/index.html#//apple_ref/doc/uid/TP40011688"/>
    [iOSVersion(6)]
    [Export("")]
    public class NSAttributedString//:
    {
        public NSAttributedString() { }
        /// <summary>
        /// Creates an attributed string with an attachment.
        /// </summary>
        /// <param name="attachment">The attachment.</param>
        [iOSVersion(7)]
        public NSAttributedString([Unwrapped] NSTextAttachment attachment) { }
        
        /// <summary>
        /// Draws the attributed string starting at the specified point in the current graphics context.
        /// </summary>
        /// <param name="point">The point in the current graphics context where you want to start drawing the string. The coordinate system of the graphics context is usually defined by the view in which you are drawing.</param>
        [iOSVersion(6)]
        [Export("drawAtPoint")]
        public virtual void DrawAtPoint(CGPoint point) {  }
        
        /// <summary>
        /// Draws the attributed string inside the specified bounding rectangle in the current graphics context.
        /// </summary>
        /// <param name="rect">The bounding rectangle in which to draw the string.</param>
        [iOSVersion(6)]
        [Export("drawInRect")]
        public virtual void DrawInRect(CGRect rect) {  }
        
        /// <summary>
        /// Draws the attributed string in the specified bounding rectangle using the provided options.
        /// </summary>
        /// <param name="rect">The bounding rectangle in which to draw the string.</param>
        /// <param name="options">Additional drawing options to apply to the string during rendering. For a list of possible values, see “NSStringDrawingOptions”.</param>
        /// <param name="context">A context object with information about how to adjust the font tracking and scaling information. On return, the specified object contains information about the actual values used to render the string. This parameter may be nil.</param>
        [iOSVersion(6)]
        [Export("drawWithRect")]
        public virtual void DrawWithRect(CGRect rect, NSStringDrawingOptions options, [Optional] NSStringDrawingContext context) {  }
        
        /// <summary>
        /// Returns the size required to draw the string.
        /// </summary>
        [iOSVersion(6)]
        [Export("size")]
        public virtual CGSize Size() { return default(CGSize); }
        
        /// <summary>
        /// Returns the bounding rectangle required to draw the string.
        /// </summary>
        /// <param name="size">The width and height constraints to apply when computing the string’s bounding rectangle.</param>
        /// <param name="options">Additional drawing options to apply to the string during rendering. For a list of possible values, see “NSStringDrawingOptions”.</param>
        /// <param name="context">A context object with information about how to adjust the font tracking and scaling information. On return, the specified object contains information about the actual values used to render the string. This parameter may be nil.</param>
        [iOSVersion(6)]
        [Export("boundingRectWithSize")]
        public virtual CGRect BoundingRectWithSize(CGSize size, NSStringDrawingOptions options, [Optional] NSStringDrawingContext context) { return default(CGRect); }
        
        /// <summary>
        /// Returns an data object that contains a text stream corresponding to the characters and attributes within the given range.
        /// </summary>
        /// <param name="range">The range.</param>
        /// <param name="documentAttributes">A required dictionary specifying the document attributes. The dictionary contains values from Document Types and must at least contain NSDocumentTypeDocumentAttribute.</param>
        /// <param name="error">An in-out variable containing an encountered error, if any.</param>
        [iOSVersion(7)]
        [Export("dataFromRange")]
        [return:Optional]
        public virtual NSData DataFromRange(NSRange range, Dictionary<NSObject, AnyObject> documentAttributes, NSErrorPointer error) { return default(NSData); }
        
        /// <summary>
        /// Returns an NSFileWrapper object that contains a text stream corresponding to the characters and attributes within the given range.
        /// </summary>
        /// <param name="range">The range.</param>
        /// <param name="documentAttributes">A required dictionary specifying the document attributes. The dictionary contains values from Document Types and must at least contain NSDocumentTypeDocumentAttribute.</param>
        /// <param name="error">An in-out variable containing an encountered error, if any.</param>
        [iOSVersion(7)]
        [Export("fileWrapperFromRange")]
        [return:Optional]
        public virtual NSFileWrapper FileWrapperFromRange(NSRange range, Dictionary<NSObject, AnyObject> documentAttributes, NSErrorPointer error) { return default(NSFileWrapper); }
    }
    /// <summary>
    /// Options for customizing the way strings are drawn.
    /// </summary>
    public enum NSStringDrawingOptions
    {
        /// <summary>
        /// Truncate and add an ellipsis character to the last visible line if the text does not fit into the specified bounds. This option is ignored if the NSStringDrawingUsesLineFragmentOrigin option is not also specified.
        /// </summary>
        [iOSVersion(6)]
        TruncatesLastVisibleLine,
        /// <summary>
        /// The origin specified when drawing the string is the line fragment origin and not the baseline origin.
        /// </summary>
        [iOSVersion(6)]
        UsesLineFragmentOrigin,
        /// <summary>
        /// Use the font leading information to calculate line heights.
        /// </summary>
        [iOSVersion(6)]
        UsesFontLeading,
        /// <summary>
        /// Use the image glyph bounds (instead of the typographic bounds) when computing layout.
        /// </summary>
        [iOSVersion(6)]
        UsesDeviceMetrics,
    }
    /// <summary>
    /// Constants for specifying both the NSUnderlineStyleAttributeName and NSStrikethroughStyleAttributeName attributes of an attributed string.
    /// </summary>
    public enum NSUnderlineStyle
    {
        /// <summary>
        /// Do not draw a line.
        /// </summary>
        [iOSVersion(6)]
        StyleNone,
        /// <summary>
        /// Draw a single line.
        /// </summary>
        [iOSVersion(6)]
        StyleSingle,
        /// <summary>
        /// Draw a thick line.
        /// </summary>
        [iOSVersion(7)]
        StyleThick,
        /// <summary>
        /// Draw a double line.
        /// </summary>
        [iOSVersion(7)]
        StyleDouble,
        /// <summary>
        /// Draw a line of dots.
        /// </summary>
        [iOSVersion(7)]
        PatternDot,
        /// <summary>
        /// Draw a line of dashes.
        /// </summary>
        [iOSVersion(7)]
        PatternDash,
        /// <summary>
        /// Draw a line of alternating dashes and dots.
        /// </summary>
        [iOSVersion(7)]
        PatternDashDot,
        /// <summary>
        /// Draw a line of alternating dashes and two dots.
        /// </summary>
        [iOSVersion(7)]
        PatternDashDotDot,
        /// <summary>
        /// Draw the line only underneath or through words, not whitespace.
        /// </summary>
        [iOSVersion(7)]
        ByWord,
    }
    /// <summary>
    /// Options for specifying text writing direction used with NSWritingDirectionAttributeName.
    /// </summary>
    public enum NSTextWritingDirection
    {
        /// <summary>
        /// Text is embedded in text with another writing direction. For example, an English quotation in the middle of an Arabic sentence could be marked as being embedded left-to-right text.
        /// </summary>
        [iOSVersion(7)]
        Embedding,
        /// <summary>
        /// Enables character types with inherent directionality to be overridden when required for special cases, such as for part numbers made of mixed English, digits, and Hebrew letters to be written from right to left.
        /// </summary>
        [iOSVersion(7)]
        Override,
    }
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback