gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Svg

Contents

- Exported types
- Methods
  - getFeatures
  - getOverflow
  - getState
  - getStateNames
  - getStylesheet
  - getWeight
  - loadFromBytes
  - loadFromResource
  - new
  - newFromBytes
  - newFromResource
  - pause
  - play
  - serialize
  - setFeatures
  - setFrameClock
  - setOverflow
  - setSettings
  - setState
  - setStylesheet
  - setWeight
  - writeToFile
- Properties
  - features
  - overflow
  - playing
  - resource
  - state
  - stylesheet
  - weight
- Signals
  - error

Description

A paintable implementation that renders SVG, with animations.

`GtkSvg` objects are created by parsing a subset of SVG, including SVG animations.

`GtkSvg` fills or strokes paths with symbolic or fixed colors. It can have multiple states, and paths can be included in a subset of the states. States can have animations, and the transition between different states can also be animated.

To show a static SVG image, it is enough to load the the SVG and use it like any other paintable.

To play an SVG animation, use `svgSetFrameClock` to connect the paintable to a frame clock, and call `svgPlay` after loading the SVG. The animation can be paused using `svgPause`.

To set the current state, use `svgSetState`.

## Error handling

Loading an SVG into `GtkSvg` will always produce a (possibly empty) paintable. GTK will drop things that it can't handle and try to make sense of the rest.

To track errors during parsing or rendering, connect to the Svg::error signal.

For parsing errors in the `GTK_SVG_ERROR` domain, the functions `SvgError`.`get_start`(), `SvgError`.`get_end`(), `SvgError`.`get_element`() and `SvgError`.`get_attribute`() can be used to obtain information about where the error occurred.

## The supported subset of SVG

The paintable supports much of SVG 2, including animations, with some exceptions.

Among the graphical elements, `<textPath>` and `<foreignObject>` are not supported.

In the `<filter>` element, the following primitives are not supported: feConvolveMatrix, feDiffuseLighting, feMorphology, feSpecularLighting.

Support for the `mask` attribute is limited to just a url referring to the `<mask>` element by ID.

In animation elements, the parsing of `begin` and `end` attributes is limited, and the `min` and `max` attributes are not supported.

The interactive aspects of SVG are supported by `SvgWidget`.

## SVG Extensions

The paintable supports a number of custom attributes that offer a convenient way to define states, transitions and animations. For example,

<circle cx='5' cy='5' r='5' gpa:states='0 1' gpa:animation-type='automatic' gpa:animation-direction='segment' gpa:animation-duration='600ms'/>

defines the circle to be shown in states 0 and 1, and animates a segment of the circle.

<image src="svg-renderer1.svg">

Note that the generated animations are implemented using standard SVG attributes (`visibility`, `stroke-dasharray,` stroke-dashoffset`,` pathLength`and` filter@). Setting these attributes in your SVG is therefore going to interfere with generated animations.

To connect general SVG animations to the states of the paintable, use the custom `StateChange(...)` condition in the `begin` and `end` attributes of SVG animation elements. For example,

<animate href='path1' attributeName='fill' begin='StateChange(1 2 3, 0)' dur='300ms' fill='freeze' from='black' to='magenta'/>

will make the fill color of path1 transition from black to magenta when the renderer enters state 0 from states 1, 2, or 3.

<image src="svg-renderer2.svg">

The `StateChange(...)` condition triggers for upcoming state changes as well, to support fade-out transitions. For example,

<animate href='path1' attributeName='opacity' begin='StateChange(0, 1 2 3) -300ms' dur='300ms' fill='freeze' from='1' to='0'/>

will start a fade-out of path1 300ms before a transition from state 0 to 1, 2 or 3.

States can be specified numerically, or by name. It is also possible to say `not STATE` instead of explictly listing all states that are different from `STATE`.

In addition to the `gpa:fill` and `gpa:stroke` attributes, symbolic colors can also be specified as a custom paint server reference, like this: `url(`gpa:warning`)`. This works in `fill` and `stroke` attributes, but also when specifying colors in SVG animation attributes like `to` or `values`.

