Gtk.WidgetPaintable
Description: Reference for Gtk.WidgetPaintable

### Class

# GtkWidgetPaintable

since: 4.0

#### Description [src]

    final class Gtk.WidgetPaintable : GObject.Object
      implements Gdk.Paintable {
      /* No available fields */
    }

`GtkWidgetPaintable` is a `GdkPaintable` that displays the contents of a widget.

`GtkWidgetPaintable` will also take care of the widget not being in a state where it can be drawn (like when it isn’t shown) and just draw nothing or where it does not have a size (like when it is hidden) and report no size in that case.

Of course, `GtkWidgetPaintable` allows you to monitor widgets for size changes by emitting the `GdkPaintable::invalidate-size` signal whenever the size of the widget changes as well as for visual changes by emitting the `GdkPaintable::invalidate-contents` signal whenever the widget changes.

You can use a `GtkWidgetPaintable` everywhere a `GdkPaintable` is allowed, including using it on a `GtkPicture` (or one of its parents) that it was set on itself via gtk_picture_set_paintable(). The paintable will take care of recursion when this happens. If you do this however, ensure that the `GtkPicture:can-shrink` property is set to `TRUE` or you might end up with an infinitely growing widget.

Available since: 4.0

#### Ancestors

- GObject

#### Implements

- GdkPaintable

#### Constructors

###### gtk_widget_paintable_new

Creates a new widget paintable observing the given widget.

since: 4.0

#### Instance methods

###### gtk_widget_paintable_get_widget

Returns the widget that is observed or `NULL` if none.

since: 4.0

###### gtk_widget_paintable_set_widget

Sets the widget that should be observed.

since: 4.0

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GdkPaintable (9)

###### gdk_paintable_compute_concrete_size

Compute a concrete size for the `GdkPaintable`.

since: 4.0

###### gdk_paintable_get_current_image

Gets an immutable paintable for the current contents displayed by `paintable`.

since: 4.0

###### gdk_paintable_get_flags

Get flags for the paintable.

since: 4.0

###### gdk_paintable_get_intrinsic_aspect_ratio

Gets the preferred aspect ratio the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_get_intrinsic_height

Gets the preferred height the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_get_intrinsic_width

Gets the preferred width the `paintable` would like to be displayed at.

since: 4.0

###### gdk_paintable_invalidate_contents

Called by implementations of `GdkPaintable` to invalidate their contents.

since: 4.0

###### gdk_paintable_invalidate_size

Called by implementations of `GdkPaintable` to invalidate their size.

since: 4.0

###### gdk_paintable_snapshot

Snapshots the given paintable with the given `width` and `height`.

since: 4.0

#### Properties

###### Gtk.WidgetPaintable:widget

The observed widget or `NULL` if none.

since: 4.0

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

since: 2.0

##### Signals inherited from GdkPaintable (2)

###### GdkPaintable::invalidate-contents

Emitted when the contents of the `paintable` change.

since: 4.0

###### GdkPaintable::invalidate-size

Emitted when the intrinsic size of the `paintable` changes.

since: 4.0

#### Class structure

    struct GtkWidgetPaintableClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`
  No description available.