OpacitySlider.h 865 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibGUI/AbstractSlider.h>
  9. namespace GUI {
  10. class OpacitySlider : public AbstractSlider {
  11. C_OBJECT(OpacitySlider);
  12. public:
  13. virtual ~OpacitySlider() override = default;
  14. protected:
  15. virtual void paint_event(PaintEvent&) override;
  16. virtual void mousedown_event(MouseEvent&) override;
  17. virtual void mousemove_event(MouseEvent&) override;
  18. virtual void mouseup_event(MouseEvent&) override;
  19. virtual void mousewheel_event(MouseEvent&) override;
  20. private:
  21. explicit OpacitySlider(Gfx::Orientation = Gfx::Orientation::Horizontal);
  22. Gfx::IntRect frame_inner_rect() const;
  23. int value_at(Gfx::IntPoint const&) const;
  24. bool m_dragging { false };
  25. };
  26. }