Automatically fix style.

This commit is contained in:
ArthurSonzogni 2020-09-06 13:46:56 +02:00 committed by Arthur Sonzogni
parent d09996a6c7
commit 5291f660ca
50 changed files with 197 additions and 190 deletions

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/button.hpp" #include "ftxui/component/button.hpp"
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
@ -46,3 +42,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&component); screen.Loop(&component);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/checkbox.hpp" #include "ftxui/component/checkbox.hpp"
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&component); screen.Loop(&component);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/checkbox.hpp" #include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp" #include "ftxui/component/input.hpp"
@ -47,3 +43,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,9 +1,5 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/button.hpp" #include "ftxui/component/button.hpp"
#include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp" #include "ftxui/component/input.hpp"
#include "ftxui/component/menu.hpp" #include "ftxui/component/menu.hpp"
@ -100,3 +96,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <cmath> #include <cmath>
#include <thread> #include <thread>
@ -385,3 +381,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/input.hpp" #include "ftxui/component/input.hpp"
#include <iostream> #include <iostream>
@ -48,3 +44,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/menu.hpp" #include "ftxui/component/menu.hpp"
#include <chrono> #include <chrono>
@ -23,3 +19,7 @@ int main(int argc, const char* argv[]) {
std::cout << "Selected element = " << menu.selected << std::endl; std::cout << "Selected element = " << menu.selected << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
#include <thread> #include <thread>
@ -81,3 +77,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <iostream> #include <iostream>
#include <thread> #include <thread>
@ -75,3 +71,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/button.hpp" #include "ftxui/component/button.hpp"
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
@ -24,7 +20,7 @@ class Content : public Component {
} }
Element Render() final { Element Render() final {
auto button_elements= hbox({ auto button_elements = hbox({
button_rate_ftxui.Render(), button_rate_ftxui.Render(),
filler(), filler(),
button_quit_.Render(), button_quit_.Render(),
@ -126,3 +122,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&my_component); screen.Loop(&my_component);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/radiobox.hpp" #include "ftxui/component/radiobox.hpp"
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
@ -22,3 +18,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&radiobox); screen.Loop(&radiobox);
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/checkbox.hpp" #include "ftxui/component/checkbox.hpp"
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp" #include "ftxui/component/input.hpp"
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <iostream> #include <iostream>
#include <thread> #include <thread>
@ -68,3 +64,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <iostream> #include <iostream>
#include "ftxui/component/container.hpp" #include "ftxui/component/container.hpp"
@ -62,3 +58,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include "ftxui/component/toggle.hpp" #include "ftxui/component/toggle.hpp"
#include <chrono> #include <chrono>
@ -64,3 +60,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure(); component.on_enter = screen.ExitLoopClosure();
screen.Loop(&component); screen.Loop(&component);
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -34,3 +30,7 @@ int main(int argc, const char* argv[]) {
Render(screen, document); Render(screen, document);
std::cout << screen.ToString() << std::endl; std::cout << screen.ToString() << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp> #include <ftxui/screen/terminal.hpp>
@ -107,3 +103,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,14 +1,10 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <algorithm> #include <algorithm>
#include <ftxui/screen/terminal.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/color_info.hpp> #include <ftxui/screen/color_info.hpp>
#include "ftxui/screen/string.hpp" #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
#include <iostream> #include <iostream>
#include "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;
@ -55,29 +51,32 @@ int main(int argc, const char* argv[]) {
best_index = j; best_index = j;
} }
} }
std::swap(column[i+1], column[best_index]); std::swap(column[i + 1], column[best_index]);
} }
} }
// Draw every columns // Draw every columns
Elements columns_elements; Elements columns_elements;
for(auto& column : info_columns) { for (auto& column : info_columns) {
Elements column_elements; Elements column_elements;
for(auto& it : column) { for (auto& it : column) {
column_elements.push_back(hbox({ column_elements.push_back(hbox({
text(L" ") | bgcolor(Color(Color::Palette256(it.index))), text(L" ") | bgcolor(Color(Color::Palette256(it.index))),
text(to_wstring(std::string(it.name))), text(to_wstring(std::string(it.name))),
})); }));
} }
columns_elements.push_back(vbox(std::move(column_elements))); columns_elements.push_back(vbox(std::move(column_elements)));
} }
auto document = hbox(std::move(columns_elements)); auto document = hbox(std::move(columns_elements));
auto screen = auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document); Render(screen, document);
std::cout << screen.ToString(); std::cout << screen.ToString();
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp> #include <ftxui/screen/terminal.hpp>
@ -30,3 +26,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <cmath> #include <cmath>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -53,3 +49,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -25,3 +21,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -30,3 +26,7 @@ int main(int argc, const char* argv[]) {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <cmath> #include <cmath>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
@ -74,3 +70,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp> #include <ftxui/screen/string.hpp>
@ -47,3 +43,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -54,3 +50,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -143,3 +139,7 @@ int main(int argc, const char* argv[]) {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp> #include <ftxui/screen/string.hpp>
@ -34,3 +30,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -27,3 +23,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <ftxui/screen/string.hpp> #include <ftxui/screen/string.hpp>
@ -26,3 +22,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <chrono> #include <chrono>
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
@ -39,3 +35,7 @@ int main(int argc, const char* argv[]) {
} }
std::cout << std::endl; std::cout << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -60,3 +56,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -28,3 +24,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -20,3 +16,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
return 0; return 0;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -1,7 +1,3 @@
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/elements.hpp> #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp> #include <ftxui/screen/screen.hpp>
#include <iostream> #include <iostream>
@ -13,3 +9,7 @@ int main(int argc, const char* argv[]) {
Render(screen, document); Render(screen, document);
std::cout << screen.ToString() << std::endl; std::cout << screen.ToString() << std::endl;
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -7,7 +7,8 @@
namespace ftxui { namespace ftxui {
/// @brief A Checkbox. It can be checked or unchecked.Display an element on a ftxui::Screen. /// @brief A Checkbox. It can be checked or unchecked.Display an element on a
/// ftxui::Screen.
/// @ingroup dom /// @ingroup dom
class CheckBox : public Component { class CheckBox : public Component {
public: public:
@ -15,19 +16,19 @@ class CheckBox : public Component {
CheckBox() = default; CheckBox() = default;
~CheckBox() override = default; ~CheckBox() override = default;
bool state = false; // The current state. true=checked, false:unchecked. bool state = false; // The current state. true=checked, false:unchecked.
std::wstring label = L"label"; // The CheckBox label. std::wstring label = L"label"; // The CheckBox label.
#if defined(_WIN32) #if defined(_WIN32)
std::wstring checked = L"[X] "; /// Prefix for a "checked" state. std::wstring checked = L"[X] "; /// Prefix for a "checked" state.
std::wstring unchecked = L"[ ] "; /// Prefix for an "unchecked" state. std::wstring unchecked = L"[ ] "; /// Prefix for an "unchecked" state.
#else #else
std::wstring checked = L""; /// Prefix for a "checked" state. std::wstring checked = L""; /// Prefix for a "checked" state.
std::wstring unchecked = L""; /// Prefix for a "unchecked" state. std::wstring unchecked = L""; /// Prefix for a "unchecked" state.
#endif #endif
Decorator focused_style = inverted; /// Decorator used when focused. Decorator focused_style = inverted; /// Decorator used when focused.
Decorator unfocused_style = nothing; /// Decorator used when unfocused. Decorator unfocused_style = nothing; /// Decorator used when unfocused.
/// Called when the user change the state of the CheckBox. /// Called when the user change the state of the CheckBox.
std::function<void()> on_change = []() {}; std::function<void()> on_change = []() {};

View File

@ -11,9 +11,9 @@ namespace ftxui {
class Color { class Color {
public: public:
enum Palette16 : uint8_t; enum Palette16 : uint8_t;
enum Palette256: uint8_t; enum Palette256 : uint8_t;
Color(); // Transparent. Color(); // Transparent.
Color(Palette16 index); // Implicit conversion from index to Color. Color(Palette16 index); // Implicit conversion from index to Color.
Color(Palette256 index); // Implicit conversion from index to Color. Color(Palette256 index); // Implicit conversion from index to Color.
Color(uint8_t red, uint8_t green, uint8_t blue); Color(uint8_t red, uint8_t green, uint8_t blue);

View File

@ -21,3 +21,7 @@ ColorInfo GetColorInfo(Color::Palette256 index);
} // namespace ftxui } // namespace ftxui
#endif /* end of include guard: FTXUI_SCREEN_COLOR_INFO_HPP */ #endif /* end of include guard: FTXUI_SCREEN_COLOR_INFO_HPP */
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -6,7 +6,7 @@ namespace ftxui {
Element Button::Render() { Element Button::Render() {
if (Focused()) if (Focused())
return text(label) | border |inverted; return text(label) | border | inverted;
else else
return text(label) | border; return text(label) | border;
} }

View File

@ -121,7 +121,6 @@ void Component::Attach(Component* parent) {
parent_->children_.push_back(this); parent_->children_.push_back(this);
} }
} // namespace ftxui } // namespace ftxui
// Copyright 2020 Arthur Sonzogni. All rights reserved. // Copyright 2020 Arthur Sonzogni. All rights reserved.

View File

@ -48,7 +48,7 @@ Component* Container::ActiveChild() {
} }
void Container::SetActiveChild(Component* child) { void Container::SetActiveChild(Component* child) {
for(size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
if (children_[i] == child) { if (children_[i] == child) {
(selector_ ? *selector_ : selected_) = i; (selector_ ? *selector_ : selected_) = i;
return; return;

View File

@ -199,7 +199,7 @@ TEST(ContainerTest, SetActiveChild) {
} }
TEST(ContainerTest, TakeFocus) { TEST(ContainerTest, TakeFocus) {
auto c= Container::Horizontal(); auto c = Container::Horizontal();
auto c1 = Container::Vertical(); auto c1 = Container::Vertical();
auto c2 = Container::Vertical(); auto c2 = Container::Vertical();
auto c3 = Container::Vertical(); auto c3 = Container::Vertical();

View File

@ -245,7 +245,7 @@ static const std::vector<std::vector<std::vector<std::wstring>>> elements = {
/// ASCII art "video". /// ASCII art "video".
/// @param charset_index The type of "video". /// @param charset_index The type of "video".
/// @param image_index The "frame" of the video. You need to increase this for /// @param image_index The "frame" of the video. You need to increase this for
///every "step". /// every "step".
/// @ingroup dom /// @ingroup dom
Element spinner(int charset_index, size_t image_index) { Element spinner(int charset_index, size_t image_index) {
if (charset_index == 0) { if (charset_index == 0) {

View File

@ -268,3 +268,7 @@ ColorInfo GetColorInfo(Color::Palette256 index) {
// clang-format off // clang-format off
} }
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.

View File

@ -8,7 +8,7 @@ for file in $files
do do
if ! grep -q Copyright $file if ! grep -q Copyright $file
then then
cat $file ./other/license_headers.cpp > $file.new && mv $file.new $file cat $file ./tools/license_headers.cpp > $file.new && mv $file.new $file
fi fi
done done