Package org.gnome.gtk
Class Shortcut
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.gtk.Shortcut
- All Implemented Interfaces:
Proxy
A
GtkShortcut
describes a keyboard shortcut.
It contains a description of how to trigger the shortcut via a
ShortcutTrigger
and a way to activate the shortcut
on a widget via a ShortcutAction
.
The actual work is usually done via ShortcutController
,
which decides if and when to activate a shortcut. Using that controller
directly however is rarely necessary as various higher level
convenience APIs exist on GtkWidget
s that make it easier to use
shortcuts in GTK.
GtkShortcut
does provide functionality to make it easy for users
to work with shortcuts, either by providing informational strings
for display purposes or by allowing shortcuts to be configured.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Shortcut.Builder<B extends Shortcut.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionShortcut
(MemorySegment address) Create a Shortcut proxy instance for the provided memory address.Shortcut
(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action) Creates a newGtkShortcut
that is triggered bytrigger
and then activatesaction
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Shortcut
asParent()
Returns this instance as if it were its parent type.static Shortcut.Builder
<? extends Shortcut.Builder> builder()
AShortcut.Builder
object constructs aShortcut
with the specified properties.Gets the action that is activated by this shortcut.Gets the arguments that are passed when activating the shortcut.Gets the trigger used to trigger this Shortcut.static Type
getType()
Get the GType of the Shortcut classvoid
setAction
(@Nullable ShortcutAction action) Sets the new action for this Shortcut to beaction
.void
setArguments
(@Nullable Variant args) Sets the arguments to pass when activating the shortcut.void
setTrigger
(@Nullable ShortcutTrigger trigger) Sets the new trigger for this Shortcut to betrigger
.static Shortcut
withArguments
(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action, @Nullable String formatString, Object... varargs) Creates a newGtkShortcut
that is triggered bytrigger
and then activatesaction
with arguments given byformatString
.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
-
Shortcut
Create a Shortcut proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Shortcut
public Shortcut(@Nullable @Nullable ShortcutTrigger trigger, @Nullable @Nullable ShortcutAction action) Creates a newGtkShortcut
that is triggered bytrigger
and then activatesaction
.- Parameters:
trigger
- The trigger that will trigger the shortcutaction
- The action that will be activated upon triggering
-
-
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. -
withArguments
public static Shortcut withArguments(@Nullable @Nullable ShortcutTrigger trigger, @Nullable @Nullable ShortcutAction action, @Nullable @Nullable String formatString, Object... varargs) Creates a newGtkShortcut
that is triggered bytrigger
and then activatesaction
with arguments given byformatString
.- Parameters:
trigger
- The trigger that will trigger the shortcutaction
- The action that will be activated upon triggeringformatString
- GVariant format string for arguments ornull
for no argumentsvarargs
- arguments, as given by format string.- Returns:
- a new
GtkShortcut
-
getAction
Gets the action that is activated by this shortcut.- Returns:
- the action
-
getArguments
Gets the arguments that are passed when activating the shortcut.- Returns:
- the arguments
-
getTrigger
Gets the trigger used to trigger this Shortcut.- Returns:
- the trigger used
-
setAction
Sets the new action for this Shortcut to beaction
.- Parameters:
action
- The new action. If theaction
isnull
, the nothing action will be used.
-
setArguments
Sets the arguments to pass when activating the shortcut.- Parameters:
args
- arguments to pass when activating this Shortcut
-
setTrigger
Sets the new trigger for this Shortcut to betrigger
.- Parameters:
trigger
- The new trigger. If thetrigger
isnull
, the never trigger will be used.
-
builder
AShortcut.Builder
object constructs aShortcut
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withShortcut.Builder.build()
.
-