Package org.gnome.gtk
Class Shortcut
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gobject.TypeInstance
org.gnome.gobject.GObject
org.gnome.gtk.Shortcut
- All Implemented Interfaces:
Proxy
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 GtkWidgets 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
Nested ClassesModifier and TypeClassDescriptionstatic classShortcut.Builder<B extends Shortcut.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionShortcut()Creates a new Shortcut.Shortcut(MemorySegment address) Create a Shortcut proxy instance for the provided memory address.Shortcut(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action) Creates a newGtkShortcutthat is triggered bytriggerand then activatesaction. -
Method Summary
Modifier and TypeMethodDescriptionprotected ShortcutasParent()Returns this instance as if it were its parent type.static Shortcut.Builder<? extends Shortcut.Builder> builder()AShortcut.Builderobject constructs aShortcutwith the specified properties.@Nullable ShortcutActionGets the action that is activated by this shortcut.@Nullable VariantGets the arguments that are passed when activating the shortcut.@Nullable ShortcutTriggerGets the trigger used to triggerself.static @Nullable TypegetType()Get the GType of the Shortcut classvoidsetAction(@Nullable ShortcutAction action) Sets the new action for this Shortcut to beaction.voidsetArguments(@Nullable Variant args) Sets the arguments to pass when activating the shortcut.voidsetTrigger(@Nullable ShortcutTrigger trigger) Sets the new trigger for this Shortcut to betrigger.static ShortcutwithArguments(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action, @Nullable String formatString, Object... varargs) Creates a newGtkShortcutthat is triggered bytriggerand then activatesactionwith 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, 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
-
Shortcut
Create a Shortcut proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Shortcut
Creates a newGtkShortcutthat is triggered bytriggerand then activatesaction.- Parameters:
trigger- The trigger that will trigger the shortcutaction- The action that will be activated upon triggering
-
Shortcut
public Shortcut()Creates a new Shortcut.
-
-
Method Details
-
getType
-
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. -
withArguments
public static Shortcut withArguments(@Nullable ShortcutTrigger trigger, @Nullable ShortcutAction action, @Nullable String formatString, Object... varargs) Creates a newGtkShortcutthat is triggered bytriggerand then activatesactionwith 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 ornullfor 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 triggerself.- Returns:
- the trigger used
-
setAction
Sets the new action for this Shortcut to beaction.- Parameters:
action- The new action. If theactionisnull, 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 thetriggerisnull, the never trigger will be used.
-
builder
AShortcut.Builderobject constructs aShortcutwith the specified properties. Use the variousset...()methods to set properties, and finish construction withShortcut.Builder.build().- Returns:
- the builder object
-