GithubHelp home page GithubHelp logo

a-n-t-h-o-n-y / termox Goto Github PK

View Code? Open in Web Editor NEW
619.0 20.0 47.0 27.88 MB

C++17 Terminal User Interface(TUI) Library.

License: MIT License

CMake 0.92% C++ 99.08%
ncurses tui terminal terminal-colors curses user-interface widgets xterm

termox's People

Contributors

a-n-t-h-o-n-y avatar afshinpir avatar buzzert avatar cloud11665 avatar hsnks100 avatar jktjkt avatar luluvia avatar nkoturovic avatar sheldonth avatar thknepper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

termox's Issues

Wide characters show garbled code

I see in the code border segments default is
/// Holds all 8 Segments that a Border is made up of.
struct Segments {
Segment north{L'─'};
Segment south{L'─'};
Segment east{L'│'};
Segment west{L'│'};
Segment north_west{L'┌'};
Segment north_east{L'┐'};
Segment south_west{L'└'};
WeChat Work Screenshot_20200706151344

    Segment south_east{L'┘'};

Widget List incomplete implementation

Widget List is very useful
this class is not fully implemented in CPPurses project

look at:
include/cppurses/widget/widgets/list.hpp.idk

Is anyone working on this class?

Failed to compile, gcc 7.5.0

Found errors of the form parameter packs not expanded with ‘...’ and operand of fold expression has no unexpanded parameter packs when compiling things from widget/tuple.hpp. The function causing the error is template <std::size_t... Is> [[nodiscard]] auto indexed_init_children(std::index_sequence<Is...>, typename Widget_t::Parameters... p)

I am using a Ubuntu 18.04 system with gcc 7.5.0.
I checked that, from https://gcc.gnu.org/projects/cxx-status.html#cxx17, the only feature in C++17 not implemented in gcc 7 is P0512R0, something related to Template argument deduction for class templates.

I wonder if this failure is due to the unimplemented feature P0512R0 in gcc 7 ?
If that is the case, is there a workaround to help me out ?

Sampled error messages
[build] /usr/bin/x86_64-linux-gnu-g++-7 -I.../TermOx/include -I.../TermOx/external/signals-light/include -I.../TermOx/external/Escape/include -g -Wall -Wextra -Wpedantic -std=gnu++1z -MD -MT src/CMakeFiles/TermOx.dir/widget/widgets/color_select.cpp.o -MF src/CMakeFiles/TermOx.dir/widget/widgets/color_select.cpp.o.d -o src/CMakeFiles/TermOx.dir/widget/widgets/color_select.cpp.o -c .../TermOx/src/widget/widgets/color_select.cpp
[build] In file included from .../TermOx/include/termox/widget/bordered.hpp:13:0,
[build] from .../TermOx/include/termox/widget/pipe.hpp:18,
[build] from .../TermOx/src/widget/widgets/color_select.cpp:8:
[build] .../TermOx/include/termox/widget/tuple.hpp: In lambda function:
[build] .../TermOx/include/termox/widget/tuple.hpp:83:27: error: parameter packs not expanded with ‘...’:
[build] if constexpr (std::is_constructible_v<
[build] ^~~
[build] .../TermOx/include/termox/widget/tuple.hpp:83:27: note: ‘Widget_t’
[build] .../TermOx/include/termox/widget/tuple.hpp:85:50: error: parameter packs not expanded with ‘...’:
[build] return std::make_unique<Widget_t>(std::move(p));
[build] ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
[build] .../TermOx/include/termox/widget/tuple.hpp:85:50: note: ‘__p’
[build] .../TermOx/include/termox/widget/tuple.hpp:85:50: note: ‘Widget_t’
[build] .../TermOx/include/termox/widget/tuple.hpp:87:50: error: parameter packs not expanded with ‘...’:
[build] return std::make_unique<Widget_t>();
[build] ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[build] .../TermOx/include/termox/widget/tuple.hpp:87:50: note: ‘Widget_t’
[build] .../TermOx/include/termox/widget/tuple.hpp: In member function ‘auto ox::Tuple<Layout_t, Widget_t>::indexed_init_children(std::index_sequence<__indices ...>, typename Widget_t::Parameters ...)’:
[build] .../TermOx/include/termox/widget/tuple.hpp:89:10: error: operand of fold expression has no unexpanded parameter packs
[build] ...);
[build] ^~~

"Feature" request: Better documentation and code examples

I know that this is still mostly an early WIP project with an unstable API, but I think it would still be nice to have some more code examples in the wiki to illustrate, incrementally, how certain features are implemented using this library. Yes, one could look in the code demos and the documentation, but this would still be nice to have. For example, see how this unrelated library does it in their wiki.

P.S. I quite like this project, and it's much less clunky than CDK, let alone directly using ncurses.

Minor build breaking typo in demos

Specifically where I encountered it was in the chess demo where it was trying to link to: "/usr/local/lib64/liblibcppurses.a" while I believe it should be linking to: "/usr/local/lib/libcppurses.a" as that was the where it was installed.

OS: Ubuntu 19.04
arch: x64

Howto use List<T>

Is there any demonstration where List is used , have failed to insert data into it .

Registering `SIGINT` internally in library

Hi

I noticed that you can registered SIGINT internally in your library. It is somehow bad idea, because it conflict registering that signal in the code that uses your library. I suggest removing it from your library.

Usage on repl.it

Your library looks like something where this would be possible, so here goes...

On https://repl.it, in order to use a library, I have to find a way to #include it. Is there a way that this library can be #included? I can't use CMake or anything like that.

undefined reference to `cppurses::Tree::set_head(cppurses::Widget*)'

Whenever I try to compile my program, I get this error:

undefined reference to `cppurses::Tree::set_head(cppurses::Widget*)'

My CMake file:

cmake_minimum_required(VERSION 2.8)

project(CPPursesTest)
add_executable(${PROJECT_NAME} "main.cpp")

target_link_libraries(${PROJECT_NAME} -lcppurses -lncurses -pthread)

Can anyone please help me? Thanks in advance!

grey screen with ncurses-6.1-r2 on Gentoo

After applying the following patch to fix random segfaults due to mixing ncursesw with tinfo (instead of tinfow):

diff --git a/cmake/Modules/FindNcursesw.cmake b/cmake/Modules/FindNcursesw.cmake
index e572c70..4b098f7 100644
--- a/cmake/Modules/FindNcursesw.cmake
+++ b/cmake/Modules/FindNcursesw.cmake
@@ -127,9 +127,9 @@ if(CURSES_USE_NCURSESW)
   CHECK_LIBRARY_EXISTS("${CURSES_NCURSESW_LIBRARY}"
     cbreak "" CURSES_NCURSESW_HAS_CBREAK)
   if(NOT CURSES_NCURSESW_HAS_CBREAK)
-    find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}"
-      DOC "Path to libtinfo.so or .lib or .a")
-    find_library(CURSES_EXTRA_LIBRARY tinfo )
+    find_library(CURSES_EXTRA_LIBRARY tinfow HINTS "${_cursesLibDir}"
+      DOC "Path to libtinfow.so or .lib or .a")
+    find_library(CURSES_EXTRA_LIBRARY tinfow )
   endif()
 
   # Report whether each possible header name exists in the include directory.
