InspectorWidgetBase.hpp
1 #pragma once
2 #include <score/command/Dispatchers/CommandDispatcher.hpp>
3 
4 #include <QColor>
5 #include <QLabel>
6 #include <QString>
7 #include <QWidget>
8 #include <qnamespace.h>
9 
10 #include <score_lib_inspector_export.h>
11 
12 #include <list>
13 #include <memory>
14 #include <verdigris>
15 
17 class QVBoxLayout;
18 
19 namespace score
20 {
21 struct DocumentContext;
22 class SelectionDispatcher;
23 }
24 
25 namespace Inspector
26 {
27 
28 class VBoxLayout;
36 class SCORE_LIB_INSPECTOR_EXPORT InspectorWidgetBase : public QWidget
37 {
38  W_OBJECT(InspectorWidgetBase)
39 public:
45  explicit InspectorWidgetBase(
46  const IdentifiedObjectAbstract& inspectedObj,
47  const score::DocumentContext& context, QWidget* parent, QString name);
49 
50  const score::DocumentContext& context() const { return m_context; }
51 
52  void updateSectionsView(QVBoxLayout* layout, const std::vector<QWidget*>& contents);
53  void updateAreaLayout(const std::vector<QWidget*>& contents);
54  void updateAreaLayout(std::initializer_list<QWidget*> contents);
55 
56  void addHeader(QWidget* header);
57 
58  // Manage Values
59  const IdentifiedObjectAbstract& inspectedObject() const;
60  const IdentifiedObjectAbstract* inspectedObject_addr() const
61  {
62  return &inspectedObject();
63  }
64 
65  // getters
66  QVBoxLayout* areaLayout() { return m_scrollAreaLayout; }
67 
68  CommandDispatcher<>* commandDispatcher() const { return m_commandDispatcher; }
69 
70 private:
71  const IdentifiedObjectAbstract& m_inspectedObject;
72  const score::DocumentContext& m_context;
73  CommandDispatcher<>* m_commandDispatcher{};
74  QVBoxLayout* m_scrollAreaLayout{};
75 
76  std::vector<QWidget*> m_sections;
77  QColor _currentColor{Qt::gray};
78 
79  static const int m_colorIconSize{21};
80 
81  VBoxLayout* m_layout{};
82  QLabel* m_label{};
83 };
84 }
The CommandDispatcher class.
Definition: CommandDispatcher.hpp:13
Base class for IdentifiedObject.
Definition: IdentifiedObjectAbstract.hpp:16
The InspectorWidgetBase class Set the global structuration for an inspected element.
Definition: InspectorWidgetBase.hpp:37
Definition: lib/score/widgets/Layout.hpp:41
Classes used for making and extending the inspector (default right panel).
Definition: lib/score/widgets/Layout.hpp:27
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DocumentContext.hpp:18