From 9b635c9b20c68e60d63ee41b9ab42aa096a5b9a9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 21 Jan 2023 05:41:47 -0500 Subject: [PATCH] Add `ModuleWidget::getModule()` helper method. --- include/app/ModuleWidget.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/app/ModuleWidget.hpp b/include/app/ModuleWidget.hpp index 7eab7a53..ac01720b 100644 --- a/include/app/ModuleWidget.hpp +++ b/include/app/ModuleWidget.hpp @@ -31,7 +31,13 @@ struct ModuleWidget : widget::OpaqueWidget { plugin::Model* getModel(); void setModel(plugin::Model* model); + /** Returns the attached Module. */ engine::Module* getModule(); + /** Returns the attached Module, casted to the given Module type. */ + template + TModule* getModule() { + return dynamic_cast(getModule()); + } /** Associates this ModuleWidget with the Module. Transfers ownership. */