//! budget's Android entry: compiled only into the packaged `.so` //! (`cargo makepad android build` links the lib target as a cdylib), where //! the desktop binary never sees it. Same app shell as `main.rs`: fonts //! declared up front, the window rooted on `BudgetApp`. use crate::{app, forms, nav_button, theme, view}; use makepad_widgets::*; app_main!( App, font_assets: ["budget/resources/jetbrains_mono_variable.ttf"] ); script_mod! { use mod.prelude.widgets.* use mod.widgets.* startup() do #(App::script_component(vm)){ ui: Root{ main_window := Window{ window.inner_size: vec2(420, 800) window.title: "Old Mutual Budget" // The stock window clears to `theme.color_bg_app` as captured // when the widgets module was evaluated — before this app // retinted it — so state the sheet's own ground explicitly. pass +: { clear_color: mod.sheets.bg } body +: { padding: 0. margin: 0. spacing: 0. budget := BudgetApp{} } } } } } #[derive(Script, ScriptHook)] pub struct App { #[live] ui: WidgetRef, } impl MatchEvent for App { fn handle_startup(&mut self, cx: &mut Cx) { if let Some(mut budget) = self .ui .widget(cx, ids!(budget)) .borrow_mut::() { budget.arm_storage(cx); } } fn handle_actions(&mut self, _cx: &mut Cx, _actions: &Actions) {} } impl AppMain for App { fn script_mod(vm: &mut ScriptVm) -> ScriptValue { makepad_widgets::script_mod(vm); // Retint the stock widgets, then publish the palette as `mod.sheets` // for this app's own splash. makepad_wm_theme::apply(vm); theme::install(vm); nav_button::script_mod(vm); view::script_mod(vm); forms::script_mod(vm); app::script_mod(vm); self::script_mod(vm) } fn handle_event(&mut self, cx: &mut Cx, event: &Event) { self.match_event(cx, event); self.ui.handle_event(cx, event, &mut Scope::empty()); } }