frontend: update example widgets and linked in resources
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -1,240 +1,478 @@
|
|||||||
use std::{cell::Cell, collections::HashSet};
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
use orbtk::theme::DEFAULT_THEME_CSS;
|
|
||||||
use orbtk::*;
|
|
||||||
|
|
||||||
static DARK_EXT: &'static str = include_str!("../resources/stylesheets/advotracker-dark.css");
|
|
||||||
|
|
||||||
//#[cfg(feature = "light-theme")]
|
|
||||||
static LIGHT_EXT: &'static str = include_str!("../resources/stylesheets/advotracker-light.css");
|
|
||||||
|
|
||||||
static CSS_EXT: &'static str = include_str!("../resources/stylesheets/grid.css");
|
|
||||||
|
|
||||||
//#[cfg(not(feature = "light-theme"))]
|
|
||||||
//fn get_theme() -> ThemeValue {
|
|
||||||
// ThemeValue::create_from_css(DEFAULT_THEME_CSS)
|
|
||||||
// .extension_css(CSS_EXT)
|
|
||||||
// .build()
|
|
||||||
//}
|
|
||||||
|
|
||||||
fn get_theme() -> ThemeValue {
|
|
||||||
ThemeValue::create()
|
|
||||||
//.extension_css(DARK_EXT)
|
|
||||||
.extension_css(LIGHT_EXT)
|
|
||||||
//.extension_css(CSS_EXT)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
enum Action {
|
enum Action {
|
||||||
|
AddItem,
|
||||||
|
ClearText,
|
||||||
|
EntryActivated(Entity),
|
||||||
|
EntryChanged(Entity),
|
||||||
|
ValueChanged(Entity),
|
||||||
IncrementCounter,
|
IncrementCounter,
|
||||||
|
RemoveItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(AsAny)]
|
||||||
pub struct MainViewState {
|
pub struct MainViewState {
|
||||||
counter: Cell<i32>,
|
action: Option<Action>,
|
||||||
action: Cell<Option<Action>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MainViewState {
|
|
||||||
fn action(&self, action: impl Into<Option<Action>>) {
|
|
||||||
self.action.set(action.into());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for MainViewState {
|
impl Default for MainViewState {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
MainViewState {
|
MainViewState { action: None }
|
||||||
counter: Cell::new(0),
|
}
|
||||||
action: Cell::new(None),
|
}
|
||||||
}
|
|
||||||
|
impl MainViewState {
|
||||||
|
fn action(&mut self, action: impl Into<Option<Action>>) {
|
||||||
|
self.action = action.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State for MainViewState {
|
impl State for MainViewState {
|
||||||
fn update(&self, ctx: &mut Context<'_>) {
|
fn update(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||||
if let Some(action) = self.action.get() {
|
if let Some(action) = self.action {
|
||||||
match action {
|
match action {
|
||||||
|
Action::AddItem => {
|
||||||
|
let len = ctx.widget().get::<List>("list").len();
|
||||||
|
if len < 5 {
|
||||||
|
ctx.widget()
|
||||||
|
.get_mut::<List>("list")
|
||||||
|
.push(format!("Item {}", len + 1));
|
||||||
|
ctx.child("items").set("count", len + 1);
|
||||||
|
ctx.child("remove-item-button").set("enabled", true);
|
||||||
|
|
||||||
|
if len == 4 {
|
||||||
|
ctx.child("add-item-button").set("enabled", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Action::RemoveItem => {
|
||||||
|
let len = ctx.widget().get::<List>("list").len();
|
||||||
|
if len > 0 {
|
||||||
|
ctx.widget().get_mut::<List>("list").remove(len - 1);
|
||||||
|
ctx.child("items").set("count", len - 1);
|
||||||
|
ctx.child("add-item-button").set("enabled", true);
|
||||||
|
|
||||||
|
if len == 1 {
|
||||||
|
ctx.child("remove-item-button").set("enabled", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Action::IncrementCounter => {
|
Action::IncrementCounter => {
|
||||||
self.counter.set(self.counter.get() + 1);
|
*ctx.widget().get_mut::<usize>("counter") += 1;
|
||||||
|
|
||||||
|
let counter = *ctx.widget().get::<usize>("counter");
|
||||||
|
|
||||||
ctx.widget().set(
|
ctx.widget().set(
|
||||||
"result",
|
"result",
|
||||||
String16::from(format!("Button count: {}", self.counter.get())),
|
String16::from(format!("Button count: {}", counter)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Action::ClearText => {
|
||||||
|
ctx.widget().set("text_one", String16::from(""));
|
||||||
|
ctx.widget().set("text_two", String16::from(""));
|
||||||
|
}
|
||||||
|
Action::EntryActivated(entity) => {
|
||||||
|
let mut widget = ctx.get_widget(entity);
|
||||||
|
let text = widget.get_mut::<String16>("text");
|
||||||
|
println!("submitting {}", text);
|
||||||
|
text.clear();
|
||||||
|
}
|
||||||
|
Action::EntryChanged(entity) => {
|
||||||
|
let widget = ctx.get_widget(entity);
|
||||||
|
let text = widget.get::<String16>("text");
|
||||||
|
println!("entry changed: {}", text);
|
||||||
|
}
|
||||||
|
Action::ValueChanged(entity) => {
|
||||||
|
let val =
|
||||||
|
((*ctx.get_widget(entity).get::<f64>("val")).floor() as i32).to_string();
|
||||||
|
ctx.child("value_text").set("text", String16::from(val));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.action.set(None);
|
self.action = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_post_layout(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||||
|
let mut selection_string = "Selected:".to_string();
|
||||||
|
|
||||||
|
for index in &ctx.widget().get::<SelectedIndices>("selected_indices").0 {
|
||||||
|
selection_string = format!("{} {}", selection_string, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.child("selection")
|
||||||
|
.set("text", String16::from(selection_string));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.text(text)
|
.text(text)
|
||||||
.selector(Selector::new().with("text-block").class("h1"))
|
.element("text-block")
|
||||||
|
.class("h1")
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type List = Vec<String>;
|
||||||
|
|
||||||
widget!(
|
widget!(
|
||||||
MainView<MainViewState> {
|
MainView<MainViewState> {
|
||||||
selected_indices: SelectedIndices,
|
selected_indices: SelectedIndices,
|
||||||
text_harm: String16,
|
counter: usize,
|
||||||
|
list_count: usize,
|
||||||
|
combo_box_list_count: usize,
|
||||||
|
list: List,
|
||||||
|
selection_list: List,
|
||||||
|
combo_box_list: List,
|
||||||
|
selection_list_count: usize,
|
||||||
|
text_one: String16,
|
||||||
|
text_two: String16,
|
||||||
result: String16
|
result: String16
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
impl Template for MainView {
|
impl Template for MainView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
let state = self.clone_state();
|
self.name("MainView")
|
||||||
|
.result("Button count: 0")
|
||||||
|
.counter(0)
|
||||||
|
.selected_indices(HashSet::new())
|
||||||
|
.list(vec![
|
||||||
|
"Item 1".to_string(),
|
||||||
|
"Item 2".to_string(),
|
||||||
|
"Item 3".to_string(),
|
||||||
|
])
|
||||||
|
.list_count(3)
|
||||||
|
.selection_list(vec![
|
||||||
|
"Item 1".to_string(),
|
||||||
|
"Item 2".to_string(),
|
||||||
|
"Item 3".to_string(),
|
||||||
|
"Item 4".to_string(),
|
||||||
|
"Item 5".to_string(),
|
||||||
|
"Item 6".to_string(),
|
||||||
|
"Item 7".to_string(),
|
||||||
|
"Item 8".to_string(),
|
||||||
|
"Item 9".to_string(),
|
||||||
|
"Item 10".to_string(),
|
||||||
|
])
|
||||||
|
.combo_box_list(vec![
|
||||||
|
"CB 1".to_string(),
|
||||||
|
"CB 2".to_string(),
|
||||||
|
"CB 3".to_string(),
|
||||||
|
"CB 4".to_string(),
|
||||||
|
"CB 5".to_string(),
|
||||||
|
"CB 6".to_string(),
|
||||||
|
"CB 7".to_string(),
|
||||||
|
"CB 8".to_string(),
|
||||||
|
"CB 9".to_string(),
|
||||||
|
"CB 10".to_string(),
|
||||||
|
])
|
||||||
|
.selection_list_count(10)
|
||||||
|
.combo_box_list_count(10)
|
||||||
|
.child(
|
||||||
|
Grid::new()
|
||||||
|
.margin(8.0)
|
||||||
|
.columns(
|
||||||
|
Columns::new()
|
||||||
|
.add(132.0)
|
||||||
|
.add(16.0)
|
||||||
|
.add(132.0)
|
||||||
|
.add(16.0)
|
||||||
|
.add(132.0),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Stack::new()
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
// Column 0
|
||||||
|
.child(create_header(ctx, "Buttons"))
|
||||||
|
.child(
|
||||||
|
Button::new()
|
||||||
|
.text("Button")
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.icon(material_font_icons::CHECK_FONT_ICON)
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(1))
|
||||||
|
.on_click(move |states, _| {
|
||||||
|
state(id, states).action(Action::IncrementCounter);
|
||||||
|
true
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Button::new()
|
||||||
|
.text("Primary")
|
||||||
|
.element("button")
|
||||||
|
.class("primary")
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.icon(material_font_icons::CHECK_FONT_ICON)
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(2))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
ToggleButton::new()
|
||||||
|
.class("single_content")
|
||||||
|
.text("ToggleButton")
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(3))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
CheckBox::new()
|
||||||
|
.text("CheckBox")
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(4))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Switch::new()
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(5))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
TextBlock::new()
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.element("h1")
|
||||||
|
.id("value_text")
|
||||||
|
.text("0")
|
||||||
|
.h_align("center")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Slider::new()
|
||||||
|
.on_changed(move |states, entity| {
|
||||||
|
state(id, states).action(Action::ValueChanged(entity));
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Stack::new()
|
||||||
|
.attach(Grid::column(2))
|
||||||
|
.child(create_header(ctx, "Text"))
|
||||||
|
.child(
|
||||||
|
TextBlock::new()
|
||||||
|
.class("body")
|
||||||
|
.text(("result", id))
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(2))
|
||||||
|
.attach(Grid::row(1))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
TextBox::new()
|
||||||
|
.water_mark("TextBox...")
|
||||||
|
.text(("text_one", id))
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(2))
|
||||||
|
.attach(Grid::row(2))
|
||||||
|
.on_activate(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryActivated(entity));
|
||||||
|
})
|
||||||
|
.on_changed(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryChanged(entity));
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
TextBox::new()
|
||||||
|
.water_mark("TextBox...")
|
||||||
|
.text(("text_two", id))
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.attach(Grid::column(2))
|
||||||
|
.attach(Grid::row(2))
|
||||||
|
.on_activate(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryActivated(entity));
|
||||||
|
})
|
||||||
|
.on_changed(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryChanged(entity));
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Button::new()
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.class("single_content")
|
||||||
|
.text("clear text")
|
||||||
|
.on_click(move |states, _| {
|
||||||
|
state(id, states).action(Action::ClearText);
|
||||||
|
true
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
NumericBox::new()
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.max(123.0)
|
||||||
|
.step(0.123)
|
||||||
|
.val(0.123)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Grid::new()
|
||||||
|
.rows(
|
||||||
|
Rows::new()
|
||||||
|
.add("auto")
|
||||||
|
.add(32.0)
|
||||||
|
.add(16.0)
|
||||||
|
.add(204.0)
|
||||||
|
.add("auto")
|
||||||
|
.add(192.0)
|
||||||
|
.add("auto"),
|
||||||
|
)
|
||||||
|
.columns(Columns::new().add("*").add(4.0).add("*"))
|
||||||
|
.attach(Grid::column(4))
|
||||||
|
.child(
|
||||||
|
TextBlock::new()
|
||||||
|
.text("Items")
|
||||||
|
.element("text-block")
|
||||||
|
.class("h1")
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::column_span(3))
|
||||||
|
.attach(Grid::row(0))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
ComboBox::new()
|
||||||
|
.items_builder(move |bc, index| {
|
||||||
|
let text = bc
|
||||||
|
.get_widget(id)
|
||||||
|
.get::<Vec<String>>("combo_box_list")[index]
|
||||||
|
.clone();
|
||||||
|
TextBlock::new()
|
||||||
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
|
.v_align("center")
|
||||||
|
.text(text)
|
||||||
|
.build(bc)
|
||||||
|
})
|
||||||
|
.selected_index(0)
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::column_span(3))
|
||||||
|
.attach(Grid::row(1))
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.count(("combo_box_list_count", id))
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
ItemsWidget::new()
|
||||||
|
.element("items-widget")
|
||||||
|
.id("items")
|
||||||
|
.padding((4.0, 4.0, 4.0, 2.0))
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::column_span(3))
|
||||||
|
.attach(Grid::row(3))
|
||||||
|
.margin((0.0, 0.0, 0.0, 8.0))
|
||||||
|
.items_builder(move |bc, index| {
|
||||||
|
let text = bc.get_widget(id).get::<Vec<String>>("list")
|
||||||
|
[index]
|
||||||
|
.clone();
|
||||||
|
|
||||||
self.name("MainView").child(
|
Button::new()
|
||||||
//.result("Button count: 0")
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
//.selected_indices(HashSet::new())
|
.text(text)
|
||||||
/*
|
.build(bc)
|
||||||
Grid::create()
|
})
|
||||||
.margin(8.0)
|
.count(("list_count", id))
|
||||||
.rows(
|
.build(ctx),
|
||||||
Rows::create()
|
)
|
||||||
// define two rows
|
.child(
|
||||||
.row("*")
|
Button::new()
|
||||||
.row("*")
|
.element("button")
|
||||||
.build(),
|
.class("single_content")
|
||||||
)
|
.id("remove-item-button")
|
||||||
.child(
|
.icon(material_font_icons::MINUS_FONT_ICON)
|
||||||
// Container 0
|
.on_click(move |states, _| {
|
||||||
Container::create()
|
state(id, states).action(Action::RemoveItem);
|
||||||
.padding(8.0)
|
true
|
||||||
.selector(Selector::from("container").class("header"))
|
})
|
||||||
.attach(Grid::row(0))
|
.min_width(0.0)
|
||||||
.child(
|
.attach(Grid::column(0))
|
||||||
*/
|
.attach(Grid::row(4))
|
||||||
Grid::create()
|
.build(ctx),
|
||||||
.selector("lynch")
|
)
|
||||||
.margin(8.0)
|
.child(
|
||||||
.columns(
|
Button::new()
|
||||||
Columns::create()
|
.element("button")
|
||||||
// define three columns
|
.class("single_content")
|
||||||
.column("auto")
|
.id("add-item-button")
|
||||||
.column(24.0)
|
.icon(material_font_icons::ADD_FONT_ICON)
|
||||||
.column("auto")
|
.on_click(move |states, _| {
|
||||||
.build(),
|
state(id, states).action(Action::AddItem);
|
||||||
)
|
true
|
||||||
.child(
|
})
|
||||||
Stack::create()
|
.min_width(0.0)
|
||||||
// Column 0
|
.attach(Grid::column(2))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::row(4))
|
||||||
.child(create_header(ctx, "Buttons"))
|
.build(ctx),
|
||||||
.child(
|
)
|
||||||
Button::create()
|
.child(
|
||||||
.text("Button")
|
ListView::new()
|
||||||
.selector(Selector::new().with("button").class("primary"))
|
.attach(Grid::column(0))
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.attach(Grid::column_span(3))
|
||||||
.icon(material_font_icons::CHECK_FONT_ICON)
|
.attach(Grid::row(5))
|
||||||
.attach(Grid::column(0))
|
.selected_indices(id)
|
||||||
.attach(Grid::row(1))
|
.margin((0.0, 16.0, 0.0, 8.0))
|
||||||
.on_mouse_move(move |_| {
|
.items_builder(move |bc, index| {
|
||||||
println!("Mouse moved over Button!");
|
let text = bc
|
||||||
true
|
.get_widget(id)
|
||||||
})
|
.get::<Vec<String>>("selection_list")[index]
|
||||||
.on_click(move |_| {
|
.clone();
|
||||||
println!("Mouse clicked Buttonmoved over Button!");
|
TextBlock::new()
|
||||||
state.action(Action::IncrementCounter);
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
true
|
.v_align("center")
|
||||||
})
|
.text(text)
|
||||||
.build(ctx),
|
.build(bc)
|
||||||
)
|
})
|
||||||
.child(
|
.count(("selection_list_count", id))
|
||||||
Switch::create()
|
.build(ctx),
|
||||||
.selector("bluebayoux")
|
)
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.child(
|
||||||
.attach(Grid::column(0))
|
// todo: wrong text width????
|
||||||
.attach(Grid::row(2))
|
TextBlock::new()
|
||||||
.build(ctx),
|
.element("text-block")
|
||||||
)
|
.id("selection")
|
||||||
.build(ctx),
|
.max_width(120.0)
|
||||||
)
|
.attach(Grid::column(0))
|
||||||
.child(
|
.attach(Grid::column_span(3))
|
||||||
Stack::create()
|
.attach(Grid::row(6))
|
||||||
// Column 2
|
.text("Selected:")
|
||||||
.attach(Grid::column(2))
|
.build(ctx),
|
||||||
.child(create_header(ctx, "Text"))
|
)
|
||||||
.child(
|
.build(ctx),
|
||||||
TextBlock::create()
|
)
|
||||||
.selector(Selector::new().class("body"))
|
|
||||||
.text(("result", id))
|
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
|
||||||
.attach(Grid::column(2))
|
|
||||||
.attach(Grid::row(1))
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
TextBox::create()
|
|
||||||
.water_mark("Harm...")
|
|
||||||
.text(("text_harm", id))
|
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
|
||||||
.attach(Grid::column(2))
|
|
||||||
.attach(Grid::row(2))
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
/*.child(
|
|
||||||
// Container 1
|
|
||||||
Container::create()
|
|
||||||
.selector(Selector::from("container").class("content"))
|
|
||||||
.padding(8.0)
|
|
||||||
.attach(Grid::row(1))
|
|
||||||
.child(
|
|
||||||
ImageWidget::create()
|
|
||||||
.image("resources/images/orbtk-space.png")
|
|
||||||
.visibility("Hidden")
|
|
||||||
.margin(8.0)
|
|
||||||
.vertical_alignment("Center")
|
|
||||||
.horizontal_alignment("Center")
|
|
||||||
.size(600.0, 600.0)
|
|
||||||
.clip(true)
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.build(ctx),
|
|
||||||
)
|
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// use this only if you want to run it as web application.
|
// use this only if you want to run it as web application.
|
||||||
orbtk::initialize();
|
//orbtk::initialize();
|
||||||
|
|
||||||
let mut application = Application::default();
|
|
||||||
application
|
|
||||||
.create_window()
|
|
||||||
.bounds((100.0, 100.0, 420.0, 730.0))
|
|
||||||
.title("OrbTk - advotracker test GUI")
|
|
||||||
.resizeable(true)
|
|
||||||
.root(MainView::create())
|
|
||||||
.build();
|
|
||||||
application.run();
|
|
||||||
|
|
||||||
/*
|
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - advotracker test GUI")
|
.title("OrbTk - widgets example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
//.size(600.0, 800.0)
|
.size(468.0, 730.0)
|
||||||
.size(640.0, 480.0)
|
|
||||||
.resizeable(true)
|
.resizeable(true)
|
||||||
//.theme(get_theme())
|
.child(MainView::new().build(ctx))
|
||||||
.child(MainView::create().build(ctx))
|
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
// helper to request MainViewState
|
||||||
|
fn state<'a>(id: Entity, states: &'a mut StatesContext) -> &'a mut MainViewState {
|
||||||
|
states.get_mut(id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ fn generate_digit_button(
|
|||||||
column_span: usize,
|
column_span: usize,
|
||||||
row: usize,
|
row: usize,
|
||||||
) -> Entity {
|
) -> Entity {
|
||||||
let mut button = Button::create()
|
let mut button = Button::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.min_size(48.0, 48.0)
|
.min_size(48.0, 48.0)
|
||||||
.text(sight.to_string())
|
.text(sight.to_string())
|
||||||
@@ -166,7 +166,7 @@ fn generate_operation_button(
|
|||||||
column_span: usize,
|
column_span: usize,
|
||||||
row: usize,
|
row: usize,
|
||||||
) -> Entity {
|
) -> Entity {
|
||||||
let mut button = Button::create()
|
let mut button = Button::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.min_size(48.0, 48.0)
|
.min_size(48.0, 48.0)
|
||||||
.text(sight.to_string())
|
.text(sight.to_string())
|
||||||
@@ -197,37 +197,37 @@ impl Template for MainView {
|
|||||||
.height(336.0)
|
.height(336.0)
|
||||||
.text("")
|
.text("")
|
||||||
.child(
|
.child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.rows(Rows::create().row(72.0).row("*").build())
|
.rows(Rows::new().add(72.0).add("*").build())
|
||||||
.child(
|
.child(
|
||||||
Container::create()
|
Container::new()
|
||||||
.padding(8.0)
|
.padding(8.0)
|
||||||
.element("container")
|
.element("container")
|
||||||
.class("header")
|
.class("header")
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.child(
|
.child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.child(
|
.child(
|
||||||
ScrollViewer::create()
|
ScrollViewer::new()
|
||||||
.scroll_viewer_mode(("custom", "disabled"))
|
.scroll_viewer_mode(("custom", "disabled"))
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.width(0.0)
|
.width(0.0)
|
||||||
.height(14.0)
|
.height(14.0)
|
||||||
.text("")
|
.text("")
|
||||||
.element("text-block")
|
.element("text-block")
|
||||||
.id("input")
|
.id("input")
|
||||||
.vertical_alignment("start")
|
.v_align("start")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.element("text-block")
|
.element("text-block")
|
||||||
.text(id)
|
.text(id)
|
||||||
.vertical_alignment("end")
|
.v_align("end")
|
||||||
.horizontal_alignment("end")
|
.h_align("end")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
@@ -235,35 +235,35 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Container::create()
|
Container::new()
|
||||||
.element("container")
|
.element("container")
|
||||||
.class("content")
|
.class("content")
|
||||||
.padding(8.0)
|
.padding(8.0)
|
||||||
.attach(Grid::row(1))
|
.attach(Grid::row(1))
|
||||||
.child(
|
.child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.columns(
|
.columns(
|
||||||
Columns::create()
|
Columns::new()
|
||||||
.column(48.0)
|
.add(48.0)
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column(48.0)
|
.add(48.0)
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column(48.0)
|
.add(48.0)
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column(48.0)
|
.add(48.0)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.rows(
|
.rows(
|
||||||
Rows::create()
|
Rows::new()
|
||||||
.row(48.0)
|
.add(48.0)
|
||||||
.row(4.0)
|
.add(4.0)
|
||||||
.row(48.0)
|
.add(48.0)
|
||||||
.row(4.0)
|
.add(4.0)
|
||||||
.row(48.0)
|
.add(48.0)
|
||||||
.row(4.0)
|
.add(4.0)
|
||||||
.row(48.0)
|
.add(48.0)
|
||||||
.row(4.0)
|
.add(4.0)
|
||||||
.row(48.0)
|
.add(48.0)
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
// row 0
|
// row 0
|
||||||
@@ -300,12 +300,12 @@ impl Template for MainView {
|
|||||||
fn main() {
|
fn main() {
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - Calculator example")
|
.title("OrbTk - Calculator example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(212.0, 336.0)
|
.size(212.0, 336.0)
|
||||||
.theme(get_theme())
|
.theme(get_theme())
|
||||||
.child(MainView::create().build(ctx))
|
.child(MainView::new().build(ctx))
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ fn main() {
|
|||||||
|
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - image example")
|
.title("OrbTk - image example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(800.0, 420.0)
|
.size(800.0, 420.0)
|
||||||
.child(
|
.child(
|
||||||
ImageWidget::create()
|
ImageWidget::new()
|
||||||
.image("res/orbtk-space.png")
|
.image("../resources/orbtk-space.png")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
|
|||||||
@@ -11,20 +11,30 @@ impl MainState {
|
|||||||
fn show_window(&mut self) {
|
fn show_window(&mut self) {
|
||||||
self.show_window = true;
|
self.show_window = true;
|
||||||
}
|
}
|
||||||
|
fn disable_window(&mut self) {
|
||||||
|
self.show_window = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State for MainState {
|
impl State for MainState {
|
||||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||||
if self.show_window {
|
if self.show_window {
|
||||||
ctx.child("button").set("enabled", false);
|
ctx.child("window1_button").set("enabled", false);
|
||||||
ctx.show_window(|ctx| {
|
ctx.show_window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("Dialog")
|
.title("Dialog")
|
||||||
.position((120.0, 120.0))
|
.position((120.0, 120.0))
|
||||||
.size(100.0, 75.0)
|
.size(120.0, 125.0)
|
||||||
.child(
|
.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.child(TextBlock::create().text("New window").margin(4.0).build(ctx))
|
.child(TextBlock::new().text("I'm the new window").margin(4.0).build(ctx))
|
||||||
|
.child(
|
||||||
|
Button::new()
|
||||||
|
.id("window3_button")
|
||||||
|
.margin(4.0)
|
||||||
|
.text("Disable me")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
@@ -39,17 +49,17 @@ widget!(MainView<MainState>);
|
|||||||
impl Template for MainView {
|
impl Template for MainView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
self.child(
|
self.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.child(TextBlock::create().text("Window 1").margin(4.0).build(ctx))
|
.child(TextBlock::new().text("Window 1").margin(4.0).build(ctx))
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.id("button")
|
.id("window1_button")
|
||||||
.on_click(move |states, _| {
|
.on_click(move |states, _| {
|
||||||
states.get_mut::<MainState>(id).show_window();
|
states.get_mut::<MainState>(id).show_window();
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.margin(4.0)
|
.margin(4.0)
|
||||||
.text("Show window")
|
.text("Show new child window")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
@@ -63,22 +73,22 @@ fn main() {
|
|||||||
|
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - multi window example window 1")
|
.title("OrbTk - multi window example window 1")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(420.0, 730.0)
|
.size(420.0, 730.0)
|
||||||
.child(MainView::create().build(ctx))
|
.child(MainView::new().build(ctx))
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - multi window example window 2")
|
.title("OrbTk - multi window example window 2")
|
||||||
.position((600.0, 100.0))
|
.position((600.0, 100.0))
|
||||||
.size(420.0, 730.0)
|
.size(420.0, 730.0)
|
||||||
.child(
|
.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.child(TextBlock::create().text("Window 2").margin(4.0).build(ctx))
|
.child(TextBlock::new().text("Window 2").margin(4.0).build(ctx))
|
||||||
.child(Button::create().margin(4.0).text("Click me").build(ctx))
|
.child(Button::new().margin(4.0).text("Click me").build(ctx))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 237 KiB |
@@ -4,30 +4,46 @@ widget!(MainView);
|
|||||||
|
|
||||||
impl Template for MainView {
|
impl Template for MainView {
|
||||||
fn template(self, _: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, _: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
let container = Container::create()
|
let container = Container::new()
|
||||||
.background("#dfebf5")
|
.background("#dfebf5")
|
||||||
.width(200.0)
|
.width(200.0)
|
||||||
.height(200.0)
|
.height(200.0)
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.foreground("#3b434a")
|
.foreground("#3b434a")
|
||||||
.text("Overlay")
|
.text("Overlay 1")
|
||||||
.vertical_alignment("center")
|
.element("h2")
|
||||||
.horizontal_alignment("center")
|
.v_align("center")
|
||||||
|
.h_align("center")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx);
|
||||||
|
|
||||||
|
let container = Container::new()
|
||||||
|
.background("#dffff5")
|
||||||
|
.width(180.0)
|
||||||
|
.height(180.0)
|
||||||
|
.position((250.0, 250.0))
|
||||||
|
.child(
|
||||||
|
TextBlock::new()
|
||||||
|
.foreground("#3f3f3f")
|
||||||
|
.text("Overlay 2")
|
||||||
|
.v_align("center")
|
||||||
|
.h_align("center")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx);
|
.build(ctx);
|
||||||
|
|
||||||
ctx.append_child_to_overlay(container).unwrap();
|
ctx.append_child_to_overlay(container).unwrap();
|
||||||
self.name("MainView").child(
|
self.name("MainView").child(
|
||||||
Container::create()
|
Container::new()
|
||||||
.background("#e1bc21")
|
.background("#e1bc21")
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.text("MainView")
|
.text("MainView")
|
||||||
.element("h1")
|
.element("h1")
|
||||||
.vertical_alignment("center")
|
.v_align("center")
|
||||||
.horizontal_alignment("center")
|
.h_align("center")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
@@ -41,7 +57,7 @@ fn main() {
|
|||||||
|
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - overlay example")
|
.title("OrbTk - overlay example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(420.0, 730.0)
|
.size(420.0, 730.0)
|
||||||
|
|||||||
213
frontend/examples/policyholder_check.rs
Normal file
213
frontend/examples/policyholder_check.rs
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
use orbtk::prelude::*;
|
||||||
|
use orbtk::theme::DEFAULT_THEME_CSS;
|
||||||
|
|
||||||
|
static WIDGET_EXT: &'static str = include_str!("../resources/stylesheets/policyholder-check.css");
|
||||||
|
|
||||||
|
fn get_theme() -> ThemeValue {
|
||||||
|
ThemeValue::create_from_css(DEFAULT_THEME_CSS)
|
||||||
|
.extension_css(WIDGET_EXT)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
enum Action {
|
||||||
|
//ClearText,
|
||||||
|
EntryActivated(Entity),
|
||||||
|
EntryChanged(Entity),
|
||||||
|
//ValueChanged(Entity),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(AsAny)]
|
||||||
|
pub struct MainViewState {
|
||||||
|
action: Option<Action>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for MainViewState {
|
||||||
|
fn default() -> Self {
|
||||||
|
MainViewState { action: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MainViewState {
|
||||||
|
fn action(&mut self, action: impl Into<Option<Action>>) {
|
||||||
|
self.action = action.into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl State for MainViewState {
|
||||||
|
fn update(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
|
||||||
|
if let Some(action) = self.action {
|
||||||
|
match action {
|
||||||
|
// Action::ClearText => {
|
||||||
|
// ctx.widget().set("policynumber", String16::from(""));
|
||||||
|
// }
|
||||||
|
Action::EntryActivated(entity) => {
|
||||||
|
let mut widget = ctx.get_widget(entity);
|
||||||
|
let text = widget.get_mut::<String16>("text");
|
||||||
|
println!("submitting {}", text);
|
||||||
|
//text.clear();
|
||||||
|
}
|
||||||
|
Action::EntryChanged(entity) => {
|
||||||
|
let widget = ctx.get_widget(entity);
|
||||||
|
let text = widget.get::<String16>("text");
|
||||||
|
println!("entry changed: {}", text);
|
||||||
|
}
|
||||||
|
// Action::ValueChanged(entity) => {
|
||||||
|
// let val =
|
||||||
|
// ((*ctx.get_widget(entity).get::<f64>("val")).floor() as i32).to_string();
|
||||||
|
// ctx.child("value_text").set("text", String16::from(val));
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.action = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
||||||
|
TextBlock::new()
|
||||||
|
.text(text)
|
||||||
|
.element("text-block")
|
||||||
|
.class("h1")
|
||||||
|
.build(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
widget!(
|
||||||
|
MainView<MainViewState> {
|
||||||
|
sum_policynumbers: usize,
|
||||||
|
policynumber: String16,
|
||||||
|
result: String16
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
impl Template for MainView {
|
||||||
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
|
self.name("MainView").child(
|
||||||
|
//.result("Anzahl Versicherungsnummern: 0")
|
||||||
|
//.result("Policyholders count: 0").sum_policynumbers(0)
|
||||||
|
//.sum_policynumbers(0)
|
||||||
|
Grid::new()
|
||||||
|
//.width(200.0)
|
||||||
|
//.height(360.0)
|
||||||
|
.columns(
|
||||||
|
Columns::new()
|
||||||
|
.add(200.0)
|
||||||
|
.add("*")
|
||||||
|
//.add(120.0)
|
||||||
|
.add(200.0)
|
||||||
|
//.add("auto")
|
||||||
|
)
|
||||||
|
.rows(
|
||||||
|
Rows::new()
|
||||||
|
//.add("auto")
|
||||||
|
//.add(150.0)
|
||||||
|
//.add(200.0)
|
||||||
|
.add("*")
|
||||||
|
.add("*")
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Grid::new()
|
||||||
|
.element("policholder_check")
|
||||||
|
.background("fafafa")
|
||||||
|
.margin((4.0, 24.0, 4.0, 4.0))
|
||||||
|
.min_width(80.0)
|
||||||
|
.min_height(180.0)
|
||||||
|
.attach(Grid::column(1))
|
||||||
|
.attach(Grid::row(0))
|
||||||
|
.child(
|
||||||
|
Stack::new()
|
||||||
|
.spacing(8.0)
|
||||||
|
.orientation("vertical")
|
||||||
|
.h_align("center")
|
||||||
|
//.child(create_header(ctx, "Validation number policyholder"))
|
||||||
|
.child(create_header(ctx, "Validierung Versicherungsnummer"))
|
||||||
|
.child(
|
||||||
|
TextBox::new()
|
||||||
|
.class("text_box")
|
||||||
|
.water_mark("Versicherungs-Nr...")
|
||||||
|
//.text("Number policyholder", id)
|
||||||
|
.text(("policynumber", id))
|
||||||
|
.font_size(24.0)
|
||||||
|
.on_activate(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryActivated(entity));
|
||||||
|
})
|
||||||
|
.on_changed(move |states, entity| {
|
||||||
|
state(id, states).action(Action::EntryChanged(entity));
|
||||||
|
})
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
TextBlock::new()
|
||||||
|
.element("text-block")
|
||||||
|
.id("result")
|
||||||
|
.min_width(80.0)
|
||||||
|
.max_width(180.0)
|
||||||
|
//.text("Result:")
|
||||||
|
.text("Ergebnis:")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx)
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Grid::new()
|
||||||
|
.element("logo_customer")
|
||||||
|
.margin((4.0, 0.0, 0.0, 4.0))
|
||||||
|
.attach(Grid::column(0))
|
||||||
|
.attach(Grid::row(1))
|
||||||
|
.child(
|
||||||
|
ImageWidget::new()
|
||||||
|
.image("../resources/images/hiedemann_logo.png")
|
||||||
|
//.h_align("center")
|
||||||
|
//.v_align("bottom")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.child(
|
||||||
|
Grid::new()
|
||||||
|
.element("logo_vendor")
|
||||||
|
.margin((4.0, 0.0, 0.0, 4.0))
|
||||||
|
.attach(Grid::column(2))
|
||||||
|
.attach(Grid::row(1))
|
||||||
|
//.v_align("bottom")
|
||||||
|
.child(
|
||||||
|
ImageWidget::new()
|
||||||
|
//.image("../resources/images/networkx_logo.jpg")
|
||||||
|
.image("../resources/images/networkx_logo.png")
|
||||||
|
//.h_align("center")
|
||||||
|
//.v_align("bottom")
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
|
.build(ctx),
|
||||||
|
) // MainView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Application::new()
|
||||||
|
.window(|ctx| {
|
||||||
|
Window::new()
|
||||||
|
//.title("OrbTk - Policyholder checker example")
|
||||||
|
.title("AdvoTracker - Versicherungsnummern")
|
||||||
|
.position((-500.0, -100.0))
|
||||||
|
.size(480.0, 360.0)
|
||||||
|
.min_width(80.0)
|
||||||
|
.min_height(180.0)
|
||||||
|
.resizeable(true)
|
||||||
|
//.theme(get_theme())
|
||||||
|
.background("#fafafa")
|
||||||
|
.child(MainView::new().build(ctx))
|
||||||
|
.build(ctx)
|
||||||
|
})
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper to request MainViewState
|
||||||
|
fn state<'a>(id: Entity, states: &'a mut StatesContext) -> &'a mut MainViewState {
|
||||||
|
states.get_mut(id)
|
||||||
|
}
|
||||||
@@ -46,23 +46,23 @@ impl State for MainViewState {
|
|||||||
impl Template for MainView {
|
impl Template for MainView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
self.child(
|
self.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.horizontal_alignment("center")
|
.h_align("center")
|
||||||
.margin((16.0, 16.0, 16.0, 16.0))
|
.margin((16.0, 16.0, 16.0, 16.0))
|
||||||
.spacing(8.0)
|
.spacing(8.0)
|
||||||
.child(
|
.child(
|
||||||
ProgressBar::create()
|
ProgressBar::new()
|
||||||
.id("pgbar")
|
.id("pgbar")
|
||||||
.val(0.0)
|
.val(0.0)
|
||||||
.width(512.0)
|
.width(512.0)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.horizontal_alignment("center")
|
.h_align("center")
|
||||||
.spacing(8.0)
|
.spacing(8.0)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.text("Progress by 25%")
|
.text("Progress by 25%")
|
||||||
.width(256.0)
|
.width(256.0)
|
||||||
.on_click(move |states, _| -> bool {
|
.on_click(move |states, _| -> bool {
|
||||||
@@ -74,7 +74,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.text("Reset")
|
.text("Reset")
|
||||||
.width(256.0)
|
.width(256.0)
|
||||||
.on_click(move |states, _| -> bool {
|
.on_click(move |states, _| -> bool {
|
||||||
@@ -86,7 +86,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.text("Set to 100%")
|
.text("Set to 100%")
|
||||||
.width(256.0)
|
.width(256.0)
|
||||||
.on_click(move |states, _| -> bool {
|
.on_click(move |states, _| -> bool {
|
||||||
@@ -107,13 +107,13 @@ impl Template for MainView {
|
|||||||
fn main() {
|
fn main() {
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - ProgressBar example")
|
.title("OrbTk - ProgressBar example")
|
||||||
.position((0.0, 0.0))
|
.position((0.0, 0.0))
|
||||||
.size(720.0, 576.0)
|
.size(720.0, 576.0)
|
||||||
.borderless(false)
|
.borderless(false)
|
||||||
.resizeable(true)
|
.resizeable(true)
|
||||||
.child(MainView::create().build(ctx))
|
.child(MainView::new().build(ctx))
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
@@ -21,50 +21,50 @@ pub struct MainViewState {
|
|||||||
|
|
||||||
impl MainViewState {
|
impl MainViewState {
|
||||||
fn action(&mut self, action: Action) {
|
fn action(&mut self, action: Action) {
|
||||||
self.action = Some(action);
|
self.action = Some(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State for MainViewState {
|
impl State for MainViewState {
|
||||||
fn update(&mut self, registry: &mut Registry, ctx: &mut Context<'_>) {
|
fn update(&mut self, registry: &mut Registry, ctx: &mut Context<'_>) {
|
||||||
if let Some(action) = self.action {
|
if let Some(action) = self.action {
|
||||||
match action {
|
match action {
|
||||||
Action::Load => {
|
Action::Load => {
|
||||||
// load label from settings file.
|
// load label from settings file.
|
||||||
if let Ok(global) = registry
|
if let Ok(global) = registry
|
||||||
.get::<Settings>("settings")
|
.get::<Settings>("settings")
|
||||||
.load::<Global>("global")
|
.load::<Global>("global")
|
||||||
{
|
{
|
||||||
ctx.widget().set("text", String16::from(global.label));
|
ctx.widget().set("text", String16::from(global.label));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.widget().set(
|
ctx.widget().set(
|
||||||
"info_text",
|
"info_text",
|
||||||
String16::from("Label loaded from settings file."),
|
String16::from("Label loaded from settings file."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Action::Save => {
|
Action::Save => {
|
||||||
// save label to settings file.
|
// save label to settings file.
|
||||||
registry
|
registry
|
||||||
.get_mut::<Settings>("settings")
|
.get_mut::<Settings>("settings")
|
||||||
.save(
|
.save(
|
||||||
"global",
|
"global",
|
||||||
&Global {
|
&Global {
|
||||||
label: ctx.widget().get::<String16>("text").to_string(),
|
label: ctx.widget().get::<String16>("text").to_string(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
ctx.widget()
|
ctx.widget()
|
||||||
.set("info_text", String16::from("Label saved to settings file."));
|
.set("info_text", String16::from("Label saved to settings file."));
|
||||||
}
|
}
|
||||||
Action::Clear => {
|
Action::Clear => {
|
||||||
ctx.widget().set("text", String16::default());
|
ctx.widget().set("text", String16::default());
|
||||||
ctx.widget().set("info_text", String16::from(""));
|
ctx.widget().set("info_text", String16::from(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.action = None;
|
self.action = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,85 +75,85 @@ widget!(MainView<MainViewState> {
|
|||||||
|
|
||||||
impl Template for MainView {
|
impl Template for MainView {
|
||||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||||
self.name("MainView").child(
|
self.name("MainView").child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.rows(Rows::create().row(36.0).row(4.0).row("auto").build())
|
.rows(Rows::new().add(36.0).add(4.0).add("auto").build())
|
||||||
.columns(
|
.columns(
|
||||||
Columns::create()
|
Columns::new()
|
||||||
.column(160.0)
|
.add(160.0)
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column("Auto")
|
.add("Auto")
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column("Auto")
|
.add("Auto")
|
||||||
.column(4.0)
|
.add(4.0)
|
||||||
.column("Auto")
|
.add("Auto")
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBox::create()
|
TextBox::new()
|
||||||
.vertical_alignment("center")
|
.v_align("center")
|
||||||
.text(id)
|
.text(id)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.on_click(move |states, _| {
|
.on_click(move |states, _| {
|
||||||
state(id, states).action(Action::Load);
|
state(id, states).action(Action::Load);
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.text("Load")
|
.text("Load")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(4))
|
.attach(Grid::column(4))
|
||||||
.on_click(move |states, _| {
|
.on_click(move |states, _| {
|
||||||
state(id, states).action(Action::Save);
|
state(id, states).action(Action::Save);
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.text("Save")
|
.text("Save")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.attach(Grid::row(0))
|
.attach(Grid::row(0))
|
||||||
.attach(Grid::column(6))
|
.attach(Grid::column(6))
|
||||||
.on_click(move |states, _| {
|
.on_click(move |states, _| {
|
||||||
state(id, states).action(Action::Clear);
|
state(id, states).action(Action::Clear);
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
.text("Clear")
|
.text("Clear")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.attach(Grid::row(2))
|
.attach(Grid::row(2))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.text(("info_text", id))
|
.text(("info_text", id))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
Application::from_name("orbtk-settings")
|
Application::from_name("orbtk-settings")
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - settings example")
|
.title("OrbTk - settings example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(420.0, 730.0)
|
.size(420.0, 730.0)
|
||||||
.child(MainView::create().margin(4.0).build(ctx))
|
.child(MainView::new().margin(4.0).build(ctx))
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper to request MainViewState
|
// helper to request MainViewState
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ impl State for MainViewState {
|
|||||||
println!("entry changed: {}", text);
|
println!("entry changed: {}", text);
|
||||||
}
|
}
|
||||||
Action::ValueChanged(entity) => {
|
Action::ValueChanged(entity) => {
|
||||||
let value =
|
let val =
|
||||||
((*ctx.get_widget(entity).get::<f64>("value")).floor() as i32).to_string();
|
((*ctx.get_widget(entity).get::<f64>("val")).floor() as i32).to_string();
|
||||||
ctx.child("value_text").set("text", String16::from(value));
|
ctx.child("value_text").set("text", String16::from(val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ impl State for MainViewState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.text(text)
|
.text(text)
|
||||||
.element("text-block")
|
.element("text-block")
|
||||||
.class("h1")
|
.class("h1")
|
||||||
@@ -173,24 +173,23 @@ impl Template for MainView {
|
|||||||
.selection_list_count(10)
|
.selection_list_count(10)
|
||||||
.combo_box_list_count(10)
|
.combo_box_list_count(10)
|
||||||
.child(
|
.child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.margin(8.0)
|
.margin(8.0)
|
||||||
.columns(
|
.columns(
|
||||||
Columns::create()
|
Columns::new()
|
||||||
.column(132.0)
|
.add(132.0)
|
||||||
.column(16.0)
|
.add(16.0)
|
||||||
.column(132.0)
|
.add(132.0)
|
||||||
.column(16.0)
|
.add(16.0)
|
||||||
.column(132.0)
|
.add(132.0),
|
||||||
.build(),
|
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
// Column 0
|
// Column 0
|
||||||
.child(create_header(ctx, "Buttons"))
|
.child(create_header(ctx, "Buttons"))
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.text("Button")
|
.text("Button")
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
.icon(material_font_icons::CHECK_FONT_ICON)
|
.icon(material_font_icons::CHECK_FONT_ICON)
|
||||||
@@ -203,7 +202,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.text("Primary")
|
.text("Primary")
|
||||||
.element("button")
|
.element("button")
|
||||||
.class("primary")
|
.class("primary")
|
||||||
@@ -214,7 +213,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
ToggleButton::create()
|
ToggleButton::new()
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.text("ToggleButton")
|
.text("ToggleButton")
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
@@ -223,7 +222,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
CheckBox::create()
|
CheckBox::new()
|
||||||
.text("CheckBox")
|
.text("CheckBox")
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
@@ -231,23 +230,23 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Switch::create()
|
Switch::new()
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::row(5))
|
.attach(Grid::row(5))
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
.element("h1")
|
.element("h1")
|
||||||
.id("value_text")
|
.id("value_text")
|
||||||
.text("0")
|
.text("0")
|
||||||
.horizontal_alignment("center")
|
.h_align("center")
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Slider::create()
|
Slider::new()
|
||||||
.on_changed(move |states, entity| {
|
.on_changed(move |states, entity| {
|
||||||
state(id, states).action(Action::ValueChanged(entity));
|
state(id, states).action(Action::ValueChanged(entity));
|
||||||
})
|
})
|
||||||
@@ -256,11 +255,11 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Stack::create()
|
Stack::new()
|
||||||
.attach(Grid::column(2))
|
.attach(Grid::column(2))
|
||||||
.child(create_header(ctx, "Text"))
|
.child(create_header(ctx, "Text"))
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.class("body")
|
.class("body")
|
||||||
.text(("result", id))
|
.text(("result", id))
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
@@ -269,7 +268,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBox::create()
|
TextBox::new()
|
||||||
.water_mark("TextBox...")
|
.water_mark("TextBox...")
|
||||||
.text(("text_one", id))
|
.text(("text_one", id))
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
@@ -284,7 +283,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
TextBox::create()
|
TextBox::new()
|
||||||
.water_mark("TextBox...")
|
.water_mark("TextBox...")
|
||||||
.text(("text_two", id))
|
.text(("text_two", id))
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
@@ -299,7 +298,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.margin((0.0, 8.0, 0.0, 0.0))
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.text("clear text")
|
.text("clear text")
|
||||||
@@ -309,31 +308,32 @@ impl Template for MainView {
|
|||||||
})
|
})
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
|
.child(
|
||||||
|
NumericBox::new()
|
||||||
|
.margin((0.0, 8.0, 0.0, 0.0))
|
||||||
|
.max(123.0)
|
||||||
|
.step(0.123)
|
||||||
|
.val(0.123)
|
||||||
|
.build(ctx),
|
||||||
|
)
|
||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Grid::create()
|
Grid::new()
|
||||||
.rows(
|
.rows(
|
||||||
Rows::create()
|
Rows::new()
|
||||||
.row("auto")
|
.add("auto")
|
||||||
.row(32.0)
|
.add(32.0)
|
||||||
.row(16.0)
|
.add(16.0)
|
||||||
.row(204.0)
|
.add(204.0)
|
||||||
.row("auto")
|
.add("auto")
|
||||||
.row(192.0)
|
.add(192.0)
|
||||||
.row("auto")
|
.add("auto"),
|
||||||
.build(),
|
|
||||||
)
|
|
||||||
.columns(
|
|
||||||
Columns::create()
|
|
||||||
.column("*")
|
|
||||||
.column(4.0)
|
|
||||||
.column("*")
|
|
||||||
.build(),
|
|
||||||
)
|
)
|
||||||
|
.columns(Columns::new().add("*").add(4.0).add("*"))
|
||||||
.attach(Grid::column(4))
|
.attach(Grid::column(4))
|
||||||
.child(
|
.child(
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.text("Items")
|
.text("Items")
|
||||||
.element("text-block")
|
.element("text-block")
|
||||||
.class("h1")
|
.class("h1")
|
||||||
@@ -343,15 +343,15 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
ComboBox::create()
|
ComboBox::new()
|
||||||
.items_builder(move |bc, index| {
|
.items_builder(move |bc, index| {
|
||||||
let text = bc
|
let text = bc
|
||||||
.get_widget(id)
|
.get_widget(id)
|
||||||
.get::<Vec<String>>("combo_box_list")[index]
|
.get::<Vec<String>>("combo_box_list")[index]
|
||||||
.clone();
|
.clone();
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.margin((0.0, 0.0, 0.0, 2.0))
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
.vertical_alignment("center")
|
.v_align("center")
|
||||||
.text(text)
|
.text(text)
|
||||||
.build(bc)
|
.build(bc)
|
||||||
})
|
})
|
||||||
@@ -364,7 +364,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
ItemsWidget::create()
|
ItemsWidget::new()
|
||||||
.element("items-widget")
|
.element("items-widget")
|
||||||
.id("items")
|
.id("items")
|
||||||
.padding((4.0, 4.0, 4.0, 2.0))
|
.padding((4.0, 4.0, 4.0, 2.0))
|
||||||
@@ -377,7 +377,7 @@ impl Template for MainView {
|
|||||||
[index]
|
[index]
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
Button::create()
|
Button::new()
|
||||||
.margin((0.0, 0.0, 0.0, 2.0))
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
.text(text)
|
.text(text)
|
||||||
.build(bc)
|
.build(bc)
|
||||||
@@ -386,7 +386,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.element("button")
|
.element("button")
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.id("remove-item-button")
|
.id("remove-item-button")
|
||||||
@@ -401,7 +401,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Button::create()
|
Button::new()
|
||||||
.element("button")
|
.element("button")
|
||||||
.class("single_content")
|
.class("single_content")
|
||||||
.id("add-item-button")
|
.id("add-item-button")
|
||||||
@@ -416,7 +416,7 @@ impl Template for MainView {
|
|||||||
.build(ctx),
|
.build(ctx),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
ListView::create()
|
ListView::new()
|
||||||
.attach(Grid::column(0))
|
.attach(Grid::column(0))
|
||||||
.attach(Grid::column_span(3))
|
.attach(Grid::column_span(3))
|
||||||
.attach(Grid::row(5))
|
.attach(Grid::row(5))
|
||||||
@@ -427,9 +427,9 @@ impl Template for MainView {
|
|||||||
.get_widget(id)
|
.get_widget(id)
|
||||||
.get::<Vec<String>>("selection_list")[index]
|
.get::<Vec<String>>("selection_list")[index]
|
||||||
.clone();
|
.clone();
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.margin((0.0, 0.0, 0.0, 2.0))
|
.margin((0.0, 0.0, 0.0, 2.0))
|
||||||
.vertical_alignment("center")
|
.v_align("center")
|
||||||
.text(text)
|
.text(text)
|
||||||
.build(bc)
|
.build(bc)
|
||||||
})
|
})
|
||||||
@@ -438,7 +438,7 @@ impl Template for MainView {
|
|||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
// todo: wrong text width????
|
// todo: wrong text width????
|
||||||
TextBlock::create()
|
TextBlock::new()
|
||||||
.element("text-block")
|
.element("text-block")
|
||||||
.id("selection")
|
.id("selection")
|
||||||
.max_width(120.0)
|
.max_width(120.0)
|
||||||
@@ -461,12 +461,12 @@ fn main() {
|
|||||||
|
|
||||||
Application::new()
|
Application::new()
|
||||||
.window(|ctx| {
|
.window(|ctx| {
|
||||||
Window::create()
|
Window::new()
|
||||||
.title("OrbTk - widgets example")
|
.title("OrbTk - widgets example")
|
||||||
.position((100.0, 100.0))
|
.position((100.0, 100.0))
|
||||||
.size(468.0, 730.0)
|
.size(468.0, 730.0)
|
||||||
.resizeable(true)
|
.resizeable(true)
|
||||||
.child(MainView::create().build(ctx))
|
.child(MainView::new().build(ctx))
|
||||||
.build(ctx)
|
.build(ctx)
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|||||||
BIN
frontend/resources/images/customer_background.jpg
Executable file
BIN
frontend/resources/images/customer_background.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
1
frontend/resources/images/customer_logo.png
Symbolic link
1
frontend/resources/images/customer_logo.png
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
hiedemann_logo.png
|
||||||
BIN
frontend/resources/images/hiedemann_logo.png
Normal file
BIN
frontend/resources/images/hiedemann_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
BIN
frontend/resources/images/networkx_logo.png
Normal file
BIN
frontend/resources/images/networkx_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
25
frontend/resources/policyholder-check.css
Normal file
25
frontend/resources/policyholder-check.css
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
* {
|
||||||
|
font-size: 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
lynch {
|
||||||
|
background: #647b91;
|
||||||
|
}
|
||||||
|
|
||||||
|
bluebayoux {
|
||||||
|
background: #516475;
|
||||||
|
}
|
||||||
|
|
||||||
|
linkwater {
|
||||||
|
background: #dfebf5;
|
||||||
|
color: #3b434a;
|
||||||
|
}
|
||||||
|
|
||||||
|
light-text {
|
||||||
|
color: #dfebf5;
|
||||||
|
}
|
||||||
|
|
||||||
|
goldendream {
|
||||||
|
background: #efd035;
|
||||||
|
color: #3b434a;
|
||||||
|
}
|
||||||
53
frontend/resources/stylesheets/policyholder-check.css
Normal file
53
frontend/resources/stylesheets/policyholder-check.css
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
* {
|
||||||
|
font-size: 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.background {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
text-box {
|
||||||
|
color: #5b0f22;
|
||||||
|
}
|
||||||
|
|
||||||
|
text-block {
|
||||||
|
color: #5b0f22;
|
||||||
|
}
|
||||||
|
|
||||||
|
light-text {
|
||||||
|
color: #dfebf5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* // Hiedemann blue */
|
||||||
|
/* color: #a5b3bf; */
|
||||||
|
/* color: #4d4c4c; */
|
||||||
|
|
||||||
|
/* // Hiedemann red */
|
||||||
|
/* color: #5b0f22; */
|
||||||
|
|
||||||
|
/* // Hiedemann darkgrey */
|
||||||
|
/* color: #879488; */
|
||||||
|
|
||||||
|
/* // Hiedemann grey */
|
||||||
|
/* color: ##b6c3b7; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* // Qt Green */
|
||||||
|
/* color: #41cd52; */
|
||||||
|
|
||||||
|
/* // lightgrey */
|
||||||
|
/* color: #f0f0f0; */
|
||||||
|
|
||||||
|
/* Accent=#5b0f22 */
|
||||||
|
/* Foreground=#000000 */
|
||||||
|
/* Background=#f0f0f0 */
|
||||||
Reference in New Issue
Block a user