io.qt.widgets.QTreeWidgetItemIterator Maven / Gradle / Ivy
package io.qt.widgets;
/**
* Way to iterate over the items in a QTreeWidget instance
* Java wrapper for Qt class QTreeWidgetItemIterator
*/
public class QTreeWidgetItemIterator extends io.qt.QtObject
implements Iterable, java.util.Iterator
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Java wrapper for Qt enum QTreeWidgetItemIterator::IteratorFlag
*
* @see IteratorFlags
*/
public enum IteratorFlag implements io.qt.QtFlagEnumerator {
All(0),
Hidden(1),
NotHidden(2),
Selected(4),
Unselected(8),
Selectable(16),
NotSelectable(32),
DragEnabled(64),
DragDisabled(128),
DropEnabled(256),
DropDisabled(512),
HasChildren(1024),
NoChildren(2048),
Checked(4096),
NotChecked(8192),
Enabled(16384),
Disabled(32768),
Editable(65536),
NotEditable(131072),
UserFlag(16777216);
private IteratorFlag(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
public IteratorFlags asFlags() {
return new IteratorFlags(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public IteratorFlags combined(IteratorFlag e) {
return new IteratorFlags(this, e);
}
/**
* Creates a new {@link IteratorFlags} from the entries.
* @param values entries
* @return new flag
*/
public static IteratorFlags flags(IteratorFlag ... values) {
return new IteratorFlags(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static IteratorFlag resolve(int value) {
switch (value) {
case 0: return All;
case 1: return Hidden;
case 2: return NotHidden;
case 4: return Selected;
case 8: return Unselected;
case 16: return Selectable;
case 32: return NotSelectable;
case 64: return DragEnabled;
case 128: return DragDisabled;
case 256: return DropEnabled;
case 512: return DropDisabled;
case 1024: return HasChildren;
case 2048: return NoChildren;
case 4096: return Checked;
case 8192: return NotChecked;
case 16384: return Enabled;
case 32768: return Disabled;
case 65536: return Editable;
case 131072: return NotEditable;
case 16777216: return UserFlag;
default: throw new io.qt.QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* QFlags type for enum {@link IteratorFlag}
*/
public static final class IteratorFlags extends io.qt.QFlags implements Comparable {
private static final long serialVersionUID = 0x865c6d2218f00d2fL;
/**
* Creates a new IteratorFlags where the flags in args
are set.
* @param args enum entries
*/
public IteratorFlags(IteratorFlag ... args){
super(args);
}
/**
* Creates a new IteratorFlags with given value
.
* @param value
*/
public IteratorFlags(int value) {
super(value);
}
/**
* Combines this flags with enum entry.
* @param e enum entry
* @return new IteratorFlags
*/
@Override
public final IteratorFlags combined(IteratorFlag e){
return new IteratorFlags(value() | e.value());
}
/**
* Sets the flag e
* @param e enum entry
* @return this
*/
public final IteratorFlags setFlag(IteratorFlag e){
super.setFlag(e);
return this;
}
/**
* Sets or clears the flag flag
* @param e enum entry
* @param on set (true) or clear (false)
* @return this
*/
public final IteratorFlags setFlag(IteratorFlag e, boolean on){
super.setFlag(e, on);
return this;
}
/**
* Returns an array of flag objects represented by this IteratorFlags.
* @return array of enum entries
*/
@Override
public final IteratorFlag[] flags(){
return super.flags(IteratorFlag.values());
}
/**
* {@inheritDoc}
*/
@Override
public final IteratorFlags clone(){
return new IteratorFlags(value());
}
/**
* {@inheritDoc}
*/
@Override
public final int compareTo(IteratorFlags other){
return Integer.compare(value(), other.value());
}
}
/**
* Overloaded constructor for {@link #QTreeWidgetItemIterator(io.qt.widgets.QTreeWidget, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags)}.
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidget widget, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlag ... flags){
this(widget, new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(flags));
}
/**
* Overloaded constructor for {@link #QTreeWidgetItemIterator(io.qt.widgets.QTreeWidget, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags)}
* with flags = new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(0)
.
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidget widget) {
this(widget, new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(0));
}
/**
* See QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget*,IteratorFlags)
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidget widget, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags flags){
super((QPrivateConstructor)null);
java.util.Objects.requireNonNull(widget, "Argument 'widget': null not expected.");
initialize_native(this, widget, flags);
QtJambi_LibraryUtilities.internal.registerDependentObject(this, widget);
}
private native static void initialize_native(QTreeWidgetItemIterator instance, io.qt.widgets.QTreeWidget widget, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags flags);
/**
* Overloaded constructor for {@link #QTreeWidgetItemIterator(io.qt.widgets.QTreeWidgetItem, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags)}.
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidgetItem item, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlag ... flags){
this(item, new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(flags));
}
/**
* Overloaded constructor for {@link #QTreeWidgetItemIterator(io.qt.widgets.QTreeWidgetItem, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags)}
* with flags = new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(0)
.
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidgetItem item) {
this(item, new io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags(0));
}
/**
* See QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem*,IteratorFlags)
*/
public QTreeWidgetItemIterator(io.qt.widgets.QTreeWidgetItem item, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags flags){
super((QPrivateConstructor)null);
if (item == null)
throw new NullPointerException("Argument 'item': null not expected.");
else if(item.treeWidget()==null)
throw new IllegalArgumentException("Item does not belong to a tree widget.");
initialize_native(this, item, flags);
QtJambi_LibraryUtilities.internal.registerDependentObject(this, item.treeWidget());
}
private native static void initialize_native(QTreeWidgetItemIterator instance, io.qt.widgets.QTreeWidgetItem item, io.qt.widgets.QTreeWidgetItemIterator.IteratorFlags flags);
/**
* See QTreeWidgetItemIterator::operator*()const
*/
@io.qt.QtUninvokable
public final boolean hasNext(){
return hasNext_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native boolean hasNext_native_constfct(long __this__nativeId);
/**
* See QTreeWidgetItemIterator::operator++()
*/
@io.qt.QtUninvokable
public final io.qt.widgets.QTreeWidgetItem next(){
return next_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@io.qt.QtUninvokable
private native io.qt.widgets.QTreeWidgetItem next_native(long __this__nativeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
*/
@io.qt.NativeAccess
protected QTreeWidgetItemIterator(QPrivateConstructor p) { super(p); }
// TEMPLATE - core.self_iterator - START
@Override
@io.qt.QtUninvokable
public final java.util.Iterator iterator() {
return this;
}
// TEMPLATE - core.self_iterator - END
}