Note that the SVG syntax allows for a fallback RGB color to be specified after the url, for compatibility with other SVG consumers:

fill='url(#gpa:warning) orange'

GtkSvg also allows to refer to symbolic colors like system colors in CSS, with names like SymbolicForeground, SymbolicSuccess, etc. These can be used whenever a color is required.

In contrast to SVG 1.1 and 2.0, we allow the `transform` attribute to be animated with @<animate>`.

Since: 4.22

Synopsis

- newtype Svg = Svg (ManagedPtr Svg)
- class (GObject o, IsDescendantOf Svg o) => IsSvg o
- toSvg :: (MonadIO m, IsSvg o) => o -> m Svg
- svgGetFeatures :: (HasCallStack, MonadIO m, IsSvg a) => a -> m [SvgFeatures]
- svgGetOverflow :: (HasCallStack, MonadIO m, IsSvg a) => a -> m Overflow
- svgGetState :: (HasCallStack, MonadIO m, IsSvg a) => a -> m Word32
- svgGetStateNames :: (HasCallStack, MonadIO m, IsSvg a) => a -> m (Maybe [Text], Word32)
- svgGetStylesheet :: (HasCallStack, MonadIO m, IsSvg a) => a -> m (Maybe Bytes)
- svgGetWeight :: (HasCallStack, MonadIO m, IsSvg a) => a -> m Double
- svgLoadFromBytes :: (HasCallStack, MonadIO m, IsSvg a) => a -> Bytes -> m ()
- svgLoadFromResource :: (HasCallStack, MonadIO m, IsSvg a) => a -> Text -> m ()
- svgNew :: (HasCallStack, MonadIO m) => m Svg
- svgNewFromBytes :: (HasCallStack, MonadIO m) => Bytes -> m Svg
- svgNewFromResource :: (HasCallStack, MonadIO m) => Text -> m Svg
- svgPause :: (HasCallStack, MonadIO m, IsSvg a) => a -> m ()
- svgPlay :: (HasCallStack, MonadIO m, IsSvg a) => a -> m ()
- svgSerialize :: (HasCallStack, MonadIO m, IsSvg a) => a -> m Bytes
- svgSetFeatures :: (HasCallStack, MonadIO m, IsSvg a) => a -> [SvgFeatures] -> m ()
- svgSetFrameClock :: (HasCallStack, MonadIO m, IsSvg a, IsFrameClock b) => a -> b -> m ()
- svgSetOverflow :: (HasCallStack, MonadIO m, IsSvg a) => a -> Overflow -> m ()
- svgSetSettings :: (HasCallStack, MonadIO m, IsSvg a, IsSettings b) => a -> Maybe b -> m ()
- svgSetState :: (HasCallStack, MonadIO m, IsSvg a) => a -> Word32 -> m ()
- svgSetStylesheet :: (HasCallStack, MonadIO m, IsSvg a) => a -> Maybe Bytes -> m ()
- svgSetWeight :: (HasCallStack, MonadIO m, IsSvg a) => a -> Double -> m ()
- svgWriteToFile :: (HasCallStack, MonadIO m, IsSvg a) => a -> Text -> m ()
- constructSvgFeatures :: (IsSvg o, MonadIO m) => [SvgFeatures] -> m (GValueConstruct o)
- getSvgFeatures :: (MonadIO m, IsSvg o) => o -> m [SvgFeatures]
- setSvgFeatures :: (MonadIO m, IsSvg o) => o -> [SvgFeatures] -> m ()
- constructSvgOverflow :: (IsSvg o, MonadIO m) => Overflow -> m (GValueConstruct o)
- getSvgOverflow :: (MonadIO m, IsSvg o) => o -> m Overflow
- setSvgOverflow :: (MonadIO m, IsSvg o) => o -> Overflow -> m ()
- constructSvgPlaying :: (IsSvg o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSvgPlaying :: (MonadIO m, IsSvg o) => o -> m Bool
- setSvgPlaying :: (MonadIO m, IsSvg o) => o -> Bool -> m ()
- clearSvgResource :: (MonadIO m, IsSvg o) => o -> m ()
- constructSvgResource :: (IsSvg o, MonadIO m) => Text -> m (GValueConstruct o)
- getSvgResource :: (MonadIO m, IsSvg o) => o -> m (Maybe Text)
- setSvgResource :: (MonadIO m, IsSvg o) => o -> Text -> m ()
- constructSvgState :: (IsSvg o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSvgState :: (MonadIO m, IsSvg o) => o -> m Word32
- setSvgState :: (MonadIO m, IsSvg o) => o -> Word32 -> m ()
- clearSvgStylesheet :: (MonadIO m, IsSvg o) => o -> m ()
- constructSvgStylesheet :: (IsSvg o, MonadIO m) => Bytes -> m (GValueConstruct o)
- getSvgStylesheet :: (MonadIO m, IsSvg o) => o -> m (Maybe Bytes)
- setSvgStylesheet :: (MonadIO m, IsSvg o) => o -> Bytes -> m ()
- constructSvgWeight :: (IsSvg o, MonadIO m) => Double -> m (GValueConstruct o)
- getSvgWeight :: (MonadIO m, IsSvg o) => o -> m Double
- setSvgWeight :: (MonadIO m, IsSvg o) => o -> Double -> m ()
- type SvgErrorCallback = GError -> IO ()
- afterSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId
- onSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId

# Exported types

newtype Svg Source #

Memory-managed wrapper type.

Constructors

Svg (ManagedPtr Svg) |

#### Instances

Instances details

Eq Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg Methods (==) :: Svg -> Svg -> Bool Source # (/=) :: Svg -> Svg -> Bool Source #
GObject Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg
ManagedPtrNewtype Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg Methods toManagedPtr :: Svg -> ManagedPtr Svg Source #
TypedObject Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg Methods glibType :: IO GType Source #
HasParentTypes Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg
IsGValue (Maybe Svg) Source # | Convert `Svg` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Svg Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Svg -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Svg) Source #
type ParentTypes Svg Source # |
Instance details Defined in GI.Gtk.Objects.Svg type ParentTypes Svg = '[Object, Paintable, SymbolicPaintable]

class (GObject o, IsDescendantOf Svg o) => IsSvg o Source #

Type class for types which can be safely cast to `Svg`, for instance with `toSvg`.

#### Instances

Instances details

(GObject o, IsDescendantOf Svg o) => IsSvg o Source # |
Instance details Defined in GI.Gtk.Objects.Svg

toSvg :: (MonadIO m, IsSvg o) => o -> m Svg Source #

Cast to `Svg`, 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

Expand

#### Methods

bindProperty, bindPropertyFull, computeConcreteSize, forceFloating, freezeNotify, getv, invalidateContents, invalidateSize, isFloating, loadFromBytes, loadFromResource, notify, notifyByPspec, pause, play, ref, refSink, runDispose, serialize, snapshot, snapshotSymbolic, snapshotWithWeight, stealData, stealQdata, thawNotify, unref, watchClosure, writeToFile.

#### Getters

getCurrentImage, getData, getFeatures, getFlags, getIntrinsicAspectRatio, getIntrinsicHeight, getIntrinsicWidth, getOverflow, getProperty, getQdata, getState, getStateNames, getStylesheet, getWeight.

#### Setters

setData, setDataFull, setFeatures, setFrameClock, setOverflow, setProperty, setSettings, setState, setStylesheet, setWeight.

## getFeatures

svgGetFeatures Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m [SvgFeatures] | Returns: the enabled features

Returns the currently enabled features.

Since: 4.22

## getOverflow

svgGetOverflow Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m Overflow | Returns: the current overflow value

Gets the current overflow value.

Since: 4.24

## getState

svgGetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m Word32 | Returns: the state

Gets the current state of the paintable.

Since: 4.22

## getStateNames

svgGetStateNames Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m (Maybe [Text], Word32) | Returns: the state names

Returns a `NULL`-terminated array of state names, if available.

Note that the returned array and the strings contained in it will only be valid until the `GtkSvg` is cleared or reloaded, so if you want to keep it around, you should make a copy.

Since: 4.22

## getStylesheet

svgGetStylesheet Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m (Maybe Bytes) | Returns: a `GBytes` with the CSS data

Gets the CSS user stylesheet.

Since: 4.24

## getWeight

svgGetWeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m Double | Returns: the weight

Gets the value of the weight property.

Since: 4.22

## loadFromBytes

svgLoadFromBytes Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Bytes | `bytes`: the data to load
-> m () |

Loads SVG content into an existing SVG paintable.

To track errors while loading SVG content, connect to the Svg::error signal.

This clears any previously loaded content.

Since: 4.22

## loadFromResource

svgLoadFromResource Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Text | `path`: the resource path
-> m () |

Loads SVG content into an existing SVG paintable.

To track errors while loading SVG content, connect to the Svg::error signal.

This clears any previously loaded content.

Since: 4.22

## new

svgNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Svg | Returns: the paintable

Creates a new, empty SVG paintable.

Since: 4.22

## newFromBytes

svgNewFromBytes Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Bytes | `bytes`: the data
-> m Svg | Returns: the paintable

Parses the SVG data in `bytes` and creates a paintable.

Since: 4.22

## newFromResource

svgNewFromResource Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `path`: the resource path
-> m Svg | Returns: the paintable

Parses the SVG data in the resource and creates a paintable.

Since: 4.22

## pause

svgPause Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m () |

Stop any playing animations and state transitions.

SvgAnimations can be paused and started repeatedly.

Since: 4.22

## play

svgPlay Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m () |

Start playing animations and state transitions.

SvgAnimations can be paused and started repeatedly.

Since: 4.22

## serialize

svgSerialize Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> m Bytes | Returns: the serialized contents

Serializes the content of the renderer as SVG.

The SVG will be similar to the orignally loaded one, but is not guaranteed to be 100% identical.

This function serializes the DOM, i.e. the results of parsing the SVG. It does not reflect the effect of applying animations.

Since: 4.22

## setFeatures

svgSetFeatures Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> [SvgFeatures] | `features`: features to enable
-> m () |

Enables or disables features of the SVG paintable.

By default, all features are enabled.

Note that this call only has an effect before the SVG is loaded.

Since: 4.22

## setFrameClock

svgSetFrameClock Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a, IsFrameClock b) |
=> a | `self`: an SVG paintable
-> b | `clock`: the frame clock
-> m () |

Sets a frame clock.

Without a frame clock, GtkSvg will not advance animations.

Since: 4.22

## setOverflow

svgSetOverflow Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Overflow | `overflow`: the new overflow value
-> m () |

Sets whether the rendering will be clipped to the bounds.

Clipping is expected for `Paintable` semantics, so this property should not be changed when using a `GtkSvg` as a paintable.

Since: 4.24

## setSettings

svgSetSettings Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a, IsSettings b) |
=> a | `self`: an SVG paintable
-> Maybe b | `settings`: the settings object
-> m () |

Sets a settings object holding settinsg used when rendering the SVG.

Since: 4.24

## setState

svgSetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Word32 | `state`: the state to set, as a value between 0 and 63
-> m () |

Sets the state of the paintable.

If the paintable is currently playing, the state change will apply transitions that are defined in the SVG. If the paintable is not playing, the state change will take effect instantaneously.

Since: 4.22

## setStylesheet

svgSetStylesheet Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Maybe Bytes | `bytes`: CSS data
-> m () |

Sets a CSS user stylesheet to use.

Note that styles are applied at load time, so this function must be called before loading SVG.

Since: 4.24

## setWeight

svgSetWeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Double | `weight`: the font weight, as a value between -1 and 1000
-> m () |

Sets the weight that is used when rendering.

The weight affects the effective linewidth when stroking paths.

The default value of -1 means to use the font weight from CSS.

Since: 4.22

## writeToFile

svgWriteToFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsSvg a) |
=> a | `self`: an SVG paintable
-> Text | `filename`: the file to save to
-> m () | (Can throw `GError`)

Serializes the paintable, and saves the result to a file.

Since: 4.22

# Properties

## features

Enabled features for this paintable.

Note that features have to be set before loading SVG data to take effect.

Since: 4.22

constructSvgFeatures :: (IsSvg o, MonadIO m) => [SvgFeatures] -> m (GValueConstruct o) Source #

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

getSvgFeatures :: (MonadIO m, IsSvg o) => o -> m [SvgFeatures] Source #

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

    get svg #features

setSvgFeatures :: (MonadIO m, IsSvg o) => o -> [SvgFeatures] -> m () Source #

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

    set svg [ #features := value ]

## overflow

Whether the rendering will be clipped to the bounds.

Since: 4.24

constructSvgOverflow :: (IsSvg o, MonadIO m) => Overflow -> m (GValueConstruct o) Source #

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

getSvgOverflow :: (MonadIO m, IsSvg o) => o -> m Overflow Source #

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

    get svg #overflow

setSvgOverflow :: (MonadIO m, IsSvg o) => o -> Overflow -> m () Source #

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

    set svg [ #overflow := value ]

## playing

Whether the paintable is currently animating its content.

To set this property, use the `svgPlay` and `svgPause` functions.

Since: 4.22

constructSvgPlaying :: (IsSvg o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getSvgPlaying :: (MonadIO m, IsSvg o) => o -> m Bool Source #

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

    get svg #playing

setSvgPlaying :: (MonadIO m, IsSvg o) => o -> Bool -> m () Source #

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

    set svg [ #playing := value ]

## resource

Resource to load SVG data from.

This property is meant to create a paintable from a resource in ui files.

Since: 4.22

clearSvgResource :: (MonadIO m, IsSvg o) => o -> m () Source #

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

    clear #resource

constructSvgResource :: (IsSvg o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getSvgResource :: (MonadIO m, IsSvg o) => o -> m (Maybe Text) Source #

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

    get svg #resource

setSvgResource :: (MonadIO m, IsSvg o) => o -> Text -> m () Source #

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

    set svg [ #resource := value ]

## state

The current state of the renderer.

This can be a number between 0 and 63.

Since: 4.22

constructSvgState :: (IsSvg o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

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

getSvgState :: (MonadIO m, IsSvg o) => o -> m Word32 Source #

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

    get svg #state

setSvgState :: (MonadIO m, IsSvg o) => o -> Word32 -> m () Source #

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

    set svg [ #state := value ]

## stylesheet

A CSS stylesheet to apply to the SVG.

Since: 4.24

clearSvgStylesheet :: (MonadIO m, IsSvg o) => o -> m () Source #

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

    clear #stylesheet

constructSvgStylesheet :: (IsSvg o, MonadIO m) => Bytes -> m (GValueConstruct o) Source #

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

getSvgStylesheet :: (MonadIO m, IsSvg o) => o -> m (Maybe Bytes) Source #

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

    get svg #stylesheet

setSvgStylesheet :: (MonadIO m, IsSvg o) => o -> Bytes -> m () Source #

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

    set svg [ #stylesheet := value ]

## weight

If not set to -1, this value overrides the weight used when rendering the paintable.

Since: 4.22

constructSvgWeight :: (IsSvg o, MonadIO m) => Double -> m (GValueConstruct o) Source #

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

getSvgWeight :: (MonadIO m, IsSvg o) => o -> m Double Source #

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

    get svg #weight

setSvgWeight :: (MonadIO m, IsSvg o) => o -> Double -> m () Source #

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

    set svg [ #weight := value ]

# Signals

## error

type SvgErrorCallback Source #

Arguments

= GError | `error`: the error
-> IO () |

Signals that an error occurred.

Errors can occur both during parsing and during rendering.

The expected error values are in the [error`gtk`.SvgError] enumeration, context information about the location of parsing errors can be obtained with the various `gtk_svg_error` functions.

Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.

::: note This signal is emitted in the middle of parsing or rendering, and if you handle it, you must be careful. Logging the errors you receive is fine, but modifying the widget hierarchy or changing the paintable state definitively isn't.

If in doubt, defer to an idle.

Since: 4.22

afterSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId Source #

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

    after svg #error 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.

onSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId Source #

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

    on svg #error callback