38 auto my_graph = [&shift](
int width,
int height) {
39 std::vector<int> output(width);
40 for (
int i = 0; i < width; ++i) {
42 v += 0.1f * sin((i + shift) * 0.1f);
43 v += 0.2f * sin((i + shift + 10) * 0.15f);
44 v += 0.1f * sin((i + shift) * 0.03f);
52 auto frequency =
vbox({
66 auto utilization =
vbox({
110 const std::vector<std::string> compiler_entries = {
116 "ALGOL 60 compilers",
117 "ALGOL 68 compilers",
118 "Assemblers (Intel *86)",
119 "Assemblers (Motorola 68*)",
120 "Assemblers (Zilog Z80)",
121 "Assemblers (other)",
123 "BASIC interpreters",
126 "Source-to-source compilers",
130 "Common Lisp compilers",
132 "DIBOL/DBL compilers",
133 "ECMAScript interpreters",
144 "Scheme compilers and interpreters",
145 "Smalltalk compilers",
152 int compiler_selected = 0;
155 std::array<std::string, 8> options_label = {
161 "-Wno-class-conversion",
163 "-Wno-conversion-null",
165 std::array<bool, 8> options_state = {
166 false,
false,
false,
false,
false,
false,
false,
false,
169 std::vector<std::string> input_entries;
170 int input_selected = 0;
174 std::string input_add_content;
175 input_option.on_enter = [&] {
176 input_entries.push_back(input_add_content);
177 input_add_content =
"";
179 Component input_add =
Input(&input_add_content,
"input files", input_option);
181 std::string executable_content_ =
"";
182 Component executable_ =
Input(&executable_content_,
"executable");
185 Checkbox(&options_label[0], &options_state[0]),
186 Checkbox(&options_label[1], &options_state[1]),
187 Checkbox(&options_label[2], &options_state[2]),
188 Checkbox(&options_label[3], &options_state[3]),
189 Checkbox(&options_label[4], &options_state[4]),
190 Checkbox(&options_label[5], &options_state[5]),
191 Checkbox(&options_label[6], &options_state[6]),
192 Checkbox(&options_label[7], &options_state[7]),
195 auto compiler_component = Container::Horizontal({
198 Container::Vertical({
200 Container::Horizontal({
207 auto render_command = [&] {
210 line.push_back(
text(compiler_entries[compiler_selected]) | bold);
212 for (
int i = 0; i < 8; ++i) {
213 if (options_state[i]) {
214 line.push_back(
text(
" "));
215 line.push_back(
text(options_label[i]) | dim);
219 if (!executable_content_.empty()) {
220 line.push_back(
text(
" -o ") | bold);
225 for (
auto& it : input_entries) {
231 auto compiler_renderer =
Renderer(compiler_component, [&] {
233 compiler->
Render() | vscroll_indicator | frame);
248 input->
Render() | vscroll_indicator | frame |
269 auto spinner_tab_renderer =
Renderer([&] {
271 for (
int i = 0; i < 22; ++i) {
272 entries.push_back(
spinner(i, shift / 5) | bold |
275 return hflow(std::move(entries));
281 auto color_tab_renderer =
Renderer([] {
282 auto basic_color_display =
284 text(
"16 color palette:"),
329 auto palette_256_color_display =
text(
"256 colors palette:");
333 for (
auto& column : info_columns) {
335 for (
auto& it : column) {
336 column_elements.push_back(
339 columns.push_back(
hbox(std::move(column_elements)));
341 palette_256_color_display =
vbox({
342 palette_256_color_display,
350 auto true_color_display =
text(
"TrueColors: 24bits:");
352 int saturation = 255;
354 for (
int value = 0; value < 255; value += 16) {
356 for (
int hue = 0; hue < 255; hue += 6) {
357 line.push_back(
text(
"▀")
361 array.push_back(
hbox(std::move(line)));
363 true_color_display =
vbox({
366 vbox(std::move(array)),
374 palette_256_color_display,
383 auto render_gauge = [&shift](
int delta) {
384 float progress = (shift + delta) % 500 / 500.f;
386 text(std::to_string(
int(progress * 100)) +
"% ") |
392 auto gauge_component =
Renderer([render_gauge] {
417 auto make_box = [](
size_t dimx,
size_t dimy) {
418 std::string title = std::to_string(dimx) +
"x" + std::to_string(dimy);
420 text(
"content") | hcenter | dim) |
424 auto paragraph_renderer_left =
Renderer([&] {
426 "Lorem Ipsum is simply dummy text of the printing and typesetting "
427 "industry.\nLorem Ipsum has been the industry's standard dummy text "
428 "ever since the 1500s, when an unknown printer took a galley of type "
429 "and scrambled it to make a type specimen book.";
456 vscroll_indicator | yframe | flex;
459 auto paragraph_renderer_right =
Renderer([] {
460 return paragraph(
"<--- This vertical bar is resizable using the mouse") |
464 int paragraph_renderer_split_position = Terminal::Size().dimx / 2;
465 auto paragraph_renderer_group =
467 ¶graph_renderer_split_position);
468 auto paragraph_renderer_group_renderer =
470 [&] {
return paragraph_renderer_group->Render(); });
477 std::vector<std::string> tab_entries = {
478 "htop",
"color",
"spinner",
"gauge",
"compiler",
"paragraph",
482 auto tab_content = Container::Tab(
486 spinner_tab_renderer,
489 paragraph_renderer_group_renderer,
496 auto main_container = Container::Vertical({
497 Container::Horizontal({
504 auto main_renderer =
Renderer(main_container, [&] {
508 tab_selection->Render() |
flex,
509 exit_button->Render(),
515 Loop loop(&screen, main_renderer);
516 while (!loop.HasQuitted()) {