1
0
Fork 0
forked from wry/wry

tree: implement tile dragging

This commit is contained in:
Julian Orth 2024-09-30 18:31:19 +02:00
parent 83fd9f211e
commit 132986df2a
17 changed files with 925 additions and 52 deletions

View file

@ -10,7 +10,8 @@ use {
state::State,
text::TextTexture,
tree::{
Direction, FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeVisitor,
default_tile_drag_destination, ContainerSplit, Direction, FindTreeResult,
FindTreeUsecase, FoundNode, Node, NodeId, NodeVisitor, TileDragDestination,
ToplevelData, ToplevelNode, ToplevelNodeBase,
},
utils::{
@ -62,6 +63,17 @@ impl PlaceholderNode {
}
}
pub fn new_empty(state: &Rc<State>) -> Self {
Self {
id: state.node_ids.next(),
toplevel: ToplevelData::new(state, String::new(), None),
destroyed: Default::default(),
update_textures_scheduled: Default::default(),
state: state.clone(),
textures: Default::default(),
}
}
pub fn is_destroyed(&self) -> bool {
self.destroyed.get()
}
@ -222,4 +234,15 @@ impl ToplevelNodeBase for PlaceholderNode {
fn tl_admits_children(&self) -> bool {
false
}
fn tl_tile_drag_destination(
self: Rc<Self>,
source: NodeId,
split: Option<ContainerSplit>,
abs_bounds: Rect,
x: i32,
y: i32,
) -> Option<TileDragDestination> {
default_tile_drag_destination(self, source, split, abs_bounds, x, y)
}
}