Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: SvgWidget

[25:7] extends: object

A widget that renders SVG, with animations and event handling. GtkSvgWidget uses [class@Gtk.Svg] internally, and should read its documentation to learn about the supported SVG features and extensions. On top of the GtkSvg rendering, GtkSvgWidget adds event handling. Tab and Shift+Tab keys can be used to move the focus and Enter and clicks will activate links by emitting the [signal@Gtk.SvgWidget::activate] signal. The tabindex attribute can be used to influence what elements act as focus locations. The styling of the SVG content is following input-related pseudo states such as :focus, :hover or :visited (for links). If [property@Gtk.Widget:has-tooltip] is set, then the content of <title> elements will be shown as tooltips. SVG animations and different <view>s can be triggered by input events as well. See the SVG animation specification for details.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • SvgWidget ()

    Creates a new, empty GtkSvgWidget.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnActivate (callback Fn, UserData = null)

    Emitted when a link or other element is activated. Activating elements can be achieved by clicking or by hitting Enter while the element has focus.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (SvgWidget Self, string Id).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • setOnError (callback Fn, UserData = null)

    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.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (SvgWidget Self, Error Error).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setResource (string Value)

    Writes the resource property.

    • @p Value is the new property value.
    • @r None.
  • setState (int Value)

    Writes the state property.

    • @p Value is the new property value.
    • @r None.
  • setStylesheet (object Value)

    Writes the stylesheet property.

    • @p Value is the new property value.
    • @r None.
  • get_state ()

    Gets the current state of the widget.

  • get_stylesheet ()

    Gets the CSS user stylesheet.

  • load_from_bytes (object bytes)

    Loads SVG content into an existing SVG widget. To track errors while loading SVG content, connect to the [signal@Gtk.SvgWidget::error] signal. This clears any previously loaded content.

    • @p bytes is the data to data.
    • @r None.
  • set_state (int state)

    Sets the state of the widget. 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.

    • @p state is the state to set, as a value between 0 and 63.
    • @r None.
  • set_stylesheet (object bytes)

    Sets a CSS user stylesheet to use. Note that styles are applied at load time, so this function must be called before loading SVG.

    • @p bytes is CSS data.
    • @r None.

class: SvgWidgetMeta

[462:14] static extends: object

Generated metadata helpers for SvgWidget class surfaces.

Methods

  • properties ()

    Returns property metadata for SvgWidget.

    • @r A list.
  • signals ()

    Returns signal metadata for SvgWidget.

    • @r A list.

class: SvgWidgetErrorCallback

[391:7] extends: object

Generated low-level callback wrapper for GIR callback error.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SvgWidgetErrorCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, error, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.

class: SvgWidgetActivateCallback

[321:7] extends: object

Generated low-level callback wrapper for GIR callback activate.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • SvgWidgetActivateCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, id, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.