Adw.Clamp¶
- 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 |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.Clamp(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A widget constraining its child to a given size.
<picture> <source srcset=”clamp-wide-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”clamp-wide.png” alt=”clamp-wide”> </picture> <picture> <source srcset=”clamp-narrow-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”clamp-narrow.png” alt=”clamp-narrow”> </picture>
The
AdwClamp
widget constrains the size of the widget it contains to a given maximum size. It will constrain the width if it is horizontal, or the height if it is vertical. The expansion of the child from its minimum to its maximum size is eased out for a smooth transition.If the child requires more than the requested maximum size, it will be allocated the minimum size it can fit in instead.
AdwClamp
can scale with the text scale factor, use the [property`ClampLayout`:py:data::unit<Adw.Clamp.props.unit>] property to enable that behavior.- CSS nodes
AdwClamp
has a single CSS node with nameclamp
.- classmethod new()¶
- Returns:
the newly created
AdwClamp
- Return type:
Creates a new
AdwClamp
.
- get_child()¶
- Returns:
the child widget of self
- Return type:
Gtk.Widget
orNone
Gets the child widget of self.
- get_maximum_size()¶
- Returns:
the maximum size to allocate to the child
- Return type:
Gets the maximum size allocated to the child.
- get_tightening_threshold()¶
- Returns:
the size above which the child is clamped
- Return type:
Gets the size above which the child is clamped.
- get_unit()¶
- Returns:
the length unit
- Return type:
Gets the length unit for maximum size and tightening threshold.
New in version 1.4.
- set_child(child)¶
- Parameters:
child (
Gtk.Widget
orNone
) – the child widget
Sets the child widget of self.
- set_maximum_size(maximum_size)¶
- Parameters:
maximum_size (
int
) – the maximum size
Sets the maximum size allocated to the child.
It is the width if the clamp is horizontal, or the height if it is vertical.
- set_tightening_threshold(tightening_threshold)¶
- Parameters:
tightening_threshold (
int
) – the tightening threshold
Sets the size above which the child is clamped.
Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the child will be allocated all the available size.
If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the size up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.
Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.
- set_unit(unit)¶
- Parameters:
unit (
Adw.LengthUnit
) – the length unit
Sets the length unit for maximum size and tightening threshold.
Allows the sizes to vary depending on the text scale factor.
New in version 1.4.
Property Details¶
- Adw.Clamp.props.child¶
- Name:
child
- Type:
- Default Value:
- Flags:
The child widget of the
AdwClamp
.
- Adw.Clamp.props.maximum_size¶
- Name:
maximum-size
- Type:
- Default Value:
600
- Flags:
The maximum size allocated to the child.
It is the width if the clamp is horizontal, or the height if it is vertical.
- Adw.Clamp.props.tightening_threshold¶
- Name:
tightening-threshold
- Type:
- Default Value:
400
- Flags:
The size above which the child is clamped.
Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum size, the child will be allocated all the available size.
If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the size up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.
Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.
- Adw.Clamp.props.unit¶
- Name:
unit
- Type:
- Default Value:
- Flags:
The length unit for maximum size and tightening threshold.
Allows the sizes to vary depending on the text scale factor.
New in version 1.4.