Remove redundant widget modules in subcrates

Instead, we can define the type aliases just once in the root crate!
This commit is contained in:
Héctor Ramón Jiménez 2022-03-09 14:10:15 +07:00
parent 7d9ab71790
commit 12c1a3f829
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
62 changed files with 225 additions and 780 deletions

View file

@ -32,7 +32,6 @@
pub mod settings;
pub mod triangle;
pub mod widget;
pub mod window;
mod backend;
@ -45,9 +44,6 @@ pub use wgpu;
pub use backend::Backend;
pub use settings::Settings;
#[doc(no_inline)]
pub use widget::*;
pub(crate) use iced_graphics::Transformation;
#[cfg(any(feature = "image_rs", feature = "svg"))]

View file

@ -1,79 +0,0 @@
//! Use the widgets supported out-of-the-box.
//!
//! # Re-exports
//! For convenience, the contents of this module are available at the root
//! module. Therefore, you can directly type:
//!
//! ```
//! use iced_wgpu::{button, Button};
//! ```
use crate::Renderer;
pub mod button;
pub mod checkbox;
pub mod container;
pub mod pane_grid;
pub mod pick_list;
pub mod progress_bar;
pub mod radio;
pub mod rule;
pub mod scrollable;
pub mod slider;
pub mod text_input;
pub mod toggler;
pub mod tooltip;
#[doc(no_inline)]
pub use button::Button;
#[doc(no_inline)]
pub use checkbox::Checkbox;
#[doc(no_inline)]
pub use container::Container;
#[doc(no_inline)]
pub use pane_grid::PaneGrid;
#[doc(no_inline)]
pub use pick_list::PickList;
#[doc(no_inline)]
pub use progress_bar::ProgressBar;
#[doc(no_inline)]
pub use radio::Radio;
#[doc(no_inline)]
pub use rule::Rule;
#[doc(no_inline)]
pub use scrollable::Scrollable;
#[doc(no_inline)]
pub use slider::Slider;
#[doc(no_inline)]
pub use text_input::TextInput;
#[doc(no_inline)]
pub use toggler::Toggler;
#[doc(no_inline)]
pub use tooltip::Tooltip;
#[cfg(feature = "canvas")]
#[cfg_attr(docsrs, doc(cfg(feature = "canvas")))]
pub mod canvas;
#[cfg(feature = "canvas")]
#[doc(no_inline)]
pub use canvas::Canvas;
#[cfg(feature = "qr_code")]
#[cfg_attr(docsrs, doc(cfg(feature = "qr_code")))]
pub mod qr_code;
#[cfg(feature = "qr_code")]
#[doc(no_inline)]
pub use qr_code::QRCode;
pub use iced_native::widget::Space;
/// A container that distributes its contents vertically.
pub type Column<'a, Message> =
iced_native::widget::Column<'a, Message, Renderer>;
/// A container that distributes its contents horizontally.
pub type Row<'a, Message> = iced_native::widget::Row<'a, Message, Renderer>;
/// A paragraph of text.
pub type Text = iced_native::widget::Text<Renderer>;

View file

@ -1,13 +0,0 @@
//! Allow your users to perform actions by pressing a button.
//!
//! A [`Button`] has some local [`State`].
use crate::Renderer;
pub use iced_graphics::button::{Style, StyleSheet};
pub use iced_native::widget::button::State;
/// A widget that produces a message when clicked.
///
/// This is an alias of an `iced_native` button with an `iced_wgpu::Renderer`.
pub type Button<'a, Message> =
iced_native::widget::Button<'a, Message, Renderer>;

View file

@ -1,6 +0,0 @@
//! Draw 2D graphics for your users.
//!
//! A [`Canvas`] widget can be used to draw different kinds of 2D shapes in a
//! [`Frame`]. It can be used for animation, data visualization, game graphics,
//! and more!
pub use iced_graphics::canvas::*;

View file

@ -1,10 +0,0 @@
//! Show toggle controls using checkboxes.
use crate::Renderer;
pub use iced_graphics::checkbox::{Style, StyleSheet};
/// A box that can be checked.
///
/// This is an alias of an `iced_native` checkbox with an `iced_wgpu::Renderer`.
pub type Checkbox<'a, Message> =
iced_native::widget::Checkbox<'a, Message, Renderer>;

View file

@ -1,11 +0,0 @@
//! Decorate content and apply alignment.
use crate::Renderer;
pub use iced_graphics::container::{Style, StyleSheet};
/// An element decorating some content.
///
/// This is an alias of an `iced_native` container with a default
/// `Renderer`.
pub type Container<'a, Message> =
iced_native::widget::Container<'a, Message, Renderer>;

