Class TabView.Builder<B extends TabView.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Enclosing class:
TabView

public static class TabView.Builder<B extends TabView.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public TabView build()
      Finish building the TabView object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to TabView.
      Overrides:
      build in class Widget.Builder<B extends TabView.Builder<B>>
      Returns:
      a new instance of TabView with the properties that were set in the Builder object.
    • setDefaultIcon

      public B setDefaultIcon(Icon defaultIcon)

      Default page icon.

      If a page doesn't provide its own icon via TabPage:icon, a default icon may be used instead for contexts where having an icon is necessary.

      TabBar will use default icon for pinned tabs in case the page is not loading, doesn't have an icon and an indicator. Default icon is never used for tabs that aren't pinned.

      TabOverview will use default icon for pages with missing thumbnails.

      By default, the adw-tab-icon-missing-symbolic icon is used.

      Parameters:
      defaultIcon - the value for the default-icon property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMenuModel

      public B setMenuModel(MenuModel menuModel)

      Tab context menu model.

      When a context menu is shown for a tab, it will be constructed from the provided menu model. Use the TabView::setup-menu signal to set up the menu actions for the particular tab.

      Parameters:
      menuModel - the value for the menu-model property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSelectedPage

      public B setSelectedPage(TabPage selectedPage)
      The currently selected page.
      Parameters:
      selectedPage - the value for the selected-page property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShortcuts

      public B setShortcuts(Set<TabViewShortcuts> shortcuts)

      The enabled shortcuts.

      See TabViewShortcuts for the list of the available shortcuts. All of the shortcuts are enabled by default.

      TabView.addShortcuts(Set) and TabView.removeShortcuts(Set) provide a convenient way to manage individual shortcuts.

      Parameters:
      shortcuts - the value for the shortcuts property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.2
    • setShortcuts

      public B setShortcuts(TabViewShortcuts... shortcuts)

      The enabled shortcuts.

      See TabViewShortcuts for the list of the available shortcuts. All of the shortcuts are enabled by default.

      TabView.addShortcuts(Set) and TabView.removeShortcuts(Set) provide a convenient way to manage individual shortcuts.

      Parameters:
      shortcuts - the value for the shortcuts property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.2
    • onClosePage

      public B onClosePage(TabView.ClosePageCallback handler)

      Emitted after TabView.closePage(TabPage) has been called for page.

      The handler is expected to call TabView.closePageFinish(TabPage, boolean) to confirm or reject the closing.

      The default handler will immediately confirm closing for non-pinned pages, or reject it for pinned pages, equivalent to the following example:

      static gboolean
      close_page_cb (AdwTabView *view,
                     AdwTabPage *page,
                     gpointer    user_data)
      {
        adw_tab_view_close_page_finish (view, page, !adw_tab_page_get_pinned (page));
      
        return GDK_EVENT_STOP;
      }
      

      The TabView.closePageFinish(TabPage, boolean) call doesn't have to happen inside the handler, so can be used to do asynchronous checks before confirming the closing.

      A typical reason to connect to this signal is to show a confirmation dialog for closing a tab.

      The signal handler should return Gdk.EVENT_STOP to stop propagation or Gdk.EVENT_PROPAGATE to invoke the default handler.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onCreateWindow

      public B onCreateWindow(TabView.CreateWindowCallback handler)

      Emitted when a tab should be transferred into a new window.

      This can happen after a tab has been dropped on desktop.

      The signal handler is expected to create a new window, position it as needed and return its AdwTabView that the page will be transferred into.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onIndicatorActivated

      public B onIndicatorActivated(TabView.IndicatorActivatedCallback handler)

      Emitted after the indicator icon on page has been activated.

      See TabPage:indicator-icon and TabPage:indicator-activatable.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPageAttached

      public B onPageAttached(TabView.PageAttachedCallback handler)

      Emitted when a page has been created or transferred to self.

      A typical reason to connect to this signal would be to connect to page signals for things such as updating window title.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPageDetached

      public B onPageDetached(TabView.PageDetachedCallback handler)

      Emitted when a page has been removed or transferred to another view.

      A typical reason to connect to this signal would be to disconnect signal handlers connected in the TabView::page-attached handler.

      It is important not to try and destroy the page child in the handler of this function as the child might merely be moved to another window; use child dispose handler for that or do it in sync with your TabView.closePageFinish(TabPage, boolean) calls.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPageReordered

      public B onPageReordered(TabView.PageReorderedCallback handler)
      Emitted after page has been reordered to position.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onSetupMenu

      public B onSetupMenu(TabView.SetupMenuCallback handler)

      Emitted when a context menu is opened or closed for page.

      If the menu has been closed, page will be set to NULL.

      It can be used to set up menu actions before showing the menu, for example disable actions not applicable to page.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: