pub struct Stackpanel { /* private fields */ }Expand description
Stackpanel will group multiple windows and arrange them according to the Orientation. It will also allow movement between them using the arrow keys. Default margin is 1.
Design (optional Border, vertical):
┌─────────┐
│Content A│
│ │
│Content B│
└─────────┘Horizontal:
┌─────────────────────┐
│Content A Content B│
└─────────────────────┘Implementations§
Source§impl Stackpanel
impl Stackpanel
pub fn default_callback(_: &mut Self)
pub fn default_key_handler(&mut self, event: &mut WindowEvent)
Sourcepub fn new(orientation: Orientation) -> Self
pub fn new(orientation: Orientation) -> Self
Constructs a new Stackpanel with the given Orientation
pub fn set_selection_changed_callback<F: Fn(&mut Self) + 'static>( &mut self, callback: F, )
pub fn set_key_handler(&mut self, f: StackpanelKeyHandler)
Sourcepub fn set_item_alignment(&mut self, alignment: Alignment)
pub fn set_item_alignment(&mut self, alignment: Alignment)
Sets the alignment for each child/item within the Stackpanel
pub fn set_orientation(&mut self, orientation: Orientation)
Sourcepub fn set_child_margin(&mut self, margin: u8)
pub fn set_child_margin(&mut self, margin: u8)
Sets the offset between each child
Sourcepub fn scroll(
&mut self,
direction: Direction,
kind: ScrollKind,
scroll_only: bool,
)
pub fn scroll( &mut self, direction: Direction, kind: ScrollKind, scroll_only: bool, )
scroll_only specifies whether selection should also change if only the view changes
pub fn has_scroll_viewer(&self) -> bool
Trait Implementations§
Source§impl Default for Stackpanel
impl Default for Stackpanel
Source§impl HasWindowUID for Stackpanel
impl HasWindowUID for Stackpanel
Source§impl ItemCollection<Rc<RefCell<dyn Window>>> for Stackpanel
impl ItemCollection<Rc<RefCell<dyn Window>>> for Stackpanel
Source§fn remove_item(&mut self, item: &WindowRef)
fn remove_item(&mut self, item: &WindowRef)
Removes a single child from the internal array
Source§fn clear_items(&mut self)
fn clear_items(&mut self)
Removes all children from the internal array
Source§impl Scrollable for Stackpanel
impl Scrollable for Stackpanel
Source§fn is_scrollable(&self, axis: Orientation) -> bool
fn is_scrollable(&self, axis: Orientation) -> bool
Can current Scrollable be scrolled horizontally / vertically
Source§fn scroll(&mut self, direction: Direction, kind: ScrollKind)
fn scroll(&mut self, direction: Direction, kind: ScrollKind)
Scrolls page/line-wise (see ScrollKind) in the given direction
Source§fn set_offset(&mut self, direction: Orientation, offset: usize)
fn set_offset(&mut self, direction: Orientation, offset: usize)
Sets the horizontal / vertical offset
Source§fn offset(&self, axis: Orientation) -> usize
fn offset(&self, axis: Orientation) -> usize
Horizontal / Vertical offset of the scrolled content
Source§fn viewport(&self, axis: Orientation) -> usize
fn viewport(&self, axis: Orientation) -> usize
Horizontal / Vertical size of the viewport for current Scrollable
Source§fn set_scroll_viewer(&mut self, scroll_viewer: Weak<RefCell<ScrollViewer>>)
fn set_scroll_viewer(&mut self, scroll_viewer: Weak<RefCell<ScrollViewer>>)
Should only be called by the ScrollViewer itself
Source§impl Widget for Stackpanel
impl Widget for Stackpanel
fn set_visibility(&mut self, visibility: bool)
fn set_width(&mut self, width: Size)
fn set_height(&mut self, height: Size)
fn set_margin(&mut self, margin: Thickness)
fn set_border(&mut self, border: BorderStyle)
fn set_alignment( &mut self, horizontal: HorizontalAlignment, vertical: VerticalAlignment, )
Source§fn set_enabled_state(&mut self, is_enabled: bool)
fn set_enabled_state(&mut self, is_enabled: bool)
Changing the IsEnabled state usually changes the highlight color
fn set_width_constraint(&mut self, width: SizeConstraint)
fn set_height_constraint(&mut self, height: SizeConstraint)
Source§impl WidgetColors for Stackpanel
impl WidgetColors for Stackpanel
fn set_disabled_color(&mut self, color: Option<Color>)
fn set_base_fg_color(&mut self, color: Option<Color>)
fn set_base_bg_color(&mut self, color: Option<Color>)
Source§impl Window for Stackpanel
impl Window for Stackpanel
Source§fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
fn children(&mut self, builder: SubWindowBuilder) -> SubWindows
Returns all children windows (and layouting Rects)
Note: When changing the children make sure to also adjust the focus
Source§fn handle_event(&mut self, event: &mut WindowEvent)
fn handle_event(&mut self, event: &mut WindowEvent)
Source§impl WindowLayout for Stackpanel
impl WindowLayout for Stackpanel
Source§fn desired_size(&self, available_size: TPoint) -> TPoint
fn desired_size(&self, available_size: TPoint) -> TPoint
Parents call this to get the desired size of the child
This must not exceed
available_size on any axis
When the result’s product is equal to 0, this window wont be drawnSource§fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn alignment(&self) -> (HorizontalAlignment, VerticalAlignment)
fn border(&self) -> BorderStyle
fn is_visible(&self) -> bool
fn margin(&self) -> Thickness
Source§fn desired_size_pre_hook(&mut self, available_size: TPoint)
fn desired_size_pre_hook(&mut self, available_size: TPoint)
This is similar to desired_size but will not return anything and can mutably change self
This is executed before WindowLayout::desired_size
Only implement if actually necessary
Auto Trait Implementations§
impl !RefUnwindSafe for Stackpanel
impl !Send for Stackpanel
impl !Sync for Stackpanel
impl !UnwindSafe for Stackpanel
impl Freeze for Stackpanel
impl Unpin for Stackpanel
impl UnsafeUnpin for Stackpanel
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
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> WindowHelper for Twhere
T: Window,
impl<T> WindowHelper for Twhere
T: Window,
Source§fn provoke_changed_property(&self, property: WindowProperty)
fn provoke_changed_property(&self, property: WindowProperty)
Helper method for WindowEventQueue::provoke_changed_property