rat_widget/
lib.rs

1#![doc = include_str!("../readme.md")]
2//
3#![allow(clippy::collapsible_else_if)]
4#![allow(clippy::collapsible_if)]
5#![allow(clippy::if_same_then_else)]
6#![allow(clippy::clone_on_copy)]
7#![allow(clippy::assigning_clones)]
8
9pub mod event {
10    //!
11    //! Event-handler traits and Keybindings.
12    //!
13    //! See [rat-event](https://docs.rs/rat-event/latest/rat_event/)
14    //!
15    pub use rat_event::*;
16
17    pub use crate::button::event::ButtonOutcome;
18    pub use crate::calendar::event::CalOutcome;
19    pub use crate::checkbox::event::CheckOutcome;
20    pub use crate::choice::event::ChoiceOutcome;
21    pub use crate::file_dialog::event::FileOutcome;
22    pub use crate::pager::event::PagerOutcome;
23    pub use crate::radio::event::RadioOutcome;
24    pub use crate::slider::event::SliderOutcome;
25    pub use crate::tabbed::event::TabbedOutcome;
26    pub use rat_ftable::event::{DoubleClickOutcome, EditOutcome, TableOutcome};
27    pub use rat_menu::event::MenuOutcome;
28    pub use rat_popup::event::PopupOutcome;
29    pub use rat_scrolled::event::ScrollOutcome;
30    pub use rat_text::event::{ReadOnly, TextOutcome};
31}
32
33/// Module for focus-handling functionality.
34/// See [rat-focus](https://docs.rs/rat-focus)
35pub mod focus {
36    pub use rat_focus::{
37        handle_focus, impl_has_focus, match_focus, on_gained, on_lost, Focus, FocusBuilder,
38        FocusFlag, HasFocus, Navigation,
39    };
40}
41
42/// Layout calculations apart from ratatui/Layout.
43pub mod layout;
44
45/// Trait for relocatable widgets.
46/// See also [rat-reloc](https://docs.rs/rat-reloc/latest/rat_reloc/)
47pub mod reloc {
48    pub use rat_reloc::{
49        impl_relocatable_state, relocate_area, relocate_areas, relocate_position,
50        relocate_positions, RelocatableState,
51    };
52}
53
54/// Scroll attribute and event-handling.
55/// See [rat-scrolled](https://docs.rs/rat-scrolled/latest/rat_scrolled/)
56pub mod scrolled {
57    pub use rat_scrolled::{
58        Scroll, ScrollArea, ScrollAreaState, ScrollState, ScrollStyle, ScrollSymbols,
59        ScrollbarPolicy, SCROLLBAR_DOUBLE_HORIZONTAL, SCROLLBAR_DOUBLE_VERTICAL,
60        SCROLLBAR_HORIZONTAL, SCROLLBAR_VERTICAL,
61    };
62}
63
64/// Text editing core functionality and utilities.
65pub mod text {
66    pub use rat_text::clipboard;
67    pub use rat_text::core;
68    pub use rat_text::undo_buffer;
69    pub use rat_text::{
70        impl_screen_cursor, ipos_type, screen_cursor, upos_type, Cursor, Glyph, Grapheme,
71        HasScreenCursor, Locale, TextError, TextFocusGained, TextFocusLost, TextPosition,
72        TextRange, TextStyle,
73    };
74}
75
76// --- widget modules here --- (alphabetical)
77
78pub mod button;
79pub mod calendar;
80pub mod checkbox;
81pub mod choice;
82pub mod clipper;
83/// Date input with patterns from chrono.
84/// See also [rat-text](https://docs.rs/rat-text/latest/rat_text/)
85pub mod date_input {
86    pub use rat_text::date_input::{
87        handle_events, handle_mouse_events, handle_readonly_events, DateInput, DateInputState,
88    };
89}
90pub mod file_dialog;
91pub mod hover;
92/// Line numbers widget.
93/// For use with TextArea mostly.
94pub mod line_number {
95    pub use rat_text::line_number::{LineNumberState, LineNumberStyle, LineNumbers};
96}
97pub mod list;
98/// Menu widgets.
99/// See also [rat-menu](https://docs.rs/rat-menu/latest/rat_menu/)
100pub mod menu {
101    pub use rat_menu::menubar::{Menubar, MenubarLine, MenubarPopup, MenubarState};
102    pub use rat_menu::menuitem::{MenuItem, Separator};
103    pub use rat_menu::menuline::{MenuLine, MenuLineState};
104    pub use rat_menu::popup_menu::{PopupConstraint, PopupMenu, PopupMenuState};
105    pub use rat_menu::{MenuBuilder, MenuStructure, MenuStyle, StaticMenu};
106
107    pub mod menubar {
108        pub use rat_menu::menubar::{handle_mouse_events, handle_popup_events};
109    }
110    pub mod menuline {
111        pub use rat_menu::menuline::{handle_events, handle_mouse_events};
112    }
113    pub mod popup_menu {
114        pub use rat_menu::popup_menu::{handle_mouse_events, handle_popup_events};
115    }
116}
117pub mod msgdialog;
118/// Number input with a number pattern.
119/// See [rat-text](https://docs.rs/rat-text/latest/rat_text/)
120pub mod number_input {
121    pub use rat_text::number_input::{
122        handle_events, handle_mouse_events, handle_readonly_events, NumberInput, NumberInputState,
123    };
124}
125pub mod pager;
126pub mod paired;
127pub mod paragraph;
128/// PopupCore helps with managing popup widgets.
129/// See also [rat-popup](https://docs.rs/rat-popup/latest/rat_popup/)
130pub mod popup {
131    pub use rat_popup::{Placement, PopupConstraint, PopupCore, PopupCoreState, PopupStyle};
132}
133pub mod radio;
134pub mod shadow;
135pub mod splitter;
136pub mod statusline;
137/// Table widget.
138///
139/// Can be used as a drop-in replacement for the ratatui table. But
140/// that's not the point of this widget.
141///
142/// This widget uses the [TableData](crate::table::TableData) trait instead
143/// of rendering all the table-cells and putting them into a Vec.
144/// This way rendering time only depends on the screen-size not on
145/// the size of your data.
146///
147/// There is a second trait [TableDataIter](crate::table::TableDataIter) that
148/// works better if you only have an Iterator over your data.
149///
150/// See [rat-ftable](https://docs.rs/rat-ftable/latest/rat_ftable/)
151pub mod table {
152    pub use rat_ftable::{
153        edit, selection, textdata, Table, TableContext, TableData, TableDataIter, TableSelection,
154        TableState, TableStyle,
155    };
156}
157pub mod tabbed;
158/// Text-Input widget.
159/// See [rat-text](https://docs.rs/rat-text/latest/rat_text/)
160pub mod text_input {
161    pub use rat_text::text_input::{
162        handle_events, handle_mouse_events, handle_readonly_events, TextInput, TextInputState,
163    };
164}
165/// Text-Input with pattern/mask.
166/// See [rat-text](https://docs.rs/rat-text/latest/rat_text/)
167pub mod text_input_mask {
168    pub use rat_text::text_input_mask::{
169        handle_events, handle_mouse_events, handle_readonly_events, MaskedInput, MaskedInputState,
170    };
171}
172/// Text-Area.
173/// See [rat-text](https://docs.rs/rat-text/latest/rat_text/)
174pub mod textarea {
175    pub use rat_text::text_area::{
176        handle_events, handle_mouse_events, handle_readonly_events, TextArea, TextAreaState,
177    };
178}
179pub mod range_op;
180pub mod slider;
181pub mod util;
182pub mod view;
183
184mod _private {
185    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
186    pub struct NonExhaustive;
187}