hydrogen 1.2.3
MidiLearnable.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23
24#ifndef MIDILEARNABLE_H
25#define MIDILEARNABLE_H
26
27#include <memory>
28#include <vector>
29#include <QString>
30#include <core/MidiAction.h>
31#include <core/IO/MidiCommon.h>
32
33#include "../EventListener.h"
34
48{
49public:
52
53 void setAction( std::shared_ptr<Action> pAction );
54
55 std::shared_ptr<Action> getAction() const {
56 return m_pAction;
57 }
58
63 void midiMapChangedEvent() override;
64
69 virtual void updateTooltip(){};
70
71protected:
72 std::shared_ptr<Action> m_pAction;
73
80 std::vector<std::pair<H2Core::MidiMessage::Event,int>> m_registeredMidiEvents;
81};
82
83#endif // MIDILEARNABLE_H
Every widget which supports MidiLearn should derive from this Class.
std::vector< std::pair< H2Core::MidiMessage::Event, int > > m_registeredMidiEvents
Stores all MIDI events mapped to m_pAction.
virtual void updateTooltip()
Indicates child class to recalculate its tool tip in case m_registeredMidiEvents changed.
std::shared_ptr< Action > m_pAction
std::shared_ptr< Action > getAction() const
void setAction(std::shared_ptr< Action > pAction)
void midiMapChangedEvent() override
Update m_registeredMidiEvents since the underlying #H2Core::MidiMap changed.