48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
mod app_delegate;
|
|
mod app_header;
|
|
mod commands;
|
|
mod data;
|
|
mod editor;
|
|
mod modal_container;
|
|
mod output_block;
|
|
|
|
use data::{AppData, Block};
|
|
use druid::widget::{Container, Flex, List, Padding, Scroll};
|
|
use druid::{AppLauncher, PlatformError, Widget, WidgetExt, WindowDesc};
|
|
use modal_container::ModalContainer;
|
|
|
|
fn build_ui() -> impl Widget<AppData> {
|
|
ModalContainer::new(
|
|
Flex::column()
|
|
.with_child(app_header::app_header_ui())
|
|
.with_child(app_header::header_separater())
|
|
.with_flex_child(
|
|
Scroll::new(
|
|
List::new(|| {
|
|
Flex::column()
|
|
.with_child(editor::editor_header())
|
|
.with_child(Container::new(Padding::new(
|
|
10.0,
|
|
editor::AbacusEditor::default().lens(Block::editor_data),
|
|
)))
|
|
.with_child(output_block::output_block())
|
|
})
|
|
.lens(AppData::blocks),
|
|
)
|
|
.vertical(),
|
|
1.0,
|
|
),
|
|
)
|
|
}
|
|
|
|
fn main() -> Result<(), PlatformError> {
|
|
AppLauncher::with_window(
|
|
WindowDesc::new(build_ui())
|
|
.resizable(true)
|
|
.window_size((600.0, 800.0)),
|
|
)
|
|
.delegate(app_delegate::Delegate)
|
|
.launch(AppData::default())?;
|
|
Ok(())
|
|
}
|