@@ -163,9 +163,9 @@ if(CURSES_USE_NCURSESW)
   endif()
 
 
-  find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}"
-    DOC "Path to libform.so or .lib or .a")
-  find_library(CURSES_FORM_LIBRARY form )
+  find_library(CURSES_FORM_LIBRARY formw HINTS "${_cursesLibDir}"
+    DOC "Path to libformw.so or .lib or .a")
+  find_library(CURSES_FORM_LIBRARY formw )
 
   # Need to provide the *_LIBRARIES
   set(CURSES_LIBRARIES ${CURSES_LIBRARY})

I tried to run the demo. All I got was a blank, grey screen. There was no text, no menus, no widgets. Tried in both Konsole (which sets TERM=xterm-256color) and plain old XTerm (TERM=xterm).

Compiler error trying to build unit tests on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)

Trying make termox.unit.tests produces the following errors:

$ make termox.unit.tests
[ 17%] Built target escape
[ 94%] Built target TermOx
[ 94%] Building CXX object tests/CMakeFiles/termox.unit.tests.dir/catch2.main.cpp.o
In file included from /usr/include/signal.h:328,
                 from /home/samara/Projects/TermOx/external/signals-light/external/Catch2/single_include/catch2/catch.hpp:7959,
                 from /home/samara/Projects/TermOx/tests/catch2.main.cpp:2:
/home/samara/Projects/TermOx/external/signals-light/external/Catch2/single_include/catch2/catch.hpp:10822:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10822 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/bits/sigstksz.h:24:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
/home/samara/Projects/TermOx/external/signals-light/external/Catch2/single_include/catch2/catch.hpp:10881:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10881 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
make[3]: *** [tests/CMakeFiles/termox.unit.tests.dir/build.make:76: tests/CMakeFiles/termox.unit.tests.dir/catch2.main.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:623: tests/CMakeFiles/termox.unit.tests.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:630: tests/CMakeFiles/termox.unit.tests.dir/rule] Error 2
make: *** [Makefile:364: termox.unit.tests] Error 2

This is because MINSIGSTKSZ is no longer a constant on Linux

Usage with other loop based library

Hi,
I am considering CPPurses. I looked at the code samples and it looks pretty promising. Great Work!

In my workflow I use ros (Robot Operating System). ROS is an event loop based library.
A sample loop looks something like

while( ros::ok() )
{
    rate.sleep(10)
    ros::spinOnce(); 
}

My question is:
Can CPPurses be used with ROS? If yes could you give me some pointers to get it running?

Make fails on Ubuntu Studio 17.10

Hi,

I've been following the build instructions in the readme. The two git operations succeeded, then I had to install GTest and that seemed to be OK, too, but now make is failing and I'm stuck for an idea:

barry@lightbulb-s2:~/Code Blocks Projects/CPPurses/build$ make Scanning dependencies of target cppurses [ 0%] Building CXX object CMakeFiles/cppurses.dir/src/system/child_event.cpp.o c++: error: unrecognized command line option ‘-ferror-limit=10’ CMakeFiles/cppurses.dir/build.make:62: recipe for target 'CMakeFiles/cppurses.dir/src/system/child_event.cpp.o' failed make[2]: *** [CMakeFiles/cppurses.dir/src/system/child_event.cpp.o] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/cppurses.dir/all' failed make[1]: *** [CMakeFiles/cppurses.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

Do you have any suggestions?

Thanks,

B

Many problems in Mac Terminal.app

I'm seeing many, many visual problems running the demo app in macOS 12's stock Terminal app. Most of them seem to involve background colors, but some are worse -- e.g. in the Focus demo everything is underlined and clicking has no effect.

The demo does appear to work OK in the 3rd-party iTerm2.

Is TermOx supposed to work in Terminal? I couldn't find any obvious compatibility chart.

ALLOW_DUPLICATE_CUSTOM_TARGETS global property kills Xcode IDE

Because the ALLOW_DUPLICATE_CUSTOM_TARGETS global property flag is set, we get into a situation where certain CMake generators are unhappy.

Cmake generation fails with an error message

