io.qt.widgets.QStyleOptionButton Maven / Gradle / Ivy
Show all versions of qtjambi Show documentation
package io.qt.widgets;
import io.qt.*;
/**
* Used to describe the parameters for drawing buttons
* Java wrapper for Qt class QStyleOptionButton
*/
public class QStyleOptionButton extends io.qt.widgets.QStyleOption
implements java.lang.Cloneable
{
/**
* Java wrapper for Qt enum QStyleOptionButton::ButtonFeature
*
* @see ButtonFeatures
*/
public enum ButtonFeature implements QtFlagEnumerator {
/**
* Representing QStyleOptionButton:: None
*/
None(0),
/**
* Representing QStyleOptionButton:: Flat
*/
Flat(1),
/**
* Representing QStyleOptionButton:: HasMenu
*/
HasMenu(2),
/**
* Representing QStyleOptionButton:: DefaultButton
*/
DefaultButton(4),
/**
* Representing QStyleOptionButton:: AutoDefaultButton
*/
AutoDefaultButton(8),
/**
* Representing QStyleOptionButton:: CommandLinkButton
*/
CommandLinkButton(16);
static {
QtJambi_LibraryUtilities.initialize();
}
private ButtonFeature(int value) {
this.value = value;
}
/**
* {@inheritDoc}
*/
@Override
public int value() {
return value;
}
/**
* Create a QFlags of the enum entry.
* @return QFlags
*/
@Override
public @NonNull ButtonFeatures asFlags() {
return new ButtonFeatures(value);
}
/**
* Combines this entry with other enum entry.
* @param e enum entry
* @return new flag
*/
public @NonNull ButtonFeatures combined(@NonNull ButtonFeature 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 ButtonFeatures cleared(@NonNull ButtonFeature e) {
return asFlags().setFlag(e, false);
}
/**
* Creates a new {@link ButtonFeatures} from the entries.
* @param values entries
* @return new flag
*/
public static @NonNull ButtonFeatures flags(@Nullable ButtonFeature @NonNull... values) {
return new ButtonFeatures(values);
}
/**
* Returns the corresponding enum entry for the given value.
* @param value
* @return enum entry
*/
public static @NonNull ButtonFeature resolve(int value) {
switch (value) {
case 0: return None;
case 1: return Flat;
case 2: return HasMenu;
case 4: return DefaultButton;
case 8: return AutoDefaultButton;
case 16: return CommandLinkButton;
default: throw new QNoSuchEnumValueException(value);
}
}
private final int value;
}
/**
* {@link QFlags} type for enum {@link ButtonFeature}
*/
public static final class ButtonFeatures extends QFlags implements Comparable {
private static final long serialVersionUID = 0x164b09117e9f3058L;
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* Creates a new ButtonFeatures where the flags in args
are set.
* @param args enum entries
*/
public ButtonFeatures(@Nullable ButtonFeature @NonNull... args){
super(args);
}
/**
* Creates a new ButtonFeatures with given value
.
* @param value
*/
public ButtonFeatures(int value) {
super(value);
}
/**
* Combines this flags with enum entry.
* @param e enum entry
* @return new ButtonFeatures
*/
@Override
public final @NonNull ButtonFeatures combined(@StrictNonNull ButtonFeature e){
return new ButtonFeatures(value() | e.value());
}
/**
* Sets the flag e
* @param e enum entry
* @return this
*/
@Override
public final @NonNull ButtonFeatures setFlag(@Nullable ButtonFeature e){
return setFlag(e, true);
}
/**
* Sets or clears the flag flag
* @param e enum entry
* @param on set (true) or clear (false)
* @return this
*/
@Override
public final @NonNull ButtonFeatures setFlag(@Nullable ButtonFeature 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 ButtonFeatures.
* @return array of enum entries
*/
@Override
public final @NonNull ButtonFeature @NonNull[] flags(){
return super.flags(ButtonFeature.values());
}
/**
* {@inheritDoc}
*/
@Override
public final @NonNull ButtonFeatures clone(){
return new ButtonFeatures(value());
}
/**
* {@inheritDoc}
*/
@Override
public final int compareTo(@StrictNonNull ButtonFeatures other){
return Integer.compare(value(), other.value());
}
}
/**
* See QStyleOptionButton:: QStyleOptionButton()
*/
public QStyleOptionButton(){
super((QPrivateConstructor)null);
initialize_native(this);
}
private native static void initialize_native(QStyleOptionButton instance);
/**
* See QStyleOptionButton:: QStyleOptionButton(QStyleOptionButton)
*/
public QStyleOptionButton(io.qt.widgets.@NonNull QStyleOptionButton other){
super((QPrivateConstructor)null);
initialize_native(this, other);
}
private native static void initialize_native(QStyleOptionButton instance, io.qt.widgets.QStyleOptionButton other);
/**
* See QStyleOptionButton:: operator=(QStyleOptionButton)
*/
@QtUninvokable
public final void assign(io.qt.widgets.@NonNull QStyleOptionButton arg__1){
assign_native_cref_QStyleOptionButton(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(arg__1));
}
@QtUninvokable
private native void assign_native_cref_QStyleOptionButton(long __this__nativeId, long arg__1);
/**
* Bitwise OR of the features that describe this button
* See QStyleOptionButton:: features
*/
@QtUninvokable
public final void setFeatures(io.qt.widgets.QStyleOptionButton.@NonNull ButtonFeatures features){
setFeatures_native_cref_QStyleOptionButton_ButtonFeatures(QtJambi_LibraryUtilities.internal.nativeId(this), features.value());
}
@QtUninvokable
private native void setFeatures_native_cref_QStyleOptionButton_ButtonFeatures(long __this__nativeId, int features);
/**
* Bitwise OR of the features that describe this button
* See QStyleOptionButton:: features
*/
@QtUninvokable
public final io.qt.widgets.QStyleOptionButton.@NonNull ButtonFeatures features(){
return new io.qt.widgets.QStyleOptionButton.ButtonFeatures(features_native(QtJambi_LibraryUtilities.internal.nativeId(this)));
}
@QtUninvokable
private native int features_native(long __this__nativeId);
/**
* The icon of the button
*
*/
@QtUninvokable
public final void setIcon(io.qt.gui.@NonNull QIcon icon){
setIcon_native_cref_QIcon(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(icon));
}
@QtUninvokable
private native void setIcon_native_cref_QIcon(long __this__nativeId, long icon);
/**
* The icon of the button
*
*/
@QtUninvokable
public final io.qt.gui.@NonNull QIcon icon(){
return icon_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.gui.QIcon icon_native(long __this__nativeId);
/**
* The size of the icon for the button
* See QStyleOptionButton:: iconSize
*/
@QtUninvokable
public final void setIconSize(io.qt.core.@NonNull QSize iconSize){
setIconSize_native_cref_QSize(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(iconSize));
}
@QtUninvokable
private native void setIconSize_native_cref_QSize(long __this__nativeId, long iconSize);
/**
* The size of the icon for the button
* See QStyleOptionButton:: iconSize
*/
@QtUninvokable
public final io.qt.core.@NonNull QSize iconSize(){
return iconSize_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native io.qt.core.QSize iconSize_native(long __this__nativeId);
/**
* The text of the button
*
*/
@QtUninvokable
public final void setText(java.lang.@NonNull String text){
setText_native_cref_QString(QtJambi_LibraryUtilities.internal.nativeId(this), text);
}
@QtUninvokable
private native void setText_native_cref_QString(long __this__nativeId, java.lang.String text);
/**
* The text of the button
*
*/
@QtUninvokable
public final java.lang.@NonNull String text(){
return text_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native java.lang.String text_native(long __this__nativeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QStyleOptionButton(QPrivateConstructor p) { super(p); }
/**
* Creates and returns a copy of this object.
See QStyleOptionButton:: QStyleOptionButton(QStyleOptionButton)
*/
@QtUninvokable
@Override
public QStyleOptionButton clone() {
return clone_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
private static native QStyleOptionButton clone_native(long __this_nativeId);
/**
* @deprecated Use {@link #assign(io.qt.widgets.QStyleOptionButton)} instead.
*/
@Deprecated
@QtUninvokable
public final void set(io.qt.widgets.@NonNull QStyleOptionButton arg__1) {
assign(arg__1);
}
/**
* Overloaded function for {@link #setFeatures(io.qt.widgets.QStyleOptionButton.ButtonFeatures)}.
*/
@QtUninvokable
public final void setFeatures(io.qt.widgets.QStyleOptionButton.@NonNull ButtonFeature @NonNull... features) {
setFeatures(new io.qt.widgets.QStyleOptionButton.ButtonFeatures(features));
}
/**
* @hidden
* Kotlin property getter. In Java use {@link #features()} instead.
*/
@QtUninvokable
public final io.qt.widgets.QStyleOptionButton.@NonNull ButtonFeatures getFeatures() {
return features();
}
/**
* Overloaded function for {@link #setIcon(io.qt.gui.QIcon)}.
*/
@QtUninvokable
public final void setIcon(io.qt.gui.@NonNull QPixmap icon) {
setIcon(new io.qt.gui.QIcon(icon));
}
/**
* @hidden
* Kotlin property getter. In Java use {@link #icon()} instead.
*/
@QtUninvokable
public final io.qt.gui.@NonNull QIcon getIcon() {
return icon();
}
/**
* @hidden
* Kotlin property getter. In Java use {@link #iconSize()} instead.
*/
@QtUninvokable
public final io.qt.core.@NonNull QSize getIconSize() {
return iconSize();
}
/**
* @hidden
* Kotlin property getter. In Java use {@link #text()} instead.
*/
@QtUninvokable
public final java.lang.@NonNull String getText() {
return text();
}
}