qpcr4vir / nana Goto Github PK
View Code? Open in Web Editor NEWThis project forked from cnjinhao/nana
a modern C++ GUI library
Home Page: http://nanapro.org
License: Boost Software License 1.0
This project forked from cnjinhao/nana
a modern C++ GUI library
Home Page: http://nanapro.org
License: Boost Software License 1.0
The format set for a cell will override the format for the column.
This could be dynamic. We set a function for the column which create dynamically the format for cell.
drag the bar: OK: move the list. Click long the buttons in the bar - not
container - like objects:
back() and front() for menu & item_proxy & menu_bar, tabbar, combox, listbox & cat_proxy,
refactor all API to use or mimic std , extensions or proposed libraries:
std::filesystem, chrono, 2D drawing, regex, codecvt_utf, atomic, thread, iterator, optional, any
see feature test macros
Only occurred in second display !!
rm -rf ReleaseClang && cmake -BReleaseClang -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ && cmake --build ReleaseClang -- The CXX compiler identification is Clang 6.0.0 -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL -- Found X11: /usr/include -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for connect -- Looking for connect - found -- Looking for remove -- Looking for remove - found -- Looking for shmat -- Looking for shmat - found -- Looking for IceConnectionNumber in ICE -- Looking for IceConnectionNumber in ICE - found -- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'fontconfig' -- Found fontconfig, version 2.12.6 -- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Looking for C++ include filesystem -- Looking for C++ include filesystem - found -- Looking for C++ include experimental/filesystem -- Looking for C++ include experimental/filesystem - found -- C++ Filesystem header: -- Performing Test CXX17_BUILTIN -- Performing Test CXX17_BUILTIN - Failed -- Performing Test CXX17_FLAG -- Performing Test CXX17_FLAG - Success -- C++ Standard-17 support: via -std=c++17 -- Performing Test C++17FS_FLAG -- Performing Test C++17FS_FLAG - Success -- C++ Filesystem library: builtin -- Configuring done -- Generating done -- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/ReleaseClang [7/80] Building CXX object CMakeFiles/nana.dir/source/charset.cpp.o ../source/charset.cpp:1130:14: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] data_ = std::move(str()); ^ ../source/charset.cpp:1130:14: note: remove std::move call here data_ = std::move(str()); ^~~~~~~~~~ ~ ../source/charset.cpp:1240:23: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] wdata_for_move_ = std::move(wstr()); ^ ../source/charset.cpp:1240:23: note: remove std::move call here wdata_for_move_ = std::move(wstr()); ^~~~~~~~~~ ~ ../source/charset.cpp:1277:22: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] data_for_move_ = std::move(str()); ^ ../source/charset.cpp:1277:22: note: remove std::move call here data_for_move_ = std::move(str()); ^~~~~~~~~~ ~ 3 warnings generated. [23/80] Building CXX object CMakeFiles/nana.dir/source/gui/filebox.cpp.o FAILED: CMakeFiles/nana.dir/source/gui/filebox.cpp.o /usr/bin/clang++ -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -O3 -march=native -mtune=native -DNDEBUG -Wall -pthread -std=gnu++17 -MD -MT CMakeFiles/nana.dir/source/gui/filebox.cpp.o -MF CMakeFiles/nana.dir/source/gui/filebox.cpp.o.d -o CMakeFiles/nana.dir/source/gui/filebox.cpp.o -c ../source/gui/filebox.cpp ../source/gui/filebox.cpp:1604:37: error: no member named 'weakly_canonical' in namespace 'std::filesystem' : impl_(new implement{ owner, fs::weakly_canonical(init_path).make_preferred(), title, false}) ~~~~^ 1 error generated. [32/80] Building CXX object CMakeFiles/nana.dir/source/gui/place.cpp.o ninja: build stopped: subcommand failed.
or to fit the text
This make even more sense now that VS2017 and CLion work easily with cmake
Examples: travis CI with clang 5 and gcc 7 in Linux and OSX and including Boost.
A book: how to use Travis CI with C++
menu
vs. toolbar
:menu
: hold a plain ptr to an implement
which use structures in a drawerbase::menu
namespace.menu_type
, menu_item_type
, and the enum checks
, enum class checks
{
none,
option,
highlight
};
menu_item_type
hold a plain pointer to a menu_type
and all the state-data of the item which can be acceded with an item_proxy
which hold a pointer to the menu
and the position order of the item.
A new item can be added with menu::append
or menu::insert
.
enum class tools
{
separator,
button,
toggle,
dropdown
};
toolbar
: the drawer
hold a plain pointer to a drawer_impl_type
that hold an item_container
of toolbar_item
s. The later hold the state-data.
A new item can be added with toolbar::append
or with item_proxy::dropdown_append
.
Implement/use checks
/tools
create command
: a no-widget class, wich state-data useful to set and to share menu
, toolbar
, button
and checkbox
image
(a shared type),image
Make menu and toolbar API similar:
In menu
:
arg_menu
?menu_type
menu_item_type
<---- real data here (generalize?)
shared_command
shared_command
(to be used by other constructors)shared_command
(to be used by other constructors)image
dropdown_item
construct take a menu
?I may have listbox with more than 100 000 items, and I need to sort.
The sort function come in two versions: for text only and for the atached any.objects only. If the second exist for the given header (column) to sort it have preference to be used.
Also, it could be a ref to an array or vector with the actual data, and indexed by the any object or better simple by the index of the item. The real items or item proxys are created only on demand, on the fly, need to be draw, but not when only need to be ordered. To draw we need maximal 20 to 100 items, not more: it is not to much and is not going to be very slow. Drawed items could be conserverd until it go out of the screen.
ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake --version | head -n1 cmake version 3.16.0 ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.3 LTS Release: 18.04 Codename: bionic ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ c++ --version c++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Debug mode
ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake -BDebug -DCMAKE_BUILD_TYPE=Debug -GNinja -- The CXX compiler identification is GNU 7.4.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL -- Found X11: /usr/include -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for connect -- Looking for connect - found -- Looking for remove -- Looking for remove - found -- Looking for shmat -- Looking for shmat - found -- Looking for IceConnectionNumber in ICE -- Looking for IceConnectionNumber in ICE - found -- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'fontconfig' -- Found fontconfig, version 2.12.6 -- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Looking for C++ include filesystem -- Looking for C++ include filesystem - not found -- Looking for C++ include experimental/filesystem -- Looking for C++ include experimental/filesystem - found -- C++ Filesystem header: -- Performing Test CXX17_BUILTIN -- Performing Test CXX17_BUILTIN - Failed -- Performing Test CXX17_FLAG -- Performing Test CXX17_FLAG - Success -- C++ Standard-17 support: via -std=c++17 -- Performing Test C++17FS_FLAG -- Performing Test C++17FS_FLAG - Success -- C++ Filesystem library: builtin -- Configuring done -- Generating done -- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/Debug ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake --build Debug [7/80] Building CXX object CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o FAILED: CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o /usr/bin/c++ -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -g -Wall -fmax-errors=3 -pthread -std=gnu++1z -MD -MT CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -MF CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o.d -o CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -c ../source/filesystem/filesystem.cpp ../source/filesystem/filesystem.cpp:1600:39: error: ‘path’ does not name a type; did you mean ‘putw’? bool try_throw(int err_val, const path& p, std::error_code* ec, const char* message) ^~~~ putw ../source/filesystem/filesystem.cpp: In function ‘bool detail::try_throw(int, const int&, std::error_code*, const char*)’: ../source/filesystem/filesystem.cpp:1611:29: error: ‘generic_category’ was not declared in this scope error_code(err_val, generic_category()))); ^~~~~~~~~~~~~~~~ ../source/filesystem/filesystem.cpp:1611:29: note: suggested alternatives: In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0, from /usr/include/c++/7/experimental/filesystem:36, from ../include/nana/filesystem/filesystem.hpp:112, from ../include/nana/filesystem/filesystem_ext.hpp:18, from ../source/filesystem/filesystem.cpp:14: /usr/include/c++/7/system_error:135:40: note: ‘std::_V2::generic_category’ _GLIBCXX_CONST const error_category& generic_category() noexcept; ^~~~~~~~~~~~~~~~ /usr/include/c++/7/system_error:135:40: note: ‘std::_V2::generic_category’ ../source/filesystem/filesystem.cpp:1611:9: error: ‘error_code’ was not declared in this scope error_code(err_val, generic_category()))); ^~~~~~~~~~ ../source/filesystem/filesystem.cpp:1611:9: note: suggested alternative: In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0, from /usr/include/c++/7/experimental/filesystem:36, from ../include/nana/filesystem/filesystem.hpp:112, from ../include/nana/filesystem/filesystem_ext.hpp:18, from ../source/filesystem/filesystem.cpp:14: /usr/include/c++/7/system_error:146:10: note: ‘std::error_code’ struct error_code ^~~~~~~~~~ compilation terminated due to -fmax-errors=3. [16/80] Building CXX object CMakeFiles/nana.dir/source/gui/dragdrop.cpp.o ninja: build stopped: subcommand failed.
Release mode
ppetraki@vanguard:~/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3$ cmake -BRelease -DCMAKE_BUILD_TYPE=Release -GNinja && cmake --build Release -- The CXX compiler identification is GNU 7.4.0 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done You are using nana directly from original sources. (Recommended!) If this was not your intention, and what you want is to install precomplied nana first, then please tern ON option NANA_CMAKE_INSTALL -- Found X11: /usr/include -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so -- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found -- Looking for gethostbyname -- Looking for gethostbyname - found -- Looking for connect -- Looking for connect - found -- Looking for remove -- Looking for remove - found -- Looking for shmat -- Looking for shmat - found -- Looking for IceConnectionNumber in ICE -- Looking for IceConnectionNumber in ICE - found -- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.8.1") -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'fontconfig' -- Found fontconfig, version 2.12.6 -- Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Looking for C++ include filesystem -- Looking for C++ include filesystem - not found -- Looking for C++ include experimental/filesystem -- Looking for C++ include experimental/filesystem - found -- C++ Filesystem header: -- Performing Test CXX17_BUILTIN -- Performing Test CXX17_BUILTIN - Failed -- Performing Test CXX17_FLAG -- Performing Test CXX17_FLAG - Success -- C++ Standard-17 support: via -std=c++17 -- Performing Test C++17FS_FLAG -- Performing Test C++17FS_FLAG - Success -- C++ Filesystem library: builtin -- Configuring done -- Generating done -- Build files have been written to: /home/ppetraki/Sandbox/hacking/Nana-rc/nana-RC.v1.7.3/Release [4/80] Building CXX object CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o FAILED: CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o /usr/bin/c++ -DNANA_IGNORE_CONF -I../include -isystem /usr/include/freetype2 -O3 -march=native -mtune=native -DNDEBUG -Wall -fmax-errors=3 -pthread -std=gnu++1z -MD -MT CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -MF CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o.d -o CMakeFiles/nana.dir/source/filesystem/filesystem.cpp.o -c ../source/filesystem/filesystem.cpp ../source/filesystem/filesystem.cpp:1600:39: error: ‘path’ does not name a type; did you mean ‘putw’? bool try_throw(int err_val, const path& p, std::error_code* ec, const char* message) ^~~~ putw ../source/filesystem/filesystem.cpp: In function ‘bool detail::try_throw(int, const int&, std::error_code*, const char*)’: ../source/filesystem/filesystem.cpp:1611:29: error: ‘generic_category’ was not declared in this scope error_code(err_val, generic_category()))); ^~~~~~~~~~~~~~~~ ../source/filesystem/filesystem.cpp:1611:29: note: suggested alternatives: In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0, from /usr/include/c++/7/experimental/filesystem:36, from ../include/nana/filesystem/filesystem.hpp:112, from ../include/nana/filesystem/filesystem_ext.hpp:18, from ../source/filesystem/filesystem.cpp:14: /usr/include/c++/7/system_error:135:40: note: ‘std::_V2::generic_category’ _GLIBCXX_CONST const error_category& generic_category() noexcept; ^~~~~~~~~~~~~~~~ /usr/include/c++/7/system_error:135:40: note: ‘std::_V2::generic_category’ ../source/filesystem/filesystem.cpp:1611:9: error: ‘error_code’ was not declared in this scope error_code(err_val, generic_category()))); ^~~~~~~~~~ ../source/filesystem/filesystem.cpp:1611:9: note: suggested alternative: In file included from /usr/include/c++/7/experimental/bits/fs_fwd.h:37:0, from /usr/include/c++/7/experimental/filesystem:36, from ../include/nana/filesystem/filesystem.hpp:112, from ../include/nana/filesystem/filesystem_ext.hpp:18, from ../source/filesystem/filesystem.cpp:14: /usr/include/c++/7/system_error:146:10: note: ‘std::error_code’ struct error_code ^~~~~~~~~~ compilation terminated due to -fmax-errors=3. [13/80] Building CXX object CMakeFiles/nana.dir/source/detail/platform_spec_posix.cpp.o ninja: build stopped: subcommand failed.
the idea is like this: (need more work! ... I´m not sure how...)
// in namespace nana
struct widget_colors
{
virtual ~widget_colors() = default;
widget_colors(){}
widget_colors(color_proxy ac, color_proxy bg , color_proxy fg):
activated(ac), background(bg), foreground(fg){}
color_proxy activated {def.activated };
color_proxy background {def.background};
color_proxy foreground {def.background};
static widget_colors def;
};
// in cpp
widget_colors widget_colors::def {color_proxy(static_cast<color_rgb>(0x60C8FD)),
color_proxy(colors::button_face),
color_proxy(colors::black)};
template<typename Category, typename DrawerTrigger, typename Events = general_events, typename Scheme = widget_colors>
class nana::widget_object< Category, DrawerTrigger, Events, Scheme >
{
//...
using scheme_type = Scheme ;
static scheme_type def_scheme{};
scheme_type & scheme () const ; // const ?
widget_object() : events_{ std::make_shared<Events>() } { }
private:
std::unique_ptr<Scheme> scheme_{ API::dev::make_scheme<Scheme>(def_scheme) }
//...
};
//...
listbox::scheme_type scheme_type():widget_colors(widget::def_widget_colors){/* ... */}}
//...
widget_colors::def.background=colors::aqua;
form::def_scheme.activate=colors::red; // for all class and object derived from form
form myForm1, myForm2; // bg will aqua, activate red
And then to have a way of switch the entery application from one "style" to other
for check-style buttons, menu items, and toolbar buttons
Related to that:
conserve beging and end for each field (in the div string), and have a function that return it and another that return the rectangle of a field based on the position in the string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.