Commit 75329b67 authored by Florian Blasius's avatar Florian Blasius 🤘

Moved api stuff to api crate

parent 4f7522b5
This diff is collapsed.
......@@ -17,4 +17,5 @@ orbgl_api = { git = "https://gitlab.redox-os.org/redox-os/orbgl.git" }
orbtk-css-engine = { version = "0.1.0", path = "../css-engine" }
orbtk-shell = { version = "0.1.0", path = "../shell" }
orbtk-utils = { version = "0.1.0", path = "../utils" }
orbtk-tree = { version = "0.1.0", path= "../tree" }
\ No newline at end of file
orbtk-tree = { version = "0.1.0", path= "../tree" }
orbtk-theme = { version = "0.1.0", path= "../theme" }
\ No newline at end of file
......@@ -2,7 +2,7 @@ use std::collections::HashMap;
use dces::prelude::Entity;
use crate::{shell::Key, prelude::*};
use crate::shell::Key;
#[derive(Default)]
/// The `Global` struct is used to define global `properties` that could be access application width.
......
......@@ -8,7 +8,7 @@ use std::{
use dces::prelude::{Entity, World};
use crate::{shell::{ShellRunner, WindowBuilder}, tree::*, utils::*, prelude::*};
use crate::{prelude::*, shell::{ShellRunner, WindowBuilder}, tree::* };
pub use self::global::*;
pub use self::window::*;
......
......@@ -2,7 +2,7 @@ use std::{cell::RefCell, collections::BTreeMap, rc::Rc};
use dces::prelude::{Entity, World};
use crate::{utils::Point, shell, tree::Tree, prelude::*};
use crate::{prelude::*, shell, tree::Tree, utils::Point};
/// Represents a window. Each window has its own tree, event pipeline and shell.
#[derive(Default)]
......
use std::rc::Rc;
use crate::shell::Key;
use crate::{prelude::*, shell::Key};
use super::{Event, EventBox, EventHandler};
pub struct KeyDownEvent {
......
use std::rc::Rc;
use crate::{utils::*, shell::MouseButton};
use crate::{prelude::*, shell::MouseButton, utils::*};
/// Checks if the given point is inside of a widget.
pub fn check_mouse_condition(mouse_position: Point, widget: &WidgetContainer<'_>) -> bool {
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree};
use crate::{prelude::*, tree::Tree, utils::prelude::*};
use crate::shell::{FONT_MEASURE, FontMeasure};
use super::Layout;
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree};
use crate::{prelude::*, tree::Tree, utils::prelude::*};
use super::Layout;
......
......@@ -2,7 +2,7 @@ use std::{any::Any, cell::RefCell, collections::BTreeMap, rc::Rc};
use dces::prelude::{Entity, EntityComponentManager};
use crate::prelude::*;
use crate::{prelude::*, tree::Tree, utils::*};
pub use self::fixed_size::*;
pub use self::grid::*;
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree};
use crate::{prelude::*, tree::Tree, utils::prelude::*};
use super::Layout;
......
......@@ -7,7 +7,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree};
use crate::{prelude::*, tree::Tree, utils::prelude::*};
use super::Layout;
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree};
use crate::{prelude::*, tree::Tree, utils::prelude::*};
use super::Layout;
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager};
use crate::{prelude::*, utils::prelude::*, tree::Tree, shell::FontMeasure};
use crate::{prelude::*, shell::FontMeasure, tree::Tree, utils::prelude::*};
use super::Layout;
......
/*!
API crate that provides base api and elements for OrbTk like widgets basis.
*/
pub use dces::prelude::*;
pub use orbtk_css_engine::prelude as css_engine;
pub use orbtk_shell::prelude as shell;
pub use orbtk_utils::prelude as utils;
pub use orbtk_tree::prelude as tree;
pub use orbtk_utils::prelude as utils;
pub use orbtk_theme::prelude as theme;
pub mod application;
pub mod event;
......
pub use dces::prelude::{Entity, EntityComponentManager};
pub use crate::{
application::*,
css_engine::{Selector as SelectorValue, SelectorRelation, Theme as ThemeValue, ThemeBuilder},
event::*,
layout::*,
properties::*,
property,
render_object::*,
systems::*,
widget::*
};
\ No newline at end of file
widget::*,
widget,
};
use std::slice::{Iter, IterMut};
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
/// Used to build a column, specifying additional details.
#[derive(Default)]
......
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
property!(
/// `ColumnSpan` describes the column span of a widget on the `Grid`.
......
use std::f64;
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
/// Used to build a constraint, specifying additional details.
#[derive(Default)]
......
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
property!(
/// `GridColumn` describes the column position of a widget on the `Grid`.
......
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
property!(
/// `GridRow` describes the row position of a widget on the `Grid`.
......
use crate::{prelude::*, utils::prelude::*};
use crate::prelude::*;
property!(
/// `Offset` describes the x- and y-axis offset of a widget.
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
use super::*;
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_align_position() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_set_left() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_set_left() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_align_y() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::prelude::*};
property!(
/// `VerticalAlignment` describes the vertical alignment of a widget.
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
property!(
/// `Background` describes the background brush of a visual element.
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
property!(
/// `BorderBrush` describes the border brush.
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
property!(
/// `BorderThickness` describes the relative thickness of a border.
......
......@@ -9,7 +9,7 @@ pub struct InnerFont(pub OrbFont);
impl Default for InnerFont {
fn default() -> Self {
InnerFont::from(fonts::font_into_box(fonts::ROBOTO_REGULAR_FONT))
InnerFont(OrbFont::from_path("").unwrap())
}
}
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
property!(
/// `Foreground` describes the foreground brush of a visual element.
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
property!(
/// `IconBrush` describes the icon brush of a visual element.
......
......@@ -2,6 +2,7 @@ use crate::{
css_engine::{Selector as SelectorValue, Specificity},
Entity,
EntityComponentManager,
prelude::*,
properties::{get_property, PropertySource},
};
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_into() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_into() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_set_left() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_into() {
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
#[test]
fn test_into() {
......
......@@ -2,7 +2,7 @@ use std::fmt;
#[cfg(not(target_arch = "wasm32"))]
use orbclient::Renderer;
use orbgl_api::{Color, Image as OrbImage, FromSource};
use orbgl_api::{Color, FromSource, Image as OrbImage};
use crate::prelude::*;
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
pub struct FontIconRenderObject;
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
/// Used to render an image.
pub struct ImageRenderObject;
......
......@@ -2,7 +2,7 @@
use std::any::Any;
use crate::prelude::*;
use crate::{prelude::*, utils::*};
pub use self::font_icon::*;
pub use self::image::*;
......
use orbgl_api::Canvas;
use crate::prelude::*;
use crate::{prelude::*, utils::*};
pub struct RectangleRenderObject;
......@@ -16,7 +16,7 @@ impl RectangleRenderObject {
brush: Brush,
) {
match brush {
Brush::SolidColor(color) => {
Brush::SolidColor(color) => {
canvas.set_fill_style(color)
}
_ => {} // todo: gradient
......@@ -97,7 +97,6 @@ impl RectangleRenderObject {
match brush {
Brush::SolidColor(color) => {
canvas.set_fill_style(color)
}
_ => {} // todo: gradient
......
use crate::prelude::*;
use crate::{prelude::*, utils::*};
/// Used to render a text.
pub struct TextRenderObject;
......
......@@ -7,7 +7,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager, System};
use crate::{prelude::*, shell::WindowShell};
use crate::{prelude::*, shell::WindowShell, tree::Tree, utils::*};
pub struct EventSystem {
pub shell: Rc<RefCell<WindowShell<WindowAdapter>>>,
......
......@@ -2,7 +2,7 @@ use std::{cell::RefCell, collections::BTreeMap, rc::Rc};
use dces::prelude::{Entity, EntityComponentManager, System};
use crate::{prelude::*, shell::WindowShell};
use crate::{prelude::*, shell::WindowShell, tree::Tree};
/// This system is used to initializes the widgets.
pub struct InitSystem {
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager, System};
use crate::{prelude::*, shell::WindowShell};
use crate::{prelude::*, shell::WindowShell, tree::Tree, utils::* };
/// The `LayoutSystem` builds per iteration the layout of the current ui. The layout parts are calulated by the layout objects of layout widgets.
pub struct LayoutSystem {
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager, System};
use crate::{prelude::*, shell::WindowShell};
use crate::{prelude::*, shell::WindowShell, tree::Tree, utils::*};
/// The `RenderSystem` iterates over all visual widgets and used its render objects to draw them on the screen.
pub struct RenderSystem {
......
......@@ -6,7 +6,7 @@ use std::{
use dces::prelude::{Entity, EntityComponentManager, System};
use crate::{prelude::*, shell::WindowShell};
use crate::{prelude::*, shell::WindowShell, tree::Tree};
/// The `StateSystem` calls the update methods of widget states.
pub struct StateSystem {
......
......@@ -2,7 +2,7 @@ use std::{cell::RefCell, collections::BTreeMap, rc::Rc};
use dces::prelude::{Component, ComponentBox, Entity, SharedComponentBox, World};
use crate::prelude::*;
use crate::{prelude::*, tree::Tree};
use super::State;
......
use dces::prelude::{Entity, EntityComponentManager};
use orbgl_api::Canvas;
use crate::{prelude::*, shell::{Renderer, WindowShell}};
use crate::{prelude::*, shell::{Renderer, WindowShell}, tree::Tree, theme::fonts, utils::* };
use super::{MessageBox, WidgetContainer};
......
......@@ -2,8 +2,7 @@ use std::rc::Rc;
use dces::prelude::Entity;
use crate::event::EventHandler;
use crate::properties::*;
use crate::{event::EventHandler, prelude::*};
pub use self::build_context::*;
pub use self::context::*;
......
......@@ -53,11 +53,11 @@ impl ThemeBuilder {
for extension_path in self.theme_extension_paths.iter().rev() {
if let Ok(file) = File::open(extension_path) {
let mut reader = BufReader::new(file);
let mut css = String::new();
let _ = reader.read_to_string(&mut css).unwrap();
let mut reader = BufReader::new(file);
let mut css = String::new();
let _ = reader.read_to_string(&mut css).unwrap();
theme.push_str(&css);
theme.push_str(&css);
}
}
......@@ -67,12 +67,11 @@ impl ThemeBuilder {
if let Some(path) = self.theme_path {
if let Ok(file) = File::open(path) {
let mut reader = BufReader::new(file);
let mut css = String::new();
let _ = reader.read_to_string(&mut css).unwrap();
let mut reader = BufReader::new(file);
let mut css = String::new();
let _ = reader.read_to_string(&mut css).unwrap();
theme.push_str(&css);
theme.push_str(&css);
}
};
......
......@@ -98,7 +98,7 @@ impl<A> WindowShell<A> where A: WindowAdapter {
});
}
while let Some(event) = self.key_up_events.borrow_mut().pop() {
while let Some(event) = self.key_up_events.borrow_mut().pop() {
self.adapter.key_event(KeyEvent {
key: get_key(event.code().as_str(), event.key().remove(0)),
state: ButtonState::Up,
......@@ -323,7 +323,7 @@ impl obsolete::Renderer for WebRenderer {
context.set_font(&format!("{}px {}", font_size, font.family));
context.set_fill_style_color(&color.to_string());
context.set_text_baseline(web::TextBaseline::Top);
context.fill_text(text, global_position.x + bounds.x, global_position.y + bounds.y , None);
context.fill_text(text, global_position.x + bounds.x, global_position.y + bounds.y, None);
context.close_path();
context.restore();
}
......
......@@ -3,7 +3,6 @@
pub use dces::prelude::*;
#[macro_use]
pub use orbtk_api::prelude as api;
pub use orbtk_css_engine::prelude as css_engine;
pub use orbtk_shell::prelude as shell;
......
......@@ -15,7 +15,6 @@ pub use crate::{
theme::{colors, default_theme, fonts, light_theme, vector_graphics::material_font_icons},
tree::*,
utils::*,
widget,
widgets::*,
};
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