mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 00:48:09 +08:00
Add mouse implementation of most components.
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user