widgets: policycheck_view: global "lang" and styling
* use ron styling * language variable in struct Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -18,28 +18,27 @@ widget!(
|
||||
/// Dialog to enter a policy identifier/number.
|
||||
/// This identifier is checked agains a map of valid policy codes.
|
||||
PolicyCheckView<PolicyCheckState> {
|
||||
lang: String,
|
||||
policy_check: PolicyCheck,
|
||||
policy_check_title: String16,
|
||||
policy_data_count: u32
|
||||
}
|
||||
);
|
||||
|
||||
// The template implementation for our View
|
||||
/// The template implementation of the policy check view
|
||||
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
|
||||
impl Template for PolicyCheckView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||
fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
||||
let policy_check_bottom_bar = Container::new()
|
||||
.class(CLASS_BOTTOM_BAR)
|
||||
//.style(STYLE_BOTTOM_BAR)
|
||||
.attach(Grid::row(4))
|
||||
.attach(Grid::column(1))
|
||||
.attach(Grid::column_span(2))
|
||||
.v_align("end")
|
||||
.child(
|
||||
Container::new()
|
||||
//.padding(18.)
|
||||
.child( Container::new()
|
||||
//.size(220., 64.)
|
||||
.element("logo_customer")
|
||||
.margin((0., 16., 16., 0.))
|
||||
.margin((0, 16, 16, 0))
|
||||
.v_align("center")
|
||||
.child(
|
||||
ImageWidget::new()
|
||||
@@ -53,15 +52,12 @@ impl Template for PolicyCheckView {
|
||||
)
|
||||
.child(
|
||||
Container::new()
|
||||
//Grid::new()
|
||||
.element("copyright_vendor")
|
||||
.attach(Grid::column(1))
|
||||
.background("#1f1f1f")
|
||||
.h_align("end")
|
||||
.v_align("end")
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.margin((0., 9., 16., 0.))
|
||||
.margin((0, 9, 16, 0))
|
||||
.text("©Networkx GmbH")
|
||||
.build(ctx)
|
||||
)
|
||||
@@ -71,7 +67,7 @@ impl Template for PolicyCheckView {
|
||||
|
||||
let policy_check_label_menu = TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_LABEL_MENU)
|
||||
.foreground("#3b434a")
|
||||
.style("menu")
|
||||
.text("Help Menu")
|
||||
.v_align("center")
|
||||
.h_align("center")
|
||||
@@ -79,19 +75,13 @@ impl Template for PolicyCheckView {
|
||||
|
||||
let policy_check_button_menu = Button::new()
|
||||
.id(ID_POLICY_CHECK_BUTTON_MENU)
|
||||
.style("button_single_content")
|
||||
.icon(material_icons_font::MD_MENU)
|
||||
.class("menu_button")
|
||||
.attach(Grid::column(2))
|
||||
//.margin((0., 0., 0., 0.))
|
||||
//.text("Menu Button")
|
||||
//.min_size(8.0, 8.0)
|
||||
.min_size(16.0, 16.0)
|
||||
//.min_size(16, 16)
|
||||
.h_align("end")
|
||||
//.v_align("center")
|
||||
//.enabled(true)
|
||||
.on_mouse_down(|_, _| true)
|
||||
.on_click(move |ctx, _| {
|
||||
ctx.get_mut::<PolicyCheckState>(id)
|
||||
ctx.get_mut::<PolicyCheckState>(policycheck_view)
|
||||
.action(Action::OpenMenu(policy_check_label_menu));
|
||||
true
|
||||
})
|
||||
@@ -99,7 +89,7 @@ impl Template for PolicyCheckView {
|
||||
|
||||
let policy_check_button_result = Button::new()
|
||||
.id(ID_POLICY_CHECK_BUTTON_RESULT)
|
||||
.class("single_content")
|
||||
.style("button_single_content")
|
||||
.h_align("start")
|
||||
.v_align("center")
|
||||
.visibility(Visibility::Collapsed)
|
||||
@@ -107,8 +97,7 @@ impl Template for PolicyCheckView {
|
||||
.build(ctx);
|
||||
|
||||
let policy_check_header_bar = Container::new()
|
||||
//.border_color("transparent")
|
||||
.class(CLASS_HEADER_BAR)
|
||||
.style(STYLE_HEADER_BAR)
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(1))
|
||||
.attach(Grid::column_span(2))
|
||||
@@ -116,15 +105,10 @@ impl Template for PolicyCheckView {
|
||||
Grid::new()
|
||||
.child(
|
||||
TextBlock::new()
|
||||
//.class(CLASS_HEADER)
|
||||
.class("h1")
|
||||
//.class(".myheader")
|
||||
.style("header")
|
||||
.id(ID_POLICY_CHECK_HEADER)
|
||||
//.font_size(24)
|
||||
//.font("Roboto Medium")
|
||||
.v_align("center")
|
||||
.h_align("left")
|
||||
//.margin((32.0, 32.0, 32.0, 32.0))
|
||||
.text("Validierung Versicherungsnummer")
|
||||
.build(ctx),
|
||||
)
|
||||
@@ -142,15 +126,12 @@ impl Template for PolicyCheckView {
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
|
||||
//.class(CLASS_TEXT_BLOCK)
|
||||
.style("body")
|
||||
.attach(Grid::row(0))
|
||||
.attach(Grid::column(0))
|
||||
.margin((0., 0., 16., 0.))
|
||||
.margin((0, 0, 16, 0))
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
//.min_width(250.)
|
||||
//.min_height(45.)
|
||||
//.size(250., 45.)
|
||||
.text("Versicherungsnummer:")
|
||||
.build(ctx),
|
||||
)
|
||||
@@ -160,13 +141,11 @@ impl Template for PolicyCheckView {
|
||||
.attach(Grid::column(2))
|
||||
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
||||
.h_align("start")
|
||||
//.width(105.0)
|
||||
//.min_width(100.0)
|
||||
.lost_focus_on_activation(false)
|
||||
.water_mark("10-stellig")
|
||||
.on_activate(move |ctx, entity| {
|
||||
// Entity is entered/activated via Mouse/Keyboard
|
||||
ctx.get_mut::<PolicyCheckState>(id)
|
||||
ctx.get_mut::<PolicyCheckState>(policycheck_view)
|
||||
.action(Action::ParseEntry(entity));
|
||||
})
|
||||
//.on_changed(move |ctx, entity| {
|
||||
@@ -205,21 +184,21 @@ impl Template for PolicyCheckView {
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_LABEL_RESULT)
|
||||
.class(CLASS_TEXT_BLOCK)
|
||||
.style("body")
|
||||
.attach(Grid::row(1))
|
||||
.attach(Grid::column(0))
|
||||
.margin((0., 0., 16., 0.))
|
||||
.margin((0, 0, 16, 0))
|
||||
.h_align("end")
|
||||
.v_align("center")
|
||||
.width(250.0)
|
||||
.min_width(250.0)
|
||||
.text("Ergebnis:")
|
||||
.width(250)
|
||||
.min_width(250)
|
||||
.visibility(Visibility::Visible)
|
||||
.build(ctx),
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
.id(ID_POLICY_CHECK_RESULT)
|
||||
.style("body")
|
||||
.attach(Grid::row(1))
|
||||
.attach(Grid::column(2))
|
||||
.h_align("start")
|
||||
@@ -229,30 +208,24 @@ impl Template for PolicyCheckView {
|
||||
.build(ctx);
|
||||
|
||||
let policy_check_form = Container::new()
|
||||
//.class(CLASS_POLICY_CHECK_FORM)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(1))
|
||||
.v_align("top")
|
||||
.padding(14.0)
|
||||
.background("transparent")
|
||||
.border_radius(3.)
|
||||
.border_width(1.)
|
||||
.border_brush("#fafafa")
|
||||
.style("container_form")
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_POLICY_CHECK_FORM)
|
||||
.columns(
|
||||
Columns::new()
|
||||
// Labels
|
||||
.add("250.")
|
||||
.add("250")
|
||||
// Seperator
|
||||
.add("16.")
|
||||
.add("16")
|
||||
// Values
|
||||
.add("100.")
|
||||
.add("100")
|
||||
// Seperator
|
||||
.add("16.")
|
||||
.add("16")
|
||||
// Result-Button
|
||||
.add("32.")
|
||||
.add("32")
|
||||
.build(),
|
||||
)
|
||||
.rows(
|
||||
@@ -270,12 +243,12 @@ impl Template for PolicyCheckView {
|
||||
let _policy_check_numeric_box = NumericBox::new()
|
||||
.id(ID_POLICY_CHECK_POLICY_NUMBER)
|
||||
.h_align("start")
|
||||
.width(100.0)
|
||||
.width(100)
|
||||
//.min(<usize>1000000000)
|
||||
//.max(<usize>9999999999)
|
||||
.val(0)
|
||||
.min_width(95.0)
|
||||
.margin((0.0, 0.0, 0.0, 16.0))
|
||||
.min_width(95)
|
||||
.margin((0, 0, 0, 16))
|
||||
// WIP code @kivimango
|
||||
// .on_activate(move |ctx, entity| {
|
||||
// ctx.get_mut::<PolicyCheckState>(id)
|
||||
@@ -289,10 +262,9 @@ impl Template for PolicyCheckView {
|
||||
|
||||
let policy_data_count_block = TextBlock::new()
|
||||
.id(ID_POLICY_DATA_COUNT_BLOCK)
|
||||
//.class(CLASS_TEXT_BLOCK)
|
||||
.attach(Grid::row(3))
|
||||
.attach(Grid::column(1))
|
||||
.margin((0., 4., 0., 0.))
|
||||
.margin((0, 4, 0, 0))
|
||||
.h_align("end")
|
||||
.v_align("top")
|
||||
.enabled(true)
|
||||
@@ -305,18 +277,17 @@ impl Template for PolicyCheckView {
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_POLICY_CHECK_WIDGET)
|
||||
//.background("#fafafa")
|
||||
.columns(
|
||||
Columns::new()
|
||||
.add(50.)
|
||||
.add(50)
|
||||
.add("*")
|
||||
.add(50.)
|
||||
.add(50)
|
||||
.build(),
|
||||
)
|
||||
.rows(
|
||||
Rows::new()
|
||||
.add("auto")
|
||||
.add(28.)
|
||||
.add(28)
|
||||
.add("*")
|
||||
.add("auto")
|
||||
.add("auto")
|
||||
|
||||
Reference in New Issue
Block a user