-- Configuring done
CMake Error: This project has enabled the ALLOW_DUPLICATE_CUSTOM_TARGETS global property.  The "Xcode" generator does not support duplicate custom targets.  Consider using a Makefiles generator or fix the project to not use duplicate target names.

I'm not sure exactly what it is that that accomplishes but I wonder if there's a way it can be turned off (At least on Apple systems)

CMake Release Build Segmentation Fault

Howdy!
I am very new to TermOx, so this may be an issue on my end, but my program runs into a Segmentation Fault when using Release settings on CMake. I am using GCC 10.2.

Here is a trace of the the threads:

2021-04-19-053738_834x265_escrotum

Multiple windows support

Hi,

Have you considered to add multiple ncurses screen/window/panel support to the lib? Or is there some reason just not doing that? It's great so far, but it would be nice to have also pop-up windows, pop-up-menus and dialogs. Seems that now it's using the root main window (stdscr) for everything.

Maybe some RootWindow class using stdscr when initializing the app, and then maybe some central widget is given to the root which is actually a sub window for stdscr, and that handles widget childs as now. If you want a pop-up, insert a widget to the root or some other high level widget and the pop-up will be on top on everything below the pop-up widget? It might need some major refactoring, though.

-Matti

Compile Error on Lubuntu 16 LTS

