hydrogen 1.2.3
ColorSelectionButton.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23
24#ifndef COLORSELECTIONBUTTON_H
25#define COLORSELECTIONBUTTON_H
26
27
28#include <core/Object.h>
30
31#include <QtGui>
32#include <QPushButton>
33#include <QColor>
34
40class ColorSelectionButton : public QPushButton, public H2Core::Object<ColorSelectionButton>
41{
43 Q_OBJECT
44
45public:
46 ColorSelectionButton( QWidget *pParent, QColor sInitialColor = Qt::black, int nSize = 0 );
48
49 QColor getColor() const;
50 void setColor( const QColor& color );
51
52signals:
54
55private:
57
58 virtual void mousePressEvent(QMouseEvent *ev) override;
59 virtual void enterEvent(QEvent *ev) override;
60 virtual void leaveEvent(QEvent *ev) override;
61 virtual void paintEvent( QPaintEvent* ev) override;
62
63 QColor m_sColor;
64};
65
66inline QColor ColorSelectionButton::getColor() const {
67 return m_sColor;
68}
69
70#endif
#define H2_OBJECT(name)
Definition Object.h:224
QPushButton opening a QColorDialog when clicked and displaying the selected color as background - wit...
virtual void mousePressEvent(QMouseEvent *ev) override
ColorSelectionButton(QWidget *pParent, QColor sInitialColor=Qt::black, int nSize=0)
virtual void leaveEvent(QEvent *ev) override
void setColor(const QColor &color)
virtual void paintEvent(QPaintEvent *ev) override
virtual void enterEvent(QEvent *ev) override