mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 02:09:00 +00:00
SelectMode, GroupHeads, PresetRowMenu and Selection are memo props, for the presets browser's memoized view
This commit is contained in:
@@ -11,7 +11,7 @@ use std::any::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// What a collection lets the user select.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, crate::contract::MemoProps)]
|
||||
#[non_exhaustive]
|
||||
pub enum SelectMode {
|
||||
/// Nothing; the lead still moves.
|
||||
|
||||
@@ -843,6 +843,16 @@ impl<T: MemoProps> MemoProps for craft_behavior::Mixed<T> {
|
||||
}
|
||||
|
||||
/// The translator (`Words::generation`): words with the same generation read every word the same.
|
||||
/// Every field (`#[non_exhaustive]`, so a field added later is listed here by hand): the selected keys, the lead and
|
||||
/// the anchor.
|
||||
impl<K: MemoProps> MemoProps for craft_behavior::Selection<K> {
|
||||
fn key(&self, key: &mut MemoKey) {
|
||||
self.items.key(key);
|
||||
self.lead.key(key);
|
||||
self.anchor.key(key);
|
||||
}
|
||||
}
|
||||
|
||||
impl MemoProps for craft_i18n::Words {
|
||||
fn key(&self, key: &mut MemoKey) {
|
||||
self.generation().key(key);
|
||||
|
||||
@@ -144,7 +144,7 @@ pub struct PresetRow<K> {
|
||||
}
|
||||
|
||||
/// What the row menu of a browser or picker shows.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, crate::contract::MemoProps)]
|
||||
#[non_exhaustive]
|
||||
pub enum PresetRowMenu {
|
||||
/// Rename, Move to, Delete, a divider, then the host's `row_items`.
|
||||
|
||||
@@ -289,7 +289,7 @@ pub struct TileGrid<'a, K: Clone + Eq + Hash + Send + Sync + 'static> {
|
||||
}
|
||||
|
||||
/// How the groups of a grid or a list are set apart.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::contract::MemoProps)]
|
||||
#[non_exhaustive]
|
||||
pub enum GroupHeads {
|
||||
/// Every group has its titled head.
|
||||
|
||||
Reference in New Issue
Block a user