pgLab/pglab/plugin_support/IPluginContentWidgetContext.h

52 lines
1.6 KiB
C
Raw Normal View History

#ifndef IPLUGINCONTENTWIDGETCONTEXT_H
#define IPLUGINCONTENTWIDGETCONTEXT_H
#include <QString>
#include <memory>
#include "plugin_support/ModuleActionParameters.h"
class OpenDatabase;
class PluginContentWidget;
/** This class serves to isolate the plugin from the actual construct in which it is
* used.
*
* It provides interface for operating on the context without needing to many details.
* Actual default implementation is in PluginContentWidgetContextBase.
*/
class IPluginContentWidgetContext {
public:
virtual ~IPluginContentWidgetContext() = default;
/** Tells the context what to use as a caption for this content widget.
*
* Depending on the context the caption might not be visible or used as the caption
* of a window or tab.
*/
virtual void setCaption(PluginContentWidget *content, const QString &caption, const QString &hint = {}) = 0;
/** Tells the context what icon to use.
*
* In general the icon is used in a similar place as the caption.
* \param iconname Assumed to be the name of an iconresource. The system will look for different
* sizes under :/icons/<size>/iconname
*/
virtual void setIcon(PluginContentWidget *content, const QString &iconname) = 0;
/** Returns an OpenDatabase object the widget can use to access
* the database.
*/
virtual std::shared_ptr<OpenDatabase> getDatabase() = 0;
virtual void showStatusMessage(const QString &msg) = 0;
virtual void moduleAction(
const QString &module_identifier,
QString module_action,
const ModuleActionParameters &action_params
) = 0;
virtual void addContentWidget(PluginContentWidget *widget) = 0;
};
#endif // IPLUGINCONTENTWIDGETCONTEXT_H