1 /// Fluid is a somewhat minimalistic and declarative high-level UI library for D.
2 ///
3 /// Fluid aims to be as simple in usage as it can be making as much possible with no excess of code. It's built
4 /// empirically, making each component suitable for all the most common needs out of the box.
5 ///
6 /// ---
7 /// auto node = label("Hello, World!");
8 /// node.draw();
9 /// ---
10 module fluid;
11 
12 public import
13     fluid.backend,
14     fluid.actions,
15     fluid.button,
16     fluid.children,
17     fluid.default_theme,
18     fluid.file_input,
19     fluid.frame,
20     fluid.grid,
21     fluid.hover_button,
22     fluid.image_view,
23     fluid.input,
24     fluid.label,
25     fluid.map_space,
26     fluid.node,
27     fluid.onion_frame,
28     fluid.popup_button,
29     fluid.popup_frame,
30     fluid.scroll,
31     fluid.scroll_input,
32     fluid.size_lock,
33     fluid.slot,
34     fluid.space,
35     fluid.structs,
36     fluid.style,
37     fluid.text_input,
38     fluid.utils;
39 
40 unittest {
41 
42     auto root = onionFrame(
43         .layout!"fill",
44 
45         vframe(
46             label("Hello, World!"),
47             button("Some input", delegate { }),
48         ),
49 
50         hframe(
51             imageView("logo.png"),
52             textInput("Input text here"),
53         ),
54 
55         popupButton(
56             "Click me!",
57             vspace(
58                 hspace(.layout!"fill", vscrollInput()),
59                 hscrollFrame(label("Hello, World!")),
60             ),
61         ),
62     );
63 
64 }
65 
66 unittest {
67 
68     import std.math;
69 
70     auto io = new HeadlessBackend;
71     auto root = vspace(
72         .layout!"center",
73         label(.layout!"center", "Hello World from"),
74         imageView("./logo.png", Vector2(499, 240)),
75     );
76 
77     root.io = io;
78     root.draw();
79 
80     // This should render two textures
81     auto textTexture = io.textures.front;
82     io.textures.popFront;
83     auto imageView = io.textures.front;
84 
85     // Both textures should have the same bottom line
86     assert(textTexture.rectangle.end.y.isClose(imageView.rectangle.end.y));
87 
88 }