Merge branch 'hotfix-1.3' into develop

This commit is contained in:
Jinhao
2016-04-18 15:16:03 +08:00
116 changed files with 2343 additions and 1004 deletions

View File

@@ -1,6 +1,6 @@
#ifndef NANA_AUDIO_PLAYER_HPP
#define NANA_AUDIO_PLAYER_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/deploy.hpp>
#ifdef NANA_ENABLE_AUDIO
@@ -31,4 +31,7 @@ namespace nana{ namespace audio
}//end namespace nana
#endif //NANA_ENABLE_AUDIO
#endif
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -15,6 +15,7 @@
#include <nana/deploy.hpp>
#include <cctype>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -337,9 +338,9 @@ namespace nana
bool operator==(const color& other) const;
bool operator!=(const color& other) const;
private:
double r_;
double g_;
double b_;
double r_{ 0.0 };
double g_{ 0.0 };
double b_{ 0.0 };
double a_{ 0.0 }; //invisible
};
@@ -484,7 +485,7 @@ namespace nana
southeast
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -31,6 +31,7 @@
* - _SCL_SECURE_NO_WARNNGS, _CRT_SECURE_NO_DEPRECATE (VC)
* - STD_CODECVT_NOT_SUPPORTED (VC RC, <codecvt> is a known issue on libstdc++, it works on libc++)
* - STD_THREAD_NOT_SUPPORTED (GCC < 4.8.1)
* - STD_put_time_NOT_SUPPORTED (GCC < 5)
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8)
@@ -133,9 +134,14 @@
#endif
#endif
#if ((__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3 ) ) )
#undef STD_FILESYSTEM_NOT_SUPPORTED
#endif
#if ((__GNUC__ < 5) )
# define STD_put_time_NOT_SUPPORTED
#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))
@@ -147,8 +153,10 @@
#endif
#if defined(NANA_MINGW)
//It's a knonwn issue under MinGW
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
#ifndef __MINGW64_VERSION_MAJOR
//It's a knonwn issue under MinGW(except MinGW-W64)
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
#endif
#endif
#if (__GNUC_MINOR__ < 8)

View File

@@ -46,7 +46,31 @@ namespace nana
class charset_encoding_interface;
}
/// An intelligent charset class for character code conversion.
/*!\class charset
\brief An intelligent charset class for character code conversion.
Example:
1. A UTF-8 string from the socket.
int len = ::recv(sd, buf, buflen, 0);
textbox.caption(nana::charset(std::string(buf, len), nana::unicode::utf8));
2. Send the string in text to the socket as UTF-8.
std::string utf8str = nana::charset(textbox.caption()).to_bytes(nana::unicode::utf8);
::send(sd, utf8str.c_str(), utf8str.size(), 0);
3, Convert a string to the specified multi-byte character code.
// Convert to a multibytes string through default system language.
std::string mbstr = nana::charset(a_wstring);
// If the default system language is English and convert
// a Chinese unicode string to multibytes string through GB2312
std::setlocale(LC_CTYPE, "zh_CN.GB2312");
//set::setlocale(LC_CTYPE, ".936"); call it in Windows
std::string mbstr = nana::charset(a_wstring_with_chinese);
*/
class charset
{
public:
@@ -74,27 +98,3 @@ namespace nana
}//end namespace nana
#endif
/*!\class charset
Example
1. A UTF-8 string from the socket.
int len = ::recv(sd, buf, buflen, 0);
textbox.caption(nana::charset(std::string(buf, len), nana::unicode::utf8));
2. Send the string in text to the socket as UTF-8.
std::string utf8str = nana::charset(textbox.caption()).to_bytes(nana::unicode::utf8);
::send(sd, utf8str.c_str(), utf8str.size(), 0);
3, Convert a string to the specified multi-byte character code.
//Convert to a multibytes string through default system language.
std::string mbstr = nana::charset(a_wstring);
//If the default system language is English and convert
//a Chinese unicode string to multibytes string through GB2312
std::setlocale(LC_CTYPE, "zh_CN.GB2312");
//set::setlocale(LC_CTYPE, ".936"); call it in Windows
std::string mbstr = nana::charset(a_wstring_with_chinese);
*/

View File

@@ -39,20 +39,30 @@
// https://github.com/meganz/mingw-std-threads
//#define NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ
////////////////////////////
// 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)?
//# The ISO C++ File System Technical Specification(ISO - TS, or STD) 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 try to use the STD.If not available will try
//# to use boost if available.Nana own implementation will be use only none of them are available.
//# You can change that default if you change one of the following
//# (please don't define more than one of the _XX_FORCE options):
//
//#define BOOST_FILESYSTEM_AVAILABLE // "Is Boost filesystem available?"
//#define BOOST_FILESYSTEM_FORCE // "Force use of Boost filesystem if available (over ISO and nana)
//#define STD_FILESYSTEM_FORCE // "Use of STD filesystem?(a compilation error will ocurre if not available)" OFF)
//#define NANA_FILESYSTEM_FORCE // "Force nana filesystem over ISO and boost?" OFF)
//
// Make sure you (cmake?) provide the following where correspond (please find the correct values):
// set CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT "Where to find <boost/filesystem.hpp>?" "../")
// set CMAKE_BOOST_FILESYSTEM_LIB "Flag for the compiler to link: " "-lboost/fs")
// include_directories CMAKE_BOOST_FILESYSTEM_INCLUDE_ROOT
// APPEND flag LINKS CMAKE_BOOST_FILESYSTEM_LIB
///////////////////
// Support of PCM playback
@@ -83,6 +93,17 @@
#endif
#endif
///////////////////
// Support for NANA_AUTOMATIC_GUI_TESTING
// Will cause the program to self-test the GUI. A default automatic GUI test
// will be added to all programs which don't have yet one defined. This default test will simple
// wait 10 sec. (time to construct, show and execute the GUI) and then exit normally.
//
//#define NANA_AUTOMATIC_GUI_TESTING
#if !defined(VERBOSE_PREPROCESSOR)
//#define VERBOSE_PREPROCESSOR
#endif

View File

