Klasse Breakpoint

Alle implementierten Schnittstellen:
PointerInterface

public class Breakpoint extends PropertyHolder
Describes a breakpoint for [class@Window] or [class@Dialog].

Breakpoints are used to create adaptive UI, allowing to change the layout
depending on available size.

Breakpoint is a size threshold, specified by its condition, as well as one or
more setters.

Each setter has a target object, a property and a value. When a breakpoint
is applied, each setter sets the target property on their target object to
the specified value, and reset it back to the original value when it's
unapplied.

For more complicated scenarios, [signal@Breakpoint::apply] and
[signal@Breakpoint::unapply] can be used instead.

Breakpoints can be used within [class@Window], [class@ApplicationWindow],
[class@Dialog] or [class@BreakpointBin].

## `AdwBreakpoint` as `GtkBuildable`:

`AdwBreakpoint` supports specifying its condition via the `<condition>`
element. The contents of the element must be a string in a format accepted by
[func@BreakpointCondition.parse].

It also supports adding setters via the `<setter>` element. Each `<setter>`
element must have the `object` attribute specifying the target object, and
the `property` attribute specifying the property name. The contents of the
element are used as the setter value.

For `G_TYPE_OBJECT` and `G_TYPE_BOXED` derived properties, empty contents are
treated as `NULL`.

Setter values can be translated with the usual `translatable`, `context` and
`comments` attributes.

Example of an `AdwBreakpoint` UI definition:

```xml
<object class="AdwBreakpoint">
<condition>max-width: 400px</condition>
<setter object="button" property="visible">True</setter>
<setter object="box" property="orientation">vertical</setter>
<setter object="page" property="title" translatable="yes">Example</setter>
</object>
```

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Breakpoint.html

  • Felddetails

  • Konstruktordetails

    • Breakpoint

      public Breakpoint(PointerContainer pointer)
    • Breakpoint

      public Breakpoint(@Nonnull BreakpointCondition condition)
      Creates a new `AdwBreakpoint` with @condition.
      Parameter:
      condition - the condition
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • addSetter

      public void addSetter(@Nonnull Object object, @Nonnull Str property, @Nullable Value value)
      Adds a setter to @self.

      The setter will automatically set @property on @object to @value when
      applying the breakpoint, and set it back to its original value upon
      unapplying it.

      ::: note
      Setting properties to their original values does not work for properties
      that have irreversible side effects. For example, changing
      [property@Gtk.Button:label] while [property@Gtk.Button:icon-name] is set
      will reset the icon. However, resetting the label will not set
      `icon-name` to its original value.

      Use the [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] signals
      for those properties instead, as follows:

      ```c
      static void
      breakpoint_apply_cb (MyWidget *self)
      {
      gtk_button_set_icon_name (self->button, "go-previous-symbolic");
      }

      static void
      breakpoint_apply_cb (MyWidget *self)
      {
      gtk_button_set_label (self->button, _("_Back"));
      }

      // ...

      g_signal_connect_swapped (breakpoint, "apply",
      G_CALLBACK (breakpoint_apply_cb), self);
      g_signal_connect_swapped (breakpoint, "unapply",
      G_CALLBACK (breakpoint_unapply_cb), self);
      ```
      Parameter:
      object - the target object
      property - the target property
      value - the value to set
    • addSetter

      public void addSetter(@Nonnull Object object, String property, @Nullable Value value)
      Adds a setter to @self.

      The setter will automatically set @property on @object to @value when
      applying the breakpoint, and set it back to its original value upon
      unapplying it.

      ::: note
      Setting properties to their original values does not work for properties
      that have irreversible side effects. For example, changing
      [property@Gtk.Button:label] while [property@Gtk.Button:icon-name] is set
      will reset the icon. However, resetting the label will not set
      `icon-name` to its original value.

      Use the [signal@Breakpoint::apply] and [signal@Breakpoint::unapply] signals
      for those properties instead, as follows:

      ```c
      static void
      breakpoint_apply_cb (MyWidget *self)
      {
      gtk_button_set_icon_name (self->button, "go-previous-symbolic");
      }

      static void
      breakpoint_apply_cb (MyWidget *self)
      {
      gtk_button_set_label (self->button, _("_Back"));
      }

      // ...

      g_signal_connect_swapped (breakpoint, "apply",
      G_CALLBACK (breakpoint_apply_cb), self);
      g_signal_connect_swapped (breakpoint, "unapply",
      G_CALLBACK (breakpoint_unapply_cb), self);
      ```
      Parameter:
      object - the target object
      property - the target property
      value - the value to set
    • addSetters

      public void addSetters(@Nonnull Object first_object, @Nonnull Str first_property, Object... _ellipsis)
      Adds multiple setters to @self.

      See [method@Breakpoint.add_setter].

      Example:

      ```c
      adw_breakpoint_add_setters (breakpoint,
      G_OBJECT (box), "orientation", GTK_ORIENTATION_VERTICAL,
      G_OBJECT (button), "halign", GTK_ALIGN_FILL,
      G_OBJECT (button), "valign", GTK_ALIGN_END,
      NULL);
      ```
      Parameter:
      first_object - the first target object
      first_property - the first target property
      _ellipsis - the value of the first setter, followed by a list of object, property and value triplets, terminated by `NULL`
    • addSetters

      public void addSetters(@Nonnull Object first_object, String first_property, Object... _ellipsis)
      Adds multiple setters to @self.

      See [method@Breakpoint.add_setter].

      Example:

      ```c
      adw_breakpoint_add_setters (breakpoint,
      G_OBJECT (box), "orientation", GTK_ORIENTATION_VERTICAL,
      G_OBJECT (button), "halign", GTK_ALIGN_FILL,
      G_OBJECT (button), "valign", GTK_ALIGN_END,
      NULL);
      ```
      Parameter:
      first_object - the first target object
      first_property - the first target property
      _ellipsis - the value of the first setter, followed by a list of object, property and value triplets, terminated by `NULL`
    • getCondition

      public BreakpointCondition getCondition()
      Gets the condition for @self.
      Gibt zurück:
      the condition
    • setCondition

      public void setCondition(@Nullable BreakpointCondition condition)
      Sets the condition for @self.
      Parameter:
      condition - the new condition
    • onApply

      public SignalHandler onApply(Breakpoint.OnApply signal)
      Connect to signal "apply".
      See Breakpoint.OnApply.onApply() for signal description.
      Field SIGNAL_ON_APPLY contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onUnapply

      public SignalHandler onUnapply(Breakpoint.OnUnapply signal)
      Connect to signal "unapply".
      See Breakpoint.OnUnapply.onUnapply() for signal description.
      Field SIGNAL_ON_UNAPPLY contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Gibt zurück:
      Buildable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()