Merge branch 'hotfix-1.2' into prepare-utf8
This commit is contained in:
@@ -18,42 +18,11 @@
|
||||
// Windows:
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
|
||||
#define NANA_WINDOWS 1
|
||||
|
||||
// compilers in Windows...
|
||||
|
||||
// MSVC++ versions
|
||||
#if defined(_MSC_VER)
|
||||
#define _SCL_SECURE_NO_WARNNGS
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#pragma warning(disable : 4996)
|
||||
|
||||
#if (_MSC_VER == 1900)
|
||||
// google: break any code that tries to use codecvt<char16_t> or codecvt<char32_t>.
|
||||
// google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
|
||||
// google: Those definitions are for codecvt<wchar_t>::id, codecvt<unsigned short>::id and codecvt<char>::id respectively.
|
||||
// However, the codecvt<char16_t>::id and codecvt<char32_t>::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all.
|
||||
// google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources.
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#endif // _MSC_VER == 1900
|
||||
#endif // _MSVC
|
||||
#define NANA_WINDOWS
|
||||
|
||||
// MINGW ...
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW)
|
||||
#define NANA_MINGW
|
||||
//#define STD_THREAD_NOT_SUPPORTED // don't works? why? where __GNUC__, etc. are set? by CLion ??
|
||||
//Use this flag if MinGW version is older than 4.8.1
|
||||
#if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2)))
|
||||
// don't works? why? where __GNUC__, etc. are set? by CLion ??
|
||||
// ??
|
||||
#define UNDEFINED_to_string
|
||||
|
||||
// https://github.com/meganz/mingw-std-threads
|
||||
#define STD_THREAD_NOT_SUPPORTED
|
||||
#define USE_github_com_meganz_mingw_std_threads
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MINGW
|
||||
|
||||
// end Windows
|
||||
@@ -62,47 +31,80 @@
|
||||
// MacOS: who define APPLE ??
|
||||
//#define APPLE
|
||||
#elif defined(APPLE)
|
||||
#define NANA_MACOS 1
|
||||
#define NANA_X11 1
|
||||
#define NANA_MACOS
|
||||
#define NANA_X11
|
||||
// how to add this: include_directories(/opt/X11/include/)
|
||||
// end MacOS
|
||||
|
||||
// Linux: (not sure about __GNU__ ??)
|
||||
#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
|
||||
#define NANA_LINUX 1
|
||||
#define NANA_X11 1
|
||||
#define NANA_LINUX
|
||||
#define NANA_X11
|
||||
// end Linux
|
||||
|
||||
|
||||
#else
|
||||
# static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)");
|
||||
#endif // Select platform
|
||||
|
||||
#if defined(NANA_LINUX) || defined(NANA_MACOS)
|
||||
#undef NANA_WINDOWS
|
||||
#define NANA_POSIX
|
||||
#undef NANA_WINDOWS
|
||||
#endif
|
||||
// End Select platform ......
|
||||
|
||||
// compilers ...
|
||||
|
||||
// temp
|
||||
//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED // don't works?
|
||||
//#define STD_CODECVT_NOT_SUPPORTED
|
||||
// MSVC++ versions
|
||||
#if defined(_MSC_VER)
|
||||
#define _SCL_SECURE_NO_WARNNGS
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#pragma warning(disable : 4996)
|
||||
|
||||
// GCC ...
|
||||
#if defined(__GNU__)
|
||||
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1)
|
||||
// don't works?
|
||||
#if (_MSC_VER == 1900)
|
||||
// google: break any code that tries to use codecvt<char16_t> or codecvt<char32_t>.
|
||||
// google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
|
||||
// google: Those definitions are for codecvt<wchar_t>::id, codecvt<unsigned short>::id and codecvt<char>::id respectively.
|
||||
// However, the codecvt<char16_t>::id and codecvt<char32_t>::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all.
|
||||
// google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources.
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#endif // _MSC_VER == 1900
|
||||
#endif // _MSVC
|
||||
|
||||
//GCC 4.7.0 does not implement the <codecvt> and codecvt_utfx classes ??
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#if defined(__clang__)
|
||||
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
//<codecvt> is a known issue on libstdc++, it works on libc++
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#endif
|
||||
|
||||
//Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented
|
||||
#elif defined(__GNUC__) //GCC
|
||||
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
//<codecvt> is a known issue on libstdc++, it works on libc++
|
||||
#define STD_CODECVT_NOT_SUPPORTED
|
||||
#endif
|
||||
|
||||
//Implement workarounds for GCC/MinGW which version is below 4.8.2
|
||||
#if (__GNUC__ == 4)
|
||||
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
|
||||
#define STD_THREAD_NOT_SUPPORTED
|
||||
|
||||
//boost.thread is preferred
|
||||
//but if USE_github_com_meganz_mingw_std_threads is enabled,
|
||||
//boost.thread will be replaced with meganz's mingw-std-threads.
|
||||
// https://github.com/meganz/mingw-std-threads
|
||||
//#define USE_github_com_meganz_mingw_std_threads
|
||||
#endif
|
||||
|
||||
#if defined(NANA_MINGW)
|
||||
//It's a known issue under MinGW
|
||||
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||
#endif
|
||||
#endif // GCC
|
||||
|
||||
#if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW))
|
||||
#define STD_TO_STRING_NOT_SUPPORTED
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// End compilers ...
|
||||
|
||||
|
||||
@@ -115,7 +117,7 @@
|
||||
//#define NANA_ENABLE_PNG //!
|
||||
//#define USE_LIBPNG_FROM_OS // Un-Comment it to use libpng from operating system.
|
||||
#if defined(NANA_ENABLE_PNG)
|
||||
#if not defined(USE_LIBPNG_FROM_OS)
|
||||
#if !defined(USE_LIBPNG_FROM_OS)
|
||||
#define NANA_LIBPNG
|
||||
#endif
|
||||
#endif
|
||||
@@ -127,7 +129,7 @@
|
||||
//#define NANA_ENABLE_JPEG //!
|
||||
//#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system.
|
||||
#if defined(NANA_ENABLE_JPEG)
|
||||
#if not defined(USE_LIBJPEG_FROM_OS)
|
||||
#if !defined(USE_LIBJPEG_FROM_OS)
|
||||
#define NANA_LIBJPEG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -56,8 +56,23 @@ namespace std
|
||||
//Workaround for no implemenation of std::stoull in MinGW.
|
||||
unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10);
|
||||
unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10);
|
||||
}
|
||||
#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
|
||||
|
||||
//Workaround for no implemenation of std::to_wstring in MinGW.
|
||||
#ifdef STD_TO_STRING_NOT_SUPPORTED
|
||||
namespace std
|
||||
{
|
||||
//Workaround for no implemenation of std::to_string/std::to_wstring in MinGW.
|
||||
std::string to_string(long double);
|
||||
std::string to_string(double);
|
||||
std::string to_string(unsigned);
|
||||
std::string to_string(int);
|
||||
std::string to_string(long);
|
||||
std::string to_string(unsigned long);
|
||||
std::string to_string(long long);
|
||||
std::string to_string(unsigned long long);
|
||||
std::string to_string(float);
|
||||
|
||||
std::wstring to_wstring(long double);
|
||||
std::wstring to_wstring(double);
|
||||
std::wstring to_wstring(unsigned);
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace filesystem
|
||||
fileinfo();
|
||||
#ifdef NANA_WINDOWS
|
||||
fileinfo(const WIN32_FIND_DATA& wfd);
|
||||
#elif NANA_LINUX or NANA_MACOS
|
||||
fileinfo(const ::std::string& filename, const struct stat &);
|
||||
#elif defined(NANA_POSIX)
|
||||
fileinfo(const nana::string& filename, const struct stat &);
|
||||
#endif
|
||||
::std::string name;
|
||||
|
||||
|
||||
@@ -228,18 +228,6 @@ namespace nana
|
||||
this->create(wd, rectangle(), visible);
|
||||
}
|
||||
|
||||
tabbar(window wd, const nana::char_t* text, bool visible)
|
||||
: tabbar(wd, ::nana::string(text), visible)
|
||||
{
|
||||
}
|
||||
|
||||
tabbar(window wd, const nana::string& text, bool visible)
|
||||
: tabbar()
|
||||
{
|
||||
this->create(wd, rectangle(), visible);
|
||||
this->caption(text);
|
||||
}
|
||||
|
||||
tabbar(window wd, const rectangle& r = rectangle(), bool visible = true)
|
||||
: tabbar()
|
||||
{
|
||||
@@ -256,7 +244,7 @@ namespace nana
|
||||
return static_cast<value_type&>(this->get_drawer_trigger().at_no_bound_check(pos));
|
||||
}
|
||||
|
||||
void activate(std::size_t pos) /// Activates a tab specified by i.
|
||||
void activated(std::size_t pos) /// Activates a tab specified by pos.
|
||||
{
|
||||
this->get_drawer_trigger().activate(pos);
|
||||
}
|
||||
@@ -266,9 +254,9 @@ namespace nana
|
||||
return this->get_drawer_trigger().activated();
|
||||
}
|
||||
|
||||
value_type & at(std::size_t i) const /// Returns i'th element
|
||||
value_type & at(std::size_t pos) const /// Returns pos'th element
|
||||
{
|
||||
return static_cast<value_type&>(this->get_drawer_trigger().at(i));
|
||||
return static_cast<value_type&>(this->get_drawer_trigger().at(pos));
|
||||
}
|
||||
|
||||
void close_fly(bool fly) /// Draw or not a close button in each tab.
|
||||
@@ -277,12 +265,12 @@ namespace nana
|
||||
API::refresh_window(this->handle());
|
||||
}
|
||||
|
||||
pat::cloneable<item_renderer>& ext_renderer() const
|
||||
pat::cloneable<item_renderer>& renderer() const
|
||||
{
|
||||
return this->get_drawer_trigger().ext_renderer();
|
||||
}
|
||||
|
||||
void ext_renderer(const pat::cloneable<item_renderer>& ir)
|
||||
void renderer(const pat::cloneable<item_renderer>& ir)
|
||||
{
|
||||
this->get_drawer_trigger().ext_renderer(ir);
|
||||
}
|
||||
@@ -292,14 +280,14 @@ namespace nana
|
||||
return this->get_drawer_trigger().length();
|
||||
}
|
||||
|
||||
void append(const std::string& text, window attach_wd, value_type value = {})
|
||||
tabbar& append(std::string text, window attach_wd, value_type value = {})
|
||||
{
|
||||
this->append(static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), attach_wd);
|
||||
return this->append(static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), attach_wd);
|
||||
}
|
||||
|
||||
void append(const std::wstring& text, window attach_wd, value_type value = {})
|
||||
tabbar& append(std::wstring text, window attach_wd, value_type value = {})
|
||||
{
|
||||
this->get_drawer_trigger().insert(::nana::npos, std::wstring(text), std::move(value));
|
||||
this->get_drawer_trigger().insert(::nana::npos, std::move(text), std::move(value));
|
||||
if (attach_wd)
|
||||
{
|
||||
auto pos = this->get_drawer_trigger().length();
|
||||
@@ -307,6 +295,7 @@ namespace nana
|
||||
}
|
||||
|
||||
API::update_window(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void push_back(nana::string text) /// Append a new item.
|
||||
@@ -315,17 +304,17 @@ namespace nana
|
||||
API::update_window(*this);
|
||||
}
|
||||
|
||||
void insert(std::size_t pos, const std::string& text, const value_type& value = {})
|
||||
void insert(std::size_t pos, std::string text, value_type value = {})
|
||||
{
|
||||
this->insert(pos, static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), value);
|
||||
return this->insert(pos, static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), std::move(value));
|
||||
}
|
||||
|
||||
void insert(std::size_t pos, const std::wstring& text, const value_type& value = {})
|
||||
void insert(std::size_t pos, std::wstring text, value_type value = {})
|
||||
{
|
||||
if (pos > length())
|
||||
throw std::out_of_range("tabbar::insert invalid position");
|
||||
|
||||
this->get_drawer_trigger().insert(pos, std::wstring(text), value_type(value));
|
||||
this->get_drawer_trigger().insert(pos, std::move(text), std::move(value));
|
||||
API::update_window(*this);
|
||||
}
|
||||
|
||||
@@ -345,19 +334,19 @@ namespace nana
|
||||
this->get_drawer_trigger().erase(pos);
|
||||
}
|
||||
|
||||
void tab_bgcolor(std::size_t i, const ::nana::color& clr)
|
||||
void tab_bgcolor(std::size_t pos, const ::nana::color& clr)
|
||||
{
|
||||
this->get_drawer_trigger().tab_color(i, true, clr);
|
||||
this->get_drawer_trigger().tab_color(pos, true, clr);
|
||||
}
|
||||
|
||||
void tab_fgcolor(std::size_t i, const ::nana::color& clr)
|
||||
void tab_fgcolor(std::size_t pos, const ::nana::color& clr)
|
||||
{
|
||||
this->get_drawer_trigger().tab_color(i, false, clr);
|
||||
this->get_drawer_trigger().tab_color(pos, false, clr);
|
||||
}
|
||||
|
||||
void tab_image(std::size_t i, const nana::paint::image& img)
|
||||
void tab_image(std::size_t pos, const nana::paint::image& img)
|
||||
{
|
||||
this->get_drawer_trigger().tab_image(i, img);
|
||||
this->get_drawer_trigger().tab_image(pos, img);
|
||||
}
|
||||
/// Sets buttons of the tabbar's toolbox, refer to notes for more details.
|
||||
template<typename Add, typename Scroll, typename List, typename Close>
|
||||
|
||||
Reference in New Issue
Block a user