org.gnome.gtk.InputPurpose Maven / Gradle / Ivy
Show all versions of gtk Show documentation
// This file was automatically generated by Java-GI. Do not edit this file
// directly! Visit for more information.
//
// The API documentation in this file was derived from GObject-Introspection
// metadata and may include text or comments from the original C sources.
//
// Copyright (c), upstream authors as identified in the GObject-Introspection
// metadata.
//
// This generated file is distributed under the same license as the original
// GObject-Introspection data, unless otherwise specified. Users of this file
// are responsible for complying with any licenses or terms required by the
// original authors.
//
// THIS FILE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
//
package org.gnome.gtk;
import io.github.jwharm.javagi.base.Enumeration;
import io.github.jwharm.javagi.interop.Interop;
import java.lang.IllegalStateException;
import java.lang.Override;
import javax.annotation.processing.Generated;
import org.gnome.glib.Type;
/**
* Describes primary purpose of the input widget.
*
* This information is useful for on-screen keyboards and similar input
* methods to decide which keys should be presented to the user.
*
* Note that the purpose is not meant to impose a totally strict rule
* about allowed characters, and does not replace input validation.
* It is fine for an on-screen keyboard to let the user override the
* character set restriction that is expressed by the purpose. The
* application is expected to validate the entry contents, even if
* it specified a purpose.
*
* The difference between {@link org.gnome.gtk.InputPurpose#DIGITS} and
* {@link org.gnome.gtk.InputPurpose#NUMBER} is that the former accepts only digits
* while the latter also some punctuation (like commas or points, plus,
* minus) and “e” or “E” as in 3.14E+000.
*
* This enumeration may be extended in the future; input methods should
* interpret unknown values as “free form”.
*/
@Generated("io.github.jwharm.JavaGI")
public enum InputPurpose implements Enumeration {
/**
* Allow any character
*/
FREE_FORM(0),
/**
* Allow only alphabetic characters
*/
ALPHA(1),
/**
* Allow only digits
*/
DIGITS(2),
/**
* Edited field expects numbers
*/
NUMBER(3),
/**
* Edited field expects phone number
*/
PHONE(4),
/**
* Edited field expects URL
*/
URL(5),
/**
* Edited field expects email address
*/
EMAIL(6),
/**
* Edited field expects the name of a person
*/
NAME(7),
/**
* Like {@link org.gnome.gtk.InputPurpose#FREE_FORM}, but characters are hidden
*/
PASSWORD(8),
/**
* Like {@link org.gnome.gtk.InputPurpose#DIGITS}, but characters are hidden
*/
PIN(9),
/**
* Allow any character, in addition to control codes
*/
TERMINAL(10);
static {
Gtk.javagi$ensureInitialized();
}
private final int value;
/**
* Create a new InputPurpose for the provided value
*
* @param value the enum value
*/
private InputPurpose(int value) {
this.value = value;
}
/**
* Create a new InputPurpose for the provided value
*
* @param value the enum value
* @return the enum for the provided value
*/
public static InputPurpose of(int value) {
return switch(value) {
case 0 -> FREE_FORM;
case 1 -> ALPHA;
case 2 -> DIGITS;
case 3 -> NUMBER;
case 4 -> PHONE;
case 5 -> URL;
case 6 -> EMAIL;
case 7 -> NAME;
case 8 -> PASSWORD;
case 9 -> PIN;
case 10 -> TERMINAL;
default -> throw new IllegalStateException("Unexpected value: " + value);
} ;
}
/**
* Get the numeric value of this enum
*
* @return the enum value
*/
@Override
public int getValue() {
return value;
}
/**
* Get the GType of the InputPurpose class
*
* @return the GType
*/
public static Type getType() {
return Interop.getType("gtk_input_purpose_get_type");
}
}