Hello , after following the instructions in the read me , all seems fine till i run make which produces this huge compile error log . Is there something i might be missing to compile the code ?
`child_event.cpp:1:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:48:39: error: ‘is_nt_cc’ was not declared in this scope
Optional(const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:48:49: error: expected primary-expression before ‘>’ token
Optional(const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:48:51: error: expected primary-expression before ‘)’ token
Optional(const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:56:34: error: ‘is_nt_mc’ was not declared in this scope
Optional(T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:56:44: error: expected primary-expression before ‘>’ token
Optional(T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:56:46: error: expected primary-expression before ‘)’ token
Optional(T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:66:55: error: ‘is_nt_cc’ was not declared in this scope
Optional(bool condition, const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:66:65: error: expected primary-expression before ‘>’ token
Optional(bool condition, const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:66:67: error: expected primary-expression before ‘)’ token
Optional(bool condition, const T& value) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:78:50: error: ‘is_nt_mc’ was not declared in this scope
Optional(bool condition, T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:78:60: error: expected primary-expression before ‘>’ token
Optional(bool condition, T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:78:62: error: expected primary-expression before ‘)’ token
Optional(bool condition, T&& value) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:85:26: error: ‘is_nt_d’ was not declared in this scope
~Optional() noexcept(is_nt_d()) { this->destroy(); }
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:85:35: error: expected primary-expression before ‘>’ token
~Optional() noexcept(is_nt_d()) { this->destroy(); }
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:85:37: error: expected primary-expression before ‘)’ token
~Optional() noexcept(is_nt_d()) { this->destroy(); }
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:93:44: error: ‘is_nt_cc’ was not declared in this scope
Optional(const Optional& rhs) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:93:54: error: expected primary-expression before ‘>’ token
Optional(const Optional& rhs) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:93:56: error: expected primary-expression before ‘)’ token
Optional(const Optional& rhs) noexcept(is_nt_cc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:104:39: error: ‘is_nt_mc’ was not declared in this scope
Optional(Optional&& rhs) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:104:49: error: expected primary-expression before ‘>’ token
Optional(Optional&& rhs) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:104:51: error: expected primary-expression before ‘)’ token
Optional(Optional&& rhs) noexcept(is_nt_mc()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:144:55: error: ‘is_nt_d_cc_ca’ was not declared in this scope
Optional& operator=(const Optional& rhs) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:144:70: error: expected primary-expression before ‘>’ token
Optional& operator=(const Optional& rhs) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:144:72: error: expected primary-expression before ‘)’ token
Optional& operator=(const Optional& rhs) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:161:50: error: ‘is_nt_d_mc_ma’ was not declared in this scope
Optional& operator=(Optional&& rhs) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:161:65: error: expected primary-expression before ‘>’ token
Optional& operator=(Optional&& rhs) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:161:67: error: expected primary-expression before ‘)’ token
Optional& operator=(Optional&& rhs) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:179:58: error: ‘is_nt_d_cc_a’ was not declared in this scope
Optional& operator=(const Optional& rhs) noexcept(is_nt_d_cc_a<T, U>())
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:179:72: error: expected primary-expression before ‘,’ token
Optional& operator=(const Optional& rhs) noexcept(is_nt_d_cc_a<T, U>()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:179:72: error: expected ‘)’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:179:72: error: expected ‘;’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:196:53: error: ‘is_nt_d_mc_a’ was not declared in this scope
Optional& operator=(Optional&& rhs) noexcept(is_nt_d_mc_a<T, U>()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:196:67: error: expected primary-expression before ‘,’ token
Optional& operator=(Optional&& rhs) noexcept(is_nt_d_mc_a<T, U>()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:196:67: error: expected ‘)’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:196:67: error: expected ‘;’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:213:50: error: ‘is_nt_d_cc_ca’ was not declared in this scope
Optional& operator=(const T& value) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:213:65: error: expected primary-expression before ‘>’ token
Optional& operator=(const T& value) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:213:67: error: expected primary-expression before ‘)’ token
Optional& operator=(const T& value) noexcept(is_nt_d_cc_ca()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:227:45: error: ‘is_nt_d_mc_ma’ was not declared in this scope
Optional& operator=(T&& value) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:227:60: error: expected primary-expression before ‘>’ token
Optional& operator=(T&& value) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:227:62: error: expected primary-expression before ‘)’ token
Optional& operator=(T&& value) noexcept(is_nt_d_mc_ma()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:242:47: error: ‘is_nt_d’ was not declared in this scope
Optional& operator=(opt::None_t) noexcept(is_nt_d()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:242:56: error: expected primary-expression before ‘>’ token
Optional& operator=(opt::None_t) noexcept(is_nt_d()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:242:58: error: expected primary-expression before ‘)’ token
Optional& operator=(opt::None_t) noexcept(is_nt_d()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:252:43: error: ‘is_nt_d_c’ was not declared in this scope
void emplace(Args&&... args) noexcept(is_nt_d_c<T, Args...>()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:252:54: error: expected primary-expression before ‘,’ token
void emplace(Args&&... args) noexcept(is_nt_d_c<T, Args...>()) {
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:252:54: error: expected ‘)’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:252:54: error: expected ‘;’ before ‘,’ token
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp: In static member function ‘static constexpr bool opt::Optional::is_nt_d_cc_ca()’:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:454:16: error: ‘conjunction’ is not a member of ‘std::experimental’
return std::experimental::conjunction<
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:455:44: error: expected primary-expression before ‘,’ token
std::is_nothrow_destructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:456:50: error: expected primary-expression before ‘,’ token
std::is_nothrow_copy_constructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:457:46: error: expected primary-expression before ‘>’ token
std::is_nothrow_copy_assignable>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:457:48: error: ‘::value’ has not been declared
std::is_nothrow_copy_assignable>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp: In static member function ‘static constexpr bool opt::Optional::is_nt_d_mc_ma()’:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:462:16: error: ‘conjunction’ is not a member of ‘std::experimental’
return std::experimental::conjunction<
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:463:44: error: expected primary-expression before ‘,’ token
std::is_nothrow_destructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:464:50: error: expected primary-expression before ‘,’ token
std::is_nothrow_move_constructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:465:46: error: expected primary-expression before ‘>’ token
std::is_nothrow_move_assignable>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:465:48: error: ‘::value’ has not been declared
std::is_nothrow_move_assignable>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp: In static member function ‘static constexpr bool opt::Optional::is_nt_d_cc_a()’:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:470:16: error: ‘conjunction’ is not a member of ‘std::experimental’
return std::experimental::conjunction<
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:471:44: error: expected primary-expression before ‘,’ token
std::is_nothrow_destructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:472:50: error: expected primary-expression before ‘,’ token
std::is_nothrow_copy_constructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:473:51: error: expected primary-expression before ‘>’ token
std::is_nothrow_assignable<X, const Y&>>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:473:53: error: ‘::value’ has not been declared
std::is_nothrow_assignable<X, const Y&>>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp: In static member function ‘static constexpr bool opt::Optional::is_nt_d_mc_a()’:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:478:16: error: ‘conjunction’ is not a member of ‘std::experimental’
return std::experimental::conjunction<
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:479:44: error: expected primary-expression before ‘,’ token
std::is_nothrow_destructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:480:50: error: expected primary-expression before ‘,’ token
std::is_nothrow_move_constructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:481:46: error: expected primary-expression before ‘>’ token
std::is_nothrow_assignable<X, Y&&>>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:481:48: error: ‘::value’ has not been declared
std::is_nothrow_assignable<X, Y&&>>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp: In static member function ‘static constexpr bool opt::Optional::is_nt_d_c()’:
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:486:16: error: ‘conjunction’ is not a member of ‘std::experimental’
return std::experimental::conjunction<
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:487:44: error: expected primary-expression before ‘,’ token
std::is_nothrow_destructible,
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:488:53: error: expected primary-expression before ‘>’ token
std::is_nothrow_constructible<X, Args...>>::value;
^
/home/william/Desktop/experts/ANTHONY/CPPurses/libs/Signals/libs/Optional/include/optional/optional_value.hpp:488:55: error: ‘::value’ has not been declared
std::is_nothrow_constructible<X, Args...>>::value;
^
In file included from /home/william/Desktop/experts/ANTHONY/CPPurses/src/system/child_event.cpp:3:0:
/home/william/Desktop/experts/ANTHONY/CPPurses/include/cppurses/widget/widget.hpp: At global scope:
/home/william/Desktop/experts/ANTHONY/CPPurses/include/cppurses/widget/widget.hpp:202:6: error: prototype for ‘decltype (u->.find_child(name)) cppurses::Widget::find_child_impl(U, const string&)’ does not match any in class ‘cppurses::Widget’
auto Widget::find_child_impl(U u, const std::string& name)
^
/home/william/Desktop/experts/ANTHONY/CPPurses/include/cppurses/widget/widget.hpp:152:17: error: candidate is: template<class T, class U> static decltype (u->.find_child(name)) cppurses::Widget::find_child_impl(U, const string&)
static auto find_child_impl(U u, const std::string& name)
^
CMakeFiles/cppurses.dir/build.make:62: recipe for target 'CMakeFiles/cppurses.dir/src/system/child_event.cpp.o' failed
make[2]: *** [CMakeFiles/cppurses.dir/src/system/child_event.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cppurses.dir/all' failed
make[1]: *** [CMakeFiles/cppurses.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

`

Error when compiling program using current master brach

