Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Widgets Overview

ashell includes three custom iced widgets in src/widgets/ that provide functionality not available in iced’s built-in widget set.

Custom Widgets

WidgetFilePurpose
Centerboxwidgets/centerbox.rsThree-column layout that keeps the center truly centered
PositionButtonwidgets/position_button.rsButton that reports its screen position on press
MenuWrapperwidgets/menu_wrapper.rsMenu container with backdrop and click-outside-to-close

ButtonUIRef

Defined in widgets/mod.rs, this type carries a button’s screen position and size:

#![allow(unused)]
fn main() {
#[derive(Debug, Clone, Default)]
pub struct ButtonUIRef {
    pub position: Point,
    pub size: Size,
}
}

This is used by PositionButton to tell the menu system where to position popup menus relative to the button that triggered them.

Why Custom Widgets?

iced provides a rich set of built-in widgets (buttons, text, rows, columns, containers, sliders, etc.), but a status bar has specific needs:

  • Centerbox: iced’s Row doesn’t guarantee the center element stays centered when left/right content has different widths.
  • PositionButton: Standard iced buttons don’t report their screen position, which is needed for menu placement.
  • MenuWrapper: No built-in support for modal overlays with backdrop click-to-close.