Add Blink. Refactor examples.

This commit is contained in:
Arthur Sonzogni
2019-01-02 22:33:59 +01:00
parent 20eaeae4c3
commit 13e04176a4
32 changed files with 122 additions and 116 deletions

View File

@@ -7,6 +7,7 @@ namespace ftxui {
namespace component {
// A component where focus and events are automatically handled for you.
// Please use ComponentVertical or ComponentHorizontal.
class ComponentDirection : public Component {
public:
ComponentDirection(Delegate* delegate);

View File

@@ -15,6 +15,7 @@ using Children = std::vector<Child>;
Element vbox(Children);
Element hbox(Children);
Element flex();
Element flex(Element);
// --- Widget --
Element text(std::wstring text);
@@ -23,7 +24,7 @@ Element gauge(float ratio);
Element frame(Child);
Element frame(Child title, Child content);
// -- Decorator (Style) ---
// -- Style ---
Element bold(Element);
Element dim(Element);
Element inverted(Element);
@@ -32,11 +33,10 @@ Element blink(Element);
Element color(Color, Element);
Element bgcolor(Color, Element);
// --- Decorator ---
// --- Util ---
Element hcenter(Element);
Element vcenter(Element);
Element center(Element);
Element flex(Element);
// --- Util ---
Element nothing(Element element);

View File

@@ -17,14 +17,14 @@ class Node {
Node(std::vector<std::unique_ptr<Node>> children);
virtual ~Node();
// Step 1: Direction parent <= children.
// Compute layout requirement. Tell parent what dimensions this
// Step 1: Compute layout requirement. Tell parent what dimensions this
// element wants to be.
// Propagated from Children to Parents.
virtual void ComputeRequirement();
Requirement requirement() { return requirement_; }
// Step 2: Direction parent => children.
// Assign this element its final dimensions.
// Step 2: Assign this element its final dimensions.
// Propagated from Parents to Children.
virtual void SetBox(Box box);
// Step 3: Draw this element.