pub struct OutlineViewerState {
pub state: ViewState,
pub delta: Point,
pub limit: Point,
pub h_scroll_bar: Option<ViewId>,
pub v_scroll_bar: Option<ViewId>,
pub foc: i32,
/* private fields */
}Expand description
The shared state of every outline viewer. A concrete outline widget embeds
one and exposes it via OutlineViewer::ov/OutlineViewer::ov_mut.
§Turbo Vision heritage
The data half of TOutlineViewer (toutline.cpp) plus the scroll
offset/limit it inherits from the scroller base.
Fields§
§state: ViewStateView state (geometry, flags, …) — the View composition target.
delta: PointThe scroll offset: x is the number of character columns to skip on
the left; y is the DFS position of the first visible row.
Read delta to find out which part of the tree is visible. Do not assign
it directly — changes come from scrollbar broadcasts that the pump
resolves and applies via apply_delta.
limit: PointThe content extent: x is the maximum graph+text width (in character
columns); y is the total number of currently-visible nodes.
Updated by ov_update after every tree mutation. Read it to know the
scrollable content size; do not assign directly.
h_scroll_bar: Option<ViewId>The horizontal scrollbar view id, or None if none was wired.
Set at construction via OutlineViewerState::new; the outline viewer
reads and writes its value through the pump broker.
v_scroll_bar: Option<ViewId>The vertical scrollbar view id, or None if none was wired.
Set at construction via OutlineViewerState::new; the outline viewer
reads and writes its value through the pump broker.
foc: i32The DFS position (0-based) of the focused node.
Read this to find out which node is focused. To move the focus
programmatically, call adjust_focus (it also scrolls the focused row
into view and notifies the trait via
OutlineViewer::focused_item). Do not assign directly.
Implementations§
Source§impl OutlineViewerState
impl OutlineViewerState
Sourcepub fn new(bounds: Rect, h: Option<ViewId>, v: Option<ViewId>) -> Self
pub fn new(bounds: Rect, h: Option<ViewId>, v: Option<ViewId>) -> Self
Create the shared state for an outline viewer.
bounds sets the initial geometry; h and v are the optional
horizontal and vertical scrollbar ids (pass None when scrollbars are
absent). The view starts selectable, grows with its lower-right corner,
and focuses at DFS position 0 with a zero scroll offset.
The initial scrollbar population is seeded automatically the first time a
context-bearing lifecycle call reaches the viewer (event, state change, or
bounds change), so no explicit ov_update is needed after construction.
Call ov_update explicitly only after mutating the tree (swapping
Outline::root, or expanding/collapsing programmatically) to recount
visible nodes and republish the limits.
Sourcepub fn set_limit(&mut self, x: i32, y: i32, ctx: &mut Context<'_>)
pub fn set_limit(&mut self, x: i32, y: i32, ctx: &mut Context<'_>)
Set the content extent and (re)publish each bar’s range/page params.
Same formula as Scroller::set_limit.
Sourcepub fn scroll_to(&mut self, x: i32, y: i32, ctx: &mut Context<'_>)
pub fn scroll_to(&mut self, x: i32, y: i32, ctx: &mut Context<'_>)
Set each bar’s value (preserving range and steps).
Same as Scroller::scroll_to.
Sourcepub fn apply_delta(&mut self, d: Point)
pub fn apply_delta(&mut self, d: Point)
Apply a freshly-read scrollbar delta. Unlike the scroller’s apply_delta
there is no cursor adjust (the outline viewer has no editor cursor); just
overwrite delta. Called by the pump (the read broker) after it resolves
the bars and reads their values.
Auto Trait Implementations§
impl Freeze for OutlineViewerState
impl RefUnwindSafe for OutlineViewerState
impl Send for OutlineViewerState
impl Sync for OutlineViewerState
impl Unpin for OutlineViewerState
impl UnsafeUnpin for OutlineViewerState
impl UnwindSafe for OutlineViewerState
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.