diff --git a/crates/pages/src/ui/list.rs b/crates/pages/src/ui/list.rs index 05b13067f..218121ea3 100644 --- a/crates/pages/src/ui/list.rs +++ b/crates/pages/src/ui/list.rs @@ -142,6 +142,23 @@ pub enum PageListEvent { ContextMenu(ContextMenuRequest), } +impl PageListEvent { + /// A name typed in place for `row`, which the list gives trimmed and never empty. + pub fn rename(row: usize, text: impl Into) -> Self { + Self::Rename { row, text: text.into() } + } + + /// A click on `row`'s lock, `locked` after the click. + pub const fn lock(row: usize, locked: bool) -> Self { + Self::Lock { row, locked } + } + + /// New, duplicating `duplicate` when a row was dropped on it; `options` with Alt held. + pub const fn new_row(duplicate: Option, options: bool) -> Self { + Self::New { duplicate, options } + } +} + /// The list's result. #[derive(Debug)] #[must_use = "the app applies the list's events"]