Glib::ObjectBase is a common base class for Objects and Interfaces.
More...
#include <glibmm/objectbase.h>
Glib::ObjectBase is a common base class for Objects and Interfaces.
This is used as virtual base class. This means the ObjectBase constructor runs before all others, either implicitly or explicitly. Each of the available constructors initializes custom_type_name_ in a different way.
- Examples
- properties/properties_example.cc.
◆ ObjectBase() [1/5]
◆ ObjectBase() [2/5]
Glib::ObjectBase::ObjectBase |
( |
| ) |
|
|
protected |
This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
This is normal behaviour for C++ virtual inheritance.
The GType name will be gtkmm__anonymous_custom_type.
◆ ObjectBase() [3/5]
Glib::ObjectBase::ObjectBase |
( |
const char * |
custom_type_name | ) |
|
|
explicitprotected |
A derived constructor always overrides this choice.
The C++ language itself ensures that the constructor is only invoked once.
All classes generated by gtkmmproc use this constructor, with custom_type_name = nullptr, which essentially means it's not a custom type. This is used to optimize vfunc and signal handler callbacks – since the C++ virtual methods are not overridden, invocation can be skipped.
The GType name will be custom_type_name.
◆ ObjectBase() [4/5]
This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually.
This feature is sometimes necessary, e.g. to implement a custom Gtk::CellRenderer. The neat trick with the virtual base class ctor makes it possible to reuse the same direct base class' constructor as with non-custom types.
The GType name will be custom_type_info.name().
◆ ObjectBase() [5/5]
◆ ~ObjectBase()
virtual Glib::ObjectBase::~ObjectBase |
( |
| ) |
|
|
protectedpure virtualnoexcept |
◆ connect_property_changed() [1/2]
You can use the signal_changed() signal of the property proxy instead.
◆ connect_property_changed() [2/2]
sigc::connection Glib::ObjectBase::connect_property_changed |
( |
const Glib::ustring & |
property_name, |
|
|
sigc::slot< void()> && |
slot |
|
) |
| |
◆ freeze_notify()
void Glib::ObjectBase::freeze_notify |
( |
| ) |
|
Increases the freeze count on object.
If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
◆ get_property() [1/2]
template <
class PropertyType >
You probably want to use a specific property_*() accessor method instead.
◆ get_property() [2/2]
template <
class PropertyType >
You probably want to use a specific property_*() accessor method instead.
◆ get_property_value()
You probably want to use a specific property_*() accessor method instead.
◆ gobj() [1/2]
GObject * Glib::ObjectBase::gobj |
( |
| ) |
|
|
inline |
Provides access to the underlying C GObject.
◆ gobj() [2/2]
const GObject * Glib::ObjectBase::gobj |
( |
| ) |
const |
|
inline |
Provides access to the underlying C GObject.
◆ gobj_copy()
GObject * Glib::ObjectBase::gobj_copy |
( |
| ) |
const |
Give a ref-ed copy to someone. Use for direct struct access.
◆ initialize()
void Glib::ObjectBase::initialize |
( |
GObject * |
castitem | ) |
|
|
protected |
◆ initialize_move()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ reference()
Increment the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
◆ set_property()
template <
class PropertyType >
You probably want to use a specific property_*() accessor method instead.
◆ set_property_value()
You probably want to use a specific property_*() accessor method instead.
◆ thaw_notify()
void Glib::ObjectBase::thaw_notify |
( |
| ) |
|
Reverts the effect of a previous call to freeze_notify().
The freeze count is decreased on object and when it reaches zero, all queued "notify" signals are emitted.
It is an error to call this function when the freeze count is zero.
◆ unreference()
Decrement the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.