@@ -14,6 +14,7 @@
#ifndef NANA_DEPLOY_HPP
#define NANA_DEPLOY_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/config.hpp>
#if defined(VERBOSE_PREPROCESSOR)
@@ -92,14 +93,57 @@ namespace std
}
#endif
#ifdef STD_put_time_NOT_SUPPORTED
#include <ctime>
namespace std
{
//Workaround for no implemenation of std::put_time in gcc < 5.
/* std unspecified return type */
//template< class CharT, class RTSTR >// let fail for CharT != char / wchar_t
//RTSTR put_time(const std::tm* tmb, const CharT* fmt);
//template< >
std::string put_time/*<char, std::string>*/(const std::tm* tmb, const char* fmt);
//Defined in header <ctime>
// std::size_t strftime(char* str, std::size_t count, const char* format, const std::tm* time);
//template<>
//std::wstring put_time<wchar_t, std::wstring>(const std::tm* tmb, const wchar_t* fmt);
}
#endif // STD_put_time_NOT_SUPPORTED
namespace nana
{
/// move to *.h ??
struct utf8_Error : std::runtime_error
{
static bool use_throw; ///< def { true }; use carefully - it is a global variable !! \todo initialize from a #define ?
using std::runtime_error::runtime_error;
#if defined(_MSC_VER)
# if (_MSC_VER < 1900)
//A workaround for lack support of C++11 inheriting constructors for VC2013
explicit utf8_Error(const std::string& msg);
# endif
#endif
void emit();
};
/// Checks whether a specified text is utf8 encoding
bool is_utf8(const char* str, std::size_t len);
void throw_not_utf8(const std::string& text);
void throw_not_utf8(const char*, std::size_t len);
void throw_not_utf8(const char*);
/// this text needed change, it needed review ??
bool review_utf8(const std::string& text);
/// this text needed change, it needed review ??
bool review_utf8(std::string& text);
const std::string& to_utf8(const std::string&);
std::string to_utf8(const std::wstring&);
@@ -190,5 +234,5 @@ namespace std {
make_unique(Args&&...) = delete;
}
#endif //STD_make_unique_NOT_SUPPORTED
#endif //NANA_MACROS_HPP
#include <nana/pop_ignore_diagnostic>
#endif //NANA_DEPLOY_HPP

View File

@@ -18,6 +18,8 @@
#ifndef NANA_DETAIL_PLATFORM_SPEC_HPP
#define NANA_DETAIL_PLATFORM_SPEC_HPP
#include <nana/push_ignore_diagnostic>
#include <thread>
#include <mutex>
#include <memory>
@@ -60,6 +62,8 @@ namespace detail
class charset_conv
{
charset_conv(const charset_conv&) = delete;
charset_conv& operator=(const charset_conv*) = delete;
public:
charset_conv(const char* tocode, const char* fromcode);
~charset_conv();
@@ -118,6 +122,9 @@ namespace detail
void update_color();
void update_text_color();
private:
drawable_impl_type(const drawable_impl_type&) = delete;
drawable_impl_type& operator=(const drawable_impl_type&) = delete;
unsigned current_color_{ 0xFFFFFF };
unsigned color_{ 0xFFFFFFFF };
unsigned text_color_{ 0xFFFFFFFF };
@@ -188,8 +195,8 @@ namespace detail
native_window_type owner;
std::vector<native_window_type> * owned;
};
public:
int error_code;
public:
int error_code;
public:
typedef drawable_impl_type::font_ptr_t font_ptr_t;
typedef void (*timer_proc_type)(unsigned tid);
@@ -197,6 +204,8 @@ namespace detail
typedef ::nana::event_code event_code;
typedef ::nana::native_window_type native_window_type;
platform_spec(const platform_spec&) = delete;
platform_spec& operator=(const platform_spec&) = delete;
platform_spec();
~platform_spec();
@@ -327,6 +336,7 @@ namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
// .h ward
#endif

View File

@@ -1,15 +1,15 @@
/*
/**
* Selector of Platform Specification
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/detail/platform_spec_selector.hpp
* @file nana/detail/platform_spec_selector.hpp
*
* Selects the proper platform_spec header file for the current platform
* @brief Selects the proper platform_spec header file for the current platform
*/
#include <nana/config.hpp>

View File

@@ -1,7 +1,7 @@
/*
* Platform Specification Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -25,6 +25,7 @@
#include <windows.h>
#include <map>
#include <memory>
#include <functional>
namespace nana
{
@@ -63,9 +64,15 @@ namespace detail
bool forced;
};
struct arg_affinity_execute
{
const std::function<void()> * function_ptr;
};
enum
{
tray = 0x501,
async_activate,
async_set_focus,
remote_flush_surface,
@@ -74,6 +81,10 @@ namespace detail
operate_caret, //wParam: 1=Destroy, 2=SetPos
remote_thread_set_window_pos,
remote_thread_set_window_text,
//Execute a function in a thread with is associated with a specified native window
affinity_execute,
user,
};
};
@@ -142,6 +153,9 @@ namespace detail
unsigned whitespace_pixels;
}string;
drawable_impl_type(const drawable_impl_type&) = delete;
drawable_impl_type& operator=(const drawable_impl_type&) = delete;
drawable_impl_type();
~drawable_impl_type();

View File

@@ -1,4 +1,4 @@
/*
/**
* A ISO C++ filesystem Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
@@ -7,17 +7,17 @@
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/filesystem/filesystem.hpp
* Modiffied by Ariel Vina-Rodriguez:
* Now mimic std::experimental::filesystem::v1 (boost v3)
* and need VC2015 or a C++11 compiler. With a few correction will be compiler by VC2013
* @file nana/filesystem/filesystem.hpp
* @author Jinhao, conributed: Ariel Vina-Rodriguez
* @brief Mimic std::experimental::filesystem::v1 (boost v3)
* and need VC2015 or a C++11 compiler. With a few correction can be compiler by VC2013
*/
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf --- last pdf of std draft N4100 <filesystem> 2014-07-04
// http://en.cppreference.com/w/cpp/experimental/fs
// http://cpprocks.com/introduction-to-tr2-filesystem-library-in-vs2012/ --- TR2 filesystem in VS2012
// https://msdn.microsoft.com/en-us/library/hh874694%28v=vs.140%29.aspx --- C++ 14, the <filesystem> header VS2015
// https://msdn.microsoft.com/en-us/library/hh874694%28v=vs.120%29.aspx --- <filesystem> header VS2013
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf --- last pdf of std draft N4100 2014-07-04
// http://cplusplus.github.io/filesystem-ts/working-draft.html --- in html format
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html --- in html format
// http://article.gmane.org/gmane.comp.lib.boost.devel/256220 --- The filesystem TS unanimously approved by ISO.
@@ -29,6 +29,9 @@
#ifndef NANA_FILESYSTEM_HPP
#define NANA_FILESYSTEM_HPP
#include <nana/push_ignore_diagnostic>
#include <string>
#include <system_error>
#include <iterator>
@@ -40,18 +43,14 @@
#include <nana/deploy.hpp>
// namespace std { namespace experimental { namespace filesystem { inline namespace v1 {
namespace nana { namespace experimental {
#ifndef CXX_NO_INLINE_NAMESPACE
inline namespace v1
namespace nana { namespace experimental { namespace filesystem
{
#ifndef CXX_NO_INLINE_NAMESPACE
inline namespace v1
{
#endif
namespace filesystem
{
enum class file_type
enum class file_type
{
none = 0, ///< has not been determined or an error occurred while trying to determine
not_found = -1, ///< Pseudo-type: file was not found. Is not considered an error
@@ -82,7 +81,7 @@ namespace filesystem
uintmax_t available;
};
using file_time_type = std::chrono::time_point<std::chrono::system_clock>;// trivial-clock> ;
using file_time_type = std::chrono::time_point<std::chrono::system_clock>; ///< trivial-clock> ;
class file_status
{
@@ -116,7 +115,7 @@ namespace filesystem
public:
#if defined(NANA_WINDOWS)
using value_type = wchar_t;
const static value_type preferred_separator = '\\';
const static value_type preferred_separator = L'\\';
#else
using value_type = char;
const static value_type preferred_separator = '/';
@@ -131,23 +130,41 @@ namespace filesystem
_m_assign(source);
}
// modifiers
//void clear() noexcept;
path& make_preferred();
path& remove_filename();
//path& replace_filename(const path& replacement);
//path& replace_extension(const path& replacement = path());
//void swap(path& rhs) noexcept;
// decomposition
//path root_name() const;
//path root_directory() const;
//path root_path() const;
//path relative_path() const;
path parent_path() const;
path filename() const;
//path stem() const;
path extension() const;
// query
bool empty() const noexcept;
//bool has_root_name() const;
//bool has_root_directory() const;
//bool has_root_path() const;
//bool has_relative_path() const;
bool has_parent_path() const { return !parent_path().string().empty(); }; // temp;;
bool has_filename() const { return !filename().string().empty(); }; // temp;
//bool has_stem() const;
bool has_extension() const { return !extension().string().empty(); }; // temp
//bool is_absolute() const;
//bool is_relative() const;
int compare(const path& other) const;
bool empty() const;
path extension() const;
path parent_path() const;
file_type what() const;
//decomposition
path filename() const;
//modifiers
path& remove_filename();
const value_type*c_str() const;
const string_type& native() const;
operator string_type() const;
@@ -203,8 +220,9 @@ namespace filesystem
filesystem_error(const std::string& msg, const path& path1, std::error_code err);
filesystem_error(const std::string& msg, const path& path1, const path& path2, std::error_code err);
const path& path1() const; //noexcept
const path& path2() const; //noexcept
const path& path1() const noexcept;
const path& path2() const noexcept;
// const char* what() const noexcept;
private:
path path1_;
path path2_;
@@ -229,33 +247,23 @@ namespace filesystem
filesystem::path path_;
};
/// an iterator for a sequence of directory_entry elements representing the files in a directory, not an recursive_directory_iterator
//template<typename FileInfo>
/// InputIterator that iterate over the sequence of directory_entry elements representing the files in a directory, not an recursive_directory_iterator
class directory_iterator :public std::iterator<std::input_iterator_tag, directory_entry>
{
using find_handle = void*;
public:
using value_type = directory_entry ;
typedef ptrdiff_t difference_type;
typedef const directory_entry* pointer;
typedef const directory_entry& reference;
typedef std::input_iterator_tag iterator_category;
directory_iterator();
directory_iterator(const path& file_path);
directory_iterator() noexcept;
explicit directory_iterator(const path& dir);
const value_type& operator*() const;
const value_type* operator->() const;
directory_iterator& operator++();
directory_iterator operator++(int);
directory_iterator operator++(int); ///< extention
bool equal(const directory_iterator& x) const;
bool equal(const directory_iterator& x) const;
// enable directory_iterator range-based for statements
directory_iterator begin();
directory_iterator end();
private:
template<typename Char>
static bool _m_ignore(const Char * p)
@@ -275,6 +283,16 @@ namespace filesystem
find_handle handle_{nullptr};
value_type value_;
};
/// enable directory_iterator range-based for statements
inline directory_iterator begin( directory_iterator iter) noexcept
{
return iter;
}
inline directory_iterator end( const directory_iterator&) noexcept
{
return {};
}
//class recursive_directory_iterator;
@@ -301,15 +319,23 @@ namespace filesystem
std::uintmax_t file_size(const path& p);
//uintmax_t file_size(const path& p, error_code& ec) noexcept;
inline bool is_directory(file_status s) { return s.type() == file_type::directory ;}
inline bool is_directory(file_status s) noexcept
{ return s.type() == file_type::directory ;}
bool is_directory(const path& p);
inline bool is_directory(const directory_entry& d)
{
return is_directory(d.status());
}
//bool is_directory(const path& p, error_code& ec) noexcept;
//bool is_regular_file(file_status s) noexcept;
inline bool is_regular_file(file_status s) noexcept
{
return s.type() == file_type::regular;
}
inline bool is_regular_file(const path& p)
{
return is_regular_file(status(p));
}
// bool is_regular_file(const path& p, error_code& ec) noexcept;
// Returns: is_regular_file(status(p, ec)).Returns false if an error occurs.
inline bool is_empty(const path& p)
{
@@ -320,7 +346,7 @@ namespace filesystem
return (file_size(p) == 0);
}
//bool is_empty(const path& p, error_code& ec) noexcept;
// bool is_empty(const path& p, error_code& ec) noexcept;
bool create_directories(const path& p);
@@ -330,16 +356,21 @@ namespace filesystem
bool create_directory(const path& p, const path& attributes);
//bool create_directory(const path& p, const path& attributes, error_code& ec) noexcept;
bool modified_file_time(const path& p, struct tm&);
bool modified_file_time(const path& p, struct tm&); ///< extention ?
/// The time of last data modification of p, determined as if by the value of the POSIX
/// stat structure member st_mtime obtained as if by POSIX stat().
file_time_type last_write_time(const path& p);
/// returns file_time_type::min() if an error occurs
//file_time_type last_write_time(const path& p, error_code& ec) noexcept;
path path_user(); ///< extention ?
path path_user();
path current_path();
//path current_path(error_code& ec);
void current_path(const path& p);
void current_path(const path& p); ///< chdir
//void current_path(const path& p, error_code& ec) noexcept;
bool remove(const path& p);
bool remove(const path& p, std::error_code& ec); // noexcept;
@@ -381,4 +412,5 @@ namespace filesystem
//namespace filesystem = experimental::filesystem;
} //end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -0,0 +1,162 @@
/**
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file nana\filesystem\filesystem_ext.hpp
* @autor by Ariel Vina-Rodriguez:
* @brief Some convenient extensions to the filesystem library.
*
*/
#ifndef NANA_FILESYSTEM_EXT_HPP
#define NANA_FILESYSTEM_EXT_HPP
#include <iomanip>
#include <nana/filesystem/filesystem_selector.hpp>
namespace nana {namespace experimental {namespace filesystem {namespace ext {
#if defined(NANA_WINDOWS)
constexpr auto def_root = "C:";
constexpr auto def_rootstr = "C:\\";
constexpr auto def_rootname = "Local Drive(C:)";
#elif defined(NANA_LINUX)
constexpr auto def_root = "/";
constexpr auto def_rootstr = "/";
constexpr auto def_rootname = "Root/";
#endif
// nana::experimental::filesystem::path_user());
inline bool is_directory(const std::experimental::filesystem::directory_entry& dir) noexcept
{
return is_directory(dir.status());
}
//template<class DI> // DI = directory_iterator from std, boost, or nana : return directory_entry
class directory_only_iterator : public std::experimental::filesystem::directory_iterator
{
using DI = std::experimental::filesystem::directory_iterator;
directory_only_iterator& find_first()
{
auto end = directory_only_iterator{};
while (*this != end)
{
if (is_directory((**this).status()))
return *this;
this->DI::operator++();
}
return *this;
}
public:
template <class... Arg>
directory_only_iterator(Arg&&... arg ): DI(std::forward<Arg>(arg)...)
{
find_first();
}
directory_only_iterator( ) {}
directory_only_iterator& operator++()
{
this->DI::operator++();
return find_first();
}
};
inline directory_only_iterator begin(directory_only_iterator iter) noexcept
{
return iter;
}
inline directory_only_iterator end(const directory_only_iterator&) noexcept
{
return{};
}
//template<class DI> // DI = directory_iterator from std, boost, or nana : value_type directory_entry
class regular_file_only_iterator : public std::experimental::filesystem::directory_iterator
{
using DI = std::experimental::filesystem::directory_iterator;
regular_file_only_iterator& find_first()
{
while(( (*this) != DI{}) && !is_regular_file((**this).status()))
this->DI::operator++();
return (*this);
}
public:
template <class... Arg>
regular_file_only_iterator(Arg&&... arg ): DI(std::forward<Arg>(arg)...)
{
find_first();
}
regular_file_only_iterator() : DI() {}
regular_file_only_iterator& operator++()
{
this->DI::operator++();
return find_first();
}
};
inline regular_file_only_iterator begin(regular_file_only_iterator iter) noexcept
{
return iter;
}
inline regular_file_only_iterator end(const regular_file_only_iterator&) noexcept
{
return{};
}
inline std::string pretty_file_size(const std::experimental::filesystem::path& path) // todo: move to .cpp
{
try {
std::size_t bytes = std::experimental::filesystem::file_size ( path );
const char * ustr[] = { " KB", " MB", " GB", " TB" };
std::stringstream ss;
if (bytes < 1024)
ss << bytes << " Bytes";
else
{
double cap = bytes / 1024.0;
std::size_t uid = 0;
while ((cap >= 1024.0) && (uid < sizeof(ustr) / sizeof(char *)))
{
cap /= 1024.0;
++uid;
}
ss << cap;
auto s = ss.str();
auto pos = s.find('.');
if (pos != s.npos)
{
if (pos + 2 < s.size())
s.erase(pos + 2);
}
return s + ustr[uid];
}
return ss.str();
}
catch (...) {}
return {};
}
inline std::string pretty_file_date(const std::experimental::filesystem::path& path) // todo: move to .cpp
{
try {
auto ftime = std::experimental::filesystem::last_write_time(path);
std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime);
std::stringstream tm;
tm << std::put_time(std::localtime(&cftime), "%Y-%m-%d, %H:%M:%S");
return tm.str();
}
catch (...) {
return {};
}
}
}}}}
#endif //NANA_FILESYSTEM_EXT_HPP

View File

@@ -0,0 +1,77 @@
/**
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file nana\filesystem\filesystem_selector.hpp
* @autor by Ariel Vina-Rodriguez:
* @brief A "ISO C++" filesystem Implementation selector
*
* The ISO C++ File System Technical Specification(ISO - TS, or STD) 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 try to use the STD. If not available will try
* to use boost if available. Nana own implementation will be use only if none of them are available.
* nana Now mimic std::experimental::filesystem::v1 (boost v3)
*
*/
#ifndef NANA_FILESYSTEM_SELECTOR
#define NANA_FILESYSTEM_SELECTOR
#include <nana/config.hpp>
#if (defined(NANA_FILESYSTEM_FORCE) || ( (defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(BOOST_FILESYSTEM_AVAILABLE)) && !(defined(BOOST_FILESYSTEM_FORCE) || defined(STD_FILESYSTEM_FORCE)) ) )
# include <nana/filesystem/filesystem.hpp>
namespace std {
namespace experimental {
namespace filesystem {
# ifdef CXX_NO_INLINE_NAMESPACE
using namespace nana::experimental::filesystem;
# else
using namespace nana::experimental::filesystem::v1;
# endif
} // filesystem
} // experimental
} // std
#elif (defined(BOOST_FILESYSTEM_AVAILABLE) && ( defined(BOOST_FILESYSTEM_FORCE) || ( defined(STD_FILESYSTEM_NOT_SUPPORTED) && !defined(STD_FILESYSTEM_FORCE) ) ))
# include <boost/filesystem.hpp>
// add boost::filesystem into std::experimental::filesystem
namespace std {
namespace experimental {
namespace filesystem {
using namespace boost::filesystem;
} // filesystem
} // experimental
} // std
#else
# include <experimental/filesystem>
#endif
#ifndef __cpp_lib_experimental_filesystem
# define __cpp_lib_experimental_filesystem 1
#endif
#endif // NANA_FILESYSTEM_SELECTOR

View File

@@ -12,7 +12,7 @@
#ifndef NANA_GUI_ANIMATION_HPP
#define NANA_GUI_ANIMATION_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/paint/image.hpp>
#include <functional>
@@ -82,4 +82,5 @@ namespace nana
impl * impl_;
};
} //end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_ANIMATION_HPP

View File

@@ -1,20 +1,22 @@
/*
/**
* \file basis.hpp
* \brief This file provides basis class and data structures required by the GUI
*
* Basis Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/basis.hpp
*
* This file provides basis class and data structrue that required by gui
*/
#ifndef NANA_GUI_BASIS_HPP
#define NANA_GUI_BASIS_HPP
#include <nana/push_ignore_diagnostic>
#include "../basic_types.hpp"
#include "../traits.hpp" //metacomp::fixed_type_set
@@ -59,9 +61,9 @@ namespace nana
};
//wait for constexpr
struct widget_tag{ static const flags value = flags::widget; };
struct lite_widget_tag : widget_tag{ static const flags value = flags::lite_widget;};
struct root_tag : widget_tag{ static const flags value = flags::root; };
struct frame_tag: widget_tag{ static const flags value = flags::frame; };
struct lite_widget_tag : public widget_tag{ static const flags value = flags::lite_widget; };
struct root_tag : public widget_tag{ static const flags value = flags::root; };
struct frame_tag : public widget_tag{ static const flags value = flags::frame; };
}// end namespace category
using native_window_type = detail::native_window_handle_impl*;
@@ -152,7 +154,25 @@ namespace nana
appearance();
appearance(bool has_decoration, bool taskbar, bool floating, bool no_activate, bool min, bool max, bool sizable);
};
/// Provided to generate an appearance object with better readability and understandability
/** @brief Provided to generate an appearance object with better readability and understandability
A window has an appearance. This appearance can be specified when a window is being created.
To determine the appearance of a window there is a structure named nana::appearance with
a bool member for each feature with can be included or excluded in the "apereance" of the windows form.
But in practical development is hard to describe the style of the appearance using the struct nana::appearance.
If a form would to be defined without min/max button and sizable border, then
\code{.CPP}
nana::form form(x, y, width, height, nana::appearance(false, false, false, true, false));
\endcode
This piece of code may be confusing because of the 5 parameters of the constructor of `nana::form`. So the library provides a helper class for making it easy.
For better readability and understandability Nana provides three templates classes to generate an appearance object:
nana::appear::decorate, nana::appear::bald and nana::appear::optional. Each provide an operator
that return a corresponding nana::appearance with predefined values.
*/
struct appear
{
struct minimize{};
@@ -161,7 +181,20 @@ namespace nana
struct taskbar{};
struct floating{};
struct no_activate{};
/// Create an appearance of a window with "decoration"
/** @brief Create an appearance of a window with "decoration" in non-client area, such as title bar
*
* We can create a form without min/max button and sizable border like this:
* \code{.CPP}
* using nana::appear;
* nana::form form(x, y, width, height, appear::decorate<appear::taskbar>());
* \endcode
* The appearance created by appear::decorate<>() has a titlebar and borders that are draw by the
* platform- window manager. If a window needs a minimize button, it should be:
* \code{.CPP}
* appear::decorate<appear::minimize, appear::taskbar>()
* \endcode
*/
template< typename Minimize = null_type,
typename Maximize = null_type,
typename Sizable = null_type,
@@ -182,7 +215,8 @@ namespace nana
);
}
};
/// Create an appearance of a window without "decoration"
/// Create an appearance of a window without "decoration" with no titlebar and no 3D-look borders.
template < typename Taskbar = null_type,
typename Floating = null_type,
typename NoActive = null_type,
@@ -227,4 +261,6 @@ namespace nana
};
};//end namespace apper
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -1,4 +1,4 @@
/*
/**
* A Basic Window Widget Definition
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
@@ -7,11 +7,13 @@
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/detail/basic_window.hpp
* @file nana/gui/detail/basic_window.hpp
* @brief A Basic Window Widget Definition
*/
#ifndef NANA_GUI_DETAIL_BASIC_WINDOW_HPP
#define NANA_GUI_DETAIL_BASIC_WINDOW_HPP
#include <nana/push_ignore_diagnostic>
#include "drawer.hpp"
#include "events_holder.hpp"
#include "widget_colors.hpp"
@@ -57,20 +59,18 @@ namespace detail
::nana::rectangle effective_range_;
};//end class caret_descriptor
//tab_type
//@brief: Define some constant about tab category, these flags can be combine with operator |
/// Define some constant about tab category, these flags can be combine with operator |
struct tab_type
{
enum t
{
none, //process by nana
tabstop, //move to the next tabstop window
eating, //process by current window
none, ///< process by nana
tabstop, ///< move to the next tabstop window
eating, ///< process by current window
};
};
//struct basic_window
//@brief: a window data structure descriptor
/// a window data structure descriptor
struct basic_window
: public events_holder
{
@@ -87,8 +87,7 @@ namespace detail
bool rendered;
};
//basic_window
//@brief: constructor for the root window
/// constructor for the root window
basic_window(basic_window* owner, std::unique_ptr<widget_notifier_interface>&&, category::root_tag**);
template<typename Category>
@@ -105,8 +104,7 @@ namespace detail
~basic_window();
//bind_native_window
//@brief: bind a native window and baisc_window
/// bind a native window and baisc_window
void bind_native_window(native_window_type, unsigned width, unsigned height, unsigned extra_width, unsigned extra_height, paint::graphics&);
void frame_window(native_window_type);
@@ -115,13 +113,13 @@ namespace detail
bool visible_parents() const;
bool displayed() const;
bool belong_to_lazy() const;
const basic_window * child_caret() const; //Returns a child which owns a caret
const basic_window * child_caret() const; ///< Returns the child which owns the caret
bool is_draw_through() const; ///< Determines whether it is a draw-through window.
basic_window * seek_non_lite_widget_ancestor() const;
public:
//Override event_holder
/// Override event_holder
bool set_events(const std::shared_ptr<general_events>&) override;
general_events * get_events() const override;
private:
@@ -131,7 +129,7 @@ namespace detail
#if defined(NANA_LINUX) || defined(NANA_MACOS)
point pos_native;
#endif
point pos_root; //coordinate for root window
point pos_root; ///< coordinates of the root window
point pos_owner;
size dimension;
::nana::size min_track_size;
@@ -146,9 +144,9 @@ namespace detail
basic_window *owner;
native_string_type title;
::nana::detail::drawer drawer; //Self Drawer with owen graphics
basic_window* root_widget; //A pointer refers to the root basic window, if the window is a root, the pointer refers to itself.
paint::graphics* root_graph; //Refer to the root buffer graphics
::nana::detail::drawer drawer; ///< Self Drawer with owen graphics
basic_window* root_widget; ///< A pointer refers to the root basic window, if the window is a root, the pointer refers to itself.
paint::graphics* root_graph; ///< Refer to the root buffer graphics
cursor predef_cursor;
std::unique_ptr<widget_notifier_interface> widget_notifier;
@@ -156,20 +154,20 @@ namespace detail
{
bool enabled :1;
bool dbl_click :1;
bool captured :1; //if mouse button is down, it always receive mouse move even the mouse is out of its rectangle
bool captured :1; ///< if mouse button is down, it always receive mouse move even the mouse is out of its rectangle
bool modal :1;
bool take_active:1; //If take_active is false, other.active_window still keeps the focus.
bool take_active:1; ///< If take_active is false, other.active_window still keeps the focus.
bool refreshing :1;
bool destroying :1;
bool dropable :1; //Whether the window has make mouse_drop event.
bool fullscreen :1; //When the window is maximizing whether it fit for fullscreen.
bool dropable :1; ///< Whether the window has make mouse_drop event.
bool fullscreen :1; ///< When the window is maximizing whether it fit for fullscreen.
bool borderless :1;
bool make_bground_declared : 1; //explicitly make bground for bground effects
bool ignore_menubar_focus : 1; //A flag indicates whether the menubar sets the focus.
bool ignore_mouse_focus : 1; //A flag indicates whether the widget accepts focus when clicking on it
bool space_click_enabled : 1; //A flag indicates whether enable mouse_down/click/mouse_up when pressing and releasing whitespace key.
bool make_bground_declared : 1; ///< explicitly make bground for bground effects
bool ignore_menubar_focus : 1; ///< A flag indicates whether the menubar sets the focus.
bool ignore_mouse_focus : 1; ///< A flag indicates whether the widget accepts focus when clicking on it
bool space_click_enabled : 1; ///< A flag indicates whether enable mouse_down/click/mouse_up when pressing and releasing whitespace key.
unsigned Reserved :18;
unsigned char tab; //indicate a window that can receive the keyboard TAB
unsigned char tab; ///< indicate a window that can receive the keyboard TAB
mouse_action action;
}flags;
@@ -198,7 +196,7 @@ namespace detail
struct attr_root_tag
{
container frames; //initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame
container frames; ///< initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame
container tabstop;
std::vector<edge_nimbus_action> effects_edge_nimbus;
basic_window* focus{nullptr};
@@ -210,13 +208,13 @@ namespace detail
cursor state_cursor{nana::cursor::arrow};
basic_window* state_cursor_window{ nullptr };
std::function<void()> draw_through; // A draw through renderer for root widgets.
std::function<void()> draw_through; ///< A draw through renderer for root widgets.
};
const category::flags category;
basic_window *active_window; //if flags.take_active is false, the active_window still keeps the focus,
//if the active_window is null, the parent of this window keeps focus.
paint::graphics glass_buffer; //if effect.bground is avaiable. Refer to window_layout::make_bground.
basic_window *active_window; ///< if flags.take_active is false, the active_window still keeps the focus,
///< if the active_window is null, the parent of this window keeps focus.
paint::graphics glass_buffer; ///< if effect.bground is avaiable. Refer to window_layout::make_bground.
update_state upd_state;
union
@@ -229,13 +227,14 @@ namespace detail
~other_tag();
}other;
native_window_type root; //root Window handle
unsigned thread_id; //the identifier of the thread that created the window.
native_window_type root; ///< root Window handle
unsigned thread_id; ///< the identifier of the thread that created the window.
unsigned index;
container children;
};
}//end namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -1,4 +1,4 @@
/*
/**
* A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
@@ -7,7 +7,9 @@
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/detail/bedrock.hpp
* @file nana/gui/detail/bedrock.hpp
*
* @brief A Bedrock Implementation
*/
#ifndef NANA_GUI_DETAIL_BEDROCK_HPP
@@ -25,12 +27,14 @@ namespace detail
struct basic_window;
class window_manager;
//class bedrock
//@brief: bedrock is a fundamental core component, it provides a abstract to the OS platform
// and some basic functions.
/// @brief fundamental core component, it provides an abstraction to the OS platform and some basic functions.
class bedrock
{
bedrock();
bedrock(const bedrock&) = delete;
bedrock& operator=(const bedrock&) = delete;
public:
using core_window_t = basic_window;

View File

@@ -1,6 +1,8 @@
#ifndef NANA_DETAIL_BEDROCK_PI_DATA_HPP
#define NANA_DETAIL_BEDROCK_PI_DATA_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/gui/detail/bedrock.hpp>
#include "color_schemes.hpp"
#include "events_operation.hpp"
@@ -30,4 +32,7 @@ namespace nana
};
}
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -13,6 +13,7 @@
#ifndef NANA_GUI_DETAIL_DRAWER_HPP
#define NANA_GUI_DETAIL_DRAWER_HPP
#include <nana/push_ignore_diagnostic>
#include <vector>
#include "general_events.hpp"
#include <nana/paint/graphics.hpp>
@@ -170,4 +171,6 @@ namespace nana
}//end namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -15,9 +15,13 @@
#include <nana/gui/element.hpp>
#include <nana/pat/cloneable.hpp>
#include <map>
#include <string>
#include <nana/push_ignore_diagnostic>
namespace nana
{
namespace detail
@@ -48,5 +52,6 @@ namespace detail
};
}//end namespace detail
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,8 @@
#ifndef NANA_DETAIL_GENERAL_EVENTS_HPP
#define NANA_DETAIL_GENERAL_EVENTS_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/gui/basis.hpp>
#include "event_code.hpp"
#include "internal_scope_guard.hpp"
@@ -84,7 +86,7 @@ namespace nana
};
}//end namespace detail
/// base clase for all event argument types
/// base class for all event argument types
class event_arg
{
public:
@@ -99,7 +101,14 @@ namespace nana
struct general_events;
/// the type of the members of general_events
/** @brief the type of the members of general_events.
*
* It connect the functions to be called as response to the event and manages that chain of responses
* It is a functor, that get called to connect a "normal" response function, with normal "priority".
* If a response function need another priority (unignorable or called first) it will need to be connected with
* the specific connect function not with the operator()
* It also permit to "emit" that event, calling all the active responders.
*/
template<typename Arg>
class basic_event : public detail::event_base
{
@@ -108,7 +117,8 @@ namespace nana
private:
struct docker
: public detail::docker_base
{
{
/// the callback/response function taking the typed argument
std::function<void(arg_reference)> invoke;
docker(basic_event * evt, std::function<void(arg_reference)> && ivk, bool unignorable_flag)
@@ -125,10 +135,10 @@ namespace nana
event_handle connect_front(Function && fn)
{
using prototype = typename std::remove_reference<Function>::type;
return _m_emplace(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)), false), true);
}
/// It will not get called if stop_propagation() was called.
event_handle connect(void (*fn)(arg_reference))
{
return connect([fn](arg_reference arg){
@@ -136,12 +146,11 @@ namespace nana
});
}
/// It will not get called if stop_propagation() was called.
/// It will not get called if stop_propagation() was called, because it is set at the end of the chain..
template<typename Function>
event_handle connect(Function && fn)
{
using prototype = typename std::remove_reference<Function>::type;
return _m_emplace(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)), false), false);
}
@@ -193,7 +202,6 @@ namespace nana
continue;
static_cast<docker*>(*i)->invoke(arg);
if (window_handle && (!detail::check_window(window_handle)))
break;
}
@@ -378,11 +386,11 @@ namespace nana
}
};
};
struct arg_mouse
: public event_arg
{
event_code evt_code; ///<
event_code evt_code; ///< what kind of mouse event?
::nana::window window_handle; ///< A handle to the event window
::nana::point pos; ///< cursor position in the event window
::nana::mouse button; ///< indicates a button which triggers the event
@@ -401,7 +409,8 @@ namespace nana
}
};
/// in arg_wheel event_code is event_code::mouse_wheel
/// \brief in arg_wheel event_code is event_code::mouse_wheel
/// The type arg_wheel is derived from arg_mouse, a handler
/// with prototype void(const arg_mouse&) can be set for mouse_wheel.
struct arg_wheel : public arg_mouse
@@ -487,11 +496,11 @@ namespace nana
{
::nana::window window_handle; ///< A handle to the event window
};
/// a higher level event argument than just mouse down
struct arg_click : public event_arg
{
::nana::window window_handle; ///< A handle to the event window
const arg_mouse* mouse_args; ///< If it is not null, it refers to the mouse arguments for click event emitted by mouse, nullptr otherwise.
const arg_mouse* mouse_args{}; ///< If it is not null, it refers to the mouse arguments for click event emitted by mouse, nullptr otherwise.
};
/// provides some fundamental events that every widget owns.
@@ -531,4 +540,6 @@ namespace nana
}//end namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -25,6 +25,8 @@
#include <map>
#include <iterator>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -288,4 +290,6 @@ namespace nana
};//end class handle_manager
}//end namespace detail
}// end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -14,6 +14,7 @@
#ifndef NANA_GUI_INNER_FWD_IMPLEMENT_HPP
#define NANA_GUI_INNER_FWD_IMPLEMENT_HPP
#include <nana/push_ignore_diagnostic>
#include "inner_fwd.hpp"
#include "basic_window.hpp"
#include "../../paint/graphics.hpp"
@@ -173,4 +174,7 @@ namespace nana{
};
}
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_INNER_FWD_IMPLEMENT_HPP

View File

@@ -1,7 +1,7 @@
/*
* Forward Declaration of Internal Scope Guard
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -26,6 +26,18 @@ namespace nana
internal_scope_guard();
~internal_scope_guard();
};
class internal_revert_guard
{
internal_revert_guard(const internal_revert_guard&) = delete;
internal_revert_guard(internal_revert_guard&&) = delete;
internal_revert_guard& operator=(const internal_revert_guard&) = delete;
internal_revert_guard& operator=(internal_revert_guard&&) = delete;
public:
internal_revert_guard();
~internal_revert_guard();
};
}
#endif

View File

@@ -1,7 +1,7 @@
/*
* Platform Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -36,6 +36,9 @@ namespace detail
using native_string_type = ::nana::detail::native_string_type;
//Execute a function in a thread which is associated with the specified native window.
static void affinity_execute(native_window_type, const std::function<void()>&);
static nana::size primary_monitor_size();
static rectangle screen_area_from_point(const point&);
static window_result create_window(native_window_type, bool nested, const rectangle&, const appearance&);

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_DETAIL_WINDOW_LAYOUT_HPP
#define NANA_GUI_DETAIL_WINDOW_LAYOUT_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/gui/basis.hpp>
#include <vector>
@@ -84,5 +85,7 @@ namespace detail
}//end namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_DETAIL_WINDOW_LAYOUT_HPP

View File

@@ -1,7 +1,7 @@
/*
* Window Manager Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -18,6 +18,8 @@
#ifndef NANA_GUI_DETAIL_WINDOW_MANAGER_HPP
#define NANA_GUI_DETAIL_WINDOW_MANAGER_HPP
#include <nana/push_ignore_diagnostic>
#include <vector>
#include "window_layout.hpp"
#include "event_code.hpp"
@@ -129,7 +131,7 @@ namespace detail
bool update(core_window_t*, bool redraw, bool force, const rectangle* update_area = nullptr);
void refresh_tree(core_window_t*);
bool do_lazy_refresh(core_window_t*, bool force_copy_to_screen);
bool do_lazy_refresh(core_window_t*, bool force_copy_to_screen, bool refresh_tree = false);
bool get_graphics(core_window_t*, nana::paint::graphics&);
bool get_visual_rectangle(core_window_t*, nana::rectangle&);
@@ -195,4 +197,7 @@ namespace detail
};//end class window_manager
}//end namespace detail
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_DRAGGER_HPP
#define NANA_GUI_DRAGGER_HPP
#include <nana/push_ignore_diagnostic>
#include "basis.hpp"
#include "../basic_types.hpp"
#include "../traits.hpp"
@@ -44,4 +45,5 @@ namespace nana
dragger_impl_t * impl_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -11,6 +11,8 @@
*/
#ifndef NANA_GUI_DRAWING_HPP
#define NANA_GUI_DRAWING_HPP
#include <nana/push_ignore_diagnostic>
#include "widgets/widget.hpp"
#include "../traits.hpp"
namespace nana
@@ -46,4 +48,6 @@ namespace nana
window handle_;
};//end class drawing
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_ELEMENT_HPP
#define NANA_GUI_ELEMENT_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/paint/graphics.hpp>
#include <nana/pat/cloneable.hpp>
#include <vector>
@@ -348,4 +349,5 @@ namespace nana
}//end namespace element
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_ELEMENT_HPP

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_MSGBOX_HPP
#define NANA_GUI_MSGBOX_HPP
#include <nana/push_ignore_diagnostic>
#include <sstream>
@@ -253,5 +254,6 @@ namespace nana
::nana::rectangle valid_areas_[4];
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -14,6 +14,7 @@
#define NANA_GUI_NOTIFIER_HPP
#include <nana/gui/basis.hpp>
#include <nana/gui/detail/general_events.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -65,4 +66,5 @@ namespace nana
implement * impl_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -15,6 +15,7 @@
#ifndef NANA_GUI_PLACE_HPP
#define NANA_GUI_PLACE_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/gui/basis.hpp>
#include <utility>
#include <memory>
@@ -145,5 +146,6 @@ namespace nana
implement * impl_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //#ifndef NANA_GUI_PLACE_HPP

