2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2022-02-26 14:50:04 -03:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-01-18 05:38:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-05-23 17:37:21 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-02-06 16:33:02 -03:00
|
|
|
#include <LibGUI/AbstractButton.h>
|
2019-05-23 17:37:21 -03:00
|
|
|
|
2020-02-02 11:07:41 -03:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
|
|
class RadioButton : public AbstractButton {
|
2020-12-28 09:18:10 -03:00
|
|
|
C_OBJECT(RadioButton);
|
|
|
|
|
|
2019-05-23 17:37:21 -03:00
|
|
|
public:
|
2022-02-26 14:50:04 -03:00
|
|
|
virtual ~RadioButton() override = default;
|
2019-05-23 17:37:21 -03:00
|
|
|
|
2020-05-12 15:30:33 -03:00
|
|
|
virtual void click(unsigned modifiers = 0) override;
|
2019-05-23 17:37:21 -03:00
|
|
|
|
2022-02-22 16:25:30 -03:00
|
|
|
virtual Optional<UISize> calculated_min_size() const override;
|
|
|
|
|
|
2019-05-23 17:37:21 -03:00
|
|
|
protected:
|
2020-12-28 09:18:10 -03:00
|
|
|
explicit RadioButton(String text = {});
|
2020-02-02 11:07:41 -03:00
|
|
|
virtual void paint_event(PaintEvent&) override;
|
2019-05-23 17:37:21 -03:00
|
|
|
|
|
|
|
|
private:
|
2019-07-13 05:27:19 -03:00
|
|
|
// These don't make sense for a radio button, so hide them.
|
2020-02-02 11:07:41 -03:00
|
|
|
using AbstractButton::auto_repeat_interval;
|
|
|
|
|
using AbstractButton::set_auto_repeat_interval;
|
2019-07-13 05:27:19 -03:00
|
|
|
|
2020-06-10 05:57:59 -03:00
|
|
|
static Gfx::IntSize circle_size();
|
2019-05-23 17:37:21 -03:00
|
|
|
};
|
2019-05-26 23:18:24 -03:00
|
|
|
|
2020-02-02 11:07:41 -03:00
|
|
|
}
|