LMMS
Loading...
Searching...
No Matches
Rubberband.h
Go to the documentation of this file.
1/*
2 * Rubberband.h - rubberband - either own implementation for Qt3 or wrapper for
3 * Qt4
4 *
5 * Copyright (c) 2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_GUI_RUBBERBAND_H
27#define LMMS_GUI_RUBBERBAND_H
28
29#include <QRubberBand>
30#include <QVector>
31
32namespace lmms::gui
33{
34
35
36class selectableObject : public QWidget
37{
38 Q_OBJECT
39public:
40 selectableObject( QWidget * _parent ) :
41 QWidget( _parent ),
43 {
44 }
45
46 ~selectableObject() override = default;
47
48 inline void setSelected(bool selected)
49 {
50 if (m_selected == selected) { return; }
51 m_selected = selected;
52 update();
53 }
54
55 inline bool isSelected() const
56 {
57 return( m_selected );
58 }
59
60
61public slots:
62 virtual void update()
63 {
64 QWidget::update();
65 }
66
67
68private:
70
71} ;
72
73
74
75
76class RubberBand : public QRubberBand
77{
78public:
79 RubberBand( QWidget * _parent );
80 ~RubberBand() override = default;
81
82 QVector<selectableObject *> selectedObjects() const;
83 QVector<selectableObject *> selectableObjects() const;
84
85
86protected:
87 void resizeEvent( QResizeEvent * _re ) override;
88
89private:
90
91};
92
93
94} // namespace lmms::gui
95
96#endif // LMMS_GUI_RUBBERBAND_H
QVector< selectableObject * > selectableObjects() const
Definition Rubberband.cpp:70
void resizeEvent(QResizeEvent *_re) override
Definition Rubberband.cpp:62
RubberBand(QWidget *_parent)
Definition Rubberband.cpp:33
~RubberBand() override=default
QVector< selectableObject * > selectedObjects() const
Definition Rubberband.cpp:41
bool m_selected
Definition Rubberband.h:69
~selectableObject() override=default
virtual void update()
Definition Rubberband.h:62
void setSelected(bool selected)
Definition Rubberband.h:48
selectableObject(QWidget *_parent)
Definition Rubberband.h:40
bool isSelected() const
Definition Rubberband.h:55
Definition AudioPortAudio.cpp:223
#define false
Definition ordinals.h:83