2019-05-23 22:37:21 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-24 16:32:20 +02:00
|
|
|
#include <LibGUI/GAbstractButton.h>
|
2019-05-23 22:37:21 +02:00
|
|
|
|
2019-05-24 16:32:20 +02:00
|
|
|
class GRadioButton : public GAbstractButton {
|
2019-05-23 22:37:21 +02:00
|
|
|
public:
|
2019-05-24 16:32:20 +02:00
|
|
|
GRadioButton(const String& text, GWidget* parent);
|
2019-05-23 22:37:21 +02:00
|
|
|
virtual ~GRadioButton() override;
|
|
|
|
|
2019-05-24 16:32:20 +02:00
|
|
|
virtual const char* class_name() const override { return "GRadioButton"; }
|
2019-05-23 22:37:21 +02:00
|
|
|
|
2019-05-24 16:32:20 +02:00
|
|
|
virtual void click() override;
|
2019-05-23 22:37:21 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual bool is_radio_button() const final { return true; }
|
|
|
|
|
2019-05-28 11:53:16 +02:00
|
|
|
template<typename Callback>
|
|
|
|
void for_each_in_group(Callback);
|
2019-05-23 22:37:21 +02:00
|
|
|
static Size circle_size();
|
|
|
|
};
|
2019-05-27 04:18:24 +02:00
|
|
|
|
2019-05-28 11:53:16 +02:00
|
|
|
template<>
|
|
|
|
inline bool is<GRadioButton>(const CObject& object)
|
2019-05-27 04:18:24 +02:00
|
|
|
{
|
|
|
|
if (!is<GWidget>(object))
|
|
|
|
return false;
|
|
|
|
return to<GWidget>(object).is_radio_button();
|
|
|
|
}
|