
com.bugvm.apple.coretext.CTFrameAttributes 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.coretext;
/**/
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.foundation.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coremedia.*;
import com.bugvm.apple.uikit.*;
/* */
/**/
/* */
/**/@Library("CoreText")/* */
@Marshaler(/**/CTFrameAttributes/* */.Marshaler.class)
/**/public/* */ class /**/CTFrameAttributes/* */
extends /**/CFDictionaryWrapper/* */
/**//* */ {
/**/
public static class Marshaler {
@MarshalsPointer
public static CTFrameAttributes toObject(Class cls, long handle, long flags) {
CFDictionary o = (CFDictionary) CFType.Marshaler.toObject(CFDictionary.class, handle, flags);
if (o == null) {
return null;
}
return new CTFrameAttributes(o);
}
@MarshalsPointer
public static long toNative(CTFrameAttributes o, long flags) {
if (o == null) {
return 0L;
}
return CFType.Marshaler.toNative(o.data, flags);
}
}
public static class AsListMarshaler {
@MarshalsPointer
public static List toObject(Class extends CFType> cls, long handle, long flags) {
CFArray o = (CFArray) CFType.Marshaler.toObject(CFArray.class, handle, flags);
if (o == null) {
return null;
}
List list = new ArrayList<>();
for (int i = 0; i < o.size(); i++) {
list.add(new CTFrameAttributes(o.get(i, CFDictionary.class)));
}
return list;
}
@MarshalsPointer
public static long toNative(List l, long flags) {
if (l == null) {
return 0L;
}
CFArray array = CFMutableArray.create();
for (CTFrameAttributes i : l) {
array.add(i.getDictionary());
}
return CFType.Marshaler.toNative(array, flags);
}
}
/* */
/**/
CTFrameAttributes(CFDictionary data) {
super(data);
}
public CTFrameAttributes() {}
/* */
/**/
public boolean has(CFString key) {
return data.containsKey(key);
}
public T get(CFString key, Class type) {
if (has(key)) {
return data.get(key, type);
}
return null;
}
public CTFrameAttributes set(CFString key, NativeObject value) {
data.put(key, value);
return this;
}
/**
* @since Available in iOS 3.2 and later.
*/
public CTFrameProgression getProgression() {
if (has(Keys.Progression())) {
CFNumber val = get(Keys.Progression(), CFNumber.class);
return CTFrameProgression.valueOf(val.longValue());
}
return null;
}
/**
* @since Available in iOS 3.2 and later.
*/
public CTFrameAttributes setProgression(CTFrameProgression progression) {
set(Keys.Progression(), CFNumber.valueOf(progression.value()));
return this;
}
/**
* @since Available in iOS 4.2 and later.
*/
public CTFramePathFillRule getPathFillRule() {
if (has(Keys.PathFillRule())) {
CFNumber val = get(Keys.PathFillRule(), CFNumber.class);
return CTFramePathFillRule.valueOf(val.longValue());
}
return null;
}
/**
* @since Available in iOS 4.2 and later.
*/
public CTFrameAttributes setPathFillRule(CTFramePathFillRule pathFillRule) {
set(Keys.PathFillRule(), CFNumber.valueOf(pathFillRule.value()));
return this;
}
/**
* @since Available in iOS 4.2 and later.
*/
public double getPathWidth() {
if (has(Keys.PathWidth())) {
CFNumber val = get(Keys.PathWidth(), CFNumber.class);
return val.doubleValue();
}
return 0;
}
/**
* @since Available in iOS 4.2 and later.
*/
public CTFrameAttributes setPathWidth(double pathWidth) {
set(Keys.PathWidth(), CFNumber.valueOf(pathWidth));
return this;
}
/**
* @since Available in iOS 4.3 and later.
*/
public List getClippingPaths() {
if (has(Keys.ClippingPaths())) {
CFArray val = get(Keys.ClippingPaths(), CFArray.class);
List list = new ArrayList<>();
CFDictionary[] array = val.toArray(CFDictionary.class);
for (CFDictionary d : array) {
list.add(new CTFrameClippingPath(d));
}
return list;
}
return null;
}
/**
* @since Available in iOS 4.3 and later.
*/
public CTFrameAttributes setClippingPaths(List clippingPaths) {
CFArray val = CFMutableArray.create();
for (CTFrameClippingPath e : clippingPaths) {
val.add(e.getDictionary());
}
set(Keys.ClippingPaths(), val);
return this;
}
/* */
/**/
@Library("CoreText")
public static class Keys {
static { Bro.bind(Keys.class); }
/**
* @since Available in iOS 3.2 and later.
*/
@GlobalValue(symbol="kCTFrameProgressionAttributeName", optional=true)
public static native CFString Progression();
/**
* @since Available in iOS 4.2 and later.
*/
@GlobalValue(symbol="kCTFramePathFillRuleAttributeName", optional=true)
public static native CFString PathFillRule();
/**
* @since Available in iOS 4.2 and later.
*/
@GlobalValue(symbol="kCTFramePathWidthAttributeName", optional=true)
public static native CFString PathWidth();
/**
* @since Available in iOS 4.3 and later.
*/
@GlobalValue(symbol="kCTFrameClippingPathsAttributeName", optional=true)
public static native CFString ClippingPaths();
}
/* */
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy