Class Breakpoint
Window or 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, Breakpoint::apply and
Breakpoint::unapply can be used instead.
Breakpoints can be used within Window, ApplicationWindow,
Dialog or 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
BreakpointCondition.parse(java.lang.String).
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:
<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>
- Since:
- 1.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theApplyCallbackcallback.static classstatic classBreakpoint.Builder<B extends Breakpoint.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theUnapplyCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Breakpoint.Breakpoint(MemorySegment address) Create a Breakpoint proxy instance for the provided memory address.Breakpoint(BreakpointCondition condition) Creates a newAdwBreakpointwithcondition. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a setter toself.voidaddSetters(@Nullable GObject @Nullable [] objects, @Nullable String @Nullable [] names, @Nullable Value @Nullable [] values) AddsnSetterssetters toself.protected BreakpointasParent()Returns this instance as if it were its parent type.static Breakpoint.Builder<? extends Breakpoint.Builder> builder()ABreakpoint.Builderobject constructs aBreakpointwith the specified properties.voidEmits the "apply" signal.voidEmits the "unapply" signal.@Nullable BreakpointConditionGets the condition forself.static @Nullable TypegetType()Get the GType of the Breakpoint classonApply(Breakpoint.ApplyCallback handler) Emitted when the breakpoint is applied.onUnapply(Breakpoint.UnapplyCallback handler) Emitted when the breakpoint is unapplied.voidsetCondition(@Nullable BreakpointCondition condition) Sets the condition forself.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
Breakpoint
Create a Breakpoint proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Breakpoint
Creates a newAdwBreakpointwithcondition.- Parameters:
condition- the condition- Since:
- 1.4
-
Breakpoint
public Breakpoint()Creates a new Breakpoint.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
addSetter
Adds a setter toself.The setter will automatically set
propertyonobjecttovaluewhen 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-nameto 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);``- Parameters:
object- the target objectproperty- the target propertyvalue- the value to set- Since:
- 1.4
-
addSetters
public void addSetters(@Nullable GObject @Nullable [] objects, @Nullable String @Nullable [] names, @Nullable Value @Nullable [] values) AddsnSetterssetters toself.This is a convenience function for adding multiple setters at once.
See
addSetter(org.gnome.gobject.GObject, java.lang.String, org.gnome.gobject.Value).This function is meant to be used by language bindings.
- Parameters:
objects- setter target objectnames- setter target propertiesvalues- setter values- Since:
- 1.4
-
getCondition
Gets the condition forself.- Returns:
- the condition
- Since:
- 1.4
-
setCondition
Sets the condition forself.- Parameters:
condition- the new condition- Since:
- 1.4
-
onApply
Emitted when the breakpoint is applied.This signal is emitted after the setters have been applied.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.4
- See Also:
-
emitApply
public void emitApply()Emits the "apply" signal. SeeonApply(org.gnome.adw.Breakpoint.ApplyCallback). -
onUnapply
Emitted when the breakpoint is unapplied.This signal is emitted before resetting the setter values.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.4
- See Also:
-
emitUnapply
public void emitUnapply()Emits the "unapply" signal. SeeonUnapply(org.gnome.adw.Breakpoint.UnapplyCallback). -
builder
ABreakpoint.Builderobject constructs aBreakpointwith the specified properties. Use the variousset...()methods to set properties, and finish construction withBreakpoint.Builder.build().- Returns:
- the builder object
-