pub struct FormSession {
pub focus: Option<FocusTarget>,
pub fields: BTreeMap<FieldId, FieldState>,
pub hover: Option<AnnotId>,
pub drag: Option<DragAnchor>,
pub dirty: BTreeSet<FieldId>,
pub formatted: BTreeMap<FieldId, String>,
pub config: SessionConfig,
pub border_styles: BTreeMap<FieldId, BorderStyle>,
}Expand description
One interaction session over one document.
Fields§
§focus: Option<FocusTarget>What has the keyboard, if anything.
fields: BTreeMap<FieldId, FieldState>Per-field interaction state, created when a field is first touched.
A field keeps its state across focus changes, which is why clicking away from a half-typed field and back finds the typing still there.
hover: Option<AnnotId>What the pointer is over, for enter and exit.
drag: Option<DragAnchor>A drag in progress, if one is.
dirty: BTreeSet<FieldId>Fields whose interaction state has outrun the document’s value.
formatted: BTreeMap<FieldId, String>What a /AA /F format script asked each field to show, which is not
what it stores.
CommitOutcome::display is a
formatting script’s whole output, and this is where it survives until
the next appearance is generated — a field with
AFNumber_Format(2, 0, 0, 0, "", true) otherwise regenerates (1234)
where it should draw (1,234.00).
Keyed by field rather than by widget, because regeneration gives
every control of the field the same string. Cleared when a field takes
focus: the editor is seeded from the stored value and never from the
formatted text, so a user who clicks into a currency field sees 1234
to edit, not 1,234.00.
config: SessionConfigThe switches.
border_styles: BTreeMap<FieldId, BorderStyle>Field.borderStyle writes a script made, keyed by field.
Spent into appearance generation rather than written into /BS: the
dictionary stays as the file left it, and a regenerated stream sees
the new style through pdfrum_doc::ap::widget::LiveInput.
Implementations§
Source§impl FormSession
impl FormSession
Sourcepub fn new() -> FormSession
pub fn new() -> FormSession
An empty session with the default switches.
Sourcepub fn with_config(config: SessionConfig) -> FormSession
pub fn with_config(config: SessionConfig) -> FormSession
An empty session with the given switches.
Sourcepub fn focused_field(&self) -> Option<FieldId>
pub fn focused_field(&self) -> Option<FieldId>
The field that currently has the keyboard, if a field does.
Sourcepub fn focused_state(&self) -> Option<&FieldState>
pub fn focused_state(&self) -> Option<&FieldState>
The interaction state of the focused field, if there is one.
Sourcepub fn focused_state_mut(&mut self) -> Option<&mut FieldState>
pub fn focused_state_mut(&mut self) -> Option<&mut FieldState>
The interaction state of the focused field, mutably.
Sourcepub fn is_accelerator(&self, modifiers: Modifiers) -> bool
pub fn is_accelerator(&self, modifiers: Modifiers) -> bool
Whether these modifiers make a gesture a shortcut in this session.
One predicate, shared with the key router rather than restated here: two spellings of the same question drift, and the oracle has only one.
Trait Implementations§
Source§impl Clone for FormSession
impl Clone for FormSession
Source§impl Debug for FormSession
impl Debug for FormSession
Auto Trait Implementations§
impl Freeze for FormSession
impl RefUnwindSafe for FormSession
impl Send for FormSession
impl Sync for FormSession
impl Unpin for FormSession
impl UnsafeUnpin for FormSession
impl UnwindSafe for FormSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.