##// END OF EJS Templates
Creates the visitor that generates a hierarchical menu associated with a variable....
Alexandre Leroux -
r210:9044a6f2b5b4
parent child
Show More
@@ -0,0 +1,38
1 #ifndef SCIQLOP_GENERATEVARIABLEMENUOPERATION_H
2 #define SCIQLOP_GENERATEVARIABLEMENUOPERATION_H
3
4 #include "Visualization/IVisualizationWidgetVisitor.h"
5
6 #include <Common/spimpl.h>
7
8 class QMenu;
9 class Variable;
10
11 /**
12 * @brief The GenerateVariableMenuOperation class defines an operation that traverses all of
13 * visualization widgets to determine which can accommodate a variable. The result of the operation
14 * is a menu that contains actions to add the variable into the containers.
15 */
16 class GenerateVariableMenuOperation : public IVisualizationWidgetVisitor {
17 public:
18 /**
19 * Ctor
20 * @param menu the menu to which to attach the generated menu
21 * @param variable the variable for which to generate the menu
22 */
23 explicit GenerateVariableMenuOperation(QMenu *menu, std::shared_ptr<Variable> variable);
24
25 void visitEnter(VisualizationWidget *widget) override final;
26 void visitLeave(VisualizationWidget *widget) override final;
27 void visitEnter(VisualizationTabWidget *tabWidget) override final;
28 void visitLeave(VisualizationTabWidget *tabWidget) override final;
29 void visitEnter(VisualizationZoneWidget *zoneWidget) override final;
30 void visitLeave(VisualizationZoneWidget *zoneWidget) override final;
31 void visit(VisualizationGraphWidget *graphWidget) override final;
32
33 private:
34 class GenerateVariableMenuOperationPrivate;
35 spimpl::unique_impl_ptr<GenerateVariableMenuOperationPrivate> impl;
36 };
37
38 #endif // SCIQLOP_GENERATEVARIABLEMENUOPERATION_H
@@ -0,0 +1,61
1 #include "Visualization/operations/GenerateVariableMenuOperation.h"
2
3 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/VisualizationTabWidget.h"
5 #include "Visualization/VisualizationZoneWidget.h"
6
7 #include <Variable/Variable.h>
8
9 #include <QMenu>
10
11 struct GenerateVariableMenuOperation::GenerateVariableMenuOperationPrivate {
12 explicit GenerateVariableMenuOperationPrivate(QMenu *menu, std::shared_ptr<Variable> variable)
13 : m_Variable{variable}
14 {
15 }
16
17 std::shared_ptr<Variable> m_Variable;
18 };
19
20 GenerateVariableMenuOperation::GenerateVariableMenuOperation(QMenu *menu,
21 std::shared_ptr<Variable> variable)
22 : impl{spimpl::make_unique_impl<GenerateVariableMenuOperationPrivate>(menu, variable)}
23 {
24 }
25
26 void GenerateVariableMenuOperation::visitEnter(VisualizationWidget *widget)
27 {
28 // VisualizationWidget is not intended to accommodate a variable
29 Q_UNUSED(widget)
30 }
31
32 void GenerateVariableMenuOperation::visitLeave(VisualizationWidget *widget)
33 {
34 // VisualizationWidget is not intended to accommodate a variable
35 Q_UNUSED(widget)
36 }
37
38 void GenerateVariableMenuOperation::visitEnter(VisualizationTabWidget *tabWidget)
39 {
40 /// @todo ALX
41 }
42
43 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget)
44 {
45 /// @todo ALX
46 }
47
48 void GenerateVariableMenuOperation::visitEnter(VisualizationZoneWidget *zoneWidget)
49 {
50 /// @todo ALX
51 }
52
53 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidget)
54 {
55 /// @todo ALX
56 }
57
58 void GenerateVariableMenuOperation::visit(VisualizationGraphWidget *graphWidget)
59 {
60 /// @todo ALX
61 }
General Comments 0
You need to be logged in to leave comments. Login now