Sign up

Glade and Custom widgets: How can I use Composite Widget Templates with gtk.Builder?

With gtk.Builder I can do
auto mainWindow = cast(ApplicationWindow)builder.getObject("mainWindow");
But if I want to to make a derived class MainWindow : ApplicationWindow how could I use it with gtk.Builder? I understand that the native gtk way of doing this is with Composite Widget Templates but I don't see anything on the gtkD docs.
Thanks.

Re: Glade and Custom widgets: How can I use Composite Widget Templates with gtk.Builder?

On 04-07-18 16:30, Paulie Saint wrote:

With gtk.Builder I can do
auto mainWindow = cast(ApplicationWindow)builder.getObject("mainWindow");
But if I want to to make a derived class MainWindow : ApplicationWindow how could I use it with gtk.Builder? I understand that the native gtk way of doing this is with Composite Widget Templates but I don't see anything on the gtkD docs.
Thanks.

We don't have anything implemented to support that, the best you can do
today with gtkd is to do this in the constructor of MainWindow:

super(cast(GtkApplicationWindow*)gtk_builder_get_object(builder.getBuilderStruct(),"mainwindow"));

Re: Glade and Custom widgets: How can I use Composite Widget Templates with gtk.Builder?

super(cast(GtkApplicationWindow*)gtk_builder_get_object(builder.getBuilderStruct(),"mainwindow"));

where does gtk_builder_get_object comes from? I see that it's the original c function but I don't see where that binding is defined in gtkD.

I'm doing this with works good enough.

auto s = builder.getObject("mainWindow");
assert(s !is null);
this(cast(GtkApplicationWindow*)s.getObjectGStruct());