No Description

Anthony Leedom 0678be6a6f Update checkbox and add UI tests 3 years ago
.github 401c0602f5 Rename to Termox, major commit 3 years ago
demos 0678be6a6f Update checkbox and add UI tests 3 years ago
docs 0678be6a6f Update checkbox and add UI tests 3 years ago
external b27be9de13 Replace Signals library with signals-light. 3 years ago
include 0678be6a6f Update checkbox and add UI tests 3 years ago
src 0678be6a6f Update checkbox and add UI tests 3 years ago
tests 0678be6a6f Update checkbox and add UI tests 3 years ago
.clang-format 751c94bfd9 add operator| for widgets and widget collections 4 years ago
.gitignore cc8199d70e Add event filter signals to Widget 3 years ago
.gitmodules 7e5ffc93f3 Remove chess demo submodule 3 years ago
.travis.yml 09b5456002 Update travis-ci config 4 years ago
CMakeLists.txt 0f38a8e7b4 Remove old tests and add new test for Checkbox Widgets. 3 years ago
LICENSE.txt 78631b5e2e Add Readme and license 6 years ago
README.md 5d4c31f78e Make Label Widget take a template template parameter for layout 3 years ago

README.md

Build Status Read the Manual Read the Reference

TermOx 🐂

TermOx is a Terminal User Interface Framework for C++17. Built on top of nCurses, it defines a set of Widgets, Layouts, and Events that make it quick to craft unique user interfaces in the terminal.

The Widget Library contains many common Widget and Layout types that can be pieced together to create a composite interface. It's easy to expand on top of these types to create new Widgets and Layouts.

This project was previously named CPPurses.

Usage

#include <termox/termox.hpp>

int main()
{
    using namespace ox;
    auto app =
        layout::vertical(
            textbox("Hello, World!" | fg(Color::Red) | Trait::Bold) | pipe::name("tb"),
            layout::horizontal<Button>(
                button("Button 1") | bg(Color::Blue) | pipe::name("b1"),
                button("Button 2") | bg(Color::Violet) | pipe::name("b2")
            ) | pipe::fixed_height(1)
        );
    auto& tb = app->find_child_by_name("tb");
    app->find_child_by_name("b1") | pipe::on_press([&tb]{ tb.append("Button 1 Pressed"); });
    app->find_child_by_name("b2") | pipe::on_press([&tb]{ tb.append("Button 2 Pressed"); });
    return System{}.run(*app);
}

See the Manual for more in depth explanations and examples.

Reference documentation can be found here.

Features

  • Event System to handle Mouse, Keyboard and Animation events, among others

  • Signals and Slots to communicate between Widgets

  • Color Palettes and Dynamic Colors

  • Animation

  • Inherit from existing Widgets and Layouts to create new UI elements

  • Library of commonly used Widgets and Layouts

Build Instructions

TermOx depends on a Signals library and nCurses, these are both included as git submodules.

git clone https://github.com/a-n-t-h-o-n-y/TermOx.git
mkdir TermOx/build && cd TermOx/build
git submodule update --init --recursive   # Pull in dependencies
cmake .. -DCMAKE_BUILD_TYPE=Release       # Generate Makefiles
make                                      # Build library
make demos                                # Build demos(optional)

Using the Library

It is recommended to clone this library into your project and use it as a submodule rather than installing it to your system. This way you can lock your application to a specific version of TermOx.

CMake will add the library target TermOx if you add the TermOx directory with add_subdirectory(...).

# CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
add_executable(my_app
               my_app.main.cpp
               ...
)

# TermOx is cloned into a directory named external/
add_subdirectory(external/TermOx)
target_link_libraries(foo TermOx)

License

This software is distributed under the MIT License.