Adw.OverlaySplitView¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Adw.Swipeable (5)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.OverlaySplitView(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A widget presenting sidebar and content side by side or as an overlay.
<picture> <source srcset=”overlay-split-view-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”overlay-split-view.png” alt=”overlay-split-view”> </picture> <picture> <source srcset=”overlay-split-view-collapsed-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”overlay-split-view-collapsed.png” alt=”overlay-split-view-collapsed”> </picture>
AdwOverlaySplitView
has two children: sidebar and content, and displays them side by side.When [property`OverlaySplitView`:py:data::collapsed<Adw.OverlaySplitView.props.collapsed>] is set to
TRUE
, the sidebar is instead shown as an overlay above the content widget.The sidebar can be hidden or shown using the [property`OverlaySplitView`:py:data::show-sidebar<Adw.OverlaySplitView.props.show_sidebar>] property.
Sidebar can be displayed before or after the content, this can be controlled with the [property`OverlaySplitView`:py:data::sidebar-position<Adw.OverlaySplitView.props.sidebar_position>] property.
Collapsing the split view automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If this behavior is not desired, the [property`OverlaySplitView`:py:data::pin-sidebar<Adw.OverlaySplitView.props.pin_sidebar>] property can be used to override it.
AdwOverlaySplitView
supports an edge swipe gesture for showing the sidebar, and a swipe from the sidebar for hiding it. Gestures are only supported on touchscreen, but not touchpad. Gestures can be controlled with the [property`OverlaySplitView`:py:data::enable-show-gesture<Adw.OverlaySplitView.props.enable_show_gesture>] and [property`OverlaySplitView`:py:data::enable-hide-gesture<Adw.OverlaySplitView.props.enable_hide_gesture>] properties.See also [class`NavigationSplitView`].
AdwOverlaySplitView
is typically used together with an [class`Breakpoint`] setting thecollapsed
property toTRUE
on small widths, as follows:``xml <object class=”AdwWindow”>
<property name=”width-request”>360</property> <property name=”height-request”>200</property> <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=”AdwOverlaySplitView” id=”split_view”>
- <property name=”sidebar”>
<!– … –>
</property> <property name=”content”>
<!– … –>
</property>
</object>
</property>
</object> ``
AdwOverlaySplitView
is often used for implementing the utility pane pattern.- Sizing
When not collapsed,
AdwOverlaySplitView
changes the sidebar width depending on its own width.If possible, it tries to allocate a fraction of the total width, controlled with the [property`OverlaySplitView`:py:data::sidebar-width-fraction<Adw.OverlaySplitView.props.sidebar_width_fraction>] property.
The sidebar also has minimum and maximum sizes, controlled with the [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>] properties.
The minimum and maximum sizes are using the length unit specified with the [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.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.
When collapsed, the preferred width fraction is ignored and the sidebar uses [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>] when possible.
- Header Bar Integration
When used inside
AdwOverlaySplitView
, [class`HeaderBar`] will automatically hide the window buttons in the middle.The
AdwOverlaySplitView
implementation of the [iface`Gtk`.Buildable] 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
AdwOverlaySplitView
has a single CSS node with the nameoverlay-split-view
.It contains two nodes with the name
widget
, containing the sidebar and content children.When not collapsed, they have the
.sidebar-view
and.content-view
style classes respectively.`` overlay-split-view ├── widget.sidebar-pane │ ╰── [sidebar child] ╰── widget.content-pane
╰── [content child]
When collapsed, the one containing the sidebar child has the
.background
style class and the other one has no style classes.`` overlay-split-view ├── widget.background │ ╰── [sidebar child] ╰── widget
╰── [content child]
- Accessibility
AdwOverlaySplitView
uses theGTK_ACCESSIBLE_ROLE_GROUP
role.New in version 1.4.
- classmethod new()¶
- Returns:
the newly created
AdwOverlaySplitView
- Return type:
Creates a new
AdwOverlaySplitView
.New in version 1.4.
- get_collapsed()¶
- Returns:
whether self is collapsed
- Return type:
Gets whether self is collapsed.
New in version 1.4.
- get_content()¶
- Returns:
the content widget for self
- Return type:
Gtk.Widget
orNone
Gets the content widget for self.
New in version 1.4.
- get_enable_hide_gesture()¶
- Returns:
TRUE
if self can be closed with a swipe gesture- Return type:
Gets whether self can be closed with a swipe gesture.
New in version 1.4.
- get_enable_show_gesture()¶
- Returns:
TRUE
if self can be opened with a swipe gesture- Return type:
Gets whether self can be opened with an edge swipe gesture.
New in version 1.4.
- get_max_sidebar_width()¶
- Returns:
the maximum width
- Return type:
Gets the maximum sidebar width for self.
New in version 1.4.
- get_min_sidebar_width()¶
- Returns:
the minimum width
- Return type:
Gets the minimum sidebar width for self.
New in version 1.4.
- get_pin_sidebar()¶
- Returns:
whether if the sidebar widget is pinned
- Return type:
Gets whether the sidebar widget is pinned for self.
New in version 1.4.
- get_show_sidebar()¶
- Returns:
TRUE
if the sidebar widget is shown- Return type:
Gets whether the sidebar widget is shown for self.
New in version 1.4.
- get_sidebar()¶
- Returns:
the sidebar widget for self
- Return type:
Gtk.Widget
orNone
Gets the sidebar widget for self.
New in version 1.4.
- get_sidebar_position()¶
- Returns:
the sidebar position for self
- Return type:
Gets the sidebar position for self.
New in version 1.4.
- get_sidebar_width_fraction()¶
- Returns:
the preferred width fraction
- Return type:
Gets the preferred sidebar width fraction for self.
New in version 1.4.
- get_sidebar_width_unit()¶
- Returns:
the length unit
- Return type:
Gets the length unit for minimum and maximum sidebar widths.
New in version 1.4.
- set_collapsed(collapsed)¶
- Parameters:
collapsed (
bool
) – whether self is collapsed
Sets whether self view is collapsed.
When collapsed, the sidebar widget is presented as an overlay above the content widget, otherwise they are displayed side by side.
New in version 1.4.
- set_content(content)¶
- Parameters:
content (
Gtk.Widget
orNone
) – the content widget
Sets the content widget for self.
New in version 1.4.
- set_enable_hide_gesture(enable_hide_gesture)¶
- Parameters:
enable_hide_gesture (
bool
) – whether self can be closed with a swipe gesture
Sets whether self can be closed with a swipe gesture.
Only touchscreen swipes are supported.
New in version 1.4.
- set_enable_show_gesture(enable_show_gesture)¶
- Parameters:
enable_show_gesture (
bool
) – whether self can be opened with a swipe gesture
Sets whether self can be opened with an edge swipe gesture.
Only touchscreen swipes are supported.
New in version 1.4.
- set_max_sidebar_width(width)¶
- Parameters:
width (
float
) – the maximum width
Sets the maximum sidebar width for self.
Maximum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].
The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.
New in version 1.4.
- set_min_sidebar_width(width)¶
- Parameters:
width (
float
) – the minimum width
Sets the minimum sidebar width for self.
Minimum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].
The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.
New in version 1.4.
- set_pin_sidebar(pin_sidebar)¶
- Parameters:
pin_sidebar (
bool
) – whether to pin the sidebar widget
Sets whether the sidebar widget is pinned for self.
By default, collapsing self automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If set to
TRUE
, sidebar visibility never changes on its own.New in version 1.4.
- set_show_sidebar(show_sidebar)¶
- Parameters:
show_sidebar (
bool
) – whether to show the sidebar widget
Sets whether the sidebar widget is shown for self.
New in version 1.4.
- set_sidebar(sidebar)¶
- Parameters:
sidebar (
Gtk.Widget
orNone
) – the sidebar widget
Sets the sidebar widget for self.
New in version 1.4.
- set_sidebar_position(position)¶
- Parameters:
position (
Gtk.PackType
) – the new position
Sets the sidebar position for self.
If it’s set to
GTK_PACK_START
, the sidebar is displayed before the content, ifGTK_PACK_END
, it’s displayed after the content.New in version 1.4.
- set_sidebar_width_fraction(fraction)¶
- Parameters:
fraction (
float
) – the preferred width fraction
Sets the preferred sidebar width as a fraction of the total width of self.
The preferred width is additionally limited by [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].
The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.
New in version 1.4.
- set_sidebar_width_unit(unit)¶
- Parameters:
unit (
Adw.LengthUnit
) – the length unit
Sets the length unit for minimum and maximum sidebar widths.
See [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].
New in version 1.4.
Property Details¶
- Adw.OverlaySplitView.props.collapsed¶
- Name:
collapsed
- Type:
- Default Value:
- Flags:
Whether the split view is collapsed.
When collapsed, the sidebar widget is presented as an overlay above the content widget, otherwise they are displayed side by side.
New in version 1.4.
- Adw.OverlaySplitView.props.content¶
- Name:
content
- Type:
- Default Value:
- Flags:
The content widget.
New in version 1.4.
- Adw.OverlaySplitView.props.enable_hide_gesture¶
- Name:
enable-hide-gesture
- Type:
- Default Value:
- Flags:
Whether the sidebar can be closed with a swipe gesture.
Only touchscreen swipes are supported.
New in version 1.4.
- Adw.OverlaySplitView.props.enable_show_gesture¶
- Name:
enable-show-gesture
- Type:
- Default Value:
- Flags:
Whether the sidebar can be opened with an edge swipe gesture.
Only touchscreen swipes are supported.
New in version 1.4.
- Adw.OverlaySplitView.props.max_sidebar_width¶
- Name:
max-sidebar-width
- Type:
- Default Value:
280.0
- Flags:
The maximum sidebar width.
Maximum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].
The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.
New in version 1.4.
- Adw.OverlaySplitView.props.min_sidebar_width¶
- Name:
min-sidebar-width
- Type:
- Default Value:
180.0
- Flags:
The minimum sidebar width.
Minimum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].
The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.
New in version 1.4.
- Adw.OverlaySplitView.props.pin_sidebar¶
- Name:
pin-sidebar
- Type:
- Default Value:
- Flags:
Whether the sidebar widget is pinned.
By default, collapsing self automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If set to
TRUE
, sidebar visibility never changes on its own.New in version 1.4.
- Adw.OverlaySplitView.props.show_sidebar¶
- Name:
show-sidebar
- Type:
- Default Value:
- Flags:
Whether the sidebar widget is shown.
New in version 1.4.
- Adw.OverlaySplitView.props.sidebar¶
- Name:
sidebar
- Type:
- Default Value:
- Flags:
The sidebar widget.
New in version 1.4.
- Adw.OverlaySplitView.props.sidebar_position¶
- Name:
sidebar-position
- Type:
- Default Value:
- Flags:
The sidebar position.
If it’s set to
GTK_PACK_START
, the sidebar is displayed before the content, ifGTK_PACK_END
, it’s displayed after the content.New in version 1.4.
- Adw.OverlaySplitView.props.sidebar_width_fraction¶
- Name:
sidebar-width-fraction
- Type:
- Default Value:
0.25
- Flags:
The preferred sidebar width as a fraction of the total width.
The preferred width is additionally limited by [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].
The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.
New in version 1.4.
- Adw.OverlaySplitView.props.sidebar_width_unit¶
- Name:
sidebar-width-unit
- Type:
- Default Value:
- Flags:
The length unit for minimum and maximum sidebar widths.
See [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].
New in version 1.4.