The error occurs when I try to compile any program using(or even just including) the current master branch version of cppurses and reads as follows:
usr/bin/ld: /usr/local/lib/libcppurses.a(event_loop.cpp.o): in function 'std::thread::thread<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<cppurses::Event_loop::run_async()::{lambda()#1}> >, int>::_Async_state_impl(std::tuple<cppurses::Event_loop::run_async()::{lambda()#1}>&&)::{lambda()#1}, , void>(std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<cppurses::Event_loop::run_async()::{lambda()#1}> >, int>::_Async_state_impl(std::tuple<cppurses::Event_loop::run_async()::{lambda()#1}>&&)::{lambda()#1}&&)': event_loop.cpp:(.text+0x2061): undefined reference to 'pthread_create' /usr/bin/ld: /usr/local/lib/libcppurses.a(output.cpp.o): in function '(anonymous namespace)::put_as_wchar(cppurses::Glyph const&)': output.cpp:(.text+0x30f): undefined reference to 'setcchar' /usr/bin/ld: output.cpp:(.text+0x32a): undefined reference to 'wadd_wchnstr' collect2: error: ld returned 1 exit status

Now this could just be because it didn't install correctly but I still believe it should brought to to your attention if it was not an installation problem.

OS: Ubuntu 19.04
arch: x64

Aur package does not compile

Hi,

First of all, thanks for the great library! I'm utilizing it in my own c++ project and it feels great!

I use Arch Linux, and the Aur-package seems to be broken. I get error:

CMake Error at src/CMakeLists.txt:170 (export):
export given target "optional" which is not built by this project.

I managed to build it manually by first building Optional library and installing it, removing references to "optional" from src/CMakeLists.txt then building and installing the Cppurses. The same issue is in the master build.

error Compiling : wadd_wchnstr’ has not been declared

Hello,

I'd love to use your library for some personal projects, and also play your curses chess game over ssh

i use a rapsberry pi 3 for my developpement (with latest stretch rapsbian/debian)
i cloned CPPurses repository, just like in your instructions, i had to setup google tests lib and ncurses to get to this step on my deb box,

