summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-01-09 18:46:06 +0100
committerLibravatar GitHub <noreply@github.com>2020-01-09 18:46:06 +0100
commit0a8302450557877cb667b51fc84383aaf0a11b02 (patch)
treefe3a8a6b0ae82f7fd1fa0c0de34b4b09d0b9edda /src
parent6699329d3f91c5b9d8e8e55ad88de24bd3894955 (diff)
parent7b278755fc7929633b5771824beac4d39b16e82e (diff)
downloadiced-0a8302450557877cb667b51fc84383aaf0a11b02.tar.gz
iced-0a8302450557877cb667b51fc84383aaf0a11b02.tar.bz2
iced-0a8302450557877cb667b51fc84383aaf0a11b02.zip
Merge pull request #146 from hecrj/feature/custom-styling
Custom styling
Diffstat (limited to '')
-rw-r--r--src/application.rs7
-rw-r--r--src/native.rs69
-rw-r--r--src/settings.rs6
3 files changed, 18 insertions, 64 deletions
diff --git a/src/application.rs b/src/application.rs
index a7e826fb..7dd76774 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -151,7 +151,12 @@ pub trait Application: Sized {
Self: 'static,
{
#[cfg(not(target_arch = "wasm32"))]
- <Instance<Self> as iced_winit::Application>::run(_settings.into());
+ <Instance<Self> as iced_winit::Application>::run(
+ _settings.into(),
+ iced_wgpu::Settings {
+ default_font: _settings.default_font,
+ },
+ );
#[cfg(target_arch = "wasm32")]
<Instance<Self> as iced_web::Application>::run();
diff --git a/src/native.rs b/src/native.rs
index 022cf337..35441a3e 100644
--- a/src/native.rs
+++ b/src/native.rs
@@ -1,6 +1,6 @@
pub use iced_winit::{
Align, Background, Color, Command, Font, HorizontalAlignment, Length,
- Space, Subscription, VerticalAlignment,
+ Space, Subscription, Vector, VerticalAlignment,
};
pub mod widget {
@@ -22,58 +22,7 @@ pub mod widget {
//!
//! [`TextInput`]: text_input/struct.TextInput.html
//! [`text_input::State`]: text_input/struct.State.html
- pub mod button {
- //! Allow your users to perform actions by pressing a button.
- //!
- //! A [`Button`] has some local [`State`].
- //!
- //! [`Button`]: type.Button.html
- //! [`State`]: struct.State.html
-
- /// A widget that produces a message when clicked.
- ///
- /// This is an alias of an `iced_native` button with a default
- /// `Renderer`.
- pub type Button<'a, Message> =
- iced_winit::Button<'a, Message, iced_wgpu::Renderer>;
-
- pub use iced_winit::button::State;
- }
-
- pub mod scrollable {
- //! Navigate an endless amount of content with a scrollbar.
-
- /// 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_winit::Scrollable<'a, Message, iced_wgpu::Renderer>;
-
- pub use iced_winit::scrollable::State;
- }
-
- pub mod text_input {
- //! Ask for information using text fields.
- //!
- //! A [`TextInput`] has some local [`State`].
- //!
- //! [`TextInput`]: struct.TextInput.html
- //! [`State`]: struct.State.html
- pub use iced_winit::text_input::{State, TextInput};
- }
-
- pub mod slider {
- //! Display an interactive selector of a single value from a range of
- //! values.
- //!
- //! A [`Slider`] has some local [`State`].
- //!
- //! [`Slider`]: struct.Slider.html
- //! [`State`]: struct.State.html
- pub use iced_winit::slider::{Slider, State};
- }
+ pub use iced_wgpu::widget::*;
pub mod image {
//! Display images in your user interface.
@@ -85,12 +34,13 @@ pub mod widget {
pub use iced_winit::svg::{Handle, Svg};
}
- pub use iced_winit::{Checkbox, ProgressBar, Radio, Text};
+ pub use iced_winit::Text;
#[doc(no_inline)]
pub use {
- button::Button, image::Image, scrollable::Scrollable, slider::Slider,
- svg::Svg, text_input::TextInput,
+ button::Button, checkbox::Checkbox, container::Container, image::Image,
+ progress_bar::ProgressBar, radio::Radio, scrollable::Scrollable,
+ slider::Slider, svg::Svg, text_input::TextInput,
};
/// A container that distributes its contents vertically.
@@ -104,13 +54,6 @@ pub mod widget {
/// This is an alias of an `iced_native` row with a default `Renderer`.
pub type Row<'a, Message> =
iced_winit::Row<'a, Message, iced_wgpu::Renderer>;
-
- /// An element decorating some content.
- ///
- /// This is an alias of an `iced_native` container with a default
- /// `Renderer`.
- pub type Container<'a, Message> =
- iced_winit::Container<'a, Message, iced_wgpu::Renderer>;
}
#[doc(no_inline)]
diff --git a/src/settings.rs b/src/settings.rs
index 62a1a614..e20edc97 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -9,6 +9,12 @@ pub struct Settings {
///
/// [`Window`]: struct.Window.html
pub window: Window,
+
+ /// The bytes of the font that will be used by default.
+ ///
+ /// If `None` is provided, a default system font will be chosen.
+ // TODO: Add `name` for web compatibility
+ pub default_font: Option<&'static [u8]>,
}
/// The window settings of an application.