Re: How to install a new "property"?



Roger Leigh wrote:

dzho002 <zhou_dx yahoo com> writes:

how I can install/register the new property (do I need do that at
all?) Is the function, PropertyBase::install_property, for this
purpose?

I think you want to firstly install the property.  You want
g_object_class_install_property() for that (in C) or add a private
Glib::Property member to your class (in addition to the PropertyProxy,
which proxies it).

I'm not totally sure of how this should be handled in C++.  If it's
the same as C, you should override the set_property() and get_property
methods of Glib::ObjectBase, but these aren't virtual...
class MyClass : public Glib::Object
{
...
public:
Glib::PropertyProxy<void *> property_data() {return property_data_.get_proxy(); }
private:
   Glib::Property<void *> property_data_;
...
};

MyClass::MyClass() :
...
property_data_( *this, "data", (void *)0 ),
...
{
...
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]