View file

@ -1,32 +0,0 @@
//! Let your users split regions of your application and organize layout dynamically.
//!
//! [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
//!
//! # Example
//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing,
//! drag and drop, and hotkey support.
//!
//! [`pane_grid` example]: https://github.com/iced-rs/iced/tree/0.3/examples/pane_grid
use crate::Renderer;
pub use iced_graphics::pane_grid::{
Axis, Configuration, Direction, DragEvent, Line, Node, Pane, ResizeEvent,
Split, State, StyleSheet,
};
/// A collection of panes distributed using either vertical or horizontal splits
/// to completely fill the space available.
///
/// [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish)
///
/// This is an alias of an `iced_native` pane grid with an `iced_wgpu::Renderer`.
pub type PaneGrid<'a, Message> =
iced_native::widget::PaneGrid<'a, Message, Renderer>;
/// The content of a [`Pane`].
pub type Content<'a, Message> =
iced_native::widget::pane_grid::Content<'a, Message, Renderer>;
/// The title bar of a [`Pane`].
pub type TitleBar<'a, Message> =
iced_native::widget::pane_grid::TitleBar<'a, Message, Renderer>;

View file

@ -1,9 +0,0 @@
//! Display a dropdown list of selectable values.
pub use iced_native::widget::pick_list::State;
pub use iced_graphics::overlay::menu::Style as Menu;
pub use iced_graphics::pick_list::{Style, StyleSheet};
/// A widget allowing the selection of a single value from a list of options.
pub type PickList<'a, T, Message> =
iced_native::widget::PickList<'a, T, Message, crate::Renderer>;

View file

@ -1,5 +0,0 @@
//! Allow your users to visually track the progress of a computation.
//!
//! A [`ProgressBar`] has a range of possible values and a current value,
//! as well as a length, height and style.
pub use iced_graphics::progress_bar::*;

View file

@ -1,2 +0,0 @@
//! Encode and display information in a QR code.
pub use iced_graphics::qr_code::*;

View file

@ -1,10 +0,0 @@
//! Create choices using radio buttons.
use crate::Renderer;
pub use iced_graphics::radio::{Style, StyleSheet};
/// A circular button representing a choice.
///
/// This is an alias of an `iced_native` radio button with an
/// `iced_wgpu::Renderer`.
pub type Radio<'a, Message> = iced_native::widget::Radio<'a, Message, Renderer>;

View file

@ -1,3 +0,0 @@
//! Display a horizontal or vertical rule for dividing content.
pub use iced_graphics::rule::*;

View file

@ -1,13 +0,0 @@
//! Navigate an endless amount of content with a scrollbar.
use crate::Renderer;
pub use iced_graphics::scrollable::{Scrollbar, Scroller, StyleSheet};
pub use iced_native::widget::scrollable::State;
/// A widget that can vertically display an infinite amount of content
/// with a scrollbar.
///
/// This is an alias of an `iced_native` scrollable with a default
/// `Renderer`.
pub type Scrollable<'a, Message> =
iced_native::widget::Scrollable<'a, Message, Renderer>;

View file

@ -1,5 +0,0 @@
//! Display an interactive selector of a single value from a range of values.
//!
//! A [`Slider`] has some local [`State`].
pub use iced_graphics::slider::{Handle, HandleShape, Style, StyleSheet};
pub use iced_native::widget::slider::{Slider, State};

View file

@ -1,13 +0,0 @@
//! Display fields that can be filled with text.
//!
//! A [`TextInput`] has some local [`State`].
use crate::Renderer;
pub use iced_graphics::text_input::{Style, StyleSheet};
pub use iced_native::widget::text_input::State;
/// A field that can be filled with text.
///
/// This is an alias of an `iced_native` text input with an `iced_wgpu::Renderer`.
pub type TextInput<'a, Message> =
iced_native::widget::TextInput<'a, Message, Renderer>;

View file

@ -1,10 +0,0 @@
//! Show toggle controls using togglers.
use crate::Renderer;
pub use iced_graphics::toggler::{Style, StyleSheet};
/// A toggler that can be toggled
///
/// This is an alias of an `iced_native` toggler with an `iced_wgpu::Renderer`.
pub type Toggler<'a, Message> =
iced_native::widget::Toggler<'a, Message, Renderer>;

View file

@ -1,6 +0,0 @@
//! Display a widget over another.
/// A widget allowing the selection of a single value from a list of options.
pub type Tooltip<'a, Message> =
iced_native::widget::Tooltip<'a, Message, crate::Renderer>;
pub use iced_native::widget::tooltip::Position;