Skip to main content

CheckBoxes

Struct CheckBoxes 

Source
pub struct CheckBoxes { /* private fields */ }
Expand description

Several check boxes in one focusable control, with one bit of value each.

Matches Borland: TCheckBoxes.

Implementations§

Source§

impl CheckBoxes

Source

pub fn new(bounds: Rect, labels: Vec<String>) -> Self

Create the cluster from labels, one per row.

A tilde-wrapped letter, as in "~B~old", becomes that item’s Alt hotkey. At most MAX_CLUSTER_ITEMS labels are kept.

Source

pub fn set_labels(&mut self, labels: Vec<String>)

Replace the labels, keeping the value bits that still apply.

Source

pub fn item_count(&self) -> usize

Number of items.

Source

pub fn value(&self) -> u32

The raw bitmask: bit n is item n.

Source

pub fn set_value(&mut self, value: u32)

Set the raw bitmask. Bits past the last item are dropped.

Source

pub fn focused_item(&self) -> usize

Index of the item the arrow keys are on.

Source

pub fn set_focused_item(&mut self, index: usize)

Move the arrow-key focus within the cluster.

Source

pub fn set_enabled(&mut self, index: usize, enabled: bool)

Whether one item can be chosen. Disabled items draw dimmed.

Source

pub fn is_enabled(&self, index: usize) -> bool

Whether one item can be chosen.

Source

pub fn set_on_change(&mut self, command: CommandId)

Command broadcast when the value changes. Zero, the default, sends none.

Source§

impl CheckBoxes

Source

pub fn is_checked(&self, index: usize) -> bool

Whether one box is ticked.

Source

pub fn set_checked(&mut self, index: usize, checked: bool)

Tick or untick one box.

Source

pub fn checked_items(&self) -> Vec<usize>

The ticked boxes, in order.

Trait Implementations§

Source§

impl View for CheckBoxes

Source§

fn core(&self) -> &ViewCore

Base fields shared by every view (Borland: the TView data members).
Source§

fn core_mut(&mut self) -> &mut ViewCore

Source§

fn state(&self) -> StateFlags

Get view state flags
Source§

fn set_state(&mut self, state: StateFlags)

Set view state flags
Source§

fn can_focus(&self) -> bool

Source§

fn draw(&mut self, terminal: &mut Terminal)

Source§

fn handle_event(&mut self, event: &mut Event)

Source§

fn set_palette_chain(&mut self, node: Option<PaletteChainNode>)

Set the QCell-based palette chain node for this view. Called by parent (Group/Window) during draw to establish the safe owner chain.
Source§

fn get_palette(&self) -> Option<Palette>

Get this view’s palette for the Borland indirect palette system Matches Borland: TView::getPalette() Read more
Source§

fn as_any(&self) -> &dyn Any

Downcast to concrete type (immutable) Allows accessing specific view type methods from trait object
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Downcast to concrete type (mutable) Allows accessing specific view type methods from trait object
Source§

fn bounds(&self) -> Rect

The rectangle this view occupies in its owner’s coordinate space (Borland: origin and size). A child at (2, 3) stays at (2, 3) however its owner moves.
Source§

fn set_bounds(&mut self, bounds: Rect)

Source§

fn extent(&self) -> Rect

The view’s own coordinate space, (0, 0) to its size (Borland: TView::getExtent). This is the rectangle draw writes into and the space mouse positions arrive in.
Source§

fn set_focus(&mut self, focused: bool)

Set focus state - default implementation uses State::FOCUSED flag Views should override only if they need custom focus behavior
Source§

fn window_number(&self) -> Option<u8>

Window number for Alt+1..9 selection (Borland: TWindow::number). Read more
Source§

fn is_focused(&self) -> bool

Check if view is focused - reads State::FOCUSED flag
Source§

fn options(&self) -> Options

Get view option flags (Options::SELECTABLE, Options::PRE_PROCESS, Options::POST_PROCESS, etc.)
Source§

fn set_options(&mut self, options: Options)

Set view option flags
Source§

fn grow_mode(&self) -> GrowFlags

Get this view’s grow mode flags (Borland: TView::growMode). Read more
Source§

fn set_grow_mode(&mut self, grow_mode: GrowFlags)

Set this view’s grow mode flags (Borland: TView::growMode). Read more
Source§

