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