Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: PaintableInvalidatesizeCallback

[386:7] extends: object

Generated low-level callback wrapper for GIR callback invalidate-size.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • PaintableInvalidatesizeCallback (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, 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: PaintableMeta

[456:14] static extends: object

Generated metadata helpers for Paintable interface surfaces.

Methods

  • signals ()

    Returns signal metadata for Paintable.

    • @r A list.

class: PaintableInvalidatecontentsCallback

[316:7] extends: object

Generated low-level callback wrapper for GIR callback invalidate-contents.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • PaintableInvalidatecontentsCallback (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, 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: Paintable

[46:7] extends: object

An interface for content that can be painted. The content of a GdkPaintable can be painted anywhere at any size without requiring any sort of layout. The interface is inspired by similar concepts elsewhere, such as ClutterContent, HTML/CSS Paint Sources, or SVG Paint Servers. A GdkPaintable can be snapshot at any time and size using [method@Gdk.Paintable.snapshot]. How the paintable interprets that size and if it scales or centers itself into the given rectangle is implementation defined, though if you are implementing a GdkPaintable and don't know what to do, it is suggested that you scale your paintable ignoring any potential aspect ratio. The contents that a GdkPaintable produces may depend on the [class@Gdk.Snapshot] passed to it. For example, paintables may decide to use more detailed images on higher resolution screens or when OpenGL is available. A GdkPaintable will however always produce the same output for the same snapshot. A GdkPaintable may change its contents, meaning that it will now produce a different output with the same snapshot. Once that happens, it will call [method@Gdk.Paintable.invalidate_contents] which will emit the [signal@Gdk.Paintable::invalidate-contents] signal. If a paintable is known to never change its contents, it will set the %GDK_PAINTABLE_STATIC_CONTENTS flag. If a consumer cannot deal with changing contents, it may call [method@Gdk.Paintable.get_current_image] which will return a static paintable and use that. A paintable can report an intrinsic (or preferred) size or aspect ratio it wishes to be rendered at, though it doesn't have to. Consumers of the interface can use this information to layout thepaintable appropriately. Just like the contents, the size of a paintable can change. A paintable will indicate this by calling [method@Gdk.Paintable.invalidate_size] which will emit the [signal@Gdk.Paintable::invalidate-size] signal. And just like for contents, if a paintable is known to never change its size, it will set the %GDK_PAINTABLE_STATIC_SIZE flag. Besides API for applications, there are some functions that are only useful for implementing subclasses and should not be used by applications: [method@Gdk.Paintable.invalidate_contents], [method@Gdk.Paintable.invalidate_size], [func@Gdk.Paintable.new_empty].

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Paintable (Handle = null)

    Creates a new Paintable by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • 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.
  • 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.
  • setOnInvalidatecontents (callback Fn, UserData = null)

    Emitted when the contents of the @paintable change. Examples for such an event would be videos changing to the next frame or the icon theme for an icon changing.

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

    Emitted when the intrinsic size of the @paintable changes. This means the values reported by at least one of [method@Gdk.Paintable.get_intrinsic_width], [method@Gdk.Paintable.get_intrinsic_height] or [method@Gdk.Paintable.get_intrinsic_aspect_ratio] has changed. Examples for such an event would be a paintable displaying the contents of a toplevel surface being resized.

    • @p Fn is the Aussom callback.
    • @p Fn is called with (Paintable Self).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • get_current_image ()

    Gets an immutable paintable for the current contents displayed by

    • @paintable. This is useful when you want to retain the current state of an animation, for example to take a screenshot of a running animation. If the @paintable is already immutable, it will return itself.
  • get_flags ()

    Get flags for the paintable. This is oftentimes useful for optimizations. See [flags@Gdk.PaintableFlags] for the flags and what they mean.

  • get_intrinsic_aspect_ratio ()

    Gets the preferred aspect ratio the @paintable would like to be displayed at. The aspect ratio is the width divided by the height, so a value of 0.5 means that the @paintable prefers to be displayed twice as high as it is wide. Consumers of this interface can use this to preserve aspect ratio when displaying the paintable. This is a purely informational value and does not in any way limit the values that may be passed to [method@Gdk.Paintable.snapshot]. Usually when a @paintable returns nonzero values from [method@Gdk.Paintable.get_intrinsic_width] and [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio should conform to those values, though that is not required. If the @paintable does not have a preferred aspect ratio, it returns 0. Negative values are never returned.

  • get_intrinsic_height ()

    Gets the preferred height the @paintable would like to be displayed at. Consumers of this interface can use this to reserve enough space to draw the paintable. This is a purely informational value and does not in any way limit the values that may be passed to [method@Gdk.Paintable.snapshot]. If the @paintable does not have a preferred height, it returns 0. Negative values are never returned.

  • get_intrinsic_width ()

    Gets the preferred width the @paintable would like to be displayed at. Consumers of this interface can use this to reserve enough space to draw the paintable. This is a purely informational value and does not in any way limit the values that may be passed to [method@Gdk.Paintable.snapshot]. If the @paintable does not have a preferred width, it returns 0. Negative values are never returned.

  • invalidate_contents ()

    Called by implementations of GdkPaintable to invalidate their contents. Unless the contents are invalidated, implementations must guarantee that multiple calls of [method@Gdk.Paintable.snapshot] produce the same output. This function will emit the [signal@Gdk.Paintable::invalidate-contents] signal. If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag, it must not call this function.

    • @r None.
  • invalidate_size ()

    Called by implementations of GdkPaintable to invalidate their size. As long as the size is not invalidated, @paintable must return the same values for its intrinsic width, height and aspect ratio. This function will emit the [signal@Gdk.Paintable::invalidate-size] signal. If a

    • @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag, it must not call this function.
    • @r None.
  • snapshot (object snapshot, double width, double height)

    Snapshots the given paintable with the given @width and @height. The paintable is drawn at the current (0,0) offset of the @snapshot. If

    • @width and @height are not larger than zero, this function will do nothing.
    • @p snapshot is a GdkSnapshot to snapshot to.
    • @p width is width to snapshot in.
    • @p height is height to snapshot in.
    • @r None.