| Line |
Branch |
Exec |
Source |
| 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 |
|
|
// This include must be include before any other Qt include for GLDEBUGPROC |
| 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 { |
| 49 |
|
|
VISIBILITY_ON, |
| 50 |
|
|
VISIBILITY_OFF, |
| 51 |
|
|
ALWAYS_ON_TOP, |
| 52 |
|
|
ATTACH_TO_WINDOW, |
| 53 |
|
|
ATTACH_CAMERA_TO_NODE, |
| 54 |
|
|
REMOVE_NODE |
| 55 |
|
|
}; |
| 56 |
|
|
|
| 57 |
|
|
NodeAction(const Type& t, const QString& text, NodePtr_t node, |
| 58 |
|
|
QWidget* parent); |
| 59 |
|
|
|
| 60 |
|
|
NodeAction(const Type& t, const QString& text, QWidget* parent); |
| 61 |
|
|
|
| 62 |
|
|
/// Attach to window |
| 63 |
|
|
NodeAction(const QString& text, NodePtr_t node, OSGWidget* window, |
| 64 |
|
|
QWidget* parent); |
| 65 |
|
|
|
| 66 |
|
|
/// Attach camera to node |
| 67 |
|
|
NodeAction(const QString& text, OSGWidget* window, QWidget* parent); |
| 68 |
|
|
|
| 69 |
|
✗ |
virtual ~NodeAction() {} |
| 70 |
|
|
|
| 71 |
|
|
protected: |
| 72 |
|
|
void act(bool checked); |
| 73 |
|
|
|
| 74 |
|
|
private: |
| 75 |
|
|
const Type type_; |
| 76 |
|
|
OSGWidget* window_; |
| 77 |
|
|
}; |
| 78 |
|
|
} // namespace gui |
| 79 |
|
|
} // namespace gepetto |
| 80 |
|
|
|
| 81 |
|
|
#endif // GEPETTO_GUI_NODE_ACTION_HH |
| 82 |
|
|
|