fn set_state_flag(&mut self, flag: StateFlags, enable: bool)

Set or clear specific state flag(s) Matches Borland’s TView::setState(ushort aState, Boolean enable) If enable is true, sets the flag(s), otherwise clears them
Source§

fn get_state_flag(&self, flag: StateFlags) -> bool

Check if specific state flag(s) are set Matches Borland’s TView::getState(ushort aState)
Source§

fn has_shadow(&self) -> bool

Check if view has shadow enabled
Source§

fn shadow_bounds(&self) -> Rect

Get bounds including shadow area
Source§

fn update_cursor(&self, _terminal: &mut Terminal)

Update cursor state (called after draw) Views that need to show a cursor when focused should override this
Source§

fn zoom(&mut self, _max_bounds: Rect)

Zoom (maximize/restore) the view with given maximum bounds Matches Borland: TWindow::zoom() toggles between current and max size Default implementation does nothing (only windows support zoom)
Source§

fn valid(&mut self, _command: CommandId) -> bool

Validate the view before performing a command (usually closing) Matches Borland: TView::valid(ushort command) - returns Boolean Returns true if the view’s state is valid for the given command Used for “Save before closing?” type scenarios and input validation Read more
Source§

fn idle(&mut self)

Called periodically while the application is idle, so animations and timers can advance (Borland: TProgram::idle, which keeps running during execView). Overlay widgets added with Application::add_overlay_widget get this on every idle tick; the default does nothing.
Source§

fn as_group(&self) -> Option<&dyn GroupLike>

The container interface of this view, if it is one (Borland: dynamic_cast<TGroup*>). Containers built on Group return Some; leaf views keep the default None. Application::exec_view uses it to read a modal view’s end state without knowing its concrete type.
Source§

fn as_group_mut(&mut self) -> Option<&mut dyn GroupLike>

Source§

fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<()>

Dump this view’s region of the terminal buffer to an ANSI file for debugging
Source§

fn get_redraw_union(&self) -> Option<Rect>

Get the union rect of previous and current bounds for redrawing Matches Borland: TView::locate() calculates union of old and new bounds Returns None if the view hasn’t moved since last redraw Used by Desktop to implement Borland’s drawUnderRect pattern
Source§

fn clear_move_tracking(&mut self)

Clear movement tracking after redrawing Matches Borland: Called after drawUnderRect completes
Source§

fn make_global(&self, local_x: i16, local_y: i16) -> (i16, i16)

Convert a point in this view’s space to its owner’s space (Borland: TView::makeGlobal, but one hop: there is no owner chain to walk, and a group translates as it dispatches, so one hop is all a view ever needs).
Source§

fn make_local(&self, owner_x: i16, owner_y: i16) -> (i16, i16)

Convert a point in the owner’s space to this view’s space (Borland: TView::makeLocal, one hop; see make_global).
Source§

fn draw_shadow(&self, terminal: &mut Terminal)

Draw shadow for this view Draws a shadow offset dynamically based on terminal cell aspect ratio Shadow is semi-transparent - darkens the underlying content by 50% This matches the Borland Turbo Vision behavior more closely
Get the linked control ViewId for labels Matches Borland: TLabel::link field Returns Some(ViewId) if this is a label with a linked control, None otherwise Used by Group to implement focus transfer when clicking labels
Source§

fn init_after_add(&mut self)

Initialize internal owner pointers after view is added to parent and won’t move This is called by parent’s add() method after the view is in its final position Views that contain other views by value should override this to set up owner chains Default implementation does nothing
Source§

fn constrain_to_parent_bounds(&mut self)

Constrain view bounds to parent/owner bounds Used after positioning (e.g., centering) to ensure view stays within valid area Matches Borland: TView::locate() constrains position to owner bounds
Source§

fn get_palette_chain(&self) -> Option<&PaletteChainNode>

Get the QCell-based palette chain node for this view. Used by map_color() to safely walk the owner chain.
Source§

fn set_owner_extent(&mut self, _extent: Rect)

Tell the view how big its owner is, for drag and resize limits (Borland: TFrame::dragWindow reads owner->owner->getExtent()). Called by Desktop when adding windows.
Source§

fn map_color(&self, color_index: u8) -> Attr

Map a logical color index to an actual color attribute Matches Borland: TView::mapColor(uchar index) Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more