gtkmm 3.89.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | List of all members
Gtk::WidgetCustomSnapshot Class Reference
Widgets

Widget with snapshot_vfunc(). More...

`#include <gtkmm/widgetcustomsnapshot.h>`

Inheritance diagram for Gtk::WidgetCustomSnapshot:
[legend]

## Public Member Functions
| WidgetCustomSnapshot ()
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)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Protected Member Functions
virtual void | snapshot_vfunc (Snapshot& snapshot)
| Called when a widget is supposed to create a snapshot of itself. More...
Protected Member Functions inherited from Glib::ExtraClassInit
| ExtraClassInit (GClassInitFunc class_init_func, void *class_data=nullptr, GInstanceInitFunc instance_init_func=nullptr)
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)

## Additional Inherited Members
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Widget with snapshot_vfunc().

Because of the way gtk+4 renders widgets, Gtk::Widget can't wrap the snapshot virtual function. If you make a custom widget that uses the snapshot vfunc, you must derive your custom widget from both WidgetCustomSnapshot and the relevant widget class. E.g. if you make a custom widget that you want to derive from Gtk::Widget, and you want snapshot_vfunc() to be called:

#include <gtkmm/widgetcustomsnapshot.h>
class MyWidget : public Gtk::WidgetCustomSnapshot, public Gtk::Widget
{
public:
MyWidget()
:
// The GType name will be gtkmm__CustomObject_MyMidget
Glib::ObjectBase("MyWidget"), // Unique class name
Gtk::WidgetCustomSnapshot(),
Gtk::Widget()
{
// ...
}
// ...
protected:
void snapshot_vfunc(Gtk::Snapshot& snapshot) override;
// ...
};

WidgetCustomSnapshot must be listed before the widget class (Gtk::Widget in the example) in the list of base classes.

Do not use WidgetCustomSnapshot for drawing in a Gtk::DrawingArea. Gtk::DrawingArea uses a draw function instead of snapshot_vfunc(). See Gtk::DrawingArea::set_draw_func().

Don't derive from both WidgetCustomDraw and WidgetCustomSnapshot in the same class. It will compile, but probably at most one of signal_draw() and snapshot_vfunc() will work.

Since gtkmm 3.90:

## Constructor & Destructor Documentation

Gtk::WidgetCustomSnapshot::WidgetCustomSnapshot | ( |  | ) |

## Member Function Documentation

virtual void Gtk::WidgetCustomSnapshot::snapshot_vfunc | ( | Snapshot& | snapshot | ) |
| protected virtual

Called when a widget is supposed to create a snapshot of itself.