How to invoke parent class methods from subclass?

When creating a subclass via the glib::wrapper macro, it turns out that only the trait methods are extended from the parent classes. Methods “directly” implemented from the parent class cannot be invoked from the subclass.

For instance, the set_interactive_debugging method is implemented by gtk::Window. When creating a subclass as follows, the method is not available from the subclass:

wrapper! {
    pub struct Window(ObjectSubclass<WindowPriv>)
    @extends gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable;
}

How do we make these parent methods available to subclass? Is there a helper macro?

Hello, that method is a static method (it has no self parameter), so it does not need to be available on the subclass to be called.

(If you find a method for a non-final class that has a self parameter, and is not in the Ext or ExtManual trait, then bugs or PRs should be filed to fix those, but not this one)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.