Class ShortcutTrigger
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
AlternativeTrigger,KeyvalTrigger,MnemonicTrigger,NeverTrigger,ShortcutTrigger.ShortcutTrigger$Impl
GtkShortcut can be activated.
To find out if a GtkShortcutTrigger triggers, you can call
trigger(org.gnome.gdk.Event, boolean) on a GdkEvent.
GtkShortcutTriggers contain functions that allow easy presentation
to end users as well as being printed for debugging.
All GtkShortcutTriggers are immutable, you can only specify their
properties during construction. If you want to change a trigger, you
have to replace it with a new one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classShortcutTrigger.Builder<B extends ShortcutTrigger.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe ShortcutTrigger$Impl type represents a native instance of the abstract ShortcutTrigger class.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ShortcutTrigger.ShortcutTrigger(MemorySegment address) Create a ShortcutTrigger proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ShortcutTriggerasParent()Returns this instance as if it were its parent type.intcompare(ShortcutTrigger trigger2) The types of this ShortcutTrigger andtrigger2aregconstpointeronly to allow use of this function as aGCompareFunc.booleanequal(ShortcutTrigger trigger2) Checks if this ShortcutTrigger andtrigger2trigger under the same conditions.static @Nullable TypegetType()Get the GType of the ShortcutTrigger classinthash()Generates a hash value for aGtkShortcutTrigger.static ShortcutTriggerparseString(String string) Tries to parse the given string into a trigger.voidPrints the given trigger into a string for the developer.booleanprintLabel(Display display, String string) Prints the given trigger into a string.Gets textual representation for the given trigger.toString()Prints the given trigger into a human-readable string.Checks if the giveneventtriggersself.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, builder, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ShortcutTrigger
Create a ShortcutTrigger proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ShortcutTrigger
public ShortcutTrigger()Creates a new ShortcutTrigger.
-
-
Method Details
-
getType
Get the GType of the ShortcutTrigger class- Returns:
- the GType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
parseString
Tries to parse the given string into a trigger.On success, the parsed trigger is returned. When parsing failed,
nullis returned.The accepted strings are:
never, forGtkNeverTrigger- a string parsed by gtk_accelerator_parse(), for a
GtkKeyvalTrigger, e.g.<Control>C - underscore, followed by a single character, for
GtkMnemonicTrigger, e.g._l - two valid trigger strings, separated by a
|character, for aGtkAlternativeTrigger:<Control>q|<Control>w
Note that you will have to escape the
<and>characters when specifying triggers in XML files, such as GtkBuilder ui files. Use<instead of<and>instead of>.- Parameters:
string- the string to parse- Returns:
- a new
GtkShortcutTrigger
-
compare
The types of this ShortcutTrigger andtrigger2aregconstpointeronly to allow use of this function as aGCompareFunc.They must each be a
GtkShortcutTrigger.- Parameters:
trigger2- aGtkShortcutTrigger- Returns:
- An integer less than, equal to, or greater than zero if
this ShortcutTrigger is found, respectively, to be less than, to match,
or be greater than
trigger2.
-
equal
Checks if this ShortcutTrigger andtrigger2trigger under the same conditions.The types of
oneandtwoaregconstpointeronly to allow use of this function withGHashTable. They must each be aGtkShortcutTrigger.- Parameters:
trigger2- aGtkShortcutTrigger- Returns:
trueif this ShortcutTrigger andtrigger2are equal
-
hash
public int hash()Generates a hash value for aGtkShortcutTrigger.The output of this function is guaranteed to be the same for a given value only per-process. It may change between different processor architectures or even different versions of GTK. Do not use this function as a basis for building protocols or file formats.
The types of this ShortcutTrigger is
gconstpointeronly to allow use of this function withGHashTable. They must each be aGtkShortcutTrigger.- Returns:
- a hash value corresponding to this ShortcutTrigger
-
print
Prints the given trigger into a string for the developer. This is meant for debugging and logging.The form of the representation may change at any time and is not guaranteed to stay identical.
- Parameters:
string- aGStringto print into
-
printLabel
Prints the given trigger into a string.This function is returning a translated string for presentation to end users for example in menu items or in help texts.
The
displayin use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.The form of the representation may change at any time and is not guaranteed to stay identical.
- Parameters:
display-GdkDisplayto print forstring- aGStringto print into- Returns:
trueif something was printed orfalseif the trigger did not have a textual representation suitable for end users.
-
toLabel
Gets textual representation for the given trigger.This function is returning a translated string for presentation to end users for example in menu items or in help texts.
The
displayin use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.The form of the representation may change at any time and is not guaranteed to stay identical.
- Parameters:
display-GdkDisplayto print for- Returns:
- a new string
-
toString
Prints the given trigger into a human-readable string.This is a small wrapper around
print(java.lang.String)to help when debugging. -
trigger
Checks if the giveneventtriggersself.- Parameters:
event- the event to checkenableMnemonics-trueif mnemonics should trigger. Usually the value of this property is determined by checking that the passed ineventis a Key event and has the right modifiers set.- Returns:
- Whether the event triggered the shortcut
-