Re: How to install a new "property"?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Andrew E. Makeev" <andrew solvo ru> writes:

> 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 ),
> ...
> {
> ...
> }

But where is getting and setting the value handled?  With the C API,
this need not be simple assignment, and the property may not proxy a
class member e.g. a get of the value may compute it on the fly, and a
set of the value may cause the indirect setting of a number of other
properties.


Regards,
Roger

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFCSGPvVcFcaSW/uEgRAjTjAKDBCEDtdqkGJAkmxSFLLB8CBYv17gCfSTVE
Xwv05FNoB/Q0exfC8StK9lk=
=cH61
-----END PGP SIGNATURE-----



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