All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.foundation.NSMutableAttributedString Maven / Gradle / Ivy

/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bugvm.apple.foundation;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.uikit.*;
import com.bugvm.apple.coretext.*;
import com.bugvm.apple.coreanimation.*;
import com.bugvm.apple.coredata.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.security.*;
import com.bugvm.apple.dispatch.*;
/**/

/**/
/**
 * @since Available in iOS 3.2 and later.
 */
/**/
/**/@Library("Foundation") @NativeClass @WeaklyLinked/**/
/**/public/**/ class /**/NSMutableAttributedString/**/ 
    extends /**/NSAttributedString/**/ 
    /**//**/ {

    /**/public static class NSMutableAttributedStringPtr extends Ptr {}/**/
    /**/static { ObjCRuntime.bind(NSMutableAttributedString.class); }/**/
    /**//**/
    /**/
    public NSMutableAttributedString() {}
    protected NSMutableAttributedString(SkipInit skipInit) { super(skipInit); }
    /**/
    
    public NSMutableAttributedString(NSAttributedString attrStr) {
        super(attrStr);
    }
    public NSMutableAttributedString(String str, NSAttributedStringAttributes attrs) {
        super(str, attrs);
    }
    public NSMutableAttributedString(String str, CMTextMarkupAttributes attrs) {
        super(str, attrs);
    }
    public NSMutableAttributedString(String str, CTAttributedStringAttributes attrs) {
        super(str, attrs);
    }
    public NSMutableAttributedString(String str) {
        super(str);
    }    
    
    /**/
    @Property(selector = "mutableString")
    public native NSMutableString getMutableString();
    /**/
    /**//**/
    public void addAttribute(String name, NSObject value, @ByVal NSRange range) {
        if (name == null) {
            throw new NullPointerException("name");
        }
        addAttribute(new NSString(name), value, range);
    }
    public void addAttribute(NSAttributedStringAttribute attribute, NSObject value, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        addAttribute(attribute.value(), value, range);
    }
    public void addAttribute(CMTextMarkupAttribute attribute, NSObject value, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        addAttribute(attribute.value().as(NSString.class), value, range);
    }
    public void addAttribute(CTAttributedStringAttribute attribute, NSObject value, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        addAttribute(attribute.value().as(NSString.class), value, range);
    }
    
    public void addAttributes(NSAttributedStringAttributes attrs, @ByVal NSRange range) {
        if (attrs == null) {
            throw new NullPointerException("attrs");
        }
        addAttributes(attrs.getDictionary(), range);
    }
    public void addAttributes(CMTextMarkupAttributes attrs, @ByVal NSRange range) {
        if (attrs == null) {
            throw new NullPointerException("attrs");
        }
        addAttributes(attrs.getDictionary().as(NSDictionary.class), range);
    }
    public void addAttributes(CTAttributedStringAttributes attrs, @ByVal NSRange range) {
        if (attrs == null) {
            throw new NullPointerException("attrs");
        }
        addAttributes(attrs.getDictionary().as(NSDictionary.class), range);
    }
    
    public void removeAttribute(String name, @ByVal NSRange range) {
        if (name == null) {
            throw new NullPointerException("name");
        }
        removeAttribute(new NSString(name), range);
    }
    public void removeAttribute(NSAttributedStringAttribute attribute, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        removeAttribute(attribute.value(), range);
    }
    public void removeAttribute(CMTextMarkupAttribute attribute, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        removeAttribute(attribute.value().as(NSString.class), range);
    }
    public void removeAttribute(CTAttributedStringAttribute attribute, @ByVal NSRange range) {
        if (attribute == null) {
            throw new NullPointerException("attribute");
        }
        removeAttribute(attribute.value().as(NSString.class), range);
    }
    
    /* UIKit extensions */
    /**
     * 
     * @param url
     * @param opts
     * @return
     * @since Available in iOS 9.0 and later.
     * @throws NSErrorException
     */
    @WeaklyLinked
    public boolean read(NSURL url, NSAttributedStringDocumentAttributes opts) throws NSErrorException {
        return NSMutableAttributedStringExtensions.read(this, url, opts);
    }
    /**
     * 
     * @param data
     * @param opts
     * @return
     * @since Available in iOS 7.0 and later.
     * @throws NSErrorException
     */
    @WeaklyLinked
    public boolean read(NSData data, NSAttributedStringDocumentAttributes opts) throws NSErrorException {
        return NSMutableAttributedStringExtensions.read(this, data, opts);
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    @WeaklyLinked
    public void fixAttributes(NSRange range) {
        NSMutableAttributedStringExtensions.fixAttributesInRange(this, range);
    }
    /**/
    @Method(selector = "replaceCharactersInRange:withString:")
    public native void replace(@ByVal NSRange range, String str);
    @Method(selector = "setAttributes:range:")
    public native void setAttributes(NSDictionary attrs, @ByVal NSRange range);
    @Method(selector = "addAttribute:value:range:")
    public native void addAttribute(NSString name, NSObject value, @ByVal NSRange range);
    @Method(selector = "addAttributes:range:")
    public native void addAttributes(NSDictionary attrs, @ByVal NSRange range);
    @Method(selector = "removeAttribute:range:")
    public native void removeAttribute(NSString name, @ByVal NSRange range);
    @Method(selector = "replaceCharactersInRange:withAttributedString:")
    public native void replace(@ByVal NSRange range, NSAttributedString attrString);
    @Method(selector = "insertAttributedString:atIndex:")
    public native void insert(NSAttributedString attrString, @MachineSizedUInt long loc);
    @Method(selector = "appendAttributedString:")
    public native void append(NSAttributedString attrString);
    @Method(selector = "deleteCharactersInRange:")
    public native void delete(@ByVal NSRange range);
    @Method(selector = "setAttributedString:")
    public native void setAttributedString(NSAttributedString attrString);
    @Method(selector = "beginEditing")
    public native void beginEditing();
    @Method(selector = "endEditing")
    public native void endEditing();
    /**/
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy