lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
ColorChooser.h
Go to the documentation of this file.
1
/* ColorChooser.h - declaration and definition of ColorChooser class.
2
*
3
* Copyright (c) 2019 CYBERDEViLNL <cyberdevilnl/at/protonmail/dot/ch>
4
*
5
* This file is part of LMMS - https://lmms.io
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (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 GNU
15
* General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public
18
* License along with this program (see COPYING); if not, write to the
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
21
*
22
*/
23
24
#ifndef LMMS_GUI_COLOR_CHOOSER_H
25
#define LMMS_GUI_COLOR_CHOOSER_H
26
27
#include <QApplication>
28
#include <QColor>
29
#include <QColorDialog>
30
#include <QKeyEvent>
31
#include <QVector>
32
33
namespace
lmms::gui
34
{
35
36
37
class
ColorChooser
:
public
QColorDialog
38
{
39
public
:
40
ColorChooser
(
const
QColor &initial, QWidget *parent): QColorDialog(initial, parent) {};
41
ColorChooser
(QWidget *parent): QColorDialog(parent) {};
43
ColorChooser
() =
default
;
44
enum class
Palette
{Default,
Track
,
Mixer
};
46
void
setPalette
(QVector<QColor>);
48
void
setPalette
(
Palette
);
50
ColorChooser
*
withPalette
(
Palette
);
52
static
QVector<QColor>
getPalette
(
Palette
);
53
54
protected
:
56
void
keyReleaseEvent
(QKeyEvent *event)
override
57
{
58
QApplication::sendEvent(parentWidget(), event);
59
}
60
private
:
62
static
QVector<QColor>
defaultPalette
();
64
static
QVector<QColor>
nicePalette
(
int
);
65
};
66
67
68
}
// namespace lmms::gui
69
70
#endif
// LMMS_GUI_COLOR_CHOOSER_H
lmms::Mixer
Definition
Mixer.h:139
lmms::Track
Base-class for all tracks.
Definition
Track.h:67
lmms::gui::ColorChooser
Definition
ColorChooser.h:38
lmms::gui::ColorChooser::setPalette
void setPalette(QVector< QColor >)
Set global palette via array, checking bounds.
Definition
ColorChooser.cpp:31
lmms::gui::ColorChooser::nicePalette
static QVector< QColor > nicePalette(int)
Generate a nice palette, with adjustable value.
Definition
ColorChooser.cpp:76
lmms::gui::ColorChooser::getPalette
static QVector< QColor > getPalette(Palette)
Return a certain palette.
Definition
ColorChooser.cpp:54
lmms::gui::ColorChooser::withPalette
ColorChooser * withPalette(Palette)
Set palette via enum, return self pointer for chaining.
Definition
ColorChooser.cpp:47
lmms::gui::ColorChooser::ColorChooser
ColorChooser(const QColor &initial, QWidget *parent)
Definition
ColorChooser.h:40
lmms::gui::ColorChooser::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *event) override
Forward key events to the parent to prevent stuck notes when the dialog gets focus.
Definition
ColorChooser.h:56
lmms::gui::ColorChooser::defaultPalette
static QVector< QColor > defaultPalette()
Copy the current QColorDialog palette into an array.
Definition
ColorChooser.cpp:65
lmms::gui::ColorChooser::ColorChooser
ColorChooser(QWidget *parent)
Definition
ColorChooser.h:41
lmms::gui::ColorChooser::ColorChooser
ColorChooser()=default
For getting a color without having to initialise a color dialog.
lmms::gui::ColorChooser::Palette
Palette
Definition
ColorChooser.h:44
lmms::gui
Definition
AudioPortAudio.cpp:209
Generated on
for lmms by
1.18.0