Glib::ObjectBase Class Referenceabstract

Glib::ObjectBase is a common base class for Objects and Interfaces. More...

`#include <glibmm/objectbase.h>`

Inheritance diagram for Glib::ObjectBase:
[legend]

## Public Member Functions

| ObjectBase (const ObjectBase&)=delete
ObjectBase& | operator= (const ObjectBase&)=delete
void | set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value)
| You probably want to use a specific property_*() accessor method instead. More...
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | set_property (const Glib::ustring& property_name, const PropertyType& value)
| You probably want to use a specific property_*() accessor method instead. More...
template<class PropertyType >
void | get_property (const Glib::ustring& property_name, PropertyType& value) const
| You probably want to use a specific property_*() accessor method instead. More...
void | connect_property_changed (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | connect_property_changed (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, const sigc::slot< void >& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, sigc::slot< void >&& slot)
| You can use the signal_changed() signal of the property proxy instead. More...
void | freeze_notify ()
| Increases the freeze count on object. More...
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify(). More...
virtual void | reference () const
| Increment the reference count for this object. More...
virtual void | unreference () const
| Decrement the reference count for this object. More...
GObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GObject* | gobj () const
| Provides access to the underlying C GObject. More...
GObject* | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access. More...
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

| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...
| ObjectBase (const char* custom_type_name)
| A derived constructor always overrides this choice. More...
| ObjectBase (const std::type_info& custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...
| 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

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.

## Constructor & Destructor Documentation

Glib::ObjectBase::ObjectBase | ( | const ObjectBase& |  | ) |

delete

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.

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.

Glib::ObjectBase::ObjectBase | ( | const std::type_info & | custom_type_info | ) |

explicitprotected

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().

Glib::ObjectBase::ObjectBase | ( | ObjectBase&& | src | ) |

protectednoexcept

virtual Glib::ObjectBase::~ObjectBase | ( |  | ) |

protectedpure virtualnoexcept

## Member Function Documentation

void Glib::ObjectBase::connect_property_changed | ( | const Glib::ustring& | property_name,
|  | const sigc::slot< void > & | slot
| ) |  |

You can use the signal_changed() signal of the property proxy instead.

See also connect_property_changed_with_return().

void Glib::ObjectBase::connect_property_changed | ( | const Glib::ustring& | property_name,
|  | sigc::slot< void > && | slot
| ) |  |

You can use the signal_changed() signal of the property proxy instead.

Since glibmm 2.48:

sigc::connection Glib::ObjectBase::connect_property_changed_with_return | ( | const Glib::ustring& | property_name,
|  | const sigc::slot< void > & | slot
| ) |  |

You can use the signal_changed() signal of the property proxy instead.

This method was added because connect_property_changed() does not return a sigc::connection, and we could not break the ABI by changing that function.

sigc::connection Glib::ObjectBase::connect_property_changed_with_return | ( | const Glib::ustring& | property_name,
|  | sigc::slot< void > && | slot
| ) |  |

You can use the signal_changed() signal of the property proxy instead.

Since glibmm 2.48:

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.

template <class PropertyType >

void Glib::ObjectBase::get_property | ( | const Glib::ustring& | property_name,
|  | PropertyType & | value
| ) |  | const

You probably want to use a specific property_*() accessor method instead.

void Glib::ObjectBase::get_property_value | ( | const Glib::ustring& | property_name,
|  | Glib::ValueBase& | value
| ) |  | const

You probably want to use a specific property_*() accessor method instead.

GObject* Glib::ObjectBase::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

const GObject* Glib::ObjectBase::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

GObject* Glib::ObjectBase::gobj_copy | ( |  | ) | const

Give a ref-ed copy to someone. Use for direct struct access.

void Glib::ObjectBase::initialize | ( | GObject * | castitem | ) |

protected

void Glib::ObjectBase::initialize_move | ( | GObject * | castitem,
|  | Glib::ObjectBase* | previous_wrapper
| ) |  |

protected

ObjectBase& Glib::ObjectBase::operator= | ( | const ObjectBase& |  | ) |

delete

ObjectBase& Glib::ObjectBase::operator= | ( | ObjectBase&& | src | ) |

protectednoexcept

virtual void Glib::ObjectBase::reference | ( |  | ) | const

virtual

Increment the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.

template <class PropertyType >

void Glib::ObjectBase::set_property | ( | const Glib::ustring& | property_name,
|  | const PropertyType & | value
| ) |  |

You probably want to use a specific property_*() accessor method instead.

void Glib::ObjectBase::set_property_value | ( | const Glib::ustring& | property_name,
|  | const Glib::ValueBase& | value
| ) |  |

You probably want to use a specific property_*() accessor method instead.

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.

virtual void Glib::ObjectBase::unreference | ( |  | ) | const

virtual

Decrement the reference count for this object.

You should never need to do this manually - use the object via a RefPtr instead.