Skip to content

A FTXUI grid container to allow navigation in horizontal and vertical directions

Notifications You must be signed in to change notification settings

mingsheng13/grid-container-ftxui

Repository files navigation

grid-container-ftxui

A FTXUI component implementing an easy grid container using Container::Horizontal and Container::Vertical.

gridcontainer

To use

#include "ftxui-grid-container/grid-container.hpp"

API

namespace ftxui {
Component GridContainer(const std::vector<Components>& lines);
Component GridContainer(const std::vector<Components>& lines, int* x, int* y);
}  // namespace ftxui

Example

See ./example.

#include "ftxui/component/component.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include "ftxui/dom/elements.hpp"
#include "ftxui-grid-container/grid-container.hpp"

using namespace ftxui;

int main() {
  auto button0 = Button({.label = "0"});
  auto button1 = Button({.label = "1"});
  auto button2 = Button({.label = "2"});
  auto button3 = Button({.label = "3"});

  auto grid = GridContainer({
    { button0, button1 },
    { button2, button3 },
  })

  auto screen = ScreenInteractive::TerminalOutput();
  screen.Loop(grid);
  return 0;
}
cmake_minimum_required (VERSION 3.14)
project(my-app LANGUAGES CXX VERSION 1.0.0)

include(FetchContent)

FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
  GIT_TAG v5.0.0
)

FetchContent_Declare(ftxui-grid-container
  GIT_REPOSITORY https://github.com/mingsheng13/grid-container-ftxui
  GIT_TAG master
)

FetchContent_MakeAvailable(ftxui)
FetchContent_MakeAvailable(ftxui-grid-container)
add_executable(my-app src/main.cpp)
target_link_libraries(my-app
  PRIVATE ftxui-grid-container
)

About

A FTXUI grid container to allow navigation in horizontal and vertical directions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published