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 GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionShortcut()Create a new Shortcut.Shortcut(MemorySegment address) Create a Shortcut 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()Return 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.static MemoryLayoutThe memory layout of the native struct.@Nullable ShortcutTriggerGets the trigger used to triggerself.static @Nullable TypegetType()Get the GType of the Shortcut class.voidsetAction(@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 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, 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 TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Shortcut
Create a Shortcut 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()Create a new Shortcut.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
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
-