2019-02-02 08:59:48 +08:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en_US">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
html, body, textarea{
|
|
|
|
margin:0;
|
|
|
|
padding:0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
overflow:hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
background-color:gray;
|
|
|
|
};
|
|
|
|
|
|
|
|
textarea {
|
|
|
|
white-space: pre-wrap;
|
|
|
|
background-color:white;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/c++">
|
|
|
|
#include <iostream>
|
|
|
|
|
2020-05-25 07:34:13 +08:00
|
|
|
#include <ftxui/screen/screen.hpp>
|
|
|
|
#include <ftxui/dom/elements.hpp>
|
2019-02-02 08:59:48 +08:00
|
|
|
|
|
|
|
int main() {
|
|
|
|
using namespace ftxui;
|
|
|
|
auto document =
|
|
|
|
hbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
window(text(" main frame ") | hcenter,
|
2019-02-02 08:59:48 +08:00
|
|
|
vbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
text("Line 1"),
|
|
|
|
text("Line 2"),
|
|
|
|
text("Line 3"),
|
2019-02-02 08:59:48 +08:00
|
|
|
vbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
text("Line 4"),
|
|
|
|
text("Line 5"),
|
|
|
|
text("Line 6")
|
2019-02-02 08:59:48 +08:00
|
|
|
) | border,
|
|
|
|
hbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
window(text("frame 2"),
|
2019-02-02 08:59:48 +08:00
|
|
|
vbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
text("Line 4"),
|
2019-02-02 08:59:48 +08:00
|
|
|
gauge(0.5) | border,
|
2021-08-09 06:27:37 +08:00
|
|
|
text("Line 6")
|
2019-02-02 08:59:48 +08:00
|
|
|
)
|
|
|
|
),
|
2021-08-09 06:27:37 +08:00
|
|
|
window(text("frame 3"),
|
2019-02-02 08:59:48 +08:00
|
|
|
vbox(
|
2021-08-09 06:27:37 +08:00
|
|
|
text("Line 7"),
|
|
|
|
text("Line 8"),
|
|
|
|
text("Line 9")
|
2019-02-02 08:59:48 +08:00
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
2021-08-09 06:27:37 +08:00
|
|
|
text("footer footer footer footer footer")
|
2019-02-02 08:59:48 +08:00
|
|
|
)
|
|
|
|
),
|
|
|
|
filler()
|
|
|
|
);
|
|
|
|
auto screen = Screen::Create(Dimension::Fit(document));
|
2020-05-21 03:23:59 +08:00
|
|
|
Render(screen, document);
|
2019-02-02 08:59:48 +08:00
|
|
|
std::cout << screen.ToString() << std::endl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<textarea id="box"></textarea>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
window.Module = {
|
|
|
|
'print': function(text) {
|
|
|
|
console.log(text);
|
|
|
|
document.getElementById("box").value += text + '\n';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</html>
|