mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 04:31:34 +08:00
Add support for PageUp/PageDown/Home/End buttons. (#242)
See: https://github.com/ArthurSonzogni/FTXUI/issues/241
This commit is contained in:
parent
4188ee2c04
commit
313ce9c35f
@ -101,6 +101,22 @@ class VerticalContainer : public ContainerBase {
|
||||
MoveSelector(-1);
|
||||
if (event == Event::ArrowDown || event == Event::Character('j'))
|
||||
MoveSelector(+1);
|
||||
if (event == Event::PageUp) {
|
||||
for(int i = 0; i<box_.y_max - box_.y_min; ++i)
|
||||
MoveSelector(-1);
|
||||
}
|
||||
if (event == Event::PageDown) {
|
||||
for(int i = 0; i<box_.y_max - box_.y_min; ++i)
|
||||
MoveSelector(1);
|
||||
}
|
||||
if (event == Event::Home) {
|
||||
for (size_t i = 0; i < children_.size(); ++i)
|
||||
MoveSelector(-1);
|
||||
}
|
||||
if (event == Event::End) {
|
||||
for (size_t i = 0; i < children_.size(); ++i)
|
||||
MoveSelector(1);
|
||||
}
|
||||
if (event == Event::Tab && children_.size())
|
||||
MoveSelectorWrap(+1);
|
||||
if (event == Event::TabReverse && children_.size())
|
||||
|
@ -61,6 +61,14 @@ class MenuBase : public ComponentBase {
|
||||
(*selected_)--;
|
||||
if (event == Event::ArrowDown || event == Event::Character('j'))
|
||||
(*selected_)++;
|
||||
if (event == Event::PageUp)
|
||||
(*selected_) -= box_.y_max - box_.y_min;
|
||||
if (event == Event::PageDown)
|
||||
(*selected_) += box_.y_max - box_.y_min;
|
||||
if (event == Event::Home)
|
||||
(*selected_) = 0;
|
||||
if (event == Event::End)
|
||||
(*selected_) = entries_.size() - 1;
|
||||
if (event == Event::Tab && entries_.size())
|
||||
*selected_ = (*selected_ + 1) % entries_.size();
|
||||
if (event == Event::TabReverse && entries_.size())
|
||||
|
@ -79,6 +79,14 @@ class RadioboxBase : public ComponentBase {
|
||||
(hovered_)--;
|
||||
if (event == Event::ArrowDown || event == Event::Character('j'))
|
||||
(hovered_)++;
|
||||
if (event == Event::PageUp)
|
||||
(hovered_) -= box_.y_max - box_.y_min;
|
||||
if (event == Event::PageDown)
|
||||
(hovered_) += box_.y_max - box_.y_min;
|
||||
if (event == Event::Home)
|
||||
(hovered_) = 0;
|
||||
if (event == Event::End)
|
||||
(hovered_) = entries_.size() - 1;
|
||||
if (event == Event::Tab && entries_.size())
|
||||
hovered_ = (hovered_ + 1) % entries_.size();
|
||||
if (event == Event::TabReverse && entries_.size())
|
||||
|
Loading…
Reference in New Issue
Block a user