CheckBox.h 816 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-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/AbstractButton.h>
  9. namespace GUI {
  10. class CheckBox : public AbstractButton {
  11. C_OBJECT(CheckBox);
  12. public:
  13. virtual ~CheckBox() override = default;
  14. virtual void click(unsigned modifiers = 0) override;
  15. bool is_autosize() const { return m_autosize; }
  16. void set_autosize(bool);
  17. private:
  18. explicit CheckBox(String = {});
  19. void size_to_fit();
  20. // These don't make sense for a check box, so hide them.
  21. using AbstractButton::auto_repeat_interval;
  22. using AbstractButton::set_auto_repeat_interval;
  23. virtual void paint_event(PaintEvent&) override;
  24. bool m_autosize { false };
  25. };
  26. }