Tchick/Source/BPMPanel.h
2026-02-04 11:51:22 +01:00

67 lines
2.0 KiB
C

#pragma once
/*
==============================================================================
Copyright 2022 Nicolas Chambert
This program is free software : you can redistribute itand /or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see < http://www.gnu.org/licenses/>.
==============================================================================
*/
/*
==============================================================================
Gestion du tempo.
==============================================================================
*/
#include <JuceHeader.h>
#include "Metronome.h"
struct BPMPanel : public juce::Component
{
explicit BPMPanel(juce::Colour c);
// Méthode de surcharge JUCE
void mouseWheelMove(const juce::MouseEvent&,
const juce::MouseWheelDetails& wheel) override; // on prend en charge le mouseWheel pour changer le tempo
void paint(juce::Graphics& g) override;
void resized() override;
// utilitaire graphique
void addComponent(juce::Component& c);
// méthodes de gestion du tempo
void init(Metronome& metro);
void inc(Metronome& metro);
void dec(Metronome& metro);
void setBPM(Metronome& metro, int value);
// composants graphiques
juce::Colour backgroundColour;
juce::TextButton increment{ "+" };
juce::TextButton decrement{ "-" };
juce::TextButton twice{ "*2" };
juce::TextButton half{ "/2" };
juce::TextButton set60{ "60" };
juce::TextButton set90{ "90" };
juce::TextButton set120{ "120" };
juce::TextButton set150{ "150" };
juce::Label bpm;
};