Commit b299afd8 authored by Florian Blasius's avatar Florian Blasius 🤘

[#166] base implementation of window widget.

parent 4f23cda4
......@@ -88,6 +88,7 @@ pub struct Theme {
impl Theme {
/// Creates a new `ThemeBuilder` object with default theme as base.
pub fn create() -> ThemeBuilder {
ThemeBuilder {
......
// Widget related properties.
pub use self::font_icon::*;
pub use self::image::*;
pub use self::text::*;
pub use self::name::*;
pub use self::resizeable::*;
pub use self::text_selection::*;
pub use self::title::*;
pub use self::water_mark::*;
mod font_icon;
mod image;
mod text;
mod name;
mod resizeable;
mod text_selection;
mod title;
mod water_mark;
#[cfg(test)]
......
use crate::prelude::*;
property!(
/// `Resizeable` describes if a widget is reslizeable.
Resizeable(bool)
);
use crate::prelude::*;
property!(
/// `Title` describes the title of a widget.
Title(String)
);
// --- Conversions ---
impl From<&str> for Title {
fn from(s: &str) -> Title {
Title(s.into())
}
}
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `Button` widget can be clicked by user. It's used to perform an action.
///
/// * CSS element: `button`
/// **CSS element:** `button`
Button: ClickHandler {
/// Sets or shares the background property.
background: Background,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `CheckBox` widget can be switch its selected state. It contains a selection box and a text.
///
/// * CSS element: `check-box`
/// **CSS element:** `check-box`
CheckBox: ClickHandler {
/// Sets or shares the background property.
background: Background,
......
......@@ -27,7 +27,7 @@ impl State for CursorState {
widget!(
/// The `Cursor` widget represents a text cursor used to mark text.
///
/// * CSS element: `cursor`
/// **CSS element:** `cursor`
Cursor<CursorState> {
/// Sets or shares the text property.
text: Text,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `FontIconBlock` widget is used to draw text. It is not interactive.
///
/// * CSS element: `font-icon-block`
/// **CSS element:** `font-icon-block`
FontIconBlock {
/// Sets or shares the icon property.
icon: FontIcon,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `Grid` defines a flexible grid area that consists of columns and rows.
///
/// * CSS element: `grid`
/// **CSS element:** `grid`
Grid {
/// Sets or shares the background property.
background: Background,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `ImageWidget` widget is used to draw an image. It is not interactive.
///
/// * CSS element: `image-widget`
/// **CSS element:** `image-widget`
ImageWidget {
/// Sets or shares the image property.
image: Image,
......
......@@ -15,6 +15,7 @@ pub use self::switch::*;
pub use self::text_block::*;
pub use self::text_box::*;
pub use self::toggle_button::*;
pub use self::window::*;
mod button;
mod core;
......@@ -31,3 +32,4 @@ mod switch;
mod text_block;
mod text_box;
mod toggle_button;
mod window;
\ No newline at end of file
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `ScrollViewer` defines a layout that is used to stack its children on the z-axis.
///
/// * CSS element: `scroll-viewer`
/// **CSS element:** `scroll-viewer`
ScrollViewer {
/// Sets or shares the orientation property.
offset: Offset,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `Stack` defines a layout that is used to stack its children on the z-axis.
///
/// * CSS element: `stack`
/// **CSS element:** `stack`
Stack {
/// Sets or shares the orientation property.
orientation: Orientation,
......
......@@ -21,7 +21,7 @@ impl State for SwitchState {
widget!(
/// The `Switch` widget can be switch between `on` and `off`.
///
/// * CSS element: `switch`
/// **CSS element:** `switch`
Switch<SwitchState> {
/// Sets or shares the background property.
background: Background,
......
......@@ -3,7 +3,7 @@ use crate::prelude::*;
widget!(
/// The `TextBlock` widget is used to draw text. It is not interactive.
///
/// * CSS element: `text-block`
/// **CSS element:** `text-block`
TextBlock {
/// Sets or shares the text property.
text: Text,
......
......@@ -4,7 +4,7 @@ widget!(
/// The `ToggleButton` widget can be clicked by user and could switch between selected / not selected.
/// It's used to perform an action.
///
/// * CSS element: `toggle-button`
/// **CSS element:** `toggle-button`
ToggleButton: ClickHandler {
/// Sets or shares the background property.
background: Background,
......
use crate::prelude::*;
widget!(
/// The `Window` widget provides access to the properties of a application window.
/// It also contains global properties like keyboard modifier and focused widget.
///
/// **CSS element:** `window`
Window {
/// Sets or shares the background property.
background: Background,
/// Sets or shares the title property.
title: Title,
/// Sets or shares the css selector property.
selector: Selector,
/// Sets or shares the resizeable property.
resizeable: Resizeable
}
);
impl Template for Window {
fn template(self, _: Entity, _: &mut BuildContext) -> Self {
self.name("Window")
.selector("window")
.title("Window")
.resizeable(false)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment