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
impl CheckBoxes
Sourcepub fn new(bounds: Rect, labels: Vec<String>) -> Self
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.
Sourcepub fn set_labels(&mut self, labels: Vec<String>)
pub fn set_labels(&mut self, labels: Vec<String>)
Replace the labels, keeping the value bits that still apply.
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Number of items.
Sourcepub fn set_value(&mut self, value: u32)
pub fn set_value(&mut self, value: u32)
Set the raw bitmask. Bits past the last item are dropped.
Sourcepub fn focused_item(&self) -> usize
pub fn focused_item(&self) -> usize
Index of the item the arrow keys are on.
Sourcepub fn set_focused_item(&mut self, index: usize)
pub fn set_focused_item(&mut self, index: usize)
Move the arrow-key focus within the cluster.
Sourcepub fn set_enabled(&mut self, index: usize, enabled: bool)
pub fn set_enabled(&mut self, index: usize, enabled: bool)
Whether one item can be chosen. Disabled items draw dimmed.
Sourcepub fn is_enabled(&self, index: usize) -> bool
pub fn is_enabled(&self, index: usize) -> bool
Whether one item can be chosen.
Sourcepub fn set_on_change(&mut self, command: CommandId)
pub fn set_on_change(&mut self, command: CommandId)
Command broadcast when the value changes. Zero, the default, sends none.
Source§impl CheckBoxes
impl CheckBoxes
Sourcepub fn is_checked(&self, index: usize) -> bool
pub fn is_checked(&self, index: usize) -> bool
Whether one box is ticked.
Sourcepub fn set_checked(&mut self, index: usize, checked: bool)
pub fn set_checked(&mut self, index: usize, checked: bool)
Tick or untick one box.
Sourcepub fn checked_items(&self) -> Vec<usize>
pub fn checked_items(&self) -> Vec<usize>
The ticked boxes, in order.
Trait Implementations§
Source§impl View for CheckBoxes
impl View for CheckBoxes
Source§fn core(&self) -> &ViewCore
fn core(&self) -> &ViewCore
Base fields shared by every view (Borland: the
TView data members).fn core_mut(&mut self) -> &mut ViewCore
Source§fn state(&self) -> StateFlags
fn state(&self) -> StateFlags
Get view state flags
Source§fn set_state(&mut self, state: StateFlags)
fn set_state(&mut self, state: StateFlags)
Set view state flags
fn can_focus(&self) -> bool
fn draw(&mut self, terminal: &mut Terminal)
fn handle_event(&mut self, event: &mut Event)
Source§fn set_palette_chain(&mut self, node: Option<PaletteChainNode>)
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>
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
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
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
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.fn set_bounds(&mut self, bounds: Rect)
Source§fn extent(&self) -> Rect
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)
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>
fn window_number(&self) -> Option<u8>
Window number for Alt+1..9 selection (Borland: TWindow::number). Read more
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Check if view is focused - reads State::FOCUSED flag
Source§fn options(&self) -> Options
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)
fn set_options(&mut self, options: Options)
Set view option flags
Source§fn grow_mode(&self) -> GrowFlags
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)
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)
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
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
fn has_shadow(&self) -> bool
Check if view has shadow enabled
Source§fn shadow_bounds(&self) -> Rect
fn shadow_bounds(&self) -> Rect
Get bounds including shadow area
Source§fn update_cursor(&self, _terminal: &mut Terminal)
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)
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
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)
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>
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.fn as_group_mut(&mut self) -> Option<&mut dyn GroupLike>
Source§fn dump_to_file(&self, terminal: &Terminal, path: &str) -> Result<()>
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>
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)
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)
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)
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)
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
Source§fn label_link(&self) -> Option<ViewId>
fn label_link(&self) -> Option<ViewId>
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)
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)
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>
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)
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.Auto Trait Implementations§
impl !RefUnwindSafe for CheckBoxes
impl !Send for CheckBoxes
impl !Sync for CheckBoxes
impl !UnwindSafe for CheckBoxes
impl Freeze for CheckBoxes
impl Unpin for CheckBoxes
impl UnsafeUnpin for CheckBoxes
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
Mutably borrows from an owned value. Read more