#include <glibmm.h>
{
public:
Person()
:
prop_firstname(*this, "firstname"),
prop_lastname(*this, "lastname"),
prop_age(*this, "age", 10)
{
}
private:
};
void
on_firstname_changed()
{
}
void
on_lastname_changed()
{
}
void
on_age_changed()
{
}
int
main(int, char**)
{
Person p;
p.property_firstname().signal_changed().connect(
sigc::ptr_fun(&on_firstname_changed));
p.property_lastname().signal_changed().connect(
sigc::ptr_fun(&on_lastname_changed));
p.property_age().signal_changed().connect(
sigc::ptr_fun(&on_age_changed));
std::cout <<
"Name, age: " << p.property_firstname() <<
" " << p.property_lastname()
p.property_firstname() = "John";
p.property_lastname() = "Doe";
p.property_age() = 43;
std::cout <<
"Name, age: " << p.property_firstname() <<
" " << p.property_lastname()
return 0;
}
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Glib::ObjectBase is a common base class for Objects and Interfaces.
Definition objectbase.h:56
A PropertyProxy can be used to get and set the value of an object's property.
Definition propertyproxy.h:43
A Glib::Object property.
Definition property.h:207
decltype(auto) ptr_fun(T_return(*func)(T_args...))
void init()
Initialize glibmm.