Adw.Squeezer¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Orientable (2)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
||
d/r |
|
||
d/r/w/en |
|
||
d/r |
|
||
d/r/w/en |
|
||
d/r/w/en |
|
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.Squeezer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A best fit container.
<picture> <source srcset=”squeezer-wide-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”squeezer-wide.png” alt=”squeezer-wide”> </picture> <picture> <source srcset=”squeezer-narrow-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”squeezer-narrow.png” alt=”squeezer-narrow”> </picture>
The
AdwSqueezer
widget is a container which only shows the first of its children that fits in the available size. It is convenient to offer different widgets to represent the same data with different levels of detail, making the widget seem to squeeze itself to fit in the available space.Transitions between children can be animated as fades. This can be controlled with [property`Squeezer`:py:data::transition-type<Adw.Squeezer.props.transition_type>].
- CSS nodes
AdwSqueezer
has a single CSS node with namesqueezer
.Deprecated since version 1.4: See the migration guide
- classmethod new()¶
- Returns:
the newly created
AdwSqueezer
- Return type:
Creates a new
AdwSqueezer
.Deprecated since version 1.4: See the migration guide
- add(child)¶
- Parameters:
child (
Gtk.Widget
) – the widget to add- Returns:
the [class`SqueezerPage`] for child
- Return type:
Adds a child to self.
Deprecated since version 1.4: See the migration guide
- get_allow_none()¶
- Returns:
whether self allows squeezing beyond the last child
- Return type:
Gets whether to allow squeezing beyond the last child’s minimum size.
Deprecated since version 1.4: See the migration guide
- get_homogeneous()¶
- Returns:
whether self is homogeneous
- Return type:
Gets whether all children have the same size for the opposite orientation.
Deprecated since version 1.4: See the migration guide
- get_interpolate_size()¶
- Returns:
whether the size is interpolated
- Return type:
Gets whether self interpolates its size when changing the visible child.
Deprecated since version 1.4: See the migration guide
- get_page(child)¶
- Parameters:
child (
Gtk.Widget
) – a child of self- Returns:
the page object for child
- Return type:
Returns the [class`SqueezerPage`] object for child.
Deprecated since version 1.4: See the migration guide
- get_pages()¶
- Returns:
a
GtkSelectionModel
for the squeezer’s children- Return type:
Returns a [iface`Gio`.ListModel] that contains the pages of self.
This can be used to keep an up-to-date view. The model also implements [iface`Gtk`.SelectionModel] and can be used to track the visible page.
Deprecated since version 1.4: See the migration guide
- get_switch_threshold_policy()¶
- Returns:
the fold threshold policy
- Return type:
Gets the switch threshold policy for self.
Deprecated since version 1.4: See the migration guide
- get_transition_duration()¶
- Returns:
the transition duration, in milliseconds
- Return type:
Gets the transition animation duration for self.
Deprecated since version 1.4: See the migration guide
- get_transition_running()¶
- Returns:
whether a transition is currently running
- Return type:
Gets whether a transition is currently running for self.
If a transition is impossible, the property value will be set to
TRUE
and then immediately toFALSE
, so it’s possible to rely on its notifications to know that a transition has happened.Deprecated since version 1.4: See the migration guide
- get_transition_type()¶
- Returns:
the current transition type of self
- Return type:
Gets the type of animation used for transitions between children in self.
Deprecated since version 1.4: See the migration guide
- get_visible_child()¶
- Returns:
the visible child
- Return type:
Gtk.Widget
orNone
Gets the currently visible child of self.
Deprecated since version 1.4: See the migration guide
- get_xalign()¶
- Returns:
the alignment value
- Return type:
Gets the horizontal alignment, from 0 (start) to 1 (end).
Deprecated since version 1.4: See the migration guide
- get_yalign()¶
- Returns:
the alignment value
- Return type:
Gets the vertical alignment, from 0 (top) to 1 (bottom).
Deprecated since version 1.4: See the migration guide
- remove(child)¶
- Parameters:
child (
Gtk.Widget
) – the child to remove
Removes a child widget from self.
Deprecated since version 1.4: See the migration guide
- set_allow_none(allow_none)¶
- Parameters:
allow_none (
bool
) – whether self allows squeezing beyond the last child
Sets whether to allow squeezing beyond the last child’s minimum size.
If set to
TRUE
, the squeezer can shrink to the point where no child can be shown. This is functionally equivalent to appending a widget with 0×0 minimum size.Deprecated since version 1.4: See the migration guide
- set_homogeneous(homogeneous)¶
- Parameters:
homogeneous (
bool
) – whether self is homogeneous
Sets whether all children have the same size for the opposite orientation.
For example, if a squeezer is horizontal and is homogeneous, it will request the same height for all its children. If it isn’t, the squeezer may change size when a different child becomes visible.
Deprecated since version 1.4: See the migration guide
- set_interpolate_size(interpolate_size)¶
- Parameters:
interpolate_size (
bool
) – whether to interpolate the size
Sets whether self interpolates its size when changing the visible child.
If
TRUE
, the squeezer will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if the squeezer is horizontal, it will interpolate the its height.Deprecated since version 1.4: See the migration guide
- set_switch_threshold_policy(policy)¶
- Parameters:
policy (
Adw.FoldThresholdPolicy
) – the policy to use
Sets the switch threshold policy for self.
Determines when the squeezer will switch children.
If set to
ADW_FOLD_THRESHOLD_POLICY_MINIMUM
, it will only switch when the visible child cannot fit anymore. WithADW_FOLD_THRESHOLD_POLICY_NATURAL
, it will switch as soon as the visible child doesn’t get their natural size.This can be useful if you have a long ellipsizing label and want to let it ellipsize instead of immediately switching.
Deprecated since version 1.4: See the migration guide
- set_transition_duration(duration)¶
- Parameters:
duration (
int
) – the new duration, in milliseconds
Sets the transition animation duration for self.
Deprecated since version 1.4: See the migration guide
- set_transition_type(transition)¶
- Parameters:
transition (
Adw.SqueezerTransitionType
) – the new transition type
Sets the type of animation used for transitions between children in self.
Deprecated since version 1.4: See the migration guide
- set_xalign(xalign)¶
- Parameters:
xalign (
float
) – the new alignment value
Sets the horizontal alignment, from 0 (start) to 1 (end).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the start side aligned and overflow the end side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide
- set_yalign(yalign)¶
- Parameters:
yalign (
float
) – the new alignment value
Sets the vertical alignment, from 0 (top) to 1 (bottom).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the top side aligned and overflow the bottom side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide
Property Details¶
- Adw.Squeezer.props.allow_none¶
- Name:
allow-none
- Type:
- Default Value:
- Flags:
Whether to allow squeezing beyond the last child’s minimum size.
If set to
TRUE
, the squeezer can shrink to the point where no child can be shown. This is functionally equivalent to appending a widget with 0×0 minimum size.Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.homogeneous¶
- Name:
homogeneous
- Type:
- Default Value:
- Flags:
Whether all children have the same size for the opposite orientation.
For example, if a squeezer is horizontal and is homogeneous, it will request the same height for all its children. If it isn’t, the squeezer may change size when a different child becomes visible.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.interpolate_size¶
- Name:
interpolate-size
- Type:
- Default Value:
- Flags:
Whether the squeezer interpolates its size when changing the visible child.
If
TRUE
, the squeezer will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if the squeezer is horizontal, it will interpolate the its height.Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.pages¶
- Name:
pages
- Type:
- Default Value:
- Flags:
A selection model with the squeezer’s pages.
This can be used to keep an up-to-date view. The model also implements [iface`Gtk`.SelectionModel] and can be used to track the visible page.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.switch_threshold_policy¶
- Name:
switch-threshold-policy
- Type:
- Default Value:
- Flags:
The switch threshold policy.
Determines when the squeezer will switch children.
If set to
ADW_FOLD_THRESHOLD_POLICY_MINIMUM
, it will only switch when the visible child cannot fit anymore. WithADW_FOLD_THRESHOLD_POLICY_NATURAL
, it will switch as soon as the visible child doesn’t get their natural size.This can be useful if you have a long ellipsizing label and want to let it ellipsize instead of immediately switching.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.transition_duration¶
- Name:
transition-duration
- Type:
- Default Value:
200
- Flags:
The transition animation duration, in milliseconds.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.transition_running¶
- Name:
transition-running
- Type:
- Default Value:
- Flags:
Whether a transition is currently running.
If a transition is impossible, the property value will be set to
TRUE
and then immediately toFALSE
, so it’s possible to rely on its notifications to know that a transition has happened.Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.transition_type¶
- Name:
transition-type
- Type:
- Default Value:
- Flags:
The type of animation used for transitions between children.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.visible_child¶
- Name:
visible-child
- Type:
- Default Value:
- Flags:
The currently visible child.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.xalign¶
- Name:
xalign
- Type:
- Default Value:
0.5
- Flags:
The horizontal alignment, from 0 (start) to 1 (end).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the start side aligned and overflow the end side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide
- Adw.Squeezer.props.yalign¶
- Name:
yalign
- Type:
- Default Value:
0.5
- Flags:
The vertical alignment, from 0 (top) to 1 (bottom).
This affects the children allocation during transitions, when they exceed the size of the squeezer.
For example, 0.5 means the child will be centered, 0 means it will keep the top side aligned and overflow the bottom side, and 1 means the opposite.
Deprecated since version 1.4: See the migration guide