pub struct Button { /* private fields */ }Implementations§
Source§impl Button
impl Button
pub fn new( bounds: Rect, title: &str, command: CommandId, is_default: bool, ) -> Self
pub fn set_disabled(&mut self, disabled: bool)
pub fn is_disabled(&self) -> bool
Sourcepub fn set_broadcast(&mut self, broadcast: bool)
pub fn set_broadcast(&mut self, broadcast: bool)
Set whether this button broadcasts its command instead of sending it as a command event Matches Borland: bfBroadcast flag
Sourcepub fn set_selectable(&mut self, selectable: bool)
pub fn set_selectable(&mut self, selectable: bool)
Set whether this button is selectable (can receive focus) Matches Borland: ofSelectable flag
Trait Implementations§
Source§impl View for Button
impl View for Button
fn bounds(&self) -> Rect
fn set_bounds(&mut self, bounds: Rect)
fn draw(&mut self, terminal: &mut Terminal)
fn handle_event(&mut self, event: &mut Event)
fn can_focus(&self) -> bool
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
Source§fn options(&self) -> u16
fn options(&self) -> u16
Get view option flags (OF_SELECTABLE, OF_PRE_PROCESS, OF_POST_PROCESS, etc.)
Source§fn set_options(&mut self, options: u16)
fn set_options(&mut self, options: u16)
Set view option flags
Check if this view is a default button (for Enter key handling at Dialog level)
Corresponds to Borland’s TButton::amDefault flag (tbutton.cc line 239)
Get the command ID for this button (if it’s a button)
Returns None if not a button
Used by Dialog to activate default button on Enter key
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_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 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 set_focus(&mut self, focused: bool)
fn set_focus(&mut self, focused: bool)
Set focus state - default implementation uses SF_FOCUSED flag
Views should override only if they need custom focus behavior
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Check if view is focused - reads SF_FOCUSED flag
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 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 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 set_list_selection(&mut self, _index: usize)
fn set_list_selection(&mut self, _index: usize)
Set the selection index for listbox views
Only implemented by ListBox, other views ignore this
Source§fn get_list_selection(&self) -> usize
fn get_list_selection(&self) -> usize
Get the selection index for listbox views
Only implemented by ListBox, other views return 0
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 get_end_state(&self) -> CommandId
fn get_end_state(&self) -> CommandId
Get the end state for modal views
Matches Borland: TGroup::endState field
Returns the command ID that ended modal execution (0 if still running)
Source§fn set_end_state(&mut self, _command: CommandId)
fn set_end_state(&mut self, _command: CommandId)
Set the end state for modal views
Called by end_modal() to signal the modal loop should exit
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 local coordinates to global (screen) coordinates
Matches Borland: TView::makeGlobal(TPoint source, TPoint& dest) Read more
Source§fn make_local(&self, global_x: i16, global_y: i16) -> (i16, i16)
fn make_local(&self, global_x: i16, global_y: i16) -> (i16, i16)
Convert global (screen) coordinates to local view coordinates
Matches Borland: TView::makeLocal(TPoint source, TPoint& dest) Read more
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 set_parent_bounds(&mut self, _bounds: Rect)
fn set_parent_bounds(&mut self, _bounds: Rect)
Set the parent’s bounds for drag/resize limit resolution.
Called by Desktop when adding windows.
Auto Trait Implementations§
impl Freeze for Button
impl !RefUnwindSafe for Button
impl !Send for Button
impl !Sync for Button
impl Unpin for Button
impl UnsafeUnpin for Button
impl !UnwindSafe for Button
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