Class NavigationPage

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class NavigationPage extends Widget implements Accessible, Buildable, ConstraintTarget

A page within NavigationView or NavigationSplitView.

Each page has a child widget, a title and optionally a tag.

The NavigationPage::showing, NavigationPage::shown, NavigationPage::hiding and NavigationPage::hidden signals can be used to track the page's visibility within its AdwNavigationView.

Header Bar Integration

When placed inside AdwNavigationPage, HeaderBar will display the page title instead of window title.

When used together with NavigationView, it will also display a back button that can be used to go back to the previous page. Set HeaderBar:show-back-button to FALSE to disable that behavior if it's unwanted.

CSS Nodes

AdwNavigationPage has a single CSS node with name navigation-view-page.

Accessibility

AdwNavigationPage uses the Gtk.AccessibleRole.group role.

Since:
1.4
  • Constructor Details

    • NavigationPage

      public NavigationPage(MemorySegment address)
      Create a NavigationPage instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • NavigationPage

      public NavigationPage(Widget child, String title)
      Creates a new AdwNavigationPage.
      Parameters:
      child - the child widget
      title - the page title
      Since:
      1.4
    • NavigationPage

      public NavigationPage()
      Create a new NavigationPage.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the NavigationPage class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected NavigationPage asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • withTag

      public static NavigationPage withTag(Widget child, String title, String tag)
      Creates a new AdwNavigationPage with provided tag.
      Parameters:
      child - the child widget
      title - the page title
      tag - the page tag
      Returns:
      the new created AdwNavigationPage
      Since:
      1.4
    • getCanPop

      public boolean getCanPop()
      Gets whether this NavigationPage can be popped from navigation stack.
      Returns:
      whether the page can be popped from navigation stack
      Since:
      1.4
    • getChild

      public @Nullable Widget getChild()
      Gets the child widget of self.
      Returns:
      the child widget of this NavigationPage
      Since:
      1.4
    • getTag

      public @Nullable String getTag()
      Gets the tag of self.
      Returns:
      the page tag
      Since:
      1.4
    • getTitle

      public String getTitle()
      Gets the title of self.
      Returns:
      the title of this NavigationPage
      Since:
      1.4
    • setCanPop

      public void setCanPop(boolean canPop)

      Sets whether this NavigationPage can be popped from navigation stack.

      Set it to FALSE to disable shortcuts and gestures, as well as remove the back button from HeaderBar.

      Manually calling NavigationView.pop() or using the navigation.pop action will still work.

      See HeaderBar:show-back-button for removing only the back button, but not shortcuts.

      Parameters:
      canPop - whether the page can be popped from navigation stack
      Since:
      1.4
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of self.
      Parameters:
      child - the child widget
      Since:
      1.4
    • setTag

      public void setTag(@Nullable String tag)

      Sets the tag for self.

      The tag can be used to retrieve the page with NavigationView.findPage(String), as well as with NavigationView.pushByTag(String), NavigationView.popToTag(String) or NavigationView.replaceWithTags(String[]).

      Tags must be unique within each NavigationView.

      The tag also must be set to use the navigation.push action.

      Parameters:
      tag - the page tag
      Since:
      1.4
    • setTitle

      public void setTitle(String title)

      Sets the title of self.

      It's displayed in HeaderBar instead of the window title, and used as the tooltip on the next page's back button, as well as by screen reader.

      Parameters:
      title - the title
      Since:
      1.4
    • hidden

      protected void hidden()
      Called when the navigation view transition has been completed and the page is fully hidden.
      Since:
      1.4
    • hiding

      protected void hiding()
      Called when the page starts hiding at the beginning of the navigation view transition.
      Since:
      1.4
    • showing

      protected void showing()
      Called when the page shows at the beginning of the navigation view transition.
      Since:
      1.4
    • shown

      protected void shown()
      Called when the navigation view transition has been completed and the page is fully shown.
      Since:
      1.4
    • onHidden

      Emitted when the navigation view transition has been completed and the page is fully hidden.

      It will always be preceded by NavigationPage::hiding or NavigationPage::showing.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.4
      See Also:
    • emitHidden

      public void emitHidden()
      Emits the "hidden" signal. See onHidden(NavigationPage.HiddenCallback).
    • onHiding

      Emitted when the page starts hiding at the beginning of the navigation view transition.

      It will always be followed by NavigationPage::hidden or NavigationPage::shown.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.4
      See Also:
    • emitHiding

      public void emitHiding()
      Emits the "hiding" signal. See onHiding(NavigationPage.HidingCallback).
    • onShowing

      Emitted when the page shows at the beginning of the navigation view transition.

      It will always be followed by NavigationPage::shown or NavigationPage::hidden.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.4
      See Also:
    • emitShowing

      public void emitShowing()
      Emits the "showing" signal. See onShowing(NavigationPage.ShowingCallback).
    • onShown

      Emitted when the navigation view transition has been completed and the page is fully shown.

      It will always be preceded by NavigationPage::showing or NavigationPage::hiding.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.4
      See Also:
    • emitShown

      public void emitShown()
      Emits the "shown" signal. See onShown(NavigationPage.ShownCallback).
    • builder

      public static NavigationPage.Builder<? extends NavigationPage.Builder> builder()
      A NavigationPage.Builder object constructs a NavigationPage with the specified properties. Use the various set...() methods to set properties, and finish construction with NavigationPage.Builder.build().
      Returns:
      the builder object