Class ShortcutTrigger
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
AlternativeTrigger
,KeyvalTrigger
,MnemonicTrigger
,NeverTrigger
,ShortcutTrigger.ShortcutTriggerImpl
GtkShortcutTrigger
tracks how a GtkShortcut
should 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
Modifier and TypeClassDescriptionstatic class
ShortcutTrigger.Builder<B extends ShortcutTrigger.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static class
The ShortcutTriggerImpl type represents a native instance of the abstract ShortcutTrigger class.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionShortcutTrigger
(MemorySegment address) Create a ShortcutTrigger proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ShortcutTrigger
asParent()
Returns this instance as if it were its parent type.static ShortcutTrigger.Builder
<? extends ShortcutTrigger.Builder> builder()
AShortcutTrigger.Builder
object constructs aShortcutTrigger
with the specified properties.int
compare
(ShortcutTrigger trigger2) The types of this ShortcutTrigger andtrigger2
aregconstpointer
only to allow use of this function as aGCompareFunc
.boolean
equal
(ShortcutTrigger trigger2) Checks if this ShortcutTrigger andtrigger2
trigger under the same conditions.static Type
getType()
Get the GType of the ShortcutTrigger classint
hash()
Generates a hash value for aGtkShortcutTrigger
.static ShortcutTrigger
parseString
(String string) Tries to parse the given string into a trigger.void
Prints the given trigger into a string for the developer.boolean
printLabel
(Display display, GString 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 givenevent
triggers this ShortcutTrigger.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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,
null
is 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 andtrigger2
aregconstpointer
only 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 andtrigger2
trigger under the same conditions.The types of
one
andtwo
aregconstpointer
only to allow use of this function withGHashTable
. They must each be aGtkShortcutTrigger
.- Parameters:
trigger2
- aGtkShortcutTrigger
- Returns:
true
if this ShortcutTrigger andtrigger2
are 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
gconstpointer
only 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
- aGString
to 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
display
in 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
-GdkDisplay
to print forstring
- aGString
to print into- Returns:
true
if something was printed orfalse
if 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
display
in 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
-GdkDisplay
to print for- Returns:
- a new string
-
toString
Prints the given trigger into a human-readable string.This is a small wrapper around
print(org.gnome.glib.GString)
to help when debugging. -
trigger
Checks if the givenevent
triggers this ShortcutTrigger.- Parameters:
event
- the event to checkenableMnemonics
-true
if mnemonics should trigger. Usually the value of this property is determined by checking that the passed inevent
is a Key event and has the right modifiers set.- Returns:
- Whether the event triggered the shortcut
-
builder
AShortcutTrigger.Builder
object constructs aShortcutTrigger
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withShortcutTrigger.Builder.build()
.
-