Adw.TabBar

g Adw.TabBar Adw.TabBar GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.TabBar

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_autohide ()

get_end_action_widget ()

get_expand_tabs ()

get_extra_drag_preferred_action ()

get_extra_drag_preload ()

get_inverted ()

get_is_overflowing ()

get_start_action_widget ()

get_tabs_revealed ()

get_view ()

set_autohide (autohide)

set_end_action_widget (widget)

set_expand_tabs (expand_tabs)

set_extra_drag_preload (preload)

set_inverted (inverted)

set_start_action_widget (widget)

set_view (view)

setup_extra_drop_target (actions, types)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

autohide

bool

r/w/en

end-action-widget

Gtk.Widget

r/w/en

expand-tabs

bool

r/w/en

extra-drag-preferred-action

Gdk.DragAction

r/en

extra-drag-preload

bool

r/w/en

inverted

bool

r/w/en

is-overflowing

bool

r

start-action-widget

Gtk.Widget

r/w/en

tabs-revealed

bool

r

view

Adw.TabView

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

extra-drag-drop

This signal is emitted when content is dropped onto a tab.

extra-drag-value

This signal is emitted when the dropped content is preloaded.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.TabBar(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Adw.TabBarClass

A tab bar for [class`TabView`].

<picture> <source srcset=”tab-bar-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”tab-bar.png” alt=”tab-bar”> </picture>

The AdwTabBar widget is a tab bar that can be used with conjunction with AdwTabView. It is typically used as a top bar within [class`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.

CSS nodes

AdwTabBar has a single CSS node with name tabbar.

classmethod new()
Returns:

the newly created AdwTabBar

Return type:

Adw.TabBar

Creates a new AdwTabBar.

get_autohide()
Returns:

whether the tabs automatically hide

Return type:

bool

Gets whether the tabs automatically hide.

get_end_action_widget()
Returns:

the widget shown after the tabs

Return type:

Gtk.Widget or None

Gets the widget shown after the tabs.

get_expand_tabs()
Returns:

whether tabs expand to full width.

Return type:

bool

Gets whether tabs expand to full width.

get_extra_drag_preferred_action()
Returns:

the drag action of the current drop.

Return type:

Gdk.DragAction

Gets the current action during a drop on the extra_drop_target.

New in version 1.4.

get_extra_drag_preload()
Returns:

whether drop data should be preloaded on hover

Return type:

bool

Gets whether drop data should be preloaded on hover.

New in version 1.3.

get_inverted()
Returns:

whether tabs use inverted layout

Return type:

bool

Gets whether tabs use inverted layout.

get_is_overflowing()
Returns:

whether self is overflowing

Return type:

bool

Gets whether self is overflowing.

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

get_start_action_widget()
Returns:

the widget shown before the tabs

Return type:

Gtk.Widget or None

Gets the widget shown before the tabs.

get_tabs_revealed()
Returns:

whether the tabs are currently revealed

Return type:

bool

Gets whether the tabs are currently revealed.

See [property`TabBar`:py:data::autohide<Adw.TabBar.props.autohide>].

get_view()
Returns:

the view self controls

Return type:

Adw.TabView or None

Gets the tab view self controls.

set_autohide(autohide)
Parameters:

autohide (bool) – whether the tabs automatically hide

Sets whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when [property`TabBar`:py:data::view<Adw.TabBar.props.view>] has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See [property`TabBar`:py:data::tabs-revealed<Adw.TabBar.props.tabs_revealed>].

set_end_action_widget(widget)
Parameters:

widget (Gtk.Widget or None) – the widget to show after the tabs

Sets the widget to show after the tabs.

set_expand_tabs(expand_tabs)
Parameters:

expand_tabs (bool) – whether to 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.

set_extra_drag_preload(preload)
Parameters:

preload (bool) – whether to preload drop data

Sets whether drop data should be preloaded on hover.

See [property`Gtk`.DropTarget:preload].

New in version 1.3.

set_inverted(inverted)
Parameters:

inverted (bool) – whether tabs use inverted layout

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.

set_start_action_widget(widget)
Parameters:

widget (Gtk.Widget or None) – the widget to show before the tabs

Sets the widget to show before the tabs.

set_view(view)
Parameters:

view (Adw.TabView or None) – a tab view

Sets the tab view self controls.

setup_extra_drop_target(actions, types)
Parameters:

Sets the supported types for this drop target.

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 [signal`TabBar`:py:func:::extra-drag-drop<Adw.TabBar.signals.extra_drag_drop>] signal can be used to handle the drop.

Signal Details

Adw.TabBar.signals.extra_drag_drop(tab_bar, page, value)
Signal Name:

extra-drag-drop

Flags:

RUN_LAST

Parameters:
  • tab_bar (Adw.TabBar) – The object which received the signal

  • page (Adw.TabPage) – the page matching the tab the content was dropped onto

  • value (GObject.Value) – the GValue being dropped

Returns:

whether the drop was accepted for page

Return type:

bool

This signal is emitted when content is dropped onto a tab.

The content must be of one of the types set up via [method`TabBar`.setup_extra_drop_target].

See [signal`Gtk`.DropTarget::drop].

Adw.TabBar.signals.extra_drag_value(tab_bar, page, value)
Signal Name:

extra-drag-value

Flags:

RUN_LAST

Parameters:
  • tab_bar (Adw.TabBar) – The object which received the signal

  • page (Adw.TabPage) – the page matching the tab the content was dropped onto

  • value (GObject.Value) – the GValue being dropped

Returns:

the preferred action for the drop on page

Return type:

Gdk.DragAction

This signal is emitted when the dropped content is preloaded.

In order for data to be preloaded, [property`TabBar`:py:data::extra-drag-preload<Adw.TabBar.props.extra_drag_preload>] must be set to TRUE.

The content must be of one of the types set up via [method`TabBar`.setup_extra_drop_target].

See [property`Gtk`.DropTarget:value].

New in version 1.3.

Property Details

Adw.TabBar.props.autohide
Name:

autohide

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when [property`TabBar`:py:data::view<Adw.TabBar.props.view>] has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See [property`TabBar`:py:data::tabs-revealed<Adw.TabBar.props.tabs_revealed>].

Adw.TabBar.props.end_action_widget
Name:

end-action-widget

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The widget shown after the tabs.

Adw.TabBar.props.expand_tabs
Name:

expand-tabs

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Adw.TabBar.props.extra_drag_preferred_action
Name:

extra-drag-preferred-action

Type:

Gdk.DragAction

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

The unique action on the current-drop of the [signal`TabBar`:py:func:::extra-drag-drop<Adw.TabBar.signals.extra_drag_drop>].

This property should only be used during a [signal`TabBar`:py:func:::extra-drag-drop<Adw.TabBar.signals.extra_drag_drop>] and is always a subset of what was originally passed to [method`TabBar`.setup_extra_drop_target].

New in version 1.4.

Adw.TabBar.props.extra_drag_preload
Name:

extra-drag-preload

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the drop data should be preloaded on hover.

See [property`Gtk`.DropTarget:preload].

New in version 1.3.

Adw.TabBar.props.inverted
Name:

inverted

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Adw.TabBar.props.is_overflowing
Name:

is-overflowing

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the tab bar is overflowing.

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

Adw.TabBar.props.start_action_widget
Name:

start-action-widget

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The widget shown before the tabs.

Adw.TabBar.props.tabs_revealed
Name:

tabs-revealed

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the tabs are currently revealed.

See [property`TabBar`:py:data::autohide<Adw.TabBar.props.autohide>].

Adw.TabBar.props.view
Name:

view

Type:

Adw.TabView

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The tab view the tab bar controls.