Loading...
Searching...
No Matches
ProcessInspectorWidgetDelegateFactory.hpp
1#pragma once
2#include <Inspector/InspectorWidgetFactoryInterface.hpp>
3
4#include <score/plugins/Interface.hpp>
5#include <score/tools/SafeCast.hpp>
6
7#include <score_lib_process_export.h>
8class QBoxLayout;
9namespace Process
10{
11class ProcessModel;
12class InspectorWidgetDelegate;
13}
14namespace score
15{
16struct DocumentContext;
17}
18
19namespace Process
20{
21class SCORE_LIB_PROCESS_EXPORT InspectorWidgetDelegateFactory
23{
24public:
26 virtual QWidget* makeProcess(
28 QWidget* parent) const
29 = 0;
30 virtual bool matchesProcess(const Process::ProcessModel&) const = 0;
31
32 virtual void addButtons(
34 QBoxLayout* layout, QWidget* parent) const;
35
36 bool matchesProcess(
37 const Process::ProcessModel& proc, const score::DocumentContext& doc,
38 QWidget* parent) const;
39
40 QWidget* make(
41 const InspectedObjects& objects, const score::DocumentContext& doc,
42 QWidget* parent) const final override;
43 bool matches(const InspectedObjects& objects) const final override;
44
45protected:
46 QWidget* wrap(
47 const Process::ProcessModel& process, const score::DocumentContext& doc,
48 QWidget* widg, QWidget* parent) const;
49};
50
51template <typename Process_T, typename Widget_T>
53{
54private:
55 QWidget* makeProcess(
56 const Process::ProcessModel& process, const score::DocumentContext& doc,
57 QWidget* parent) const override
58 {
59 auto w = new Widget_T{safe_cast<const Process_T&>(process), doc, nullptr};
60
61 return wrap(process, doc, w, parent);
62 }
63
64 bool matchesProcess(const Process::ProcessModel& process) const override
65 {
66 return dynamic_cast<const Process_T*>(&process);
67 }
68};
69
70}
The InspectorWidgetFactoryInterface class.
Definition InspectorWidgetFactoryInterface.hpp:32
Definition ProcessInspectorWidgetDelegateFactory.hpp:53
Definition ProcessInspectorWidgetDelegateFactory.hpp:23
The Process class.
Definition score-lib-process/Process/Process.hpp:61
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition ObjectMatches.hpp:6
Definition DocumentContext.hpp:18