Class SidebarItem
- All Implemented Interfaces:
Proxy
An item within SidebarSection.
Sidebar items must have a title, set via SidebarItem:title.
Sidebar items should, but are not required to, have an icon. Icons can be set
from an icon name, via SidebarItem:icon-name, or a
Paintable, via SidebarItem:icon-paintable.
Items can also have subtitles, set with the SidebarItem:subtitle
property. Subtitles should be used sparingly.
To add a tooltip, use SidebarItem:tooltip. Tooltips always use
Pango markup.
Items can have an arbitrary suffix widget, set with the
SidebarItem:suffix properties. It will be displayed at the end of
its row, or before the arrow in the Adw.SidebarMode.page mode.
To hide or disable the item, use the SidebarItem:visible and
SidebarItem:enabled properties respectively.
To access the items's section, use SidebarItem:section.
It's also possible to access the index of the item in both the section and
the sidebar, using getSectionIndex() and
getIndex() respectively.
Dragging content over sidebar items activates them by default. To disable
this behavior, set SidebarItem:drag-motion-activate to FALSE.
AdwSidebarItem is derivable, and applications that need to associate each
page with data can store it in the items themselves this way.
- Since:
- 1.9
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSidebarItem.Builder<B extends SidebarItem.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 SidebarItem.SidebarItem(MemorySegment address) Create a SidebarItem instance for the provided memory address.SidebarItem(String title) Creates a newAdwSidebarItemwithtitleas its title. -
Method Summary
Modifier and TypeMethodDescriptionprotected SidebarItemasParent()Return this instance as if it were its parent type.static SidebarItem.Builder<? extends SidebarItem.Builder> builder()ASidebarItem.Builderobject constructs aSidebarItemwith the specified properties.booleanGets whether this SidebarItem will be activated on pointer motion during Drag-and-Drop.booleanGets whether this SidebarItem is enabled.@Nullable StringGets the icon name foritem.@Nullable PaintableGets the paintable used as the icon foritem.intgetIndex()Gets index of this SidebarItem within itsSidebar.static MemoryLayoutThe memory layout of the native struct.@Nullable SidebarSectionGets the section this SidebarItem is in.intGets index of this SidebarItem within itsSidebarSection.@Nullable StringGets the subtitle ofself.@Nullable WidgetGets the suffix widget forself.@Nullable StringgetTitle()Gets the title ofself.@Nullable StringGets the tooltip ofself.static @Nullable TypegetType()Get the GType of the SidebarItem class.booleanGets whether an underline in the title indicates a mnemonic.booleanGets whether this SidebarItem is visible.voidsetDragMotionActivate(boolean dragMotionActivate) Sets whether to activate this SidebarItem on pointer motion during Drag-and-Drop.voidsetEnabled(boolean enabled) Sets whether this SidebarItem is enabled.voidsetIconName(@Nullable String iconName) Sets the icon name foritem.voidsetIconPaintable(@Nullable Paintable paintable) Sets the paintable to use as the icon foritem.voidsetSubtitle(@Nullable String subtitle) Sets the subtitle ofself.voidSets the suffix widget forself.voidSets the title ofself.voidsetTooltip(@Nullable String tooltip) Sets the tooltip ofself.voidsetUseUnderline(boolean useUnderline) Sets whether an underline in the title indicates a mnemonic.voidsetVisible(boolean visible) Sets whether this SidebarItem is visible.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
-
SidebarItem
Create a SidebarItem instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SidebarItem
Creates a newAdwSidebarItemwithtitleas its title.- Parameters:
title- the item title- Since:
- 1.9
-
SidebarItem
public SidebarItem()Create a new SidebarItem.
-
-
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. -
getDragMotionActivate
public boolean getDragMotionActivate()Gets whether this SidebarItem will be activated on pointer motion during Drag-and-Drop.- Returns:
- whether to enable the item on drag motion
- Since:
- 1.9
-
getEnabled
public boolean getEnabled()Gets whether this SidebarItem is enabled.- Returns:
- whether the item is enabled
- Since:
- 1.9
-
getIconName
Gets the icon name foritem.- Returns:
- the icon name
- Since:
- 1.9
-
getIconPaintable
Gets the paintable used as the icon foritem.- Returns:
- the icon paintable
- Since:
- 1.9
-
getIndex
public int getIndex()Gets index of this SidebarItem within its
Sidebar.If this SidebarItem is within a section, but that section is not in a sidebar, index will be within the section only.
If this SidebarItem is not within a section, the index will be 0.
The item can later be retrieved by passing this index into
Sidebar.getItem(int).- Returns:
- the index of this SidebarItem
- Since:
- 1.9
-
getSection
Gets the section this SidebarItem is in.- Returns:
- the section of this SidebarItem
- Since:
- 1.9
-
getSectionIndex
public int getSectionIndex()Gets index of this SidebarItem within its
SidebarSection.If this SidebarItem is not within a section, the index will be 0.
The item can later be retrieved by passing this index into
SidebarSection.getItem(int).- Returns:
- the index of this SidebarItem
- Since:
- 1.9
-
getSubtitle
-
getSuffix
Gets the suffix widget forself.- Returns:
- the suffix widget
- Since:
- 1.9
-
getTitle
-
getTooltip
-
getUseUnderline
public boolean getUseUnderline()Gets whether an underline in the title indicates a mnemonic.- Returns:
- whether an underline in the text indicates a mnemonic
- Since:
- 1.9
-
getVisible
public boolean getVisible()Gets whether this SidebarItem is visible.- Returns:
- whether the item is visible
- Since:
- 1.9
-
setDragMotionActivate
public void setDragMotionActivate(boolean dragMotionActivate) Sets whether to activate this SidebarItem on pointer motion during Drag-and-Drop.
This is needed to be able to drag content into the page the item represents, when the sidebar is used as a page switcher. However, it may be unwanted when dropping content onto the item itself, so it can be disabled.
- Parameters:
dragMotionActivate- whether to enable the item on drag motion- Since:
- 1.9
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this SidebarItem is enabled.
See
Gtk.Widget:sensitive.- Parameters:
enabled- whether to enable the item- Since:
- 1.9
-
setIconName
Sets the icon name for
item.Mutually exclusive with
SidebarItem:icon-paintable.- Parameters:
iconName- the icon name- Since:
- 1.9
-
setIconPaintable
Sets the paintable to use as the icon for
item.Mutually exclusive with
SidebarItem:icon-name.- Parameters:
paintable- the icon paintable- Since:
- 1.9
-
setSubtitle
Sets the subtitle ofself.- Parameters:
subtitle- the subtitle- Since:
- 1.9
-
setSuffix
Sets the suffix widget for
self.Suffix will be shown at the end of the item's row, or before the arrow in the
Adw.SidebarMode.pagemode.- Parameters:
suffix- the suffix widget- Since:
- 1.9
-
setTitle
Sets the title ofself.- Parameters:
title- the title- Since:
- 1.9
-
setTooltip
Sets the tooltip of
self.The tooltip can be marked up with the Pango text markup language.
- Parameters:
tooltip- the tooltip- Since:
- 1.9
-
setUseUnderline
public void setUseUnderline(boolean useUnderline) Sets whether an underline in the title indicates a mnemonic.
The mnemonic can be used to activate the item.
- Parameters:
useUnderline- whether an underline in the text indicates a mnemonic- Since:
- 1.9
-
setVisible
public void setVisible(boolean visible) Sets whether this SidebarItem is visible.- Parameters:
visible- whether the item is visible- Since:
- 1.9
-
builder
ASidebarItem.Builderobject constructs aSidebarItemwith the specified properties. Use the variousset...()methods to set properties, and finish construction withSidebarItem.Builder.build().- Returns:
- the builder object
-