pub struct InputLine {Show 13 fields
pub state: ViewState,
pub data: String,
pub max_len: i32,
pub max_width: i32,
pub max_chars: i32,
pub cur_pos: i32,
pub first_pos: i32,
pub sel_start: i32,
pub sel_end: i32,
pub validator: Option<Box<dyn Validator>>,
pub select_all_on_focus: bool,
pub mask: Option<char>,
pub reveal: bool,
/* private fields */
}Expand description
A single-line text-entry field with selection, horizontal scrolling, an
optional Validator, and the typed value/
set_value data protocol.
§Coordinate model — byte offsets vs. display columns
data is a Rust String. The cursor/selection offsets
cur_pos / sel_start /
sel_end / anchor are byte
offsets into it. Slicing a String at a non-char boundary panics, so
every step over data goes through text::next / text::prev (whole
grapheme clusters) — never +1/-1. prev_word/next_word scan ASCII
spaces, whose byte offsets are always char boundaries.
first_pos, by contrast, is a display column
(the horizontal scroll offset). The displayed position of an offset is the
display width of data[..pos]. For ASCII, byte == column, but for multi-byte
/ wide content they diverge, so the two units are kept strictly distinct here.
§Clipboard and command enabling
Cut/copy write to the clipboard via Context; paste is requested through
the context and the pump reads the backend clipboard and inserts into the
field, clamped to max_len and replacing any selection. The field keeps
cmCut/cmCopy enabled while there is a selection and cmPaste enabled
while it is active and selected, pushing those enable/disable updates as
selection and focus change.
§Validation
A Validator gates the contents. Validators may also carry typed,
non-text values: value/set_value
consult the validator’s transfer_get /
transfer_set hook before falling back to the
text itself, so a range validator round-trips an integer rather than a string.
Validation runs on focus loss and returns a plain boolean. Deciding validity
is a read-only query (valid(&self)); a field that fails validation is not
automatically re-focused, since moving focus would require mutable access to
the event loop.
§Turbo Vision heritage
Ports TInputLine (tinputli.cpp/dialogs.h). Inheritance becomes the
View trait plus ViewState composition (D2); the byte/width/char limit
constants become the LimitMode enum (D1); the get/set/size data hooks
become the typed value/set_value
protocol over FieldValue (D10); and the explicit byte-offset vs.
display-column split is the two-unit coordinate model (D13).
Fields§
§state: ViewStateView state (geometry, flags, cursor) — the composition target.
data: StringThe UTF-8 text currently in the field.
Direct reads are fine; to replace the whole content programmatically,
prefer View::set_value so the cursor and scroll position are
updated consistently. Slicing this string at a non-char boundary
panics, so all internal traversals go through text::next /
text::prev rather than raw byte arithmetic.
max_len: i32Hard cap on data.len() in bytes.
Set at construction time by the limit argument when LimitMode::MaxBytes
is active (max_len = limit - 1); otherwise fixed at 255. Insertions
that would push data.len() past this value are silently dropped.
See also max_width and
max_chars for the display-width and
grapheme-count caps that the other two limit modes control.
max_width: i32Hard cap on the display width of data (in terminal columns).
Active only when the field is constructed with LimitMode::MaxWidth,
in which case max_width = limit and max_len is fixed at 255.
Defaults to i32::MAX (effectively unbounded) for the other two modes.
Wide characters such as CJK ideographs count as 2 columns each.
max_chars: i32Hard cap on the grapheme count of data.
Active only when the field is constructed with LimitMode::MaxChars,
in which case max_chars = limit and max_len is fixed at 255.
Defaults to i32::MAX (effectively unbounded) for the other two modes.
A grapheme cluster (e.g. a base letter plus combining diacritic) counts
as one regardless of its byte or column size.
cur_pos: i32Cursor position, a byte offset into data.
Direct writes are supported — see cursor_request
for how this feeds the screen cursor. Direct writes do not scroll
the caret into view, though — use set_cursor_pos
for that.
first_pos: i32Horizontal scroll offset, a display column (see the InputLine
docs: NOT a byte offset).
Direct writes are supported — see cursor_request
for how this feeds the screen cursor. Direct writes do not scroll
the caret into view, though — use set_cursor_pos
for that.
sel_start: i32Selection start, a byte offset into data.
Direct writes are supported and take effect immediately — nothing is
cached. Note this does not move cur_pos or scroll the field; pair
with a cur_pos write if the caret should track the selection.
sel_end: i32Selection end, a byte offset into data.
Direct writes are supported and take effect immediately — nothing is
cached. Note this does not move cur_pos or scroll the field; pair
with a cur_pos write if the caret should track the selection.
validator: Option<Box<dyn Validator>>The optional input validator, or None when the field is unconstrained.
A Validator can filter individual keystrokes (is_valid_input),
check the whole value on focus loss (validate), and carry typed
non-text values via the transfer_get/transfer_set hooks so that
View::value/View::set_value round-trip an integer rather than a
string.
You can read the validator (e.g. to call is_status_ok), but to
swap it out after construction use set_validator
rather than assigning to this field directly — that keeps the
ownership contract explicit.
select_all_on_focus: boolWhether the field selects its whole content when it gains focus.
true (the default) matches Turbo Vision’s TInputLine, where becoming
selected selects all so the first keystroke replaces the value. Set it
false (via set_select_all_on_focus)
to suppress that select-all on focus gain — the caret and any existing
selection are left untouched and typing inserts rather than replacing.
Focus loss still clears the selection either way. Useful for
pre-filled or derived fields where select-all-then-type is surprising.
mask: Option<char>Echo character painted in place of the real text when set. None = plain
field. data/value() always hold the real text; masking is draw-only.
Assumes width-1 graphemes (passwords): one echo char per char.
reveal: boolTransient: when true, the real text is painted despite mask (reveal).
Implementations§
Source§impl InputLine
impl InputLine
Sourcepub const READ_ONLY_REJECTED: Command
pub const READ_ONLY_REJECTED: Command
Broadcast when a read-only field refuses a change, carrying the field’s
own ViewId as the broadcast source so the owner can
tell which field was refused and explain it in its own words.
A broadcast rather than a flag the owner polls: the deferred clipboard
paste is applied outside any keystroke the owner could poll around, and
the source id spares the owner any bookkeeping to map a refusal back to a
field. See set_read_only.
Sourcepub fn new(
bounds: Rect,
limit: i32,
validator: Option<Box<dyn Validator>>,
limit_mode: LimitMode,
) -> Self
pub fn new( bounds: Rect, limit: i32, validator: Option<Box<dyn Validator>>, limit_mode: LimitMode, ) -> Self
Build a field from bounds, a limit, an optional validator, and a
LimitMode that decides what limit counts.
The three internal caps are derived from the mode: max_len (byte cap)
is limit - 1 clamped to a non-negative range when the mode is byte-based,
else 255; max_width is limit only in width mode, else unbounded;
max_chars is limit only in char mode, else unbounded. The field is
selectable, takes focus on first click, shows a cursor, and starts empty.
Pass None for validator to create an unconstrained field. To attach
or replace the validator after construction, use
set_validator. For the common case of a
byte-limited field with no validator, prefer with_limit.
§Note: headless / unit-test use outside a Program
When constructing an InputLine outside a Program (e.g. in a unit test
with a hand-built crate::view::Context), the field will silently ignore
all key events unless state.state.selected is set to true before
driving it — the same condition a group sets when it focuses a child.
All the fields involved are pub, so the workaround is straightforward:
let mut il = InputLine::with_limit(Rect::new(0, 0, 20, 1), 64);
il.state.state.selected = true; // required to receive key events in tests
il.handle_event(&mut Event::Key(/* … */), &mut ctx);Sourcepub fn with_limit(bounds: Rect, limit: i32) -> Self
pub fn with_limit(bounds: Rect, limit: i32) -> Self
Convenience constructor with no validator and the default byte-limit mode.
Sourcepub fn set_validator(&mut self, validator: Option<Box<dyn Validator>>)
pub fn set_validator(&mut self, validator: Option<Box<dyn Validator>>)
Replace this field’s validator after construction.
Pass Some(validator) to attach a Validator
that filters keystrokes and checks the field on focus-change/close, or
None to remove any constraint. The previous validator (if any) is dropped.
Most fields set their validator once via InputLine::new; use this when
the constraint is only known later (e.g. it depends on another control’s
value gathered at dialog-open time).
§Turbo Vision heritage
Mirrors TInputLine::setValidator, which disposed the old validator and
assigned the new one.
Sourcepub fn set_select_all_on_focus(&mut self, enable: bool)
pub fn set_select_all_on_focus(&mut self, enable: bool)
Enable or disable select-all on focus gain (default enabled).
With true (the Turbo Vision default) the field selects its whole content
when it becomes focused, so the first keystroke replaces it. With false
the field keeps its caret and any existing selection on focus gain and
typing inserts at the caret — the field still clears its selection on focus
loss. See select_all_on_focus.
§Turbo Vision heritage
tvision-rs extension to TInputLine. TInputLine always selects all on
focus gain.
Sourcepub fn set_read_only(&mut self, read_only: bool)
pub fn set_read_only(&mut self, read_only: bool)
Make the field refuse every change to its text while leaving it fully navigable — the “look but don’t touch” mode.
This is orthogonal to disabled. A disabled view is skipped by focus
entirely, so its value can never be scrolled, selected or copied. A
read-only field still takes focus, moves its caret, scrolls horizontally,
select-alls, and copies; only the text is untouchable:
disabled | read_only | plain | |
|---|---|---|---|
| takes focus | no | yes | yes |
| caret / horizontal scroll | — | yes | yes |
| select + copy | — | yes | yes |
| type / delete / cut / paste | — | refused | yes |
Every refused change consumes the event and broadcasts
READ_ONLY_REJECTED, so the owner can
tell the user why the field will not budge. Cut and paste are also grayed
in the command set, closing the menu route.
Setting this does not change the text, the caret, or the appearance: a read-only field is drawn exactly like an editable one, because the owner — which knows why the field is read-only — is better placed to signal it.
§Turbo Vision heritage
tvision-rs extension to TInputLine.
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Whether the field refuses changes. See set_read_only.
Sourcepub fn set_value_position(&mut self, position: ValuePosition)
pub fn set_value_position(&mut self, position: ValuePosition)
Choose which end of the text View::set_value leaves on screen.
A value wider than the field shows only one end of itself, and the
Turbo Vision default (ValuePosition::End) picks the tail: set_value
select-alls, which parks caret and view after the last character, ready
for the first keystroke to replace the value.
That is wrong for data whose front identifies it — a path, a URL, a
distinguished name — where the operator is left staring at
…,dc=example,dc=org. ValuePosition::Start homes the caret and the
view instead, leaving nothing selected.
This governs set_value only. Focus is separate: see
set_select_all_on_focus.
§Turbo Vision heritage
tvision-rs extension to TInputLine. ValuePosition::End is the
TInputLine::setData behaviour.
Sourcepub fn value_position(&self) -> ValuePosition
pub fn value_position(&self) -> ValuePosition
Which end of the text set_value leaves on screen. See
set_value_position.
Sourcepub fn set_mask(&mut self, mask: Option<char>)
pub fn set_mask(&mut self, mask: Option<char>)
Set (or clear) the echo character. Some(ch) masks the display with ch;
None restores the plain field. The stored value is unaffected.
§Turbo Vision heritage
tvision-rs extension to TInputLine.
Sourcepub fn set_reveal(&mut self, reveal: bool)
pub fn set_reveal(&mut self, reveal: bool)
Momentarily show the real text despite mask (password reveal). Ignored
when the field is not masked.
§Turbo Vision heritage
tvision-rs extension to TInputLine.
Sourcepub fn set_cursor_pos(&mut self, pos: i32)
pub fn set_cursor_pos(&mut self, pos: i32)
Move the caret to byte offset pos, collapsing any selection and
scrolling the field so the caret is visible.
pos is clamped to [0, data.len()]; if the clamped offset does not
land on a char boundary it snaps down to the previous one (the same
boundary-snap idiom check_valid and View::set_value already use
when clamping to max_len).
§Turbo Vision heritage
C++ code assigns the public TInputLine::curPos field directly; this
setter does the same and also collapses the selection and scrolls the
caret into view.
Sourcepub fn home(&mut self)
pub fn home(&mut self)
Move the caret to the start of the field. Extension — see
set_cursor_pos.
Sourcepub fn end(&mut self)
pub fn end(&mut self)
Move the caret to the end of the field. Extension — see
set_cursor_pos.
Sourcepub fn select_all(&mut self, enable: bool, scroll: bool)
pub fn select_all(&mut self, enable: bool, scroll: bool)
Select the whole field (enable = true) or deselect it (enable = false), and optionally scroll the cursor into view (scroll = true).
When enable is true the cursor moves to the end of data and the
selection covers [0, data.len()]. When false both the cursor and
the selection are collapsed to position 0.
Pass scroll = true when the field is gaining focus (so the end of a
long value scrolls into view). Pass scroll = false from set_state
where the viewport position should be left as-is.
This method does not trigger a redraw on its own — the event loop
redraws the whole tree. The screen cursor needs no separate update: it
is derived fresh from cur_pos/first_pos via
cursor_request on the next pump. Callers that
also need to refresh cut/copy/paste command graying call
update_commands separately.
Sourcepub fn paste_text(&mut self, text: &str)
pub fn paste_text(&mut self, text: &str)
Insert text from the clipboard at the current cursor position,
replacing any active selection and clamping the result to max_len.
Called by the pump’s Deferred::InputLinePaste apply arm once the backend
has supplied the clipboard text: insert the pasted bytes at the cursor,
replacing the selection, clamped so the total byte length does not exceed
the byte cap. Tabs/newlines are replaced with spaces. After insertion the
cursor sits at the end of the pasted text and the selection is cleared.
A no-op on a read-only field. Both routes into a
deferred paste are already refused before they get here, so this is the
belt to their braces — and it is silent, because without a Context it
cannot broadcast the refusal.
Trait Implementations§
Source§impl View for InputLine
impl View for InputLine
Source§fn as_any_mut(&mut self) -> Option<&mut dyn Any>
fn as_any_mut(&mut self) -> Option<&mut dyn Any>
Exposes the concrete InputLine so the pump’s
InputLinePaste broker can
downcast and call paste_text.
Source§fn cursor_request(&self) -> Option<Point>
fn cursor_request(&self) -> Option<Point>
The screen-cursor column, derived fresh from cur_pos/first_pos on
every call — the port of C++ TInputLine::draw’s tail
setCursor(displayedPos(curPos)-firstPos+1, 0), which re-derives the
cursor every paint rather than caching it. Because this recomputes from
the live fields instead of reading a cache, direct writes to cur_pos/
first_pos are always reflected on the next pump. Mirrors the base
View::cursor_request focus/visibility gate.
Source§fn draw(&mut self, ctx: &mut DrawCtx<'_>)
fn draw(&mut self, ctx: &mut DrawCtx<'_>)
Render the field: background fill, scrolled text, scroll arrows at the edges when the content overflows, and the selection highlight.
Colors come from the theme roles: Role::InputNormal for the
background and unselected text of a focused field (or a never-selectable
one) within an active pane, Role::InputSurface for a non-focused
selectable field in that same active pane, Role::InputInactive once
the owning pane recedes, Role::InputArrow for the ◄/► overflow
indicators, and Role::InputSelected for highlighted text. Because
tvision-rs has no attribute-only paint, the selected substring is redrawn (not just
re-attributed) in the selected style at the correct scroll offset — the
visible glyphs of the scrolled window, not the raw head of the selection.
The screen cursor position is not set here; cursor placement lives
in cursor_request, called by the event loop
before each redraw.
Source§fn handle_event(&mut self, ev: &mut Event, ctx: &mut Context<'_>)
fn handle_event(&mut self, ev: &mut Event, ctx: &mut Context<'_>)
Process keyboard, mouse, and command events while the field is selected.
Keyboard: printable characters are inserted at the cursor (replacing
any active selection, with validator filtering and all three caps checked).
Navigation keys (arrows, Home, End, Ctrl-arrows, Ins, Delete, Backspace,
Ctrl-Y) are dispatched through the global keymap and applied by
apply_input_command. Shift-held
movement extends the selection block. Unhandled keys (Tab, Enter, Escape,
modified characters outside the repertoire) are left live so the enclosing
dialog can route them.
Mouse: a single click positions the cursor; a double-click selects
all. Click-and-drag or a click on a scroll-arrow arms a press-and-hold
tracking capture that continues updating selection or scroll position on
each Event::MouseAuto / Event::MouseMove tick until mouse-up.
Commands: Command::CUT, Command::COPY, and Command::PASTE
are consumed here; other commands fall through.
After each handled event, cut/copy/paste command graying is refreshed via
update_commands (only while both active
and selected).
Source§fn set_state(&mut self, flag: StateFlag, enable: bool, ctx: &mut Context<'_>)
fn set_state(&mut self, flag: StateFlag, enable: bool, ctx: &mut Context<'_>)
Apply a state-flag change and react to focus transitions.
Flips the requested flag on ViewState, then:
- On
StateFlag::Selected(orStateFlag::Activewhile the field is already selected): callsselect_all(enable, false)so the field is fully selected when it gains focus and deselected when it loses it. - When the active-and-selected condition changes (e.g. the field gains or
loses focus): pushes cut/copy/paste command enable/disable updates via
update_commands. This is what grays the Edit menu items when focus leaves the field.
Source§fn valid(&mut self, cmd: Command, ctx: &mut Context<'_>) -> bool
fn valid(&mut self, cmd: Command, ctx: &mut Context<'_>) -> bool
With a validator: the validate command reports the validator’s status; any other non-cancel command runs the validator and fails if invalid. Without a validator: always valid.
Source§fn value(&self) -> Option<FieldValue>
fn value(&self) -> Option<FieldValue>
Return the field’s current value as a FieldValue.
If the attached validator supports typed transfer (transfer_get
returns Some), that typed value is returned — for example, a
RangeValidator with transfer
enabled yields FieldValue::Int(n) rather than FieldValue::Text.
Otherwise (no validator, or transfer disabled) the raw field text is
returned as FieldValue::Text.
Call this from a dialog’s gather pass (or directly) to read the field’s
value in a type-safe way. For a plain text field with no validator the
result is always Some(FieldValue::Text(…)).
Source§fn set_value(&mut self, v: FieldValue)
fn set_value(&mut self, v: FieldValue)
Load a value into the field, replacing the current contents, and select all.
If the attached validator supports typed transfer (transfer_set returns
Some), the validator formats the value into the display text (e.g.
FieldValue::Int(42) becomes "42") and select_all(true, true)
is called. Otherwise, a FieldValue::Text value is loaded directly,
truncated to max_len bytes at the nearest char boundary if it
is too long, and the field is selected. A FieldValue::Int into a field
with no transfer-enabled validator is silently ignored (type mismatch).
Use this from a dialog’s scatter pass or any time you need to populate the field programmatically and want the cursor/scroll state reset.
Source§fn set_modal_answer(&mut self, _cmd: Command)
fn set_modal_answer(&mut self, _cmd: Command)
Context::request_message_box (the
answer_to/RouteModalAnswer round-trip). Default: no-op. Overridden by
views that drive a Yes/No/Cancel prompt out of valid (e.g.
FileEditor caches it for the re-validate).Source§fn set_modal_data(&mut self, _data: FieldValue)
fn set_modal_data(&mut self, _data: FieldValue)
Source§fn set_value_ctx(&mut self, v: FieldValue, ctx: &mut Context<'_>)
fn set_value_ctx(&mut self, v: FieldValue, ctx: &mut Context<'_>)
FieldValue into this control with a Context. Default:
calls set_value (the context-free setter). Override
when scatter needs deferred publishing (e.g.
ListBox republishes its vertical scrollbar via
focus_item).Source§fn awaken(&mut self)
fn awaken(&mut self)
Source§fn calc_bounds(&mut self, owner_size: Point, delta: Point) -> Rect
fn calc_bounds(&mut self, owner_size: Point, delta: Point) -> Rect
owner_size (delta = new - old). Computes the size limits via the overridable
size_limits hook — so a widget override (e.g. a
window’s minimum) participates — then delegates the grow math to
ViewState::calc_bounds (the single source). Returns the bounds; it does
not apply them (change_bounds does).Source§fn change_bounds(&mut self, bounds: Rect)
fn change_bounds(&mut self, bounds: Rect)
bounds to this view and propagate as needed. Read moreSource§fn on_bounds_changed(&mut self, _ctx: &mut Context<'_>)
fn on_bounds_changed(&mut self, _ctx: &mut Context<'_>)
change_bounds is applied via
Deferred::ChangeBounds — provides a
Context for re-publishing state that depends on the new bounds (e.g. scrollbar
params). Default implementation is a no-op. Read moreSource§fn caret_size(&self) -> u8
fn caret_size(&self) -> u8
CARET_INSERT (a block) when the
cursor_ins state is set, else
CARET_NORMAL (the normal caret).
The event loop reads it along the same focused chain as
cursor_request;
Group overrides it to descend into its current
child. Read moreSource§fn find_mut(&mut self, id: ViewId) -> Option<&mut dyn View>
fn find_mut(&mut self, id: ViewId) -> Option<&mut dyn View>
id to a descendant of this view (never self — the parent
identifies a view by id). A leaf has no descendants, so the base returns
None; a Group overrides to search its children
and recurse; a Group-embedding view delegates to its inner group. This is
the “tree-walk via Context” — the uniform way the event loop
/ a capture handler acts on a view it holds only by id (move a window’s
bounds, flip the dragging flag, …).Source§fn remove_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool
fn remove_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool
id from whichever group owns it.
Returns true if it was found+removed. Distinct
from find_mut because removal happens in the owner’s
child Vec (a view cannot remove itself — it doesn’t know its owner)
and must run the owning group’s reset_current. Base: false (a leaf owns
nothing).Source§fn focus_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool
fn focus_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool
id within whichever group owns it
— the tree-op behind a label focusing its linked control. Returns true
if id was found in this subtree (selectable or not — finding it stops the
walk). Distinct from find_mut because focusing happens in
the owning group (a view cannot select itself within itself): the
owning Group calls focus_child after applying the
selectable gate. Base: false (a leaf owns nothing). Read moreSource§fn has_focusable_leaf(&self) -> bool
fn has_focusable_leaf(&self) -> bool
Group
overrides to recurse into children; wrapper views delegate. Used by the
hierarchical Tab traversal to skip selectable-but-empty subtrees.Source§fn focus_to_edge(&mut self, backward: bool, ctx: &mut Context<'_>) -> bool
fn focus_to_edge(&mut self, backward: bool, ctx: &mut Context<'_>) -> bool
backward = false) or last (Shift-Tab,
backward = true) focusable leaf in this view’s subtree, establishing the
full focus path down to it. Returns true if a focusable leaf was focused. Read moreSource§fn reset_current(&mut self, _ctx: &mut Context<'_>)
fn reset_current(&mut self, _ctx: &mut Context<'_>)
Group::insert, so
exec_view calls this on a freshly-inserted modal BEFORE focusing it, so
the modal’s first selectable child is current on open (otherwise the modal
is keyboard-dead until a nav event — see the seam note in exec_view).
Base: no-op (a leaf has no internal currency); Group overrides;
Window/Dialog delegate.Source§fn settle_currency(&mut self, _ctx: &mut Context<'_>)
fn settle_currency(&mut self, _ctx: &mut Context<'_>)
Source§fn set_visible_descendant(
&mut self,
id: ViewId,
visible: bool,
ctx: &mut Context<'_>,
) -> bool
fn set_visible_descendant( &mut self, id: ViewId, visible: bool, ctx: &mut Context<'_>, ) -> bool
visible flag of the descendant named by id from its
OWNING group, running the owning group’s currency tail. Toggling
visibility on a selectable view re-picks the owner’s current child, in both
directions (show and hide). Returns true if id was found in this
subtree. Read moreSource§fn number(&self) -> Option<i16>
fn number(&self) -> Option<i16>
None);
Window overrides to return its number when > 0
(0 means unnumbered → None).Source§fn grabs_focus_on_click(&self) -> bool
fn grabs_focus_on_click(&self) -> bool
Group::route_event). Default true (the common case); a
Button overrides to return its grab-focus flag.
A view returning false is not focused by a click but still
receives the click (so it can act, e.g. press, without becoming the
current view).Source§fn select_window_num(&mut self, num: i16, ctx: &mut Context<'_>) -> bool
fn select_window_num(&mut self, num: i16, ctx: &mut Context<'_>) -> bool
num. Returns
whether one matched. Consistent with the find_mut /
remove_descendant tree-op family: the live
loop holds a subtree only by id (here, the desktop) and asks it to act.
Default: no-op (false). Desktop overrides.Source§fn tile(&mut self, _r: Rect)
fn tile(&mut self, _r: Rect)
Desktop lays out
windows). r is the desktop-local layout rect. Mirrors
select_window_num: the live loop drives the
desktop by id through &mut dyn View.Source§fn cascade(&mut self, _r: Rect)
fn cascade(&mut self, _r: Rect)
Desktop overrides.Source§fn apply_scroll_sync(
&mut self,
_h: Option<i32>,
_v: Option<i32>,
_ctx: &mut Context<'_>,
)
fn apply_scroll_sync( &mut self, _h: Option<i32>, _v: Option<i32>, _ctx: &mut Context<'_>, )
None if that bar
is absent or unresolved), each read via View::value. Overridden by the
list viewers (delegate to
list_viewer::apply_scroll),
Scroller, the outline viewer, and the editor —
every sibling-scrollbar read sync routes through this one method instead of
a pump downcast. Read moremenu::menu_view::update_menu_commands
implements the re-gray walk. Read moreMenuBar / MenuBox)
override to set their
MenuViewState::current — the write-only
display cache their draw reads to pick the selected colour. Read moreSource§fn get_help_ctx(&self) -> HelpCtx
fn get_help_ctx(&self) -> HelpCtx
HelpCtx::DRAGGING while the view is being dragged, otherwise the
view’s own ViewState::help_ctx. Read moreSource§fn descendant_global_bounds(&self, _id: ViewId, _acc: Point) -> Option<Rect>
fn descendant_global_bounds(&self, _id: ViewId, _acc: Point) -> Option<Rect>
id to its absolute bounds, given acc = this
view’s own absolute origin. Base returns None (a leaf owns no
descendants); a Group overrides to walk its children
accumulating origins, and a Group-embedding view delegates to its inner
group. The THistory open path needs its linked
input line’s bounds in the root/absolute frame, because exec_view
root-inserts the modal and the modal frame hit-tests in absolute coords (the
documented ROOT-INSERT + (0,0) caveat). Mirrors
find_mut’s recursion but returns geometry, not a borrow.Source§fn set_indicator_value(&mut self, _location: Point, _modified: bool)
fn set_indicator_value(&mut self, _location: Point, _modified: bool)
Indicator overrides it to store the new
cursor location + modified flag. Driven by
Deferred::IndicatorSetValue:
the editor (a leaf) cannot reach its indicator sibling inline, so it requests
this and the pump calls the method by id — virtual dispatch, not a downcast.Source§fn apply_page_sync(&mut self, _idx: usize, _ctx: &mut Context<'_>)
fn apply_page_sync(&mut self, _idx: usize, _ctx: &mut Context<'_>)
PageStack overrides it to make page idx
active. Driven by
Deferred::PageStackSync: the pump
reads the bound tab bar’s value and calls this method by id — virtual
dispatch, not a downcast.Auto Trait Implementations§
impl !RefUnwindSafe for InputLine
impl !Send for InputLine
impl !Sync for InputLine
impl !UnwindSafe for InputLine
impl Freeze for InputLine
impl Unpin for InputLine
impl UnsafeUnpin for InputLine
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.