From c6375efa22e3db269cfc85e4f61a7bb90436c6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Mon, 9 Sep 2024 10:36:13 +0200 Subject: [PATCH] Add `WidgetType::RadioGroup` (#5081) Extracted out of #4805 I'm using this widget type in [`egui-theme-switch`] but since it's not built in I have to call `accesskit_node_builder` which is a bit cumbersome :) * [x] I have followed the instructions in the PR template [`egui-theme-switch`]: https://github.com/bash/egui-theme-switch/blob/main/src/lib.rs --- crates/egui/src/data/output.rs | 1 + crates/egui/src/lib.rs | 3 +++ crates/egui/src/response.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/crates/egui/src/data/output.rs b/crates/egui/src/data/output.rs index 58df5da230a..5d50afec371 100644 --- a/crates/egui/src/data/output.rs +++ b/crates/egui/src/data/output.rs @@ -640,6 +640,7 @@ impl WidgetInfo { WidgetType::Button => "button", WidgetType::Checkbox => "checkbox", WidgetType::RadioButton => "radio", + WidgetType::RadioGroup => "radio group", WidgetType::SelectableLabel => "selectable", WidgetType::ComboBox => "combo", WidgetType::Slider => "slider", diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 9a93a56fa90..78a526c181d 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -618,6 +618,9 @@ pub enum WidgetType { RadioButton, + /// A group of radio buttons. + RadioGroup, + SelectableLabel, ComboBox, diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index d6a9a8a0c7f..3a415e36961 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -992,6 +992,7 @@ impl Response { } WidgetType::Checkbox => Role::CheckBox, WidgetType::RadioButton => Role::RadioButton, + WidgetType::RadioGroup => Role::RadioGroup, WidgetType::SelectableLabel => Role::Button, WidgetType::ComboBox => Role::ComboBox, WidgetType::Slider => Role::Slider,