Package ch.bailu.gtk.adw
Class Flap
- All Implemented Interfaces:
PointerInterface
An adaptive container acting like a box or an overlay.
<picture>
<source srcset="flap-wide-dark.png" media="(prefers-color-scheme: dark)">
<img src="flap-wide.png" alt="flap-wide">
</picture>
<picture>
<source srcset="flap-narrow-dark.png" media="(prefers-color-scheme: dark)">
<img src="flap-narrow.png" alt="flap-narrow">
</picture>
The `AdwFlap` widget can display its children like a [class@Gtk.Box] does or
like a [class@Gtk.Overlay] does, according to the
[property@Flap:fold-policy] value.
`AdwFlap` has at most three children: [property@Flap:content],
[property@Flap:flap] and [property@Flap:separator]. Content is the primary
child, flap is displayed next to it when unfolded, or overlays it when
folded. Flap can be shown or hidden by changing the
[property@Flap:reveal-flap] value, as well as via swipe gestures if
[property@Flap:swipe-to-open] and/or [property@Flap:swipe-to-close] are set
to `TRUE`.
Optionally, a separator can be provided, which would be displayed between
the content and the flap when there's no shadow to separate them, depending
on the transition type.
[property@Flap:flap] is transparent by default; add the
[`.background`](style-classes.html#background) style class to it if this is
unwanted.
If [property@Flap:modal] is set to `TRUE`, content becomes completely
inaccessible when the flap is revealed while folded.
The position of the flap and separator children relative to the content is
determined by orientation, as well as the [property@Flap:flap-position]
value.
Folding the flap will automatically hide the flap widget, and unfolding it
will automatically reveal it. If this behavior is not desired, the
[property@Flap:locked] property can be used to override it.
Common use cases include sidebars, header bars that need to be able to
overlap the window content (for example, in fullscreen mode) and bottom
sheets.
## AdwFlap as GtkBuildable
The `AdwFlap` implementation of the [iface@Gtk.Buildable] interface supports
setting the flap child by specifying “flap” as the “type” attribute of a
`<child>` element, and separator by specifying “separator”. Specifying
“content” child type or omitting it results in setting the content child.
## CSS nodes
`AdwFlap` has a single CSS node with name `flap`. The node will get the style
classes `.folded` when it is folded, and `.unfolded` when it's not.
<picture>
<source srcset="flap-wide-dark.png" media="(prefers-color-scheme: dark)">
<img src="flap-wide.png" alt="flap-wide">
</picture>
<picture>
<source srcset="flap-narrow-dark.png" media="(prefers-color-scheme: dark)">
<img src="flap-narrow.png" alt="flap-narrow">
</picture>
The `AdwFlap` widget can display its children like a [class@Gtk.Box] does or
like a [class@Gtk.Overlay] does, according to the
[property@Flap:fold-policy] value.
`AdwFlap` has at most three children: [property@Flap:content],
[property@Flap:flap] and [property@Flap:separator]. Content is the primary
child, flap is displayed next to it when unfolded, or overlays it when
folded. Flap can be shown or hidden by changing the
[property@Flap:reveal-flap] value, as well as via swipe gestures if
[property@Flap:swipe-to-open] and/or [property@Flap:swipe-to-close] are set
to `TRUE`.
Optionally, a separator can be provided, which would be displayed between
the content and the flap when there's no shadow to separate them, depending
on the transition type.
[property@Flap:flap] is transparent by default; add the
[`.background`](style-classes.html#background) style class to it if this is
unwanted.
If [property@Flap:modal] is set to `TRUE`, content becomes completely
inaccessible when the flap is revealed while folded.
The position of the flap and separator children relative to the content is
determined by orientation, as well as the [property@Flap:flap-position]
value.
Folding the flap will automatically hide the flap widget, and unfolding it
will automatically reveal it. If this behavior is not desired, the
[property@Flap:locked] property can be used to override it.
Common use cases include sidebars, header bars that need to be able to
overlap the window content (for example, in fullscreen mode) and bottom
sheets.
## AdwFlap as GtkBuildable
The `AdwFlap` implementation of the [iface@Gtk.Buildable] interface supports
setting the flap child by specifying “flap” as the “type” attribute of a
`<child>` element, and separator by specifying “separator”. Specifying
“content” child type or omitting it results in setting the content child.
## CSS nodes
`AdwFlap` has a single CSS node with name `flap`. The node will get the style
classes `.folded` when it is folded, and `.unfolded` when it's not.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Flap.html
-
Nested Class Summary
Nested classes/interfaces inherited from class 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
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class 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
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceOrientable
.Implements interfaceSwipeable
.static ClassHandler
Gets the content widget for @self.getFlap()
Gets the flap widget for @self.int
Gets the flap position for @self.int
Gets the fold transition animation duration for @self, in milliseconds.boolean
Gets whether @self is currently folded.int
Gets the fold policy for @self.int
Gets the fold threshold policy for @self.static int
boolean
Gets whether @self is locked.boolean
getModal()
Gets whether @self is modal.static long
static TypeSystem.TypeSize
boolean
Gets whether the flap widget is revealed for @self.Gets the reveal animation spring parameters for @self.double
Gets the current reveal progress for @self.Gets the separator widget for @self.boolean
Gets whether @self can be closed with a swipe gesture.boolean
Gets whether @self can be opened with a swipe gesture.int
Gets the type of animation used for reveal and fold transitions in @self.static long
static TypeSystem.TypeSize
void
setContent
(Widget content) Sets the content widget for @self.void
Sets the flap widget for @self.void
setFlapPosition
(int position) Sets the flap position for @self.void
setFoldDuration
(int duration) Sets the fold transition animation duration for @self, in milliseconds.void
setFoldPolicy
(int policy) Sets the fold policy for @self.void
setFoldThresholdPolicy
(int policy) Sets the fold threshold policy for @self.void
setLocked
(boolean locked) Sets whether @self is locked.void
setModal
(boolean modal) Sets whether @self is modal.void
setRevealFlap
(boolean reveal_flap) Sets whether the flap widget is revealed for @self.void
setRevealParams
(SpringParams params) Sets the reveal animation spring parameters for @self.void
setSeparator
(Widget separator) Sets the separator widget for @self.void
setSwipeToClose
(boolean swipe_to_close) Sets whether @self can be closed with a swipe gesture.void
setSwipeToOpen
(boolean swipe_to_open) Sets whether @self can be opened with a swipe gesture.void
setTransitionType
(int transition_type) Sets the type of animation used for reveal and fold transitions in @self.Methods inherited from class 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, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, 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, 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
Methods inherited from class 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
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Flap
-
Flap
public Flap()Creates a new `AdwFlap`.
-
-
Method Details
-
getClassHandler
-
getContent
Gets the content widget for @self.- Returns:
- the content widget for @self
-
getFlap
Gets the flap widget for @self.- Returns:
- the flap widget for @self
-
getFlapPosition
public int getFlapPosition()Gets the flap position for @self.- Returns:
- the flap position for @self
-
getFoldDuration
public int getFoldDuration()Gets the fold transition animation duration for @self, in milliseconds.- Returns:
- the fold transition duration
-
getFoldPolicy
public int getFoldPolicy()Gets the fold policy for @self.- Returns:
- the fold policy for @self
-
getFoldThresholdPolicy
public int getFoldThresholdPolicy()Gets the fold threshold policy for @self.- Returns:
-
getFolded
public boolean getFolded()Gets whether @self is currently folded.
See [property@Flap:fold-policy].- Returns:
- `TRUE` if @self is currently folded
-
getLocked
public boolean getLocked()Gets whether @self is locked.- Returns:
- `TRUE` if @self is locked
-
getModal
public boolean getModal()Gets whether @self is modal.- Returns:
- `TRUE` if @self is modal
-
getRevealFlap
public boolean getRevealFlap()Gets whether the flap widget is revealed for @self.- Returns:
- `TRUE` if the flap widget is revealed
-
getRevealParams
Gets the reveal animation spring parameters for @self.- Returns:
- the reveal animation parameters
-
getRevealProgress
public double getRevealProgress()Gets the current reveal progress for @self.
0 means fully hidden, 1 means fully revealed.
See [property@Flap:reveal-flap].- Returns:
- the current reveal progress for @self
-
getSeparator
Gets the separator widget for @self.- Returns:
- the separator widget for @self
-
getSwipeToClose
public boolean getSwipeToClose()Gets whether @self can be closed with a swipe gesture.- Returns:
- `TRUE` if @self can be closed with a swipe gesture
-
getSwipeToOpen
public boolean getSwipeToOpen()Gets whether @self can be opened with a swipe gesture.- Returns:
- `TRUE` if @self can be opened with a swipe gesture
-
getTransitionType
public int getTransitionType()Gets the type of animation used for reveal and fold transitions in @self.- Returns:
- the current transition type of @self
-
setContent
Sets the content widget for @self.
It's always displayed when unfolded, and partially visible when folded.- Parameters:
content
- the content widget
-
setFlap
Sets the flap widget for @self.
It's only visible when [property@Flap:reveal-progress] is greater than 0.- Parameters:
flap
- the flap widget
-
setFlapPosition
public void setFlapPosition(int position) Sets the flap position for @self.
If it's set to `GTK_PACK_START`, the flap is displayed before the content,
if `GTK_PACK_END`, it's displayed after the content.- Parameters:
position
- the new value
-
setFoldDuration
public void setFoldDuration(int duration) Sets the fold transition animation duration for @self, in milliseconds.- Parameters:
duration
- the new duration, in milliseconds
-
setFoldPolicy
public void setFoldPolicy(int policy) Sets the fold policy for @self.- Parameters:
policy
- the fold policy
-
setFoldThresholdPolicy
public void setFoldThresholdPolicy(int policy) Sets the fold threshold policy for @self.
If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, flap will only fold when the
children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`, it
will fold as soon as children don't get their natural size.
This can be useful if you have a long ellipsizing label and want to let it
ellipsize instead of immediately folding.- Parameters:
policy
- the policy to use
-
setLocked
public void setLocked(boolean locked) Sets whether @self is locked.
If `FALSE`, folding when the flap is revealed automatically closes it, and
unfolding it when the flap is not revealed opens it. If `TRUE`,
[property@Flap:reveal-flap] value never changes on its own.- Parameters:
locked
- the new value
-
setModal
public void setModal(boolean modal) Sets whether @self is modal.
If `TRUE`, clicking the content widget while flap is revealed, as well as
pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks are
passed through to the content widget.- Parameters:
modal
- whether @self is modal
-
setRevealFlap
public void setRevealFlap(boolean reveal_flap) Sets whether the flap widget is revealed for @self.- Parameters:
reveal_flap
- whether to reveal the flap widget
-
setRevealParams
Sets the reveal animation spring parameters for @self.
The default value is equivalent to:
```c
adw_spring_params_new (1, 0.5, 500)
```- Parameters:
params
- the new parameters
-
setSeparator
Sets the separator widget for @self.
It's displayed between content and flap when there's no shadow to display.
When exactly it's visible depends on the [property@Flap:transition-type]
value.- Parameters:
separator
- the separator widget
-
setSwipeToClose
public void setSwipeToClose(boolean swipe_to_close) Sets whether @self can be closed with a swipe gesture.
The area that can be swiped depends on the [property@Flap:transition-type]
value.- Parameters:
swipe_to_close
- whether @self can be closed with a swipe gesture
-
setSwipeToOpen
public void setSwipeToOpen(boolean swipe_to_open) Sets whether @self can be opened with a swipe gesture.
The area that can be swiped depends on the [property@Flap:transition-type]
value.- Parameters:
swipe_to_open
- whether @self can be opened with a swipe gesture
-
setTransitionType
public void setTransitionType(int transition_type) Sets the type of animation used for reveal and fold transitions in @self.
[property@Flap:flap] is transparent by default, which means the content will
be seen through it with `ADW_FLAP_TRANSITION_TYPE_OVER` transitions; add the
[`.background`](style-classes.html#background) style class to it if this is
unwanted.- Parameters:
transition_type
- the new transition type
-
asSwipeable
Implements interfaceSwipeable
. Call this to get access to interface functions.- Returns:
Swipeable
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWidget
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWidget
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWidget
- Returns:
ConstraintTarget
-
asOrientable
Implements interfaceOrientable
. Call this to get access to interface functions.- Returns:
Orientable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-