Next: <AdwNavigationView>, Previous: <AdwNavigationPage>, Up: Classes   [Index]


1.35 <AdwNavigationSplitView> ¶

Class: <AdwNavigationSplitView> ¶

It derives from <GtkWidget>.

A widget presenting sidebar and content side by side or as a navigation view.

<AdwNavigationSplitView> has two NavigationPage children: sidebar and content, and displays them side by side.

When NavigationSplitView:collapsed is set to TRUE, it instead puts both children inside an NavigationView. The NavigationSplitView:show-content controls which child is visible while collapsed.

See also OverlaySplitView.

<AdwNavigationSplitView> is typically used together with an Breakpoint setting the collapsed property to TRUE on small widths, as follows:

<object class="AdwWindow">
  <property name="default-width">800</property>
  <property name="default-height">800</property>
  <child>
    <object class="AdwBreakpoint">
      <condition>max-width: 400sp</condition>
      <setter object="split_view" property="collapsed">True</setter>
    </object>
  </child>
  <property name="content">
    <object class="AdwNavigationSplitView" id="split_view">
      <property name="sidebar">
        <object class="AdwNavigationPage">
          <property name="title" translatable="yes">Sidebar</property>
          <property name="child">
            <!-- ... -->
          </property>
        </object>
      </property>
      <property name="content">
        <object class="AdwNavigationPage">
          <property name="title" translatable="yes">Content</property>
          <property name="child">
            <!-- ... -->
          </property>
        </object>
      </property>
    </object>
  </property>
</object>

Sizing ¶

When not collapsed, <AdwNavigationSplitView> changes the sidebar width depending on its own width.

If possible, it tries to allocate a fraction of the total width, controlled with the NavigationSplitView:sidebar-width-fraction property.

The sidebar also has minimum and maximum sizes, controlled with the NavigationSplitView:min-sidebar-width and NavigationSplitView:max-sidebar-width properties.

The minimum and maximum sizes are using the length unit specified with the NavigationSplitView:sidebar-width-unit.

By default, sidebar is using 25% of the total width, with 180sp as the minimum size and 280sp as the maximum size.

Header Bar Integration ¶

When used inside <AdwNavigationSplitView>, HeaderBar will automatically hide the window buttons in the middle.

When collapsed, it also displays a back button for the content widget, as well as the page titles. See NavigationView documentation for details.

Actions ¶

<AdwNavigationSplitView> defines the same actions as <AdwNavigationView>, but they can be used even when the split view is not collapsed:

  • navigation.push takes a string parameter specifying the tag of the page to push. If it matches the tag of the content widget, it sets NavigationSplitView:show-content to TRUE.
  • navigation.pop doesn’t take any parameters and sets NavigationSplitView:show-content to FALSE.

‘AdwNavigationSplitView‘ as ‘GtkBuildable‘ ¶

The <AdwNavigationSplitView> implementation of the <GtkBuildable> interface supports setting the sidebar widget by specifying “sidebar” as the “type” attribute of a <child> element, Specifying “content” child type or omitting it results in setting the content widget.

CSS nodes ¶

<AdwNavigationSplitView> has a single CSS node with the name navigation-split-view.

When collapsed, it contains a child node with the name navigation-view containing both children.

navigation-split-view
╰── navigation-view
    ├── [sidebar child]
    ╰── [content child]

When not collapsed, it contains two nodes with the name widget, one with the .sidebar-pane style class, the other one with .content-view style class, containing the sidebar and content children respectively.

navigation-split-view
├── widget.sidebar-pane
│   ╰── [sidebar child]
╰── widget.content-pane
    ╰── [content child]

Accessibility ¶

<AdwNavigationSplitView> uses the Gtk.AccessibleRole.group role.

Properties ¶

Property: navigation-split-view:collapsed self ¶

Whether the split view is collapsed.

When collapsed, the children are put inside an NavigationView, otherwise they are displayed side by side.

The NavigationSplitView:show-content controls which child is visible while collapsed.

Its value is a boolean.

Set it with (set! (navigation-split-view:collapsed self) value).

Property: navigation-split-view:content self ¶

The content widget.

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

Set it with (set! (navigation-split-view:content self) value).

Property: navigation-split-view:max-sidebar-width self ¶

The maximum sidebar width.

Maximum width is affected by NavigationSplitView:sidebar-width-unit.

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

Its value is a real number.

Set it with (set! (navigation-split-view:max-sidebar-width self) value).

Property: navigation-split-view:min-sidebar-width self ¶

The minimum sidebar width.

Minimum width is affected by NavigationSplitView:sidebar-width-unit.

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

Its value is a real number.

Set it with (set! (navigation-split-view:min-sidebar-width self) value).

Property: navigation-split-view:show-content self ¶

Determines the visible page when collapsed.

If set to TRUE, the content widget will be the visible page when NavigationSplitView:collapsed is TRUE; otherwise the sidebar widget will be visible.

If the split view is already collapsed, the visible page changes immediately.

Its value is a boolean.

Set it with (set! (navigation-split-view:show-content self) value).

Property: navigation-split-view:sidebar self ¶

The sidebar widget.

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

Set it with (set! (navigation-split-view:sidebar self) value).

Property: navigation-split-view:sidebar-position self ¶

The sidebar position.

If set to Gtk.PackType.start, the sidebar is displayed before the content, and the sidebar will be the root page when collapsed.

If set to Gtk.PackType.end, the sidebar is displayed after the content, and the content will be the root page.

Its value is a <GtkPackType> (or, to set it, one of its symbols).

Set it with (set! (navigation-split-view:sidebar-position self) value).

Property: navigation-split-view:sidebar-width-fraction self ¶

The preferred sidebar width as a fraction of the total width.

