iced-yoda/web/src/widget.rs

69 lines
1.6 KiB
Rust
Raw Normal View History

2019-11-22 22:14:04 +01:00
//! Use the built-in widgets or create your own.
//!
//! # Custom widgets
//! If you want to implement a custom widget, you simply need to implement the
//! [`Widget`] trait. You can use the API of the built-in widgets as a guide or
//! source of inspiration.
//!
//! # Re-exports
//! For convenience, the contents of this module are available at the root
//! module. Therefore, you can directly type:
//!
//! ```
//! use iced_web::{button, Button, Widget};
//! ```
use crate::{Bus, Css};
use dodrio::bumpalo;
2019-09-14 20:54:50 +02:00
pub mod button;
pub mod checkbox;
pub mod container;
pub mod image;
pub mod progress_bar;
pub mod radio;
pub mod scrollable;
2019-09-14 20:54:50 +02:00
pub mod slider;
pub mod text_input;
2020-10-03 18:26:31 +02:00
pub mod toggler;
2019-09-14 20:54:50 +02:00
mod column;
mod row;
2019-12-30 21:32:21 +01:00
mod space;
2019-11-22 22:14:04 +01:00
mod text;
2019-09-14 20:54:50 +02:00
2019-09-24 15:15:34 +02:00
#[doc(no_inline)]
2019-09-14 20:54:50 +02:00
pub use button::Button;
#[doc(no_inline)]
pub use scrollable::Scrollable;
2019-09-24 15:15:34 +02:00
#[doc(no_inline)]
pub use slider::Slider;
#[doc(no_inline)]
pub use text::Text;
#[doc(no_inline)]
pub use text_input::TextInput;
2020-10-03 18:26:31 +02:00
#[doc(no_inline)]
pub use toggler::Toggler;
2019-09-24 15:15:34 +02:00
2019-09-14 20:54:50 +02:00
pub use checkbox::Checkbox;
pub use column::Column;
pub use container::Container;
2019-09-14 20:54:50 +02:00
pub use image::Image;
pub use progress_bar::ProgressBar;
2019-09-14 20:54:50 +02:00
pub use radio::Radio;
pub use row::Row;
2019-12-30 21:32:21 +01:00
pub use space::Space;
2019-09-14 20:54:50 +02:00
2019-11-22 22:14:04 +01:00
/// A component that displays information and allows interaction.
///
/// If you want to build your own widgets, you will need to implement this
/// trait.
pub trait Widget<Message> {
2019-11-22 22:14:04 +01:00
/// Produces a VDOM node for the [`Widget`].
fn node<'b>(
&self,
bump: &'b bumpalo::Bump,
_bus: &Bus<Message>,
style_sheet: &mut Css<'b>,
2019-09-15 18:53:13 +02:00
) -> dodrio::Node<'b>;
}