1#![doc = include_str!("../README.md")]
2
3use fltk::{prelude::*, app::App};
4
5
6#[cfg(feature = "id_map")]
7#[macro_use]
8extern crate lazy_static;
9
10pub mod extensions;
12
13#[cfg(feature = "id_map")]
14mod id_map;
15#[cfg(feature = "id_map")]
16pub use id_map::{get_widget_by_id, IdMapError};
17
18#[derive(Debug)]
20pub struct FltkBuilder<W>
21where W: WindowExt {
22 app: App,
23 window: Option<W>
24}
25
26impl<W> FltkBuilder<W>
27where W: WindowExt
28{
29 pub fn new(app: App) -> Self { Self { app, window: None } }
31
32 #[must_use]
34 pub fn app(&self) -> App {
35 self.app
36 }
37
38 pub fn window(mut self, window: W) -> Self{
40 window.end();
41 self.window = Some(window);
42 self
43 }
44
45 pub fn show(&mut self) {
47 if self.window.is_some() {
48 let win = self.window.as_mut().unwrap();
49 win.show();
50 }
51 }
52
53 #[must_use]
55 pub fn get_window_mut(&mut self) -> &mut Option<W> {
56 &mut self.window
57 }
58}
59
60pub mod prelude;