OpenCPN Partial API docs
|
PluginLoader is a backend module without any direct GUI functionality. More...
#include <plugin_loader.h>
Public Member Functions | |
bool | LoadAllPlugIns (bool enabled_plugins, bool keep_orphans=false) |
Update catalog with imported metadata and load all plugin library files. More... | |
const wxBitmap * | GetPluginDefaultIcon () |
void | SetPluginDefaultIcon (const wxBitmap *bitmap) |
void | SetOnDeactivateCb (std::function< void(const PlugInContainer *)> cb) |
Callback invoked in late stage on deactivating a plugin. | |
void | ShowPreferencesDialog (const PlugInData &pd, wxWindow *parent) |
Display the preferences dialog for a plugin. | |
void | NotifySetupOptionsPlugin (const PlugInData *pic) |
void | RemovePlugin (const PlugInData &pd) |
Remove a plugin from *GetPluginArray(). More... | |
void | SortPlugins (int(*cmp_func)(PlugInContainer **, PlugInContainer **)) |
Sort GetPluginArray(). | |
bool | UnLoadPlugIn (size_t ix) |
Unload, delete and remove item ix in GetPlugInArray(). | |
bool | UnLoadAllPlugIns () |
bool | DeactivateAllPlugIns () |
bool | DeactivatePlugIn (PlugInContainer *pic) |
bool | DeactivatePlugIn (const PlugInData &pic) |
bool | UpdatePlugIns () |
void | UpdateManagedPlugins (bool keep_orphans) |
PlugInContainer * | LoadPlugIn (const wxString &plugin_file) |
PlugInContainer * | LoadPlugIn (const wxString &plugin_file, PlugInContainer *pic) |
const ArrayOfPlugIns * | GetPlugInArray () |
bool | IsPlugInAvailable (const wxString &commonName) |
bool | CheckPluginCompatibility (const wxString &plugin_file) |
void | SetEnabled (const wxString &common_name, bool enabled) |
Update enabled/disabled state for plugin with given name. | |
void | SetToolboxPanel (const wxString &common_name, bool value) |
Update m_toolbox_panel state for plugin with given name. | |
Static Public Member Functions | |
static PluginLoader * | getInstance () |
static void | UpdatePlugin (PlugInContainer *plugin, const PluginMetadata &md) |
Update PlugInContainer status using data from PluginMetadata and manifest. More... | |
static std::string | GetPluginVersion (const PlugInData pd, std::function< const PluginMetadata(const std::string &)> get_metadata) |
Return version string for a plugin, possibly with an "Imported" suffix. | |
static PluginMetadata | MetadataByName (const std::string &name) |
Find metadata for given plugin. | |
Public Attributes | |
EventVar | evt_blacklisted_plugin |
EventVar | evt_load_directory |
EventVar | evt_load_plugin |
EventVar | evt_plugin_unload |
EventVar | evt_pluglist_change |
EventVar | evt_unreadable_plugin |
EventVar | evt_deactivate_plugin |
Carries a malloc'ed read-only copy of a PlugInContainer owned by listener. | |
EventVar | evt_update_chart_types |
EventVar | evt_plugin_loadall_finalize |
Emitted after all plugins are loaded. More... | |
EventVar | evt_version_incompatible_plugin |
PluginLoader is a backend module without any direct GUI functionality.
Instead, it generates events listed here. Each event is mirrored by a public variable, by convention having the same name in lower case.
The general usage pattern to process events, here using EVT_LOAD_PLUGIN:
PluginLoader::getInstance()->evt_load_plugin.listen(this, EVT_LOAD_PLUGIN) Bind(EVT_LOAD_PLUGIN, [&](ObservedEvt ev) { code to run on event... });
The code in plugin_loader uses evt_load_plugin.Notify() to trigger the event. Notify() might have a string or void* argument; these are available as ev.GetString() or ev.GetClientData() in the Bind() lambda function. There is a also a generic std::shared_ptr available as using GetSharedPtr();
Examples: PlugInManager::PlugInManager() in pluginmanager.cpp
Definition at line 154 of file plugin_loader.h.
bool PluginLoader::LoadAllPlugIns | ( | bool | enabled_plugins, |
bool | keep_orphans = false |
||
) |
Update catalog with imported metadata and load all plugin library files.
enabled_plugins | If true, only load enabled plugins |
keep_orphans | If true, don't scrub plugins not available in the catalog. |
Definition at line 415 of file plugin_loader.cpp.
void PluginLoader::RemovePlugin | ( | const PlugInData & | pd | ) |
|
static |
Update PlugInContainer status using data from PluginMetadata and manifest.
Update PlugInContainer using data from PluginMetadata and manifest.
Definition at line 866 of file plugin_loader.cpp.
EventVar PluginLoader::evt_plugin_loadall_finalize |
Emitted after all plugins are loaded.
Event carries a std::vector<LoadError> available though GetSharedPtr()
Definition at line 190 of file plugin_loader.h.