gtkmm: Gtk::WidgetPaintable Class Reference

gtkmm 4.9.1

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::WidgetPaintable Class Reference

Drawing a widget elsewhere. More...

`#include <gtkmm/widgetpaintable.h>`

Inheritance diagram for Gtk::WidgetPaintable:
[legend]

## Public Member Functions
| WidgetPaintable (WidgetPaintable && src) noexcept
WidgetPaintable & | operator= (WidgetPaintable && src) noexcept
| ~WidgetPaintable () noexcept override
GtkWidgetPaintable * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkWidgetPaintable * | gobj () const
| Provides access to the underlying C GObject. More...
GtkWidgetPaintable * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Widget * | get_widget ()
| Returns the widget that is observed or `nullptr` if none. More...
const Widget * | get_widget () const
| Returns the widget that is observed or `nullptr` if none. More...
void | set_widget (Widget & widget)
| Sets the widget that should be observed. More...
void | unset_widget ()
Glib::PropertyProxy< Widget * > | property_widget ()
| The observed widget or `nullptr` if none. More...
Glib::PropertyProxy_ReadOnly< Widget * > | property_widget () const
| The observed widget or `nullptr` if none. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const
Public Member Functions inherited from Gdk::Paintable
| Paintable (Paintable && src) noexcept
Paintable & | operator= (Paintable && src) noexcept
| ~Paintable () noexcept override
GdkPaintable * | gobj ()
| Provides access to the underlying C GObject. More...
const GdkPaintable * | gobj () const
| Provides access to the underlying C GObject. More...
void | snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
| Snapshots the given paintable with the given width and height. More...
Glib::RefPtr< const Paintable > | get_current_image () const
| Gets an immutable paintable for the current contents displayed by paintable. More...
Flags | get_flags () const
| Get flags for the paintable. More...
int | get_intrinsic_width () const
| Gets the preferred width the paintable would like to be displayed at. More...
int | get_intrinsic_height () const
| Gets the preferred height the paintable would like to be displayed at. More...
double | get_intrinsic_aspect_ratio () const
| Gets the preferred aspect ratio the paintable would like to be displayed at. More...
void | compute_concrete_size (double specified_width, double specified_height, double default_width, double default_height, double & concrete_width, double & concrete_height) const
| Compute a concrete size for the `Gdk::Paintable`. More...
void | invalidate_contents ()
| Called by implementations of `Gdk::Paintable` to invalidate their contents. More...
void | invalidate_size ()
| Called by implementations of `Gdk::Paintable` to invalidate their size. More...
Glib::SignalProxy< void()> | signal_invalidate_contents ()
Glib::SignalProxy< void()> | signal_invalidate_size ()
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< WidgetPaintable > | create ()
static Glib::RefPtr< WidgetPaintable > | create (Widget & widget)
Static Public Member Functions inherited from Gdk::Paintable
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| WidgetPaintable ()
| WidgetPaintable (Widget & widget)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gdk::Paintable
| Paintable ()
| You should derive from this class to use it. More...
virtual void | snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
virtual Glib::RefPtr< Paintable > | get_current_image_vfunc () const
virtual Flags | get_flags_vfunc () const
virtual int | get_intrinsic_width_vfunc () const
virtual int | get_intrinsic_height_vfunc () const
virtual double | get_intrinsic_aspect_ratio_vfunc () const

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::WidgetPaintable > | wrap (GtkWidgetPaintable * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gdk::Paintable
Glib::RefPtr< Gdk::Paintable > | wrap (GdkPaintable * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from Gdk::Paintable
enum class | Flags { STATIC_SIZE = 1 << 0 , STATIC_CONTENTS = 1 << 1 }
| Flags about a paintable object. More...

## Detailed Description

Drawing a widget elsewhere.

Gtk::WidgetPaintable is an implementation of the Gdk::Paintable interface that allows displaying the contents of a Gtk::Widget.

WidgetPaintable 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, WidgetPaintable allows you to monitor widgets for size changes by emitting Gdk::Paintable::signal_invalidate_size() whenever the size of the widget changes as well as for visual changes by emitting Gdk::Paintable::signal_invalidate_contents() whenever the widget changes.

You can of course use a Gtk::WidgetPaintable everywhere a Gdk::Paintable is allowed, including using it on a Gtk::Picture (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 Gtk::Picture::property_can_shrink() is set to `true` or you might end up with an infinitely growing widget.

Since gtkmm 3.94:

## Constructor & Destructor Documentation

## ◆ WidgetPaintable() [1/3]

Gtk::WidgetPaintable::WidgetPaintable | ( | WidgetPaintable && | src | ) |
| noexcept

## ◆ ~WidgetPaintable()

Gtk::WidgetPaintable::~WidgetPaintable | ( |  | ) |
| overridenoexcept

## ◆ WidgetPaintable() [2/3]

Gtk::WidgetPaintable::WidgetPaintable | ( |  | ) |
| protected

## ◆ WidgetPaintable() [3/3]

Gtk::WidgetPaintable::WidgetPaintable | ( | Widget & | widget | ) |
| explicitprotected

## Member Function Documentation

## ◆ create() [1/2]

static Glib::RefPtr<WidgetPaintable> Gtk::WidgetPaintable::create | ( |  | ) |
| static

## ◆ create() [2/2]

static Glib::RefPtr<WidgetPaintable> Gtk::WidgetPaintable::create | ( | Widget & | widget | ) |
| static

## ◆ get_type()

static GType Gtk::WidgetPaintable::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_widget() [1/2]

Widget* Gtk::WidgetPaintable::get_widget | ( |  | ) |

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

Returns
  The observed widget.

## ◆ get_widget() [2/2]

const Widget* Gtk::WidgetPaintable::get_widget | ( |  | ) | const

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

Returns
  The observed widget.

## ◆ gobj() [1/2]

GtkWidgetPaintable* Gtk::WidgetPaintable::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkWidgetPaintable* Gtk::WidgetPaintable::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkWidgetPaintable* Gtk::WidgetPaintable::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

WidgetPaintable& Gtk::WidgetPaintable::operator= | ( | WidgetPaintable && | src | ) |
| noexcept

## ◆ property_widget() [1/2]

Glib::PropertyProxy< Widget* > Gtk::WidgetPaintable::property_widget | ( |  | ) |

The observed widget or `nullptr` if none.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_widget() [2/2]

Glib::PropertyProxy_ReadOnly< Widget* > Gtk::WidgetPaintable::property_widget | ( |  | ) | const

The observed widget or `nullptr` if none.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ set_widget()

void Gtk::WidgetPaintable::set_widget | ( | Widget & | widget | ) |

Sets the widget that should be observed.

Parameters

  widget | The widget to observe.

## ◆ unset_widget()

void Gtk::WidgetPaintable::unset_widget | ( |  | ) |

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::WidgetPaintable > wrap | ( | GtkWidgetPaintable * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.