2 * Pixmap Keyboard, a custom Qt4 widget
3 * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef PIXMAPKEYBOARD_HPP_INCLUDED
19 #define PIXMAPKEYBOARD_HPP_INCLUDED
21 #include "CarlaJuceUtils.hpp"
24 #include <QtGui/QPixmap>
26 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
27 # include <QtWidgets/QWidget>
29 # include <QtGui/QWidget>
32 class PixmapKeyboard
: public QWidget
47 PixmapKeyboard(QWidget
* parent
);
50 void sendNoteOn(int note
, bool sendSignal
=true);
51 void sendNoteOff(int note
, bool sendSignal
=true);
53 void setMode(Orientation mode
, Color color
=COLOR_ORANGE
);
54 void setOctaves(int octaves
);
63 void handleMousePos(const QPoint
&);
65 void keyPressEvent(QKeyEvent
*) override
;
66 void keyReleaseEvent(QKeyEvent
*) override
;
67 void mousePressEvent(QMouseEvent
*) override
;
68 void mouseMoveEvent(QMouseEvent
*) override
;
69 void mouseReleaseEvent(QMouseEvent
*) override
;
70 void paintEvent(QPaintEvent
*) override
;
74 Orientation fPixmapMode
;
84 QList
<int> fEnabledKeys
;
85 std::map
<int, QRectF
>& fMidiMap
;
87 bool _isNoteBlack(int note
) const;
88 const QRectF
& _getRectFromMidiNote(int note
) const;
90 CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PixmapKeyboard
)
93 #endif // PIXMAPKEYBOARD_HPP_INCLUDED