1.61 <AdwTabBar>

Class: <AdwTabBar>

It derives from <GtkWidget>.

A tab bar for TabView.

The <AdwTabBar> widget is a tab bar that can be used with conjunction with <AdwTabView>. It is typically used as a top bar within ToolbarView.

<AdwTabBar> can autohide and can optionally contain action widgets on both sides of the tabs.

When there’s not enough space to show all the tabs, <AdwTabBar> will scroll them. Pinned tabs always stay visible and aren’t a part of the scrollable area.

Drag-and-Drop

<AdwTabBar> tabs can have an additional drop target for arbitrary content.

Use TabBar.setup_extra_drop_target to set it up, specifying the supported content types and drag actions, then connect to "extra-drag-drop" to handle a drop.

In some cases, it may be necessary to determine the used action based on the content. In that case, set TabBar:extra-drag-preload to TRUE and connect to "extra-drag-value" signal, then return the action from its handler. To access this action from the "extra-drag-drop" handler, use the TabBar:extra-drag-preferred-action property.

"extra-drag-value" is also always emitted when starting to hover an item, with a NULL value. This happens even when TabBar:extra-drag-preload is FALSE.

CSS nodes

<AdwTabBar> has a single CSS node with name tabbar.

Style classes

By default <AdwTabBar> look like a part of an <AdwHeaderBar> and is intended to be used directly attached to one or used as a ToolbarView toolbar. The ‘.inline‘ style class removes its background, so that it can be used in different contexts instead.

Properties

Property: tab-bar:autohide self

Whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when TabBar:view has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See TabBar:tabs-revealed.

Its value is a boolean.

Set it with (set! (tab-bar:autohide self) value).

Property: tab-bar:end-action-widget self

The widget shown after the tabs.

Its value is a <GtkWidget>, or #f.

Set it with (set! (tab-bar:end-action-widget self) value).

Property: tab-bar:expand-tabs self

Whether tabs expand to full width.

If set to TRUE, the tabs will always vary width filling the whole width when possible, otherwise tabs will always have the minimum possible size.

Its value is a boolean.

Set it with (set! (tab-bar:expand-tabs self) value).

Property: tab-bar:extra-drag-preferred-action self

The current drag action during a drop.

This property should only be used from inside a "extra-drag-drop" handler.

The action will be a subset of what was originally passed to TabBar.setup_extra_drop_target.

Its value is a <GdkDragAction>.

It is read only.

Property: tab-bar:extra-drag-preload self

Whether the drop data should be preloaded on hover.

See drop-target:preload.

Its value is a boolean.

Set it with (set! (tab-bar:extra-drag-preload self) value).

Property: tab-bar:inverted self

Whether tabs use inverted layout.

If set to TRUE, non-pinned tabs will have the close button at the beginning and the indicator at the end rather than the opposite.

Its value is a boolean.

Set it with (set! (tab-bar:inverted self) value).

Property: tab-bar:is-overflowing self

Whether the tab bar is overflowing.

If TRUE, all tabs cannot be displayed at once and require scrolling.

Its value is a boolean.

It is read only.

Property: tab-bar:start-action-widget self

The widget shown before the tabs.

Its value is a <GtkWidget>, or #f.

Set it with (set! (tab-bar:start-action-widget self) value).

Property: tab-bar:tabs-revealed self

Whether the tabs are currently revealed.

See TabBar:autohide.

Its value is a boolean.

It is read only.

Property: tab-bar:view self

The tab view the tab bar controls.

Its value is a <AdwTabView>, or #f.

Set it with (set! (tab-bar:view self) value).

Procedures

Method: tab-bar:get-autohide? self ⇒ %return
Method: get-autohide? self ⇒ %return

Gets whether the tabs automatically hide.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether the tabs automatically hide

Method: tab-bar:get-end-action-widget self ⇒ %return
Method: get-end-action-widget self ⇒ %return

Gets the widget shown after the tabs.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a <GtkWidget>, or #f.

the widget shown after the tabs

Method: tab-bar:get-expand-tabs? self ⇒ %return
Method: get-expand-tabs? self ⇒ %return

Gets whether tabs expand to full width.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether tabs expand to full width.

Method: tab-bar:get-extra-drag-preferred-action self ⇒ %return
Method: get-extra-drag-preferred-action self ⇒ %return

Gets the current drag action during a drop.

This method should only be used from inside a "extra-drag-drop" handler.

The action will be a subset of what was originally passed to TabBar.setup_extra_drop_target.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a <GdkDragAction>.

the drag action of the current drop

Method: tab-bar:get-extra-drag-preload? self ⇒ %return
Method: get-extra-drag-preload? self ⇒ %return

Gets whether drop data should be preloaded on hover.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether drop data should be preloaded on hover

Method: tab-bar:get-inverted? self ⇒ %return
Method: get-inverted? self ⇒ %return

Gets whether tabs use inverted layout.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether tabs use inverted layout

Method: tab-bar:get-is-overflowing? self ⇒ %return
Method: get-is-overflowing? self ⇒ %return

Gets whether self is overflowing.

