node-action.hh
Go to the documentation of this file.
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef GEPETTO_GUI_NODE_ACTION_HH
18 #define GEPETTO_GUI_NODE_ACTION_HH
19 
20 #include <gepetto/gui/fwd.hh>
21 
22 #include <QAction>
23 
24 namespace gepetto {
25  namespace gui {
26  class NodeActionBase : public QAction {
27  Q_OBJECT
28 
29  public:
30  NodeActionBase(const QString& text, NodePtr_t node, QWidget* parent);
31 
32  virtual ~NodeActionBase () {}
33 
34  NodePtr_t node () const;
35 
36  protected:
37  virtual void act(bool checked) = 0;
38 
39  private slots:
40  void _act(bool checked);
41 
42  private:
43  NodePtr_t node_;
44  };
45 
46  class NodeAction : public NodeActionBase {
47  public:
48  enum Type {
54  REMOVE_NODE
55  };
56 
57  NodeAction(const Type& t, const QString& text, NodePtr_t node, QWidget* parent);
58 
59  NodeAction(const Type& t, const QString& text, QWidget* parent);
60 
62  NodeAction(const QString& text, NodePtr_t node, OSGWidget* window, QWidget* parent);
63 
65  NodeAction(const QString& text, OSGWidget* window, QWidget* parent);
66 
67  virtual ~NodeAction () {}
68 
69  protected:
70  void act(bool checked);
71 
72  private:
73  const Type type_;
74  OSGWidget* window_;
75  };
76  }
77 }
78 
79 #endif // GEPETTO_GUI_NODE_ACTION_HH
virtual ~NodeAction()
Definition: node-action.hh:67
virtual void act(bool checked)=0
Definition: node-action.hh:26
Definition: node-action.hh:49
Type
Definition: node-action.hh:48
viewer::NodePtr_t NodePtr_t
Definition: fwd.hh:47
Definition: action-search-bar.hh:27
Definition: node-action.hh:52
Definition: node-action.hh:51
Definition: node-action.hh:46
virtual ~NodeActionBase()
Definition: node-action.hh:32
Definition: node-action.hh:50
NodeActionBase(const QString &text, NodePtr_t node, QWidget *parent)
Widget that displays scenes.
Definition: osgwidget.hh:44