mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
Remove explicit default destructors (#157)
From CppCoreGuidelines: Rule of Zero: C.20: If you can avoid defining default operations, do. C.52: Use inheriting constructors to import constructors into a derived class that does not need further explicit initialization. DRY forward and using declarations. Miscellaneous: Fix format.sh to output examples with normalised paths in sorted order. Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
parent
b3a333b417
commit
21d746e858
@ -1,46 +1,46 @@
|
|||||||
# Examples
|
# Examples
|
||||||
@example ./examples/util/print_key_press.cpp
|
@example ./examples/component/button.cpp
|
||||||
@example ./examples/dom/color_truecolor_HSV.cpp
|
|
||||||
@example ./examples/dom/dbox.cpp
|
|
||||||
@example ./examples/dom/separator.cpp
|
|
||||||
@example ./examples/dom/style_color.cpp
|
|
||||||
@example ./examples/dom/color_info_palette256.cpp
|
|
||||||
@example ./examples/dom/color_truecolor_RGB.cpp
|
|
||||||
@example ./examples/dom/paragraph.cpp
|
|
||||||
@example ./examples/dom/style_blink.cpp
|
|
||||||
@example ./examples/dom/style_dim.cpp
|
|
||||||
@example ./examples/dom/style_inverted.cpp
|
|
||||||
@example ./examples/dom/graph.cpp
|
|
||||||
@example ./examples/dom/package_manager.cpp
|
|
||||||
@example ./examples/dom/window.cpp
|
|
||||||
@example ./examples/dom/html_like.cpp
|
|
||||||
@example ./examples/dom/border.cpp
|
|
||||||
@example ./examples/dom/style_underlined.cpp
|
|
||||||
@example ./examples/dom/color_gallery.cpp
|
|
||||||
@example ./examples/dom/gauge.cpp
|
|
||||||
@example ./examples/dom/style_bold.cpp
|
|
||||||
@example ./examples/dom/spinner.cpp
|
|
||||||
@example ./examples/dom/style_gallery.cpp
|
|
||||||
@example ./examples/dom/vbox_hbox.cpp
|
|
||||||
@example ./examples/dom/size.cpp
|
|
||||||
@example ./examples/dom/hflow.cpp
|
|
||||||
@example ./examples/component/tab_vertical.cpp
|
|
||||||
@example ./examples/component/gallery.cpp
|
|
||||||
@example ./examples/component/checkbox.cpp
|
@example ./examples/component/checkbox.cpp
|
||||||
@example ./examples/component/checkbox_in_frame.cpp
|
@example ./examples/component/checkbox_in_frame.cpp
|
||||||
@example ./examples/component/menu2.cpp
|
|
||||||
@example ./examples/component/resizable_split.cpp
|
|
||||||
@example ./examples/component/tab_horizontal.cpp
|
|
||||||
@example ./examples/component/slider.cpp
|
|
||||||
@example ./examples/component/input.cpp
|
|
||||||
@example ./examples/component/homescreen.cpp
|
|
||||||
@example ./examples/component/radiobox.cpp
|
|
||||||
@example ./examples/component/menu_multiple.cpp
|
|
||||||
@example ./examples/component/slider_rgb.cpp
|
|
||||||
@example ./examples/component/menu.cpp
|
|
||||||
@example ./examples/component/menu_style.cpp
|
|
||||||
@example ./examples/component/radiobox_in_frame.cpp
|
|
||||||
@example ./examples/component/composition.cpp
|
@example ./examples/component/composition.cpp
|
||||||
@example ./examples/component/button.cpp
|
@example ./examples/component/gallery.cpp
|
||||||
@example ./examples/component/toggle.cpp
|
@example ./examples/component/homescreen.cpp
|
||||||
|
@example ./examples/component/input.cpp
|
||||||
|
@example ./examples/component/menu2.cpp
|
||||||
|
@example ./examples/component/menu.cpp
|
||||||
|
@example ./examples/component/menu_multiple.cpp
|
||||||
|
@example ./examples/component/menu_style.cpp
|
||||||
@example ./examples/component/modal_dialog.cpp
|
@example ./examples/component/modal_dialog.cpp
|
||||||
|
@example ./examples/component/radiobox.cpp
|
||||||
|
@example ./examples/component/radiobox_in_frame.cpp
|
||||||
|
@example ./examples/component/resizable_split.cpp
|
||||||
|
@example ./examples/component/slider.cpp
|
||||||
|
@example ./examples/component/slider_rgb.cpp
|
||||||
|
@example ./examples/component/tab_horizontal.cpp
|
||||||
|
@example ./examples/component/tab_vertical.cpp
|
||||||
|
@example ./examples/component/toggle.cpp
|
||||||
|
@example ./examples/dom/border.cpp
|
||||||
|
@example ./examples/dom/color_gallery.cpp
|
||||||
|
@example ./examples/dom/color_info_palette256.cpp
|
||||||
|
@example ./examples/dom/color_truecolor_HSV.cpp
|
||||||
|
@example ./examples/dom/color_truecolor_RGB.cpp
|
||||||
|
@example ./examples/dom/dbox.cpp
|
||||||
|
@example ./examples/dom/gauge.cpp
|
||||||
|
@example ./examples/dom/graph.cpp
|
||||||
|
@example ./examples/dom/hflow.cpp
|
||||||
|
@example ./examples/dom/html_like.cpp
|
||||||
|
@example ./examples/dom/package_manager.cpp
|
||||||
|
@example ./examples/dom/paragraph.cpp
|
||||||
|
@example ./examples/dom/separator.cpp
|
||||||
|
@example ./examples/dom/size.cpp
|
||||||
|
@example ./examples/dom/spinner.cpp
|
||||||
|
@example ./examples/dom/style_blink.cpp
|
||||||
|
@example ./examples/dom/style_bold.cpp
|
||||||
|
@example ./examples/dom/style_color.cpp
|
||||||
|
@example ./examples/dom/style_dim.cpp
|
||||||
|
@example ./examples/dom/style_gallery.cpp
|
||||||
|
@example ./examples/dom/style_inverted.cpp
|
||||||
|
@example ./examples/dom/style_underlined.cpp
|
||||||
|
@example ./examples/dom/vbox_hbox.cpp
|
||||||
|
@example ./examples/dom/window.cpp
|
||||||
|
@example ./examples/util/print_key_press.cpp
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
class CapturedMouseInterface {
|
class CapturedMouseInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~CapturedMouseInterface() {}
|
virtual ~CapturedMouseInterface() = default;
|
||||||
};
|
};
|
||||||
using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;
|
using CapturedMouse = std::unique_ptr<CapturedMouseInterface>;
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -2,29 +2,24 @@
|
|||||||
#define FTXUI_COMPONENT_HPP
|
#define FTXUI_COMPONENT_HPP
|
||||||
|
|
||||||
#include <functional> // for function
|
#include <functional> // for function
|
||||||
#include <memory> // for shared_ptr, make_shared
|
#include <memory> // for make_shared, shared_ptr
|
||||||
#include <string> // for wstring
|
#include <string> // for wstring
|
||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
#include "ftxui/component/component_base.hpp"
|
#include "ftxui/component/component_base.hpp" // for Component, Components
|
||||||
#include "ftxui/component/component_options.hpp"
|
#include "ftxui/component/component_options.hpp" // for ButtonOption, CheckboxOption, InputOption, MenuOption, RadioboxOption, ToggleOption
|
||||||
#include "ftxui/dom/elements.hpp" // for Element
|
#include "ftxui/dom/elements.hpp" // for Element
|
||||||
#include "ftxui/util/ref.hpp" // for Ref, ConstStringRef, StringRef
|
#include "ftxui/util/ref.hpp" // for Ref, ConstStringRef, StringRef
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
class ComponentBase;
|
|
||||||
struct Event;
|
|
||||||
struct ButtonOption;
|
struct ButtonOption;
|
||||||
struct CheckboxOption;
|
struct CheckboxOption;
|
||||||
|
struct Event;
|
||||||
struct InputOption;
|
struct InputOption;
|
||||||
struct MenuOption;
|
struct MenuOption;
|
||||||
struct RadioboxOption;
|
struct RadioboxOption;
|
||||||
struct ToggleOption;
|
struct ToggleOption;
|
||||||
|
|
||||||
using Component = std::shared_ptr<ComponentBase>;
|
|
||||||
using Components = std::vector<Component>;
|
|
||||||
|
|
||||||
template <class T, class... Args>
|
template <class T, class... Args>
|
||||||
std::shared_ptr<T> Make(Args&&... args) {
|
std::shared_ptr<T> Make(Args&&... args) {
|
||||||
return std::make_shared<T>(args...);
|
return std::make_shared<T>(args...);
|
||||||
|
@ -22,8 +22,7 @@ using Components = std::vector<Component>;
|
|||||||
/// @ingroup component
|
/// @ingroup component
|
||||||
class ComponentBase {
|
class ComponentBase {
|
||||||
public:
|
public:
|
||||||
// Constructor/Destructor.
|
// virtual Destructor.
|
||||||
ComponentBase() = default;
|
|
||||||
virtual ~ComponentBase();
|
virtual ~ComponentBase();
|
||||||
|
|
||||||
// Component hierarchy:
|
// Component hierarchy:
|
||||||
@ -73,8 +72,6 @@ class ComponentBase {
|
|||||||
ComponentBase* parent_ = nullptr;
|
ComponentBase* parent_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Component = std::shared_ptr<ComponentBase>;
|
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
|
||||||
#endif /* end of include guard: FTXUI_COMPONENT_BASE_HPP */
|
#endif /* end of include guard: FTXUI_COMPONENT_BASE_HPP */
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
|
|
||||||
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
|
#include "ftxui/component/captured_mouse.hpp" // for CapturedMouse
|
||||||
#include "ftxui/component/event.hpp"
|
#include "ftxui/component/event.hpp" // for Event
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
class ComponentBase;
|
class ComponentBase;
|
||||||
|
struct Event;
|
||||||
|
|
||||||
using Component = std::shared_ptr<ComponentBase>;
|
using Component = std::shared_ptr<ComponentBase>;
|
||||||
struct Event;
|
|
||||||
|
|
||||||
class ScreenInteractive : public Screen {
|
class ScreenInteractive : public Screen {
|
||||||
public:
|
public:
|
||||||
|
@ -14,7 +14,7 @@ class Node;
|
|||||||
class Screen;
|
class Screen;
|
||||||
|
|
||||||
using Element = std::shared_ptr<Node>;
|
using Element = std::shared_ptr<Node>;
|
||||||
using Elements = std::vector<std::shared_ptr<Node>>;
|
using Elements = std::vector<Element>;
|
||||||
|
|
||||||
class Node {
|
class Node {
|
||||||
public:
|
public:
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
class Node;
|
class Node;
|
||||||
}
|
|
||||||
|
|
||||||
namespace ftxui {
|
|
||||||
using Element = std::shared_ptr<Node>;
|
using Element = std::shared_ptr<Node>;
|
||||||
|
|
||||||
/// @brief A unicode character and its associated style.
|
/// @brief A unicode character and its associated style.
|
||||||
|
@ -23,8 +23,6 @@ class ButtonBase : public ComponentBase {
|
|||||||
Ref<ButtonOption> option)
|
Ref<ButtonOption> option)
|
||||||
: label_(label), on_click_(on_click), option_(std::move(option)) {}
|
: label_(label), on_click_(on_click), option_(std::move(option)) {}
|
||||||
|
|
||||||
~ButtonBase() override = default;
|
|
||||||
|
|
||||||
// Component implementation:
|
// Component implementation:
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
auto style = Focused() ? inverted : nothing;
|
auto style = Focused() ? inverted : nothing;
|
||||||
|
@ -13,7 +13,6 @@ class CatchEventBase : public ComponentBase {
|
|||||||
// Constructor.
|
// Constructor.
|
||||||
CatchEventBase(std::function<bool(Event)> on_event)
|
CatchEventBase(std::function<bool(Event)> on_event)
|
||||||
: on_event_(std::move(on_event)) {}
|
: on_event_(std::move(on_event)) {}
|
||||||
~CatchEventBase() override = default;
|
|
||||||
|
|
||||||
// Component implementation.
|
// Component implementation.
|
||||||
bool OnEvent(Event event) override {
|
bool OnEvent(Event event) override {
|
||||||
|
@ -29,8 +29,6 @@ class CheckboxBase : public ComponentBase {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~CheckboxBase() override = default;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Component implementation.
|
// Component implementation.
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class CaptureMouseImpl : public CapturedMouseInterface {
|
class CaptureMouseImpl : public CapturedMouseInterface {};
|
||||||
public:
|
|
||||||
~CaptureMouseImpl() override {}
|
|
||||||
};
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ComponentBase::~ComponentBase() {
|
ComponentBase::~ComponentBase() {
|
||||||
@ -161,9 +158,9 @@ void ComponentBase::TakeFocus() {
|
|||||||
/// @param event
|
/// @param event
|
||||||
/// @ingroup component
|
/// @ingroup component
|
||||||
CapturedMouse ComponentBase::CaptureMouse(const Event& event) {
|
CapturedMouse ComponentBase::CaptureMouse(const Event& event) {
|
||||||
if (!event.screen_)
|
if (event.screen_)
|
||||||
return std::make_unique<CaptureMouseImpl>();
|
return event.screen_->CaptureMouse();
|
||||||
return event.screen_->CaptureMouse();
|
return std::make_unique<CaptureMouseImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -53,8 +53,6 @@ class ContainerBase : public ComponentBase {
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
~ContainerBase() override = default;
|
|
||||||
|
|
||||||
// Component override.
|
// Component override.
|
||||||
bool OnEvent(Event event) override {
|
bool OnEvent(Event event) override {
|
||||||
if (event.is_mouse())
|
if (event.is_mouse())
|
||||||
|
@ -24,7 +24,6 @@ class InputBase : public ComponentBase {
|
|||||||
ConstStringRef placeholder,
|
ConstStringRef placeholder,
|
||||||
Ref<InputOption> option)
|
Ref<InputOption> option)
|
||||||
: content_(content), placeholder_(placeholder), option_(option) {}
|
: content_(content), placeholder_(placeholder), option_(option) {}
|
||||||
~InputBase() override = default;
|
|
||||||
|
|
||||||
int& cursor_position() { return *(option_->cursor_position); }
|
int& cursor_position() { return *(option_->cursor_position); }
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ class RadioboxBase : public ComponentBase {
|
|||||||
option_->style_unchecked = L"( )";
|
option_->style_unchecked = L"( )";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
~RadioboxBase() override = default;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
|
@ -18,7 +18,6 @@ class RendererBase : public ComponentBase {
|
|||||||
|
|
||||||
// Constructor.
|
// Constructor.
|
||||||
RendererBase(std::function<Element()> render) : render_(std::move(render)) {}
|
RendererBase(std::function<Element()> render) : render_(std::move(render)) {}
|
||||||
~RendererBase() override = default;
|
|
||||||
|
|
||||||
// Component implementation.
|
// Component implementation.
|
||||||
Element Render() override { return render_(); }
|
Element Render() override { return render_(); }
|
||||||
|
@ -29,8 +29,6 @@ class ToggleBase : public ComponentBase {
|
|||||||
Ref<ToggleOption> option)
|
Ref<ToggleOption> option)
|
||||||
: entries_(entries), selected_(selected), option_(std::move(option)) {}
|
: entries_(entries), selected_(selected), option_(std::move(option)) {}
|
||||||
|
|
||||||
~ToggleBase() override = default;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
Elements children;
|
Elements children;
|
||||||
|
@ -11,8 +11,7 @@ namespace ftxui {
|
|||||||
|
|
||||||
class Blink : public NodeDecorator {
|
class Blink : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
Blink(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~Blink() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
Node::Render(screen);
|
Node::Render(screen);
|
||||||
|
@ -11,8 +11,7 @@ namespace ftxui {
|
|||||||
|
|
||||||
class Bold : public NodeDecorator {
|
class Bold : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
Bold(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~Bold() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
|
@ -22,7 +22,6 @@ class Border : public Node {
|
|||||||
std::end(simple_border_charset)) {}
|
std::end(simple_border_charset)) {}
|
||||||
Border(Elements children, Pixel pixel)
|
Border(Elements children, Pixel pixel)
|
||||||
: Node(std::move(children)), charset_pixel(10, pixel) {}
|
: Node(std::move(children)), charset_pixel(10, pixel) {}
|
||||||
~Border() override {}
|
|
||||||
|
|
||||||
std::vector<Pixel> charset_pixel;
|
std::vector<Pixel> charset_pixel;
|
||||||
std::vector<wchar_t> charset;
|
std::vector<wchar_t> charset;
|
||||||
|
@ -13,8 +13,7 @@ using ftxui::Screen;
|
|||||||
|
|
||||||
class ClearUnder : public NodeDecorator {
|
class ClearUnder : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
ClearUnder(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~ClearUnder() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
|
@ -30,7 +30,6 @@ class FgColor : public NodeDecorator {
|
|||||||
public:
|
public:
|
||||||
FgColor(Elements children, Color color)
|
FgColor(Elements children, Color color)
|
||||||
: NodeDecorator(std::move(children)), color_(color) {}
|
: NodeDecorator(std::move(children)), color_(color) {}
|
||||||
~FgColor() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
|
@ -13,7 +13,6 @@ namespace ftxui {
|
|||||||
class DBox : public Node {
|
class DBox : public Node {
|
||||||
public:
|
public:
|
||||||
DBox(Elements children) : Node(std::move(children)) {}
|
DBox(Elements children) : Node(std::move(children)) {}
|
||||||
~DBox() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 0;
|
requirement_.min_x = 0;
|
||||||
|
@ -9,12 +9,9 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
using ftxui::Screen;
|
|
||||||
|
|
||||||
class Dim : public NodeDecorator {
|
class Dim : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
Dim(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~Dim() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
Node::Render(screen);
|
Node::Render(screen);
|
||||||
|
@ -67,9 +67,8 @@ void function_not_flex(Requirement& r) {
|
|||||||
|
|
||||||
class Flex : public Node {
|
class Flex : public Node {
|
||||||
public:
|
public:
|
||||||
Flex(FlexFunction f) { f_ = f; }
|
Flex(FlexFunction f) : f_(f) {}
|
||||||
Flex(FlexFunction f, Element child) : Node(unpack(std::move(child))), f_(f) {}
|
Flex(FlexFunction f, Element child) : Node(unpack(std::move(child))), f_(f) {}
|
||||||
~Flex() override {}
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 0;
|
requirement_.min_x = 0;
|
||||||
requirement_.min_y = 0;
|
requirement_.min_y = 0;
|
||||||
|
@ -19,7 +19,6 @@ static wchar_t charset[] = L" ▏▎▍▌▋▊▉█";
|
|||||||
class Gauge : public Node {
|
class Gauge : public Node {
|
||||||
public:
|
public:
|
||||||
Gauge(float progress) : progress_(progress) {}
|
Gauge(float progress) : progress_(progress) {}
|
||||||
~Gauge() override {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.flex_grow_x = 1;
|
requirement_.flex_grow_x = 1;
|
||||||
|
@ -21,7 +21,6 @@ const wchar_t charset[] = L" ▗▐▖▄▟▌▙█";
|
|||||||
class Graph : public Node {
|
class Graph : public Node {
|
||||||
public:
|
public:
|
||||||
Graph(GraphFunction graph_function) : graph_function_(graph_function) {}
|
Graph(GraphFunction graph_function) : graph_function_(graph_function) {}
|
||||||
~Graph() override {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.flex_grow_x = 1;
|
requirement_.flex_grow_x = 1;
|
||||||
|
@ -13,7 +13,6 @@ namespace ftxui {
|
|||||||
class HBox : public Node {
|
class HBox : public Node {
|
||||||
public:
|
public:
|
||||||
HBox(Elements children) : Node(std::move(children)) {}
|
HBox(Elements children) : Node(std::move(children)) {}
|
||||||
~HBox() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 0;
|
requirement_.min_x = 0;
|
||||||
|
@ -13,7 +13,6 @@ namespace ftxui {
|
|||||||
class HFlow : public Node {
|
class HFlow : public Node {
|
||||||
public:
|
public:
|
||||||
HFlow(Elements children) : Node(std::move(children)) {}
|
HFlow(Elements children) : Node(std::move(children)) {}
|
||||||
~HFlow() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 1;
|
requirement_.min_x = 1;
|
||||||
|
@ -9,12 +9,9 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
using ftxui::Screen;
|
|
||||||
|
|
||||||
class Inverted : public NodeDecorator {
|
class Inverted : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
Inverted(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~Inverted() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
Node::Render(screen);
|
Node::Render(screen);
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
using ftxui::Screen;
|
|
||||||
|
|
||||||
Node::Node() {}
|
Node::Node() {}
|
||||||
Node::Node(Elements children) : children_(std::move(children)) {}
|
Node::Node(Elements children) : children_(std::move(children)) {}
|
||||||
Node::~Node() {}
|
Node::~Node() {}
|
||||||
|
@ -12,7 +12,6 @@ struct Box;
|
|||||||
class NodeDecorator : public Node {
|
class NodeDecorator : public Node {
|
||||||
public:
|
public:
|
||||||
NodeDecorator(Elements children) : Node(std::move(children)) {}
|
NodeDecorator(Elements children) : Node(std::move(children)) {}
|
||||||
~NodeDecorator() override {}
|
|
||||||
void ComputeRequirement() override;
|
void ComputeRequirement() override;
|
||||||
void SetBox(Box box) override;
|
void SetBox(Box box) override;
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,6 @@ class Reflect : public Node {
|
|||||||
public:
|
public:
|
||||||
Reflect(Element child, Box& box)
|
Reflect(Element child, Box& box)
|
||||||
: Node(unpack(std::move(child))), reflected_box_(box) {}
|
: Node(unpack(std::move(child))), reflected_box_(box) {}
|
||||||
~Reflect() override {}
|
|
||||||
|
|
||||||
void ComputeRequirement() final {
|
void ComputeRequirement() final {
|
||||||
Node::ComputeRequirement();
|
Node::ComputeRequirement();
|
||||||
|
@ -13,8 +13,6 @@ using ftxui::Screen;
|
|||||||
|
|
||||||
class Separator : public Node {
|
class Separator : public Node {
|
||||||
public:
|
public:
|
||||||
Separator() {}
|
|
||||||
~Separator() override {}
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 1;
|
requirement_.min_x = 1;
|
||||||
requirement_.min_y = 1;
|
requirement_.min_y = 1;
|
||||||
@ -41,7 +39,6 @@ class Separator : public Node {
|
|||||||
class SeparatorWithPixel : public Separator {
|
class SeparatorWithPixel : public Separator {
|
||||||
public:
|
public:
|
||||||
SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {}
|
SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {}
|
||||||
~SeparatorWithPixel() override {}
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
for (int y = box_.y_min; y <= box_.y_max; ++y) {
|
||||||
for (int x = box_.x_min; x <= box_.x_max; ++x) {
|
for (int x = box_.x_min; x <= box_.x_max; ++x) {
|
||||||
|
@ -19,8 +19,6 @@ class Size : public Node {
|
|||||||
constraint_(constraint),
|
constraint_(constraint),
|
||||||
value_(value) {}
|
value_(value) {}
|
||||||
|
|
||||||
~Size() override {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
Node::ComputeRequirement();
|
Node::ComputeRequirement();
|
||||||
requirement_ = children_[0]->requirement();
|
requirement_ = children_[0]->requirement();
|
||||||
|
@ -15,8 +15,7 @@ using ftxui::Screen;
|
|||||||
|
|
||||||
class Text : public Node {
|
class Text : public Node {
|
||||||
public:
|
public:
|
||||||
Text(std::wstring text) : Node(), text_(text) {}
|
Text(std::wstring text) : text_(text) {}
|
||||||
~Text() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = wstring_width(text_);
|
requirement_.min_x = wstring_width(text_);
|
||||||
@ -47,11 +46,10 @@ class Text : public Node {
|
|||||||
|
|
||||||
class VText : public Node {
|
class VText : public Node {
|
||||||
public:
|
public:
|
||||||
VText(std::wstring text) : Node(), text_(text) {
|
VText(std::wstring text) : text_(text) {
|
||||||
for (auto& c : text_)
|
for (auto& c : text_)
|
||||||
width_ = std::max(width_, wchar_width(c));
|
width_ = std::max(width_, wchar_width(c));
|
||||||
}
|
}
|
||||||
~VText() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = width_;
|
requirement_.min_x = width_;
|
||||||
|
@ -9,12 +9,9 @@
|
|||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
using ftxui::Screen;
|
|
||||||
|
|
||||||
class Underlined : public NodeDecorator {
|
class Underlined : public NodeDecorator {
|
||||||
public:
|
public:
|
||||||
Underlined(Elements children) : NodeDecorator(std::move(children)) {}
|
using NodeDecorator::NodeDecorator;
|
||||||
~Underlined() override {}
|
|
||||||
|
|
||||||
void Render(Screen& screen) override {
|
void Render(Screen& screen) override {
|
||||||
Node::Render(screen);
|
Node::Render(screen);
|
||||||
|
@ -13,7 +13,6 @@ namespace ftxui {
|
|||||||
class VBox : public Node {
|
class VBox : public Node {
|
||||||
public:
|
public:
|
||||||
VBox(Elements children) : Node(std::move(children)) {}
|
VBox(Elements children) : Node(std::move(children)) {}
|
||||||
~VBox() {}
|
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
requirement_.min_x = 0;
|
requirement_.min_x = 0;
|
||||||
|
@ -20,7 +20,7 @@ done
|
|||||||
|
|
||||||
exampleList="./doc/example_list.md"
|
exampleList="./doc/example_list.md"
|
||||||
echo "# Examples" > $exampleList
|
echo "# Examples" > $exampleList
|
||||||
files=$(find ./examples/ -iname "*.cpp")
|
files=$(find ./examples -iname "*.cpp" | sort)
|
||||||
for f in $files
|
for f in $files
|
||||||
do
|
do
|
||||||
echo "@example $f" >> $exampleList
|
echo "@example $f" >> $exampleList
|
||||||
|
Loading…
Reference in New Issue
Block a user