io.qt.gui.QTextItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qtjambi Show documentation
Show all versions of qtjambi Show documentation
QtJambi base module containing QtCore, QtGui and QtWidgets.
package io.qt.gui;
import io.qt.*;
/**
* All the information required to draw text in a custom paint engine
* Java wrapper for Qt class QTextItem
*/
public class QTextItem extends QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QTextItem::RenderFlag
*
* @see RenderFlags
*/
public enum RenderFlag implements QtFlagEnumerator {
/**
* Representing QTextItem:: RightToLeft
*/
RightToLeft(1),
/**
* Representing QTextItem:: Overline
*/
Overline(16),
/**
* Representing QTextItem:: Underline
*/
Underline(32),
/**
* Representing QTextItem:: StrikeOut
*/
StrikeOut(64),
/**
* Representing QTextItem:: Dummy
*/
Dummy(-1);
static {
QtJambi_LibraryUtilities.initialize();
}
private RenderFlag(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
public @NonNull RenderFlags asFlags() {
return new RenderFlags(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public @NonNull RenderFlags combined(@NonNull RenderFlag e) {
return asFlags().setFlag(e, true);
}
/**
* Excludes other enum entry from a flag of this entry.
* @param e enum entry
* @return new flag
*/
public @NonNull RenderFlags cleared(@NonNull RenderFlag e) {
return asFlags().setFlag(e, false);
}
/**
* Creates a new {@link RenderFlags} from the entries.
* @param values entries
* @return new flag
*/
public static @NonNull RenderFlags flags(@Nullable RenderFlag @NonNull... values) {
return new RenderFlags(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull RenderFlag resolve(int value) {
switch (value) {
case 1: return RightToLeft;
case 16: return Overline;
case 32: return Underline;
case 64: return StrikeOut;
case -1: return Dummy;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* {@link QFlags} type for enum {@link RenderFlag}
*/
public static final class RenderFlags extends QFlags implements Comparable {
private static final long serialVersionUID = 0xc5275907bfed457bL;
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Creates a new RenderFlags where the flags in args
are set.
* @param args enum entries
*/
public RenderFlags(@Nullable RenderFlag @NonNull... args){
super(args);
}
/**
* Creates a new RenderFlags with given value
.
* @param value
*/
public RenderFlags(int value) {
super(value);
}
/**
* Combines this flags with enum entry.
* @param e enum entry
* @return new RenderFlags
*/
@Override
public final @NonNull RenderFlags combined(@StrictNonNull RenderFlag e){
return new RenderFlags(value() | e.value());
}
/**
* Sets the flag e
* @param e enum entry
* @return this
*/
public final @NonNull RenderFlags setFlag(@Nullable RenderFlag e){
return setFlag(e, true);
}
/**
* Sets or clears the flag flag
* @param e enum entry
* @param on set (true) or clear (false)
* @return this
*/
public final @NonNull RenderFlags setFlag(@Nullable RenderFlag e, boolean on){
if (on) {
setValue(value() | e.value());
}else {
setValue(value() & ~e.value());
}
return this;
}
/**
* Returns an array of flag objects represented by this RenderFlags.
* @return array of enum entries
*/
@Override
public final @NonNull RenderFlag @NonNull[] flags(){
return super.flags(RenderFlag.values());
}
/**
* {@inheritDoc}
*/
@Override
public final @NonNull RenderFlags clone(){
return new RenderFlags(value());
}
/**
* {@inheritDoc}
*/
@Override
public final int compareTo(@StrictNonNull RenderFlags other){
return Integer.compare(value(), other.value());
}
}
/**
* See QTextItem:: QTextItem()
*/
public QTextItem(){
super((QPrivateConstructor)null);
initialize_native(this);
}
private native static void initialize_native(QTextItem instance);
/**
*
*/
@QtUninvokable
public final double ascent(){
return ascent_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native double ascent_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final double descent(){
return descent_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native double descent_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final io.qt.gui.@NonNull QFont font(){
return font_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.gui.QFont font_native_constfct(long __this__nativeId);
/**
* See QTextItem:: renderFlags()const
*/
@QtUninvokable
public final io.qt.gui.QTextItem.@NonNull RenderFlags renderFlags(){
return new io.qt.gui.QTextItem.RenderFlags(renderFlags_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@QtUninvokable
private native int renderFlags_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final java.lang.@NonNull String text(){
return text_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String text_native_constfct(long __this__nativeId);
/**
*
*/
@QtUninvokable
public final double width(){
return width_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native double width_native_constfct(long __this__nativeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QTextItem(QPrivateConstructor p) { super(p); }
}