gtkmm 4.16.0
|
Drawing a widget elsewhere. More...
#include <gtkmm/widgetpaintable.h>
Public Member Functions | |
WidgetPaintable (WidgetPaintable &&src) noexcept | |
WidgetPaintable & | operator= (WidgetPaintable &&src) noexcept |
~WidgetPaintable () noexcept override | |
GtkWidgetPaintable * | gobj () |
Provides access to the underlying C GObject. | |
const GtkWidgetPaintable * | gobj () const |
Provides access to the underlying C GObject. | |
GtkWidgetPaintable * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Widget * | get_widget () |
Returns the widget that is observed or nullptr if none. | |
const Widget * | get_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 | |
Paintable & | operator= (Paintable &&src) noexcept |
~Paintable () noexcept override | |
GdkPaintable * | gobj () |
Provides access to the underlying C GObject. | |
const GdkPaintable * | gobj () 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 Paintable > | get_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< 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. | |
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< 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 Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gtk::WidgetPaintable > | wrap (GtkWidgetPaintable *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Related Symbols inherited from Gdk::Paintable | |
Glib::RefPtr< Gdk::Paintable > | wrap (GdkPaintable *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... | |
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.
|
noexcept |
|
overridenoexcept |
|
protected |
|
explicitprotected |
|
static |
|
static |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
Widget * Gtk::WidgetPaintable::get_widget | ( | ) |
Returns the widget that is observed or nullptr
if none.
Returns the widget that is observed or nullptr
if none.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
|
noexcept |
Glib::PropertyProxy< Widget * > Gtk::WidgetPaintable::property_widget | ( | ) |
The observed widget or nullptr
if none.
Glib::PropertyProxy_ReadOnly< Widget * > Gtk::WidgetPaintable::property_widget | ( | ) | const |
The observed widget or nullptr
if none.
Sets the widget that should be observed.
widget | The widget to observe. |
void Gtk::WidgetPaintable::unset_widget | ( | ) |
|
related |
A Glib::wrap() method for this object.
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. |