diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-06 14:43:16 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-06 14:43:16 +0100 |
commit | dccf335d5b1aa06e44f9262c95b176c42ba2cf1e (patch) | |
tree | f426c8cabb635b49ebf6e4f59c3aa28aff42bee3 /Applications | |
parent | 6a71ba1deb6cc34cfe22094207c70ec9996d1501 (diff) | |
download | serenity-dccf335d5b1aa06e44f9262c95b176c42ba2cf1e.zip |
LibGUI: Add HorizontalSlider and VerticalSlider convenience classes
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/Piano/KnobsWidget.cpp | 14 | ||||
-rw-r--r-- | Applications/Terminal/main.cpp | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Applications/Piano/KnobsWidget.cpp b/Applications/Piano/KnobsWidget.cpp index a5cf1ac204..8f53f0b8b0 100644 --- a/Applications/Piano/KnobsWidget.cpp +++ b/Applications/Piano/KnobsWidget.cpp @@ -74,7 +74,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid // FIXME: Implement vertical flipping in GSlider, not here. - m_octave_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_octave_knob = GUI::VerticalSlider::construct(m_knobs_container); m_octave_knob->set_tooltip("Z: octave down, X: octave up"); m_octave_knob->set_range(octave_min - 1, octave_max - 1); m_octave_knob->set_value((octave_max - 1) - (m_audio_engine.octave() - 1)); @@ -86,7 +86,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid m_octave_value->set_text(String::number(new_octave)); }; - m_wave_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_wave_knob = GUI::VerticalSlider::construct(m_knobs_container); m_wave_knob->set_tooltip("C: cycle through waveforms"); m_wave_knob->set_range(0, last_wave); m_wave_knob->set_value(last_wave - m_audio_engine.wave()); @@ -98,7 +98,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid }; constexpr int max_attack = 1000; - m_attack_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_attack_knob = GUI::VerticalSlider::construct(m_knobs_container); m_attack_knob->set_range(0, max_attack); m_attack_knob->set_value(max_attack - m_audio_engine.attack()); m_attack_knob->on_value_changed = [this](int value) { @@ -109,7 +109,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid }; constexpr int max_decay = 1000; - m_decay_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_decay_knob = GUI::VerticalSlider::construct(m_knobs_container); m_decay_knob->set_range(0, max_decay); m_decay_knob->set_value(max_decay - m_audio_engine.decay()); m_decay_knob->on_value_changed = [this](int value) { @@ -120,7 +120,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid }; constexpr int max_sustain = 1000; - m_sustain_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_sustain_knob = GUI::VerticalSlider::construct(m_knobs_container); m_sustain_knob->set_range(0, max_sustain); m_sustain_knob->set_value(max_sustain - m_audio_engine.sustain()); m_sustain_knob->on_value_changed = [this](int value) { @@ -131,7 +131,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid }; constexpr int max_release = 1000; - m_release_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_release_knob = GUI::VerticalSlider::construct(m_knobs_container); m_release_knob->set_range(0, max_release); m_release_knob->set_value(max_release - m_audio_engine.release()); m_release_knob->on_value_changed = [this](int value) { @@ -142,7 +142,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid }; constexpr int max_delay = 8; - m_delay_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container); + m_delay_knob = GUI::VerticalSlider::construct(m_knobs_container); m_delay_knob->set_range(0, max_delay); m_delay_knob->set_value(max_delay - (m_audio_engine.delay() / m_audio_engine.tick())); m_delay_knob->on_value_changed = [this](int value) { diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 0ac4a8edaf..78151b324d 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -156,7 +156,7 @@ RefPtr<GUI::Window> create_settings_window(TerminalWidget& terminal) slider_container->layout()->set_margins({ 6, 16, 6, 6 }); slider_container->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); slider_container->set_preferred_size(100, 50); - auto slider = GUI::Slider::construct(Orientation::Horizontal, slider_container); + auto slider = GUI::HorizontalSlider::construct(slider_container); slider->on_value_changed = [&terminal](int value) { terminal.set_opacity(value); |