gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
selection-handler.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_SELECTION_HANDLER_H__
18#define GEPETTO_GUI_SELECTION_HANDLER_H__
19
20#include <gepetto/gui/fwd.hh>
21// This include must be include before any other Qt include for GLDEBUGPROC
22#include <QComboBox>
23#include <QKeyEvent>
24#include <QVector3D>
25#include <QWidget>
26
27namespace gepetto {
28namespace gui {
31class SelectionMode : public QObject {
32 Q_OBJECT
33 public:
36
37 virtual void reset() { currentSelected_ = ""; }
38
39 QString currentBody() { return currentSelected_; }
40
41 signals:
42 void selectedBodies(QStringList selectedBodies);
43
44 public slots:
48 virtual void onSelect(SelectionEvent* event) = 0;
49
50 virtual QString getName() { return "None"; }
51
52 protected:
55};
56
59 Q_OBJECT
60 public:
63
64 public slots:
65 virtual void onSelect(SelectionEvent* event);
66 virtual QString getName() { return "Unique"; }
67};
68
70 Q_OBJECT
71 public:
74
75 virtual void reset();
76
77 public slots:
78 virtual void onSelect(SelectionEvent* event);
79 virtual QString getName() { return "Multi"; }
80
81 protected:
82 QStringList selectedBodies_;
83};
84
85class SelectionHandler : public QComboBox {
86 Q_OBJECT
87 public:
88 SelectionHandler(WindowsManagerPtr_t wsm, QWidget* parent = 0);
90
92
93 public slots:
97
98 private slots:
99 void getBodies(QStringList selectedBodies);
100 void changeMode(int index);
101
102 private:
103 void initWidget();
104
105 std::vector<SelectionMode*> modes_;
106 int index_;
108 QStringList selected_;
109};
110} // namespace gui
111} // namespace gepetto
112
113#endif /* GEPETTO_GUI_SELECTION_HANDLER_H__ */
Definition selection-handler.hh:69
MultiSelection(WindowsManagerPtr_t wsm)
virtual QString getName()
Definition selection-handler.hh:79
virtual void onSelect(SelectionEvent *event)
QStringList selectedBodies_
Definition selection-handler.hh:82
Definition selection-event.hh:31
Definition selection-handler.hh:85
SelectionHandler(WindowsManagerPtr_t wsm, QWidget *parent=0)
void addMode(SelectionMode *mode)
Definition selection-handler.hh:31
QString currentSelected_
Definition selection-handler.hh:53
QString currentBody()
Definition selection-handler.hh:39
void selectedBodies(QStringList selectedBodies)
~SelectionMode()
Definition selection-handler.hh:35
SelectionMode(WindowsManagerPtr_t wsm)
Definition selection-handler.hh:34
virtual void reset()
Definition selection-handler.hh:37
virtual void onSelect(SelectionEvent *event)=0
virtual QString getName()
Definition selection-handler.hh:50
WindowsManagerPtr_t wsm_
Definition selection-handler.hh:54
Class that allows to select one body.
Definition selection-handler.hh:58
virtual QString getName()
Definition selection-handler.hh:66
virtual void onSelect(SelectionEvent *event)
UniqueSelection(WindowsManagerPtr_t wsm)
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition fwd.hh:59
Definition action-search-bar.hh:27