Re: Setting custom Glib::Property values in Gtk::Builder .ui XML



On Mon, 10 Jun 2019 at 08:44, Kjell Ahlstedt <kjellahlstedt gmail com> wrote:
On 6/9/19 11:04 AM, Daniel Boles via gtkmm-list wrote:
> Short of having to write an underlying class in C, is there any way to
> have custom derived widgets with custom Glib::Property, and set those
> custom properties through a Gtk::Builder .ui?
>
> Presuming the answer is no, because the properties are only registered
> with GType when the instance is constructed - not when the class is
> constructed, which GtkBuilder won't do anyway if it's C++ - is there
> any way this could possibly work in future, or discussion I can read?
>
I think this has not been possible previously, but what about
Glib::ExtraClassInit, available since glibmm 2.60.0? Do you think it
will help? It makes it possible to add code to the class init func in
your custom widget. If you register properties in the class init func,
like C classes do, you shall probably not use Glib::Property<>, but
rather code that resembles what _WRAP_PROPERTY() generates.


Thanks! I kind of forgot this had gotten arrived in a stable release (but was otherwise wondering if I could trick GObject into doing it anyway!)

I imagine this can probably work, so I'll give it a shot. Do you think it would be possible, or worth thinking about, to add ways to do this (and probably custom signals) in C++? It would be nice if we could add properties and signals to the class without having to go into C (or rather, by having glibmm do that for us). Properties especially, to make them usable with GtkBuilder .ui files as mentioned.

If such properties can be added, could they still be used with Glib::PropertyProxy, or does it require its target property to have been fully created by Glib::Property?



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