The preferred width is additionally limited by NavigationSplitView:min-sidebar-width and NavigationSplitView:max-sidebar-width.

The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.

Its value is a real number.

Set it with (set! (navigation-split-view:sidebar-width-fraction self) value).

Property: navigation-split-view:sidebar-width-unit self ¶

The length unit for minimum and maximum sidebar widths.

See NavigationSplitView:min-sidebar-width and NavigationSplitView:max-sidebar-width.

Its value is a <AdwLengthUnit> (or, to set it, one of its symbols).

Set it with (set! (navigation-split-view:sidebar-width-unit self) value).

Procedures ¶

Method: navigation-split-view:get-collapsed? self ⇒ %return ¶
Method: get-collapsed? self ⇒ %return ¶

Gets whether self is collapsed.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a boolean.

whether self is collapsed

Method: navigation-split-view:get-content self ⇒ %return ¶
Method: get-content self ⇒ %return ¶

Sets the content widget for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a <AdwNavigationPage>, or #f.

the content widget

Method: navigation-split-view:get-max-sidebar-width self ⇒ %return ¶
Method: get-max-sidebar-width self ⇒ %return ¶

Gets the maximum sidebar width for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a real number.

the maximum width

Method: navigation-split-view:get-min-sidebar-width self ⇒ %return ¶
Method: get-min-sidebar-width self ⇒ %return ¶

Gets the minimum sidebar width for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a real number.

the minimum width

Method: navigation-split-view:get-show-content? self ⇒ %return ¶
Method: get-show-content? self ⇒ %return ¶

Gets which page is visible when self is collapsed.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a boolean.

whether to show content when collapsed

Method: navigation-split-view:get-sidebar self ⇒ %return ¶
Method: get-sidebar self ⇒ %return ¶

Gets the sidebar widget for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a <AdwNavigationPage>, or #f.

the sidebar widget

Method: navigation-split-view:get-sidebar-position self ⇒ %return ¶
Method: get-sidebar-position self ⇒ %return ¶

Gets the sidebar position for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a <GtkPackType>.

the sidebar position for self

Method: navigation-split-view:get-sidebar-width-fraction self ⇒ %return ¶
Method: get-sidebar-width-fraction self ⇒ %return ¶

Gets the preferred sidebar width fraction for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a real number.

the preferred width fraction

Method: navigation-split-view:get-sidebar-width-unit self ⇒ %return ¶
Method: get-sidebar-width-unit self ⇒ %return ¶

Gets the length unit for minimum and maximum sidebar widths.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

%return

Returned: a <AdwLengthUnit>.

the length unit

Procedure: navigation-split-view:new ⇒ %return ¶

Creates a new <AdwNavigationSplitView>.

%return

Returned: a <GtkWidget>.

the newly created <AdwNavigationSplitView>

Method: navigation-split-view:set-collapsed self collapsed ¶
Method: set-collapsed self collapsed ¶

Sets whether self is collapsed.

When collapsed, the children are put inside an NavigationView, otherwise they are displayed side by side.

The NavigationSplitView:show-content controls which child is visible while collapsed.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

collapsed

Passed: a boolean.

whether self is collapsed

Method: navigation-split-view:set-content self [content] ¶
Method: set-content self [content] ¶

Sets the content widget for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

content

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

the content widget

Method: navigation-split-view:set-max-sidebar-width self width ¶
Method: set-max-sidebar-width self width ¶

Sets the maximum sidebar width for self.

Maximum width is affected by NavigationSplitView:sidebar-width-unit.

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

width

Passed: a real number.

the maximum width

Method: navigation-split-view:set-min-sidebar-width self width ¶
Method: set-min-sidebar-width self width ¶

Sets the minimum sidebar width for self.

Minimum width is affected by NavigationSplitView:sidebar-width-unit.

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

width

Passed: a real number.

the minimum width

Method: navigation-split-view:set-show-content self show-content ¶
Method: set-show-content self show-content ¶

Sets which page is visible when self is collapsed.

If set to TRUE, the content widget will be the visible page when NavigationSplitView:collapsed is TRUE; otherwise the sidebar widget will be visible.

If the split view is already collapsed, the visible page changes immediately.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

show-content

Passed: a boolean.

whether to show content when collapsed

Method: navigation-split-view:set-sidebar self [sidebar] ¶
Method: set-sidebar self [sidebar] ¶

Sets the sidebar widget for self.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

sidebar

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

the sidebar widget

Method: navigation-split-view:set-sidebar-position self position ¶
Method: set-sidebar-position self position ¶

Sets the sidebar position for self.

If set to Gtk.PackType.start, the sidebar is displayed before the content, and the sidebar will be the root page when collapsed.

If set to Gtk.PackType.end, the sidebar is displayed after the content, and the content will be the root page.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

position

Passed: a <GtkPackType>, or one of its symbols.

the new position

Method: navigation-split-view:set-sidebar-width-fraction self fraction ¶
Method: set-sidebar-width-fraction self fraction ¶

Sets the preferred sidebar width as a fraction of the total width of self.

The preferred width is additionally limited by NavigationSplitView:min-sidebar-width and NavigationSplitView:max-sidebar-width.

The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

fraction

Passed: a real number.

the preferred width fraction

Method: navigation-split-view:set-sidebar-width-unit self unit ¶
Method: set-sidebar-width-unit self unit ¶

Sets the length unit for minimum and maximum sidebar widths.

See NavigationSplitView:min-sidebar-width and NavigationSplitView:max-sidebar-width.

self

Passed: a <AdwNavigationSplitView>.

a navigation split view

unit

Passed: a <AdwLengthUnit>, or one of its symbols.

the length unit


Next: <AdwNavigationView>, Previous: <AdwNavigationPage>, Up: Classes   [Index]