pub struct CategoryNavigationBar {
id: Id,
pub rect: Rectangle,
children: Vec<Box<dyn View>>,
pub selected: Category,
}Expand description
Horizontal navigation bar displaying category tabs.
This component shows all available settings categories as horizontal tabs,
wrapping onto additional rows when the categories no longer fit on a single
line. The selected category is visually highlighted. The bar’s height is
determined by SettingsCategoryProvider::estimate_line_count, which must
match the number of rows required.
§Structure
┌─────────────────────────────────────────────┐
│ [General] [Libraries] [Intermissions] ... │
│ [OtherCategory] ... │
└─────────────────────────────────────────────┘Fields§
§id: Id§rect: Rectangle§children: Vec<Box<dyn View>>§selected: CategoryImplementations§
pub fn new(rect: Rectangle, selected: Category) -> Self
pub fn update_content(&mut self, selected: Category, fonts: &mut Fonts)
Layout all category buttons in rows, distributing vertical space evenly.
This method implements a two-pass layout algorithm:
§Pass 1: Horizontal measurement
Each category is measured to determine its button width. Categories are packed left-to-right; when a button doesn’t fit, a new row begins.
§Pass 2: Vertical distribution
Available vertical space is divided evenly using the baseline method (same
as DirectoriesBar). For row_count rows, the total non-text space is
divided into row_count + 1 gaps. Each row claims big_half of the gap
above it and small_half of the gap below. This ensures consistent
centering regardless of the number of rows.
§Child views:
Background fillers are added to cover all non-button regions (top strip, left margin per row, trailing space per row, bottom strip) to prevent stale framebuffer content from showing through.
pub fn update_selection(&mut self, selected: Category, fonts: &mut Fonts)
pub fn resize_by(&mut self, _delta_y: i32, _fonts: &mut Fonts) -> i32
pub fn shift(&mut self, delta: Point)
Trait Implementations§
fn handle_event( &mut self, _evt: &Event, _hub: &Hub, _bus: &mut Bus, _rq: &mut RenderQueue, _context: &mut Context, ) -> bool
fn render( &self, _fb: &mut dyn Framebuffer, _rect: Rectangle, _fonts: &mut Fonts, )
fn rect(&self) -> &Rectangle
fn rect_mut(&mut self) -> &mut Rectangle
fn children(&self) -> &Vec<Box<dyn View>>
fn children_mut(&mut self) -> &mut Vec<Box<dyn View>>
fn id(&self) -> Id
fn render_rect(&self, _rect: &Rectangle) -> Rectangle
fn resize( &mut self, rect: Rectangle, _hub: &Hub, _rq: &mut RenderQueue, _context: &mut Context, )
fn child(&self, index: usize) -> &dyn View
fn child_mut(&mut self, index: usize) -> &mut dyn View
fn len(&self) -> usize
fn might_skip(&self, _evt: &Event) -> bool
fn might_rotate(&self) -> bool
fn is_background(&self) -> bool
fn view_id(&self) -> Option<ViewId>
Auto Trait Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more