mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 11:18:13 +08:00
Implement event/response roundtrip (#49)
This commit is contained in:
+14
-2
@@ -1,6 +1,6 @@
|
||||
mod color;
|
||||
mod dispatcher;
|
||||
mod error;
|
||||
mod scheduler;
|
||||
pub mod tools;
|
||||
pub mod workspace;
|
||||
|
||||
@@ -10,6 +10,13 @@ pub use error::EditorError;
|
||||
#[doc(inline)]
|
||||
pub use color::Color;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use dispatcher::events;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use dispatcher::Callback;
|
||||
|
||||
use dispatcher::Dispatcher;
|
||||
use tools::ToolState;
|
||||
use workspace::Workspace;
|
||||
|
||||
@@ -17,13 +24,18 @@ use workspace::Workspace;
|
||||
pub struct Editor {
|
||||
pub tools: ToolState,
|
||||
workspace: Workspace,
|
||||
dispatcher: Dispatcher,
|
||||
}
|
||||
|
||||
impl Editor {
|
||||
pub fn new() -> Self {
|
||||
pub fn new(callback: Callback) -> Self {
|
||||
Self {
|
||||
tools: ToolState::new(),
|
||||
workspace: Workspace::new(),
|
||||
dispatcher: Dispatcher::new(callback),
|
||||
}
|
||||
}
|
||||
pub fn handle_event(&mut self, event: events::Event) -> Result<(), EditorError> {
|
||||
self.dispatcher.handle_event(event)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user