Browse Source

Add `ModuleWidget::getModule<TModule>()` helper method.

tags/v2.2.3
Andrew Belt 1 year ago
parent
commit
9b635c9b20
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      include/app/ModuleWidget.hpp

+ 6
- 0
include/app/ModuleWidget.hpp View File

@@ -31,7 +31,13 @@ struct ModuleWidget : widget::OpaqueWidget {
plugin::Model* getModel(); plugin::Model* getModel();
void setModel(plugin::Model* model); void setModel(plugin::Model* model);


/** Returns the attached Module. */
engine::Module* getModule(); engine::Module* getModule();
/** Returns the attached Module, casted to the given Module type. */
template <class TModule>
TModule* getModule() {
return dynamic_cast<TModule*>(getModule());
}
/** Associates this ModuleWidget with the Module. /** Associates this ModuleWidget with the Module.
Transfers ownership. Transfers ownership.
*/ */


Loading…
Cancel
Save