mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
Contract stubs: stage 9 mop-up
This commit is contained in:
@@ -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<Shape = shape::Items> {
|
||||
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<Pos2>) -> Option<Pos2> {
|
||||
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.
|
||||
|
||||
@@ -183,6 +183,7 @@ pub enum FirePhase {
|
||||
pub struct CommandState {
|
||||
flags: CommandFlags,
|
||||
title: Option<Arc<str>>,
|
||||
icon: Option<Cow<'static, str>>,
|
||||
hint: Option<Arc<str>>,
|
||||
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<Cow<'static, str>>) -> Self {
|
||||
let _ = icon;
|
||||
todo!("CM-C31")
|
||||
}
|
||||
|
||||
/// The accessible description and second tooltip line.
|
||||
#[must_use]
|
||||
pub fn hint(mut self, hint: impl Into<Arc<str>>) -> 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<str>> {
|
||||
self.hint.as_ref()
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<String>) -> Self {
|
||||
|
||||
@@ -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<PathBuf>, name: impl Into<String>) -> 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<String>,
|
||||
}
|
||||
|
||||
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<PathBuf>, name: impl Into<String>) -> 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<String>) -> Self {
|
||||
let _ = note;
|
||||
todo!("L-165")
|
||||
}
|
||||
}
|
||||
|
||||
/// What a start screen pass reports.
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
|
||||
@@ -822,6 +822,11 @@ impl<K: Clone + Eq + Hash + Send + Sync + 'static> Collection for TileGrid<'_, K
|
||||
self.zooms
|
||||
}
|
||||
|
||||
fn zoom_anchor(&self, wheel: Option<Pos2>) -> Option<Pos2> {
|
||||
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<K>, _: &crate::runtime::env::Env) -> Option<Box<dyn ItemSource<K> + 's>> {
|
||||
|
||||
Reference in New Issue
Block a user