Klasse Leaflet

Alle implementierten Schnittstellen:
PointerInterface

public class Leaflet extends Widget
An adaptive container acting like a box or a stack.

<picture>
<source srcset="leaflet-wide-dark.png" media="(prefers-color-scheme: dark)">
<img src="leaflet-wide.png" alt="leaflet-wide">
</picture>
<picture>
<source srcset="leaflet-narrow-dark.png" media="(prefers-color-scheme: dark)">
<img src="leaflet-narrow.png" alt="leaflet-narrow">
</picture>

The `AdwLeaflet` widget can display its children like a [class@Gtk.Box] does
or like a [class@Gtk.Stack] does, adapting to size changes by switching
between the two modes.

When there is enough space the children are displayed side by side, otherwise
only one is displayed and the leaflet is said to be “folded”.
The threshold is dictated by the preferred minimum sizes of the children.
When a leaflet is folded, the children can be navigated using swipe gestures.

The “over” and “under” transition types stack the children one on top of the
other, while the “slide” transition puts the children side by side. While
navigating to a child on the side or below can be performed by swiping the
current child away, navigating to an upper child requires dragging it from
the edge where it resides. This doesn't affect non-dragging swipes.

## CSS nodes

`AdwLeaflet` has a single CSS node with name `leaflet`. The node will get the
style classes `.folded` when it is folded, `.unfolded` when it's not, or none
if it hasn't computed its fold yet.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Leaflet.html

  • Konstruktordetails

  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • append

      @Deprecated public LeafletPage append(@Nonnull Widget child)
      Veraltet.
      Adds a child to @self.
      Parameter:
      child - the widget to add
      Gibt zurück:
      the [class@LeafletPage] for @child
    • getAdjacentChild

      @Deprecated public Widget getAdjacentChild(int direction)
      Veraltet.
      Finds the previous or next navigatable child.

      This will be the same child [method@Leaflet.navigate] or swipe gestures will
      navigate to.

      If there's no child to navigate to, `NULL` will be returned instead.

      See [property@LeafletPage:navigatable].
      Parameter:
      direction - the direction
      Gibt zurück:
      the previous or next child
    • getCanNavigateBack

      @Deprecated public boolean getCanNavigateBack()
      Veraltet.
      Gets whether gestures and shortcuts for navigating backward are enabled.
      Gibt zurück:
      Whether gestures and shortcuts are enabled.
    • getCanNavigateForward

      @Deprecated public boolean getCanNavigateForward()
      Veraltet.
      Gets whether gestures and shortcuts for navigating forward are enabled.
      Gibt zurück:
      Whether gestures and shortcuts are enabled.
    • getCanUnfold

      @Deprecated public boolean getCanUnfold()
      Veraltet.
      Gets whether @self can unfold.
      Gibt zurück:
      whether @self can unfold
    • getChildByName

      @Deprecated public Widget getChildByName(@Nonnull Str name)
      Veraltet.
      Finds the child of @self with @name.

      Returns `NULL` if there is no child with this name.

      See [property@LeafletPage:name].
      Parameter:
      name - the name of the child to find
      Gibt zurück:
      the requested child of @self
    • getChildByName

      @Deprecated public Widget getChildByName(String name)
      Veraltet.
      Finds the child of @self with @name.

      Returns `NULL` if there is no child with this name.

      See [property@LeafletPage:name].
      Parameter:
      name - the name of the child to find
      Gibt zurück:
      the requested child of @self
    • getChildTransitionParams

      @Deprecated public SpringParams getChildTransitionParams()
      Veraltet.
      Gets the child transition spring parameters for @self.
      Gibt zurück:
      the child transition parameters
    • getChildTransitionRunning

      @Deprecated public boolean getChildTransitionRunning()
      Veraltet.
      Gets whether a child transition is currently running for @self.
      Gibt zurück:
      whether a transition is currently running
    • getFoldThresholdPolicy

      @Deprecated public int getFoldThresholdPolicy()
      Veraltet.
      Gets the fold threshold policy for @self.
      Gibt zurück:
      the fold threshold policy
    • getFolded

      @Deprecated public boolean getFolded()
      Veraltet.
      Gets whether @self is folded.

      The leaflet will be folded if the size allocated to it is smaller than the
      sum of the minimum or natural sizes of the children (see
      [property@Leaflet:fold-threshold-policy]), it will be unfolded otherwise.
      Gibt zurück:
      whether @self is folded.
    • getHomogeneous

      @Deprecated public boolean getHomogeneous()
      Veraltet.
      Gets whether @self is homogeneous.
      Gibt zurück:
      whether @self is homogeneous
    • getModeTransitionDuration

      @Deprecated public int getModeTransitionDuration()
      Veraltet.
      Gets the mode transition animation duration for @self.
      Gibt zurück:
      the mode transition duration, in milliseconds.
    • getPage

      @Deprecated public LeafletPage getPage(@Nonnull Widget child)
      Veraltet.
      Returns the [class@LeafletPage] object for @child.
      Parameter:
      child - a child of @self
      Gibt zurück:
      the page object for @child
    • getPages

      @Deprecated public SelectionModel getPages()
      Veraltet.
      Returns a [iface@Gio.ListModel] that contains the pages of the leaflet.

      This can be used to keep an up-to-date view. The model also implements
      [iface@Gtk.SelectionModel] and can be used to track and change the visible
      page.
      Gibt zurück:
      a `GtkSelectionModel` for the leaflet's children
    • getTransitionType

      @Deprecated public int getTransitionType()
      Veraltet.
      Gets the type of animation used for transitions between modes and children.
      Gibt zurück:
      the current transition type of @self
    • getVisibleChild

      @Deprecated public Widget getVisibleChild()
      Veraltet.
      Gets the widget currently visible when the leaflet is folded.
      Gibt zurück:
      the visible child
    • getVisibleChildName

      @Deprecated public Str getVisibleChildName()
      Veraltet.
      Gets the name of the currently visible child widget.
      Gibt zurück:
      the name of the visible child
    • insertChildAfter

      @Deprecated public LeafletPage insertChildAfter(@Nonnull Widget child, @Nullable Widget sibling)
      Veraltet.
      Inserts @child in the position after @sibling in the list of children.

      If @sibling is `NULL`, inserts @child at the first position.
      Parameter:
      child - the widget to insert
      sibling - the sibling after which to insert @child
      Gibt zurück:
      the [class@LeafletPage] for @child
    • prepend

      @Deprecated public LeafletPage prepend(@Nonnull Widget child)
      Veraltet.
      Inserts @child at the first position in @self.
      Parameter:
      child - the widget to prepend
      Gibt zurück:
      the [class@LeafletPage] for @child
    • remove

      @Deprecated public void remove(@Nonnull Widget child)
      Veraltet.
      Removes a child widget from @self.
      Parameter:
      child - the child to remove
    • reorderChildAfter

      @Deprecated public void reorderChildAfter(@Nonnull Widget child, @Nullable Widget sibling)
      Veraltet.
      Moves @child to the position after @sibling in the list of children.

      If @sibling is `NULL`, moves @child to the first position.
      Parameter:
      child - the widget to move, must be a child of @self
      sibling - the sibling to move @child after
    • setCanNavigateBack

      @Deprecated public void setCanNavigateBack(boolean can_navigate_back)
      Veraltet.
      Sets whether gestures and shortcuts for navigating backward are enabled.

      The supported gestures are:

      - One-finger swipe on touchscreens
      - Horizontal scrolling on touchpads (usually two-finger swipe)
      - Back/forward mouse buttons

      The keyboard back/forward keys are also supported, as well as the
      <kbd>Alt</kbd>+<kbd>←</kbd> shortcut for horizontal orientation, or
      <kbd>Alt</kbd>+<kbd>↑</kbd> for vertical orientation.

      If the orientation is horizontal, for right-to-left locales, gestures and
      shortcuts are reversed.

      Only children that have [property@LeafletPage:navigatable] set to `TRUE` can
      be navigated to.
      Parameter:
      can_navigate_back - the new value
    • setCanNavigateForward

      @Deprecated public void setCanNavigateForward(boolean can_navigate_forward)
      Veraltet.
      Sets whether gestures and shortcuts for navigating forward are enabled.

      The supported gestures are:

      - One-finger swipe on touchscreens
      - Horizontal scrolling on touchpads (usually two-finger swipe)
      - Back/forward mouse buttons

      The keyboard back/forward keys are also supported, as well as the
      <kbd>Alt</kbd>+<kbd>→</kbd> shortcut for horizontal orientation, or
      <kbd>Alt</kbd>+<kbd>↓</kbd> for vertical orientation.

      If the orientation is horizontal, for right-to-left locales, gestures and
      shortcuts are reversed.

      Only children that have [property@LeafletPage:navigatable] set to `TRUE` can
      be navigated to.
      Parameter:
      can_navigate_forward - the new value
    • setCanUnfold

      @Deprecated public void setCanUnfold(boolean can_unfold)
      Veraltet.
      Sets whether @self can unfold.
      Parameter:
      can_unfold - whether @self can unfold
    • setChildTransitionParams

      @Deprecated public void setChildTransitionParams(@Nonnull SpringParams params)
      Veraltet.
      Sets the child transition spring parameters for @self.

      The default value is equivalent to:

      ```c
      adw_spring_params_new (1, 0.5, 500)
      ```
      Parameter:
      params - the new parameters
    • setFoldThresholdPolicy

      @Deprecated public void setFoldThresholdPolicy(int policy)
      Veraltet.
      Sets the fold threshold policy for @self.

      If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it 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.
      Parameter:
      policy - the policy to use
    • setHomogeneous

      @Deprecated public void setHomogeneous(boolean homogeneous)
      Veraltet.
      Sets @self to be homogeneous or not.

      If set to `FALSE`, different children can have different size along the
      opposite orientation.
      Parameter:
      homogeneous - whether to make @self homogeneous
    • setModeTransitionDuration

      @Deprecated public void setModeTransitionDuration(int duration)
      Veraltet.
      Sets the mode transition animation duration for @self.
      Parameter:
      duration - the new duration, in milliseconds
    • setTransitionType

      @Deprecated public void setTransitionType(int transition)
      Veraltet.
      Sets the type of animation used for transitions between modes and children.

      The transition type can be changed without problems at runtime, so it is
      possible to change the animation based on the mode or child that is about to
      become current.
      Parameter:
      transition - the new transition type
    • setVisibleChild

      @Deprecated public void setVisibleChild(@Nonnull Widget visible_child)
      Veraltet.
      Sets the widget currently visible when the leaflet is folded.

      The transition is determined by [property@Leaflet:transition-type] and
      [property@Leaflet:child-transition-params]. The transition can be cancelled
      by the user, in which case visible child will change back to the previously
      visible child.
      Parameter:
      visible_child - the new child
    • setVisibleChildName

      @Deprecated public void setVisibleChildName(@Nonnull Str name)
      Veraltet.
      Makes the child with the name @name visible.

      See [property@Leaflet:visible-child].
      Parameter:
      name - the name of a child
    • setVisibleChildName

      @Deprecated public void setVisibleChildName(String name)
      Veraltet.
      Makes the child with the name @name visible.

      See [property@Leaflet:visible-child].
      Parameter:
      name - the name of a child
    • asSwipeable

      public Swipeable asSwipeable()
      Implements interface Swipeable. Call this to get access to interface functions.
      Gibt zurück:
      Swipeable
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Setzt außer Kraft:
      asAccessible in Klasse Widget
      Gibt zurück:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Setzt außer Kraft:
      asBuildable in Klasse Widget
      Gibt zurück:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Setzt außer Kraft:
      asConstraintTarget in Klasse Widget
      Gibt zurück:
      ConstraintTarget
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Gibt zurück:
      Orientable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()