WidgetLayerPresenter.hpp
1 #pragma once
2 #include <Process/Focus/FocusDispatcher.hpp>
3 #include <Process/LayerPresenter.hpp>
4 #include <Process/Process.hpp>
5 #include <Process/WidgetLayer/WidgetLayerPresenter.hpp>
6 #include <Process/WidgetLayer/WidgetLayerView.hpp>
7 #include <Process/ZoomHelper.hpp>
8 
9 #include <score/document/DocumentContext.hpp>
10 #include <score/document/DocumentInterface.hpp>
11 #include <score/model/Identifier.hpp>
12 
13 #include <score_lib_process_export.h>
14 
15 namespace WidgetLayer
16 {
17 template <typename Process_T, typename Widget_T>
18 class Presenter final : public Process::LayerPresenter
19 {
20 public:
21  explicit Presenter(
22  const Process::ProcessModel& model, View* view, const Process::Context& ctx,
23  QObject* parent)
24  : LayerPresenter{model, view, ctx, parent}
25  , m_view{view}
26  {
27  putToFront();
28 
29  m_view->setWidget(new Widget_T{static_cast<const Process_T&>(model), ctx, nullptr});
30  }
31 
32  void setWidth(qreal width, qreal defaultWidth) override { m_view->setWidth(width); }
33  void setHeight(qreal val) override { m_view->setHeight(val); }
34 
35  void putToFront() override { m_view->setVisible(true); }
36 
37  void putBehind() override { m_view->setVisible(false); }
38 
39  void on_zoomRatioChanged(ZoomRatio) override { }
40 
41  void parentGeometryChanged() override { }
42 
43 private:
44  View* m_view{};
45 };
46 }
Definition: LayerPresenter.hpp:34
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
Definition: WidgetLayerPresenter.hpp:19
Definition: WidgetLayerView.hpp:15
Definition: ProcessContext.hpp:12