GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
feat(model): Input hooks for the tree context-menu actions (TreeList conversion prep)
copy_key / copy_value / delete_key / expand_node / collapse_node /
expand_all_nodes / collapse_all_nodes as transitional Input capability
hooks (default no-op) with Adapted forwards — the same 5k pattern as
copy_path and the controller pairs. The global context menu dispatches
these on its dyn Element target; once TreeList is Adapted<TreeList>,
the forwards keep that dispatch working. Dies with the Element deletion.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018u7qTwzX95dd5ysAkaSCLk
src/widget/model.rs | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/widget/model.rs b/src/widget/model.rs
index 029088a..747ff0b 100644
--- a/src/widget/model.rs
+++ b/src/widget/model.rs
@@ -623,6 +623,18 @@ pub trait Input {
/// calls `Element::copy_path` on its target (Breadcrumb is the only implementor).
fn copy_path(&self) {}
+ /// The tree context-menu actions ("Copy Key" / "Copy Value" / "Delete" / "Expand" /
+ /// "Collapse" / "Expand All" / "Collapse All") — the global context menu dispatches them
+ /// on its `dyn Element` target; `Adapted` forwards here. TreeList is the only implementor
+ /// (transitional, dies with the `Element` deletion like the controller hooks above).
+ fn copy_key(&self) {}
+ fn copy_value(&self) {}
+ fn delete_key(&mut self) {}
+ fn expand_node(&mut self) {}
+ fn collapse_node(&mut self) {}
+ fn expand_all_nodes(&mut self) {}
+ fn collapse_all_nodes(&mut self) {}
+
/// Keyboard modifier state pushed in by hosts before dispatch (legacy
/// `Element::set_modifiers`).
fn set_modifiers(&mut self, _ctrl: bool, _shift: bool, _alt: bool) {}
@@ -1513,6 +1525,28 @@ impl<W: Layout + Paint + Input + 'static> Element for Adapted<W> {
Input::copy_path(&self.inner)
}
+ fn copy_key(&self) {
+ Input::copy_key(&self.inner)
+ }
+ fn copy_value(&self) {
+ Input::copy_value(&self.inner)
+ }
+ fn delete_key(&mut self) {
+ Input::delete_key(&mut self.inner)
+ }
+ fn expand_node(&mut self) {
+ Input::expand_node(&mut self.inner)
+ }
+ fn collapse_node(&mut self) {
+ Input::collapse_node(&mut self.inner)
+ }
+ fn expand_all_nodes(&mut self) {
+ Input::expand_all_nodes(&mut self.inner)
+ }
+ fn collapse_all_nodes(&mut self) {
+ Input::collapse_all_nodes(&mut self.inner)
+ }
+
// --- Legacy direct-dispatch entry points. Hosts (treelist's add-key button, parameters_bg's
// checkboxes, app pages) call these ON the widget instead of routing an Event through
// `propagate_event`; without these overrides they'd hit the inert Element defaults and the