| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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
- newtype Breakpoint = Breakpoint (ManagedPtr Breakpoint)
- class (GObject o, IsDescendantOf Breakpoint o) => IsBreakpoint o
- toBreakpoint :: (MonadIO m, IsBreakpoint o) => o -> m Breakpoint
- breakpointAddSetter :: (HasCallStack, MonadIO m, IsBreakpoint a, IsObject b) => a -> b -> Text -> Maybe GValue -> m ()
- breakpointAddSetters :: (HasCallStack, MonadIO m, IsBreakpoint a) => a -> [Object] -> [Text] -> [GValue] -> m ()
- breakpointGetCondition :: (HasCallStack, MonadIO m, IsBreakpoint a) => a -> m (Maybe BreakpointCondition)
- breakpointNew :: (HasCallStack, MonadIO m) => BreakpointCondition -> m Breakpoint
- breakpointSetCondition :: (HasCallStack, MonadIO m, IsBreakpoint a) => a -> Maybe BreakpointCondition -> m ()
- clearBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> m ()
- constructBreakpointCondition :: (IsBreakpoint o, MonadIO m) => BreakpointCondition -> m (GValueConstruct o)
- getBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> m (Maybe BreakpointCondition)
- setBreakpointCondition :: (MonadIO m, IsBreakpoint o) => o -> BreakpointCondition -> m ()
- type BreakpointApplyCallback = IO ()
- afterBreakpointApply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointApplyCallback) -> m SignalHandlerId
- onBreakpointApply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointApplyCallback) -> m SignalHandlerId
- type BreakpointUnapplyCallback = IO ()
- afterBreakpointUnapply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointUnapplyCallback) -> m SignalHandlerId
- onBreakpointUnapply :: (IsBreakpoint a, MonadIO m) => a -> ((?self :: a) => BreakpointUnapplyCallback) -> m SignalHandlerId
Exported types
newtype Breakpoint Source #
Memory-managed wrapper type.
Constructors
| Breakpoint (ManagedPtr Breakpoint) |
Instances
| Eq Breakpoint Source # | |
Defined in GI.Adw.Objects.Breakpoint | |
| GObject Breakpoint Source # | |
Defined in GI.Adw.Objects.Breakpoint | |
| ManagedPtrNewtype Breakpoint Source # | |
Defined in GI.Adw.Objects.Breakpoint Methods toManagedPtr :: Breakpoint -> ManagedPtr Breakpoint | |
| TypedObject Breakpoint Source # | |
Defined in GI.Adw.Objects.Breakpoint | |
| HasParentTypes Breakpoint Source # | |
Defined in GI.Adw.Objects.Breakpoint | |
| IsGValue (Maybe Breakpoint) Source # | Convert |
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 # | |
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
| (GObject o, IsDescendantOf Breakpoint o) => IsBreakpoint o Source # | |
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
Click to display all available methods, including inherited ones
Methods
addSetter, addSetters, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getBuildableId, getCondition, getData, getProperty, getQdata.
Setters
addSetter
Arguments
| :: (HasCallStack, MonadIO m, IsBreakpoint a, IsObject b) | |
| => a |
|
| -> b |
|
| -> Text |
|
| -> Maybe GValue |
|
| -> 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
Arguments
| :: (HasCallStack, MonadIO m, IsBreakpoint a) | |
| => a |
|
| -> [Object] |
|
| -> [Text] |
|
| -> [GValue] |
|
| -> 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 |
|
| -> m (Maybe BreakpointCondition) | Returns: the condition |
Gets the condition for self.
Since: 1.4
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => BreakpointCondition |
|
| -> m Breakpoint | Returns: the newly created |
Creates a new AdwBreakpoint with condition.
Since: 1.4
setCondition
breakpointSetCondition Source #
Arguments
| :: (HasCallStack, MonadIO m, IsBreakpoint a) | |
| => a |
|
| -> Maybe BreakpointCondition |
|
| -> 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
setbreakpoint [ #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