Nana is a cross-platform C++ library for creating graphical user interfaces, currently it supports Windows and Linux(X11) platforms. By using platform-independent interfaces, it allows the program works on all supported operating systems. Nana is a free and open source software, licensed under Boost Software License. It is written in Standard C++, and uses many advanced C++ features, such as templates, standard libraries, exception and RTTI, therefore can be compiled by Standard C++ compilers(VC2013, GCC/MinGW, Clang).
Nana is a modern C++ library, it means that users have freedom for various modern C++ features, lambda, smart pointers and the standard library.
The primary task of this project is to make things simple and intuitive. For example,
A old style C++ version:
void my_callback(Widget* wdg, void* userdata)
{
const char* str = (const char*)userdata;
wdg->caption(str);
}
const char* str = new char[N];
strcpy(str, get_text());
button->callback(my_callback, (void*)str);
A modern C++ version:auto str = get_text();
button.events().click([str,&button]
{
button.caption(str);
});
Obviously, the benefit from the modern C++ is more simpler, while the old C++ version is error-prone, because these matters you have to care about are type-conversion and resource managemet.