Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- Adw.accent_color_to_rgba(self)¶
- Parameters:
self (
Adw.AccentColor) – an accent color- Returns:
return location for the color
- Return type:
rgba:
Gdk.RGBA
Converts self to a
GdkRGBArepresenting its background color.The matching foreground color is white.
Added in version 1.6.
- Adw.accent_color_to_standalone_rgba(self, dark)¶
- Parameters:
self (
Adw.AccentColor) – an accent colordark (
bool) – Whether to calculate standalone color for light or dark background
- Returns:
return location for the color
- Return type:
rgba:
Gdk.RGBA
Converts self to a
GdkRGBArepresenting its standalone color.It will typically be darker for light background, and lighter for dark background, ensuring contrast.
Added in version 1.6.
- Adw.bind_property_to_css_class(source, source_property, target, target_css_class, flags)¶
- Parameters:
source (
GObject.Object) – the source objectsource_property (
str) – the property on source to bindtarget (
Gtk.Widget) – the target widgettarget_css_class (
str) – the CSS class on target to bindflags (
GObject.BindingFlags) – flags to pass to self
- Returns:
the new binding
- Return type:
Creates a binding between a property on source and a CSS class on target.
Whenever source_property is changed the target_css_class is toggled either on or off on target using the boolean value of source_property.
For instance:
``c adw_bind_property_to_css_class (action, “active”, widget, “active-widget”, 0); ``
will result in the
active-widgetCSS class on the widget instance being applied whenactiveisTRUE, andactive-widgetbeing removed whenactiveisFALSE.The binding will automatically be removed when either the source or target instances are finalized. To remove the binding without affecting the source or target, call [method`GObject`.Object.unref] on the returned binding. It is recommended to only call [method`GObject`.Object.unref] when it is clear that both source and target will outlive the binding.
This function is not thread safe. A source can have multiple bindings.
See also: [func`Adw`.bind_property_to_css_class_full].
Added in version 1.10.
- Adw.bind_property_to_css_class_full(source, source_property, target, target_css_class, flags, map_to_class, map_to_property)¶
- Parameters:
source (
GObject.Object) – the source objectsource_property (
str) – the property on source to bindtarget (
Gtk.Widget) – the target widgettarget_css_class (
str) – the CSS class on target to bindflags (
GObject.BindingFlags) – flags to pass to selfmap_to_class (
GObject.ClosureorNone) – a closure wrapping the source_property to boolean value map, orNULLto use the defaultmap_to_property (
GObject.ClosureorNone) – a closure wrapping the target_css_class to [struct`GObject`.Value] map, orNULLto use the default
- Returns:
the new binding
- Return type:
Creates a binding between a property on source and a CSS class on target with a custom mapping using closures.
This function is the language bindings friendly version of [func`Adw`.bind_property_to_css_class_full].
The binding will automatically be removed when either the source or target instances are finalized. To remove the binding without affecting the source or target, call [method`GObject`.Object.unref] on the returned binding. It is recommended to only call [method`GObject`.Object.unref] when it is clear that both source and target will outlive the binding.
This function is not thread safe. A source can have multiple bindings.
See also: [func`Adw`.bind_property_to_css_class].
Added in version 1.10.
- Adw.breakpoint_condition_parse(str)¶
- Parameters:
str (
str) – the string specifying the condition- Returns:
the parsed condition
- Return type:
Parses a condition from a string.
Length conditions are specified as
<type>: <value>[<unit>], where:<type>can bemin-width,max-width,min-heightormax-height<value>is a fractional number<unit>can bepx,ptorsp
If the unit is omitted,
pxis assumed.See [ctor`BreakpointCondition`.new_length].
Examples:
min-width: 500pxmin-height: 400ptmax-width: 100spmax-height: 500
Ratio conditions are specified as
<type>: <width>[/<height>], where:<type>can bemin-aspect-ratioormax-aspect-ratio<width>and<height>are integer numbers
See [ctor`BreakpointCondition`.new_ratio].
The ratio is represented as
<width>divided by<height>.If
<height>is omitted, it’s assumed to be 1.Examples:
min-aspect-ratio: 4/3max-aspect-ratio: 1
The logical operators
and,orcan be used to compose a complex condition as follows:<condition> and <condition>: the condition is true when both ``<condition>``s are true, same as when using [ctor`BreakpointCondition`.new_and]<condition> or <condition>: the condition is true when either of the ``<condition>``s is true, same as when using [ctor`BreakpointCondition`.new_or]
Examples:
min-width: 400px and max-aspect-ratio: 4/3max-width: 360sp or max-width: 360px
Conditions can be further nested using parentheses, for example:
min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)
If parentheses are omitted, the first operator takes priority.
Added in version 1.4.
- Adw.easing_ease(self, value)¶
- Parameters:
self (
Adw.Easing) – an easing valuevalue (
float) – a value to ease
- Returns:
the easing for value
- Return type:
Computes easing with easing for value.
value should generally be in the [0, 1] range.
- Adw.get_enable_animations(widget)¶
- Parameters:
widget (
Gtk.Widget) – aGtkWidget- Returns:
whether animations are enabled for widget
- Return type:
Checks whether animations are enabled for widget.
This should be used when implementing an animated widget to know whether to animate it or not.
- Adw.get_major_version()¶
- Returns:
the major version number of the Adwaita library
- Return type:
Returns the major version number of the Adwaita library.
For example, in libadwaita version 1.2.3 this is 1.
This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the major version of the libadwaita headers you have included when compiling your code.
- Adw.get_micro_version()¶
- Returns:
the micro version number of the Adwaita library
- Return type:
Returns the micro version number of the Adwaita library.
For example, in libadwaita version 1.2.3 this is 3.
This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the micro version of the libadwaita headers you have included when compiling your code.
- Adw.get_minor_version()¶
- Returns:
the minor version number of the Adwaita library
- Return type:
Returns the minor version number of the Adwaita library.
For example, in libadwaita version 1.2.3 this is 2.
This function is in the library, so it represents the libadwaita library your code is running against. Contrast with the [constMAJOR_VERSION] constant, which represents the minor version of the libadwaita headers you have included when compiling your code.
- Adw.init()¶
Initializes Libadwaita.
This function can be used instead of [func`Gtk`.init] as it initializes GTK implicitly.
There’s no need to call this function if you’re using [class`Application`].
If Libadwaita has already been initialized, the function will simply return.
This makes sure translations, types, themes, and icons for the Adwaita library are set up properly.
- Adw.is_initialized()¶
- Returns:
the initialization status
- Return type:
Use this function to check if libadwaita has been initialized with [func`init`].
- Adw.length_unit_from_px(unit, value, settings)¶
- Parameters:
unit (
Adw.LengthUnit) – a length unitvalue (
float) – a value in pixelssettings (
Gtk.SettingsorNone) – settings to use, orNULLfor default settings
- Returns:
the length in unit
- Return type:
Converts value from pixels to unit.
Added in version 1.4.
- Adw.length_unit_to_px(unit, value, settings)¶
- Parameters:
unit (
Adw.LengthUnit) – a length unitvalue (
float) – a value in unitsettings (
Gtk.SettingsorNone) – settings to use, orNULLfor default settings
- Returns:
the length in pixels
- Return type:
Converts value from unit to pixels.
Added in version 1.4.
- Adw.lerp(a, b, t)¶
- Parameters:
- Returns:
the computed value
- Return type:
Computes the linear interpolation between a and b for t.
- Adw.rgba_to_standalone(rgba, dark)¶
- Parameters:
- Returns:
return location for the standalone color
- Return type:
standalone_rgba:
Gdk.RGBA
Adjusts rgba to be suitable as a standalone color.
It will typically be darker for light background, and lighter for dark background, ensuring contrast.
Added in version 1.6.