Execute IWYU (#299)

This commit is contained in:
Arthur Sonzogni 2022-01-07 11:03:54 +01:00 committed by GitHub
parent 358f886fab
commit cdd6339849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 242 additions and 248 deletions

View File

@ -1,14 +1,19 @@
#include <stddef.h> // for size_t #include <cmath> // for sin, cos
#include <stdio.h> // for getchar #include <ftxui/dom/elements.hpp> // for canvas, Element, separator, hbox, operator|, border
#include <ftxui/dom/elements.hpp> // for operator|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN #include <ftxui/screen/screen.hpp> // for Pixel
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <memory> // for allocator, shared_ptr #include <string> // for string, basic_string
#include <string> // for operator+, to_string, char_traits, string #include <utility> // for move
#include <vector> // for vector, __alloc_traits<>::value_type
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp" // for Renderer, CatchEvent, Horizontal, Menu, Tab
#include "ftxui/component/screen_interactive.hpp" #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/event.hpp" // for Event
#include "ftxui/component/mouse.hpp" // for Mouse
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/canvas.hpp" // for Canvas
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
#include <cmath>
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;
@ -183,9 +188,9 @@ int main(int argc, const char* argv[]) {
return canvas(std::move(c)); return canvas(std::move(c));
}); });
int selected_tab = 12; int selected_tab = 12;
auto tab = Container::Tab({ auto tab = Container::Tab(
{
renderer_line_braille, renderer_line_braille,
renderer_line_block, renderer_line_block,
renderer_circle_braille, renderer_circle_braille,
@ -202,7 +207,8 @@ int main(int argc, const char* argv[]) {
renderer_plot_3, renderer_plot_3,
renderer_text, renderer_text,
}, &selected_tab); },
&selected_tab);
// This capture the last mouse position. // This capture the last mouse position.
auto tab_with_mouse = CatchEvent(tab, [&](Event e) { auto tab_with_mouse = CatchEvent(tab, [&](Event e) {

View File

@ -1,14 +1,12 @@
#include <iostream> // for basic_ostream::operator<<, operator<<, endl, basic_ostream, basic_ostream<>::__ostream_type, cout, ostream #include <memory> // for allocator, make_shared, __shared_ptr_access
#include <memory> // for shared_ptr, __shared_ptr_access #include <utility> // for move
#include <string> // for to_string, allocator #include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for MenuEntry, Renderer, Vertical #include "ftxui/component/component.hpp" // for Collapsible, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/component_options.hpp" // for MenuEntryOption #include "ftxui/component/screen_interactive.hpp" // for Component, ScreenInteractive
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/dom/elements.hpp" // for text, hbox, Element
#include "ftxui/dom/elements.hpp" // for operator|, separator, Element, Decorator, color, text, hbox, size, bold, frame, inverted, vbox, HEIGHT, LESS_THAN, border
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::Green, Color::Red, Color::Yellow
using namespace ftxui; using namespace ftxui;

View File

@ -1,15 +1,13 @@
#include <stddef.h> // for size_t #include <memory> // for allocator, shared_ptr, __shared_ptr_access
#include <memory> // for shared_ptr, __shared_ptr_access, allocator #include <string> // for operator+, char_traits, to_string, string
#include <string> // for string, basic_string, to_string, operator+, char_traits
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for ftxui #include "ftxui/component/captured_mouse.hpp" // for ftxui
#include "ftxui/component/component.hpp" // for Radiobox, Vertical, Checkbox, Horizontal, Renderer, ResizableSplitBottom, ResizableSplitRight #include "ftxui/component/component.hpp" // for Slider, Renderer, Vertical
#include "ftxui/component/component_base.hpp" // for ComponentBase #include "ftxui/component/component_base.hpp" // for ComponentBase
#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive #include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive
#include "ftxui/dom/elements.hpp" // for text, window, operator|, vbox, hbox, Element, flexbox, bgcolor, filler, flex, size, border, hcenter, color, EQUAL, bold, dim, notflex, xflex_grow, yflex_grow, HEIGHT, WIDTH #include "ftxui/dom/elements.hpp" // for Elements, Element, operator|, separator, text, focusPositionRelative, size, border, flex, frame, bgcolor, gridbox, vbox, EQUAL, center, HEIGHT, WIDTH
#include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignItems, FlexboxConfig::Direction, FlexboxConfig::JustifyContent::Center, FlexboxConfig::Wrap #include "ftxui/screen/color.hpp" // for Color
#include "ftxui/screen/color.hpp" // for Color, Color::Black
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,8 +3,8 @@
#include <iostream> // for endl, cout, ostream #include <iostream> // for endl, cout, ostream
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -1,14 +1,13 @@
#include <stddef.h> // for size_t
#include <stdio.h> // for getchar #include <stdio.h> // for getchar
#include <ftxui/dom/elements.hpp> // for operator|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN #include <cmath> // for cos
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/dom/elements.hpp> // for Fit, canvas, operator|, border, Element
#include <memory> // for allocator, shared_ptr #include <ftxui/screen/screen.hpp> // for Pixel, Screen
#include <string> // for operator+, to_string, char_traits, string #include <vector> // for vector, allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui #include "ftxui/dom/canvas.hpp" // for Canvas
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Red, Color::Blue, Color::Green, ftxui
#include <cmath>
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -4,9 +4,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector, allocator #include <vector> // for vector, allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Palette256 #include "ftxui/screen/color.hpp" // for Color, Color::Palette256, ftxui
using namespace ftxui; using namespace ftxui;
#include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D #include "./color_info_sorted_2d.ipp" // for ColorInfoSorted2D

View File

@ -3,9 +3,8 @@
#include <memory> // for allocator #include <memory> // for allocator
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color #include "ftxui/screen/color.hpp" // for Color, ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,9 +3,8 @@
#include <memory> // for allocator #include <memory> // for allocator
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color #include "ftxui/screen/color.hpp" // for Color, ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string #include <string> // for allocator, operator+, char_traits, operator<<, string, to_string, basic_string
#include <thread> // for sleep_for #include <thread> // for sleep_for
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -8,9 +8,8 @@
#include <thread> // for sleep_for #include <thread> // for sleep_for
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight #include "ftxui/screen/color.hpp" // for Color, Color::BlueLight, Color::RedLight, Color::YellowLight, ftxui
class Graph { class Graph {
public: public:

View File

@ -3,8 +3,8 @@
#include <ftxui/screen/screen.hpp> // for Screen #include <ftxui/screen/screen.hpp> // for Screen
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string, char_traits, string #include <string> // for operator+, to_string, char_traits, string
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -9,9 +9,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight #include "ftxui/screen/color.hpp" // for Color, Color::Green, Color::Red, Color::RedLight, ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -4,8 +4,8 @@
#include <string> // for string, to_string #include <string> // for string, to_string
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -7,8 +7,8 @@
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,9 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Blue #include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,8 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,9 +5,8 @@
#include <string> // for basic_string, allocator, string #include <string> // for basic_string, allocator, string
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White #include "ftxui/screen/color.hpp" // for Color, Color::Blue, Color::Cyan, Color::White, ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -3,8 +3,8 @@
#include <ftxui/screen/screen.hpp> // for Full, Screen #include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -5,8 +5,8 @@
#include <memory> // for allocator, shared_ptr #include <memory> // for allocator, shared_ptr
#include <string> // for operator+, to_string, char_traits, string #include <string> // for operator+, to_string, char_traits, string
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
using namespace ftxui; using namespace ftxui;

View File

@ -2,9 +2,8 @@
#include <ftxui/screen/screen.hpp> // for Fixed, Screen #include <ftxui/screen/screen.hpp> // for Fixed, Screen
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Green, Color::Red #include "ftxui/screen/color.hpp" // for Color, Color::DarkBlue, Color::Green, Color::Red, ftxui
int main(void) { int main(void) {
using namespace ftxui; using namespace ftxui;

View File

@ -1,10 +1,13 @@
#ifndef FTXUI_DOM_CANVAS_HPP #ifndef FTXUI_DOM_CANVAS_HPP
#define FTXUI_DOM_CANVAS_HPP #define FTXUI_DOM_CANVAS_HPP
#include "ftxui/screen/color.hpp" #include <stddef.h> // for size_t
#include "ftxui/screen/screen.hpp" #include <functional> // for function
#include <unordered_map> #include <string> // for string
#include <functional> #include <unordered_map> // for unordered_map
#include "ftxui/screen/color.hpp" // for Color
#include "ftxui/screen/screen.hpp" // for Pixel
namespace ftxui { namespace ftxui {
@ -34,25 +37,14 @@ struct Canvas {
void DrawPointCircle(int x, int y, int radius, const Stylizer& s); void DrawPointCircle(int x, int y, int radius, const Stylizer& s);
void DrawPointCircle(int x, int y, int radius, const Color& color); void DrawPointCircle(int x, int y, int radius, const Color& color);
void DrawPointCircleFilled(int x, int y, int radius); void DrawPointCircleFilled(int x, int y, int radius);
void DrawPointCircleFilled(int x, void DrawPointCircleFilled(int x, int y, int radius, const Stylizer& s);
int y,
int radius,
const Stylizer& s);
void DrawPointCircleFilled(int x, int y, int radius, const Color& color); void DrawPointCircleFilled(int x, int y, int radius, const Color& color);
void DrawPointEllipse(int x, int y, int r1, int r2); void DrawPointEllipse(int x, int y, int r1, int r2);
void DrawPointEllipse(int x, int y, int r1, int r2, const Color& color); void DrawPointEllipse(int x, int y, int r1, int r2, const Color& color);
void DrawPointEllipse(int x, int y, int r1, int r2, const Stylizer& s); void DrawPointEllipse(int x, int y, int r1, int r2, const Stylizer& s);
void DrawPointEllipseFilled(int x, int y, int r1, int r2); void DrawPointEllipseFilled(int x, int y, int r1, int r2);
void DrawPointEllipseFilled(int x, void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Color& color);
int y, void DrawPointEllipseFilled(int x, int y, int r1, int r2, const Stylizer& s);
int r1,
int r2,
const Color& color);
void DrawPointEllipseFilled(int x,
int y,
int r1,
int r2,
const Stylizer& s);
// Draw using box characters ------------------------------------------------- // Draw using box characters -------------------------------------------------
// Block are of size 1x2. y is considered to be a multiple of 2. // Block are of size 1x2. y is considered to be a multiple of 2.
@ -92,10 +84,7 @@ struct Canvas {
// y is considered to be a multiple of 4. // y is considered to be a multiple of 4.
void DrawText(int x, int y, const std::string& value); void DrawText(int x, int y, const std::string& value);
void DrawText(int x, int y, const std::string& value, const Color& color); void DrawText(int x, int y, const std::string& value, const Color& color);
void DrawText(int x, void DrawText(int x, int y, const std::string& value, const Stylizer& style);
int y,
const std::string& value,
const Stylizer& style);
// Decorator: // Decorator:
// x is considered to be a multiple of 2. // x is considered to be a multiple of 2.
@ -124,7 +113,9 @@ struct Canvas {
}; };
struct XYHash { struct XYHash {
size_t operator()(const XY& xy) const { return static_cast<size_t>(xy.x * 1024 + xy.y); } size_t operator()(const XY& xy) const {
return static_cast<size_t>(xy.x * 1024 + xy.y);
}
}; };
int width_ = 0; int width_ = 0;
@ -135,3 +126,7 @@ struct Canvas {
} // namespace ftxui } // namespace ftxui
#endif // FTXUI_DOM_CANVAS_HPP #endif // FTXUI_DOM_CANVAS_HPP
// Copyright 2021 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,6 +1,7 @@
#ifndef FTXUI_SCREEN_STRING_HPP #ifndef FTXUI_SCREEN_STRING_HPP
#define FTXUI_SCREEN_STRING_HPP #define FTXUI_SCREEN_STRING_HPP
#include <stddef.h> // for size_t
#include <string> // for string, wstring, to_string #include <string> // for string, wstring, to_string
#include <vector> // for vector #include <vector> // for vector

View File

@ -1,11 +1,10 @@
#include <memory> // for make_unique, __shared_ptr_access, __shared_ptr_access<>::element_type, shared_ptr #include <string> // for string
#include <utility> // for move #include <utility> // for move
#include "ftxui/component/component.hpp" // for Make, Collapsible #include "ftxui/component/component.hpp" // for Checkbox, Maybe, Make, Vertical, Collapsible
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for Component, ComponentBase
#include "ftxui/component/event.hpp" // for Event #include "ftxui/component/component_options.hpp" // for CheckboxOption
#include "ftxui/dom/elements.hpp" // for Element #include "ftxui/util/ref.hpp" // for Ref, ConstStringRef
#include "ftxui/dom/node.hpp" // for Node
namespace ftxui { namespace ftxui {
@ -26,9 +25,7 @@ namespace ftxui {
/// ▼ Show details /// ▼ Show details
/// <details component> /// <details component>
/// ``` /// ```
Component Collapsible(ConstStringRef label, Component Collapsible(ConstStringRef label, Component child, Ref<bool> show) {
Component child,
Ref<bool> show) {
class Impl : public ComponentBase { class Impl : public ComponentBase {
public: public:
Impl(ConstStringRef label, Component child, Ref<bool> show) Impl(ConstStringRef label, Component child, Ref<bool> show)

View File

@ -1,8 +1,10 @@
#include <algorithm> // for max, min #include <stddef.h> // for size_t
#include <algorithm> // for clamp, max, min
#include <functional> // for function #include <functional> // for function
#include <memory> // for shared_ptr, allocator #include <memory> // for shared_ptr, allocator
#include <string> // for wstring, basic_string #include <string> // for string, wstring
#include <utility> // for move #include <utility> // for move
#include <vector> // for vector
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse #include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
#include "ftxui/component/component.hpp" // for Make, Input #include "ftxui/component/component.hpp" // for Make, Input
@ -12,11 +14,10 @@
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Custom, Event::Delete, Event::End, Event::Home, Event::Return #include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Custom, Event::Delete, Event::End, Event::Home, Event::Return
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed #include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Left, Mouse::Pressed
#include "ftxui/component/screen_interactive.hpp" // for Component #include "ftxui/component/screen_interactive.hpp" // for Component
#include "ftxui/dom/deprecated.hpp" // for text #include "ftxui/dom/elements.hpp" // for operator|, text, Element, reflect, inverted, Decorator, flex, focus, hbox, size, bold, dim, frame, select, EQUAL, HEIGHT
#include "ftxui/dom/elements.hpp" // for operator|, Element, reflect, text, dim, flex, focus, inverted, hbox, size, frame, select, underlined, Decorator, EQUAL, HEIGHT
#include "ftxui/screen/box.hpp" // for Box #include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/string.hpp" // for to_wstring, to_string #include "ftxui/screen/string.hpp" // for GlyphPosition, GlyphCount, to_string, CellToGlyphIndex, to_wstring
#include "ftxui/util/ref.hpp" // for WideStringRef, Ref, ConstStringRef, StringRef #include "ftxui/util/ref.hpp" // for StringRef, Ref, WideStringRef, ConstStringRef
namespace ftxui { namespace ftxui {

View File

@ -8,9 +8,10 @@
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component #include "ftxui/component/component_base.hpp" // for ComponentBase, Component
#include "ftxui/component/component_options.hpp" // for InputOption #include "ftxui/component/component_options.hpp" // for InputOption
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Delete, Event::End, Event::Home #include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Backspace, Event::Delete, Event::End, Event::Home
#include "ftxui/component/mouse.hpp" // for Mouse, Mouse::Button, Mouse::Left, Mouse::Motion, Mouse::Pressed
#include "ftxui/dom/elements.hpp" // for Fit #include "ftxui/dom/elements.hpp" // for Fit
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/screen.hpp" // for Screen, Pixel #include "ftxui/screen/screen.hpp" // for Fixed, Screen, Pixel
#include "ftxui/util/ref.hpp" // for Ref #include "ftxui/util/ref.hpp" // for Ref
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -1,8 +1,8 @@
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>
#include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border #include "ftxui/dom/elements.hpp" // for separator, gauge, operator|, text, Element, blink, inverted, hbox, vbox, border
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
using namespace ftxui; using namespace ftxui;

View File

@ -1,9 +1,20 @@
#include "ftxui/dom/canvas.hpp" #include "ftxui/dom/canvas.hpp"
#include <map> #include <stdlib.h> // for abs
#include <algorithm> // for max, min
#include <cstdint> // for uint8_t
#include <map> // for allocator, map
#include <memory> // for make_shared
#include <utility> // for move, pair
#include <vector> // for vector
#include "ftxui/dom/elements.hpp" #include "ftxui/dom/elements.hpp" // for Element, canvas
#include "ftxui/screen/screen.hpp" #include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/requirement.hpp" // for Requirement
#include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
#include "ftxui/screen/string.hpp" // for Utf8ToGlyphs
#include "ftxui/util/ref.hpp" // for ConstRef
namespace ftxui { namespace ftxui {
@ -233,10 +244,7 @@ void Canvas::DrawPointCircle(int x, int y, int radius, const Color& color) {
/// @param y the y coordinate of the center of the circle. /// @param y the y coordinate of the center of the circle.
/// @param radius the radius of the circle. /// @param radius the radius of the circle.
/// @param style the style of the circle. /// @param style the style of the circle.
void Canvas::DrawPointCircle(int x, void Canvas::DrawPointCircle(int x, int y, int radius, const Stylizer& style) {
int y,
int radius,
const Stylizer& style) {
DrawPointEllipse(x, y, radius, radius, style); DrawPointEllipse(x, y, radius, radius, style);
} }
@ -573,10 +581,7 @@ void Canvas::DrawBlockCircle(int x, int y, int radius, const Color& color) {
/// @param y the y coordinate of the center of the circle. /// @param y the y coordinate of the center of the circle.
/// @param radius the radius of the circle. /// @param radius the radius of the circle.
/// @param style the style of the circle. /// @param style the style of the circle.
void Canvas::DrawBlockCircle(int x, void Canvas::DrawBlockCircle(int x, int y, int radius, const Stylizer& style) {
int y,
int radius,
const Stylizer& style) {
DrawBlockEllipse(x, y, radius, radius, style); DrawBlockEllipse(x, y, radius, radius, style);
} }
@ -868,3 +873,7 @@ Element canvas(std::function<void(Canvas&)> fn) {
} }
} // namespace ftxui } // namespace ftxui
// Copyright 2021 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

@ -3,8 +3,9 @@
#include <string> // for allocator #include <string> // for allocator
#include "ftxui/dom/elements.hpp" // for text, flexbox #include "ftxui/dom/elements.hpp" // for text, flexbox
#include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Direction::Column, FlexboxConfig::AlignItems, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::SpaceBetween, ftxui #include "ftxui/dom/flexbox_config.hpp" // for FlexboxConfig, FlexboxConfig::Direction, FlexboxConfig::AlignContent, FlexboxConfig::JustifyContent, FlexboxConfig::Direction::Column, FlexboxConfig::AlignItems, FlexboxConfig::JustifyContent::SpaceAround, FlexboxConfig::AlignContent::Center, FlexboxConfig::AlignContent::FlexEnd, FlexboxConfig::AlignContent::SpaceAround, FlexboxConfig::AlignContent::SpaceBetween, FlexboxConfig::AlignContent::SpaceEvenly, FlexboxConfig::AlignItems::Center, FlexboxConfig::AlignItems::FlexEnd, FlexboxConfig::Direction::ColumnInversed, FlexboxConfig::Direction::Row, FlexboxConfig::Direction::RowInversed, FlexboxConfig::JustifyContent::Center, FlexboxConfig::JustifyContent::SpaceBetween
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -1,18 +1,13 @@
#include <memory> // for make_shared #include <memory> // for make_shared
#include <utility> // for move #include <utility> // for move
#include "ftxui/dom/elements.hpp" // for Element, bold #include "ftxui/dom/elements.hpp" // for Decorator, Element, focusPosition, focusPositionRelative
#include "ftxui/dom/node.hpp" // for Node
#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator #include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
#include "ftxui/dom/requirement.hpp" // for Requirement, Requirement::NORMAL, Requirement::Selection
#include "ftxui/screen/box.hpp" // for Box #include "ftxui/screen/box.hpp" // for Box
#include "ftxui/screen/screen.hpp" // for Pixel, Screen
namespace ftxui { namespace ftxui {
namespace {
} // namespace
/// @brief Used inside a `frame`, this force the view to be scrolled toward a /// @brief Used inside a `frame`, this force the view to be scrolled toward a
/// a given position. The position is expressed in proportion of the requested /// a given position. The position is expressed in proportion of the requested
/// size. /// size.

View File

@ -3,8 +3,8 @@
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for gauge #include "ftxui/dom/elements.hpp" // for gauge
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -4,9 +4,9 @@
#include <string> // for allocator, basic_string, string #include <string> // for allocator, basic_string, string
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex, flex_grow, Elements, flex_shrink, vtext, gridbox, vbox, border #include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex, Elements, flex_grow, flex_shrink, vtext, gridbox, vbox, border
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ #include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ

View File

@ -4,8 +4,8 @@
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex_grow, flex_shrink, hbox #include "ftxui/dom/elements.hpp" // for text, operator|, Element, flex_grow, flex_shrink, hbox
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -3,9 +3,9 @@
#include <memory> // for allocator #include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for LIGHT, flex, center, EMPTY, DOUBLE #include "ftxui/dom/elements.hpp" // for LIGHT, flex, center, EMPTY, DOUBLE
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/dom/table.hpp" #include "ftxui/dom/table.hpp"
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -3,8 +3,8 @@
#include <string> // for allocator, string #include <string> // for allocator, string
#include "ftxui/dom/elements.hpp" // for text, operator|, border, Element #include "ftxui/dom/elements.hpp" // for text, operator|, border, Element
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -5,8 +5,8 @@
#include <vector> // for vector #include <vector> // for vector
#include "ftxui/dom/elements.hpp" // for vtext, operator|, Element, flex_grow, flex_shrink, vbox #include "ftxui/dom/elements.hpp" // for vtext, operator|, Element, flex_grow, flex_shrink, vbox
#include "ftxui/dom/flexbox_config.hpp" // for ftxui
#include "ftxui/dom/node.hpp" // for Render #include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for ftxui
#include "ftxui/screen/screen.hpp" // for Screen #include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST #include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST

View File

@ -288,7 +288,9 @@ std::vector<std::string> Utf8ToGlyphs(const std::string& input) {
return out; return out;
} }
int GlyphPosition(const std::string& input, size_t glyph_to_skip, size_t start) { int GlyphPosition(const std::string& input,
size_t glyph_to_skip,
size_t start) {
if (glyph_to_skip <= 0) if (glyph_to_skip <= 0)
return 0; return 0;
size_t end = 0; size_t end = 0;

View File

@ -59,7 +59,6 @@ TEST(StringTest, GlyphCount) {
EXPECT_EQ(GlyphCount("a\1a"), 2); EXPECT_EQ(GlyphCount("a\1a"), 2);
} }
TEST(StringTest, GlyphPosition) { TEST(StringTest, GlyphPosition) {
// Basic: // Basic:
EXPECT_EQ(GlyphPosition("", -1), 0); EXPECT_EQ(GlyphPosition("", -1), 0);