View File

@@ -60,6 +60,8 @@ namespace API
//@brief: The interfaces defined in namespace dev are used for developing the nana.gui
namespace dev
{
void affinity_execute(window window_handle, const std::function<void()>&);
bool set_events(window, const std::shared_ptr<general_events>&);
template<typename Scheme>
@@ -153,9 +155,17 @@ namespace API
};
}//end namespace detail
void exit();
void exit(); ///< close all windows in current thread
void exit_all(); ///< close all windows
std::string transform_shortkey_text(std::string text, wchar_t &shortkey, std::string::size_type *skpos);
/// @brief Searchs whether the text contains a '&' and removes the character for transforming.
/// If the text contains more than one '&' charachers, the others are ignored. e.g
/// text = "&&a&bcd&ef", the result should be "&abcdef", shortkey = 'b', and pos = 2.
std::string transform_shortkey_text
( std::string text, ///< the text is transformed
wchar_t &shortkey, ///< the character which indicates a short key.
std::string::size_type *skpos ///< retrives the shortkey position if it is not a null_ptr;
);
bool register_shortkey(window, unsigned long);
void unregister_shortkey(window);

View File

@@ -16,6 +16,7 @@
#ifndef NANA_GUI_TIMER_HPP
#define NANA_GUI_TIMER_HPP
#include <nana/gui/detail/general_events.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -58,4 +59,5 @@ namespace nana
implement * const impl_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -14,6 +14,8 @@
#define NANA_GUI_WIDGET_BUTTON_HPP
#include "widget.hpp"
#include <nana/gui/element.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana{
namespace drawerbase
@@ -105,5 +107,7 @@ namespace nana{
void _m_caption(native_string_type&&) override;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -16,6 +16,7 @@
#include <nana/gui/widgets/widget.hpp>
#include <nana/pat/cloneable.hpp>
#include <nana/any.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -141,7 +142,7 @@ namespace nana
void mouse_leave(graph_reference, const arg_mouse&) override;
private:
std::unique_ptr<event_agent_interface> event_agent_;
scheme * scheme_;
scheme * scheme_{nullptr};
};
}//end namespace categorize
}//end namespace drawerbase
@@ -258,5 +259,5 @@ namespace nana
}
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,8 @@
#ifndef NANA_GUI_WIDGET_CHECKBOX_HPP
#define NANA_GUI_WIDGET_CHECKBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include <vector>
#include <memory>
@@ -106,5 +108,6 @@ namespace drawerbase
std::vector<element_tag> ui_container_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_WIDGETS_COMBOX_HPP
#define NANA_GUI_WIDGETS_COMBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include "float_listbox.hpp"
#include "skeletons/text_editor_part.hpp"
@@ -227,4 +228,5 @@ namespace nana
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
};
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,7 +12,7 @@
#ifndef NANA_GUI_WIDGETS_DATE_CHOOSER_HPP
#define NANA_GUI_WIDGETS_DATE_CHOOSER_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include <nana/datetime.hpp>
@@ -79,5 +79,6 @@ namespace nana
void weekstr(unsigned index, ::std::string);///<Set the week strings which will be displayed for day, index is in range of [0, 6]
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_WIDGETS_DETAIL_TREE_CONT_HPP
#define NANA_GUI_WIDGETS_DETAIL_TREE_CONT_HPP
#include <stack>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -515,4 +516,6 @@ namespace detail
}//end namespace detail
}//end namespace widgets
}//end namesace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_WIDGETS_FLOAT_LISTBOX_HPP
#define NANA_GUI_WIDGETS_FLOAT_LISTBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include <vector>
@@ -101,5 +102,6 @@ namespace nana
std::size_t index() const;
};
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,8 +12,9 @@
#ifndef NANA_GUI_WIDGET_LABEL_HPP
#define NANA_GUI_WIDGET_LABEL_HPP
#include "widget.hpp"
#include "widget.hpp"
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -80,4 +81,6 @@ namespace nana
void _m_caption(native_string_type&&) override;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -17,6 +17,8 @@
#ifndef NANA_GUI_WIDGETS_LISTBOX_HPP
#define NANA_GUI_WIDGETS_LISTBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include "detail/inline_widget.hpp"
#include <nana/pat/abstract_factory.hpp>
@@ -295,7 +297,18 @@ namespace nana
throw std::runtime_error("listbox::item_proxy.value<T>() invalid type of value");
return *p;
}
template<typename T>
T & value()
{
auto * pany = _m_value();
if (nullptr == pany)
throw std::runtime_error("listbox::item_proxy.value<T>() is empty");
T * p = any_cast<T>(_m_value(false));
if (nullptr == p)
throw std::runtime_error("listbox::item_proxy.value<T>() invalid type of value");
return *p;
}
template<typename T>
item_proxy & value(T&& t)
{
@@ -503,9 +516,7 @@ namespace nana
{
basic_event<arg_listbox> checked;
basic_event<arg_listbox> selected;
/// An event occurs when a listbox category is double clicking.
basic_event<arg_listbox_category> category_dbl_click;
basic_event<arg_listbox_category> category_dbl_click; ///< An event occurs when a listbox category is double clicking.
};
struct scheme
@@ -516,26 +527,40 @@ namespace nana
color_proxy header_floated{ static_cast<color_rgb>(0xBABBBC)};
color_proxy item_selected{ static_cast<color_rgb>(0xD5EFFC) };
unsigned max_header_width{3000}, /// \todo how to implement some geometrical parameters ??
ext_w = 5;
/// \todo how to implement some geometrical parameters ??
unsigned max_header_width{ 3000 }; ///< during auto width don't alow more than this
unsigned min_header_width{ 20 }; ///< non counting suspension_width
unsigned suspension_width{ 0 }; ///< the trigger will set this to the width if ("...")
unsigned ext_w { 5 }; ///< ??
unsigned header_height { 20 }; ///< header height header_size
unsigned text_height { 0 }; ///< the trigger will set this to the height of the text font
unsigned item_height_ex { 6 }; ///< 6? item_height = text_height + item_height_ex
unsigned item_height { 0 }; ///< the trigger will set this TO item_height = text_height + item_height_ex
unsigned header_mouse_spliter_area_before{ 2 };
unsigned header_mouse_spliter_area_after { 3 };
};
}
}//end namespace drawerbase
/*! \class listbox
\brief A rectangle containing a list of strings from which the user can select. This widget contain a list of \a categories, with in turn contain a list of \a items.
A category is a text with can be \a selected, \a checked and \a expanded to show the items.
An item is formed by \a column-fields, each corresponding to one of the \a headers.
An item can be \a selected and \a checked.
\brief A rectangle containing a list of strings from which the user can select.
This widget contain a list of \a categories, with in turn contain a list of \a items.
A \a category is a text with can be \a selected, \a checked and \a expanded to show the \a items.
An \a item is formed by \a column-fields, each corresponding to one of the \a headers.
An \a item can be \a selected and \a checked.
The user can \a drag the header to \a resize it or to \a reorganize it.
By \a clicking on one header the list get \a reordered, first up, and then down alternatively.
1. The resolver is used to resolute an object of the specified type for a listbox item.
3. nana::listbox creates the category 0 by default. The member functions without the categ parameter operate the items that belong to category 0.
1. The resolver is used to resolute an object of the specified type into (or back from) a listbox item.
3. nana::listbox creates the category 0 by default.
This is an special category, becouse it is invisible, while the associated items are visible.
The optional, user-created categories begin at index 1 and are visibles.
The member functions without the categ parameter operate the items that belong to category 0.
4. A sort compare is used for sorting the items. It is a strict weak ordering comparer that must meet the requirement:
Irreflexivity (comp(x, x) returns false)
and
antisymmetry(comp(a, b) != comp(b, a) returns true)
Antisymmetry(comp(a, b) != comp(b, a) returns true)
A simple example.
bool sort_compare( const std::string& s1, nana::any*,
const std::string& s2, nana::any*, bool reverse)
@@ -550,10 +575,10 @@ By \a clicking on one header the list get \a reordered, first up, and then down
{
if(o1 && o2) //some items may not attach a customer object.
{
int * i1 = o1->get<int>();
int * i2 = o2->get<int>();
int * i1 = any_cast<int>(*o1);
int * i2 = any_cast<int>(*o2);
return (i1 && i2 && (reverse ? *i1 > *i2 : *i1 < *i2));
;//some types may not be int.
// ^ some types may not be int.
}
return false;
}
@@ -697,7 +722,7 @@ By \a clicking on one header the list get \a reordered, first up, and then down
size_type size_categ() const; ///<Get the number of categories
size_type size_item() const; ///<The number of items in the default category
size_type size_item(size_type cat) const; ///<The number of items in category "cat"
size_type size_item(size_type cat) const; ///<The number of items in category "cat"
void enable_single(bool for_selection, bool category_limited);
void disable_single(bool for_selection);
@@ -709,4 +734,6 @@ By \a clicking on one header the list get \a reordered, first up, and then down
void _m_erase_key(nana::detail::key_interface*);
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -17,6 +17,8 @@
#include <nana/gui/timer.hpp>
#include <nana/pat/cloneable.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana
{
namespace drawerbase
@@ -198,4 +200,6 @@ namespace nana
detail::popuper menu_popuper(menu&, mouse = mouse::right_button);
detail::popuper menu_popuper(menu&, window owner, const point&, mouse = mouse::right_button);
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -14,6 +14,7 @@
#define NANA_GUI_WIDGETS_MENUBAR_HPP
#include "widget.hpp"
#include "menu.hpp"
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -117,4 +118,6 @@ namespace nana
::nana::event_handle evt_resized_{nullptr};
};//end class menubar
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -13,6 +13,8 @@
*/
#ifndef NANA_GUI_WIDGET_PICTURE_HPP
#define NANA_GUI_WIDGET_PICTURE_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
namespace nana
@@ -67,4 +69,6 @@ namespace nana
bool transparent() const;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -15,6 +15,7 @@
#include "widget.hpp"
#include <nana/gui/timer.hpp>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -502,4 +503,5 @@ namespace nana
}
};//end class scroll
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -13,6 +13,8 @@
#ifndef NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#define NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#include <nana/push_ignore_diagnostic>
#include "textbase.hpp"
#include "text_editor_part.hpp"
#include <nana/gui/widgets/scroll.hpp>
@@ -218,7 +220,7 @@ namespace nana{ namespace widgets
void set_end_caret();
bool hit_text_area(const point&) const;
bool hit_select_area(nana::upoint pos) const;
bool hit_select_area(nana::upoint pos, bool ignore_when_select_all) const;
bool move_select();
bool mask(wchar_t);
@@ -358,12 +360,11 @@ namespace nana{ namespace widgets
struct selection
{
enum class mode{ no_selected, mouse_selected, method_selected };
enum class mode{ no_selected, mouse_selected, method_selected, move_selected };
text_focus_behavior behavior;
bool move_to_end;
mode mode_selection;
bool dragged;
bool ignore_press;
nana::upoint a, b;
}select_;
@@ -380,5 +381,7 @@ namespace nana{ namespace widgets
}//end namespace widgets
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -21,6 +21,8 @@
#include <stack>
#include <stdexcept>
#include <nana/push_ignore_diagnostic>
namespace nana{ namespace widgets{ namespace skeletons
{
//The tokens are defined for representing a text, the tokens are divided
@@ -177,13 +179,24 @@ namespace nana{ namespace widgets{ namespace skeletons
return token::tag_begin;
}
//Escape
if(ch == '\\')
if(this->format_enabled_ && (ch == '\\'))
{
if(iptr_ + 1 < endptr_)
{
ch = *(iptr_ + 1);
iptr_ += 2;
if ('<' == ch || '>' == ch) //two characters need to be escaped.
{
iptr_ += 2;
}
else
{
//ignore escape
ch = '\\';
iptr_++;
}
}
else
{
@@ -191,8 +204,8 @@ namespace nana{ namespace widgets{ namespace skeletons
return token::eof;
}
}
++iptr_;
else
++iptr_;
idstr_.clear();
idstr_.append(1, ch);
@@ -260,6 +273,8 @@ namespace nana{ namespace widgets{ namespace skeletons
return token::eof;
}
if(('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || '_' == ch)
{
--iptr_;
@@ -926,4 +941,5 @@ namespace nana{ namespace widgets{ namespace skeletons
}//end namespace skeletons
}//end namespace widgets
}//end namepsace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_WIDGETS_SKELETONS_TEXT_TOKEN_STREAM

View File

@@ -13,6 +13,7 @@
#ifndef NANA_GUI_WIDGET_DETAIL_TEXTBASE_HPP
#define NANA_GUI_WIDGET_DETAIL_TEXTBASE_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/charset.hpp>
#include <nana/basic_types.hpp>
@@ -536,4 +537,6 @@ namespace skeletons
}//end namespace detail
}//end namespace widgets
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -11,6 +11,9 @@
*/
#ifndef NANA_GUI_WIDGETS_SLIDER_HPP
#define NANA_GUI_WIDGETS_SLIDER_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include <nana/pat/cloneable.hpp>
@@ -111,7 +114,7 @@ namespace nana
};
}//end namespace slider
}//end namespace drawerbase
/// A slider widget wich the user can drag for tracking
/// A slider widget wich the user can drag for tracking \todo add scheme ?
class slider
: public widget_object<category::widget_tag, drawerbase::slider::trigger, drawerbase::slider::slider_events>
{
@@ -141,5 +144,6 @@ namespace nana
bool transparent() const;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,8 @@
#ifndef NANA_GUI_WIDGET_SPINBOX_HPP
#define NANA_GUI_WIDGET_SPINBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include "skeletons/text_editor_part.hpp"
@@ -68,7 +70,7 @@ namespace nana
private:
implementation * const impl_;
};
};
}
}//end namespace drawerbase
/// Spinbox Widget
@@ -110,5 +112,5 @@ namespace nana
void _m_caption(native_string_type&&);
}; //end class spinbox
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif //NANA_GUI_WIDGET_SPINBOX_HPP

View File

@@ -13,6 +13,8 @@
*/
#ifndef NANA_GUI_WIDGET_TABBAR_HPP
#define NANA_GUI_WIDGET_TABBAR_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include <nana/pat/cloneable.hpp>
#include <nana/any.hpp>
@@ -410,5 +412,6 @@ namespace nana
void erase(std::size_t pos, bool close_attached = true);
};
}
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -11,6 +11,8 @@
*/
#ifndef NANA_GUI_WIDGET_TEXTBOX_HPP
#define NANA_GUI_WIDGET_TEXTBOX_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/gui/widgets/widget.hpp>
#include "skeletons/textbase_export_interface.hpp"
#include "skeletons/text_editor_part.hpp"
@@ -224,4 +226,6 @@ namespace nana
void _m_typeface(const paint::font&) override;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,7 @@
#ifndef NANA_GUI_WIDGET_TOOLBAR_HPP
#define NANA_GUI_WIDGET_TOOLBAR_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
@@ -101,4 +102,6 @@ namespace nana
bool detached_;
};
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -17,6 +17,8 @@
#ifndef NANA_GUI_WIDGETS_TREEBOX_HPP
#define NANA_GUI_WIDGETS_TREEBOX_HPP
#include <nana/push_ignore_diagnostic>
#include "widget.hpp"
#include "detail/compset.hpp"
#include "detail/tree_cont.hpp"
@@ -307,14 +309,14 @@ namespace nana
{
_m_value() = t;
return *this;
};
}
template<typename T>
item_proxy & value(T&& t)
{
_m_value() = std::move(t);
return *this;
};
}
// Undocumentated methods for internal use
trigger::node_type * _m_node() const;
@@ -452,4 +454,6 @@ namespace nana
item_proxy selected() const; ///< returns the selected node
};//end class treebox
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -12,6 +12,8 @@
#ifndef NANA_GUI_WIDGET_HPP
#define NANA_GUI_WIDGET_HPP
#include <nana/push_ignore_diagnostic>
#include "../basis.hpp"
#include "../programming_interface.hpp"
#include <nana/internationalization.hpp>
@@ -481,4 +483,6 @@ namespace nana
std::unique_ptr<scheme_type> scheme_;
};//end class widget_object<category::frame_tag>
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -1,14 +1,14 @@
/*
/**
* Nana GUI Library Definition
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/wvl.hpp
* @description:
* @file nana/gui/wvl.hpp
* @description
* the header file contains the files required for running of Nana.GUI
*/
@@ -22,6 +22,7 @@
#include "msgbox.hpp"
#include "place.hpp"
namespace nana
{
namespace detail
@@ -58,6 +59,25 @@ namespace nana
template<typename Form, bool IsVisible = true>
using form_loader = detail::form_loader<Form, IsVisible>;
void exec();
/// @brief Take control of the GUI and optionaly automaticaly tests it.
///
/// @detail It transfers to nana the program flow control, which begin pumping messages
/// from the underlying OS, interpreting and sending it with suitable arguments
/// to the nana widgets that registered a response in the corresponding event.
/// It also accept arguments to be used in case of automatic GUI testing.
/// Other Way the arguments are ignored.
void exec(
unsigned wait = 1, ///< for the GUI to be constructed, in seconds
unsigned wait_end = 1, ///< for the GUI to be destructed, in seconds
std::function<void()> = {} ///< emit events to mimics user actions and may asert results
);
/// send a click message to this widget - useffull in GUI testing
void click(widget& w);
/// in seconds
void Wait(unsigned wait = 0);
}//end namespace nana
#endif

