summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/AbstractButton.cpp2
-rw-r--r--Libraries/LibGUI/RadioButton.cpp16
-rw-r--r--Libraries/LibGUI/RadioButton.h2
3 files changed, 2 insertions, 18 deletions
diff --git a/Libraries/LibGUI/AbstractButton.cpp b/Libraries/LibGUI/AbstractButton.cpp
index 6f839017f0..a71ab20ce0 100644
--- a/Libraries/LibGUI/AbstractButton.cpp
+++ b/Libraries/LibGUI/AbstractButton.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/Libraries/LibGUI/RadioButton.cpp b/Libraries/LibGUI/RadioButton.cpp
index a6bb9c636a..bafefffa07 100644
--- a/Libraries/LibGUI/RadioButton.cpp
+++ b/Libraries/LibGUI/RadioButton.cpp
@@ -36,6 +36,7 @@ namespace GUI {
RadioButton::RadioButton(String text)
: AbstractButton(move(text))
{
+ set_exclusive(true);
set_min_width(32);
set_fixed_height(22);
}
@@ -73,25 +74,10 @@ void RadioButton::paint_event(PaintEvent& event)
painter.draw_focus_rect(text_rect.inflated(6, 6), palette().focus_outline());
}
-template<typename Callback>
-void RadioButton::for_each_in_group(Callback callback)
-{
- if (!parent())
- return;
- parent()->for_each_child_of_type<RadioButton>([&](auto& child) {
- return callback(downcast<RadioButton>(child));
- });
-}
-
void RadioButton::click(unsigned)
{
if (!is_enabled())
return;
- for_each_in_group([this](auto& button) {
- if (&button != this)
- button.set_checked(false);
- return IterationDecision::Continue;
- });
set_checked(true);
}
diff --git a/Libraries/LibGUI/RadioButton.h b/Libraries/LibGUI/RadioButton.h
index 1c4c163755..aaaedd9185 100644
--- a/Libraries/LibGUI/RadioButton.h
+++ b/Libraries/LibGUI/RadioButton.h
@@ -49,8 +49,6 @@ private:
virtual bool is_radio_button() const final { return true; }
- template<typename Callback>
- void for_each_in_group(Callback);
static Gfx::IntSize circle_size();
};