Feature: hscroll_indicator (#753)

This is the symetrical of `vscroll_indicator`.

Requested by @ibrahimnasson.

Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/752
This commit is contained in:
Arthur Sonzogni
2023-09-26 23:08:42 +02:00
committed by GitHub
parent 20d4be286b
commit c24a274292
16 changed files with 185 additions and 22 deletions

View File

@@ -33,19 +33,21 @@ ButtonOption ButtonStyle() {
int main() {
int value = 50;
// The tree of components. This defines how to navigate using the keyboard.
auto buttons =
Container::Vertical({
auto buttons = Container::Vertical({
Container::Horizontal({
Button("-1", [&] { value--; }, ButtonStyle()),
Button("+1", [&] { value++; }, ButtonStyle()),
Button(
"-1", [&] { value--; }, ButtonStyle()),
Button(
"+1", [&] { value++; }, ButtonStyle()),
}) | flex,
Container::Horizontal({
Button("-10", [&] { value -= 10; }, ButtonStyle()),
Button("+10", [&] { value += 10; }, ButtonStyle()),
Button(
"-10", [&] { value -= 10; }, ButtonStyle()),
Button(
"+10", [&] { value += 10; }, ButtonStyle()),
}) | flex,
});
});
// Modify the way to render them on screen:
auto component = Renderer(buttons, [&] {
@@ -53,7 +55,8 @@ int main() {
text("value = " + std::to_string(value)),
separator(),
buttons->Render() | flex,
}) | flex | border;
}) |
flex | border;
});
auto screen = ScreenInteractive::Fullscreen();