View File

@@ -13,6 +13,7 @@
#ifndef NANA_PAT_CLONEABLE_HPP
#define NANA_PAT_CLONEABLE_HPP
#include <nana/push_ignore_diagnostic>
#include <nana/c++defines.hpp>
#include <cstddef>
#include <type_traits>
@@ -97,9 +98,7 @@ namespace nana{ namespace pat{
typedef int inner_bool::* operator_bool_t;
template<typename U>
struct member_enabled
: public std::enable_if<(!std::is_base_of<cloneable, typename std::remove_reference<U>::type>::value) && std::is_base_of<base_t, typename std::remove_reference<U>::type>::value, int>
{};
using member_enabled = std::enable_if<(!std::is_base_of<cloneable, typename std::remove_reference<U>::type>::value) && std::is_base_of<base_t, typename std::remove_reference<U>::type>::value, int>;
public:
cloneable() noexcept = default;
@@ -207,5 +206,5 @@ namespace nana{ namespace pat{
using mutable_cloneable = cloneable<T, true>;
}//end namespace pat
}//end namespace nana
#include <nana/pop_ignore_diagnostic>
#endif

View File

@@ -0,0 +1,5 @@
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
# pragma GCC diagnostic pop
#endif

View File

@@ -0,0 +1,4 @@
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Weffc++"
#endif

View File

@@ -8,12 +8,12 @@
#include <windows.h>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <pthread.h>
//#include <thread>
//#include <pthread.h>
#include <errno.h>
#include <cstdio>
// http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno.h#L53
#define EPROTO 71 /* Protocol error */
//#define EPROTO 71 /* Protocol error */
#include <mingw.thread.h>
#include <mingw.mutex.h>
#else

View File

@@ -5,6 +5,7 @@
#if defined(STD_THREAD_NOT_SUPPORTED)
#if defined(NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
#include <mingw.thread.h>
#else
#include <boost/thread.hpp>
@@ -13,5 +14,11 @@ namespace std
typedef boost::thread thread;
}
#endif // (NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
#else
#include <thread>
#endif // (STD_THREAD_NOT_SUPPORTED)
#endif // NANA_STD_THREAD_HPP

View File

@@ -30,7 +30,7 @@ namespace system
typedef void* module_t;
void* symbols(module_t handle, const char* symbol);
}; //end struct shared_helper
} //end namespace shared_helper
}//end namespace detail
class shared_wrapper

View File

@@ -1,6 +1,8 @@
#ifndef NANA_UNICODE_BIDI_HPP
#define NANA_UNICODE_BIDI_HPP
#include <vector>
#include <nana/push_ignore_diagnostic>
namespace nana
{
@@ -60,7 +62,7 @@ namespace nana
void _m_resolve_weak_types();
void _m_resolve_neutral_types();
void _m_resolve_implicit_levels();
void _m_reordering_resolved_levels(const char_type*, std::vector<entity> & reordered);
void _m_reordering_resolved_levels(std::vector<entity> & reordered);
static bidi_category _m_bidi_category(bidi_char);
static bidi_char _m_char_dir(char_type);
private:
@@ -71,5 +73,6 @@ namespace nana
};
}
#include <nana/pop_ignore_diagnostic>
#endif