Skip to main content

retroglyph_ui/widget/
list_direction.rs

1//! [`ListDirection`]: which end of a [`List`](super::List)'s area its items render from.
2
3/// Which end of a [`List`](super::List)'s area its items render from.
4///
5/// [`ListDirection::TopToBottom`] is the default: `items[state.offset()]` draws at the top row
6/// and later items draw downward, the list's only behavior before this type existed.
7/// [`ListDirection::BottomToTop`] draws the same window from the bottom of the area instead:
8/// `items[state.offset()]` draws at the bottom row and later items draw upward, for a
9/// chat/log-style list that grows toward the top.
10#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
11pub enum ListDirection {
12    /// `items[state.offset()]` draws at the top of the area; later items draw downward.
13    #[default]
14    TopToBottom,
15    /// `items[state.offset()]` draws at the bottom of the area; later items draw upward.
16    BottomToTop,
17}