gi-adwaita-1.0.7: Adwaita bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Adw.Objects.Breakpoint

Description

Describes a breakpoint for [classwindow] or [classdialog].

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, signalbreakpoint[apply] and signalbreakpoint[unapply] can be used instead.

Breakpoints can be used within [classwindow], [classapplicationWindow], [classdialog] or [classbreakpointBin].

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.

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 code

<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

Synopsis

Exported types

newtype Breakpoint Source #

Memory-managed wrapper type.

Constructors

Breakpoint (ManagedPtr Breakpoint) 

Instances

Instances details
Eq Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

GObject Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

ManagedPtrNewtype Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

Methods

toManagedPtr :: Breakpoint -> ManagedPtr Breakpoint

TypedObject Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

Methods

glibType :: IO GType

HasParentTypes Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

IsGValue (Maybe Breakpoint) Source #

Convert Breakpoint to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Adw.Objects.Breakpoint

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Breakpoint -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Breakpoint)

type ParentTypes Breakpoint Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

type ParentTypes Breakpoint = '[Object, Buildable]

class (GObject o, IsDescendantOf Breakpoint o) => IsBreakpoint o Source #

Type class for types which can be safely cast to Breakpoint, for instance with toBreakpoint.

Instances

Instances details
(GObject o, IsDescendantOf Breakpoint o) => IsBreakpoint o Source # 
Instance details

Defined in GI.Adw.Objects.Breakpoint

toBreakpoint :: (MonadIO m, IsBreakpoint o) => o -> m Breakpoint Source #

Cast to Breakpoint, for types for which this is known to be safe. For general casts, use castTo.

Methods

addSetter

breakpointAddSetter Source #

Arguments

:: (HasCallStack, MonadIO m, IsBreakpoint a, IsObject b) 
=> a

self: a breakpoint

-> b

object: the target object

-> Text

property: the target property

-> Maybe GValue

value: the value to set

-> m () 

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 Button:label while Button:iconName is set will reset the icon. However, resetting the label will not set icon-name to its original value.

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

c code

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);

Since: 1.4

addSetters

breakpointAddSetters Source #

Arguments

:: (HasCallStack, MonadIO m, IsBreakpoint a) 
=> a

self: a breakpoint

-> [Object]

objects: setter target object

-> [Text]

names: setter target properties

-> [GValue]

values: setter values

-> m () 

Adds nSetters setters to self.

This is a convenience function for adding multiple setters at once.

See [methodbreakpoint.add_setter].

This function is meant to be used by language bindings.

Since: 1.4

getCondition

breakpointGetCondition Source #

Arguments

:: (HasCallStack, MonadIO m, IsBreakpoint a) 
=> a

self: a breakpoint

-> m (Maybe BreakpointCondition)

Returns: the condition

Gets the condition for self.

Since: 1.4

new

breakpointNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BreakpointCondition

condition: the condition

-> m Breakpoint

Returns: the newly created AdwBreakpoint

Creates a new AdwBreakpoint with condition.

Since: 1.4

setCondition

breakpointSetCondition Source #

Arguments

:: (HasCallStack, MonadIO m, IsBreakpoint a) 
=> a

self: a breakpoint

-> Maybe BreakpointCondition

condition: the new condition

-> m () 

Sets the condition for self.

Since: 1.4

Properties

condition

The breakpoint's condition.

Since: 1.4

clearBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> m () Source #

Set the value of the “condition” property to Nothing. When overloading is enabled, this is equivalent to

clear #condition

constructBreakpointCondition :: (IsBreakpoint o, MonadIO m) => BreakpointCondition -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “condition” property. This is rarely needed directly, but it is used by new.

getBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> m (Maybe BreakpointCondition) Source #

Get the value of the “condition” property. When overloading is enabled, this is equivalent to

get breakpoint #condition

setBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> BreakpointCondition -> m () Source #

Set the value of the “condition” property. When overloading is enabled, this is equivalent to

set breakpoint [ #condition := value ]

Signals

apply

type BreakpointApplyCallback = IO () Source #

Emitted when the breakpoint is applied.

This signal is emitted after the setters have been applied.

Since: 1.4

afterBreakpointApply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointApplyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the apply signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after breakpoint #apply callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onBreakpointApply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointApplyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the apply signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on breakpoint #apply callback

unapply

type BreakpointUnapplyCallback = IO () Source #

Emitted when the breakpoint is unapplied.

This signal is emitted before resetting the setter values.

Since: 1.4

afterBreakpointUnapply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointUnapplyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the unapply signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after breakpoint #unapply callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onBreakpointUnapply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointUnapplyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the unapply signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on breakpoint #unapply callback