at the step "make " i encouter a compiling error,(after cmake ..), the full output of make is :
``root@raspberrypi:/home/pi/Downloads/HTMLPAGES/CPPurses/build# make
[ 1%] Building CXX object CMakeFiles/cppurses.dir/src/system/ncurses_event_listener.cpp.o
[ 3%] Building CXX object CMakeFiles/cppurses.dir/src/system/on_tree_event.cpp.o
[ 3%] Building CXX object CMakeFiles/cppurses.dir/src/system/paint_event.cpp.o
[ 4%] Building CXX object CMakeFiles/cppurses.dir/src/system/resize_event.cpp.o
[ 6%] Building CXX object CMakeFiles/cppurses.dir/src/system/show_event.cpp.o
[ 7%] Building CXX object CMakeFiles/cppurses.dir/src/system/system.cpp.o
[ 9%] Building CXX object CMakeFiles/cppurses.dir/src/system/shortcuts.cpp.o
[ 11%] Building CXX object CMakeFiles/cppurses.dir/src/painter/ncurses_paint_engine.cpp.o
/home/pi/Downloads/HTMLPAGES/CPPurses/src/painter/ncurses_paint_engine.cpp: In member function ‘void cppurses::detail::NCurses_paint_engine::put_glyph(const cppurses::Glyph&)’:
/home/pi/Downloads/HTMLPAGES/CPPurses/src/painter/ncurses_paint_engine.cpp:123:5: error: ‘::wadd_wchnstr’ has not been declared
::wadd_wchnstr(::stdscr, &image, 1);
^~
CMakeFiles/cppurses.dir/build.make:686: recipe for target 'CMakeFiles/cppurses.dir/src/painter/ncurses_paint_engine.cpp.o' failed
make[2]: *** [CMakeFiles/cppurses.dir/src/painter/ncurses_paint_engine.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cppurses.dir/all' failed
make[1]: *** [CMakeFiles/cppurses.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
root@raspberrypi:/home/pi/Downloads/HTMLPAGES/CPPurses/build#

List initialization in the library examples

In your code you often have the convention where a class reference member is list initialized with the return value of *_layout->make_child()

but doing so with a function parameter list seems to cause a compiler error.

{
private:
    Textbox_base& textBoxBase{this->make_child<Textbox_base>("This is my textbox")}; // works
//    Textbox_base& textBoxBase(this->make_child<Textbox_base>("This is my textbox")); // compile err
};

I'm having trouble figuring out where your code makes the distinction for the list initialization?

Feature request: Table widget

Hi. i was surprised when i see this repo first time. It is totally an awesome effort.
But still i think there are some widgets misses. For example a table-view like this:

Screenshot-from-2019-10-08-15-44-12.png

Actually, i'm developing a tui app and needs a table to show some data and also update some cells of them at runtime.
It can be awesome that see this widget in CPPurses.

CPPurses for Windows porting

Anthony,
It is very exciting to discover this project which meet our needs. We found this project is very good to use modern project for TUI (C++14). We would like to use it but we are stocked at Windows porting.
It would be nice if these following OS can be supported.
Microsoft Windows and FreeBSD/Solaris?

Errors building using make

Unfortunately I can't give much more context than the make output:

[  2%] Building CXX object src/CMakeFiles/cppurses.dir/system/delete_event.cpp.o
In file included from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/detail/connection_impl.hpp:4:0,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/detail/signal_impl.hpp:4,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/signal.hpp:6,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/widget/widget.hpp:15,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/system/events/delete_event.hpp:7,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/src/system/delete_event.cpp:1:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/slot.hpp:51:59: error: ‘function_’ was not declared in this scope
     Slot(const Function& func) noexcept(noexcept(decltype(function_){func})) : function_{func} {}
                                                           ^~~~~~~~~
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/slot.hpp:51:59: note: suggested alternative: ‘Function’
     Slot(const Function& func) noexcept(noexcept(decltype(function_){func})) : function_{func} {}
                                                           ^~~~~~~~~
                                                           Function
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/slot.hpp:51:59: error: ‘function_’ was not declared in this scope
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/libs/Signals/include/signals/slot.hpp:51:59: note: suggested alternative: ‘Function’
     Slot(const Function& func) noexcept(noexcept(decltype(function_){func})) : function_{func} {}
                                                           ^~~~~~~~~
                                                           Function
In file included from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/widget/widget.hpp:18:0,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/system/events/delete_event.hpp:7,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/src/system/delete_event.cpp:1:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp: In member function ‘constexpr void cppurses::Brush::set_background(cppurses::Color)’:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp:44:70: error: call to non-constexpr function ‘std::optional<cppurses::Color>& std::optional<cppurses::Color>::operator=(std::optional<cppurses::Color>&&)’
     constexpr void set_background(Color color) { background_color_ = color; }
                                                                      ^~~~~
In file included from /usr/include/c++/7/bits/node_handle.h:39:0,
                 from /usr/include/c++/7/bits/hashtable.h:37,
                 from /usr/include/c++/7/unordered_map:47,
                 from /usr/include/c++/7/functional:60,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/widget/widget.hpp:6,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/system/events/delete_event.hpp:7,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/src/system/delete_event.cpp:1:
/usr/include/c++/7/optional:453:11: note: ‘std::optional<cppurses::Color>& std::optional<cppurses::Color>::operator=(std::optional<cppurses::Color>&&)’ is not usable as a constexpr function because:
     class optional
           ^~~~~~~~
/usr/include/c++/7/optional:367:7: note: defaulted constructor calls non-constexpr ‘std::_Optional_base<_Tp>& std::_Optional_base<_Tp>::operator=(std::_Optional_base<_Tp>&&) [with _Tp = cppurses::Color]’
       operator=(_Optional_base&& __other)
       ^~~~~~~~
In file included from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/widget/widget.hpp:18:0,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/system/events/delete_event.hpp:7,
                 from /mnt/c/crystalbox/lulu/code/repositories/public/cppurses/src/system/delete_event.cpp:1:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp: In member function ‘constexpr void cppurses::Brush::set_foreground(cppurses::Color)’:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp:47:70: error: call to non-constexpr function ‘std::optional<cppurses::Color>& std::optional<cppurses::Color>::operator=(std::optional<cppurses::Color>&&)’
     constexpr void set_foreground(Color color) { foreground_color_ = color; }
                                                                      ^~~~~
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp: In member function ‘constexpr void cppurses::Brush::remove_background()’:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp:50:67: error: call to non-constexpr function ‘std::optional<_Tp>& std::optional<_Tp>::operator=(std::nullopt_t) [with _Tp = cppurses::Color]’
     constexpr void remove_background() { background_color_ = std::nullopt; }
                                                                   ^~~~~~~
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp: In member function ‘constexpr void cppurses::Brush::remove_foreground()’:
/mnt/c/crystalbox/lulu/code/repositories/public/cppurses/include/cppurses/painter/brush.hpp:53:67: error: call to non-constexpr function ‘std::optional<_Tp>& std::optional<_Tp>::operator=(std::nullopt_t) [with _Tp = cppurses::Color]’
     constexpr void remove_foreground() { foreground_color_ = std::nullopt; }
                                                                   ^~~~~~~
src/CMakeFiles/cppurses.dir/build.make:62: recipe for target 'src/CMakeFiles/cppurses.dir/system/delete_event.cpp.o' failed
make[2]: *** [src/CMakeFiles/cppurses.dir/system/delete_event.cpp.o] Error 1
CMakeFiles/Makefile2:153: recipe for target 'src/CMakeFiles/cppurses.dir/all' failed
make[1]: *** [src/CMakeFiles/cppurses.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

OS: Ubuntu 16.04 LTS x86-64

urxvt term colors issue

Description

After executing any cppurses tui program in some terminal emulators (tested with multiple versions of urxvt, and st(simple terminal)) some of the terminal colors get modified.
Colors: 239-254 after end of program execution (with or without interrupt) look different.
Screenshot: terminal color test
I'm using Arch Linux
Tried with following packages:

URXVT

  1. community/rxvt-unicode (9.22-7)
  2. aur/rxvt-unicode-intensityfix (9.22-12)

st - Simple Terminal

  1. aur/st (0.8.1-1)

Additional info

st (Simple terminal) logs to stderr:

# at cppurses program execution start
erresc: unknown csi ESC[22;0;0t
# at cppurses program end
erresc: invalid color (null)
erresc: unknown csi ESC[23;0;0t
  • On the other hand, using some other terminal emulators: lxterminal or xterm issue described above does not occur.

Advice on composing long widget

Hi,
I would appreciate some guidance.

Given the existing widgets what should I use to compose the following:
A widget with a long vertical list of checkboxes and a vertical scrollbar.

I could not find similar widget in the examples.

How to show wide charaters

What a beautiful TUI library!
I just started using it.

Is there any way to display the wide characters?
It doesn't seem to depend on ncurses anymore, do I still need to install ncursesw?

Runtime error trying to execute UI tests (and possibly all other programs?) on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)

While the tests build without error with make termox.ui.tests after building the library, the resulting binaries all throw with the following response:

$ ./fixed.ui.test
terminate called after throwing an instance of 'std::runtime_error'
  what():  initialize_terminal(): setlocale() failed.
Aborted

This is presumably a problem further up the code chain, since the UI tests themselves don't contain any code that should cause this to throw, but I haven't searched through the code enough to say where the issue lies.

`Line_edit.veil_text()` crashes application

Hi

I tried to use veil_text() in Line_edit to create a password textbox, but it crashes application.
I guess it creates infinite recursion, because you try to use set_contents() within paint_event().

when I make demos, It occurs the following errors.

╭─ksoo@ksoo-pc ~/CPPurses/build  ‹master*› 
╰─$ make demos                 
Build Type: Release
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- CURSES_INCLUDE_DIR:/usr/include
-- NCURSES_INCLUDE_PATH:/usr/include
-- CURSES_LIBRARIES:/usr/lib/libncursesw.so/usr/lib/libform.so
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ksoo/CPPurses/build
[ 58%] Built target cppurses
Scanning dependencies of target demos
[ 60%] Building CXX object demos/CMakeFiles/demos.dir/chess/src/side_pane.cpp.o
/home/ksoo/CPPurses/demos/chess/src/side_pane.cpp: In member function ‘void Side_pane::toggle_status(const Chessboard_widget&)’:
/home/ksoo/CPPurses/demos/chess/src/side_pane.cpp:112:16: error: ‘class cppurses::Status_bar’ has no member named ‘set_contents’; did you mean ‘contents’?
         status.set_contents(
                ^~~~~~~~~~~~
                contents
/home/ksoo/CPPurses/demos/chess/src/side_pane.cpp:115:16: error: ‘class cppurses::Status_bar’ has no member named ‘set_contents’; did you mean ‘contents’?
         status.set_contents(
                ^~~~~~~~~~~~
                contents

I am interest in your curses. I try to build cppurses, It occurs some errors.

AppleClang support?

Hi. Very cool library. Is this meant to support AppleClang 10+ as the compiler?

I am seeing some build errors on the current master. Apologies if you are intending this to be GCC only.
Errors are

[ 28%] Building CXX object src/CMakeFiles/cppurses.dir/painter/ncurses_paint_engine.cpp.o
/Users/s/Development/CPPurses/src/painter/ncurses_paint_engine.cpp:131:67: error: cannot initialize a parameter of type 'bool *' with an lvalue of type 'bool'
    auto symbol_and_attributes = detail::get_chtype(glyph.symbol, use_addch);
                                                                  ^~~~~~~~~
/Users/s/Development/CPPurses/include/cppurses/painter/detail/extended_char.hpp:10:38: note: passing argument to parameter 'use_addch' here
chtype get_chtype(wchar_t sym, bool* use_addch);
                                     ^
/Users/s/Development/CPPurses/src/painter/ncurses_paint_engine.cpp:209:25: error: use of undeclared identifier 'cchar_t'
    auto temp_display = cchar_t{' '};
                        ^
/Users/s/Development/CPPurses/src/painter/ncurses_paint_engine.cpp:209:32: error: expected ';' at end of declaration
    auto temp_display = cchar_t{' '};
                               ^
                               ;
/Users/s/Development/CPPurses/src/painter/ncurses_paint_engine.cpp:210:7: error: no member named 'setcchar' in the global namespace
    ::setcchar(&temp_display, temp_sym, A_NORMAL, temp_color_pair, nullptr);
    ~~^
/Users/s/Development/CPPurses/src/painter/ncurses_paint_engine.cpp:211:7: error: no member named 'wadd_wchnstr' in the global namespace; did you mean 'waddchnstr'?
    ::wadd_wchnstr(::stdscr, &temp_display, 1);
    ~~^~~~~~~~~~~~
      waddchnstr
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/curses.h:737:28: note: 'waddchnstr' declared here
extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);    /* implemented */
                           ^
5 errors generated.

Thanks
Sheldon

Update documentation to point to how to install gtest.

While installing following instructions, one would get:

CMake Error at /usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_MAIN_LIBRARY)

heavy Widget::timer_event() make ui unresponsive

Great Library! I Love it!

I got a question about Widget::timer_event().
I have several widgets that fetch data from some service synchronically in Widget::timer_event().
Then a confirm_button become non responsive occasionally.

Does that mean I have to write time_event() to finish as soon as possible?

I made a sample code to demo the issue.
Running this cause the confirm_button to be occasionally unresponsive.

#include <cppurses/system/system.hpp>
#include <cppurses/widget/layouts/vertical.hpp>
#include <cppurses/widget/widgets/confirm_button.hpp>
#include <cppurses/widget/widget.hpp>
#include <cppurses/painter/painter.hpp>

using namespace cppurses;

class Animation : public cppurses::Widget {
public:
    explicit Animation() {
        std::chrono::milliseconds p{3000};
        this->enable_animation(p);
    }

    bool timer_event() override {
        std::this_thread::sleep_for(std::chrono::seconds(1));
        return Widget::timer_event();
    };
    bool paint_event() override {
        cppurses::Painter painter{*this};
        return Widget::paint_event();
    };
};

int main() {
    System system;
    cppurses::layout::Vertical mainLayout;

    mainLayout.make_child<Animation>();
    mainLayout.make_child<cppurses::Confirm_button>("Seriously?");

    return system.run(mainLayout);
}

Cannot find -lcppurses

Whenever I try to compile my project I get this error:

/usr/bin/ld: cannot find -lcppurses
collect2: error: ld returned 1 exit status

My CMake file:

cmake_minimum_required(VERSION 2.8)

project(CPPursesTest)
add_executable(${PROJECT_NAME} "main.cpp")

target_link_libraries(${PROJECT_NAME} -lcppurses -lncurses -pthread)

The same thing happens when I compile it with this command:

% gcc -o program main.cpp -lcppurses -lncurses -pthread

Can anybody help me, please? Thanks in advance!

Loader failure to build demos on Raspberry Pi 4 (Debian bookworm 12.2.0-14, GCC 12.2)

The TermOx library builds fine with cmake .. -DCMAKE_BUILD_TYPE=Release && make, but trying make demos produces the following ld error

$ make demos
[ 15%] Built target escape
[ 78%] Built target TermOx
[ 80%] Linking CXX executable demos
/usr/bin/ld: CMakeFiles/demos.dir/game_of_life/gol_demo.cpp.o: in function `ox::Bar<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Primary_policy, ox::layout::v_detail::Primary_length, ox::layout::v_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Secondary_policy, ox::layout::v_detail::Secondary_length, ox::layout::v_detail::Secondary_offset>, ox::layout::v_detail::Get_area, ox::layout::v_detail::Get_point> > >::type>::Title::Title(ox::Bar<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Primary_policy, ox::layout::v_detail::Primary_length, ox::layout::v_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Secondary_policy, ox::layout::v_detail::Secondary_length, ox::layout::v_detail::Secondary_offset>, ox::layout::v_detail::Get_area, ox::layout::v_detail::Get_point> > >::type>::Title::Parameters)':
gol_demo.cpp:(.text._ZN2ox3BarINS_6layout17Opposite_templateINS1_6detail13Linear_layoutINS_6WidgetENS3_24Linear_layout_parametersINS3_20Dimension_parametersINS1_8v_detail14Primary_policyENS8_14Primary_lengthENS8_14Primary_offsetEEENS7_INS8_16Secondary_policyENS8_16Secondary_lengthENS8_16Secondary_offsetEEENS8_8Get_areaENS8_9Get_pointEEEEEE4typeEE5TitleC2ENSO_10ParametersE[_ZN2ox3BarINS_6layout17Opposite_templateINS1_6detail13Linear_layoutINS_6WidgetENS3_24Linear_layout_parametersINS3_20Dimension_parametersINS1_8v_detail14Primary_policyENS8_14Primary_lengthENS8_14Primary_offsetEEENS7_INS8_16Secondary_policyENS8_16Secondary_lengthENS8_16Secondary_offsetEEENS8_8Get_areaENS8_9Get_pointEEEEEE4typeEE5TitleC5ENSO_10ParametersE]+0x168): undefined reference to `ox::Label<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Primary_policy, ox::layout::v_detail::Primary_length, ox::layout::v_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Secondary_policy, ox::layout::v_detail::Secondary_length, ox::layout::v_detail::Secondary_offset>, ox::layout::v_detail::Get_area, ox::layout::v_detail::Get_point> > >::type>::Label(ox::Label<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Primary_policy, ox::layout::v_detail::Primary_length, ox::layout::v_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::v_detail::Secondary_policy, ox::layout::v_detail::Secondary_length, ox::layout::v_detail::Secondary_offset>, ox::layout::v_detail::Get_area, ox::layout::v_detail::Get_point> > >::type>::Parameters)'
/usr/bin/ld: CMakeFiles/demos.dir/notepad/notepad.cpp.o: in function `ox::Bar<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Primary_policy, ox::layout::h_detail::Primary_length, ox::layout::h_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Secondary_policy, ox::layout::h_detail::Secondary_length, ox::layout::h_detail::Secondary_offset>, ox::layout::h_detail::Get_area, ox::layout::h_detail::Get_point> > >::type>::Title::Title(ox::Bar<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Primary_policy, ox::layout::h_detail::Primary_length, ox::layout::h_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Secondary_policy, ox::layout::h_detail::Secondary_length, ox::layout::h_detail::Secondary_offset>, ox::layout::h_detail::Get_area, ox::layout::h_detail::Get_point> > >::type>::Title::Parameters)':
notepad.cpp:(.text._ZN2ox3BarINS_6layout17Opposite_templateINS1_6detail13Linear_layoutINS_6WidgetENS3_24Linear_layout_parametersINS3_20Dimension_parametersINS1_8h_detail14Primary_policyENS8_14Primary_lengthENS8_14Primary_offsetEEENS7_INS8_16Secondary_policyENS8_16Secondary_lengthENS8_16Secondary_offsetEEENS8_8Get_areaENS8_9Get_pointEEEEEE4typeEE5TitleC2ENSO_10ParametersE[_ZN2ox3BarINS_6layout17Opposite_templateINS1_6detail13Linear_layoutINS_6WidgetENS3_24Linear_layout_parametersINS3_20Dimension_parametersINS1_8h_detail14Primary_policyENS8_14Primary_lengthENS8_14Primary_offsetEEENS7_INS8_16Secondary_policyENS8_16Secondary_lengthENS8_16Secondary_offsetEEENS8_8Get_areaENS8_9Get_pointEEEEEE4typeEE5TitleC5ENSO_10ParametersE]+0x160): undefined reference to `ox::Label<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Primary_policy, ox::layout::h_detail::Primary_length, ox::layout::h_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Secondary_policy, ox::layout::h_detail::Secondary_length, ox::layout::h_detail::Secondary_offset>, ox::layout::h_detail::Get_area, ox::layout::h_detail::Get_point> > >::type>::Label(ox::Label<ox::layout::Opposite_template<ox::layout::detail::Linear_layout<ox::Widget, ox::layout::detail::Linear_layout_parameters<ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Primary_policy, ox::layout::h_detail::Primary_length, ox::layout::h_detail::Primary_offset>, ox::layout::detail::Dimension_parameters<ox::layout::h_detail::Secondary_policy, ox::layout::h_detail::Secondary_length, ox::layout::h_detail::Secondary_offset>, ox::layout::h_detail::Get_area, ox::layout::h_detail::Get_point> > >::type>::Parameters)'
collect2: error: ld returned 1 exit status
make[3]: *** [demos/CMakeFiles/demos.dir/build.make:403: demos/demos] Error 1
make[2]: *** [CMakeFiles/Makefile2:348: demos/CMakeFiles/demos.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:355: demos/CMakeFiles/demos.dir/rule] Error 2
make: *** [Makefile:234: demos] Error 2

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.