Class ShortcutsItem
- All Implemented Interfaces:
Proxy
An object representing an individual shortcut in ShortcutsSection.
A shortcut has a title, an optional subtitle, and an accelerator.
Accelerator must be specified in the format ShortcutLabel accepts.
Alternatively, the ShortcutsItem:action-name property can be used
to automatically get accelerator associated with the specified action, as set
via Application#setAccelsForAction.
If both are specified, the accelerator will be used if the action couldn't be found or doesn't have an accelerator associated for it.
If ShortcutsItem:direction is set, the shortcut will only be
displayed for the specified text direction. This allows to display different
shortcuts for different text directions.
- Since:
- 1.8
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classShortcutsItem.Builder<B extends ShortcutsItem.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
ConstructorsConstructorDescriptionCreate a new ShortcutsItem.ShortcutsItem(MemorySegment address) Create a ShortcutsItem instance for the provided memory address.ShortcutsItem(String title, String accelerator) Creates a newAdwShortcutsItemwithtitleandaccelerator. -
Method Summary
Modifier and TypeMethodDescriptionprotected ShortcutsItemasParent()Return this instance as if it were its parent type.static ShortcutsItem.Builder<? extends ShortcutsItem.Builder> builder()AShortcutsItem.Builderobject constructs aShortcutsItemwith the specified properties.static ShortcutsItemfromAction(String title, String actionName) Creates a newAdwShortcutsItemwithtitleandactionName.Gets the accelerator ofself.Gets the action name to get the accelerator from.Gets the direction ofself.static MemoryLayoutThe memory layout of the native struct.Gets the subtitle ofself.getTitle()Gets the title ofself.static @Nullable TypegetType()Get the GType of the ShortcutsItem class.voidsetAccelerator(String accelerator) Sets the accelerator ofself.voidsetActionName(String actionName) Sets the action name to get the accelerator from.voidsetDirection(TextDirection direction) Sets the direction ofself.voidsetSubtitle(String subtitle) Sets the subtitle ofself.voidSets the title ofself.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
-
ShortcutsItem
Create a ShortcutsItem instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ShortcutsItem
-
ShortcutsItem
public ShortcutsItem()Create a new ShortcutsItem.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
fromAction
Creates a newAdwShortcutsItemwithtitleandactionName.- Parameters:
title- the shortcut titleactionName- the shortcut action name- Returns:
- the newly created
AdwShortcutsItem - Since:
- 1.8
-
getAccelerator
-
getActionName
Gets the action name to get the accelerator from.- Returns:
- the action name
- Since:
- 1.8
-
getDirection
Gets the direction ofself.- Returns:
- the shortcut direction
- Since:
- 1.8
-
getSubtitle
-
getTitle
-
setAccelerator
Sets the accelerator of
self.acceleratormust be in the formatShortcutLabelaccepts.- Parameters:
accelerator- the accelerator to use- Since:
- 1.8
-
setActionName
Sets the action name to get the accelerator from.- Parameters:
actionName- the action name to use- Since:
- 1.8
-
setDirection
Sets the direction of
self.If set to
Gtk.TextDirection.ltrorGtk.TextDirection.rtl, the shortcut will only be displayed for this direction.- Parameters:
direction- the shortcut direction- Since:
- 1.8
-
setSubtitle
Sets the subtitle ofself.- Parameters:
subtitle- the subtitle to use- Since:
- 1.8
-
setTitle
Sets the title ofself.- Parameters:
title- the title to use- Since:
- 1.8
-
builder
AShortcutsItem.Builderobject constructs aShortcutsItemwith the specified properties. Use the variousset...()methods to set properties, and finish construction withShortcutsItem.Builder.build().- Returns:
- the builder object
-