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/component.hpp"
@ -46,3 +42,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&component);
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/component.hpp"
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&component);
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/container.hpp"
#include "ftxui/component/input.hpp"
@ -47,3 +43,7 @@ int main(int argc, const char* argv[]) {
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/checkbox.hpp"
#include "ftxui/component/container.hpp"
#include "ftxui/component/input.hpp"
#include "ftxui/component/menu.hpp"
@ -100,3 +96,7 @@ int main(int argc, const char* argv[]) {
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 <thread>
@ -385,3 +381,7 @@ int main(int argc, const char* argv[]) {
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 <iostream>
@ -48,3 +44,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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 <chrono>
@ -23,3 +19,7 @@ int main(int argc, const char* argv[]) {
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 <iostream>
#include <thread>
@ -81,3 +77,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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 <thread>
@ -75,3 +71,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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/component.hpp"
#include "ftxui/component/container.hpp"
@ -24,7 +20,7 @@ class Content : public Component {
}
Element Render() final {
auto button_elements= hbox({
auto button_elements = hbox({
button_rate_ftxui.Render(),
filler(),
button_quit_.Render(),
@ -126,3 +122,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&my_component);
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/component.hpp"
@ -22,3 +18,7 @@ int main(int argc, const char* argv[]) {
screen.Loop(&radiobox);
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/container.hpp"
#include "ftxui/component/input.hpp"
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
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 <thread>
@ -68,3 +64,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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 "ftxui/component/container.hpp"
@ -62,3 +58,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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 <chrono>
@ -64,3 +60,7 @@ int main(int argc, const char* argv[]) {
component.on_enter = screen.ExitLoopClosure();
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -34,3 +30,7 @@ int main(int argc, const char* argv[]) {
Render(screen, document);
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/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
@ -107,3 +103,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/screen/terminal.hpp>
#include <ftxui/dom/elements.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 "ftxui/screen/string.hpp"
int main(int argc, const char* argv[]) {
using namespace ftxui;
@ -55,29 +51,32 @@ int main(int argc, const char* argv[]) {
best_index = j;
}
}
std::swap(column[i+1], column[best_index]);
std::swap(column[i + 1], column[best_index]);
}
}
// Draw every columns
Elements columns_elements;
for(auto& column : info_columns) {
for (auto& column : info_columns) {
Elements column_elements;
for(auto& it : column) {
for (auto& it : column) {
column_elements.push_back(hbox({
text(L" ") | bgcolor(Color(Color::Palette256(it.index))),
text(to_wstring(std::string(it.name))),
text(L" ") | bgcolor(Color(Color::Palette256(it.index))),
text(to_wstring(std::string(it.name))),
}));
}
columns_elements.push_back(vbox(std::move(column_elements)));
}
auto document = hbox(std::move(columns_elements));
auto screen =
Screen::Create(Dimension::Full(), Dimension::Fit(document));
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << screen.ToString();
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/screen/screen.hpp>
#include <ftxui/screen/terminal.hpp>
@ -30,3 +26,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -53,3 +49,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -25,3 +21,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -30,3 +26,7 @@ int main(int argc, const char* argv[]) {
}
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 <cmath>
#include <ftxui/dom/elements.hpp>
@ -74,3 +70,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
@ -47,3 +43,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -54,3 +50,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -143,3 +139,7 @@ int main(int argc, const char* argv[]) {
}
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/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
@ -34,3 +30,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -27,3 +23,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <ftxui/screen/string.hpp>
@ -26,3 +22,7 @@ int main(int argc, const char* argv[]) {
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 <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
@ -39,3 +35,7 @@ int main(int argc, const char* argv[]) {
}
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/screen/screen.hpp>
#include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -60,3 +56,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -28,3 +24,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -20,3 +16,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -21,3 +17,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -36,3 +32,7 @@ int main(int argc, const char* argv[]) {
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/screen/screen.hpp>
#include <iostream>
@ -13,3 +9,7 @@ int main(int argc, const char* argv[]) {
Render(screen, document);
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 {
/// @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
class CheckBox : public Component {
public:
@ -15,19 +16,19 @@ class CheckBox : public Component {
CheckBox() = default;
~CheckBox() override = default;
bool state = false; // The current state. true=checked, false:unchecked.
std::wstring label = L"label"; // The CheckBox label.
bool state = false; // The current state. true=checked, false:unchecked.
std::wstring label = L"label"; // The CheckBox label.
#if defined(_WIN32)
std::wstring checked = L"[X] "; /// Prefix for a "checked" state.
std::wstring unchecked = L"[ ] "; /// Prefix for an "unchecked" state.
std::wstring checked = L"[X] "; /// Prefix for a "checked" state.
std::wstring unchecked = L"[ ] "; /// Prefix for an "unchecked" state.
#else
std::wstring checked = L""; /// Prefix for a "checked" state.
std::wstring unchecked = L""; /// Prefix for a "unchecked" state.
std::wstring checked = L""; /// Prefix for a "checked" state.
std::wstring unchecked = L""; /// Prefix for a "unchecked" state.
#endif
Decorator focused_style = inverted; /// Decorator used when focused.
Decorator unfocused_style = nothing; /// Decorator used when unfocused.
Decorator focused_style = inverted; /// Decorator used when focused.
Decorator unfocused_style = nothing; /// Decorator used when unfocused.
/// Called when the user change the state of the CheckBox.
std::function<void()> on_change = []() {};

View File

@ -11,9 +11,9 @@ namespace ftxui {
class Color {
public:
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(Palette256 index); // Implicit conversion from index to Color.
Color(uint8_t red, uint8_t green, uint8_t blue);

View File

@ -21,3 +21,7 @@ ColorInfo GetColorInfo(Color::Palette256 index);
} // namespace ftxui
#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() {
if (Focused())
return text(label) | border |inverted;
return text(label) | border | inverted;
else
return text(label) | border;
}

View File

@ -13,7 +13,7 @@ Component::~Component() {
/// @brief Return the parent Component, or nul if any.
/// @see Attach
/// @see Detach
/// @see Parent
/// @see Parent
/// @ingroup component
Component* Component::Parent() {
return parent_;
@ -100,7 +100,7 @@ void Component::TakeFocus() {
/// @brief Detach this children from its parent.
/// @see Attach
/// @see Detach
/// @see Parent
/// @see Parent
/// @ingroup component
void Component::Detach() {
if (!parent_)
@ -113,7 +113,7 @@ void Component::Detach() {
/// @brief Attach this element to its parent.
/// @see Attach
/// @see Detach
/// @see Parent
/// @see Parent
/// @ingroup component
void Component::Attach(Component* parent) {
Detach();
@ -121,7 +121,6 @@ void Component::Attach(Component* parent) {
parent_->children_.push_back(this);
}
} // namespace ftxui
// Copyright 2020 Arthur Sonzogni. All rights reserved.

View File

@ -48,7 +48,7 @@ Component* Container::ActiveChild() {
}
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) {
(selector_ ? *selector_ : selected_) = i;
return;

View File

@ -199,7 +199,7 @@ TEST(ContainerTest, SetActiveChild) {
}
TEST(ContainerTest, TakeFocus) {
auto c= Container::Horizontal();
auto c = Container::Horizontal();
auto c1 = Container::Vertical();
auto c2 = 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".
/// @param charset_index The type of "video".
/// @param image_index The "frame" of the video. You need to increase this for
///every "step".
/// every "step".
/// @ingroup dom
Element spinner(int charset_index, size_t image_index) {
if (charset_index == 0) {

View File

@ -41,7 +41,7 @@ Elements operator|(Elements elements, Decorator decorator) {
/// @brief From an element, apply a decorator.
/// @return the decorated element.
/// @ingroup dom
///
///
/// ### Example
///
/// Both of these are equivalent:

View File

@ -268,3 +268,7 @@ ColorInfo GetColorInfo(Color::Palette256 index) {
// 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
if ! grep -q Copyright $file
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
done