Perform widget operations in Emulator
This commit is contained in:
parent
149eb8a024
commit
927d5b7cba
1 changed files with 24 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ use crate::Instruction;
|
|||
use crate::core;
|
||||
use crate::core::mouse;
|
||||
use crate::core::renderer;
|
||||
use crate::core::widget::operation;
|
||||
use crate::core::window;
|
||||
use crate::core::{Element, Size};
|
||||
use crate::program::Program;
|
||||
|
|
@ -91,8 +92,29 @@ impl<P: Program + 'static> Emulator<P> {
|
|||
Action::LoadFont { .. } => {
|
||||
// TODO
|
||||
}
|
||||
Action::Widget(_operation) => {
|
||||
// TODO
|
||||
Action::Widget(operation) => {
|
||||
let mut user_interface = UserInterface::build(
|
||||
program.view(&self.state, self.window),
|
||||
self.size,
|
||||
self.cache.take().unwrap(),
|
||||
&mut self.renderer,
|
||||
);
|
||||
|
||||
let mut operation = Some(operation);
|
||||
|
||||
while let Some(mut current) = operation.take() {
|
||||
user_interface.operate(&self.renderer, &mut current);
|
||||
|
||||
match current.finish() {
|
||||
operation::Outcome::None => {}
|
||||
operation::Outcome::Some(()) => {}
|
||||
operation::Outcome::Chain(next) => {
|
||||
operation = Some(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.cache = Some(user_interface.into_cache());
|
||||
}
|
||||
Action::Clipboard(action) => {
|
||||
// TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue