CheckBox.h 756 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGUI/AbstractButton.h>
  8. namespace GUI {
  9. class CheckBox : public AbstractButton {
  10. C_OBJECT(CheckBox);
  11. public:
  12. virtual ~CheckBox() override;
  13. virtual void click(unsigned modifiers = 0) override;
  14. bool is_autosize() const { return m_autosize; }
  15. void set_autosize(bool);
  16. private:
  17. explicit CheckBox(String = {});
  18. void size_to_fit();
  19. // These don't make sense for a check box, so hide them.
  20. using AbstractButton::auto_repeat_interval;
  21. using AbstractButton::set_auto_repeat_interval;
  22. virtual void paint_event(PaintEvent&) override;
  23. bool m_autosize { false };
  24. };
  25. }