Add dom::blink and component::Input

This commit is contained in:
Arthur Sonzogni
2018-10-21 14:18:11 +02:00
parent 50a732c651
commit 20eaeae4c3
11 changed files with 96 additions and 31 deletions

View File

@@ -28,4 +28,4 @@
* mouse
* terminal event
You can make implement your own.
Implement your own!

View File

@@ -14,8 +14,8 @@ class Input : public Component {
~Input() override;
// State.
std::wstring content = L"input";
std::wstring placeholder = L"placeholder";
std::wstring content;
std::wstring placeholder;
// State update callback.
std::function<void()> on_change = [](){};

View File

@@ -28,6 +28,7 @@ Element bold(Element);
Element dim(Element);
Element inverted(Element);
Element underlined(Element);
Element blink(Element);
Element color(Color, Element);
Element bgcolor(Color, Element);
@@ -37,6 +38,9 @@ Element vcenter(Element);
Element center(Element);
Element flex(Element);
// --- Util ---
Element nothing(Element element);
template <class... Args>
Children unpack(Args... args) {
Children vec;

View File

@@ -9,7 +9,7 @@ namespace ftxui {
struct Event{
public:
// --- Character ---
static Event Character(char);
static Event Character(int);
// --- Arrow ---
static Event ArrowLeft;
@@ -27,7 +27,7 @@ struct Event{
bool operator==(const Event& other) { return values == other.values; }
// Internal representation.
std::array<char, 5> values = {0, 0, 0, 0, 0};
std::array<int, 5> values = {0, 0, 0, 0, 0};
};

View File

@@ -14,10 +14,11 @@ namespace dom {
struct Pixel {
wchar_t character = U' ';
bool blink = false;
bool bold = false;
bool dim = false;
bool inverted = false;
bool underlined = false;
bool dim = false;
Color background_color = Color::Default;
Color foreground_color = Color::Default;
};