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. | |
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(). | |
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. | |
void | SetSetupOptions (const wxString &common_name, bool value) |
Update m_has_setup_options 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. | |
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. | |
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 155 of file plugin_loader.h.
bool PluginLoader::CheckPluginCompatibility | ( | const wxString & | plugin_file | ) |
Definition at line 1161 of file plugin_loader.cpp.
bool PluginLoader::DeactivateAllPlugIns | ( | ) |
Definition at line 981 of file plugin_loader.cpp.
bool PluginLoader::DeactivatePlugIn | ( | const PlugInData & | pic | ) |
Definition at line 814 of file plugin_loader.cpp.
bool PluginLoader::DeactivatePlugIn | ( | PlugInContainer * | pic | ) |
Definition at line 802 of file plugin_loader.cpp.
|
static |
Definition at line 295 of file plugin_loader.cpp.
|
inline |
Definition at line 236 of file plugin_loader.h.
const wxBitmap * PluginLoader::GetPluginDefaultIcon | ( | ) |
Definition at line 396 of file plugin_loader.cpp.
|
static |
Return version string for a plugin, possibly with an "Imported" suffix.
Definition at line 154 of file plugin_loader.cpp.
bool PluginLoader::IsPlugInAvailable | ( | const wxString & | commonName | ) |
Definition at line 311 of file plugin_loader.cpp.
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 425 of file plugin_loader.cpp.
PlugInContainer * PluginLoader::LoadPlugIn | ( | const wxString & | plugin_file | ) |
Definition at line 1403 of file plugin_loader.cpp.
PlugInContainer * PluginLoader::LoadPlugIn | ( | const wxString & | plugin_file, |
PlugInContainer * | pic | ||
) |
Definition at line 1413 of file plugin_loader.cpp.
|
static |
Find metadata for given plugin.
Definition at line 854 of file plugin_loader.cpp.
void PluginLoader::NotifySetupOptionsPlugin | ( | const PlugInData * | pic | ) |
Definition at line 327 of file plugin_loader.cpp.
void PluginLoader::RemovePlugin | ( | const PlugInData & | pd | ) |
void PluginLoader::SetEnabled | ( | const wxString & | common_name, |
bool | enabled | ||
) |
Update enabled/disabled state for plugin with given name.
Definition at line 362 of file plugin_loader.cpp.
|
inline |
Callback invoked in late stage on deactivating a plugin.
Definition at line 209 of file plugin_loader.h.
void PluginLoader::SetPluginDefaultIcon | ( | const wxBitmap * | bitmap | ) |
Definition at line 401 of file plugin_loader.cpp.
void PluginLoader::SetSetupOptions | ( | const wxString & | common_name, |
bool | value | ||
) |
Update m_has_setup_options state for plugin with given name.
Definition at line 384 of file plugin_loader.cpp.
void PluginLoader::SetToolboxPanel | ( | const wxString & | common_name, |
bool | value | ||
) |
Update m_toolbox_panel state for plugin with given name.
Definition at line 372 of file plugin_loader.cpp.
void PluginLoader::ShowPreferencesDialog | ( | const PlugInData & | pd, |
wxWindow * | parent | ||
) |
Display the preferences dialog for a plugin.
Definition at line 320 of file plugin_loader.cpp.
void PluginLoader::SortPlugins | ( | int(*)(PlugInContainer **, PlugInContainer **) | cmp_func | ) |
Sort GetPluginArray().
Definition at line 420 of file plugin_loader.cpp.
bool PluginLoader::UnLoadAllPlugIns | ( | ) |
Definition at line 971 of file plugin_loader.cpp.
bool PluginLoader::UnLoadPlugIn | ( | size_t | ix | ) |
Unload, delete and remove item ix in GetPlugInArray().
Definition at line 824 of file plugin_loader.cpp.
void PluginLoader::UpdateManagedPlugins | ( | bool | keep_orphans | ) |
Definition at line 912 of file plugin_loader.cpp.
|
static |
Update PlugInContainer status using data from PluginMetadata and manifest.
Update PlugInContainer using data from PluginMetadata and manifest.
Definition at line 885 of file plugin_loader.cpp.
bool PluginLoader::UpdatePlugIns | ( | ) |
Definition at line 738 of file plugin_loader.cpp.
EventVar PluginLoader::evt_blacklisted_plugin |
Definition at line 172 of file plugin_loader.h.
EventVar PluginLoader::evt_deactivate_plugin |
Carries a malloc'ed read-only copy of a PlugInContainer owned by listener.
Definition at line 183 of file plugin_loader.h.
EventVar PluginLoader::evt_load_directory |
Definition at line 174 of file plugin_loader.h.
EventVar PluginLoader::evt_load_plugin |
Definition at line 175 of file plugin_loader.h.
EventVar PluginLoader::evt_plugin_loadall_finalize |
Emitted after all plugins are loaded.
Event carries a std::vector<LoadError> available though GetSharedPtr()
Definition at line 191 of file plugin_loader.h.
EventVar PluginLoader::evt_plugin_unload |
Definition at line 176 of file plugin_loader.h.
EventVar PluginLoader::evt_pluglist_change |
Definition at line 177 of file plugin_loader.h.
EventVar PluginLoader::evt_unreadable_plugin |
Definition at line 178 of file plugin_loader.h.
EventVar PluginLoader::evt_update_chart_types |
Definition at line 185 of file plugin_loader.h.
EventVar PluginLoader::evt_version_incompatible_plugin |
Definition at line 193 of file plugin_loader.h.