Skip to main content

rustapi/editor_tools/
mod.rs

1pub mod tile_draw;
2pub mod tile_eraser;
3pub mod tile_fill;
4pub mod tile_picker;
5pub mod tile_select;
6
7pub use tile_draw::*;
8pub use tile_eraser::*;
9pub use tile_fill::*;
10pub use tile_picker::*;
11pub use tile_select::*;
12
13use shared::prelude::*;
14use theframework::prelude::*;
15
16/// Tool trait for dock editors (like tile editor, tilemap editor, etc.)
17#[allow(unused)]
18pub trait EditorTool: Send + Sync {
19    fn new() -> Self
20    where
21        Self: Sized;
22
23    fn id(&self) -> TheId;
24    fn info(&self) -> String;
25    fn icon_name(&self) -> String;
26    fn rgba_view_mode(&self) -> Option<TheRGBAViewMode> {
27        None
28    }
29
30    fn accel(&self) -> Option<char> {
31        None
32    }
33
34    fn help_url(&self) -> Option<String> {
35        None
36    }
37
38    fn activate(&mut self) {}
39    fn deactivate(&mut self) {}
40
41    fn handle_event(
42        &mut self,
43        event: &TheEvent,
44        ui: &mut TheUI,
45        ctx: &mut TheContext,
46        project: &mut Project,
47        server_ctx: &mut ServerContext,
48    ) -> bool {
49        false
50    }
51
52    /// Get the current undo atom if the tool has pending changes
53    /// This is called when a tool operation completes (e.g., on mouse up)
54    fn get_undo_atom(&mut self, project: &Project) -> Option<Box<dyn std::any::Any>> {
55        None
56    }
57}