diff --git a/crates/ui-contract/src/contract/mod.rs b/crates/ui-contract/src/contract/mod.rs index 89bd54bb0..8c2f12687 100644 --- a/crates/ui-contract/src/contract/mod.rs +++ b/crates/ui-contract/src/contract/mod.rs @@ -107,7 +107,7 @@ use crate::runtime::overlay::CloseReason; use crate::style::{ComponentStyle, Flags, StyleCx, StyleKey}; pub use craft_behavior::Input; use craft_behavior::{CellSpace, ItemLayout, ItemSource, Proposal, ScrollPos, SelectionModel, Sense}; -use egui::{Id, IdSalt, Rect, Ui, Vec2}; +use egui::{Id, IdSalt, Pos2, Rect, Ui, Vec2}; use run::ShowAt; use std::hash::Hash; use std::ops::Deref; @@ -691,6 +691,13 @@ pub trait Collection: Component + HasProps + Meta { false } + /// The point the collection keeps fixed while a zoom reflows it: `wheel`, the point of this pass's zoom event, or + /// the pointer a zoom chord was taken at. `None` by default, and for a collection that does not zoom. + fn zoom_anchor(&self, wheel: Option) -> Option { + let _ = wheel; + None + } + /// The height of the empty state at `width`: a `Sizing::Content` collection with no rows is this tall. The /// default is the height of `CollectionProps::empty` laid out at `width`; an override replaces the empty text, so /// it replaces `empty` as well. diff --git a/crates/ui-contract/src/runtime/commands/mod.rs b/crates/ui-contract/src/runtime/commands/mod.rs index b6ce45e54..dd422ceb5 100644 --- a/crates/ui-contract/src/runtime/commands/mod.rs +++ b/crates/ui-contract/src/runtime/commands/mod.rs @@ -183,6 +183,7 @@ pub enum FirePhase { pub struct CommandState { flags: CommandFlags, title: Option>, + icon: Option>, hint: Option>, marked: bool, } @@ -222,6 +223,14 @@ impl CommandState { self } + /// An icon for this frame in place of the command's own, by catalogue name or registered app set name. + #[allow(dead_code)] // P3(pdf-chrome-w1): CM-C31 + #[must_use] + pub fn icon(self, icon: impl Into>) -> Self { + let _ = icon; + todo!("CM-C31") + } + /// The accessible description and second tooltip line. #[must_use] pub fn hint(mut self, hint: impl Into>) -> Self { @@ -246,6 +255,11 @@ impl CommandState { self.title.as_ref() } + #[allow(dead_code)] // P3(pdf-chrome-w1): CM-C31 + pub(crate) fn icon_ref(&self) -> Option<&Cow<'static, str>> { + self.icon.as_ref() + } + pub(crate) fn hint_ref(&self) -> Option<&Arc> { self.hint.as_ref() } diff --git a/crates/ui-panels/src/sections/footer.rs b/crates/ui-panels/src/sections/footer.rs index 0272497f7..517dbe2a4 100644 --- a/crates/ui-panels/src/sections/footer.rs +++ b/crates/ui-panels/src/sections/footer.rs @@ -627,7 +627,7 @@ impl FooterBar { // Initial focus lands on the first enabled Accept button on every OS. let default_at = buttons.iter().position(|button| button.role == DialogRole::Accept && button.enabled); let least = if column { LeastWidth::DialogSideButton } else { LeastWidth::DialogButton }; - let mut place = |ui: &mut Ui, shown: &mut Shown| { + let place = |ui: &mut Ui, shown: &mut Shown| { for at in display_order(&roles, crate::runtime::windows::os_of(ui.ctx()) == Os::Windows, column) { let button = &buttons[at]; let variant = match button.role { diff --git a/crates/ui-shell/src/shell/recent.rs b/crates/ui-shell/src/shell/recent.rs index 0d831bb3e..f36334fa7 100644 --- a/crates/ui-shell/src/shell/recent.rs +++ b/crates/ui-shell/src/shell/recent.rs @@ -37,6 +37,22 @@ impl RecentFile { RecentFile { path: path.into(), name: name.into(), opened: None, created: None, note: None } } + /// This file last opened at `opened`, in seconds since the Unix epoch. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn opened(self, opened: i64) -> Self { + let _ = opened; + todo!("L-165") + } + + /// This file created at `created`, in seconds since the Unix epoch. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn created(self, created: i64) -> Self { + let _ = created; + todo!("L-165") + } + /// This file with a second line, `note`, under its name. #[must_use] pub fn note(self, note: impl Into) -> Self { diff --git a/crates/ui-shell/src/shell/start.rs b/crates/ui-shell/src/shell/start.rs index f65b9a9b3..5e416b781 100644 --- a/crates/ui-shell/src/shell/start.rs +++ b/crates/ui-shell/src/shell/start.rs @@ -141,6 +141,39 @@ pub struct PinnedFolder { pub expanded: bool, } +impl PinnedFolder { + /// A pinned folder at `path` shown as `name`, not yet listed, unfolded and not expanded. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + pub fn new(path: impl Into, name: impl Into) -> Self { + let _ = (path, name); + todo!("L-165") + } + + /// This folder with its files, `listing`, as the app found them. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn listing(self, listing: FolderListing) -> Self { + let _ = listing; + todo!("L-165") + } + + /// This folder shown folded (no files) or not. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn folded(self, folded: bool) -> Self { + let _ = folded; + todo!("L-165") + } + + /// This folder listing all of its files, or only the first [`PINNED_FILES_SHOWN`]. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn expanded(self, expanded: bool) -> Self { + let _ = expanded; + todo!("L-165") + } +} + /// What the app knows of a pinned folder's files. #[derive(Clone, Debug, PartialEq)] #[non_exhaustive] @@ -170,6 +203,23 @@ pub struct PinnedFile { pub note: Option, } +impl PinnedFile { + /// A file at `path` shown as `name`, with no second line. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + pub fn new(path: impl Into, name: impl Into) -> Self { + let _ = (path, name); + todo!("L-165") + } + + /// This file with a second line, `note`, under its name. + #[allow(dead_code)] // P3(pdf-chrome-w2): L-165 + #[must_use] + pub fn note(self, note: impl Into) -> Self { + let _ = note; + todo!("L-165") + } +} + /// What a start screen pass reports. #[derive(Debug)] #[non_exhaustive] diff --git a/crates/ui-widgets/src/tile_grid/grid.rs b/crates/ui-widgets/src/tile_grid/grid.rs index eba93e49c..d06c2abb3 100644 --- a/crates/ui-widgets/src/tile_grid/grid.rs +++ b/crates/ui-widgets/src/tile_grid/grid.rs @@ -822,6 +822,11 @@ impl Collection for TileGrid<'_, K self.zooms } + fn zoom_anchor(&self, wheel: Option) -> Option { + let _ = wheel; + todo!("WF-W12") + } + /// The tiles with a header row before each group, then the tail rows: the rows the item step walks and the layout /// places. fn filtered<'s>(&self, source: &'s dyn ItemSource, _: &crate::runtime::env::Env) -> Option + 's>> {