Package ch.bailu.gtk.adw
Klasse BottomSheet
- Alle implementierten Schnittstellen:
PointerInterface
A bottom sheet with an optional bottom bar.
<picture>
<source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)">
<img src="bottom-sheet.png" alt="bottom-sheet">
</picture>
`AdwBottomSheet` has three child widgets. [property@BottomSheet:content] is
shown persistently. [property@BottomSheet:sheet] is displayed above it when
it's open, and [property@BottomSheet:bottom-bar] is displayed when it's not.
Bottom sheet and bottom bar are attached to the bottom edge of the widget.
They take the full width by default, but can only take a portion of it if
[property@BottomSheet:full-width] is set to `FALSE`. In this case,
[property@BottomSheet:align] determines where along the bottom edge they are
placed.
Bottom bar can be hidden using the [property@BottomSheet:reveal-bottom-bar]
property.
`AdwBottomSheet` can be useful for applications such as music players, that
want to have a persistent bottom bar that expands into a bottom sheet when
clicked. It's meant for cases where a bottom sheet is tightly integrated into
the UI. For more transient bottom sheets, see [class@Dialog].
To open or close the bottom sheet, use the [property@BottomSheet:open]
property.
By default, the bottom sheet has an overlaid drag handle. It can be disabled
by setting [property@BottomSheet:show-drag-handle] to `FALSE`. Note that the
handle also controls whether the sheet can be dragged using a pointer.
Bottom sheets are modal by default, meaning that the content is dimmed and
cannot be accessed while the sheet is open. Set [property@BottomSheet:modal]
to `FALSE` if this behavior is unwanted.
To disable user interactions for opening or closing the bottom sheet (such as
swipes or clicking the bottom bar or close button), set
[property@BottomSheet:can-open] or [property@BottomSheet:can-close] to
`FALSE`.
In some cases, particularly when using a full-width bottom bar, it may be
necessary to shift [property@BottomSheet:content] upwards. Use the
[property@BottomSheet:bottom-bar-height] and
[property@BottomSheet:sheet-height] for that.
`AdwBottomSheet` is not adaptive, and for larger window sizes applications
may want to replace it with another UI, such as a sidebar. This can be done
using [class@MultiLayoutView].
## Sizing
Unlike [class@Dialog] presented as a bottom sheet, `AdwBottomSheet` just
follows the content's natural size, and it's up to the applications to make
sure their content provides one. For example, when using
[class@Gtk.ScrolledWindow], make sure to set
[property@Gtk.ScrolledWindow:propagate-natural-height] to `TRUE`.
## Header Bar Integration
When placed inside an `AdwBottomSheet`, [class@HeaderBar] will not show the
title when [property@BottomSheet:show-drag-handle] is `TRUE`, regardless of
[property@HeaderBar:show-title]. This only applies to the default title,
titles set with [property@HeaderBar:title-widget] will still be shown.
## `AdwBottomSheet` as `GtkBuildable`:
The `AdwBottomSheet` implementation of the [iface@Gtk.Buildable] interface
supports setting the sheet widget by specifying “sheet” as the “type”
attribute of a `<child>` element, and the bottom bar by specifying
“bottom-bar”. Specifying “content” or omitting the child type results in
setting the content child.
<picture>
<source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)">
<img src="bottom-sheet.png" alt="bottom-sheet">
</picture>
`AdwBottomSheet` has three child widgets. [property@BottomSheet:content] is
shown persistently. [property@BottomSheet:sheet] is displayed above it when
it's open, and [property@BottomSheet:bottom-bar] is displayed when it's not.
Bottom sheet and bottom bar are attached to the bottom edge of the widget.
They take the full width by default, but can only take a portion of it if
[property@BottomSheet:full-width] is set to `FALSE`. In this case,
[property@BottomSheet:align] determines where along the bottom edge they are
placed.
Bottom bar can be hidden using the [property@BottomSheet:reveal-bottom-bar]
property.
`AdwBottomSheet` can be useful for applications such as music players, that
want to have a persistent bottom bar that expands into a bottom sheet when
clicked. It's meant for cases where a bottom sheet is tightly integrated into
the UI. For more transient bottom sheets, see [class@Dialog].
To open or close the bottom sheet, use the [property@BottomSheet:open]
property.
By default, the bottom sheet has an overlaid drag handle. It can be disabled
by setting [property@BottomSheet:show-drag-handle] to `FALSE`. Note that the
handle also controls whether the sheet can be dragged using a pointer.
Bottom sheets are modal by default, meaning that the content is dimmed and
cannot be accessed while the sheet is open. Set [property@BottomSheet:modal]
to `FALSE` if this behavior is unwanted.
To disable user interactions for opening or closing the bottom sheet (such as
swipes or clicking the bottom bar or close button), set
[property@BottomSheet:can-open] or [property@BottomSheet:can-close] to
`FALSE`.
In some cases, particularly when using a full-width bottom bar, it may be
necessary to shift [property@BottomSheet:content] upwards. Use the
[property@BottomSheet:bottom-bar-height] and
[property@BottomSheet:sheet-height] for that.
`AdwBottomSheet` is not adaptive, and for larger window sizes applications
may want to replace it with another UI, such as a sidebar. This can be done
using [class@MultiLayoutView].
## Sizing
Unlike [class@Dialog] presented as a bottom sheet, `AdwBottomSheet` just
follows the content's natural size, and it's up to the applications to make
sure their content provides one. For example, when using
[class@Gtk.ScrolledWindow], make sure to set
[property@Gtk.ScrolledWindow:propagate-natural-height] to `TRUE`.
## Header Bar Integration
When placed inside an `AdwBottomSheet`, [class@HeaderBar] will not show the
title when [property@BottomSheet:show-drag-handle] is `TRUE`, regardless of
[property@HeaderBar:show-title]. This only applies to the default title,
titles set with [property@HeaderBar:title-widget] will still be shown.
## `AdwBottomSheet` as `GtkBuildable`:
The `AdwBottomSheet` implementation of the [iface@Gtk.Buildable] interface
supports setting the sheet widget by specifying “sheet” as the “type”
attribute of a `<child>` element, and the bottom bar by specifying
“bottom-bar”. Specifying “content” or omitting the child type results in
setting the content child.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BottomSheet.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungImplements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceSwipeable
.float
getAlign()
Gets horizontal alignment of the bottom sheet.Gets the bottom bar widget for @self.int
Gets the current bottom bar height.boolean
Gets whether the bottom sheet can be closed by user.boolean
Gets whether the bottom sheet can be opened by user.static ClassHandler
Gets the content widget for @self.boolean
Gets whether the bottom sheet takes the full width.static int
boolean
getModal()
Gets whether the bottom sheet is modal.boolean
getOpen()
Gets whether the bottom sheet is open.static long
static TypeSystem.TypeSize
boolean
Gets whether the bottom bar is revealed.getSheet()
Gets the bottom sheet widget for @self.int
Gets the current bottom sheet height.boolean
Gets whether to show a drag handle in the bottom sheet.static long
static TypeSystem.TypeSize
Connect to signal "close-attempt".void
setAlign
(float align) Sets horizontal alignment of the bottom sheet.void
setBottomBar
(Widget bottom_bar) Sets the bottom bar widget for @self.void
setCanClose
(boolean can_close) Sets whether the bottom sheet can be closed by user.void
setCanOpen
(boolean can_open) Sets whether the bottom sheet can be opened by user.void
setContent
(Widget content) Sets the content widget for @self.void
setFullWidth
(boolean full_width) Sets whether the bottom sheet takes the full width.void
setModal
(boolean modal) Sets whether the bottom sheet is modal.void
setOpen
(boolean open) Sets whether the bottom sheet is open.void
setRevealBottomBar
(boolean reveal) Sets whether to reveal the bottom bar.void
Sets the bottom sheet widget for @self.void
setShowDragHandle
(boolean show_drag_handle) Sets whether to show a drag handle in the bottom sheet.Von Klasse geerbte Methoden ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, 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, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_CLOSE_ATTEMPT
- Siehe auch:
-
-
Konstruktordetails
-
BottomSheet
-
BottomSheet
public BottomSheet()Creates a new `AdwBottomSheet`.
-
-
Methodendetails
-
getClassHandler
-
getAlign
public float getAlign()Gets horizontal alignment of the bottom sheet.- Gibt zurück:
- the horizontal alignment
-
getBottomBar
Gets the bottom bar widget for @self.- Gibt zurück:
- the bottom bar widget
-
getBottomBarHeight
public int getBottomBarHeight()Gets the current bottom bar height.
It can be used to shift the content upwards permanently to accommodate for
the bottom bar.- Gibt zurück:
- the bottom bar height
-
getCanClose
public boolean getCanClose()Gets whether the bottom sheet can be closed by user.- Gibt zurück:
- whether the sheet can be closed by user
-
getCanOpen
public boolean getCanOpen()Gets whether the bottom sheet can be opened by user.- Gibt zurück:
- whether the sheet can be opened by user.
-
getContent
Gets the content widget for @self.- Gibt zurück:
- the content widget
-
getFullWidth
public boolean getFullWidth()Gets whether the bottom sheet takes the full width.- Gibt zurück:
- whether the sheet takes up the full width
-
getModal
public boolean getModal()Gets whether the bottom sheet is modal.- Gibt zurück:
- whether the sheet is modal
-
getOpen
public boolean getOpen()Gets whether the bottom sheet is open.- Gibt zurück:
- whether the sheet is open
-
getRevealBottomBar
public boolean getRevealBottomBar()Gets whether the bottom bar is revealed.- Gibt zurück:
- whether the bottom bar is revealed
-
getSheet
Gets the bottom sheet widget for @self.- Gibt zurück:
- the sheet widget
-
getSheetHeight
public int getSheetHeight()Gets the current bottom sheet height.
It can be used to shift the content upwards when the bottom sheet is open.- Gibt zurück:
- the sheet height
-
getShowDragHandle
public boolean getShowDragHandle()Gets whether to show a drag handle in the bottom sheet.- Gibt zurück:
- whether to show the drag handle
-
setAlign
public void setAlign(float align) Sets horizontal alignment of the bottom sheet.
0 means the bottom sheet is flush with the start edge, 1 means it's flush
with the end edge. 0.5 means it's centered.
Only used when [property@BottomSheet:full-width] is set to `FALSE`.- Parameter:
align
- the new alignment
-
setBottomBar
Sets the bottom bar widget for @self.
Shown when [property@BottomSheet:open] is `FALSE`. When open, morphs into
the [property@BottomSheet:sheet].
Bottom bar can be temporarily hidden using the
[property@BottomSheet:reveal-bottom-bar] property.- Parameter:
bottom_bar
- the bottom bar widget
-
setCanClose
public void setCanClose(boolean can_close) Sets whether the bottom sheet can be closed by user.
It can be closed via the close button, swiping down, pressing
<kbd>Escape</kbd> or clicking the content dimming (when modal).
Bottom sheet can still be closed using [property@BottomSheet:open].- Parameter:
can_close
- whether the sheet can be closed by user
-
setCanOpen
public void setCanOpen(boolean can_open) Sets whether the bottom sheet can be opened by user.
It can be opened via clicking or swiping up from the bottom bar.
Does nothing if [property@BottomSheet:bottom-bar] is not set.
Bottom sheet can still be opened using [property@BottomSheet:open].- Parameter:
can_open
- whether the sheet can be opened by user.
-
setContent
Sets the content widget for @self.
It's always shown, and the bottom sheet is overlaid over it.- Parameter:
content
- the content widget
-
setFullWidth
public void setFullWidth(boolean full_width) Sets whether the bottom sheet takes the full width.
When full width, [property@BottomSheet:align] is ignored.- Parameter:
full_width
- whether the sheet takes up the full width
-
setModal
public void setModal(boolean modal) Sets whether the bottom sheet is modal.
When modal, [property@BottomSheet:content] will be dimmed when the bottom
sheet is open, and clicking it will close the bottom sheet. It also cannot be
focused with keyboard.
Otherwise, the content is accessible even when the bottom sheet is open.- Parameter:
modal
- whether the sheet is modal
-
setOpen
public void setOpen(boolean open) Sets whether the bottom sheet is open.- Parameter:
open
- whether to open the sheet
-
setRevealBottomBar
public void setRevealBottomBar(boolean reveal) Sets whether to reveal the bottom bar.
The transition will be animated.
See [property@BottomSheet:bottom-bar] and
[property@BottomSheet:bottom-bar-height].- Parameter:
reveal
- whether to reveal the bottom bar
-
setSheet
Sets the bottom sheet widget for @self.
Only shown when [property@BottomSheet:open] is `TRUE`.- Parameter:
sheet
- the sheet widget
-
setShowDragHandle
public void setShowDragHandle(boolean show_drag_handle) Sets whether to show a drag handle in the bottom sheet.
The handle will be overlaid over [property@BottomSheet:sheet].
When the handle is shown, [class@HeaderBar] will hide its default title, and
[class@ToolbarView] will reserve space if there are no top bars.
Showing drag handle also allows to swipe the bottom sheet down (and to swipe
the bottom bar up) with a pointer, instead of just touchscreen.- Parameter:
show_drag_handle
- whether to show the drag handle
-
onCloseAttempt
Connect to signal "close-attempt".
SeeBottomSheet.OnCloseAttempt.onCloseAttempt()
for signal description.
FieldSIGNAL_ON_CLOSE_ATTEMPT
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asSwipeable
Implements interfaceSwipeable
. Call this to get access to interface functions.- Gibt zurück:
Swipeable
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Setzt außer Kraft:
asAccessible
in KlasseWidget
- Gibt zurück:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Setzt außer Kraft:
asBuildable
in KlasseWidget
- Gibt zurück:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Setzt außer Kraft:
asConstraintTarget
in KlasseWidget
- Gibt zurück:
ConstraintTarget
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-