//! This crate provides a set of core widgets for Bevy UI, such as buttons, checkboxes, and sliders.1//! These widgets have no inherent styling, it's the responsibility of the user to add styling2//! appropriate for their game or application.3//!4//! # State Management5//!6//! Most of the widgets use external state management: this means that the widgets do not7//! automatically update their own internal state, but instead rely on the app to update the widget8//! state (as well as any other related game state) in response to a change event emitted by the9//! widget. The primary motivation for this is to avoid two-way data binding in scenarios where the10//! user interface is showing a live view of dynamic data coming from deeper within the game engine.1112// Note on naming: the `Core` prefix is used on components that would normally be internal to the13// styled/opinionated widgets that use them. Components which are directly exposed to users above14// the widget level, like `SliderValue`, should not have the `Core` prefix.1516mod callback;17mod core_button;18mod core_checkbox;19mod core_radio;20mod core_scrollbar;21mod core_slider;2223use bevy_app::{PluginGroup, PluginGroupBuilder};2425use bevy_ecs::entity::Entity;26pub use callback::{Callback, Notify};27pub use core_button::{CoreButton, CoreButtonPlugin};28pub use core_checkbox::{CoreCheckbox, CoreCheckboxPlugin, SetChecked, ToggleChecked};29pub use core_radio::{CoreRadio, CoreRadioGroup, CoreRadioGroupPlugin};30pub use core_scrollbar::{31ControlOrientation, CoreScrollbar, CoreScrollbarDragState, CoreScrollbarPlugin,32CoreScrollbarThumb,33};34pub use core_slider::{35CoreSlider, CoreSliderDragState, CoreSliderPlugin, CoreSliderThumb, SetSliderValue,36SliderPrecision, SliderRange, SliderStep, SliderValue, TrackClick,37};3839/// A plugin group that registers the observers for all of the core widgets. If you don't want to40/// use all of the widgets, you can import the individual widget plugins instead.41pub struct CoreWidgetsPlugins;4243impl PluginGroup for CoreWidgetsPlugins {44fn build(self) -> PluginGroupBuilder {45PluginGroupBuilder::start::<Self>()46.add(CoreButtonPlugin)47.add(CoreCheckboxPlugin)48.add(CoreRadioGroupPlugin)49.add(CoreScrollbarPlugin)50.add(CoreSliderPlugin)51}52}5354/// Notification sent by a button or menu item.55#[derive(Copy, Clone, Debug, PartialEq)]56pub struct Activate(pub Entity);5758/// Notification sent by a widget that edits a scalar value.59#[derive(Copy, Clone, Debug, PartialEq)]60pub struct ValueChange<T> {61/// The id of the widget that produced this value.62pub source: Entity,63/// The new value.64pub value: T,65}666768