diff --git a/CMakeLists.txt b/CMakeLists.txt
index dba9e2c9..242a1ea2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,7 +123,7 @@ execute_process(COMMAND ${CMAKE_COMMAND}
${CMAKE_CURRENT_SOURCE_DIR}/include/nana/)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)
@@ -161,3 +161,5 @@ install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(DIRECTORY ${NANA_INCLUDE_DIR}/nana DESTINATION include)
+
+set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 )
diff --git a/build/codeblocks/nana.cbp b/build/codeblocks/nana.cbp
index 83985a24..fb1a1b55 100644
--- a/build/codeblocks/nana.cbp
+++ b/build/codeblocks/nana.cbp
@@ -81,6 +81,7 @@
+
diff --git a/build/codeblocks/nana.layout b/build/codeblocks/nana.layout
index 805917bc..92b352dc 100644
--- a/build/codeblocks/nana.layout
+++ b/build/codeblocks/nana.layout
@@ -1,34 +1,9 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -36,86 +11,51 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -126,9 +66,19 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -136,19 +86,69 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/vc2013/nana.vcxproj b/build/vc2013/nana.vcxproj
index 7e216758..610054bc 100644
--- a/build/vc2013/nana.vcxproj
+++ b/build/vc2013/nana.vcxproj
@@ -67,24 +67,32 @@
- ../bin/vc2013/
+ ../bin/
..\..\include;$(IncludePath)
..\..\source;$(VC_SourcePath);
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
..\..\include;$(IncludePath)
..\..\source;$(VC_SourcePath);
- ../bin/vc2013/
+ ../bin/
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
- ../bin/vc2013/
+ ../bin/
..\..\include;$(IncludePath)
..\..\source;$(VC_SourcePath);
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
..\..\include;$(IncludePath)
..\..\source;$(VC_SourcePath);
- ../bin/vc2013/
+ ../bin/
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
@@ -102,7 +110,7 @@
true
- $(OutDir)\nana_$(ConfigurationName)_$(PlatformShortName).lib
+ $(TargetPath)
@@ -119,7 +127,7 @@
true
- $(OutDir)\nana_$(ConfigurationName)_$(PlatformShortName).lib
+ $(TargetPath)
@@ -141,7 +149,7 @@
true
- $(OutDir)\nana_$(ConfigurationName)_$(PlatformShortName).lib
+ $(TargetPath)
@@ -162,7 +170,7 @@
true
- $(OutDir)\nana_$(ConfigurationName)_$(PlatformShortName).lib
+ $(TargetPath)
@@ -177,6 +185,7 @@
+
@@ -213,6 +222,7 @@
+
@@ -247,7 +257,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/build/vc2013/nana.vcxproj.filters b/build/vc2013/nana.vcxproj.filters
index f0f82981..6ade66c7 100644
--- a/build/vc2013/nana.vcxproj.filters
+++ b/build/vc2013/nana.vcxproj.filters
@@ -58,6 +58,51 @@
{e95b4a72-643f-4416-af95-b0bbaf7f0c57}
+
+ {d421a05b-b868-4c3d-bdac-ff57d09f8d07}
+
+
+ {64c22f90-dce2-40dc-be98-edc9fe8951e8}
+
+
+ {91301ff5-79ac-40cc-a6db-bca2097ea763}
+
+
+ {81c62a28-ef5f-43f7-a6ce-e6c186cb411a}
+
+
+ {4a1db6f0-a4ee-4514-8e89-54ef9d52e3b8}
+
+
+ {c92e890a-ffd5-4efd-8b37-78ed9bbea1e1}
+
+
+ {63401f37-26a3-423e-87e6-6840344c3056}
+
+
+ {61385c08-f06b-4cf3-8e05-9b47d546164b}
+
+
+ {e9eadc97-4a14-4a4e-bb52-52d3a20e2693}
+
+
+ {5667eac1-0887-4936-9502-eac4dd8c1c1d}
+
+
+ {e6c4a4d9-b4b5-4c56-bb2a-486f3f777ecb}
+
+
+ {ac132633-f80c-4983-8e47-fa7fc17f666e}
+
+
+ {ee3e9e63-7221-409e-9659-25864e576e16}
+
+
+ {ef87057b-dff2-40aa-a05e-9dcd0b335c30}
+
+
+ {8ea232cf-bd7c-47e3-a694-6a8898b677d7}
+
@@ -74,6 +119,9 @@
Source Files\nana\detail\win32
+
+
+ Source Files\nana\filesystem
Source Files\nana\filesystem
@@ -301,4 +349,374 @@
Source Files\nana\gui\widgets
-
\ No newline at end of file
+
+
+ Source Files\nana\gui\widgets
+
+
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\widgets
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui\detail
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui
+
+
+ Header Files\gui\widgets\detail
+
+
+ Header Files\gui\widgets\detail
+
+
+ Header Files\gui\widgets\skeletons
+
+
+ Header Files\gui\widgets\skeletons
+
+
+ Header Files\gui\widgets\skeletons
+
+
+ Header Files\gui\widgets\skeletons
+
+
+ Header Files\gui\widgets\skeletons
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\detail\linux_X11
+
+
+ Header Files\detail\linux_X11
+
+
+ Header Files\detail\linux_X11
+
+
+ Header Files\detail\win32
+
+
+ Header Files\extrlib
+
+
+ Header Files\extrlib
+
+
+ Header Files\extrlib
+
+
+ Header Files\extrlib
+
+
+ Header Files\filesystem
+
+
+ Header Files\filesystem
+
+
+ Header Files\filesystem
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\paint\detail
+
+
+ Header Files\pat
+
+
+ Header Files\system
+
+
+ Header Files\system
+
+
+ Header Files\system
+
+
+ Header Files\system
+
+
+ Header Files\threads
+
+
+ Header Files\gui\widgets
+
+
+
diff --git a/build/vc2015/nana.sln b/build/vc2015/nana.sln
new file mode 100644
index 00000000..eab31ab5
--- /dev/null
+++ b/build/vc2015/nana.sln
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.22823.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{25B21068-491B-4A9F-B99F-6C27BF31BAAD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.ActiveCfg = Debug|x64
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.Build.0 = Debug|x64
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.ActiveCfg = Debug|Win32
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.Build.0 = Debug|Win32
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.ActiveCfg = Release|x64
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.Build.0 = Release|x64
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.ActiveCfg = Release|Win32
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/build/vc2015/nana.vcxproj b/build/vc2015/nana.vcxproj
new file mode 100644
index 00000000..d4f7f5d3
--- /dev/null
+++ b/build/vc2015/nana.vcxproj
@@ -0,0 +1,264 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {25B21068-491B-4A9F-B99F-6C27BF31BAAD}
+ Win32Proj
+ nana
+ 8.1
+
+
+
+ StaticLibrary
+ true
+ v140
+ Unicode
+
+
+ StaticLibrary
+ true
+ v140
+ Unicode
+
+
+ StaticLibrary
+ false
+ v140
+ true
+ Unicode
+
+
+ StaticLibrary
+ false
+ v140
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ../bin/
+ ..\..\include;$(IncludePath)
+ ..\..\source;$(VC_SourcePath);
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
+
+
+ ..\..\include;$(IncludePath)
+ ..\..\source;$(VC_SourcePath);
+ ../bin/
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
+
+
+ ../bin/
+ ..\..\include;$(IncludePath)
+ ..\..\source;$(VC_SourcePath);
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
+
+
+ ..\..\include;$(IncludePath)
+ ..\..\source;$(VC_SourcePath);
+ ../bin/
+ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)
+ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ MultiThreadedDebug
+ true
+ false
+
+
+ Windows
+ true
+
+
+ $(TargetPath)
+
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ MultiThreadedDebug
+
+
+ Windows
+ true
+
+
+ $(TargetPath)
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ MultiThreaded
+ true
+
+
+ Windows
+ true
+ true
+ true
+
+
+ $(TargetPath)
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
+ MultiThreaded
+
+
+ Windows
+ true
+ true
+ true
+
+
+ $(TargetPath)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/vc2015/nana.vcxproj.filters b/build/vc2015/nana.vcxproj.filters
new file mode 100644
index 00000000..81495341
--- /dev/null
+++ b/build/vc2015/nana.vcxproj.filters
@@ -0,0 +1,310 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {b0bd11b1-bcbb-4e05-885e-44295bc1a7bb}
+
+
+ {aab16aa3-c8d4-4495-8606-1b21ae739ee5}
+
+
+ {c395f107-7102-415b-a019-54e7cf3575af}
+
+
+ {e2569be2-9e68-477d-8b59-e248595de6c7}
+
+
+ {52ed7f8e-fa48-495e-af1f-4df013205a35}
+
+
+ {87d14798-9015-4162-b9ab-72c741cff063}
+
+
+ {4f8e7d23-9fe1-4409-bb03-2bd0809e606b}
+
+
+ {85c9c1bb-d87b-4481-bf3c-7425f680a12d}
+
+
+ {8058b530-86ec-4d72-890d-345aa30db056}
+
+
+ {87b124cb-408d-460b-a81b-8a788bbae0d9}
+
+
+ {b10db2f1-0542-421a-9e1d-4357e3be5f68}
+
+
+ {59f186c8-f5f8-4499-8e19-f278d4754220}
+
+
+ {5acf1733-47b2-4872-a105-66c7ad15cd39}
+
+
+ {a81fa10e-1274-44e0-92a0-434fa28f89ae}
+
+
+ {e95b4a72-643f-4416-af95-b0bbaf7f0c57}
+
+
+
+
+ Source Files\nana\audio\detail
+
+
+ Source Files\nana\audio\detail
+
+
+ Source Files\nana\audio\detail
+
+
+ Source Files\nana\audio
+
+
+ Source Files\nana\detail\win32
+
+
+ Source Files\nana\filesystem
+
+
+ Source Files\nana\filesystem
+
+
+ Source Files\nana\gui\detail\win32
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\widgets\skeletons
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\paint\detail
+
+
+ Source Files\nana\paint\detail
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\paint
+
+
+ Source Files\nana\system
+
+
+ Source Files\nana\system
+
+
+ Source Files\nana\system
+
+
+ Source Files\nana\system
+
+
+ Source Files\nana\threads
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana
+
+
+ Source Files\nana\gui\detail
+
+
+ Source Files\nana\gui
+
+
+ Source Files\nana\gui\widgets
+
+
+ Source Files\nana\filesystem
+
+
+ Source Files\nana\gui\widgets
+
+
+
\ No newline at end of file
diff --git a/include/nana/audio/detail/audio_stream.hpp b/include/nana/audio/detail/audio_stream.hpp
index 694089bd..5fe9d39c 100644
--- a/include/nana/audio/detail/audio_stream.hpp
+++ b/include/nana/audio/detail/audio_stream.hpp
@@ -12,19 +12,19 @@ namespace nana{ namespace audio{
#pragma pack(1)
struct master_riff_chunk
{
- unsigned long ckID; //"RIFF"
- unsigned long cksize;
- unsigned long waveID; //"WAVE"
+ unsigned ckID; //"RIFF"
+ unsigned cksize;
+ unsigned waveID; //"WAVE"
};
struct format_chunck
{
- unsigned long ckID; //"fmt "
- unsigned long cksize;
+ unsigned ckID; //"fmt "
+ unsigned cksize;
unsigned short wFormatTag;
unsigned short nChannels;
- unsigned long nSamplePerSec;
- unsigned long nAvgBytesPerSec;
+ unsigned nSamplePerSec;
+ unsigned nAvgBytesPerSec;
unsigned short nBlockAlign;
unsigned short wBitsPerSample;
};
@@ -32,19 +32,19 @@ namespace nana{ namespace audio{
#elif defined(NANA_LINUX)
struct master_riff_chunk
{
- unsigned long ckID; //"RIFF"
- unsigned long cksize;
- unsigned long waveID; //"WAVE"
+ unsigned ckID; //"RIFF"
+ unsigned cksize;
+ unsigned waveID; //"WAVE"
}__attribute__((packed));
struct format_chunck
{
- unsigned long ckID; //"fmt "
- unsigned long cksize;
+ unsigned ckID; //"fmt "
+ unsigned cksize;
unsigned short wFormatTag;
unsigned short nChannels;
- unsigned long nSamplePerSec;
- unsigned long nAvgBytesPerSec;
+ unsigned nSamplePerSec;
+ unsigned nAvgBytesPerSec;
unsigned short nBlockAlign;
unsigned short wBitsPerSample;
}__attribute__((packed));
@@ -55,8 +55,8 @@ namespace nana{ namespace audio{
{
struct chunck
{
- unsigned long ckID;
- unsigned long cksize;
+ unsigned ckID;
+ unsigned cksize;
};
public:
bool open(const nana::string& file);
diff --git a/include/nana/audio/player.hpp b/include/nana/audio/player.hpp
index 278e0ecc..24378214 100644
--- a/include/nana/audio/player.hpp
+++ b/include/nana/audio/player.hpp
@@ -4,7 +4,10 @@
#include
namespace nana{ namespace audio
-{ /// play an audio file in Windows WAV format
+{ /// class player
+ /// \brief play an audio file in PCM Windows WAV format
+ ///
+ /// \include audio_player.cpp
class player
: private nana::noncopyable
{
diff --git a/include/nana/basic_types.hpp b/include/nana/basic_types.hpp
index a48d9ece..da37272d 100644
--- a/include/nana/basic_types.hpp
+++ b/include/nana/basic_types.hpp
@@ -306,7 +306,7 @@ namespace nana
color(unsigned red, unsigned green, unsigned blue, double alpha);
/// Initializes the color with a CSS-like rgb string.
- color(std::string css_rgb);
+ explicit color(std::string css_rgb);
color& alpha(double); ///< Sets alpha channel
color& from_rgb(unsigned red, unsigned green, unsigned blue); ///< immutable alpha channel
@@ -406,10 +406,10 @@ namespace nana
struct rectangle
{
- rectangle(); ///< a zero-size rectangle at (0, 0).
+ rectangle(); ///< a zero-size rectangle at (0, 0).
rectangle(int x, int y, unsigned width, unsigned height);
- rectangle(const size &); ///< a rectangle with specified size at coordinate (0, 0).
- rectangle(const point&, const size& = size());
+ explicit rectangle(const size &); ///< a rectangle with specified size at coordinate (0, 0).
+ explicit rectangle(const point&, const size& = size());
bool operator==(const rectangle& rhs) const;
bool operator!=(const rectangle& rhs) const;
diff --git a/include/nana/config.hpp b/include/nana/config.hpp
index 77b9005c..6d2cf836 100644
--- a/include/nana/config.hpp
+++ b/include/nana/config.hpp
@@ -13,6 +13,26 @@
#ifndef NANA_CONFIG_HPP
#define NANA_CONFIG_HPP
+
+#if defined(_MSC_VER)
+ #define _SCL_SECURE_NO_WARNINGS
+ #define _CRT_SECURE_NO_DEPRECATE
+ #pragma warning(disable : 4996)
+
+ #if (_MSC_VER < 1900)
+ // is this a good idea?
+ #define NOT_IMPLEMENTED_KEYWORD_noexcept
+ #endif // _MSC_VER < 1900
+ #if (_MSC_VER == 1900)
+ // google: break any code that tries to use codecvt or codecvt.
+ // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support.
+ // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively.
+ // However, the codecvt::id and codecvt::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
+
//Select platform automatically
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
//Windows:
@@ -35,7 +55,7 @@
#define PLATFORM_SPEC_HPP
#define STD_CODECVT_NOT_SUPPORTED
#else
-# static_assert(false, "Only Windows and Unix are support now");
+# static_assert(false, "Only Windows and Unix are supported now");
#endif
#if defined(NANA_MINGW) || defined(NANA_LINUX)
diff --git a/include/nana/detail/win32/platform_spec.hpp b/include/nana/detail/win32/platform_spec.hpp
index 9e735f99..e8db5fff 100644
--- a/include/nana/detail/win32/platform_spec.hpp
+++ b/include/nana/detail/win32/platform_spec.hpp
@@ -55,6 +55,13 @@ namespace detail
unsigned ignore; //determinate that pos or size would be ignored.
};
+ struct map_thread
+ {
+ rectangle update_area;
+ bool ignore_update_area;
+ bool forced;
+ };
+
enum
{
tray = 0x501,
@@ -165,6 +172,12 @@ namespace detail
HMODULE ole32_;
};
+ struct window_icons
+ {
+ ::nana::paint::image sml_icon;
+ ::nana::paint::image big_icon;
+ };
+
platform_spec();
const font_ptr_t& default_native_font() const;
@@ -175,11 +188,11 @@ namespace detail
static platform_spec& instance();
- void keep_window_icon(native_window_type, const nana::paint::image&);
+ void keep_window_icon(native_window_type, const paint::image&sml_icon, const paint::image& big_icon);
void release_window_icon(native_window_type);
private:
font_ptr_t def_font_ptr_;
- std::map iconbase_;
+ std::map iconbase_;
};
}//end namespace detail
diff --git a/include/nana/filesystem/filesystem.hpp b/include/nana/filesystem/filesystem.hpp
new file mode 100644
index 00000000..6647747d
--- /dev/null
+++ b/include/nana/filesystem/filesystem.hpp
@@ -0,0 +1,468 @@
+/*
+ * A ISO C++ filesystem Implementation
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 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.hpp
+ * @description:
+ * file_iterator is a toolkit for applying each file and directory in a
+ * specified path.
+ * 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
+ */
+
+// 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 header VS2015
+// https://msdn.microsoft.com/en-us/library/hh874694%28v=vs.120%29.aspx --- 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.
+// http://theboostcpplibraries.com/boost.filesystem --- Boost docs
+// http://www.boost.org/doc/libs/1_58_0/libs/filesystem/doc/index.htm ---
+// http://www.boost.org/doc/libs/1_34_0/libs/filesystem/doc/index.htm
+// http://www.boost.org/doc/libs/1_58_0/boost/filesystem.hpp
+// https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x --- Table 1.4. g++ C++ Technical Specifications Implementation Status
+
+#ifndef NANA_FILESYSTEM_HPP
+#define NANA_FILESYSTEM_HPP
+#include
+#include
+#include
+#include
+
+#include
+
+#ifdef NANA_WINDOWS
+ #include
+ typedef HANDLE find_handle_t;
+#elif defined(NANA_LINUX)
+ #include
+ #include
+ #include
+ typedef DIR* find_handle_t;
+#endif
+
+ // namespace std { namespace experimental { namespace filesystem { inline namespace v1 {
+
+namespace nana { namespace experimental
+{
+namespace filesystem
+{
+ 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
+ regular = 1,
+ directory = 2 ,
+ symlink =3, ///< Symbolic link file
+ block =4, ///< Block special file
+ character= 5 , ///< Character special file
+ fifo = 6 , ///< FIFO or pipe file
+ socket =7,
+ unknown= 8 ///< The file does exist, but is of an operating system dependent type not covered by any of the other
+ };
+
+ enum class perms
+ {
+ none =0, ///< There are no permissions set for the file.
+ unknown = 0xFFFF ///< not known, such as when a file_status object is created without specifying the permissions
+ };
+ //enum class copy_options;
+ //enum class directory_options;
+
+ // class filesystem_error;
+ enum class error { none = 0 }; // deprecate ??
+
+ struct attribute // deprecate ??
+ {
+ uintmax_t size {};
+ bool directory{};
+ tm modified {};
+
+ attribute() {} ;
+ attribute( uintmax_t size, bool is_directory) :size{size}, directory{is_directory} {}
+ };
+
+ struct space_info
+ {
+ uintmax_t capacity;
+ uintmax_t free;
+ uintmax_t available;
+ };
+ using file_time_type = std::chrono::time_point< std::chrono::system_clock>;// trivial-clock> ;
+
+ class file_status
+ {
+ file_type m_ft = file_type::none;
+ perms m_prms = perms::unknown;
+
+ public:
+ explicit file_status(file_type ft = file_type::none, perms prms = perms::unknown)
+ :m_ft{ft}, m_prms{prms}
+ {}
+
+ file_status(const file_status& fs) : m_ft{fs.m_ft}, m_prms{fs.m_prms}{} // = default;
+ file_status(file_status&& fs) : m_ft{fs.m_ft}, m_prms{fs.m_prms}{} // = default;
+
+ ~file_status(){};
+ file_status& operator=(const file_status&) = default;
+ file_status& operator=(file_status&&fs) // = default;
+ {
+ m_ft=fs.m_ft; m_prms = fs.m_prms;
+ return *this;
+ }
+ // observers
+ file_type type() const { return m_ft;}
+ perms permissions() const { return m_prms;}
+ // modifiers
+ void type (file_type ft) { m_ft=ft ;}
+ void permissions(perms prms) { m_prms = prms; }
+ };
+
+ /// concerned only with lexical and syntactic aspects and does not necessarily exist in
+ /// external storage, and the pathname is not necessarily valid for the current operating system
+ /// or for a particular file system
+ /// A sequence of elements that identify the location of a file within a filesystem.
+ /// The elements are the:
+ /// rootname (opt), root-directory (opt), and an optional sequence of filenames.
+ /// The maximum number of elements in the sequence is operating system dependent.
+ class path
+ {
+ public:
+ path();
+ path(const nana::string&);
+
+ bool empty() const;
+ path root() const;
+ file_type what() const;
+
+ nana::string filename() const;
+#if defined(NANA_WINDOWS)
+ public:
+ nana::string to_string() const { return text_; }
+ operator nana::string() const { return text_; }
+ private:
+ nana::string text_;
+#else
+ public:
+ std::string to_string() const { return text_; }
+ operator std::string() const { return text_; }
+ private:
+ std::string text_;
+#endif
+ };
+
+ struct directory_entry
+ {
+ using path_type = filesystem::path;
+ path_type m_path;
+
+ attribute attr{};
+ //file_status m_status;
+
+ directory_entry(){}
+ directory_entry(const path_type& p, bool is_directory, uintmax_t size)
+ :m_path{p}, attr{size, is_directory}
+ {}
+
+ void assign (const path_type& p){ m_path=p;}
+ void replace_filename(const path_type& p){ m_path=p;}
+
+ //file_status status() const;
+
+ operator const path_type&() const {return m_path;};
+ const path_type& path() const {return m_path;}
+ };
+
+ /// an iterator for a sequence of directory_entry elements representing the files in a directory, not an recursive_directory_iterator
+ //template
+ class directory_iterator :public std::iterator
+ {
+ 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():end_(true), handle_(nullptr){}
+
+ directory_iterator(const nana::string& file_path) { _m_prepare(file_path); }
+ directory_iterator(const path& file_path) { _m_prepare(file_path.filename()); }
+
+ const value_type&
+ operator*() const { return value_; }
+
+ const value_type*
+ operator->() const { return &(operator*()); }
+
+ directory_iterator& operator++()
+ { _m_read(); return *this; }
+
+ directory_iterator operator++(int)
+ {
+ directory_iterator tmp = *this;
+ _m_read();
+ return tmp;
+ }
+
+ bool equal(const directory_iterator& x) const
+ {
+ if(end_ && (end_ == x.end_)) return true;
+ return (value_.path().filename() == x.value_.path().filename());
+ }
+
+
+ // enable directory_iterator range-based for statements
+ directory_iterator begin( ) { return *this; }
+ directory_iterator end( ) { return {}; }
+
+ private:
+ template
+ static bool _m_ignore(const Char * p)
+ {
+ while(*p == '.')
+ ++p;
+ return (*p == 0);
+ }
+
+ void _m_prepare(const nana::string& file_path)
+ {
+ #if defined(NANA_WINDOWS)
+ path_ = file_path;
+ auto pat = file_path;
+ DWORD attr = ::GetFileAttributes(pat.data());
+ if((attr != INVALID_FILE_ATTRIBUTES) && (attr & FILE_ATTRIBUTE_DIRECTORY))
+ pat += STR("\\*");
+
+ ::HANDLE handle = ::FindFirstFile(pat.data(), &wfd_);
+
+ if(handle == INVALID_HANDLE_VALUE)
+ {
+ end_ = true;
+ return;
+ }
+
+ while(_m_ignore(wfd_.cFileName))
+ {
+ if(::FindNextFile(handle, &wfd_) == 0)
+ {
+ end_ = true;
+ ::FindClose(handle);
+ return;
+ }
+ }
+
+ value_ = value_type(path(wfd_.cFileName),
+ (FILE_ATTRIBUTE_DIRECTORY & wfd_.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY,
+ wfd_.nFileSizeLow);
+
+ #elif defined(NANA_LINUX)
+ path_ = nana::charset(file_path);
+ if(path_.size() && (path_[path_.size() - 1] != '/'))
+ path_ += '/';
+ find_handle_t handle = opendir(path_.c_str());
+ end_ = true;
+ if(handle)
+ {
+ struct dirent * dnt = readdir(handle);
+ if(dnt)
+ {
+ while(_m_ignore(dnt->d_name))
+ {
+ dnt = readdir(handle);
+ if(dnt == 0)
+ {
+ closedir(handle);
+ return;
+ }
+ }
+
+ struct stat fst;
+ bool is_directory = false;
+ unsigned size = 0;
+ if(stat((path_ + dnt->d_name).c_str(), &fst) == 0)
+ {
+ is_directory = (0 != S_ISDIR(fst.st_mode));
+ size = fst.st_size;
+ }
+ value_ = value_type(static_cast(nana::charset(dnt->d_name)), is_directory, size);
+ end_ = false;
+ }
+ }
+ #endif
+ if(false == end_)
+ {
+ find_ptr_ = std::shared_ptr(new find_handle_t(handle), inner_handle_deleter());
+ handle_ = handle;
+ }
+ }
+
+ void _m_read()
+ {
+ if(handle_)
+ {
+ #if defined(NANA_WINDOWS)
+ if(::FindNextFile(handle_, &wfd_) != 0)
+ {
+ while(_m_ignore(wfd_.cFileName))
+ {
+ if(::FindNextFile(handle_, &wfd_) == 0)
+ {
+ end_ = true;
+ return;
+ }
+ }
+ value_ = value_type(path(wfd_.cFileName),
+ (FILE_ATTRIBUTE_DIRECTORY & wfd_.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY,
+ wfd_.nFileSizeLow);
+ }
+ else
+ end_ = true;
+ #elif defined(NANA_LINUX)
+ struct dirent * dnt = readdir(handle_);
+ if(dnt)
+ {
+ while(_m_ignore(dnt->d_name))
+ {
+ dnt = readdir(handle_);
+ if(dnt == 0)
+ {
+ end_ = true;
+ return;
+ }
+ }
+
+ nana::string d_name = nana::charset(dnt->d_name);
+ struct stat fst;
+ if(stat((path_ + "/" + dnt->d_name).c_str(), &fst) == 0)
+ value_ = value_type(std::move(d_name), (0 != S_ISDIR(fst.st_mode)), fst.st_size);
+ else
+ value_.m_path = path(std::move(d_name));
+ }
+ else
+ end_ = true;
+ #endif
+ }
+ }
+ private:
+ struct inner_handle_deleter
+ {
+ void operator()(find_handle_t * handle)
+ {
+ if(handle && *handle)
+ {
+ #if defined(NANA_WINDOWS)
+ ::FindClose(*handle);
+ #elif defined(NANA_LINUX)
+ ::closedir(*handle);
+ #endif
+ }
+ delete handle;
+ }
+ };
+ private:
+ bool end_{false};
+
+#if defined(NANA_WINDOWS)
+ WIN32_FIND_DATA wfd_;
+ nana::string path_;
+#elif defined(NANA_LINUX)
+ std::string path_;
+#endif
+ std::shared_ptr find_ptr_;
+ find_handle_t handle_{nullptr};
+ value_type value_;
+ };
+
+
+ //class recursive_directory_iterator;
+ //// enable recursive_directory_iterator range-based for statements
+ //recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
+ //recursive_directory_iterator end(const recursive_directory_iterator&) noexcept;
+
+ //template
+ inline bool operator==(const directory_iterator/**/ & x, const directory_iterator/**/ & y)
+ {
+ return x.equal(y);
+ }
+
+ //template
+ inline bool operator!=(const directory_iterator/**/ & x, const directory_iterator/**/ & y)
+ {
+ return !x.equal(y);
+ }
+
+
+ // file_status status(const path& p);
+ bool file_attrib(const nana::string& file, attribute&);
+
+ inline bool is_directory(file_status s) { return s.type() == file_type::directory ;}
+ inline bool is_directory(const path& p) { return directory_iterator(p)->attr.directory; }//works??
+ inline bool is_directory(const directory_entry& d) { return d.attr.directory; }
+ //bool is_directory(const path& p, error_code& ec) noexcept;
+
+ //bool is_regular_file(file_status s) noexcept;
+
+ inline bool is_empty(const path& p)
+ {
+ directory_iterator d(p) ;
+ return d->attr.directory ? d == directory_iterator()
+ : d->attr.size == 0;
+ }
+ //bool is_empty(const path& p, error_code& ec) noexcept;
+
+ uintmax_t file_size(const nana::string& file); // deprecate?
+ inline uintmax_t file_size(const path& p){return file_size(p.filename());}
+ //uintmax_t file_size(const path& p, error_code& ec) noexcept;
+ //long long filesize(const nana::string& file);
+
+
+ bool create_directories(const path& p);
+ //bool create_directories(const path& p, error_code& ec) noexcept;
+ bool create_directory(const path& p);
+ //bool create_directory(const path& p, error_code& ec) noexcept;
+ bool create_directory(const path& p, const path& attributes);
+ //bool create_directory(const path& p, const path& attributes, error_code& ec) noexcept;
+ bool create_directory(const nana::string& dir, bool & if_exist);
+ inline bool create_directory(const path& p, bool & if_exist)
+ {
+ return create_directory(p.filename(), if_exist);
+ };
+
+
+ bool modified_file_time(const nana::string& file, struct tm&);
+
+
+ nana::string path_user();
+
+
+ path current_path();
+ //path current_path(error_code& ec);
+ void current_path(const path& p);
+ //void current_path(const path& p, error_code& ec) noexcept;
+ //nana::string path_current();
+
+
+ //bool remove(const path& p);
+ //bool remove(const path& p, error_code& ec) noexcept;
+ bool rmfile(const nana::char_t* file);
+
+ //uintmax_t remove_all(const path& p);
+ //uintmax_t remove_all(const path& p, error_code& ec) noexcept;
+ bool rmdir(const nana::char_t* dir, bool fails_if_not_empty);
+ nana::string root(const nana::string& path);
+
+
+}//end namespace filesystem
+} //end namespace experimental
+}//end namespace nana
+
+#endif
diff --git a/include/nana/gui/basis.hpp b/include/nana/gui/basis.hpp
index c0ef0aa5..789ab5c3 100644
--- a/include/nana/gui/basis.hpp
+++ b/include/nana/gui/basis.hpp
@@ -84,6 +84,7 @@ namespace nana
end_of_medium = 0x19, //Ctrl+Y
substitute = 0x1A, //Ctrl+Z
escape = 0x1B,
+ space = 0x20, //Space
//The following names are intuitive name of ASCII control codes
select_all = start_of_headline,
diff --git a/include/nana/gui/detail/basic_window.hpp b/include/nana/gui/detail/basic_window.hpp
index 659f4316..1ce944a9 100644
--- a/include/nana/gui/detail/basic_window.hpp
+++ b/include/nana/gui/detail/basic_window.hpp
@@ -15,17 +15,21 @@
#include "drawer.hpp"
#include "events_holder.hpp"
#include "widget_colors.hpp"
+#include "widget_notifier_interface.hpp"
#include
#include
#include
-#include
namespace nana{
- class widget; //declaration ofr nana/widgets/widget.hpp
namespace detail
{
struct basic_window;
+ enum class visible_state
+ {
+ invisible, visible, displayed
+ };
+
class caret_descriptor
{
public:
@@ -42,17 +46,13 @@ namespace detail
bool visible() const;
::nana::size size() const;
void size(const ::nana::size&);
-
void update();
- private:
- void _m_visible(bool isshow);
private:
core_window_t* wd_;
::nana::point point_;
::nana::size size_;
::nana::size paint_size_;
- bool visible_;
- bool real_visible_state_;
+ visible_state visible_state_;
bool out_of_range_;
::nana::rectangle effective_range_;
};//end class caret_descriptor
@@ -76,11 +76,6 @@ namespace detail
{
using container = std::vector;
- struct root_context
- {
- bool focus_changed;
- };
-
enum class update_state
{
none, lazy, refresh
@@ -94,11 +89,11 @@ namespace detail
//basic_window
//@brief: constructor for the root window
- basic_window(basic_window* owner, widget*, category::root_tag**);
+ basic_window(basic_window* owner, std::unique_ptr&&, category::root_tag**);
template
- basic_window(basic_window* parent, const rectangle& r, widget* wdg, Category**)
- : widget_ptr(wdg), other(Category::value)
+ basic_window(basic_window* parent, std::unique_ptr&& wdg_notifier, const rectangle& r, Category**)
+ : widget_notifier(std::move(wdg_notifier)), other(Category::value)
{
drawer.bind(this);
if(parent)
@@ -118,9 +113,13 @@ namespace detail
bool is_ancestor_of(const basic_window* wd) const;
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
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
bool set_events(const std::shared_ptr&) override;
@@ -151,7 +150,7 @@ namespace detail
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;
- widget* const widget_ptr;
+ std::unique_ptr widget_notifier;
struct flags_type
{
@@ -165,9 +164,10 @@ namespace detail
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.
- unsigned Reserved :20;
+ 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
+ unsigned Reserved :19;
unsigned char tab; //indicate a window that can receive the keyboard TAB
mouse_action action;
}flags;
@@ -202,7 +202,6 @@ namespace detail
std::vector effects_edge_nimbus;
basic_window* focus{nullptr};
basic_window* menubar{nullptr};
- root_context context;
bool ime_enabled{false};
#if defined(NANA_WINDOWS)
cursor running_cursor{ nana::cursor::arrow };
@@ -210,7 +209,7 @@ namespace detail
cursor state_cursor{nana::cursor::arrow};
basic_window* state_cursor_window{ nullptr };
- std::function draw_through; ///< A draw through renderer for root widgets.
+ std::function draw_through; // A draw through renderer for root widgets.
};
const category::flags category;
diff --git a/include/nana/gui/detail/bedrock.hpp b/include/nana/gui/detail/bedrock.hpp
index 1ae2a41d..91bc71ed 100644
--- a/include/nana/gui/detail/bedrock.hpp
+++ b/include/nana/gui/detail/bedrock.hpp
@@ -40,9 +40,11 @@ namespace detail
struct thread_context;
+ class flag_guard;
+
~bedrock();
void pump_event(window, bool is_modal);
- void map_thread_root_buffer(core_window_t*, bool forced);
+ void map_thread_root_buffer(core_window_t*, bool forced, const rectangle* update_area = nullptr);
static int inc_window(unsigned tid = 0);
thread_context* open_thread_context(unsigned tid = 0);
thread_context* get_thread_context(unsigned tid = 0);
diff --git a/include/nana/gui/detail/drawer.hpp b/include/nana/gui/detail/drawer.hpp
index f6948a45..dfd98e88 100644
--- a/include/nana/gui/detail/drawer.hpp
+++ b/include/nana/gui/detail/drawer.hpp
@@ -23,12 +23,18 @@ namespace nana
{
class widget;
+ namespace detail
+ {
+ class drawer;
+ }
+
class drawer_trigger
: ::nana::noncopyable, ::nana::nonmovable
{
+ friend class detail::drawer;
public:
- typedef widget& widget_reference;
- typedef paint::graphics& graph_reference;
+ using widget_reference = widget&;
+ using graph_reference = paint::graphics&;
virtual ~drawer_trigger();
virtual void attached(widget_reference, graph_reference); //none-const
@@ -40,7 +46,7 @@ namespace nana
virtual void resizing(graph_reference, const arg_resizing&);
virtual void resized(graph_reference, const arg_resized&);
virtual void move(graph_reference, const arg_move&);
- virtual void click(graph_reference, const arg_mouse&);
+ virtual void click(graph_reference, const arg_click&);
virtual void dbl_click(graph_reference, const arg_mouse&);
virtual void mouse_enter(graph_reference, const arg_mouse&);
virtual void mouse_move(graph_reference, const arg_mouse&);
@@ -56,10 +62,11 @@ namespace nana
virtual void key_release(graph_reference, const arg_keyboard&);
virtual void shortkey(graph_reference, const arg_keyboard&);
- void _m_reset_overrided();
- bool _m_overrided() const;
private:
- bool overrided_{false};
+ void _m_reset_overrided();
+ bool _m_overrided(event_code) const;
+ private:
+ unsigned overrided_{ 0xFFFFFFFF };
};
namespace detail
@@ -83,7 +90,7 @@ namespace nana
enum class method_state
{
- unknown,
+ pending,
overrided,
not_overrided
};
@@ -93,7 +100,7 @@ namespace nana
void bind(basic_window*);
void typeface_changed();
- void click(const arg_mouse&);
+ void click(const arg_click&);
void dbl_click(const arg_mouse&);
void mouse_enter(const arg_mouse&);
void mouse_move(const arg_mouse&);
@@ -110,7 +117,7 @@ namespace nana
void key_char(const arg_keyboard&);
void key_release(const arg_keyboard&);
void shortkey(const arg_keyboard&);
- void map(window, bool forced); //Copy the root buffer to screen
+ void map(window, bool forced, const rectangle* update_area = nullptr); //Copy the root buffer to screen
void refresh();
drawer_trigger* realizer() const;
void attached(widget&, drawer_trigger&);
@@ -128,31 +135,27 @@ namespace nana
template
void _m_emit(event_code evt_code, const Arg& arg, Mfptr mfptr)
{
- if (realizer_)
+ const int pos = static_cast(evt_code);
+ if (realizer_ && (method_state::not_overrided != mth_state_[pos]))
{
- const int pos = static_cast(evt_code);
- if (method_state::not_overrided != mth_state_[pos])
+ _m_bground_pre();
+
+ if (method_state::pending == mth_state_[pos])
{
- _m_bground_pre();
+ (realizer_->*mfptr)(graphics, arg);
+
+ //Check realizer, when the window is closed in that event handler, the drawer will be
+ //detached and realizer will be a nullptr
+ if(realizer_)
+ mth_state_[pos] = (realizer_->_m_overrided(evt_code) ? method_state::overrided : method_state::not_overrided);
+ }
+ else
+ (realizer_->*mfptr)(graphics, arg);
- if (method_state::unknown == mth_state_[pos])
- {
- realizer_->_m_reset_overrided();
- (realizer_->*mfptr)(graphics, arg);
-
- //Check realizer, when the window is closed in that event handler, the drawer will be
- //detached and realizer will be a nullptr
- if(realizer_)
- mth_state_[pos] = (realizer_->_m_overrided() ? method_state::overrided : method_state::not_overrided);
- }
- else
- (realizer_->*mfptr)(graphics, arg);
-
- if (_m_lazy_decleared())
- {
- _m_draw_dynamic_drawing_object();
- _m_bground_end();
- }
+ if (_m_lazy_decleared())
+ {
+ _m_draw_dynamic_drawing_object();
+ _m_bground_end();
}
}
}
diff --git a/include/nana/gui/detail/effects_renderer.hpp b/include/nana/gui/detail/effects_renderer.hpp
index 91daf849..ea2b810e 100644
--- a/include/nana/gui/detail/effects_renderer.hpp
+++ b/include/nana/gui/detail/effects_renderer.hpp
@@ -13,9 +13,9 @@ namespace nana{
{
edge_nimbus_renderer() = default;
public:
- typedef CoreWindow core_window_t;
- typedef window_layout window_layer;
- typedef nana::paint::graphics & graph_reference;
+ using core_window_t = CoreWindow;
+ using window_layer = window_layout;
+ using graph_reference = ::nana::paint::graphics&;
static edge_nimbus_renderer& instance()
{
@@ -23,37 +23,69 @@ namespace nana{
return object;
}
- std::size_t weight() const
+ unsigned weight() const
{
return 2;
}
- bool render(core_window_t * wd, bool forced)
+ void erase(core_window_t* wd)
{
- bool rendered = false;
+ if (effects::edge_nimbus::none == wd->effect.edge_nimbus)
+ return;
+
core_window_t * root_wd = wd->root_widget;
auto & nimbus = root_wd->other.attribute.root->effects_edge_nimbus;
- if(nimbus.size())
+ for (auto i = nimbus.begin(); i != nimbus.end(); ++i)
{
- core_window_t * focused = root_wd->other.attribute.root->focus;
- native_window_type native = root_wd->root;
- std::size_t pixels = weight();
+ if (i->window == wd)
+ {
+ auto pixels = weight();
+ rectangle r{wd->pos_root, wd->dimension};
+ r.x -= static_cast(pixels);
+ r.y -= static_cast(pixels);
+ r.width += static_cast(pixels << 1);
+ r.height += static_cast(pixels << 1);
+
+ root_wd->root_graph->paste(root_wd->root, r, r.x, r.y);
+
+ nimbus.erase(i);
+ break;
+ }
+ }
+ }
+
+ void render(core_window_t * wd, bool forced, const rectangle* update_area = nullptr)
+ {
+ bool copy_separately = true;
+ std::vector> rd_set;
+
+ if (wd->root_widget->other.attribute.root->effects_edge_nimbus.size())
+ {
+ auto root_wd = wd->root_widget;
+
+ auto & nimbus = root_wd->other.attribute.root->effects_edge_nimbus;
+
+ auto focused = root_wd->other.attribute.root->focus;
+
+ const unsigned pixels = weight();
auto graph = root_wd->root_graph;
- std::vector erase;
- std::vector> rd_set;
nana::rectangle r;
for(auto & action : nimbus)
{
if(_m_edge_nimbus(focused, action.window) && window_layer::read_visual_rectangle(action.window, r))
{
- if(action.window == wd)
- rendered = true;
+ if (action.window == wd)
+ {
+ if (update_area)
+ ::nana::overlap(*update_area, rectangle(r), r);
+ copy_separately = false;
+ }
//Avoiding duplicated rendering. If the window is declared to lazy refresh, it should be rendered.
- if ((forced && (action.window == wd)) || !action.rendered || (action.window->other.upd_state == core_window_t::update_state::refresh))
+ if ((forced && (action.window == wd)) || (focused == action.window) || !action.rendered || (action.window->other.upd_state == core_window_t::update_state::refresh))
{
rd_set.emplace_back(r, action.window);
action.rendered = true;
@@ -62,29 +94,36 @@ namespace nana{
else if(action.rendered)
{
action.rendered = false;
- erase.push_back(action.window);
+
+ if (action.window == wd)
+ copy_separately = false;
+
+ ::nana::rectangle erase_r(
+ action.window->pos_root.x - static_cast(pixels),
+ action.window->pos_root.y - static_cast(pixels),
+ static_cast(action.window->dimension.width + (pixels << 1)),
+ static_cast(action.window->dimension.height + (pixels << 1))
+ );
+
+ graph->paste(root_wd->root, erase_r, erase_r.x, erase_r.y);
}
}
-
- //Erase
- for(auto el : erase)
- {
- if(el == wd)
- rendered = true;
-
- r.x = el->pos_root.x - static_cast(pixels);
- r.y = el->pos_root.y - static_cast(pixels);
- r.width = static_cast(el->dimension.width + (pixels << 1));
- r.height = static_cast(el->dimension.height + (pixels << 1));
-
- graph->paste(native, r, r.x, r.y);
- }
-
- //Render
- for (auto & rd : rd_set)
- _m_render_edge_nimbus(rd.second, rd.first);
}
- return rendered;
+
+ if (copy_separately)
+ {
+ rectangle vr;
+ if (window_layer::read_visual_rectangle(wd, vr))
+ {
+ if (update_area)
+ ::nana::overlap(*update_area, rectangle(vr), vr);
+ wd->root_graph->paste(wd->root, vr, vr.x, vr.y);
+ }
+ }
+
+ //Render
+ for (auto & rd : rd_set)
+ _m_render_edge_nimbus(rd.second, rd.first);
}
private:
static bool _m_edge_nimbus(core_window_t * focused_wd, core_window_t * wd)
@@ -98,13 +137,13 @@ namespace nana{
void _m_render_edge_nimbus(core_window_t* wd, const nana::rectangle & visual)
{
- nana::rectangle r(visual);
+ auto r = visual;
r.pare_off(-static_cast(weight()));
- nana::rectangle good_r;
- if(overlap(r, wd->root_graph->size(), good_r))
+ rectangle good_r;
+ if (overlap(r, rectangle{ wd->root_graph->size() }, good_r))
{
- if( (good_r.x < wd->pos_root.x) || (good_r.y < wd->pos_root.y) ||
- (good_r.x + good_r.width > visual.x + visual.width) || (good_r.y + good_r.height > visual.y + visual.height))
+ if ((good_r.x < wd->pos_root.x) || (good_r.y < wd->pos_root.y) ||
+ (good_r.right() > visual.right()) || (good_r.bottom() > visual.bottom()))
{
auto graph = wd->root_graph;
nana::paint::pixel_buffer pixbuf(graph->handle(), r);
@@ -131,7 +170,7 @@ namespace nana{
pixbuf.pixel(0, r.height - 1, px2);
pixbuf.pixel(r.width - 1, r.height - 1, px3);
- pixbuf.paste(wd->root, r.x, r.y);
+ pixbuf.paste(wd->root, { r.x, r.y });
std::vector overlaps;
if(window_layer::read_overlaps(wd, visual, overlaps))
diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp
index 1a4bf972..cdb6ac3a 100644
--- a/include/nana/gui/detail/general_events.hpp
+++ b/include/nana/gui/detail/general_events.hpp
@@ -46,7 +46,7 @@ namespace nana
class event_arg
{
public:
- virtual ~event_arg();
+ virtual ~event_arg() = default;
/// ignorable handlers behind the current one in a chain of event handlers will not get called.
void stop_propagation() const;
@@ -425,11 +425,19 @@ namespace nana
event_code evt_code; ///<
::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
+
bool left_button; ///< mouse left button is pressed?
bool mid_button; ///< mouse middle button is pressed?
bool right_button; ///< mouse right button is pressed?
bool shift; ///< keyboard Shift is pressed?
bool ctrl; ///< keyboard Ctrl is pressed?
+
+ /// Checks if left button is operated,
+ bool is_left_button() const
+ {
+ return (event_code::mouse_move == evt_code ? left_button : (mouse::left_button == button));
+ }
};
/// in arg_wheel event_code is event_code::mouse_wheel
@@ -510,31 +518,37 @@ namespace nana
::nana::window window_handle; ///< A handle to the event window
};
+ struct arg_click : public event_arg
+ {
+ ::nana::window window_handle; ///< A handle to the event window
+ bool by_mouse; ///< Determines whether the event is emitted by clicking mouse button
+ };
+
/// provides some fundamental events that every widget owns.
struct general_events
{
virtual ~general_events(){}
- basic_event mouse_enter; ///< the cursor enters the window
- basic_event mouse_move; ///< the cursor moves on the window
- basic_event mouse_leave; ///< the cursor leaves the window
- basic_event mouse_down; ///< the user presses the mouse button
- basic_event mouse_up; ///< the user presses the mouse button
- basic_event click; ///< the window is clicked, but occurs after mouse_down and before mouse_up
- basic_event dbl_click; ///< the window is double clicked
- basic_event mouse_wheel; ///< the mouse wheel rotates while the window has focus
+ basic_event mouse_enter; ///< the cursor enters the window
+ basic_event mouse_move; ///< the cursor moves on the window
+ basic_event mouse_leave; ///< the cursor leaves the window
+ basic_event mouse_down; ///< the user presses the mouse button
+ basic_event mouse_up; ///< the user presses the mouse button
+ basic_event click; ///< the window is clicked, but occurs after mouse_down and before mouse_up
+ basic_event dbl_click; ///< the window is double clicked
+ basic_event mouse_wheel; ///< the mouse wheel rotates while the window has focus
basic_event mouse_dropfiles; ///< the mouse drops some external data while the window enable accepting files
- basic_event expose; ///< the visibility changes
- basic_event focus; ///< the window receives or loses keyboard focus
+ basic_event expose; ///< the visibility changes
+ basic_event focus; ///< the window receives or loses keyboard focus
basic_event key_press; ///< a key is pressed while the window has focus. event code is event_code::key_press
basic_event key_release; ///< a key is released while the window has focus. event code is event_code::key_release
- basic_event key_char; ///< a character, whitespace or backspace is pressed. event code is event_code::key_char
- basic_event shortkey; ///< a defined short key is pressed. event code is event_code::shortkey
+ basic_event key_char; ///< a character, whitespace or backspace is pressed. event code is event_code::key_char
+ basic_event shortkey; ///< a defined short key is pressed. event code is event_code::shortkey
- basic_event move; ///< the window changes position
- basic_event resizing; ///< the window is changing its size
- basic_event resized; ///< the window is changing its size
+ basic_event move; ///< the window changes position
+ basic_event resizing; ///< the window is changing its size
+ basic_event resized; ///< the window is changing its size
- basic_event destroy; ///< the window is destroyed, but occurs when all children have been destroyed
+ basic_event destroy; ///< the window is destroyed, but occurs when all children have been destroyed
};
namespace detail
diff --git a/include/nana/gui/detail/inner_fwd.hpp b/include/nana/gui/detail/inner_fwd.hpp
index 00a1f24e..ffe18a52 100644
--- a/include/nana/gui/detail/inner_fwd.hpp
+++ b/include/nana/gui/detail/inner_fwd.hpp
@@ -1,7 +1,7 @@
/*
* Inner Forward Declaration
* Nana C++ Library(http://www.nanapro.org)
-* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
+* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -19,37 +19,6 @@
namespace nana{
namespace detail
{
- struct signals
- {
- enum class code
- {
- caption,
- read_caption,
- destroy,
- size,
- end
- };
-
- union
- {
- const nana::char_t* caption;
- nana::string * str;
- struct
- {
- unsigned width;
- unsigned height;
- }size;
- }info;
- };
-
- class signal_invoker_interface
- {
- public:
- virtual ~signal_invoker_interface()
- {}
-
- virtual void call_signal(signals::code, const signals&) = 0;
- };
}
}
#endif //NANA_GUI_INNER_FWD_HPP
diff --git a/include/nana/gui/detail/inner_fwd_implement.hpp b/include/nana/gui/detail/inner_fwd_implement.hpp
index 5384aec4..e420c554 100644
--- a/include/nana/gui/detail/inner_fwd_implement.hpp
+++ b/include/nana/gui/detail/inner_fwd_implement.hpp
@@ -121,7 +121,6 @@ namespace nana{
{
core_window_t* pressed{nullptr}; //The handle to a window which is being pressed
core_window_t* hovered{nullptr}; //the latest window that mouse moved
- bool tabstop_focus_changed{false}; //KeyDown may set it true, if it is true KeyChar will ignore the message
}condition;
root_misc(core_window_t * wd, unsigned width, unsigned height)
@@ -170,34 +169,6 @@ namespace nana{
std::map table_;
};
-
-
- class signal_manager
- {
- typedef basic_window core_window_t;
- public:
- void make(core_window_t* wd, signal_invoker_interface* si)
- {
- if (si)
- table_[wd].reset(si);
- else
- table_.erase(wd);
- }
-
- void umake(core_window_t * wd)
- {
- table_.erase(wd);
- }
-
- void call_signal(core_window_t * wd, signals::code code, const signals& s)
- {
- auto i = table_.find(wd);
- if (i != table_.end())
- i->second->call_signal(code, s);
- }
- private:
- std::map> table_;
- };
}
}//end namespace nana
#endif //NANA_GUI_INNER_FWD_IMPLEMENT_HPP
diff --git a/include/nana/gui/detail/native_window_interface.hpp b/include/nana/gui/detail/native_window_interface.hpp
index 39cd7c49..5db4a645 100644
--- a/include/nana/gui/detail/native_window_interface.hpp
+++ b/include/nana/gui/detail/native_window_interface.hpp
@@ -44,7 +44,8 @@ namespace detail
#endif
static void enable_dropfiles(native_window_type, bool);
static void enable_window(native_window_type, bool);
- static bool window_icon(native_window_type, const paint::image&);
+ // (On Windows) The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.
+ static bool window_icon(native_window_type, const paint::image& big_icon, const paint::image& small_icon);
static void activate_owner(native_window_type);
static void activate_window(native_window_type);
static void close_window(native_window_type);
diff --git a/include/nana/gui/detail/widget_notifier_interface.hpp b/include/nana/gui/detail/widget_notifier_interface.hpp
new file mode 100644
index 00000000..204bdeea
--- /dev/null
+++ b/include/nana/gui/detail/widget_notifier_interface.hpp
@@ -0,0 +1,39 @@
+/*
+ * Widget Notifier Interface
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 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/detail/widget_notifier_interface.hpp
+ */
+
+#ifndef NANA_GUI_DETAIL_WIDGET_NOTIFIER_INTERFACE_HEADER
+#define NANA_GUI_DETAIL_WIDGET_NOTIFIER_INTERFACE_HEADER
+#include
+#include
+
+namespace nana
+{
+ class widget; //forward declaration
+
+ namespace detail
+ {
+ class widget_notifier_interface
+ {
+ public:
+ virtual ~widget_notifier_interface() = default;
+
+ static std::unique_ptr get_notifier(widget*); //defined in nana/gui/widgets/widget.cpp
+
+ virtual widget* widget_ptr() const = 0;
+ virtual void destroy() = 0;
+ virtual std::wstring caption() = 0;
+ virtual void caption(std::wstring) = 0;
+ };
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/include/nana/gui/detail/window_manager.hpp b/include/nana/gui/detail/window_manager.hpp
index 37c9c150..ec91fe1f 100644
--- a/include/nana/gui/detail/window_manager.hpp
+++ b/include/nana/gui/detail/window_manager.hpp
@@ -42,24 +42,7 @@ namespace nana
namespace nana{
namespace detail
{
- template
- class signal_invoker_mf
- : public signal_invoker_interface
- {
- public:
- signal_invoker_mf(T& obj, void(T::*mf)(signals::code, const signals&))
- : obj_(obj),
- mf_(mf)
- {}
-
- void call_signal(signals::code code, const signals& s) override
- {
- (obj_.*mf_)(code, s);
- }
- private:
- T& obj_;
- void(T::*mf_)(signals::code, const signals&);
- };
+ class widget_notifier_interface; //forward declaration
struct root_misc;
@@ -87,13 +70,11 @@ namespace detail
std::vector stack_;
};
public:
- typedef native_window_type native_window;
- typedef revertible_mutex mutex_type;
+ using native_window = native_window_type;
+ using mutex_type = revertible_mutex;
- typedef basic_window core_window_t;
- typedef std::vector cont_type;
-
- typedef window_layout wndlayout_type;
+ using core_window_t = basic_window;
+ using window_layer = window_layout;
window_manager();
~window_manager();
@@ -103,16 +84,7 @@ namespace detail
mutex_type & internal_lock() const;
void all_handles(std::vector&) const;
- template
- void attach_signal(core_window_t* wd, T& obj, void(Concept::*mf)(signals::code, const signals&))
- {
- return _m_attach_signal(wd, new signal_invoker_mf(obj, mf));
- }
-
- void signal_fire_caption(core_window_t*, const nana::char_t*);
- nana::string signal_fire_caption(core_window_t*);
void event_filter(core_window_t*, bool is_make, event_code);
- void default_icon(const nana::paint::image&);
bool available(core_window_t*);
bool available(core_window_t *, core_window_t*);
@@ -121,6 +93,7 @@ namespace detail
core_window_t* create_root(core_window_t*, bool nested, rectangle, const appearance&, widget*);
core_window_t* create_widget(core_window_t*, const rectangle&, bool is_lite, widget*);
core_window_t* create_frame(core_window_t*, const rectangle&, widget*);
+
bool insert_frame(core_window_t* frame, native_window);
bool insert_frame(core_window_t* frame, core_window_t*);
void close(core_window_t*);
@@ -133,7 +106,8 @@ namespace detail
//@brief: Delete window handle, the handle type must be a root and a frame.
void destroy_handle(core_window_t*);
- void icon(core_window_t*, const paint::image&);
+ void default_icon(const paint::image& small_icon, const paint::image& big_icon);
+ void icon(core_window_t*, const paint::image& small_icon, const paint::image& big_icon);
//show
//@brief: show or hide a window
@@ -150,9 +124,9 @@ namespace detail
core_window_t* root(native_window_type) const;
//Copy the root buffer that wnd specified into DeviceContext
- void map(core_window_t*, bool forced);
+ void map(core_window_t*, bool forced, const rectangle* update_area = nullptr);
- bool update(core_window_t*, bool redraw, bool force);
+ 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);
@@ -188,7 +162,6 @@ namespace detail
core_window_t* find_shortkey(native_window_type, unsigned long key);
private:
- void _m_attach_signal(core_window_t*, signal_invoker_interface*);
void _m_disengage(core_window_t*, core_window_t* for_new);
void _m_destroy(core_window_t*);
void _m_move_core(core_window_t*, const point& delta);
@@ -200,8 +173,6 @@ namespace detail
struct wdm_private_impl;
wdm_private_impl * const impl_;
- signals signals_;
-
struct attribute
{
struct captured
diff --git a/include/nana/gui/layout_utility.hpp b/include/nana/gui/layout_utility.hpp
index fae4f4c9..51d4d4ea 100644
--- a/include/nana/gui/layout_utility.hpp
+++ b/include/nana/gui/layout_utility.hpp
@@ -1,14 +1,13 @@
/*
* Utility Implementation
- * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 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/layout_utility.hpp
- *
- *
*/
#ifndef NANA_GUI_LAYOUT_UTILITY_HPP
diff --git a/include/nana/gui/programming_interface.hpp b/include/nana/gui/programming_interface.hpp
index c2430ccd..167fd8d8 100644
--- a/include/nana/gui/programming_interface.hpp
+++ b/include/nana/gui/programming_interface.hpp
@@ -48,13 +48,6 @@ namespace API
//@brief: The interfaces defined in namespace dev are used for developing the nana.gui
namespace dev
{
- template
- void attach_signal(window wd, Object& object, void (Concept::*f)(::nana::detail::signals::code, const ::nana::detail::signals&))
- {
- using namespace ::nana::detail;
- bedrock::instance().wd_manager.attach_signal(reinterpret_cast(wd), object, f);
- }
-
bool set_events(window, const std::shared_ptr&);
template
@@ -68,7 +61,7 @@ namespace API
widget_colors* get_scheme(window);
void attach_drawer(widget&, drawer_trigger&);
- nana::string window_caption(window);
+ nana::string window_caption(window) throw();
void window_caption(window, nana::string);
window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached);
@@ -119,10 +112,12 @@ namespace API
}
}
- void window_icon_default(const paint::image&);
- void window_icon(window, const paint::image&);
+ void window_icon_default(const paint::image& small_icon, const paint::image& big_icon = {});
+ void window_icon(window, const paint::image& small_icon, const paint::image& big_icon = {});
+
bool empty_window(window); ///< Determines whether a window is existing.
bool is_window(window); ///< Determines whether a window is existing, equal to !empty_window.
+ bool is_destroying(window); ///< Determines whether a window is destroying
void enable_dropfiles(window, bool);
/// \brief Retrieves the native window of a Nana.GUI window.
@@ -300,6 +295,9 @@ namespace API
nana::mouse_action mouse_action(window);
nana::element_state element_state(window);
+
+ bool ignore_mouse_focus(window, bool ignore); ///< Enables/disables the mouse focus, it returns the previous state
+ bool ignore_mouse_focus(window); ///< Determines whether the mouse focus is enabled
}//end namespace API
}//end namespace nana
diff --git a/include/nana/gui/screen.hpp b/include/nana/gui/screen.hpp
index ef9126e8..06c344ee 100644
--- a/include/nana/gui/screen.hpp
+++ b/include/nana/gui/screen.hpp
@@ -34,27 +34,38 @@ namespace nana
virtual const ::nana::rectangle& workarea() const = 0;
};
+ /// Provides some functions to get the metrics of the monitors \include screen.cpp
class screen
{
struct implement;
public:
- static ::nana::size desktop_size();
- static ::nana::size primary_monitor_size();
+ /// gets the size in pixel of the whole virtual desktop
+ static ::nana::size desktop_size();
+
+ /// gets the resolution in pixel of the primary monitor,
+ /// if there is only one monitor installed in the system,
+ /// the return value of primary_monitor_size is equal to desktop_size's.
+ static ::nana::size primary_monitor_size();
+
screen();
/// Reload has no preconditions, it's safe to call on moved-from
void reload();
- /// Returns the number of display monitors
+ /// Returns the number of display monitors installed in the system
std::size_t count() const;
+ /// gets the display monitor that contains the specified point
display& from_point(const point&);
+
+ /// gets the display monitor that contains the specified window
display& from_window(window);
display& get_display(std::size_t index) const;
display& get_primary() const;
+ /// applies a given function to all display monitors
void for_each(std::function) const;
private:
std::shared_ptr impl_;
diff --git a/include/nana/gui/widgets/button.hpp b/include/nana/gui/widgets/button.hpp
index e57f3b12..3c0eaf7d 100644
--- a/include/nana/gui/widgets/button.hpp
+++ b/include/nana/gui/widgets/button.hpp
@@ -15,7 +15,6 @@
#include "widget.hpp"
#include
-
namespace nana{
namespace drawerbase
{
@@ -46,12 +45,13 @@ namespace nana{
void mouse_up(graph_reference, const arg_mouse&) override;
void key_char(graph_reference, const arg_keyboard&) override;
void key_press(graph_reference, const arg_keyboard&) override;
+ void key_release(graph_reference, const arg_keyboard&) override;
void focus(graph_reference, const arg_focus&) override;
private:
- void _m_draw(graph_reference);
void _m_draw_title(graph_reference, bool enabled);
void _m_draw_background(graph_reference);
void _m_draw_border(graph_reference);
+ void _m_press(graph_reference, bool);
private:
widget* wdg_{nullptr};
paint::graphics* graph_{nullptr};
@@ -101,8 +101,6 @@ namespace nana{
bool transparent() const;
button& edge_effects(bool enable);
- private:
- void _m_shortkey();
private:
//Overrides widget virtual functions
void _m_complete_creation() override;
diff --git a/include/nana/gui/widgets/checkbox.hpp b/include/nana/gui/widgets/checkbox.hpp
index 22f87fff..c0ebee4f 100644
--- a/include/nana/gui/widgets/checkbox.hpp
+++ b/include/nana/gui/widgets/checkbox.hpp
@@ -37,7 +37,6 @@ namespace drawerbase
public:
implement * impl() const;
private:
- void _m_draw(graph_reference);
void _m_draw_background(graph_reference);
void _m_draw_checkbox(graph_reference, unsigned first_line_height);
void _m_draw_title(graph_reference);
@@ -89,7 +88,7 @@ namespace drawerbase
std::size_t checked() const; ///< Retrieves the index of the checkbox which is checked.
std::size_t size() const;
private:
- void _m_checked(const arg_mouse&);
+ void _m_checked(const arg_click&);
void _m_destroy(const arg_destroy&);
private:
std::vector ui_container_;
diff --git a/include/nana/gui/widgets/combox.hpp b/include/nana/gui/widgets/combox.hpp
index 16b22faf..beb1cece 100644
--- a/include/nana/gui/widgets/combox.hpp
+++ b/include/nana/gui/widgets/combox.hpp
@@ -3,8 +3,8 @@
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE_1_0.txt or copy at
+ * 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/widgets/combox.hpp
@@ -43,7 +43,7 @@ namespace nana
};
class drawer_impl;
-
+
class trigger
: public drawer_trigger
{
@@ -101,7 +101,7 @@ namespace nana
throw std::runtime_error("combox::item_proxy.value() invalid type of value");
return *p;
}
-
+
template
item_proxy& value(const T& t)
{
@@ -169,7 +169,7 @@ namespace nana
combox(window, nana::string, bool visible = true);
combox(window, const nana::char_t*, bool visible = true);
combox(window, const rectangle& r = rectangle(), bool visible = true);
-
+
void clear();
void editable(bool);
bool editable() const;
@@ -209,8 +209,8 @@ namespace nana
_m_erase(p.get());
}
- /// \brief Set user-defined item renderer object.
- /// It is an address therefore the user should not destroy the renderer object
+ /// \brief Set user-defined item renderer object.
+ /// It is an address therefore the user should not destroy the renderer object
/// after it is set to the combox. Passing null_ptr cancels the user-defined renderer object.
void renderer(item_renderer*);
@@ -224,7 +224,7 @@ namespace nana
const drawerbase::combox::drawer_impl& _m_impl() const;
private:
//Overrides widget's virtual functions
- nana::string _m_caption() const override;
+ nana::string _m_caption() const throw() override;
void _m_caption(nana::string&&) override;
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
};
diff --git a/include/nana/gui/widgets/date_chooser.hpp b/include/nana/gui/widgets/date_chooser.hpp
index 9fc0ca8d..9a168bfb 100644
--- a/include/nana/gui/widgets/date_chooser.hpp
+++ b/include/nana/gui/widgets/date_chooser.hpp
@@ -45,7 +45,6 @@ namespace nana
void week_name(unsigned index, const nana::string&);
private:
where _m_pos_where(graph_reference, const ::nana::point& pos);
- void _m_draw(graph_reference);
void _m_draw_topbar(graph_reference);
void _m_make_drawing_basis(drawing_basis&, graph_reference, const nana::point& refpos);
void _m_draw_pos(drawing_basis &, graph_reference, int x, int y, const nana::string&, bool primary, bool sel);
diff --git a/include/nana/gui/widgets/detail/inline_widget.hpp b/include/nana/gui/widgets/detail/inline_widget.hpp
new file mode 100644
index 00000000..6b40c7e3
--- /dev/null
+++ b/include/nana/gui/widgets/detail/inline_widget.hpp
@@ -0,0 +1,85 @@
+/**
+ * A Inline Widget Interface Definition
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 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/widgets/detail/inline_widget.hpp
+ *
+ */
+
+#ifndef NANA_GUI_INLINE_WIDGETS_HPP
+#define NANA_GUI_INLINE_WIDGETS_HPP
+#include "../../basis.hpp"
+
+namespace nana
+{
+ namespace detail
+ {
+ template
+ class inline_widget_indicator
+ {
+ public:
+ /// A type to index a item
+ using index_type = Index;
+
+ /// A type to the value of the item
+ using value_type = Value;
+
+ /// The destructor
+ virtual ~inline_widget_indicator() = default;
+
+ /// Returns the host widget of the indicator
+ virtual ::nana::widget& host() const = 0;
+
+ /// Modifies the value of a item specified by pos
+ virtual void modify(index_type pos, const value_type&) const = 0;
+
+ /// Sends a signal that a specified item is selected
+ virtual void selected(index_type) = 0;
+
+ /// Sends a signal that a specified item is hovered
+ virtual void hovered(index_type) = 0;
+ };
+
+ template
+ class inline_widget_notifier_interface
+ {
+ public:
+ /// A type to index a item
+ using index_type = Index;
+
+ /// A type to the value of the item
+ using value_type = Value;
+
+ /// A typedef name of a inline widget indicator
+ using inline_indicator = inline_widget_indicator;
+
+ /// A type to the notifier interface that will be refered by the abstract factory pattern
+ using factory_interface = inline_widget_notifier_interface;
+
+ /// The destructor
+ virtual ~inline_widget_notifier_interface() = default;
+
+ /// A message to create the inline widget
+ virtual void create(window) = 0;
+
+ /// A message to activate the inline widget to attach a specified item
+ virtual void activate(inline_indicator&, index_type) = 0;
+
+ /// A message to resize the inline widget
+ virtual void resize(const size&) = 0;
+
+ /// A message to set the value from the item
+ virtual void set(const value_type&) = 0;
+
+ /// Determines whether to draw the background of the widget
+ virtual bool whether_to_draw() const = 0;
+ }; //end class inline_widget_notifier_interface
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/include/nana/gui/widgets/detail/inline_widget_manager.hpp b/include/nana/gui/widgets/detail/inline_widget_manager.hpp
new file mode 100644
index 00000000..ef5ec65b
--- /dev/null
+++ b/include/nana/gui/widgets/detail/inline_widget_manager.hpp
@@ -0,0 +1,89 @@
+/**
+ * A Inline Widget Manager Implementation
+ * Nana C++ Library(http://www.nanapro.org)
+ * Copyright(C) 2003-2015 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/widgets/detail/inline_widget_manager.hpp
+ *
+ */
+
+#ifndef NANA_GUI_INLINE_WIDGET_MANAGER_HPP
+#define NANA_GUI_INLINE_WIDGET_MANAGER_HPP
+#include "inline_widget.hpp"
+#include
+#include "../panel.hpp"
+
+#include
+
+namespace nana
+{
+ namespace detail
+ {
+
+ template
+ class inline_widget_manager
+ {
+ using index_type = Index;
+ using value_type = Value;
+ using indicator_type = inline_widget_indicator;
+ using inline_widget = inline_widget_interface;
+ using factory = pat::abstract_factory;
+
+ struct widget_holder
+ {
+ panel docker;
+ std::unique_ptr widget_ptr;
+ };
+ public:
+ void set_window(window wd)
+ {
+ window_handle_ = wd;
+ }
+
+ void set_factory(std::unique_ptr fac)
+ {
+ factory_.swap(fac);
+ }
+
+ void place(point pos, const size& dimension, const size & visible_size, const indicator_type& indicator, index_type index)
+ {
+ auto holder = _m_append();
+ holder->docker.move({ pos, visible_size });
+ holder->widget_ptr->move({ point(), dimension });
+
+ holder->widget_ptr->activate(indicator, index);
+ }
+ private:
+ widget_holder* _m_append()
+ {
+ if (swap_widgets_.empty())
+ {
+ widgets_.emplace_back();
+ widgets_.back().swap(swap_widgets_.back());
+ swap_widgets_.pop_back();
+ }
+ else
+ {
+
+ widgets_.emplace_back(new widget_holder);
+ auto & holder = widgets_.back();
+ holder->docker.create(window_handle_, false);
+ holder->widget_ptr.swap(factory_->create());
+ holder->widget_ptr->create(holder->docker->handle());
+ }
+ return widgets_.back().get();
+ }
+ private:
+ window window_handle_{nullptr};
+ std::unique_ptr factory_;
+ std::vector> widgets_;
+ std::vector> swap_widgets_;
+ };
+ }
+}
+
+#endif
diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp
new file mode 100644
index 00000000..82f34a5b
--- /dev/null
+++ b/include/nana/gui/widgets/group.hpp
@@ -0,0 +1,87 @@
+/**
+ * A group widget implementation
+ * Nana C++ Library(http://www.nanaro.org)
+ * Copyright(C) 2015 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/widgets/group.hpp
+ *
+ * @Author: Stefan Pfeifer(st-321), Ariel Vina-Rodriguez (qPCR4vir)
+ *
+ * @brief group is a widget used to visually group and layout other widgets.
+ */
+
+#ifndef NANA_GUI_WIDGETS_GROUP_HPP
+#define NANA_GUI_WIDGETS_GROUP_HPP
+
+#include
+#include
+
+namespace nana{
+ class group
+ : public panel
+ {
+ struct implement;
+ public:
+ using field_reference = place::field_reference;
+
+ /// The default construction
+ group();
+
+ /// The construction that creates the widget
+ group(window parent, const rectangle& = {}, bool visible = true);
+
+ /// The construction that creates the widget and set the titel or caption
+
+ group(window parent, ///< a handle to the parent
+ ::nana::string titel, ///< caption of the group
+ bool formatted = false, ///< Enable/disable the formatted text for the title
+ unsigned gap = 2, ///< betwen the content and the external limit
+ const rectangle& r = {} ,
+ bool visible = true
+ );
+
+
+ /// The destruction
+ ~group();
+
+ /// Adds an option for user selection
+ group& add_option(::nana::string);
+
+ /// Enables/disables the radio mode which is single selection
+ group& radio_mode(bool);
+
+ /// Returns the index of option in radio_mode, it throws a logic_error if radio_mode is false.
+ std::size_t option() const;
+
+ /// Determines whether a specified option is checked, it throws an out_of_range if !(pos < number of options)
+ bool option_checked(std::size_t pos) const;
+
+ group& enable_format_caption(bool format);
+
+ group& collocate() throw();
+ group& div(const char* div_str) throw();
+ field_reference operator[](const char* field);
+
+ template
+ Widget* create_child(const char* field, Args && ... args)
+ {
+ auto wdg = new Widget(handle(), std::forward(args)...);
+ _m_add_child(field, wdg);
+ return wdg;
+ }
+ private:
+ void _m_add_child(const char* field, widget*);
+ void _m_init();
+ void _m_complete_creation() override;
+ ::nana::string _m_caption() const throw() override;
+ void _m_caption(::nana::string&&) override;
+ private:
+ std::unique_ptr impl_;
+ };
+
+}//end namespace nana
+#endif
diff --git a/include/nana/gui/widgets/label.hpp b/include/nana/gui/widgets/label.hpp
index ba6a5cf0..6d72cd4e 100644
--- a/include/nana/gui/widgets/label.hpp
+++ b/include/nana/gui/widgets/label.hpp
@@ -40,7 +40,7 @@ namespace nana
void refresh(graph_reference) override;
void mouse_move(graph_reference, const arg_mouse&) override;
void mouse_leave(graph_reference, const arg_mouse&) override;
- void click(graph_reference, const arg_mouse&) override;
+ void click(graph_reference, const arg_click&) override;
private:
impl_t * impl_;
};
@@ -58,14 +58,15 @@ namespace nana
label();
label(window, bool visible);
label(window, const nana::string& text, bool visible = true);
- label(window, const nana::char_t* text, bool visible = true);
label(window, const rectangle& = {}, bool visible = true);
label& transparent(bool); ///< Switchs the label widget to the transparent background mode.
- bool transparent() const;
+ bool transparent() const throw();
label& format(bool); ///< Switches the format mode of the widget.
label& add_format_listener(std::function);
- /// \briefReturn the size of the text. If *allowed_width_in_pixel* is not zero, returns a
+ label& click_for(window associated_window) throw(); // as same as the "for" attribute of a label
+
+ /// Returns the size of the text. If *allowed_width_in_pixel* is not zero, returns a
/// "corrected" size that changes lines to fit the text into the specified width
nana::size measure(unsigned allowed_width_in_pixel) const;
diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp
index 8a2f1938..3661b8a3 100644
--- a/include/nana/gui/widgets/listbox.hpp
+++ b/include/nana/gui/widgets/listbox.hpp
@@ -15,9 +15,10 @@
#ifndef NANA_GUI_WIDGETS_LISTBOX_HPP
#define NANA_GUI_WIDGETS_LISTBOX_HPP
#include "widget.hpp"
+#include "detail/inline_widget.hpp"
+#include
#include
#include
-//#include
#include
#include
@@ -29,7 +30,58 @@ namespace nana
{
namespace listbox
{
- using size_type = std::size_t ;
+ using size_type = std::size_t;
+
+ /// usefull for both absolute and display (sorted) positions
+ struct index_pair
+ {
+ size_type cat; //The pos of category
+ size_type item; //the pos of item in a category.
+
+ index_pair(size_type cat_pos = 0, size_type item_pos = 0)
+ : cat(cat_pos),
+ item(item_pos)
+ {}
+
+ bool empty() const
+ {
+ return (npos == cat);
+ }
+
+ void set_both(size_type n)
+ {
+ cat = item = n;
+ }
+
+ bool is_category() const
+ {
+ return (npos != cat && npos == item);
+ }
+
+ bool is_item() const
+ {
+ return (npos != cat && npos != item);
+ }
+
+ bool operator==(const index_pair& r) const
+ {
+ return (r.cat == cat && r.item == item);
+ }
+
+ bool operator!=(const index_pair& r) const
+ {
+ return !this->operator==(r);
+ }
+
+ bool operator>(const index_pair& r) const
+ {
+ return (cat > r.cat) || (cat == r.cat && item > r.item);
+ }
+ };
+
+ using selection = std::vector;
+
+ using inline_notifier_interface = detail::inline_widget_notifier_interface;
struct cell
{
@@ -114,58 +166,13 @@ namespace nana
std::size_t pos_{0};
};
- /// usefull for both absolute and display (sorted) positions
- struct index_pair
- {
- size_type cat; //The pos of category
- size_type item; //the pos of item in a category.
- index_pair(size_type cat_pos = 0, size_type item_pos = 0)
- : cat(cat_pos),
- item(item_pos)
- {}
-
- bool empty() const
- {
- return (npos == cat);
- }
-
- void set_both(size_type n)
- {
- cat = item = n;
- }
-
- bool is_category() const
- {
- return (npos != cat && npos == item);
- }
-
- bool is_item() const
- {
- return (npos != cat && npos != item);
- }
-
- bool operator==(const index_pair& r) const
- {
- return (r.cat == cat && r.item == item);
- }
-
- bool operator!=(const index_pair& r) const
- {
- return !this->operator==(r);
- }
-
- bool operator>(const index_pair& r) const
- {
- return (cat > r.cat) || (cat == r.cat && item > r.item);
- }
- };
typedef std::vector selection;
- //struct essence_t
- //@brief: this struct gives many data for listbox,
- // the state of the struct does not effect on member funcions, therefore all data members are public.
+ /// struct essence_t
+ ///@brief: this struct gives many data for listbox,
+ /// the state of the struct does not effect on member funcions, therefore all data members are public.
struct essence_t;
struct category_t;
@@ -344,6 +351,8 @@ namespace nana
: public std::iterator < std::input_iterator_tag, cat_proxy >
{
public:
+ using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;
+
cat_proxy() = default;
cat_proxy(essence_t*, size_type pos);
cat_proxy(essence_t*, category_t*);
@@ -366,13 +375,17 @@ namespace nana
return iter;
}
- void append(std::initializer_list);
+ /// Appends one item at the end of this category with the specifies text in the column fields
+ void append(std::initializer_list);
size_type columns() const;
cat_proxy& text(nana::string);
nana::string text() const;
+ cat_proxy & select(bool);
+ bool selected() const;
+
/// Behavior of a container
void push_back(nana::string);
@@ -423,6 +436,8 @@ namespace nana
/// Behavior of Iterator
bool operator!=(const cat_proxy&) const;
+
+ void inline_factory(size_type column, pat::cloneable> factory);
private:
void _m_append(std::vector && cells);
void _m_cat_by_pos();
@@ -473,16 +488,54 @@ namespace nana
color_proxy header_grabbed{ static_cast(0x8BD6F6)};
color_proxy header_floated{ static_cast(0xBABBBC)};
color_proxy item_selected{ static_cast(0xD5EFFC) };
+
+ unsigned max_header_width{3000}, /// \todo how to implement some geometrical parameters ??
+ ext_w = 5;
};
}
}//end namespace drawerbase
-/*! \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.
+/*! \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.
-The user can \a drag the header to \a reisize it or to \a reorganize it.
-By \a clicking on a header the list get \a reordered, first up, and then down alternatively.
+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.
+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)
+ A simple example.
+ bool sort_compare( const nana::string& s1, nana::any*,
+ const nana::string& s2, nana::any*, bool reverse)
+ {
+ return (reverse ? s1 > s2 : s1 < s2);
+ }
+ listbox.set_sort_compare(0, sort_compare);
+ The listbox supports attaching a customer's object for each item, therefore the items can be
+ sorted by comparing these customer's object.
+ bool sort_compare( const nana::string&, nana::any* o1,
+ const nana::string&, nana::any* o2, bool reverse)
+ {
+ if(o1 && o2) //some items may not attach a customer object.
+ {
+ int * i1 = o1->get();
+ int * i2 = o2->get();
+ return (i1 && i2 && (reverse ? *i1 > *i2 : *i1 < *i2));
+ ;//some types may not be int.
+ }
+ return false;
+ }
+ listbox.anyobj(0, 0, 10); //the type of customer's object is int.
+ listbox.anyobj(0, 0, 20);
+\todo doc: actualize this example listbox.at(0)...
+\see nana::drawerbase::listbox::cat_proxy
+\see nana::drawerbase::listbox::item_proxy
+\example listbox_Resolver.cpp
*/
class listbox
: public widget_object,
@@ -499,19 +552,23 @@ By \a clicking on a header the list get \a reordered, first up, and then down al
using cell = drawerbase::listbox::cell;
using export_options= drawerbase::listbox::export_options;
using columns_indexs= drawerbase::listbox::size_type;
+ using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;
public:
listbox() = default;
listbox(window, bool visible);
listbox(window, const rectangle& = {}, bool visible = true);
- void auto_draw(bool); ///); ///); ///< Appends categories at the end
cat_proxy insert(cat_proxy, nana::string);
cat_proxy at(size_type pos) const;
diff --git a/include/nana/gui/widgets/menu.hpp b/include/nana/gui/widgets/menu.hpp
index 883760cf..512d30d7 100644
--- a/include/nana/gui/widgets/menu.hpp
+++ b/include/nana/gui/widgets/menu.hpp
@@ -108,7 +108,7 @@ namespace nana
virtual void background(graph_reference, window) = 0;
virtual void item(graph_reference, const nana::rectangle&, const attr&) = 0;
- virtual void item_image(graph_reference, const nana::point&, const paint::image&) = 0;
+ virtual void item_image(graph_reference, const nana::point&, unsigned image_px, const paint::image&) = 0;
virtual void item_text(graph_reference, const nana::point&, const nana::string&, unsigned text_pixels, const attr&) = 0;
virtual void sub_arrow(graph_reference, const nana::point&, unsigned item_pixels, const attr&) = 0;
};
diff --git a/include/nana/gui/widgets/menubar.hpp b/include/nana/gui/widgets/menubar.hpp
index 44a4913e..8e7270bc 100644
--- a/include/nana/gui/widgets/menubar.hpp
+++ b/include/nana/gui/widgets/menubar.hpp
@@ -67,7 +67,6 @@ namespace nana
bool _m_close_menu();
std::size_t _m_item_by_pos(const ::nana::point&);
bool _m_track_mouse(const ::nana::point&);
- void _m_draw();
private:
widget *widget_;
nana::paint::graphics *graph_;
diff --git a/include/nana/gui/widgets/progress.hpp b/include/nana/gui/widgets/progress.hpp
index 91e58ab7..b4f692db 100644
--- a/include/nana/gui/widgets/progress.hpp
+++ b/include/nana/gui/widgets/progress.hpp
@@ -30,11 +30,12 @@ namespace nana
unsigned Max(unsigned);
void unknown(bool);
bool unknown() const;
+ bool stop(bool s = true);
+ bool stopped() const;
private:
void attached(widget_reference, graph_reference) override;
void refresh(graph_reference) override;
private:
- void _m_draw();
void _m_draw_box(graph_reference);
void _m_draw_progress(graph_reference);
bool _m_check_changing(unsigned) const;
@@ -45,6 +46,7 @@ namespace nana
nana::paint::graphics* graph_{nullptr};
unsigned draw_width_{static_cast(-1)};
bool unknown_{false};
+ bool stop_{false};
unsigned max_{100};
unsigned value_{0};
}; //end class drawer
@@ -67,6 +69,8 @@ namespace nana
unsigned amount(unsigned value);
void unknown(bool);
bool unknown() const;
+ bool stop(bool s=true); ///< request stop or cancel and return previus stop status
+ bool stopped() const;
};
}//end namespace nana
#endif
diff --git a/include/nana/gui/widgets/scroll.hpp b/include/nana/gui/widgets/scroll.hpp
index 39491da6..54a04de0 100644
--- a/include/nana/gui/widgets/scroll.hpp
+++ b/include/nana/gui/widgets/scroll.hpp
@@ -19,16 +19,15 @@
namespace nana
{
- template class scroll;
+ template class scroll; //forward declaration
- template
struct arg_scroll
: public event_arg
{
- scroll & widget;
+ window window_handle;
- arg_scroll(scroll & wdg)
- : widget(wdg)
+ arg_scroll(window wd)
+ : window_handle{ wd }
{}
};
@@ -36,11 +35,10 @@ namespace nana
{
namespace scroll
{
- template
struct scroll_events
: public general_events
{
- basic_event> value_changed;
+ basic_event value_changed;
};
enum class buttons
@@ -313,7 +311,7 @@ namespace nana
private:
void _m_emit_value_changed()
{
- widget_->events().value_changed.emit(::nana::arg_scroll(*widget_));
+ widget_->events().value_changed.emit({ widget_->handle() });
}
void _m_tick()
@@ -335,7 +333,7 @@ namespace nana
/// Provides a way to display an object which is larger than the window's client area.
template
class scroll // add a widget scheme?
- : public widget_object, drawerbase::scroll::scroll_events>
+ : public widget_object, drawerbase::scroll::scroll_events>
{
typedef widget_object > base_type;
public:
@@ -448,7 +446,6 @@ namespace nana
{
return this->make_step(forward, range() - 1);
}
-
};//end class scroll
}//end namespace nana
#endif
diff --git a/include/nana/gui/widgets/skeletons/text_editor.hpp b/include/nana/gui/widgets/skeletons/text_editor.hpp
index 976c168d..41812395 100644
--- a/include/nana/gui/widgets/skeletons/text_editor.hpp
+++ b/include/nana/gui/widgets/skeletons/text_editor.hpp
@@ -157,8 +157,8 @@ namespace nana{ namespace widgets
void set_accept(std::function);
void set_accept(accepts);
- bool respond_char(char_type);
- bool respond_key(char_type);
+ bool respond_char(const arg_keyboard& arg);
+ bool respond_key(const arg_keyboard& arg);
void typeface_changed();
@@ -231,13 +231,14 @@ namespace nana{ namespace widgets
void move_ns(bool to_north); //Moves up and down
void move_left();
void move_right();
- nana::upoint mouse_caret(const point& screen_pos);
- nana::upoint caret() const;
+ upoint mouse_caret(const point& screen_pos);
+ upoint caret() const;
+ point caret_screen_pos() const;
bool scroll(bool upwards, bool vertical);
bool mouse_enter(bool);
- bool mouse_down(bool left_button, const point& screen_pos);
+ bool mouse_down(::nana::mouse, const point& screen_pos);
bool mouse_move(bool left_button, const point& screen_pos);
- bool mouse_up(bool left_button, const point& screen_pos);
+ bool mouse_up(::nana::mouse, const point& screen_pos);
skeletons::textbase& textbase();
const skeletons::textbase& textbase() const;
@@ -286,6 +287,8 @@ namespace nana{ namespace widgets
unsigned _m_char_by_pixels(const nana::char_t*, std::size_t len, unsigned* pxbuf, int str_px, int pixels, bool is_rtl);
unsigned _m_pixels_by_char(const nana::string&, std::size_t pos) const;
static bool _m_is_right_text(const unicode_bidi::entity&);
+ void _handle_move_key(const arg_keyboard& arg);
+
private:
std::unique_ptr behavior_;
undoable undo_;
diff --git a/include/nana/gui/widgets/skeletons/text_token_stream.hpp b/include/nana/gui/widgets/skeletons/text_token_stream.hpp
index 024c12ce..eef80358 100644
--- a/include/nana/gui/widgets/skeletons/text_token_stream.hpp
+++ b/include/nana/gui/widgets/skeletons/text_token_stream.hpp
@@ -574,9 +574,9 @@ namespace nana{ namespace widgets{ namespace skeletons
virtual void nontext_render(graph_reference graph, int x, int y) override
{
if(size_ != image_.size())
- image_.stretch(image_.size(), graph, nana::rectangle(x, y, size_.width, size_.height));
+ image_.stretch(::nana::rectangle{ image_.size() }, graph, nana::rectangle(x, y, size_.width, size_.height));
else
- image_.paste(graph, x, y);
+ image_.paste(graph, point{ x, y });
}
virtual const nana::size & size() const override
diff --git a/include/nana/gui/widgets/spinbox.hpp b/include/nana/gui/widgets/spinbox.hpp
index df962c39..22b780e4 100644
--- a/include/nana/gui/widgets/spinbox.hpp
+++ b/include/nana/gui/widgets/spinbox.hpp
@@ -106,7 +106,7 @@ namespace nana
void modifier(std::wstring prefix, std::wstring suffix);
void modifier(const std::string & prefix_utf8, const std::string& suffix_utf8);
private:
- ::nana::string _m_caption() const;
+ ::nana::string _m_caption() const throw();
void _m_caption(::nana::string&&);
}; //end class spinbox
diff --git a/include/nana/gui/widgets/textbox.hpp b/include/nana/gui/widgets/textbox.hpp
index a678d31c..85bac2a6 100644
--- a/include/nana/gui/widgets/textbox.hpp
+++ b/include/nana/gui/widgets/textbox.hpp
@@ -144,12 +144,15 @@ namespace nana
bool saved() const;
/// Read the text from a specified line. It returns true for success.
- bool getline(std::size_t line_index, nana::string&) const;
+ bool getline(std::size_t pos, nana::string&) const;
+
+ /// Gets the caret position
+ bool caret_pos(point& pos, bool text_coordinate) const;
/// Appends an string. If `at_caret` is `true`, the string is inserted at the position of caret, otherwise, it is appended at end of the textbox.
textbox& append(const nana::string& text, bool at_caret);
- /// Determine wheter the text is line wrapped.
+ /// Determine wheter the text is line wrapped.
bool line_wrapped() const;
textbox& line_wrapped(bool);
@@ -187,7 +190,7 @@ namespace nana
void erase_keyword(const nana::string& kw);
protected:
//Overrides widget's virtual functions
- ::nana::string _m_caption() const override;
+ ::nana::string _m_caption() const throw() override;
void _m_caption(::nana::string&&) override;
void _m_typeface(const paint::font&) override;
};
diff --git a/include/nana/gui/widgets/toolbar.hpp b/include/nana/gui/widgets/toolbar.hpp
index efb8af74..0b097676 100644
--- a/include/nana/gui/widgets/toolbar.hpp
+++ b/include/nana/gui/widgets/toolbar.hpp
@@ -14,7 +14,6 @@
#define NANA_GUI_WIDGET_TOOLBAR_HPP
#include "widget.hpp"
-#include
namespace nana
{
@@ -39,10 +38,10 @@ namespace nana
basic_event selected; ///< A mouse click on a control button.
basic_event enter; ///< The mouse enters a control button.
basic_event leave; ///< The mouse leaves a control button.
-
};
struct item_type;
+ class item_container;
class drawer
: public drawer_trigger
@@ -50,15 +49,12 @@ namespace nana
struct drawer_impl_type;
public:
- typedef std::size_t size_type;
+ using size_type = std::size_t;
drawer();
~drawer();
- void append(const nana::string&, const nana::paint::image&);
- void append();
- bool enable(size_type) const;
- bool enable(size_type, bool);
+ item_container& items() const;
void scale(unsigned);
private:
void refresh(graph_reference) override;
@@ -69,32 +65,28 @@ namespace nana
void mouse_down(graph_reference, const arg_mouse&) override;
void mouse_up(graph_reference, const arg_mouse&) override;
private:
- size_type _m_which(int x, int y, bool want_if_disabled) const;
- void _m_draw_background(const ::nana::color&);
- void _m_draw();
- void _m_owner_sized(const arg_resized&);
- private:
- void _m_fill_pixels(item_type*, bool force);
+ size_type _m_which(point, bool want_if_disabled) const;
+ void _m_calc_pixels(item_type*, bool force);
private:
::nana::toolbar* widget_;
- ::nana::paint::graphics* graph_;
drawer_impl_type* impl_;
};
}//end namespace toolbar
}//end namespace drawerbase
+
/// Control bar that contains buttons for controlling
class toolbar
: public widget_object
{
public:
- typedef std::size_t size_type; ///< A type to count the number of elements.
+ using size_type = std::size_t; ///< A type to count the number of elements.
toolbar() = default;
toolbar(window, bool visible);
toolbar(window, const rectangle& = rectangle(), bool visible = true);
- void append(); ///< Adds a separator.
+ void separate(); ///< Adds a separator.
void append(const nana::string& text, const nana::paint::image& img); ///< Adds a control button.
void append(const nana::string& text); ///< Adds a control button.
bool enable(size_type index) const;
diff --git a/include/nana/gui/widgets/widget.hpp b/include/nana/gui/widgets/widget.hpp
index 9d298fbe..18163f61 100644
--- a/include/nana/gui/widgets/widget.hpp
+++ b/include/nana/gui/widgets/widget.hpp
@@ -12,20 +12,26 @@
#ifndef NANA_GUI_WIDGET_HPP
#define NANA_GUI_WIDGET_HPP
-#include
#include "../basis.hpp"
#include "../programming_interface.hpp"
#include
#include
-#include
#include
namespace nana
{
+ namespace detail
+ {
+ //Forward declaration of widget_notifier_interface
+ class widget_notifier_interface;
+ }
+
/// Abstract class for defining the capacity interface.
class widget
: nana::noncopyable, nana::nonmovable
{
+ friend class detail::widget_notifier_interface;
+ class notifier;
typedef void(*dummy_bool_type)(widget* (*)(const widget&));
public:
virtual ~widget() = default;
@@ -35,9 +41,9 @@ namespace nana
window parent() const;
- nana::string caption() const;
+ nana::string caption() const throw();
void caption(std::string utf8);
- void caption(nana::string);
+ void caption(std::wstring);
template
void i18n(std::string msgid, Args&&... args)
@@ -70,6 +76,7 @@ namespace nana
point pos() const;
void move(int x, int y);
+ void move(const point&);
void move(const rectangle&);
void fgcolor(const nana::color&);
@@ -88,12 +95,17 @@ namespace nana
operator dummy_bool_type() const;
operator window() const;
+ protected:
+ std::unique_ptr<::nana::detail::widget_notifier_interface> _m_wdg_notifier();
+ private:
+ virtual void _m_notify_destroy() = 0;
+
protected:
//protected members, a derived class must call this implementation if it overrides an implementation
virtual void _m_complete_creation();
virtual general_events& _m_get_general_events() const = 0;
- virtual nana::string _m_caption() const;
+ virtual nana::string _m_caption() const throw();
virtual void _m_caption(nana::string&&);
virtual nana::cursor _m_cursor() const;
virtual void _m_cursor(nana::cursor);
@@ -152,7 +164,6 @@ namespace nana
handle_ = API::dev::create_widget(parent_wd, r, this);
API::dev::set_events(handle_, events_);
API::dev::set_scheme(handle_, scheme_.get());
- API::dev::attach_signal(handle_, *this, &widget_object::signal);
API::dev::attach_drawer(*this, trigger_);
if(visible)
API::show_window(handle_, true);
@@ -193,29 +204,15 @@ namespace nana
return trigger_;
}
private:
- void signal(detail::signals::code code, const detail::signals& sig)
- {
- typedef detail::signals::code codes;
- switch(code)
- {
- case codes::caption:
- this->_m_caption(sig.info.caption);
- break;
- case codes::read_caption:
- *sig.info.str = this->_m_caption();
- break;
- case codes::destroy:
- handle_ = nullptr;
- break;
- default:
- break;
- }
- }
-
general_events& _m_get_general_events() const override
{
return *events_;
}
+
+ void _m_notify_destroy() override final
+ {
+ handle_ = nullptr;
+ }
private:
window handle_{nullptr};
DrawerTrigger trigger_;
@@ -276,29 +273,15 @@ namespace nana
return *scheme_;
}
private:
- void signal(detail::signals::code code, const detail::signals& sig)
- {
- typedef detail::signals::code codes;
- switch(code)
- {
- case codes::caption:
- this->_m_caption(sig.info.caption);
- break;
- case codes::read_caption:
- *sig.info.str = this->_m_caption();
- break;
- case codes::destroy:
- handle_ = nullptr;
- break;
- default:
- break;
- }
- }
-
general_events& _m_get_general_events() const override
{
return *events_;
}
+
+ void _m_notify_destroy() override final
+ {
+ handle_ = nullptr;
+ }
private:
window handle_{nullptr};
std::shared_ptr events_;
@@ -430,25 +413,6 @@ namespace nana
return trigger_;
}
private:
- void signal(detail::signals::code code, const detail::signals& sig)
- {
- typedef detail::signals::code codes;
- switch(code)
- {
- case codes::caption:
- this->_m_caption(sig.info.caption);
- break;
- case codes::read_caption:
- *sig.info.str = this->_m_caption();
- break;
- case codes::destroy:
- handle_ = nullptr;
- break;
- default:
- break;
- }
- }
-
void _m_bind_and_attach()
{
events_ = std::make_shared();
@@ -456,7 +420,6 @@ namespace nana
scheme_ = API::dev::make_scheme();
API::dev::set_scheme(handle_, scheme_.get());
- API::dev::attach_signal(handle_, *this, &widget_object::signal);
API::dev::attach_drawer(*this, trigger_);
}
@@ -464,6 +427,11 @@ namespace nana
{
return *events_;
}
+
+ void _m_notify_destroy() override final
+ {
+ handle_ = nullptr;
+ }
private:
window handle_;
DrawerTrigger trigger_;
@@ -511,7 +479,6 @@ namespace nana
handle_ = API::dev::create_frame(parent_wd, r, this);
API::dev::set_events(handle_, events_);
API::dev::set_scheme(handle_, scheme_.get());
- API::dev::attach_signal(handle_, *this, &widget_object::signal);
API::show_window(handle_, visible);
this->_m_complete_creation();
}
@@ -533,29 +500,15 @@ namespace nana
return nullptr;
}
- void signal(detail::signals::code code, const detail::signals& sig)
- {
- typedef detail::signals::code codes;
- switch(code)
- {
- case codes::caption:
- this->_m_caption(sig.info.caption);
- break;
- case codes::read_caption:
- *sig.info.str = this->_m_caption();
- break;
- case codes::destroy:
- handle_ = nullptr;
- break;
- default:
- break;
- }
- }
-
general_events& _m_get_general_events() const override
{
return *events_;
}
+
+ void _m_notify_destroy() override final
+ {
+ handle_ = nullptr;
+ }
private:
window handle_{nullptr};
std::shared_ptr events_;
diff --git a/include/nana/paint/detail/image_impl_interface.hpp b/include/nana/paint/detail/image_impl_interface.hpp
index b2a7df50..6cd604fb 100644
--- a/include/nana/paint/detail/image_impl_interface.hpp
+++ b/include/nana/paint/detail/image_impl_interface.hpp
@@ -16,11 +16,12 @@ namespace nana{ namespace paint{
typedef nana::paint::graphics& graph_reference;
virtual ~image_impl_interface() = 0; //The destructor is defined in ../image.cpp
virtual bool open(const nana::char_t* filename) = 0;
+ virtual bool open(const void* data, std::size_t bytes) = 0; // reads image from memory
virtual bool alpha_channel() const = 0;
virtual bool empty() const = 0;
virtual void close() = 0;
virtual nana::size size() const = 0;
- virtual void paste(const nana::rectangle& src_r, graph_reference dst, int x, int y) const = 0;
+ virtual void paste(const nana::rectangle& src_r, graph_reference dst, const point& p_dst) const = 0;
virtual void stretch(const nana::rectangle& src_r, graph_reference dst, const nana::rectangle& r) const = 0;
};//end class image::image_impl_interface
}//end namespace paint
diff --git a/include/nana/paint/graphics.hpp b/include/nana/paint/graphics.hpp
index aac4712a..e790fc89 100644
--- a/include/nana/paint/graphics.hpp
+++ b/include/nana/paint/graphics.hpp
@@ -130,7 +130,7 @@ namespace nana
void setsta(); ///< Clears the status if the graphics object had been changed
void set_changed();
void release();
- void save_as_file(const char*);
+ void save_as_file(const char*) const; // saves image as a bitmap file
void set_color(const ::nana::color&);
void set_text_color(const ::nana::color&);
diff --git a/include/nana/paint/image.hpp b/include/nana/paint/image.hpp
index b335a4fe..b1c237bc 100644
--- a/include/nana/paint/image.hpp
+++ b/include/nana/paint/image.hpp
@@ -37,13 +37,16 @@ namespace paint
image& operator=(const image& rhs);
image& operator=(image&&);
bool open(const nana::string& filename);
+
+ /// Opens an icon from a specified buffer
+ bool open_icon(const void* data, std::size_t bytes);
bool empty() const;
operator unspecified_bool_t() const;
void close();
bool alpha() const;
nana::size size() const;
- void paste(graphics& dst, int x, int y) const;
+ void paste(graphics& dst, const point& p_dst) const;
void paste(const nana::rectangle& r_src, graphics& dst, const point& p_dst) const;///< Paste the area of picture specified by r_src into the destination graphics specified by dst at position p_dst.
void stretch(const nana::rectangle& r_src, graphics& dst, const nana::rectangle& r_dst) const;///
+
+namespace nana
+{
+ namespace pat
+ {
+ namespace detail
+ {
+ //A Base class for abstract factory, avoids decorated name length exceeding for a class template.
+ class abstract_factory_base
+ {
+ public:
+ virtual ~abstract_factory_base() = default;
+ };
+ }
+
+ template
+ class abstract_factory
+ : public detail::abstract_factory_base
+ {
+ public:
+ using interface_type = Interface;
+
+ virtual ~abstract_factory() = default;
+ virtual std::unique_ptr create() = 0;
+ };
+
+ namespace detail
+ {
+ template
+ class abs_factory
+ : public abstract_factory
+ {
+ std::unique_ptr create() override
+ {
+ return std::unique_ptr{ new T };
+ }
+ };
+ }//end namespace detail
+
+ template
+ pat::cloneable> make_factory()
+ {
+ return detail::abs_factory();
+ }
+ }//end namespace pat
+}//end namespace nana
+#endif
diff --git a/source/audio/detail/audio_stream.cpp b/source/audio/detail/audio_stream.cpp
index 96def3d9..902911a0 100644
--- a/source/audio/detail/audio_stream.cpp
+++ b/source/audio/detail/audio_stream.cpp
@@ -8,17 +8,20 @@ namespace nana{ namespace audio
//class audio_stream
bool audio_stream::open(const nana::string& file)
{
- fs_.open(static_cast(nana::charset(file)), std::ios::binary);
+ fs_.open(static_cast(charset(file)), std::ios::binary);
if(fs_)
{
wave_spec::master_riff_chunk riff;
fs_.read(reinterpret_cast(&riff), sizeof(riff));
- if(riff.ckID == *reinterpret_cast("RIFF") && riff.waveID == *reinterpret_cast("WAVE"))
+ if(riff.ckID == *reinterpret_cast("RIFF") && riff.waveID == *reinterpret_cast("WAVE"))
{
fs_.read(reinterpret_cast(&ck_format_), sizeof(ck_format_));
- if(ck_format_.ckID == *reinterpret_cast("fmt ") && ck_format_.wFormatTag == 1) //Only support PCM format
+ if(ck_format_.ckID == *reinterpret_cast("fmt ") && ck_format_.wFormatTag == 1) //Only support PCM format
{
- std::size_t cksize = _m_locate_chunck(*reinterpret_cast("data"));
+ if (ck_format_.cksize > 16)
+ fs_.seekg(ck_format_.cksize - 16, std::ios::cur);
+
+ std::size_t cksize = _m_locate_chunck(*reinterpret_cast("data"));
if(cksize)
{
pcm_data_pos_ = static_cast(fs_.tellg());
@@ -77,7 +80,7 @@ namespace nana{ namespace audio
if(ck.ckID == ckID)
return ck.cksize;
- if(ck.ckID == *reinterpret_cast("data"))
+ if(ck.ckID == *reinterpret_cast("data"))
fs_.seekg(ck.cksize + (ck.cksize & 1 ? 1 : 0), std::ios::cur);
else
fs_.seekg(ck.cksize, std::ios::cur);
@@ -88,4 +91,4 @@ namespace nana{ namespace audio
}//end namespace detail
}//end namespace audio
-}//end namespace nana
\ No newline at end of file
+}//end namespace nana
diff --git a/source/charset.cpp b/source/charset.cpp
index c4a0f256..7e952503 100644
--- a/source/charset.cpp
+++ b/source/charset.cpp
@@ -799,7 +799,7 @@ namespace nana
switch(utf_x_)
{
case unicode::utf8:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
strbuf = detail::utf8_to_utf16(data_, true);
detail::put_utf16char(strbuf, 0, true);
#else
@@ -808,7 +808,7 @@ namespace nana
#endif
break;
case unicode::utf16:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
strbuf = data_;
detail::put_utf16char(strbuf, 0, true);
#else
@@ -817,7 +817,7 @@ namespace nana
#endif
break;
case unicode::utf32:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
strbuf = detail::utf32_to_utf16(data_);
detail::put_utf16char(strbuf, 0, true);
#else
@@ -907,21 +907,21 @@ namespace nana
switch(utf_x_)
{
case unicode::utf8:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
bytes = detail::utf8_to_utf16(data_, true);
#else
bytes = detail::utf8_to_utf32(data_, true);
#endif
break;
case unicode::utf16:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
bytes = data_;
#else
bytes = detail::utf16_to_utf32(data_);
#endif
break;
case unicode::utf32:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
bytes = detail::utf32_to_utf16(data_);
#else
bytes = data_;
@@ -984,19 +984,19 @@ namespace nana
switch(encoding)
{
case unicode::utf8:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
return detail::utf16_to_utf8(std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t)));
#else
return detail::utf32_to_utf8(std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t)));
#endif
case unicode::utf16:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
return std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t));
#else
return detail::utf32_to_utf16(std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t)));
#endif
case unicode::utf32:
-#if defined(NANA_MINGW)
+#if defined(NANA_WINDOWS)
return detail::utf16_to_utf32(std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t)));
#else
return std::string(reinterpret_cast(data_.c_str()), data_.size() * sizeof(wchar_t));
diff --git a/include/nana/detail/linux_X11/msg_dispatcher.hpp b/source/detail/linux_X11/msg_dispatcher.hpp
similarity index 99%
rename from include/nana/detail/linux_X11/msg_dispatcher.hpp
rename to source/detail/linux_X11/msg_dispatcher.hpp
index eab77f2f..7ba64b4f 100644
--- a/include/nana/detail/linux_X11/msg_dispatcher.hpp
+++ b/source/detail/linux_X11/msg_dispatcher.hpp
@@ -17,7 +17,7 @@
#ifndef NANA_DETAIL_MSG_DISPATCHER_HPP
#define NANA_DETAIL_MSG_DISPATCHER_HPP
-#include "msg_packet.hpp"
+#include
#include
#include
#include
diff --git a/source/detail/linux_X11/platform_spec.cpp b/source/detail/linux_X11/platform_spec.cpp
index f53c046b..7501158d 100644
--- a/source/detail/linux_X11/platform_spec.cpp
+++ b/source/detail/linux_X11/platform_spec.cpp
@@ -16,7 +16,6 @@
#include
#include PLATFORM_SPEC_HPP
-#include
#include
#include
#include |