mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-23 02:51:42 +01:00
Merge pull request #3087 from aiongg/dropdown-drives
Dropdowns name the list that takes their opener's keys (font picker Enter after typing)
This commit is contained in:
14 files changed
+140
-33
No files matched your search
@@ -389,7 +389,10 @@ pub(super) fn popup<'a>(picker: &mut FontPicker<'a>, ui: &mut OverlayUi<'_>, cx:
|
||||
let mut stars: Vec<(String, bool)> = Vec::new();
|
||||
let mut over_rows = false;
|
||||
let mut under_pointer: Option<SlotKey> = None;
|
||||
let events = ui.show(popup, Overlay::dropdown().dismiss(Dismiss::new().focus_left(true)), |ui, _| {
|
||||
// The field's list keys go to the family list, not to the class column beside it.
|
||||
let families = cx.id.with("families");
|
||||
let overlay = Overlay::dropdown().dismiss(Dismiss::new().focus_left(true)).list(families);
|
||||
let events = ui.show(popup, overlay, |ui, _| {
|
||||
let mut events = Vec::new();
|
||||
Stack::new().show(ui, |ui, _| {
|
||||
if let Some(text) = banner_text {
|
||||
@@ -434,6 +437,7 @@ pub(super) fn popup<'a>(picker: &mut FontPicker<'a>, ui: &mut OverlayUi<'_>, cx:
|
||||
let selection =
|
||||
current.filter(|_| query.trim().is_empty()).map_or_else(Selection::default, |at| Selection::single(slots[at].key()));
|
||||
let rows = List::<SlotKey>::options(name.clone())
|
||||
.id(families)
|
||||
.tree(true)
|
||||
.tree_leaves(leaves)
|
||||
.columns(columns.clone())
|
||||
|
||||
@@ -9,7 +9,7 @@ use craft_behavior::{PartKey, Preview};
|
||||
use craft_font_manager::craft_font_catalog::{Limits, Os, Source};
|
||||
use craft_font_manager::missing::MissingFontsWords;
|
||||
use craft_font_manager::picker::{
|
||||
FamilyInfos, FontFilters, FontPicker, FontPickerKind, FontPickerSettings, FontPickerWords, MissingAdvice, SIMILAR_COUNT, family_rows,
|
||||
FamilyInfos, FontClass, FontFilters, FontPicker, FontPickerKind, FontPickerSettings, FontPickerWords, MissingAdvice, SIMILAR_COUNT, family_rows,
|
||||
};
|
||||
use craft_font_manager::{Catalog, FontEnv};
|
||||
use craft_ui::buttons::ControlPlace;
|
||||
@@ -198,6 +198,75 @@ fn a_click_on_the_focused_closed_field_selects_the_name_so_typing_replaces_it()
|
||||
}
|
||||
}
|
||||
|
||||
/// A picker as the character controls host it: a given value, the filters (so the class column shows beside the
|
||||
/// families) and a preview text. The field's list keys go to the family list: Enter on a typed part of a name picks the
|
||||
/// best match, and Down moves the family row, which previews, before Enter picks it. While no family row shows, Enter is
|
||||
/// the field's: it commits a typed family name and leaves the class column as it was.
|
||||
#[trial]
|
||||
fn with_the_class_column_shown_the_field_keys_move_and_pick_in_the_family_list() {
|
||||
#[derive(Default)]
|
||||
struct Reported {
|
||||
picks: Vec<String>,
|
||||
previews: Vec<String>,
|
||||
}
|
||||
let reported = Rc::new(RefCell::new(Reported::default()));
|
||||
let seen = Rc::clone(&reported);
|
||||
let catalog = catalog_of(&[INTER_REGULAR, epaint_default_fonts::HACK_REGULAR, epaint_default_fonts::UBUNTU_LIGHT]);
|
||||
let mut settings = FontPickerSettings::default();
|
||||
let filters = Rc::new(RefCell::new(FontFilters::default()));
|
||||
let held = Rc::clone(&filters);
|
||||
let mut fx = Fixture::new(move |ui| {
|
||||
let mut filters = held.borrow_mut();
|
||||
let out = FontPicker::new("Font family", Bind::given("Ubuntu".to_owned()), &catalog)
|
||||
.settings(Bind::bound(&mut settings))
|
||||
.filters(Bind::bound(&mut *filters))
|
||||
.preview_text("Sample")
|
||||
.show(ui);
|
||||
let mut seen = seen.borrow_mut();
|
||||
if let Preview::Shows(family) = out.preview {
|
||||
seen.previews.push(family);
|
||||
}
|
||||
seen.picks.extend(out.picked);
|
||||
});
|
||||
fx.in_room(Room::Window);
|
||||
fx.settle();
|
||||
let words = FontPickerWords::default();
|
||||
let type_in = |fx: &mut Fixture, text: &str| {
|
||||
let field = fx.by_label("Font family").expect("the family field");
|
||||
fx.click(&field);
|
||||
fx.settle();
|
||||
fx.type_text(text);
|
||||
fx.settle();
|
||||
};
|
||||
|
||||
type_in(&mut fx, "Ha");
|
||||
assert!(present(&fx, words.all_classes.as_str()), "the class column shows");
|
||||
fx.key(Key::Enter, Modifiers::NONE);
|
||||
fx.settle();
|
||||
assert_eq!(reported.borrow().picks, ["Hack"], "Enter on a partial name picks the best match");
|
||||
|
||||
// "n" matches Inter and Ubuntu.
|
||||
type_in(&mut fx, "n");
|
||||
reported.borrow_mut().previews.clear();
|
||||
fx.key(Key::ArrowDown, Modifiers::NONE);
|
||||
fx.settle();
|
||||
let keyed = reported.borrow().previews.last().cloned().expect("Down moves the family row, which previews its family");
|
||||
assert!(["Inter", "Ubuntu"].contains(&keyed.as_str()), "the row is a family that matches: {keyed}");
|
||||
fx.key(Key::Enter, Modifiers::NONE);
|
||||
fx.settle();
|
||||
assert_eq!(reported.borrow().picks.last(), Some(&keyed), "Enter picks the family row the keys reached");
|
||||
|
||||
// The host's filters list monospaced families only, Hack alone, so the exact name "Inter" matches no row.
|
||||
filters.borrow_mut().class = Some(FontClass::Monospace);
|
||||
type_in(&mut fx, "Inter");
|
||||
assert!(present(&fx, words.all_classes.as_str()), "the class column shows");
|
||||
assert!(fx.by_label("Favorite Inter").is_none() && fx.by_label("Favorite Hack").is_none(), "no family row shows");
|
||||
fx.key(Key::Enter, Modifiers::NONE);
|
||||
fx.settle();
|
||||
assert_eq!(reported.borrow().picks.last().map(String::as_str), Some("Inter"), "the field commits the typed name");
|
||||
assert_eq!(filters.borrow().class, Some(FontClass::Monospace), "the class column is unchanged");
|
||||
}
|
||||
|
||||
/// A `Plain` picker over `family` with `recent` families, `actions` rows and the face `shown_as`.
|
||||
fn plain_rig(
|
||||
catalog: Arc<Catalog>,
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::runtime::windows::ResizeEdge;
|
||||
use craft_behavior::overlay::{Align, MinWidth, Side};
|
||||
use craft_behavior::{GesturePhase, OwnerClass};
|
||||
use egui::emath::TSTransform;
|
||||
use egui::{Align2, Pos2, Rect, Response, Vec2};
|
||||
use egui::{Align2, Id, Pos2, Rect, Response, Vec2};
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// What a press outside the layer and its anchor does.
|
||||
@@ -215,7 +215,8 @@ impl Overlay {
|
||||
}
|
||||
|
||||
/// A dropdown list: from its content, at least as wide as its anchor and capped, focus stays on the anchor. It
|
||||
/// closes when a row is activated or the focus leaves the anchor.
|
||||
/// closes when a row is activated or the focus leaves the anchor. The opener's list keys go to the collection
|
||||
/// [`Overlay::list`] names.
|
||||
pub fn dropdown() -> Overlay {
|
||||
let focus = FocusPolicy::POPUP.trap(false).restore(false).initial(Initial::KeepAnchor);
|
||||
let mut overlay = Overlay::base(Rank::Popup, Overlay::below(), OverlayFit::ContentCapped(DROPDOWN_SHARE), OwnerClass::PassivePopup, focus);
|
||||
@@ -451,6 +452,14 @@ impl Overlay {
|
||||
self
|
||||
}
|
||||
|
||||
/// The collection in a dropdown that takes its opener's list keys (`FocusPolicy::list`). A dropdown that holds a
|
||||
/// list names it each pass it is shown; the opener keeps the keys while the named list is not shown, and in a
|
||||
/// dropdown that names none.
|
||||
pub fn list(mut self, list: Id) -> Overlay {
|
||||
self.focus = self.focus.list(list);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the dismissal rules.
|
||||
pub fn dismiss(mut self, dismiss: Dismiss) -> Overlay {
|
||||
self.dismiss = dismiss;
|
||||
|
||||
@@ -53,6 +53,9 @@ pub struct FocusPolicy {
|
||||
/// In a `KeepAnchor` layer, Enter on a text opener activates the layer's list; off, the opener keeps Enter and
|
||||
/// Tab alone takes the list's lead (a completion list that leaves Enter to the field's own commit).
|
||||
pub list_enter: bool,
|
||||
/// In a `KeepAnchor` layer, the collection the opener hands its list keys to (Up, Down, Page keys, Home and End,
|
||||
/// Enter and Tab as the layer's rules say). Without one the opener keeps its keys.
|
||||
pub list: Option<Id>,
|
||||
}
|
||||
|
||||
impl FocusPolicy {
|
||||
@@ -66,6 +69,7 @@ impl FocusPolicy {
|
||||
cancel: CancelRule::Ignore,
|
||||
pages: false,
|
||||
list_enter: true,
|
||||
list: None,
|
||||
};
|
||||
/// A pane: an F6 stop.
|
||||
pub const PANE: FocusPolicy = FocusPolicy { kind: ScopeKind::Pane, ..FocusPolicy::NONE };
|
||||
@@ -79,6 +83,7 @@ impl FocusPolicy {
|
||||
cancel: CancelRule::Close,
|
||||
pages: false,
|
||||
list_enter: true,
|
||||
list: None,
|
||||
};
|
||||
/// A popup: focus moves in, Escape closes and focus returns to the opener.
|
||||
pub const POPUP: FocusPolicy = FocusPolicy {
|
||||
@@ -90,6 +95,7 @@ impl FocusPolicy {
|
||||
cancel: CancelRule::Close,
|
||||
pages: false,
|
||||
list_enter: true,
|
||||
list: None,
|
||||
};
|
||||
/// A menu: like a popup.
|
||||
pub const MENU: FocusPolicy = FocusPolicy { kind: ScopeKind::Menu, ..FocusPolicy::POPUP };
|
||||
@@ -127,6 +133,12 @@ impl FocusPolicy {
|
||||
self
|
||||
}
|
||||
|
||||
/// The collection in the layer that takes the opener's list keys.
|
||||
pub const fn list(mut self, list: Id) -> Self {
|
||||
self.list = Some(list);
|
||||
self
|
||||
}
|
||||
|
||||
/// Whether Ctrl+Tab cycles pages.
|
||||
pub const fn pages(mut self, on: bool) -> Self {
|
||||
self.pages = on;
|
||||
|
||||
@@ -180,27 +180,18 @@ impl Group {
|
||||
}
|
||||
}
|
||||
|
||||
/// The innermost open `KeepAnchor` layer opened from the stop `opener`, the collection its opener hands list keys
|
||||
/// to (the stop with the collection's key role that is registered inside the layer's focus scope) and the layer's
|
||||
/// policy. `None` while no such layer is open or it has no collection.
|
||||
/// The innermost open `KeepAnchor` layer opened from the stop `opener`, the collection the layer names for its
|
||||
/// opener's list keys (`FocusPolicy::list`) and the layer's policy. `None` while no such layer is open, or it names no
|
||||
/// collection or one that registered no stop in the last pass (a list not shown leaves the keys with the opener).
|
||||
pub(crate) fn dropdown_target(ctx: &Context, opener: StopKey) -> Option<(Id, Id, FocusPolicy)> {
|
||||
with(ctx, |state| {
|
||||
let layer =
|
||||
*state.last_scope_order.iter().rev().find(|id| {
|
||||
state.last_scopes.get(*id).is_some_and(|scope| scope.policy.initial == Initial::KeepAnchor && scope.opener == Some(opener))
|
||||
})?;
|
||||
let inside = |rec: &super::StopRec| {
|
||||
let mut at = rec.scope;
|
||||
while let Some(scope) = at {
|
||||
if scope == layer {
|
||||
return true;
|
||||
}
|
||||
at = state.last_scopes.get(&scope).and_then(|record| record.parent);
|
||||
}
|
||||
false
|
||||
};
|
||||
let policy = state.last_scopes.get(&layer)?.policy;
|
||||
state.last_stops.iter().find(|rec| rec.stop.role.type_ahead && inside(rec)).map(|rec| (layer, rec.stop.id, policy))
|
||||
let shown = |list: &Id| state.last_stops.iter().any(|rec| rec.stop.id == *list);
|
||||
policy.list.filter(shown).map(|list| (layer, list, policy))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ impl<'a> CommandPalette<'a> {
|
||||
let session = inner.memory::<Session>();
|
||||
let field =
|
||||
TextField::search(label.clone(), Bind::bound(&mut session.query)).placeholder(face_hint.clone()).id(field_id).show(ui).response;
|
||||
let popup = PopupList::new(label.clone(), open.reborrowed()).opened_by(&field).show(ui, |ui, popup| {
|
||||
let popup = PopupList::new(label.clone(), open.reborrowed()).opened_by(&field).list(list_id).show(ui, |ui, popup| {
|
||||
let recent = recent_of(&mut recents, popup);
|
||||
let input = RowsInput {
|
||||
ctx: &ctx,
|
||||
|
||||
@@ -263,9 +263,11 @@ impl Component for ComboBox<'_> {
|
||||
let rows = EntryRows::new(options, &labels);
|
||||
let mut over_rows = false;
|
||||
let mut under_pointer: Option<usize> = None;
|
||||
let events = ui.show(popup, Overlay::dropdown(), |ui, _| {
|
||||
let list = cx.id.with("options");
|
||||
let events = ui.show(popup, Overlay::dropdown().list(list), |ui, _| {
|
||||
let selection = current.filter(|_| query.trim().is_empty()).map_or_else(Selection::default, Selection::single);
|
||||
let shown = List::<usize>::options(name.clone())
|
||||
.id(list)
|
||||
.selection(Bind::given(selection))
|
||||
.filter(&query, |key| labels[*key].clone())
|
||||
.ranked(true)
|
||||
|
||||
@@ -315,8 +315,8 @@ impl<T: Value + 'static> Component for Select<'_, T> {
|
||||
let held = self.position(cx.value());
|
||||
let (searchable, dress, picture) = (self.searchable, self.decorate.as_ref(), self.picture.as_ref());
|
||||
let mut header_menu = self.header_menu.as_mut();
|
||||
let events = ui.show(popup, Overlay::dropdown(), |ui, body| {
|
||||
let list = ui.scope_id().with("options");
|
||||
let list = cx.id.with("options");
|
||||
let events = ui.show(popup, Overlay::dropdown().list(list), |ui, body| {
|
||||
let mut query = String::new();
|
||||
if searchable || header_menu.is_some() {
|
||||
let _ = Row::new().show(ui, |ui, _| {
|
||||
|
||||
@@ -357,10 +357,10 @@ impl<K: Value + Eq + Hash + 'static> Component for TreePicker<'_, K> {
|
||||
}
|
||||
};
|
||||
// Folders open and close inside the popup, so activating one must not close it: a pick closes it below.
|
||||
let overlay = Overlay::dropdown().dismiss(Dismiss::new());
|
||||
let list_id = cx.id.with("tree");
|
||||
let overlay = Overlay::dropdown().dismiss(Dismiss::new()).list(list_id);
|
||||
let events = ui.show(popup, overlay, |ui, body| {
|
||||
let fresh = Popup::opening(popup, cx);
|
||||
let list_id = ui.scope_id().with("tree");
|
||||
let query = search::show(ui, body, popup, cx, &name, list_id);
|
||||
if fresh {
|
||||
cx.memory::<Browsing<K>>().open = tree.opened_for(chosen.as_ref());
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::runtime::env::Label;
|
||||
use crate::runtime::overlay::CloseReason;
|
||||
use crate::style::{ComponentStyle, StyleCx, SurfaceKind};
|
||||
use craft_behavior::{Metrics, Sense};
|
||||
use egui::Response;
|
||||
use egui::{Id, Response};
|
||||
|
||||
#[cfg(feature = "suite")]
|
||||
pub(crate) mod stories;
|
||||
@@ -23,7 +23,8 @@ pub struct PopupListStyle {
|
||||
///
|
||||
/// - The popup is at least as wide as its opener and capped to a share of the viewport.
|
||||
/// - The opener keeps the keyboard focus. While the popup is open the host hands the opener's list keys (Up, Down,
|
||||
/// Page, Home, End, Enter and type-ahead on an opener that is not a text field) to the list.
|
||||
/// Page, Home, End, Enter and type-ahead on an opener that is not a text field) to the list named with
|
||||
/// [`PopupList::list`].
|
||||
/// - Activating a row closes the popup with `CloseReason::Activated`; Escape and a press outside close it too.
|
||||
/// - Open state: the caller's binding. The output's `closed` says why it closed in this pass.
|
||||
/// - The popup is a group; the caller's `List::options` is the listbox inside it.
|
||||
@@ -57,6 +58,17 @@ impl<'a> PopupList<'a> {
|
||||
self.props = self.props.mount(Mount::Layer(overlay.opened_by(opener, Trigger::Manual)));
|
||||
self
|
||||
}
|
||||
|
||||
/// The caller's `List`, by the id it is shown with: it takes the opener's list keys while the popup is open.
|
||||
#[must_use]
|
||||
pub fn list(mut self, list: Id) -> Self {
|
||||
let overlay = match std::mem::take(&mut self.props.mount) {
|
||||
Mount::Layer(overlay) => overlay,
|
||||
_ => Overlay::dropdown(),
|
||||
};
|
||||
self.props = self.props.mount(Mount::Layer(overlay.list(list)));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for PopupList<'_> {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use super::PopupList;
|
||||
use crate::buttons::Button;
|
||||
use crate::contract::{Show as _, ShowCollection as _, ShowContainer as _};
|
||||
use crate::contract::{Props as _, Show as _, ShowCollection as _, ShowContainer as _};
|
||||
use crate::layout_components::Stack;
|
||||
use crate::list::{List, ListRow};
|
||||
use crate::testing::{Drive, StoryData, StoryOutput, story};
|
||||
@@ -38,10 +38,12 @@ fn popup_list(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let names = ["Round", "Square", "Chisel", "Fan"];
|
||||
let shown = Stack::new().fill().show(ui, |ui, _| {
|
||||
let opener = Button::new("Brush tip").show(ui);
|
||||
let list = opener.id.with("tips");
|
||||
PopupList::new("Brush tips", data.bind("open", true))
|
||||
.opened_by(&opener)
|
||||
.list(list)
|
||||
.show(ui, |ui, _| {
|
||||
List::<usize>::options("Brush tips").show_items(ui, &Names(&names), &mut |key, _| ListRow::new(names[*key]).option());
|
||||
List::<usize>::options("Brush tips").id(list).show_items(ui, &Names(&names), &mut |key, _| ListRow::new(names[*key]).option());
|
||||
})
|
||||
.output
|
||||
.response
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! on a row hands the pick back to the adapter, which accepts it in its next run.
|
||||
|
||||
use crate::contract::{
|
||||
CollectionEvent, Component, Cx, Overlay, OverlayUi, Overlays as _, Show as _, ShowCollection as _, WordSetCx as _, lead_position,
|
||||
CollectionEvent, Component, Cx, Overlay, OverlayUi, Overlays as _, Props as _, Show as _, ShowCollection as _, WordSetCx as _, lead_position,
|
||||
};
|
||||
use crate::display::{Divider, Text};
|
||||
use crate::list::{List, ListRow};
|
||||
@@ -59,10 +59,11 @@ pub(crate) fn show<C: Component, V: 'static>(ui: &mut OverlayUi<'_>, cx: &mut Cx
|
||||
labels.iter().for_each(|label| label.as_str().hash(&mut hasher));
|
||||
hasher.finish()
|
||||
};
|
||||
let focus = Overlay::dropdown().focus.list_enter(enter);
|
||||
let list_id = cx.id.with("completions");
|
||||
let focus = Overlay::dropdown().focus.list_enter(enter).list(list_id);
|
||||
let overlay = Overlay::dropdown().focus(focus);
|
||||
let events = ui.show(popup, overlay, |ui, _| {
|
||||
let list = List::options(name.clone()).rows_stamp(stamp).show_items(ui, &Candidates { labels: &labels }, &mut |at, _| {
|
||||
let list = List::options(name.clone()).id(list_id).rows_stamp(stamp).show_items(ui, &Candidates { labels: &labels }, &mut |at, _| {
|
||||
let row = ListRow::new(labels[*at].clone()).option().role(TypeRole::Mono).lead_role(TypeRole::Mono);
|
||||
match (&marks[*at], &widest) {
|
||||
(Some(mark), Some(widest)) => row.lead_text(mark.clone(), widest.clone()),
|
||||
|
||||
@@ -26,10 +26,12 @@ impl<'a, V: NumberValue + 'static> NumberField<'a, V> {
|
||||
};
|
||||
let marked = (0..rows.len()).find(|at| held(*at));
|
||||
let name = cx.label();
|
||||
let events = ui.show(popup, Overlay::dropdown(), |ui, _| {
|
||||
let list = cx.id.with("presets");
|
||||
let events = ui.show(popup, Overlay::dropdown().list(list), |ui, _| {
|
||||
let selection = marked.map_or_else(Selection::default, |at| Selection::new(vec![at], Some(at), Some(at)));
|
||||
let source = Presets { rows, labels: &labels };
|
||||
List::<usize>::options(name.clone())
|
||||
.id(list)
|
||||
.selection(Bind::given(selection))
|
||||
.show_items(ui, &source, &mut |at, _| {
|
||||
if rows[*at].is_separator() {
|
||||
|
||||
@@ -2389,6 +2389,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub fn moves_window(mut self, on: bool) -> Overlay`. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
|
||||
- `pub fn moved_by_app(mut self) -> Overlay`. The app moves the OS window from the move band ([`Overlay::moved_by_app`]).
|
||||
- `pub fn focus(mut self, focus: FocusPolicy) -> Overlay`. Sets the focus scope.
|
||||
- `pub fn list(mut self, list: Id) -> Overlay`. The collection in a dropdown that takes its opener's list keys (`FocusPolicy::list`). A dropdown that holds a
|
||||
- `pub fn dismiss(mut self, dismiss: Dismiss) -> Overlay`. Sets the dismissal rules.
|
||||
- `pub fn motion(mut self, motion: MotionSpec) -> Overlay`. Sets the open and close motion.
|
||||
- `pub fn opened_by(mut self, anchor: &Response, trigger: Trigger) -> Overlay`. Records an opener. An anchored layer hangs from the rect of the opener that opened it, on the side and
|
||||
@@ -2702,6 +2703,7 @@ Chapter 15: the `Overlay` data, its presets, popup handles, `OverlayUi` and the
|
||||
- `pub fn moves_window(mut self, on: bool) -> Overlay`. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
|
||||
- `pub fn moved_by_app(mut self) -> Overlay`. The app moves the OS window from the move band ([`Overlay::moved_by_app`]).
|
||||
- `pub fn focus(mut self, focus: FocusPolicy) -> Overlay`. Sets the focus scope.
|
||||
- `pub fn list(mut self, list: Id) -> Overlay`. The collection in a dropdown that takes its opener's list keys (`FocusPolicy::list`). A dropdown that holds a
|
||||
- `pub fn dismiss(mut self, dismiss: Dismiss) -> Overlay`. Sets the dismissal rules.
|
||||
- `pub fn motion(mut self, motion: MotionSpec) -> Overlay`. Sets the open and close motion.
|
||||
- `pub fn opened_by(mut self, anchor: &Response, trigger: Trigger) -> Overlay`. Records an opener. An anchored layer hangs from the rect of the opener that opened it, on the side and
|
||||
@@ -3889,7 +3891,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu
|
||||
- `pub const fn contains(self, command: EditCommand) -> bool`. Whether the set has `command`.
|
||||
- `craft_ui::runtime::focus::EndKey`: `pub enum EndKey { LastItem, EndMode }`. What a bare End means for a focused component.
|
||||
- `craft_ui::runtime::focus::EnterRule`: `pub enum EnterRule { Pass, Submit }`. What Enter does in a scope after the focused component declined it.
|
||||
- `craft_ui::runtime::focus::FocusPolicy`: `pub struct FocusPolicy { pub kind: ScopeKind, pub trap: bool, pub restore: bool, pub initial: Initial, pub enter: EnterRule, pub cancel: CancelRule, pub pages: bool, pub list_enter: bool }`. A focus scope's rules.
|
||||
- `craft_ui::runtime::focus::FocusPolicy`: `pub struct FocusPolicy { pub kind: ScopeKind, pub trap: bool, pub restore: bool, pub initial: Initial, pub enter: EnterRule, pub cancel: CancelRule, pub pages: bool, pub list_enter: bool, pub list: Option<Id> }`. A focus scope's rules.
|
||||
- `pub const NONE: FocusPolicy`. A scope that changes nothing.
|
||||
- `pub const PANE: FocusPolicy`. A pane: an F6 stop.
|
||||
- `pub const DIALOG: FocusPolicy`. A dialog: Tab stays inside, Enter submits, Escape closes.
|
||||
@@ -3901,6 +3903,7 @@ The focus service: stops, scopes and roving groups registered per pass, the focu
|
||||
- `pub const fn initial(mut self, initial: Initial) -> Self`. Where focus goes first.
|
||||
- `pub const fn cancel(mut self, cancel: CancelRule) -> Self`. What Escape does.
|
||||
- `pub const fn list_enter(mut self, on: bool) -> Self`. Whether Enter on a text opener activates the layer's list.
|
||||
- `pub const fn list(mut self, list: Id) -> Self`. The collection in the layer that takes the opener's list keys.
|
||||
- `pub const fn pages(mut self, on: bool) -> Self`. Whether Ctrl+Tab cycles pages.
|
||||
- `craft_ui::runtime::focus::FocusTarget`: `pub enum FocusTarget { Id(Id), Part(Id, PartRef), Doc(DocKey) }`. What `runtime::focus::request` focuses.
|
||||
- `craft_ui::runtime::focus::Initial`: `pub enum Initial { Keep, First, FirstField, Default, Key(&'static str), KeepAnchor }`. Where focus goes the first time a scope is pushed.
|
||||
|
||||
Reference in new issue
Block a user