If TRUE, all tabs cannot be displayed at once and require scrolling.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether self is overflowing

Method: tab-bar:get-start-action-widget self ⇒ %return
Method: get-start-action-widget self ⇒ %return

Gets the widget shown before the tabs.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a <GtkWidget>, or #f.

the widget shown before the tabs

Method: tab-bar:get-tabs-revealed? self ⇒ %return
Method: get-tabs-revealed? self ⇒ %return

Gets whether the tabs are currently revealed.

See TabBar:autohide.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a boolean.

whether the tabs are currently revealed

Method: tab-bar:get-view self ⇒ %return
Method: get-view self ⇒ %return

Gets the tab view self controls.

self

Passed: a <AdwTabBar>.

a tab bar

%return

Returned: a <AdwTabView>, or #f.

the view self controls

Procedure: tab-bar:new ⇒ %return

Creates a new <AdwTabBar>.

%return

Returned: a <AdwTabBar>.

the newly created <AdwTabBar>

Method: tab-bar:set-autohide self autohide
Method: set-autohide self autohide

Sets whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when TabBar:view has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See TabBar:tabs-revealed.

self

Passed: a <AdwTabBar>.

a tab bar

autohide

Passed: a boolean.

whether the tabs automatically hide

Method: tab-bar:set-end-action-widget self [widget]
Method: set-end-action-widget self [widget]

Sets the widget to show after the tabs.

self

Passed: a <AdwTabBar>.

a tab bar

widget

Passed, or left out: a <GtkWidget>, or #f.

the widget to show after the tabs

Method: tab-bar:set-expand-tabs self expand-tabs
Method: set-expand-tabs self expand-tabs

Sets whether tabs expand to full width.

If set to TRUE, the tabs will always vary width filling the whole width when possible, otherwise tabs will always have the minimum possible size.

self

Passed: a <AdwTabBar>.

a tab bar

expand-tabs

Passed: a boolean.

whether to expand tabs

Method: tab-bar:set-extra-drag-preload self preload
Method: set-extra-drag-preload self preload

Sets whether drop data should be preloaded on hover.

See drop-target:preload.

self

Passed: a <AdwTabBar>.

a tab bar

preload

Passed: a boolean.

whether to preload drop data

Method: tab-bar:set-inverted self inverted
Method: set-inverted self inverted

Sets whether tabs tabs use inverted layout.

If set to TRUE, non-pinned tabs will have the close button at the beginning and the indicator at the end rather than the opposite.

self

Passed: a <AdwTabBar>.

a tab bar

inverted

Passed: a boolean.

whether tabs use inverted layout

Method: tab-bar:set-start-action-widget self [widget]
Method: set-start-action-widget self [widget]

Sets the widget to show before the tabs.

self

Passed: a <AdwTabBar>.

a tab bar

widget

Passed, or left out: a <GtkWidget>, or #f.

the widget to show before the tabs

Method: tab-bar:set-view self [view]
Method: set-view self [view]

Sets the tab view self controls.

self

Passed: a <AdwTabBar>.

a tab bar

view

Passed, or left out: a <AdwTabView>, or #f.

a tab view

Method: tab-bar:setup-extra-drop-target self actions types
Method: setup-extra-drop-target self actions types

Sets up an extra drop target on tabs.

This allows to drag arbitrary content onto tabs, for example URLs in a web browser.

If a tab is hovered for a certain period of time while dragging the content, it will be automatically selected.

The "extra-drag-drop" signal can be used to handle the drop.

self

Passed: a <AdwTabBar>.

a tab bar

actions

Passed: a <GdkDragAction>, or a list of its symbols, or one of them.

the supported actions

types

Passed: a list or vector, each a class, or a GType number, or #f.

all supported GTypes that can be dropped

n-types

Not passed: guile-gi gives the length of types.

number of types

Signals

Signal: tab-bar:extra-drag-drop

Connect a handler with (connect object tab-bar:extra-drag-drop handler). It is called as (handler self page value) ⇒ %return.

Emitted when content is dropped onto a tab.

The content must be of one of the types set up via TabBar.setup_extra_drop_target.

See drop-target:drop.

self

Passed: a <AdwTabBar>.

page

Passed: a <AdwTabPage>.

the page matching the tab the content was dropped onto

value

Passed: a <GValue>.

the <GValue> being dropped

%return

Returned: a boolean.

whether the drop was accepted

Signal: tab-bar:extra-drag-value

Connect a handler with (connect object tab-bar:extra-drag-value handler). It is called as (handler self page value) ⇒ %return.

Emitted when the dropped content is preloaded.

In order for data to be preloaded, TabBar:extra-drag-preload must be set to TRUE.

The content must be of one of the types set up via TabBar.setup_extra_drop_target.

See drop-target:value.

self

Passed: a <AdwTabBar>.

page

Passed: a <AdwTabPage>.

the page matching the tab the content was dropped onto

value

Passed: a <GValue>, or #f.

the <GValue> being dropped

%return

Returned: a <GdkDragAction>, or a list of its symbols, or one of them.

the preferred action for the drop