1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// (C) 2025 - Enzo Lombardi
//! Application module providing the main application structure and event loop.
//!
//! This module contains the [`Application`] type which serves as the central
//! coordinator for Turbo Vision applications. It manages:
//! - The terminal instance
//! - The desktop (root container for all windows)
//! - Optional menu bar and status line
//! - The main event loop
//! - Modal dialog execution
//!
//! # Architecture
//!
//! A Turbo Vision application follows this structure:
//!
//! ```text
//! Application
//! ├── Terminal (rendering backend)
//! ├── Desktop (window manager)
//! │ ├── Background
//! │ └── Windows/Dialogs
//! ├── MenuBar (optional)
//! └── StatusLine (optional)
//! ```
//!
//! # Examples
//!
//! Basic application with event loop:
//!
//! ```rust,no_run
//! use turbo_vision::app::Application;
//! use turbo_vision::views::View;
//! use turbo_vision::core::error::Result;
//! use turbo_vision::core::event::EventType;
//! use turbo_vision::core::command::CM_QUIT;
//!
//! fn main() -> Result<()> {
//! let mut app = Application::new()?;
//!
//! app.running = true;
//! while app.running {
//! // Draw
//! app.desktop.draw(&mut app.terminal);
//! app.terminal.flush()?;
//!
//! // Handle events
//! if let Ok(Some(mut event)) = app.terminal.poll_event(
//! std::time::Duration::from_millis(50)
//! ) {
//! app.desktop.handle_event(&mut event);
//!
//! if event.what == EventType::Command && event.command == CM_QUIT {
//! app.running = false;
//! }
//! }
//! }
//!
//! app.terminal.shutdown()?;
//! Ok(())
//! }
//! ```
pub use Application;