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

Drawing a widget elsewhere. More...

#include <gtkmm/widgetpaintable.h>

Inheritance diagram for Gtk::WidgetPaintable:
Inheritance graph
[legend]

Public Member Functions

 WidgetPaintable (WidgetPaintable &&src) noexcept
 
WidgetPaintableoperator= (WidgetPaintable &&src) noexcept
 
 ~WidgetPaintable () noexcept override
 
GtkWidgetPaintablegobj ()
 Provides access to the underlying C GObject.
 
const GtkWidgetPaintablegobj () const
 Provides access to the underlying C GObject.
 
GtkWidgetPaintablegobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Widgetget_widget ()
 Returns the widget that is observed or nullptr if none.
 
const Widgetget_widget () const
 Returns the widget that is observed or nullptr if none.
 
void set_widget (Widget &widget)
 Sets the widget that should be observed.
 
void unset_widget ()
 
Glib::PropertyProxy< Widget * > property_widget ()
 The observed widget or nullptr if none.
 
Glib::PropertyProxy_ReadOnly< Widget * > property_widget () const
 The observed widget or nullptr if none.
 
- Public Member Functions inherited from Gdk::Paintable
 Paintable (Paintable &&src) noexcept
 
Paintableoperator= (Paintable &&src) noexcept
 
 ~Paintable () noexcept override
 
GdkPaintablegobj ()
 Provides access to the underlying C GObject.
 
const GdkPaintablegobj () const
 Provides access to the underlying C GObject.
 
void snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
 Snapshots the given paintable with the given width and height.
 
Glib::RefPtr< const Paintableget_current_image () const
 Gets an immutable paintable for the current contents displayed by paintable.
 
Flags get_flags () const
 Get flags for the paintable.
 
int get_intrinsic_width () const
 Gets the preferred width the paintable would like to be displayed at.
 
int get_intrinsic_height () const
 Gets the preferred height the paintable would like to be displayed at.
 
double get_intrinsic_aspect_ratio () const
 Gets the preferred aspect ratio the paintable would like to be displayed at.
 
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.
 
void invalidate_contents ()
 Called by implementations of Gdk::Paintable to invalidate their contents.
 
void invalidate_size ()
 Called by implementations of Gdk::Paintable to invalidate their size.
 
Glib::SignalProxy< void()> signal_invalidate_contents ()
 
Glib::SignalProxy< void()> signal_invalidate_size ()
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< WidgetPaintablecreate ()
 
static Glib::RefPtr< WidgetPaintablecreate (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.
 

Protected Member Functions

 WidgetPaintable ()
 
 WidgetPaintable (Widget &widget)
 
- Protected Member Functions inherited from Gdk::Paintable
 Paintable ()
 You should derive from this class to use it.
 
virtual void snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
 
virtual Glib::RefPtr< Paintableget_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 Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::WidgetPaintablewrap (GtkWidgetPaintable *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Additional Inherited Members

- Public Types inherited from Gdk::Paintable
enum class  Flags {
  Flags::STATIC_SIZE = 1 << 0 ,
  Flags::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
widgetThe widget to observe.

◆ unset_widget()

void Gtk::WidgetPaintable::unset_widget ( )

Friends And Related Symbol Documentation

◆ wrap()

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

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

Parameters
objectThe C instance.
take_copyFalse 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.