tile/
tile.rs

1use fltk::{enums::*, prelude::*, *};
2
3fn main() {
4    let app = app::App::default();
5    let mut window = window::Window::default().with_size(300, 300);
6    window.set_frame(FrameType::NoBox);
7    window.make_resizable(true);
8
9    let dx = 20;
10    let dy = dx; // border width of resizable() - see below
11    let tile = group::Tile::default_fill();
12
13    // create the symmetrical resize box with dx and dy pixels distance, resp.
14    // from the borders of the Fl_Tile widget before all other children
15    let r = frame::Frame::new(
16        tile.x() + dx,
17        tile.y() + dy,
18        tile.w() - 2 * dx,
19        tile.h() - 2 * dy,
20        None,
21    );
22    tile.resizable(&r);
23
24    let mut box0 = frame::Frame::new(0, 0, 150, 150, "0");
25    box0.set_frame(FrameType::DownBox);
26    box0.set_color(Color::by_index(9));
27    box0.set_label_size(36);
28    box0.set_align(Align::Clip);
29
30    let mut w1 = window::Window::new(150, 0, 150, 150, "1");
31    w1.set_frame(FrameType::NoBox);
32    let mut box1 = frame::Frame::new(0, 0, 150, 150, "1\nThis is a child window");
33    box1.set_frame(FrameType::DownBox);
34    box1.set_color(Color::by_index(19));
35    box1.set_label_size(18);
36    box1.set_align(Align::Clip | Align::Inside | Align::Wrap);
37    w1.resizable(&box1);
38    w1.end();
39
40    let mut box2a = frame::Frame::new(0, 150, 70, 150, "2a");
41    box2a.set_frame(FrameType::DownBox);
42    box2a.set_color(Color::by_index(12));
43    box2a.set_label_size(36);
44    box2a.set_align(Align::Clip);
45
46    let mut box2b = frame::Frame::new(70, 150, 80, 150, "2b");
47    box2b.set_frame(FrameType::DownBox);
48    box2b.set_color(Color::by_index(13));
49    box2b.set_label_size(36);
50    box2b.set_align(Align::Clip);
51
52    let mut box3a = frame::Frame::new(150, 150, 150, 70, "3a");
53    box3a.set_frame(FrameType::DownBox);
54    box3a.set_color(Color::by_index(12));
55    box3a.set_label_size(36);
56    box3a.set_align(Align::Clip);
57
58    let mut box3b = frame::Frame::new(150, 150 + 70, 150, 80, "3b");
59    box3b.set_frame(FrameType::DownBox);
60    box3b.set_color(Color::by_index(13));
61    box3b.set_label_size(36);
62    box3b.set_align(Align::Clip);
63
64    tile.end();
65    window.end();
66
67    w1.show();
68    window.show();
69
70    app.run().unwrap();
71}