mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-29 22:55:51 +08:00
86c3b60a6f
Most CJK users use IME (input method) to type CJK characters. They need the cursor to be at the correct location, not in the bottom right corner. This CL does: * Move the cursor the focus() element. * Hide the cursor (and show it at exit) * Intercept SIGINT to guarantee proper cleanup all the time. This should fix the second issue mentionned on: https://github.com/ArthurSonzogni/FTXUI/issues/2
43 lines
1002 B
C++
43 lines
1002 B
C++
#ifndef FTXUI_DOM_NODE_HPP
|
|
#define FTXUI_DOM_NODE_HPP
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "ftxui/dom/requirement.hpp"
|
|
#include "ftxui/screen/box.hpp"
|
|
#include "ftxui/screen/screen.hpp"
|
|
|
|
namespace ftxui {
|
|
|
|
class Node {
|
|
public:
|
|
Node();
|
|
Node(std::vector<std::unique_ptr<Node>> children);
|
|
virtual ~Node();
|
|
|
|
// 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: Assign this element its final dimensions.
|
|
// Propagated from Parents to Children.
|
|
virtual void SetBox(Box box);
|
|
|
|
// Step 3: Draw this element.
|
|
virtual void Render(Screen& screen);
|
|
|
|
std::vector<std::unique_ptr<Node>> children;
|
|
protected:
|
|
Requirement requirement_;
|
|
Box box_;
|
|
};
|
|
|
|
void Render(Screen& screen, Node* node);
|
|
|
|
}; // namespace ftxui
|
|
|
|
#endif /* end of include guard: FTXUI_DOM_NODE_HPP */
|