Mercurial > hg > orthanc
diff Plugins/OrthancCPlugin/OrthancCPlugin.h @ 1232:f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Dec 2014 17:04:40 +0100 |
parents | 1169528a9a5f |
children | eac00401cb96 |
line wrap: on
line diff
--- a/Plugins/OrthancCPlugin/OrthancCPlugin.h Fri Nov 28 12:39:22 2014 +0100 +++ b/Plugins/OrthancCPlugin/OrthancCPlugin.h Thu Dec 04 17:04:40 2014 +0100 @@ -153,6 +153,13 @@ #endif /** + * Forward declaration of one of the mandatory functions for Orthanc + * plugins. + **/ + ORTHANC_PLUGINS_API const char* OrthancPluginGetName(); + + + /** * The various HTTP methods for a REST call. **/ typedef enum @@ -241,6 +248,7 @@ _OrthancPluginService_GetOrthancPath = 4, _OrthancPluginService_GetOrthancDirectory = 5, _OrthancPluginService_GetConfigurationPath = 6, + _OrthancPluginService_SetProperty = 7, /* Registration of callbacks */ _OrthancPluginService_RegisterRestCallback = 1000, @@ -281,6 +289,14 @@ } _OrthancPluginService; + typedef enum + { + _OrthancPluginProperty_Description = 1, + _OrthancPluginProperty_RootUri = 2, + _OrthancPluginProperty_OrthancExplorer = 3 + } _OrthancPluginProperty; + + /** * The memory layout of the pixels of an image. @@ -1712,6 +1728,62 @@ + typedef struct + { + const char* plugin; + _OrthancPluginProperty property; + const char* value; + } _OrthancPluginSetProperty; + + + /** + * @brief Set the URI where the plugin provides its Web interface. + * + * For plugins that come with a Web interface, this function + * declares the entry path where to find this interface. This + * information is notably used in the "Plugins" page of Orthanc + * Explorer. + * + * @param context The Orthanc plugin context, as received by OrthancPluginInitialize(). + * @param uri The root URI for this plugin. + **/ + ORTHANC_PLUGIN_INLINE void OrthancPluginSetRootUri( + OrthancPluginContext* context, + const char* uri) + { + _OrthancPluginSetProperty params; + params.plugin = OrthancPluginGetName(); + params.property = _OrthancPluginProperty_RootUri; + params.value = uri; + + context->InvokeService(context, _OrthancPluginService_SetProperty, ¶ms); + } + + + ORTHANC_PLUGIN_INLINE void OrthancPluginSetDescription( + OrthancPluginContext* context, + const char* description) + { + _OrthancPluginSetProperty params; + params.plugin = OrthancPluginGetName(); + params.property = _OrthancPluginProperty_Description; + params.value = description; + + context->InvokeService(context, _OrthancPluginService_SetProperty, ¶ms); + } + + + ORTHANC_PLUGIN_INLINE void OrthancPluginExtendOrthancExplorer( + OrthancPluginContext* context, + const char* javascript) + { + _OrthancPluginSetProperty params; + params.plugin = OrthancPluginGetName(); + params.property = _OrthancPluginProperty_OrthancExplorer; + params.value = javascript; + + context->InvokeService(context, _OrthancPluginService_SetProperty, ¶ms); + } #ifdef __cplusplus }