pub struct Options {
pub selectable: bool,
pub top_select: bool,
pub first_click: bool,
pub framed: bool,
pub pre_process: bool,
pub post_process: bool,
pub tileable: bool,
pub center_x: bool,
pub center_y: bool,
pub validate: bool,
}Expand description
The per-view option flags — fixed, build-time choices about how a view
behaves (selectable, framed, centered, pre/post-process, …), as opposed to
the live State bits.
Set these flags on ViewState::options before inserting the view into its
owner. The most commonly needed flags are:
selectable = true— the view can receive focus (required for input widgets).top_select = true— combined withselectable, brings windows to the front on mouse-click (set automatically byWindow).first_click = true— the click that selects the view is also delivered as aMouseDown; without it, the first click only selects.pre_process = true— the view receives focused-chain events before the focused view (e.g. a menu bar that intercepts Alt-letter hotkeys).post_process = true— the view receives focused-chain events after the focused view (plain-letter hotkeys for buttons, labels, and clusters).center_x / center_y = true— the owner auto-centers the view’s bounds on that axis. Useful for dialogs placed without an exact position.
Dropped: the per-view back-buffer option (tvision-rs redraws the whole tree and diffs). The streaming-only version bits are dropped too.
§Turbo Vision heritage
Ports the of* flag family (views.h) as a struct-of-bools (deviation D5);
each field names its of* source. The dropped options are ofBuffered
(0x040) and the streaming-only ofVersion* bits.
Fields§
§selectable: boolofSelectable — the view can become the current/focused view.
All interactive widgets (buttons, input lines, list viewers, …) set this.
A view without selectable is purely decorative: it never receives focus.
top_select: boolofTopSelect — selecting the view moves it to the front of its owner.
Used by Window: clicking a window selects it and
brings it to the top of the z-order simultaneously.
first_click: boolofFirstClick — a selecting mouse-down is also passed through to the view.
Without this flag, the first click on an unfocused view only focuses it;
with it, the click is also delivered as a MouseDown event so the view
can react immediately (e.g. a button that fires on the first click).
framed: boolofFramed — the view has a frame drawn around it.
Informs the owner that the view manages its own border; used by
Frame so the owner can adjust layouts.
pre_process: boolofPreProcess — the view sees focused-chain events before the focused view.
Set on views that must intercept events at the group level before the current child sees them (e.g. a menu bar intercepting Alt+letter hotkeys).
post_process: boolofPostProcess — the view sees focused-chain events after the focused view.
Set on views that handle plain-letter accelerators (e.g. buttons and clusters), which fire only when no other view consumed the key first.
tileable: boolofTileable — the view participates in tile/cascade layout.
Set on windows that should be included when the desktop tiles or cascades.
Decorative or fixed-position windows leave this false.
center_x: boolofCenterX — the view is centered horizontally in its owner.
The owner adjusts the view’s x position to center it. Combine with
center_y (or use Options::centered) to center on both axes.
center_y: boolofCenterY — the view is centered vertically in its owner.
The owner adjusts the view’s y position to center it.
validate: boolofValidate — the view is asked to validate (valid(Command::RELEASED_FOCUS)) before losing focus.
When set, the group calls view.valid(Command::RELEASED_FOCUS) before
allowing focus to move away. Return false from valid to keep focus
locked (e.g. an input line with a required field).
Implementations§
Trait Implementations§
impl Copy for Options
impl Eq for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
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,
§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.