klass can always be used instead of widget_class, as the casting will be done in the registration macros.