Merge branch 'master' into develop

This commit is contained in:
Jinhao
2016-02-16 23:50:45 +08:00
13 changed files with 341 additions and 114 deletions

View File

@@ -38,9 +38,10 @@
#ifndef NANA_CXX_DEFINES_INCLUDED
#define NANA_CXX_DEFINES_INCLUDED
#define STD_FILESYSTEM_NOT_SUPPORTED
//C++ language
#if defined(_MSC_VER)
# undef STD_FILESYSTEM_NOT_SUPPORTED
# if (_MSC_VER < 1900)
# //Nana defines some macros for lack of support of keywords
# define _ALLOW_KEYWORD_MACROS
@@ -130,6 +131,10 @@
#endif
#endif
#if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) )
#undef STD_FILESYSTEM_NOT_SUPPORTED
#endif
#if (__GNUC__ == 4)
#if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1))
#define STD_THREAD_NOT_SUPPORTED
@@ -168,4 +173,17 @@
#endif
#endif
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0061r0.html
# if __cpp_lib_experimental_filesystem
# undef STD_FILESYSTEM_NOT_SUPPORTED
# endif
#ifdef __has_include
# if __has_include(<filesystem>)
# undef STD_FILESYSTEM_NOT_SUPPORTED
# endif
#endif
#endif // NANA_CXX_DEFINES_INCLUDED

View File

@@ -14,6 +14,7 @@
* External libraries:
* - NANA_LIBPNG, USE_LIBPNG_FROM_OS
* - NANA_LIBJPEG, USE_LIBJPEG_FROM_OS
* - NANA_ENABLE_AUDIO
*
* messages:
* - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR
@@ -30,22 +31,37 @@
// Here defines some flags that tell Nana what features will be supported.
//Support of std::thread
//Boost.Thread is preferred.
//NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is only available on MinGW when STD_THREAD_NOT_SUPPORTED is defined.
//if NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is enabled, Boost.Thread will be replaced with meganz's mingw-std-threads.
//https://github.com/meganz/mingw-std-threads
///////////////////////////
// Support of std::thread
// Boost.Thread is preferred.
// NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is only available on MinGW when STD_THREAD_NOT_SUPPORTED is defined.
// if NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ is enabled, Boost.Thread will be replaced with meganz's mingw-std-threads.
// https://github.com/meganz/mingw-std-threads
//#define NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ
///////////////////
//Support of PCM playback
//
//#define NANA_ENABLE_AUDIO
////////////////////////////
// The ISO C++ File System Technical Specification is optional.
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf
// This is not a workaround, but an user option.
// The library maybe available in the std library in use or from Boost (almost compatible)
// http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/index.htm
// or you can choose to use the (partial, but functional) implementation provided by nana.
// If you include the file <nana/filesystem/filesystem_selector.hpp>
// The selected option will be set by nana into std::experimental::filesystem
// By default Nana will use the ISO TS if available, or nana if not.
// Boost will be use only if you change one of the following (set the includes and link correspondly):
//#define NANA_BOOST_FILESYSTEM_AVAILABLE // "Is Boost filesystem available?"
//#define NANA_BOOST_FILESYSTEM_PREFERRED // "Is Boost filesystem preferred over nana?"
//#define NANA_BOOST_FILESYSTEM_FORCE // "Force use of Boost filesystem if available (over ISO)?
///////////////////
//Support for PNG
// Define the NANA_ENABLE_PNG to enable the support of PNG.
// Support of PCM playback
//
#define NANA_ENABLE_AUDIO
///////////////////
// Support for PNG
// Define the NANA_ENABLE_PNG to enable the support of PNG.
//
//#define NANA_ENABLE_PNG //!
//#define USE_LIBPNG_FROM_OS // Un-Comment it to use libpng from operating system.
@@ -56,8 +72,8 @@
#endif
///////////////////
//Support for JPEG
// Define the NANA_ENABLE_JPEG to enable the support of JPEG.
// Support for JPEG
// Define the NANA_ENABLE_JPEG to enable the support of JPEG.
//
//#define NANA_ENABLE_JPEG //!
//#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system.

View File

@@ -36,12 +36,13 @@
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <algorithm>
#include <nana/deploy.hpp>
// namespace std { namespace experimental { namespace filesystem { inline namespace v1 {
namespace nana { namespace experimental
namespace nana { namespace experimental { inline namespace v1
{
namespace filesystem
{
@@ -149,6 +150,14 @@ namespace filesystem
std::string string() const;
std::wstring wstring() const;
std::string u8string() const;
// std::u16string u16string() const;
// std::u32string u32string() const;
std::string generic_string() const ;
std::wstring generic_wstring() const;
std::string generic_u8string() const;
// std::u16string generic_u16string() const;
// std::u32string generic_u32string() const;
//appends
path& operator/=(const path& other);
@@ -359,11 +368,11 @@ namespace filesystem
return index ? path.substr(0, index + 1) : std::basic_string<CharType>();
}
}//end namespace filesystem
} //end namespace v1
} //end namespace filesystem
} //end namespace experimental
namespace filesystem = experimental::filesystem;
}//end namespace nana
//namespace filesystem = experimental::filesystem;
} //end namespace nana
#endif

View File

@@ -19,6 +19,7 @@
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/panel.hpp>
#include <nana/gui/widgets/checkbox.hpp>
namespace nana{
class group
@@ -49,7 +50,7 @@ namespace nana{
~group();
/// Adds an option for user selection
group& add_option(::std::string);
checkbox& add_option(::std::string);
/// Enables/disables the radio mode which is single selection
group& radio_mode(bool);

View File

@@ -261,17 +261,18 @@ namespace nana
return this->get_drawer_trigger().length();
}
tabbar& append(std::string text, window attach_wd, value_type value = {})
/// Append a new tab
tabbar& append(std::string text, window attach_wd, value_type value = {}) // 2x text convertion. maybe better to duplicate code?
{
return this->append(static_cast<std::wstring>(nana::charset(text, nana::unicode::utf8)), attach_wd);
return this->append( static_cast<std::wstring&&>(nana::charset(std::move(text), nana::unicode::utf8)), attach_wd, std::move(value));
}
tabbar& append(std::wstring text, window attach_wd, value_type value = {})
{
if (attach_wd && API::empty_window(attach_wd))
throw std::invalid_argument("tabbar.attach: invalid window handle");
throw std::invalid_argument("Appening a tab to a tabbar - error: tabbar.attach: invalid window handle");
this->get_drawer_trigger().insert(::nana::npos, std::move(text), std::move(value));
this->get_drawer_trigger().insert(::nana::npos, to_nstring(std::move(text)), std::move(value));
if (attach_wd)
this->attach(this->get_drawer_trigger().length() - 1, attach_wd);
@@ -299,7 +300,7 @@ namespace nana
if (pos > length())
throw std::out_of_range("tabbar::insert invalid position");
this->get_drawer_trigger().insert(pos, to_nstring(text), std::move(value));
this->get_drawer_trigger().insert(pos, to_nstring(std::move(text)), std::move(value));
API::update_window(*this);
}