Giter Club home page Giter Club logo

console-ui's Introduction

console-ui

Pure C++, Lite weight UI Kit for POSIX terminal.

Describe UI in Pure C++ language

With simple code, you can describe an interface like this:

code:

void description(Canvas *cv)
{
    cv->setBackground(Cyan);

    cv->add(new Label(-100, 5, "TITLE", Magenta, White));
    cv->endHeader();

    cv->add(new TextField(-40, 3, "username", 'u', false, White, Blue));
    cv->add(new TextField(-40, 3, "password", 'p', true, White, Blue));
    
    cv->add(new Padding(-40, 3));

    cv->beginHorizontal();
    cv->add(new Button(-40, 3, "login", nullptr, 'l', Blue, White));
    cv->add(new Button(-40, 3, "regist", nullptr, 'r', Green, White));
    cv->endHorizontal();

    cv->beginTailer();
    cv->add(new Label(-100, 5, "TAILER", Red, White));
}

Event Driven

Using or Inheritance the Action class, you can save data you need in the action.

  • Bind an action to a button

    just pass the action in when constructing the button.

  • Combine multiple action

    Construct an Actions class to combine two action. (They will execute in order)

  • Bind action to special events

    Canvas provide start and update action pointer, point them to action you want to make actions on Canvas start or update.

    TextField provide finish and entering action pointer, point them to action you want to make actions on TextField been focused or user finish entering.

Change Canvas

  • Start with a Canvas by Screen::initRoot()

  • Change Canvas by Screen::setRoot()

How to use

To run the example, just

make compile_lib
make compile
make run

To write your own program, just keep it in the console-ui folder.

console-ui's People

Contributors

wwwzbwcom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.