mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 04:04:59 +00:00

SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
35 lines
742 B
C++
35 lines
742 B
C++
/*
|
|
* Copyright (c) 2021, Cesar Torres <shortanemoia@protonmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGUI/Slider.h>
|
|
|
|
class AutoSlider final : public GUI::Slider {
|
|
C_OBJECT(AutoSlider)
|
|
public:
|
|
~AutoSlider() override = default;
|
|
Function<void(int)> on_knob_released;
|
|
void set_value(int value)
|
|
{
|
|
if (!knob_dragging())
|
|
GUI::Slider::set_value(value);
|
|
}
|
|
|
|
protected:
|
|
AutoSlider(Orientation orientation)
|
|
: GUI::Slider(orientation)
|
|
{
|
|
}
|
|
|
|
virtual void mouseup_event(GUI::MouseEvent& event) override
|
|
{
|
|
if (on_knob_released && is_enabled())
|
|
on_knob_released(value());
|
|
|
|
GUI::Slider::mouseup_event(event);
|
|
}
|
|
};
|