Class ViewSwitcherSidebar
- All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy
An adaptive sidebar that controls an ViewStack.
AdwViewSwitcherSidebar is a view switcher implemented using a
Sidebar, in a similar fashion to StackSidebar.
AdwViewSwitcherSidebar items have an icon, a label, as well as an unread
dot or a badge.
Unlike other switchers, AdwViewSwitcherSidebar supports grouping pages into
sections, using the ViewStackPage:starts-section and
ViewStackPage:section-title properties.
Like Sidebar, AdwViewSwitcherSidebar is adaptive and can behave as
a sidebar or a page, via the ViewSwitcherSidebar:mode property.
Connect to the ViewSwitcherSidebar::activated signal to run code when
an item has been activated. This can be used to toggle the visible pane when
used in a split view.
Like AdwSidebar, AdwViewSwitcherSidebar supports filtering items via the
ViewSwitcherSidebar:filter property.
Use ViewSwitcherSidebar:placeholder to provide an empty state
widget. It will be shown when all items have been filtered out, or the
sidebar has no items otherwise.
CSS nodes
AdwViewSwitcherSidebar has a single CSS node with name
view-switcher-sidebar.
See also: ViewSwitcher, ViewSwitcherBar,
InlineViewSwitcher.
- Since:
- 1.9
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theActivatedCallbackcallback.static classInner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterface -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new ViewSwitcherSidebar.ViewSwitcherSidebar(MemorySegment address) Create a ViewSwitcherSidebar instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ViewSwitcherSidebarasParent()Return this instance as if it were its parent type.static ViewSwitcherSidebar.Builder<? extends ViewSwitcherSidebar.Builder> builder()AViewSwitcherSidebar.Builderobject constructs aViewSwitcherSidebarwith the specified properties.voidEmits the "activated" signal.@Nullable FilterGets the item filter forself.static MemoryLayoutThe memory layout of the native struct.getMode()Getsself'slook and behavior.@Nullable WidgetGets the placeholder widget forself.@Nullable ViewStackgetStack()Gets the stack this ViewSwitcherSidebar controls.static @Nullable TypegetType()Get the GType of the ViewSwitcherSidebar class.Emitted when an item has been activated.voidSets the item filter forself.voidsetMode(SidebarMode mode) Setsself'slook and behavior.voidsetPlaceholder(@Nullable Widget placeholder) Sets the placeholder widget forself.voidSets the stack to control.Methods inherited from class Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlagsMethods 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, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Accessible
announce, getAccessibleId, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface Buildable
getBuildableId
-
Constructor Details
-
ViewSwitcherSidebar
Create a ViewSwitcherSidebar instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ViewSwitcherSidebar
public ViewSwitcherSidebar()Create a new ViewSwitcherSidebar.
-
-
Method Details
-
getType
Get the GType of the ViewSwitcherSidebar class.- Returns:
- the GType
-
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. -
getFilter
Gets the item filter forself.- Returns:
- the item filter
- Since:
- 1.9
-
getMode
Gets
self'slook and behavior.See
Sidebar.getMode().- Returns:
- the current mode
- Since:
- 1.9
-
getPlaceholder
Gets the placeholder widget forself.- Returns:
- the placeholder widget
- Since:
- 1.9
-
getStack
Gets the stack this ViewSwitcherSidebar controls.- Returns:
- The stack of this ViewSwitcherSidebar
- Since:
- 1.9
-
setFilter
Sets the item filter for
self.Can be used to implement search within the sidebar.
Use
ViewSwitcherSidebar:placeholderto provide an empty state.- Parameters:
filter- the item filter- Since:
- 1.9
-
setMode
Sets
self'slook and behavior.
If set to
Adw.SidebarMode.sidebar, behaves like a sidebar: with a sidebar style and a persistent selection.If set to
Adw.SidebarMode.page, behaves like a page of boxed lists. In this mode, the selection is invisible and only tracked to determine the initially selected item once switched back to sidebar mode.The page mode is intended to be used with
NavigationSplitViewwhen collapsed, as the sidebar pane becomes a page there.When used with
OverlaySplitView, the sidebar should stay in sidebar mode, as the sidebar pane is still a sidebar when collapsed.- Parameters:
mode- the new mode- Since:
- 1.9
-
setPlaceholder
Sets the placeholder widget for
self.This widget will be shown if this ViewSwitcherSidebar has no items, or all of its items have been filtered out by
ViewSwitcherSidebar:filter.- Parameters:
placeholder- the placeholder widget- Since:
- 1.9
-
setStack
Sets the stack to control.- Parameters:
stack- a stack- Since:
- 1.9
-
onActivated
public SignalConnection<ViewSwitcherSidebar.ActivatedCallback> onActivated(ViewSwitcherSidebar.ActivatedCallback handler) Emitted when an item has been activated.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.9
- See Also:
-
emitActivated
public void emitActivated()Emits the "activated" signal. SeeonActivated(ViewSwitcherSidebar.ActivatedCallback). -
builder
AViewSwitcherSidebar.Builderobject constructs aViewSwitcherSidebarwith the specified properties. Use the variousset...()methods to set properties, and finish construction withViewSwitcherSidebar.Builder.build().- Returns:
- the builder object
-