2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2019-01-20 06:49:48 +03:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-06 22:33:02 +03:00
|
|
|
#include <LibGUI/AbstractButton.h>
|
2019-01-20 06:49:48 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class CheckBox : public AbstractButton {
|
2020-12-28 15:18:10 +03:00
|
|
|
C_OBJECT(CheckBox);
|
|
|
|
|
2019-01-20 06:49:48 +03:00
|
|
|
public:
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual ~CheckBox() override;
|
2019-01-20 06:49:48 +03:00
|
|
|
|
2020-05-12 21:30:33 +03:00
|
|
|
virtual void click(unsigned modifiers = 0) override;
|
2019-03-06 14:52:41 +03:00
|
|
|
|
2021-04-04 18:12:17 +03:00
|
|
|
bool is_autosize() const { return m_autosize; }
|
|
|
|
void set_autosize(bool);
|
|
|
|
|
2019-01-20 06:49:48 +03:00
|
|
|
private:
|
2020-12-28 15:18:10 +03:00
|
|
|
explicit CheckBox(String = {});
|
2019-09-21 19:58:48 +03:00
|
|
|
|
2021-04-04 18:12:17 +03:00
|
|
|
void size_to_fit();
|
|
|
|
|
2019-07-13 11:27:19 +03:00
|
|
|
// These don't make sense for a check box, so hide them.
|
2020-02-02 17:07:41 +03:00
|
|
|
using AbstractButton::auto_repeat_interval;
|
|
|
|
using AbstractButton::set_auto_repeat_interval;
|
2019-07-13 11:27:19 +03:00
|
|
|
|
2020-02-02 17:07:41 +03:00
|
|
|
virtual void paint_event(PaintEvent&) override;
|
2021-04-04 18:12:17 +03:00
|
|
|
|
|
|
|
bool m_autosize { false };
|
2019-01-20 06:49:48 +03:00
|
|
|
};
|
2020-02-02 17:07:41 +03:00
|
|
|
|
|
|
|
}
|