Add mouse implementation of most components.

This commit is contained in:
ArthurSonzogni
2021-04-18 22:33:41 +02:00
parent d685a8655e
commit 890a41a64c
20 changed files with 239 additions and 12 deletions

View File

@@ -30,6 +30,9 @@ Container Container::Tab(int* selector) {
}
bool Container::OnEvent(Event event) {
if (event.is_mouse())
return OnMouseEvent(event);
if (!Focused())
return false;
@@ -115,6 +118,17 @@ Element Container::TabRender() {
return text(L"Empty container");
}
bool Container::OnMouseEvent(Event event) {
if (selector_)
return ActiveChild()->OnEvent(event);
for (Component* child : children_) {
if (child->OnEvent(event))
return true;
}
return false;
}
} // namespace ftxui
// Copyright 2020 Arthur Sonzogni. All rights reserved.