mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-29 02:38:10 +08:00
Flatten the namespaces.
Remove: * ftxui::screen * ftxui::dom * ftxui::component Keep: * ftxui
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#include "ftxui/component/delegate.hpp"
|
||||
#include <assert.h>
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
Component::Component(Delegate* delegate) {
|
||||
delegate_ = delegate;
|
||||
@@ -11,8 +11,8 @@ Component::Component(Delegate* delegate) {
|
||||
|
||||
Component::~Component() {}
|
||||
|
||||
dom::Element Component::Render() {
|
||||
using namespace ftxui::dom;
|
||||
Element Component::Render() {
|
||||
using namespace ftxui;
|
||||
return text(L"Not implemented component");
|
||||
}
|
||||
|
||||
@@ -54,4 +54,4 @@ Component* Component::Parent() {
|
||||
return parent_delegate->component();
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/component/component_direction.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
ComponentDirection::ComponentDirection(Delegate* delegate)
|
||||
: Component(delegate), active_child_(nullptr) {}
|
||||
@@ -16,6 +16,7 @@ bool ComponentDirection::OnEvent(Event event) {
|
||||
return true;
|
||||
|
||||
return HandleDirection(event);
|
||||
|
||||
}
|
||||
|
||||
Component* ComponentDirection::GetActiveChild() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/component/component_horizontal.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
ComponentHorizontal::ComponentHorizontal(Delegate* delegate)
|
||||
: ComponentDirection(delegate) {}
|
||||
@@ -27,4 +27,4 @@ bool ComponentHorizontal::HandleDirection(Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/component/component_vertical.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
ComponentVertical::ComponentVertical(Delegate* delegate)
|
||||
: ComponentDirection(delegate) {}
|
||||
@@ -27,4 +27,4 @@ bool ComponentVertical::HandleDirection(Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/component/event.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
constexpr int ESC = int(27);
|
||||
|
||||
@@ -34,4 +34,4 @@ Event Event::F10{ESC, '[', '2', '1', '~'};
|
||||
Event Event::F11{ESC, '[', '2', '1', '~'}; // Same as F10 ?
|
||||
Event Event::F12{ESC, '[', '2', '4', '~'};
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -1,14 +1,13 @@
|
||||
#include "ftxui/component/input.hpp"
|
||||
#include "ftxui/util/string.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
Input::Input(Delegate* delegate): Component(delegate) {}
|
||||
Input::~Input() {}
|
||||
|
||||
// Component implementation.
|
||||
dom::Element Input::Render() {
|
||||
using namespace dom;
|
||||
Element Input::Render() {
|
||||
bool is_focused = Focused();
|
||||
|
||||
// Placeholder.
|
||||
@@ -75,4 +74,4 @@ bool Input::OnEvent(Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -2,12 +2,11 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
Menu::Menu(Delegate* delegate) : Component(delegate) {}
|
||||
|
||||
dom::Element Menu::Render() {
|
||||
using namespace dom;
|
||||
Element Menu::Render() {
|
||||
std::vector<Element> elements;
|
||||
bool focused = Focused();
|
||||
for (size_t i = 0; i < entries.size(); ++i) {
|
||||
@@ -49,4 +48,4 @@ bool Menu::OnEvent(Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -6,9 +6,9 @@
|
||||
#include <iostream>
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/component/delegate.hpp"
|
||||
#include "ftxui/terminal.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
constexpr int ESC = 27;
|
||||
@@ -42,13 +42,14 @@ Event GetEvent() {
|
||||
|
||||
return Event{v1};
|
||||
};
|
||||
|
||||
}; // namespace
|
||||
|
||||
class ScreenInteractive::Delegate : public component::Delegate {
|
||||
class ScreenInteractive::Delegate : public Component::Delegate {
|
||||
public:
|
||||
Delegate() : root_(this) {}
|
||||
|
||||
void Register(component::Component* c) override { component_ = c; }
|
||||
void Register(Component* c) override { component_ = c; }
|
||||
|
||||
std::vector<std::unique_ptr<Delegate>> child_;
|
||||
Delegate* NewChild() override {
|
||||
@@ -67,24 +68,24 @@ class ScreenInteractive::Delegate : public component::Delegate {
|
||||
|
||||
void OnEvent(Event event) { component_->OnEvent(event); }
|
||||
|
||||
std::vector<component::Delegate*> children() override {
|
||||
std::vector<component::Delegate*> ret;
|
||||
std::vector<Component::Delegate*> children() override {
|
||||
std::vector<Component::Delegate*> ret;
|
||||
for (auto& it : child_)
|
||||
ret.push_back(it.get());
|
||||
return ret;
|
||||
}
|
||||
|
||||
Delegate* root_;
|
||||
Delegate* parent_ = nullptr;
|
||||
Delegate* previous_sibling_ = nullptr;
|
||||
Delegate* next_sibling_ = nullptr;
|
||||
component::Component* component_;
|
||||
Component::Delegate* root_;
|
||||
Component::Delegate* parent_ = nullptr;
|
||||
Component::Delegate* previous_sibling_ = nullptr;
|
||||
Component::Delegate* next_sibling_ = nullptr;
|
||||
Component* component_;
|
||||
|
||||
Delegate* Root() override { return root_; }
|
||||
Delegate* Parent() override { return parent_; }
|
||||
Delegate* PreviousSibling() override { return previous_sibling_; }
|
||||
Delegate* NextSibling() override { return next_sibling_; }
|
||||
component::Component* component() override { return component_; }
|
||||
Component::Delegate* Root() override { return root_; }
|
||||
Component::Delegate* Parent() override { return parent_; }
|
||||
Component::Delegate* PreviousSibling() override { return previous_sibling_; }
|
||||
Component::Delegate* NextSibling() override { return next_sibling_; }
|
||||
Component* component() override { return component_; }
|
||||
};
|
||||
|
||||
ScreenInteractive::ScreenInteractive(size_t dimx,
|
||||
@@ -162,14 +163,14 @@ void ScreenInteractive::PrepareDraw() {
|
||||
if (dimx != dimx_ || dimy != dimy_) {
|
||||
dimx_ = dimx;
|
||||
dimy_ = dimy;
|
||||
pixels_ = std::vector<std::vector<screen::Pixel>>(
|
||||
dimy, std::vector<screen::Pixel>(dimx));
|
||||
pixels_ = std::vector<std::vector<Pixel>>(
|
||||
dimy, std::vector<Pixel>(dimx));
|
||||
}
|
||||
|
||||
Render(*this, document.get());
|
||||
}
|
||||
|
||||
component::Delegate* ScreenInteractive::delegate() {
|
||||
Component::Delegate* ScreenInteractive::delegate() {
|
||||
return delegate_.get();
|
||||
}
|
||||
|
||||
@@ -177,4 +178,4 @@ std::function<void()> ScreenInteractive::ExitLoopClosure() {
|
||||
return [this]() { quit_ = true; };
|
||||
}
|
||||
|
||||
} // namespace ftxui::component.
|
||||
} // namespace ftxui.
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "ftxui/component/toggle.hpp"
|
||||
|
||||
namespace ftxui::component {
|
||||
namespace ftxui {
|
||||
|
||||
Toggle::Toggle(Delegate* delegate) : Component(delegate) {}
|
||||
|
||||
dom::Element Toggle::Render() {
|
||||
using namespace dom;
|
||||
Element Toggle::Render() {
|
||||
auto highlight = Focused() ? inverted : bold;
|
||||
|
||||
Children children;
|
||||
@@ -40,4 +39,4 @@ bool Toggle::OnEvent(Event event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ftxui::component
|
||||
} // namespace ftxui
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class Blink : public NodeDecorator {
|
||||
public:
|
||||
Blink(Children children) : NodeDecorator(std::move(children)) {}
|
||||
~Blink() override {}
|
||||
|
||||
void Render(screen::Screen& screen) override {
|
||||
void Render(Screen& screen) override {
|
||||
Node::Render(screen);
|
||||
for (int y = box_.top; y <= box_.bottom; ++y) {
|
||||
for (int x = box_.left; x <= box_.right; ++x) {
|
||||
@@ -22,4 +22,4 @@ std::unique_ptr<Node> blink(Child child) {
|
||||
return std::make_unique<Blink>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class Bold : public NodeDecorator {
|
||||
public:
|
||||
Bold(Children children) : NodeDecorator(std::move(children)) {}
|
||||
~Bold() override {}
|
||||
|
||||
void Render(screen::Screen& screen) override {
|
||||
void Render(Screen& screen) override {
|
||||
for (int y = box_.top; y <= box_.bottom; ++y) {
|
||||
for (int x = box_.left; x <= box_.right; ++x) {
|
||||
screen.PixelAt(x,y).bold = true;
|
||||
@@ -22,4 +22,4 @@ std::unique_ptr<Node> bold(Child child) {
|
||||
return std::make_unique<Bold>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class BgColor : public NodeDecorator {
|
||||
public:
|
||||
BgColor(Children children, Color color)
|
||||
: NodeDecorator(std::move(children)), color_(color) {}
|
||||
|
||||
void Render(screen::Screen& screen) override {
|
||||
void Render(Screen& screen) override {
|
||||
for (int y = box_.top; y <= box_.bottom; ++y) {
|
||||
for (int x = box_.left; x <= box_.right; ++x) {
|
||||
screen.PixelAt(x, y).background_color = color_;
|
||||
@@ -26,7 +26,7 @@ class FgColor : public NodeDecorator {
|
||||
: NodeDecorator(std::move(children)), color_(color) {}
|
||||
~FgColor() override {}
|
||||
|
||||
void Render(screen::Screen& screen) override {
|
||||
void Render(Screen& screen) override {
|
||||
for (int y = box_.top; y <= box_.bottom; ++y) {
|
||||
for (int x = box_.left; x <= box_.right; ++x) {
|
||||
screen.PixelAt(x, y).foreground_color = color_;
|
||||
@@ -58,4 +58,4 @@ Decorator bgcolor(Color c) {
|
||||
};
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
std::unique_ptr<Node> hcenter(Element child) {
|
||||
return hbox(filler(), std::move(child), filler());
|
||||
@@ -19,4 +19,4 @@ std::unique_ptr<Node> align_right(Element child) {
|
||||
return hbox(filler(), std::move(child));
|
||||
}
|
||||
|
||||
} // namespace ftxui::dom
|
||||
} // namespace ftxui
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class DBox : public Node {
|
||||
public:
|
||||
@@ -32,4 +32,4 @@ std::unique_ptr<Node> dbox(Children children) {
|
||||
return std::make_unique<DBox>(std::move(children));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
class Dim : public NodeDecorator {
|
||||
public:
|
||||
@@ -24,4 +24,4 @@ std::unique_ptr<Node> dim(Child child) {
|
||||
return std::make_unique<Dim>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class Flex : public Node {
|
||||
public:
|
||||
@@ -34,4 +34,4 @@ std::unique_ptr<Node> flex(Element child) {
|
||||
return std::make_unique<Flex>(std::move(child));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui;
|
||||
|
||||
static wchar_t charset[] = L"┌┐└┘─│┬┴┤├";
|
||||
|
||||
@@ -95,4 +95,4 @@ Decorator boxed() {
|
||||
};
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui;
|
||||
|
||||
static wchar_t charset[] = L" ▏▎▍▌▋▊▉█";
|
||||
|
||||
@@ -36,4 +36,4 @@ std::unique_ptr<Node> gauge(float progress) {
|
||||
return std::make_unique<Gauge>(progress);
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui::dom;
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(GaugeTest, zero) {
|
||||
auto root = gauge(0);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class HBox : public Node {
|
||||
public:
|
||||
@@ -63,4 +63,4 @@ std::unique_ptr<Node> hbox(Children children) {
|
||||
return std::make_unique<HBox>(std::move(children));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui::dom;
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(HBoxTest, ScreenSmaller1) {
|
||||
auto root = hbox(
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
class Inverted : public NodeDecorator {
|
||||
public:
|
||||
@@ -24,4 +24,4 @@ std::unique_ptr<Node> inverted(Child child) {
|
||||
return std::make_unique<Inverted>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
Node::Node() {}
|
||||
Node::Node(std::vector<std::unique_ptr<Node>> children)
|
||||
@@ -40,4 +40,4 @@ void Render(Screen& screen, Node* node) {
|
||||
node->Render(screen);
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
void NodeDecorator::ComputeRequirement() {
|
||||
Node::ComputeRequirement();
|
||||
@@ -12,4 +12,4 @@ void NodeDecorator::SetBox(Box box) {
|
||||
children[0]->SetBox(box);
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
// Helper class.
|
||||
class NodeDecorator : public Node {
|
||||
@@ -15,6 +15,6 @@ class NodeDecorator : public Node {
|
||||
void SetBox(Box box) override;
|
||||
};
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
||||
#endif /* end of include guard: FTXUI_DOM_NODE_DECORATOR_H_ */
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
class Separator : public Node {
|
||||
public:
|
||||
@@ -35,4 +35,4 @@ std::unique_ptr<Node> separator() {
|
||||
return std::make_unique<Separator>();
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class Size : public Node {
|
||||
public:
|
||||
@@ -32,4 +32,4 @@ Decorator size(size_t width, size_t height) {
|
||||
};
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui;
|
||||
|
||||
static const std::vector<std::vector<std::vector<std::wstring>>> elements = {
|
||||
{
|
||||
@@ -276,4 +276,4 @@ std::unique_ptr<Node> spinner(int c, size_t index) {
|
||||
return vbox(std::move(lines));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
class Text : public Node {
|
||||
public:
|
||||
@@ -34,4 +34,4 @@ std::unique_ptr<Node> text(std::wstring text) {
|
||||
return std::make_unique<Text>(text);
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui::dom;
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(TextTest, ScreenHeightSmaller) {
|
||||
auto element = text(L"test");
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "ftxui/dom/node_decorator.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
using ftxui::screen::Screen;
|
||||
using ftxui::Screen;
|
||||
|
||||
class Underlined : public NodeDecorator {
|
||||
public:
|
||||
@@ -24,4 +24,4 @@ std::unique_ptr<Node> underlined(Child child) {
|
||||
return std::make_unique<Underlined>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
Element nothing(Element element) {
|
||||
return std::move(element);
|
||||
@@ -23,4 +23,4 @@ Element operator|(Element e, Decorator d) {
|
||||
return d(std::move(e));
|
||||
}
|
||||
|
||||
} // namespace ftxui::dom
|
||||
} // namespace ftxui
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
|
||||
namespace ftxui::dom {
|
||||
namespace ftxui {
|
||||
|
||||
class VBox : public Node {
|
||||
public:
|
||||
@@ -63,4 +63,4 @@ std::unique_ptr<Node> vbox(Children children) {
|
||||
return std::make_unique<VBox>(std::move(children));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::dom
|
||||
}; // namespace ftxui
|
||||
|
@@ -2,8 +2,8 @@
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace ftxui::screen;
|
||||
using namespace ftxui::dom;
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(VBoxTest, ScreenSmaller1) {
|
||||
auto root = vbox(text(L"text_1"), text(L"text_2"));
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "ftxui/dom/node.hpp"
|
||||
#include "ftxui/terminal.hpp"
|
||||
#include "ftxui/util/string.hpp"
|
||||
#include "ftxui/screen/screen.hpp"
|
||||
#include "ftxui/screen/string.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace ftxui::screen {
|
||||
namespace ftxui {
|
||||
|
||||
static const wchar_t* BOLD_SET = L"\e[1m";
|
||||
static const wchar_t* BOLD_RESET = L"\e[22m"; // Can't use 21 here.
|
||||
@@ -86,7 +86,7 @@ Screen Screen::TerminalFullscreen() {
|
||||
}
|
||||
|
||||
// static
|
||||
Screen Screen::TerminalOutput(std::unique_ptr<dom::Node>& element) {
|
||||
Screen Screen::TerminalOutput(std::unique_ptr<Node>& element) {
|
||||
element->ComputeRequirement();
|
||||
Terminal::Dimensions size = Terminal::Size();
|
||||
return Screen(size.dimx, element->requirement().min.y);
|
||||
@@ -106,4 +106,4 @@ void Screen::Clear() {
|
||||
std::vector<Pixel>(dimx_, Pixel()));
|
||||
}
|
||||
|
||||
}; // namespace ftxui::screen
|
||||
}; // namespace ftxui
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ftxui/terminal.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
namespace ftxui {
|
||||
|
Reference in New Issue
Block a user