Change CoreWidgets plugin to plugin group. (#20036)

What it says on the tin. :)
This commit is contained in:
Talin 2025-07-08 18:07:49 -07:00 committed by GitHub
parent 0ee937784e
commit aa87581cce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 19 deletions

View File

@ -21,7 +21,7 @@ mod core_radio;
mod core_scrollbar;
mod core_slider;
use bevy_app::{App, Plugin};
use bevy_app::{PluginGroup, PluginGroupBuilder};
pub use callback::{Callback, Notify};
pub use core_button::{CoreButton, CoreButtonPlugin};
@ -36,18 +36,17 @@ pub use core_slider::{
SliderRange, SliderStep, SliderValue, TrackClick,
};
/// A plugin that registers the observers for all of the core widgets. If you don't want to
/// A plugin group that registers the observers for all of the core widgets. If you don't want to
/// use all of the widgets, you can import the individual widget plugins instead.
pub struct CoreWidgetsPlugin;
pub struct CoreWidgetsPlugins;
impl Plugin for CoreWidgetsPlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
CoreButtonPlugin,
CoreCheckboxPlugin,
CoreRadioGroupPlugin,
CoreScrollbarPlugin,
CoreSliderPlugin,
));
impl PluginGroup for CoreWidgetsPlugins {
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(CoreButtonPlugin)
.add(CoreCheckboxPlugin)
.add(CoreRadioGroupPlugin)
.add(CoreScrollbarPlugin)
.add(CoreSliderPlugin)
}
}

View File

@ -4,7 +4,7 @@ use bevy::{
color::palettes::basic::*,
core_widgets::{
Callback, CoreButton, CoreCheckbox, CoreRadio, CoreRadioGroup, CoreSlider,
CoreSliderDragState, CoreSliderThumb, CoreWidgetsPlugin, SliderRange, SliderValue,
CoreSliderDragState, CoreSliderThumb, CoreWidgetsPlugins, SliderRange, SliderValue,
TrackClick,
},
input_focus::{
@ -21,7 +21,7 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins,
CoreWidgetsPlugin,
CoreWidgetsPlugins,
InputDispatchPlugin,
TabNavigationPlugin,
))

View File

@ -3,7 +3,7 @@
use bevy::{
color::palettes::basic::*,
core_widgets::{
Callback, CoreButton, CoreCheckbox, CoreSlider, CoreSliderThumb, CoreWidgetsPlugin,
Callback, CoreButton, CoreCheckbox, CoreSlider, CoreSliderThumb, CoreWidgetsPlugins,
SliderRange, SliderValue,
},
ecs::system::SystemId,
@ -21,7 +21,7 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins,
CoreWidgetsPlugin,
CoreWidgetsPlugins,
InputDispatchPlugin,
TabNavigationPlugin,
))

View File

@ -1,7 +1,7 @@
//! This example shows off the various Bevy Feathers widgets.
use bevy::{
core_widgets::{Callback, CoreRadio, CoreRadioGroup, CoreWidgetsPlugin, SliderStep},
core_widgets::{Callback, CoreRadio, CoreRadioGroup, CoreWidgetsPlugins, SliderStep},
feathers::{
controls::{
button, checkbox, radio, slider, toggle_switch, ButtonProps, ButtonVariant,
@ -25,7 +25,7 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins,
CoreWidgetsPlugin,
CoreWidgetsPlugins,
InputDispatchPlugin,
TabNavigationPlugin,
FeathersPlugin,

View File

@ -1,7 +1,7 @@
---
title: Headless Widgets
authors: ["@viridia", "@ickshonpe", "@alice-i-cecile"]
pull_requests: [19366, 19584, 19665, 19778, 19803]
pull_requests: [19366, 19584, 19665, 19778, 19803, 20036]
---
Bevy's `Button` and `Interaction` components have been around for a long time. Unfortunately