abacus/abacus-ui/src/main.rs

36 lines
1009 B
Rust

mod editor;
use druid::widget::{Align, Flex, Label, Padding, RawLabel};
use druid::{AppLauncher, Color, Data, PlatformError, Widget, WidgetExt, WindowDesc};
use editor::EditorData;
fn build_ui() -> impl Widget<editor::EditorData> {
Padding::new(
10.0,
Flex::row()
.with_flex_child(
Flex::column().with_flex_child(editor::AbacusEditor, 1.0),
1.0,
)
.with_flex_child(
Flex::column()
.with_flex_child(
Label::new("top right").background(Color::rgb8(0, 0, 255)),
1.0,
)
.with_flex_child(Align::centered(Label::new("bottom right")), 1.0),
1.0,
),
)
}
fn main() -> Result<(), PlatformError> {
AppLauncher::with_window(WindowDesc::new(build_ui())).launch(editor::EditorData::default())?;
Ok(())
}
#[derive(Clone, Data)]
struct CodeEditor {
code: String,
}