ProcessFocusManager.hpp
1 #pragma once
2 #include <Process/Focus/FocusDispatcher.hpp>
3 
4 #include <QObject>
5 #include <QPointer>
6 
7 #include <score_plugin_scenario_export.h>
8 
9 #include <verdigris>
10 namespace score
11 {
12 struct FocusManager;
13 }
14 namespace Process
15 {
16 class LayerPresenter;
17 }
18 namespace Process
19 {
20 class ProcessModel;
21 }
22 namespace Scenario
23 {
24 class ScenarioDocumentPresenter;
25 }
26 // Keeps the focused elements in memory for use by the scenario application
27 // plugin.
28 // Note : focus should not be lost when switching documents. Hence, this
29 // should more be part of the per-document part.
30 namespace Process
31 {
32 class SCORE_PLUGIN_SCENARIO_EXPORT ProcessFocusManager final : public QObject
33 {
34  W_OBJECT(ProcessFocusManager)
35 
36 public:
37  static ProcessFocusManager* get(const score::DocumentContext& ctx);
38 
41 
42  ProcessModel* focusedModel() const;
43  LayerPresenter* focusedPresenter() const;
44 
45  void focus(QPointer<Process::LayerPresenter>);
47 
48  void focusNothing();
49 
50 public:
51  void sig_focusedPresenter(LayerPresenter* arg_1) W_SIGNAL(sig_focusedPresenter, arg_1);
52  void sig_defocusedPresenter(LayerPresenter* arg_1)
53  W_SIGNAL(sig_defocusedPresenter, arg_1);
54 
55  void sig_defocusedViewModel(const ProcessModel* arg_1)
56  W_SIGNAL(sig_defocusedViewModel, arg_1);
57  void sig_focusedViewModel(const ProcessModel* arg_1)
58  W_SIGNAL(sig_focusedViewModel, arg_1);
59 
60  void sig_focusedRoot() W_SIGNAL(sig_focusedRoot);
61 
62 private:
63  void focusPresenter(LayerPresenter*);
64  void defocusPresenter(LayerPresenter*);
65 
66  score::FocusManager& m_mgr;
67 
68  QPointer<ProcessModel> m_currentModel{};
69  QPointer<LayerPresenter> m_currentPresenter{};
70 
71  QMetaObject::Connection m_deathConnection{};
72 };
73 }
Definition: LayerPresenter.hpp:34
Definition: ProcessFocusManager.hpp:33
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
The ScenarioDocumentPresenter class.
Definition: ScenarioDocumentPresenter.hpp:58
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DocumentContext.hpp:18
Definition: FocusManager.hpp:9