Merge branch 'develop'

This commit is contained in:
Jinhao 2015-11-10 22:51:06 +08:00
commit 9d49877a74
108 changed files with 5842 additions and 8549 deletions

4
.gitignore vendored
View File

@ -33,3 +33,7 @@ _ReSharper*/
*.suo *.suo
*.sdf *.sdf
lib/ lib/
*.ninja*
CMakeCache.txt
CMakeFiles/
cmake_install.cmake

View File

@ -27,15 +27,20 @@ if(BIICODE)
endif() endif()
# set compile flags # set compile flags
if(CMAKE_COMPILER_IS_GNUCXX) 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} -std=c++11 -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX) endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# we'll use the default config file so we can iliminate the following macro definitions # we'll use the default config file so we can iliminate the following macro definitions
if(MSVC) if(MSVC)
# More MSVC specific compilation flags # More MSVC specific compilation flags
add_definitions(-D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
if(MSVC14)
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
else()
add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept)
endif()
endif() endif()
add_biicode_targets() add_biicode_targets()
@ -50,12 +55,21 @@ cmake_minimum_required(VERSION 2.8)
if(WIN32) if(WIN32)
add_definitions(-DNANA_WINDOWS) add_definitions(-DNANA_WINDOWS)
add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/win32/platform_spec.hpp>) add_definitions(-DPLATFORM_SPEC_HPP=<nana/detail/win32/platform_spec.hpp>)
if(MSVC14)
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
else()
add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept)
endif()
#Test if it is MINGW #Test if it is MINGW
if(MINGW) if(MINGW)
add_definitions(-DNANA_MINGW) add_definitions(-DNANA_MINGW)
add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) add_definitions(-DSTD_CODECVT_NOT_SUPPORTED)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.1")
option(NANA_THREAD_NOT_SUPPORTED "Use this flag if MinGW version is older than 4.8.1" ON) option(NANA_THREAD_NOT_SUPPORTED "Use this flag if MinGW version is older than 4.8.1" ON)
endif()
endif()
if(NANA_THREAD_NOT_SUPPORTED) if(NANA_THREAD_NOT_SUPPORTED)
add_definitions(-DSTD_THREAD_NOT_SUPPORTED) add_definitions(-DSTD_THREAD_NOT_SUPPORTED)
endif() endif()
@ -123,7 +137,7 @@ execute_process(COMMAND ${CMAKE_COMMAND}
${CMAKE_CURRENT_SOURCE_DIR}/include/nana/) ${CMAKE_CURRENT_SOURCE_DIR}/include/nana/)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source) set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source)

View File

@ -14,8 +14,11 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option createDefFile="1" /> <Option createDefFile="1" />
<Compiler> <Compiler>
<Add option="-std=c++11" />
<Add option="-Wall" /> <Add option="-Wall" />
<Add option="-g" /> <Add option="-g" />
<Add directory="../../include" />
<Add directory="../../extrlib/mingw" />
</Compiler> </Compiler>
</Target> </Target>
<Target title="Release"> <Target title="Release">
@ -26,8 +29,11 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Option createDefFile="1" /> <Option createDefFile="1" />
<Compiler> <Compiler>
<Add option="-Wall" />
<Add option="-O2" /> <Add option="-O2" />
<Add option="-std=c++11" />
<Add option="-Wall" />
<Add directory="../../include" />
<Add directory="../../extrlib/mingw" />
</Compiler> </Compiler>
<Linker> <Linker>
<Add option="-s" /> <Add option="-s" />
@ -44,7 +50,6 @@
<Unit filename="../../source/datetime.cpp" /> <Unit filename="../../source/datetime.cpp" />
<Unit filename="../../source/deploy.cpp" /> <Unit filename="../../source/deploy.cpp" />
<Unit filename="../../source/detail/platform_spec_selector.cpp" /> <Unit filename="../../source/detail/platform_spec_selector.cpp" />
<Unit filename="../../source/exceptions.cpp" />
<Unit filename="../../source/filesystem/file_iterator.cpp" /> <Unit filename="../../source/filesystem/file_iterator.cpp" />
<Unit filename="../../source/filesystem/fs_utility.cpp" /> <Unit filename="../../source/filesystem/fs_utility.cpp" />
<Unit filename="../../source/gui/animation.cpp" /> <Unit filename="../../source/gui/animation.cpp" />
@ -102,7 +107,6 @@
<Unit filename="../../source/internationalization.cpp" /> <Unit filename="../../source/internationalization.cpp" />
<Unit filename="../../source/paint/detail/image_process_provider.cpp" /> <Unit filename="../../source/paint/detail/image_process_provider.cpp" />
<Unit filename="../../source/paint/detail/native_paint_interface.cpp" /> <Unit filename="../../source/paint/detail/native_paint_interface.cpp" />
<Unit filename="../../source/paint/gadget.cpp" />
<Unit filename="../../source/paint/graphics.cpp" /> <Unit filename="../../source/paint/graphics.cpp" />
<Unit filename="../../source/paint/image.cpp" /> <Unit filename="../../source/paint/image.cpp" />
<Unit filename="../../source/paint/image_process_selector.cpp" /> <Unit filename="../../source/paint/image_process_selector.cpp" />

View File

@ -537,3 +537,664 @@
1399002439 source:d:\privates\nana\release\nana.cpp11\source\gui\detail\element_store.cpp 1399002439 source:d:\privates\nana\release\nana.cpp11\source\gui\detail\element_store.cpp
<nana/gui/detail/element_store.hpp> <nana/gui/detail/element_store.hpp>
1363362719 source:d:\git.repo\nana\source\any.cpp
<nana/any.hpp>
1362509572 source:d:\git.repo\nana\source\audio\detail\audio_device.cpp
<nana/audio/detail/audio_device.hpp>
<nana/system/platform.hpp>
<pthread.h>
<unistd.h>
<sys/time.h>
<errno.h>
1439496157 source:d:\git.repo\nana\source\audio\detail\audio_stream.cpp
<nana/audio/detail/audio_stream.hpp>
<nana/charset.hpp>
1362509721 source:d:\git.repo\nana\source\audio\detail\buffer_preparation.cpp
<nana/audio/detail/buffer_preparation.hpp>
<cstring>
1353253406 source:d:\git.repo\nana\source\audio\player.cpp
<nana/audio/player.hpp>
<nana/audio/detail/audio_stream.hpp>
<nana/audio/detail/audio_device.hpp>
<nana/audio/detail/buffer_preparation.hpp>
<nana/system/platform.hpp>
1439496157 source:d:\git.repo\nana\source\basic_types.cpp
<nana/basic_types.hpp>
<regex>
<vector>
<algorithm>
<stdexcept>
1439496157 source:d:\git.repo\nana\source\charset.cpp
<nana/charset.hpp>
<utility>
<nana/deploy.hpp>
<cwchar>
<clocale>
<codecvt>
<windows.h>
1439496157 source:d:\git.repo\nana\source\datetime.cpp
<nana/config.hpp>
<nana/datetime.hpp>
<windows.h>
<cassert>
1439496157 source:d:\git.repo\nana\source\deploy.cpp
<nana/deploy.hpp>
<cstdlib>
<stdexcept>
<windows.h>
<string.h>
<sstream>
1439496157 source:d:\git.repo\nana\source\detail\platform_spec_selector.cpp
<nana/config.hpp>
"win32/platform_spec.cpp"
"linux_X11/platform_spec.cpp"
1443581342 d:\git.repo\nana\source\detail\win32\platform_spec.cpp
<nana/config.hpp>
<shellapi.h>
<stdexcept>
<VersionHelpers.h>
1443581342 d:\git.repo\nana\source\detail\linux_x11\platform_spec.cpp
<nana/config.hpp>
<X11/Xlocale.h>
<locale>
<map>
<set>
<algorithm>
<nana/paint/graphics.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/basic_window.hpp>
<nana/system/platform.hpp>
<errno.h>
<sstream>
"msg_dispatcher.hpp"
1439496157 d:\git.repo\nana\source\detail\linux_x11\msg_dispatcher.hpp
<nana/detail/linux_X11/msg_packet.hpp>
<nana/system/platform.hpp>
<list>
<set>
<map>
<mutex>
<condition_variable>
<memory>
<thread>
1365203880 source:d:\git.repo\nana\source\exceptions.cpp
<nana/exceptions.hpp>
1365203878 source:d:\git.repo\nana\source\filesystem\file_iterator.cpp
<nana/filesystem/file_iterator.hpp>
1365203878 source:d:\git.repo\nana\source\filesystem\fs_utility.cpp
<nana/filesystem/fs_utility.hpp>
<nana/filesystem/file_iterator.hpp>
<vector>
<windows.h>
<shlobj.h>
<nana/datetime.hpp>
<nana/charset.hpp>
<sys/stat.h>
<sys/types.h>
<dirent.h>
<cstdio>
<cstring>
<errno.h>
<unistd.h>
<stdlib.h>
1444647306 source:d:\git.repo\nana\source\gui\animation.cpp
<nana/gui/animation.hpp>
<nana/gui/drawing.hpp>
<nana/system/timepiece.hpp>
<nana/system/platform.hpp>
<vector>
<list>
<map>
<algorithm>
<nana/std_thread.hpp>
<nana/std_mutex.hpp>
<nana/std_condition_variable.hpp>
<mutex>
<condition_variable>
<thread>
1423350892 source:d:\git.repo\nana\source\gui\basis.cpp
<nana/gui/basis.hpp>
1439496157 source:d:\git.repo\nana\source\gui\detail\basic_window.cpp
<nana/gui/detail/basic_window.hpp>
<nana/gui/detail/native_window_interface.hpp>
1444585389 source:d:\git.repo\nana\source\gui\detail\bedrock_pi.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock_pi_data.hpp>
<nana/gui/detail/event_code.hpp>
<nana/system/platform.hpp>
<sstream>
<nana/system/timepiece.hpp>
<nana/gui/wvl.hpp>
<nana/gui/detail/inner_fwd_implement.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/layout_utility.hpp>
<nana/gui/detail/element_store.hpp>
<algorithm>
1439496157 source:d:\git.repo\nana\source\gui\detail\bedrock_selector.cpp
<nana/config.hpp>
"win32/bedrock.cpp"
"linux_X11/bedrock.cpp"
1444657608 d:\git.repo\nana\source\gui\detail\win32\bedrock.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/bedrock_pi_data.hpp>
<nana/gui/detail/event_code.hpp>
<nana/system/platform.hpp>
<sstream>
<nana/system/timepiece.hpp>
<nana/gui.hpp>
<nana/gui/detail/inner_fwd_implement.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/layout_utility.hpp>
<nana/gui/detail/element_store.hpp>
<nana/gui/detail/color_schemes.hpp>
1444647171 d:\git.repo\nana\source\gui\detail\linux_x11\bedrock.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock_pi_data.hpp>
<nana/gui/detail/event_code.hpp>
<nana/system/platform.hpp>
<nana/gui/detail/inner_fwd_implement.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/layout_utility.hpp>
<nana/gui/detail/element_store.hpp>
<errno.h>
1444567878 source:d:\git.repo\nana\source\gui\detail\color_schemes.cpp
<nana/gui/detail/color_schemes.hpp>
<map>
1439496157 source:d:\git.repo\nana\source\gui\detail\drawer.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/drawer.hpp>
<nana/gui/detail/dynamic_drawing_object.hpp>
<nana/gui/detail/effects_renderer.hpp>
<nana/gui/detail/basic_window.hpp>
<nana/detail/linux_X11/platform_spec.hpp>
1408986718 source:d:\git.repo\nana\source\gui\detail\element_store.cpp
<nana/gui/detail/element_store.hpp>
1444470665 source:d:\git.repo\nana\source\gui\detail\events_operation.cpp
<nana/gui/detail/events_operation.hpp>
1444647213 source:d:\git.repo\nana\source\gui\detail\native_window_interface.cpp
<nana/config.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/screen.hpp>
<nana/std_mutex.hpp>
<mutex>
<map>
"../../paint/detail/image_ico.hpp"
<nana/system/platform.hpp>
<nana/gui/detail/bedrock.hpp>
1439496158 d:\git.repo\nana\source\paint\detail\image_ico.hpp
<nana/paint/detail/image_impl_interface.hpp>
1439496157 source:d:\git.repo\nana\source\gui\detail\window_layout.cpp
<nana/gui/detail/window_layout.hpp>
<nana/gui/detail/basic_window.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/layout_utility.hpp>
<algorithm>
1444657627 source:d:\git.repo\nana\source\gui\detail\window_manager.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/events_operation.hpp>
<nana/gui/detail/handle_manager.hpp>
<nana/gui/detail/window_manager.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/detail/inner_fwd_implement.hpp>
<nana/gui/layout_utility.hpp>
<nana/gui/detail/effects_renderer.hpp>
<stdexcept>
<algorithm>
1444585885 source:d:\git.repo\nana\source\gui\dragger.cpp
<nana/gui/dragger.hpp>
1444647322 source:d:\git.repo\nana\source\gui\drawing.cpp
<nana/gui/drawing.hpp>
<nana/gui/programming_interface.hpp>
<nana/gui/detail/basic_window.hpp>
1439496157 source:d:\git.repo\nana\source\gui\effects.cpp
<nana/gui/effects.hpp>
<nana/gui/programming_interface.hpp>
1444585885 source:d:\git.repo\nana\source\gui\element.cpp
<nana/gui/element.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/element_store.hpp>
<nana/paint/image.hpp>
<map>
<string>
<nana/std_mutex.hpp>
<mutex>
1439496157 source:d:\git.repo\nana\source\gui\filebox.cpp
<nana/gui.hpp>
<nana/gui/filebox.hpp>
<nana/filesystem/fs_utility.hpp>
<windows.h>
<nana/gui/widgets/label.hpp>
<nana/gui/widgets/button.hpp>
<nana/gui/widgets/listbox.hpp>
<nana/gui/widgets/categorize.hpp>
<nana/gui/widgets/textbox.hpp>
<nana/gui/widgets/treebox.hpp>
<nana/gui/widgets/combox.hpp>
<nana/filesystem/file_iterator.hpp>
<nana/gui/place.hpp>
<stdexcept>
<algorithm>
1439496157 source:d:\git.repo\nana\source\gui\layout_utility.cpp
<nana/gui/layout_utility.hpp>
1444585885 source:d:\git.repo\nana\source\gui\msgbox.cpp
<nana/gui.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/widgets/button.hpp>
<nana/gui/widgets/spinbox.hpp>
<nana/gui/widgets/combox.hpp>
<nana/gui/widgets/textbox.hpp>
<nana/gui/widgets/panel.hpp>
<nana/gui/widgets/picture.hpp>
<nana/gui/place.hpp>
<nana/datetime.hpp>
<nana/internationalization.hpp>
<nana/gui/filebox.hpp>
<functional>
<cstdlib>
<windows.h>
<nana/gui/widgets/picture.hpp>
<nana/paint/pixel_buffer.hpp>
1444647352 source:d:\git.repo\nana\source\gui\notifier.cpp
<nana/deploy.hpp>
<nana/gui/programming_interface.hpp>
<nana/gui/notifier.hpp>
<nana/gui/timer.hpp>
<unordered_map>
<unordered_set>
<nana/std_mutex.hpp>
<mutex>
<nana/detail/win32/platform_spec.hpp>
<nana/system/platform.hpp>
<iostream>
1444657299 source:d:\git.repo\nana\source\gui\programming_interface.cpp
<nana/gui/programming_interface.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/basic_window.hpp>
<nana/gui/detail/window_manager.hpp>
<nana/system/platform.hpp>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/widgets/widget.hpp>
<nana/gui/detail/events_operation.hpp>
1439496158 source:d:\git.repo\nana\source\gui\screen.cpp
<nana/gui/screen.hpp>
<vector>
<memory>
<nana/gui/detail/native_window_interface.hpp>
<nana/gui/programming_interface.hpp>
<windows.h>
1444647437 source:d:\git.repo\nana\source\gui\state_cursor.cpp
<nana/gui/state_cursor.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/basic_window.hpp>
<nana/gui/detail/window_manager.hpp>
1439496158 source:d:\git.repo\nana\source\gui\timer.cpp
<nana/deploy.hpp>
<nana/gui/timer.hpp>
<map>
<memory>
<nana/std_mutex.hpp>
<mutex>
<windows.h>
<nana/system/platform.hpp>
1444585886 source:d:\git.repo\nana\source\gui\tooltip.cpp
<nana/gui/tooltip.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/timer.hpp>
<nana/gui/screen.hpp>
<memory>
1439496158 source:d:\git.repo\nana\source\gui\widgets\button.cpp
<nana/gui/widgets/button.hpp>
<nana/paint/text_renderer.hpp>
1439829040 source:d:\git.repo\nana\source\gui\widgets\categorize.cpp
<nana/gui/wvl.hpp>
<nana/gui/widgets/categorize.hpp>
<nana/gui/widgets/float_listbox.hpp>
<nana/gui/element.hpp>
<nana/gui/widgets/detail/tree_cont.hpp>
<stdexcept>
1439829040 source:d:\git.repo\nana\source\gui\widgets\checkbox.cpp
<nana/gui/widgets/checkbox.hpp>
<nana/paint/text_renderer.hpp>
<nana/gui/element.hpp>
<algorithm>
1439496158 source:d:\git.repo\nana\source\gui\widgets\combox.cpp
<nana/gui.hpp>
<nana/gui/widgets/combox.hpp>
<nana/gui/element.hpp>
<nana/system/dataexch.hpp>
<nana/gui/widgets/float_listbox.hpp>
<nana/gui/widgets/skeletons/text_editor.hpp>
<nana/gui/widgets/skeletons/textbase_export_interface.hpp>
<iterator>
1439829040 source:d:\git.repo\nana\source\gui\widgets\date_chooser.cpp
<nana/gui/widgets/date_chooser.hpp>
<nana/gui/element.hpp>
<nana/system/platform.hpp>
<sstream>
1439496158 source:d:\git.repo\nana\source\gui\widgets\float_listbox.cpp
<nana/gui/widgets/float_listbox.hpp>
<nana/gui/widgets/scroll.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\form.cpp
<nana/gui/widgets/form.hpp>
1408985395 source:d:\git.repo\nana\source\gui\widgets\frame.cpp
<nana/gui/widgets/frame.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\group.cpp
<nana/gui/widgets/group.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/drawing.hpp>
<nana/gui/widgets/checkbox.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\label.cpp
<nana/gui/widgets/label.hpp>
<nana/unicode_bidi.hpp>
<nana/gui/widgets/skeletons/text_token_stream.hpp>
<nana/system/platform.hpp>
<stdexcept>
<sstream>
1439496158 source:d:\git.repo\nana\source\gui\widgets\listbox.cpp
<nana/gui/widgets/listbox.hpp>
<nana/gui/widgets/scroll.hpp>
<nana/gui/widgets/panel.hpp>
<nana/gui/layout_utility.hpp>
<nana/gui/element.hpp>
<list>
<deque>
<stdexcept>
<algorithm>
<nana/system/dataexch.hpp>
<cassert>
1439828820 source:d:\git.repo\nana\source\gui\widgets\menu.cpp
<nana/gui/widgets/menu.hpp>
<nana/system/platform.hpp>
<nana/gui/element.hpp>
<nana/gui/wvl.hpp>
<nana/paint/text_renderer.hpp>
<cctype>
1439496158 source:d:\git.repo\nana\source\gui\widgets\menubar.cpp
<nana/gui/widgets/menubar.hpp>
<stdexcept>
1439496158 source:d:\git.repo\nana\source\gui\widgets\panel.cpp
<nana/gui/widgets/panel.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\picture.cpp
<nana/gui/widgets/picture.hpp>
<nana/gui/layout_utility.hpp>
<nana/paint/image.hpp>
<nana/gui/element.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\progress.cpp
<nana/gui/widgets/progress.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\scroll.cpp
<nana/gui/widgets/scroll.hpp>
<nana/gui/element.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\skeletons\text_editor.cpp
<nana/gui/widgets/skeletons/text_editor.hpp>
<nana/gui/widgets/skeletons/textbase_export_interface.hpp>
<nana/gui/element.hpp>
<nana/system/dataexch.hpp>
<nana/unicode_bidi.hpp>
<numeric>
<cwctype>
<cstring>
<set>
<algorithm>
1439496158 source:d:\git.repo\nana\source\gui\widgets\slider.cpp
<nana/gui/widgets/slider.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\spinbox.cpp
<nana/gui/widgets/spinbox.hpp>
<nana/gui/widgets/skeletons/text_editor.hpp>
<nana/gui/element.hpp>
<nana/gui/timer.hpp>
<algorithm>
1439496158 source:d:\git.repo\nana\source\gui\widgets\textbox.cpp
<nana/gui/widgets/textbox.hpp>
<nana/gui/widgets/skeletons/text_editor.hpp>
<stdexcept>
<sstream>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/inner_fwd_implement.hpp>
1439496158 source:d:\git.repo\nana\source\gui\widgets\toolbar.cpp
<nana/gui/widgets/toolbar.hpp>
<nana/gui/tooltip.hpp>
<vector>
1439496158 source:d:\git.repo\nana\source\gui\widgets\treebox.cpp
<nana/gui/widgets/treebox.hpp>
<nana/gui/widgets/scroll.hpp>
<nana/gui/element.hpp>
<nana/gui/layout_utility.hpp>
<nana/system/platform.hpp>
<stdexcept>
1439746410 source:d:\git.repo\nana\source\gui\widgets\widget.cpp
<nana/gui/widgets/widget.hpp>
<nana/gui/tooltip.hpp>
<nana/gui/detail/widget_notifier_interface.hpp>
1408984042 source:d:\git.repo\nana\source\gui\wvl.cpp
<nana/gui/wvl.hpp>
1425221155 source:d:\git.repo\nana\source\internationalization.cpp
<nana/internationalization.hpp>
<nana/gui/widgets/widget.hpp>
<unordered_map>
<fstream>
<sstream>
<memory>
1423350893 source:d:\git.repo\nana\source\paint\detail\image_process_provider.cpp
<nana/paint/detail/image_process_provider.hpp>
<nana/paint/detail/image_processor.hpp>
1439496158 source:d:\git.repo\nana\source\paint\detail\native_paint_interface.cpp
<nana/config.hpp>
<nana/paint/detail/native_paint_interface.hpp>
<nana/paint/pixel_buffer.hpp>
<nana/gui/layout_utility.hpp>
<windows.h>
<X11/Xlib.h>
1439746289 source:d:\git.repo\nana\source\paint\graphics.cpp
<nana/config.hpp>
<nana/gui/detail/bedrock.hpp>
<nana/paint/graphics.hpp>
<nana/paint/detail/native_paint_interface.hpp>
<nana/paint/pixel_buffer.hpp>
<nana/gui/layout_utility.hpp>
<nana/unicode_bidi.hpp>
<algorithm>
<windows.h>
<X11/Xlib.h>
1439496158 source:d:\git.repo\nana\source\paint\image.cpp
<nana/config.hpp>
<nana/paint/image.hpp>
<algorithm>
<fstream>
<iterator>
<stdexcept>
<nana/paint/detail/image_impl_interface.hpp>
<nana/paint/pixel_buffer.hpp>
"detail/image_png.hpp"
"detail/image_bmp.hpp"
"detail/image_ico.hpp"
1439687843 d:\git.repo\nana\source\paint\detail\image_png.hpp
<nana/paint/detail/image_impl_interface.hpp>
<nana/extrlib/png.h>
<png.h>
<stdio.h>
<nana/paint/pixel_buffer.hpp>
1439496158 d:\git.repo\nana\source\paint\detail\image_bmp.hpp
<nana/paint/detail/image_impl_interface.hpp>
<memory>
1376313789 source:d:\git.repo\nana\source\paint\image_process_selector.cpp
<nana/paint/image_process_selector.hpp>
1439496158 source:d:\git.repo\nana\source\paint\pixel_buffer.cpp
<nana/config.hpp>
<nana/paint/pixel_buffer.hpp>
<nana/gui/layout_utility.hpp>
<nana/paint/detail/native_paint_interface.hpp>
<nana/paint/detail/image_process_provider.hpp>
<stdexcept>
1423350893 source:d:\git.repo\nana\source\paint\text_renderer.cpp
<nana/config.hpp>
<nana/paint/text_renderer.hpp>
<nana/unicode_bidi.hpp>
<nana/paint/detail/native_paint_interface.hpp>
1439496158 source:d:\git.repo\nana\source\system\dataexch.cpp
<nana/system/dataexch.hpp>
<nana/traits.hpp>
<nana/paint/graphics.hpp>
<vector>
<cassert>
<windows.h>
<nana/gui/detail/bedrock.hpp>
<nana/gui/detail/basic_window.hpp>
1387007333 source:d:\git.repo\nana\source\system\platform.cpp
<nana/deploy.hpp>
<windows.h>
<time.h>
<errno.h>
<unistd.h>
<sys/time.h>
<sys/syscall.h>
1365203879 source:d:\git.repo\nana\source\system\shared_wrapper.cpp
<nana/system/shared_wrapper.hpp>
<algorithm>
<iterator>
<dlfcn.h>
<windows.h>
1342280997 source:d:\git.repo\nana\source\system\timepiece.cpp
<nana/system/timepiece.hpp>
<nana/config.hpp>
<windows.h>
<sys/time.h>
1386165989 source:d:\git.repo\nana\source\threads\pool.cpp
<nana/threads/pool.hpp>
<nana/system/platform.hpp>
<time.h>
<deque>
<vector>
<nana/std_condition_variable.hpp>
<nana/std_mutex.hpp>
<condition_variable>
<mutex>
<windows.h>
<process.h>
<pthread.h>
1365203748 source:d:\git.repo\nana\source\traits.cpp
<nana/traits.hpp>
1439496158 source:d:\git.repo\nana\source\unicode_bidi.cpp
<nana/unicode_bidi.hpp>
1439830958 source:d:\git.repo\nana\source\gui\widgets\tabbar.cpp
<nana/gui/widgets/tabbar.hpp>
<nana/gui/widgets/menu.hpp>
<nana/paint/text_renderer.hpp>
<nana/gui/element.hpp>
<stdexcept>
<list>
<forward_list>
1444658359 source:d:\git.repo\nana\source\gui\place.cpp
<cfloat>
<cmath>
<map>
<deque>
<nana/gui/place.hpp>
<nana/gui/programming_interface.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/widgets/panel.hpp>
<nana/gui/dragger.hpp>
<nana/gui/drawing.hpp>
<memory>
<limits>
<cstdlib>
<cstring>
"place_parts.hpp"
1444585885 d:\git.repo\nana\source\gui\place_parts.hpp
<nana/gui/widgets/form.hpp>
<nana/gui/widgets/tabbar.hpp>
<nana/gui/element.hpp>
<nana/paint/text_renderer.hpp>
<stdexcept>
<deque>

View File

@ -1,154 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<File name="..\..\source\paint\text_renderer.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5894" topLine="205" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\native_window_interface.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4901" topLine="171" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\window_layout.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5198" topLine="161" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\window_manager.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30124" topLine="1046" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\listbox.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12428" topLine="532" />
</Cursor>
</File>
<File name="..\..\source\gui\dragger.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1316" topLine="59" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\menu.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="27717" topLine="1044" />
</Cursor>
</File>
<File name="..\..\source\threads\pool.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5569" topLine="249" />
</Cursor>
</File>
<File name="..\..\source\gui\element.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20890" topLine="542" />
</Cursor>
</File>
<File name="..\..\source\gui\filebox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="22934" topLine="871" />
</Cursor>
</File>
<File name="..\..\source\gui\msgbox.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="48249" topLine="407" />
</Cursor>
</File>
<File name="..\..\source\charset.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="412" topLine="15" />
</Cursor>
</File>
<File name="..\..\source\gui\programming_interface.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5022" topLine="159" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18615" topLine="760" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11188" topLine="459" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\toolbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2244" topLine="84" />
</Cursor>
</File>
<File name="..\..\source\detail\platform_spec_selector.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="587" topLine="2" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\treebox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="15535" topLine="539" />
</Cursor>
</File>
<File name="..\..\source\audio\detail\buffer_preparation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1924" topLine="62" />
</Cursor>
</File>
<File name="..\..\source\gui\tooltip.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4739" topLine="194" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\button.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7080" topLine="291" />
</Cursor>
</File>
<File name="..\..\source\filesystem\fs_utility.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1562" topLine="57" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\categorize.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6160" topLine="196" />
</Cursor>
</File>
<File name="..\..\source\gui\animation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1164" topLine="43" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\checkbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6998" topLine="275" />
</Cursor>
</File>
<File name="..\..\source\audio\detail\audio_device.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6256" topLine="215" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\combox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16572" topLine="610" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\date_chooser.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="457" topLine="3" />
</Cursor>
</File>
<File name="..\..\source\paint\graphics.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30961" topLine="1020" />
</Cursor>
</File>
<File name="..\..\source\paint\image.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3714" topLine="168" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -5,9 +5,10 @@
GCC = g++ GCC = g++
INCROOT = ../../include INCROOT = ../../include
SRCROOT = ../../source SRCROOT = ../../source
EXTRLIB = ../../extrlib
NANA_INC= $(INCROOT)/nana NANA_INC= $(INCROOT)/nana
INCS = -I$(INCROOT) -I/usr/include/freetype2 INCS = -I$(INCROOT) -I/usr/include/freetype2 -I$(EXTRLIB)
BIN = libnana.a BIN = libnana.a
@ -34,7 +35,7 @@ $(BIN): $(LINKOBJ)
ranlib ../bin/$(BIN) ranlib ../bin/$(BIN)
.cpp.o: .cpp.o:
$(GCC) -g -c $< -o $@ $(INCS) -std=c++0x -Wall $(GCC) -g -c $< -o $@ $(INCS) -std=c++11 -Wall
clean: clean:
rm -f $(LINKOBJ) rm -f $(LINKOBJ)

View File

@ -68,31 +68,35 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<IncludePath>..\..\include;$(IncludePath)</IncludePath> <IncludePath>..\..\include;..\..\extrlib\vc2013;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath> <SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<LibraryPath>..\..\extrlib\vc2013;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\..\include;$(IncludePath)</IncludePath> <IncludePath>..\..\include;..\..\extrlib\vc2013;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath> <SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<LibraryPath>..\..\extrlib\vc2013;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<IncludePath>..\..\include;$(IncludePath)</IncludePath> <IncludePath>..\..\include;..\..\extrlib\vc2013;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath> <SourcePath>..\..\source;$(VC_SourcePath)</SourcePath>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<LibraryPath>..\..\extrlib\vc2013;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>..\..\include;$(IncludePath)</IncludePath> <IncludePath>..\..\include;..\..\extrlib\vc2013;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath> <SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<LibraryPath>..\..\extrlib\vc2013;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -184,7 +188,6 @@
<ClCompile Include="..\..\source\datetime.cpp" /> <ClCompile Include="..\..\source\datetime.cpp" />
<ClCompile Include="..\..\source\deploy.cpp" /> <ClCompile Include="..\..\source\deploy.cpp" />
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" /> <ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" />
<ClCompile Include="..\..\source\exceptions.cpp" />
<ClCompile Include="..\..\source\filesystem\filesystem.cpp" /> <ClCompile Include="..\..\source\filesystem\filesystem.cpp" />
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp" /> <ClCompile Include="..\..\source\filesystem\file_iterator.cpp" />
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp" /> <ClCompile Include="..\..\source\filesystem\fs_utility.cpp" />
@ -243,7 +246,6 @@
<ClCompile Include="..\..\source\internationalization.cpp" /> <ClCompile Include="..\..\source\internationalization.cpp" />
<ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp" /> <ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp" />
<ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp" /> <ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp" />
<ClCompile Include="..\..\source\paint\gadget.cpp" />
<ClCompile Include="..\..\source\paint\graphics.cpp" /> <ClCompile Include="..\..\source\paint\graphics.cpp" />
<ClCompile Include="..\..\source\paint\image.cpp" /> <ClCompile Include="..\..\source\paint\image.cpp" />
<ClCompile Include="..\..\source\paint\image_process_selector.cpp" /> <ClCompile Include="..\..\source\paint\image_process_selector.cpp" />
@ -273,11 +275,6 @@
<ClInclude Include="..\..\include\nana\detail\linux_X11\msg_packet.hpp" /> <ClInclude Include="..\..\include\nana\detail\linux_X11\msg_packet.hpp" />
<ClInclude Include="..\..\include\nana\detail\linux_X11\platform_spec.hpp" /> <ClInclude Include="..\..\include\nana\detail\linux_X11\platform_spec.hpp" />
<ClInclude Include="..\..\include\nana\detail\win32\platform_spec.hpp" /> <ClInclude Include="..\..\include\nana\detail\win32\platform_spec.hpp" />
<ClInclude Include="..\..\include\nana\exceptions.hpp" />
<ClInclude Include="..\..\include\nana\extrlib\png.h" />
<ClInclude Include="..\..\include\nana\extrlib\pngconf.h" />
<ClInclude Include="..\..\include\nana\extrlib\pnglibconf.h" />
<ClInclude Include="..\..\include\nana\extrlib\zlib.h" />
<ClInclude Include="..\..\include\nana\filesystem\filesystem.hpp" /> <ClInclude Include="..\..\include\nana\filesystem\filesystem.hpp" />
<ClInclude Include="..\..\include\nana\filesystem\file_iterator.hpp" /> <ClInclude Include="..\..\include\nana\filesystem\file_iterator.hpp" />
<ClInclude Include="..\..\include\nana\filesystem\fs_utility.hpp" /> <ClInclude Include="..\..\include\nana\filesystem\fs_utility.hpp" />

View File

@ -82,9 +82,6 @@
<Filter Include="Header Files\detail\linux_X11"> <Filter Include="Header Files\detail\linux_X11">
<UniqueIdentifier>{61385c08-f06b-4cf3-8e05-9b47d546164b}</UniqueIdentifier> <UniqueIdentifier>{61385c08-f06b-4cf3-8e05-9b47d546164b}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\extrlib">
<UniqueIdentifier>{e9eadc97-4a14-4a4e-bb52-52d3a20e2693}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\filesystem"> <Filter Include="Header Files\filesystem">
<UniqueIdentifier>{5667eac1-0887-4936-9502-eac4dd8c1c1d}</UniqueIdentifier> <UniqueIdentifier>{5667eac1-0887-4936-9502-eac4dd8c1c1d}</UniqueIdentifier>
</Filter> </Filter>
@ -261,9 +258,6 @@
<ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp"> <ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp">
<Filter>Source Files\nana\paint\detail</Filter> <Filter>Source Files\nana\paint\detail</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\paint\gadget.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\graphics.cpp"> <ClCompile Include="..\..\source\paint\graphics.cpp">
<Filter>Source Files\nana\paint</Filter> <Filter>Source Files\nana\paint</Filter>
</ClCompile> </ClCompile>
@ -309,9 +303,6 @@
<ClCompile Include="..\..\source\deploy.cpp"> <ClCompile Include="..\..\source\deploy.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files\nana</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\exceptions.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\traits.cpp"> <ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files\nana</Filter>
</ClCompile> </ClCompile>
@ -580,9 +571,6 @@
<ClInclude Include="..\..\include\nana\deploy.hpp"> <ClInclude Include="..\..\include\nana\deploy.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\nana\exceptions.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\fwd.hpp"> <ClInclude Include="..\..\include\nana\fwd.hpp">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -634,18 +622,6 @@
<ClInclude Include="..\..\include\nana\detail\win32\platform_spec.hpp"> <ClInclude Include="..\..\include\nana\detail\win32\platform_spec.hpp">
<Filter>Header Files\detail\win32</Filter> <Filter>Header Files\detail\win32</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\nana\extrlib\png.h">
<Filter>Header Files\extrlib</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\extrlib\pngconf.h">
<Filter>Header Files\extrlib</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\extrlib\pnglibconf.h">
<Filter>Header Files\extrlib</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\extrlib\zlib.h">
<Filter>Header Files\extrlib</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\filesystem\filesystem.hpp"> <ClInclude Include="..\..\include\nana\filesystem\filesystem.hpp">
<Filter>Header Files\filesystem</Filter> <Filter>Header Files\filesystem</Filter>
</ClInclude> </ClInclude>

View File

@ -1,9 +1,9 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.22823.1 VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{25B21068-491B-4A9F-B99F-6C27BF31BAAD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{98091380-2EC4-44B4-82A2-F0A6393BA908}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,14 +13,14 @@ Global
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.ActiveCfg = Debug|x64 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x64.ActiveCfg = Debug|x64
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.Build.0 = Debug|x64 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x64.Build.0 = Debug|x64
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.ActiveCfg = Debug|Win32 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x86.ActiveCfg = Debug|Win32
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.Build.0 = Debug|Win32 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x86.Build.0 = Debug|Win32
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.ActiveCfg = Release|x64 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x64.ActiveCfg = Release|x64
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.Build.0 = Release|x64 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x64.Build.0 = Release|x64
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.ActiveCfg = Release|Win32 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x86.ActiveCfg = Release|Win32
{25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.Build.0 = Release|Win32 {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -5,14 +5,14 @@
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
@ -22,7 +22,7 @@
<ProjectGuid>{25B21068-491B-4A9F-B99F-6C27BF31BAAD}</ProjectGuid> <ProjectGuid>{25B21068-491B-4A9F-B99F-6C27BF31BAAD}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>nana</RootNamespace> <RootNamespace>nana</RootNamespace>
<TargetPlatformVersion>8.1</TargetPlatformVersion> <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -31,12 +31,6 @@
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
@ -44,6 +38,12 @@
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
@ -54,46 +54,52 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="Shared">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>../../include;../../extrlib/vc2015;$(IncludePath)</IncludePath>
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<LibraryPath>../../extrlib/vc2015;$(LibraryPath)</LibraryPath>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<SourcePath>..\..\source;$(SourcePath)</SourcePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\..\include;$(IncludePath)</IncludePath> <IncludePath>../../include;../../extrlib/vc2015;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<LibraryPath>../../extrlib/vc2015;$(LibraryPath)</LibraryPath>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<SourcePath>..\..\source;$(SourcePath)</SourcePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>../../include;../../extrlib/vc2015;$(IncludePath)</IncludePath>
<LibraryPath>../../extrlib/vc2015;$(LibraryPath)</LibraryPath>
<OutDir>../bin/</OutDir>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<SourcePath>..\..\source;$(SourcePath)</SourcePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>../../include;../../extrlib/vc2015;$(IncludePath)</IncludePath>
<LibraryPath>../../extrlib/vc2015;$(LibraryPath)</LibraryPath>
<OutDir>../bin/</OutDir> <OutDir>../bin/</OutDir>
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
<SourcePath>..\..\source;$(VC_SourcePath);</SourcePath>
<OutDir>../bin/</OutDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName> <TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir> <SourcePath>..\..\source;$(SourcePath)</SourcePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -103,16 +109,11 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Lib>
<OutputFile>$(TargetPath)</OutputFile>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
@ -120,7 +121,7 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
@ -128,7 +129,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Lib> <Lib>
<OutputFile>$(TargetPath)</OutputFile> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -141,7 +142,6 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -149,9 +149,6 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib>
<OutputFile>$(TargetPath)</OutputFile>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -161,7 +158,7 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
@ -171,7 +168,7 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib> <Lib>
<OutputFile>$(TargetPath)</OutputFile> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Lib> </Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -185,7 +182,6 @@
<ClCompile Include="..\..\source\datetime.cpp" /> <ClCompile Include="..\..\source\datetime.cpp" />
<ClCompile Include="..\..\source\deploy.cpp" /> <ClCompile Include="..\..\source\deploy.cpp" />
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" /> <ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" />
<ClCompile Include="..\..\source\exceptions.cpp" />
<ClCompile Include="..\..\source\filesystem\filesystem.cpp" /> <ClCompile Include="..\..\source\filesystem\filesystem.cpp" />
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp" /> <ClCompile Include="..\..\source\filesystem\file_iterator.cpp" />
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp" /> <ClCompile Include="..\..\source\filesystem\fs_utility.cpp" />
@ -244,7 +240,6 @@
<ClCompile Include="..\..\source\internationalization.cpp" /> <ClCompile Include="..\..\source\internationalization.cpp" />
<ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp" /> <ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp" />
<ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp" /> <ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp" />
<ClCompile Include="..\..\source\paint\gadget.cpp" />
<ClCompile Include="..\..\source\paint\graphics.cpp" /> <ClCompile Include="..\..\source\paint\graphics.cpp" />
<ClCompile Include="..\..\source\paint\image.cpp" /> <ClCompile Include="..\..\source\paint\image.cpp" />
<ClCompile Include="..\..\source\paint\image_process_selector.cpp" /> <ClCompile Include="..\..\source\paint\image_process_selector.cpp" />
@ -252,7 +247,6 @@
<ClCompile Include="..\..\source\paint\text_renderer.cpp" /> <ClCompile Include="..\..\source\paint\text_renderer.cpp" />
<ClCompile Include="..\..\source\system\dataexch.cpp" /> <ClCompile Include="..\..\source\system\dataexch.cpp" />
<ClCompile Include="..\..\source\system\platform.cpp" /> <ClCompile Include="..\..\source\system\platform.cpp" />
<ClCompile Include="..\..\source\system\shared_wrapper.cpp" />
<ClCompile Include="..\..\source\system\timepiece.cpp" /> <ClCompile Include="..\..\source\system\timepiece.cpp" />
<ClCompile Include="..\..\source\threads\pool.cpp" /> <ClCompile Include="..\..\source\threads\pool.cpp" />
<ClCompile Include="..\..\source\traits.cpp" /> <ClCompile Include="..\..\source\traits.cpp" />

View File

@ -13,298 +13,286 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter> </Filter>
<Filter Include="Source Files\nana"> <Filter Include="Source Files\audio">
<UniqueIdentifier>{b0bd11b1-bcbb-4e05-885e-44295bc1a7bb}</UniqueIdentifier> <UniqueIdentifier>{9630500a-5aca-4625-a11b-1ba83a93895c}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\audio"> <Filter Include="Source Files\detail">
<UniqueIdentifier>{aab16aa3-c8d4-4495-8606-1b21ae739ee5}</UniqueIdentifier> <UniqueIdentifier>{d43db913-0472-45f6-889e-b147a7b3eb7e}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\audio\detail"> <Filter Include="Source Files\filesystem">
<UniqueIdentifier>{c395f107-7102-415b-a019-54e7cf3575af}</UniqueIdentifier> <UniqueIdentifier>{4e91af62-8e45-41d5-8bb9-1deb850de937}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\detail"> <Filter Include="Source Files\gui">
<UniqueIdentifier>{e2569be2-9e68-477d-8b59-e248595de6c7}</UniqueIdentifier> <UniqueIdentifier>{c575e702-d7d3-48d2-a465-30e51ca72f8d}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\detail\win32"> <Filter Include="Source Files\paint">
<UniqueIdentifier>{52ed7f8e-fa48-495e-af1f-4df013205a35}</UniqueIdentifier> <UniqueIdentifier>{e1fbd69a-2a82-419e-854a-0b5dbd0e0237}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\filesystem"> <Filter Include="Source Files\system">
<UniqueIdentifier>{87d14798-9015-4162-b9ab-72c741cff063}</UniqueIdentifier> <UniqueIdentifier>{295ba47e-9dc7-4375-82bc-443b767eb87d}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\gui"> <Filter Include="Source Files\threads">
<UniqueIdentifier>{4f8e7d23-9fe1-4409-bb03-2bd0809e606b}</UniqueIdentifier> <UniqueIdentifier>{b0854b25-60fc-47e2-a9df-5e4f2d28065c}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\gui\detail"> <Filter Include="Source Files\audio\detail">
<UniqueIdentifier>{85c9c1bb-d87b-4481-bf3c-7425f680a12d}</UniqueIdentifier> <UniqueIdentifier>{b3023f5e-2759-409d-b6e8-5ef2fe6601ae}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\gui\detail\win32"> <Filter Include="Source Files\detail\win32">
<UniqueIdentifier>{8058b530-86ec-4d72-890d-345aa30db056}</UniqueIdentifier> <UniqueIdentifier>{2ce139f3-ef8e-48b7-a82a-68003eac75da}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\gui\widgets"> <Filter Include="Source Files\gui\detail">
<UniqueIdentifier>{87b124cb-408d-460b-a81b-8a788bbae0d9}</UniqueIdentifier> <UniqueIdentifier>{b9f9a5a8-fd1a-4b99-b530-d8a4c45e62ec}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\gui\widgets\skeletons"> <Filter Include="Source Files\gui\widgets">
<UniqueIdentifier>{b10db2f1-0542-421a-9e1d-4357e3be5f68}</UniqueIdentifier> <UniqueIdentifier>{4b04c197-4a1e-41f9-bfa3-d82c18bcad51}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\paint"> <Filter Include="Source Files\gui\detail\win32">
<UniqueIdentifier>{59f186c8-f5f8-4499-8e19-f278d4754220}</UniqueIdentifier> <UniqueIdentifier>{cd6e7f3f-fe5b-44c6-ae8d-15554f926055}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\paint\detail"> <Filter Include="Source Files\gui\widgets\skeletons">
<UniqueIdentifier>{5acf1733-47b2-4872-a105-66c7ad15cd39}</UniqueIdentifier> <UniqueIdentifier>{60f588f2-bdb9-4b1d-9e23-40a73f327283}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Source Files\nana\system"> <Filter Include="Source Files\paint\detail">
<UniqueIdentifier>{a81fa10e-1274-44e0-92a0-434fa28f89ae}</UniqueIdentifier> <UniqueIdentifier>{53feb93f-2b86-4bf5-b2f3-f60ef1bbbf76}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\nana\threads">
<UniqueIdentifier>{e95b4a72-643f-4416-af95-b0bbaf7f0c57}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\source\audio\detail\audio_device.cpp">
<Filter>Source Files\nana\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\detail\audio_stream.cpp">
<Filter>Source Files\nana\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\detail\buffer_preparation.cpp">
<Filter>Source Files\nana\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\player.cpp">
<Filter>Source Files\nana\audio</Filter>
</ClCompile>
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp">
<Filter>Source Files\nana\detail\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp">
<Filter>Source Files\nana\filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp">
<Filter>Source Files\nana\filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\win32\bedrock.cpp">
<Filter>Source Files\nana\gui\detail\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\basic_window.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\drawer.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\native_window_interface.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\window_manager.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\skeletons\text_editor.cpp">
<Filter>Source Files\nana\gui\widgets\skeletons</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\button.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\categorize.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\checkbox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\combox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\date_chooser.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\float_listbox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\form.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\frame.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\label.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\listbox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\menu.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\menubar.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\panel.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\picture.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\progress.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\scroll.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\slider.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\tabbar.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\textbox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\toolbar.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\treebox.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\widget.cpp">
<Filter>Source Files\nana\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\animation.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\basis.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\dragger.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\drawing.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\effects.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\element.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\filebox.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\layout_utility.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\msgbox.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\place.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\programming_interface.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\timer.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\tooltip.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\wvl.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp">
<Filter>Source Files\nana\paint\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp">
<Filter>Source Files\nana\paint\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\gadget.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\graphics.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\image.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\image_process_selector.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\pixel_buffer.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\text_renderer.cpp">
<Filter>Source Files\nana\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\dataexch.cpp">
<Filter>Source Files\nana\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\platform.cpp">
<Filter>Source Files\nana\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\shared_wrapper.cpp">
<Filter>Source Files\nana\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\timepiece.cpp">
<Filter>Source Files\nana\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\threads\pool.cpp">
<Filter>Source Files\nana\threads</Filter>
</ClCompile>
<ClCompile Include="..\..\source\any.cpp"> <ClCompile Include="..\..\source\any.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\basic_types.cpp"> <ClCompile Include="..\..\source\basic_types.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\charset.cpp"> <ClCompile Include="..\..\source\charset.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\datetime.cpp"> <ClCompile Include="..\..\source\datetime.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\deploy.cpp"> <ClCompile Include="..\..\source\deploy.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\exceptions.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\unicode_bidi.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\window_layout.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\element_store.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\bedrock_pi.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\events_operation.cpp">
<Filter>Source Files\nana\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\notifier.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\state_cursor.cpp">
<Filter>Source Files\nana\gui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\internationalization.cpp"> <ClCompile Include="..\..\source\internationalization.cpp">
<Filter>Source Files\nana</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\gui\detail\color_schemes.cpp"> <ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files\nana\gui\detail</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\gui\screen.cpp"> <ClCompile Include="..\..\source\unicode_bidi.cpp">
<Filter>Source Files\nana\gui</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\gui\widgets\spinbox.cpp"> <ClCompile Include="..\..\source\audio\detail\audio_device.cpp">
<Filter>Source Files\nana\gui\widgets</Filter> <Filter>Source Files\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\detail\audio_stream.cpp">
<Filter>Source Files\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\detail\buffer_preparation.cpp">
<Filter>Source Files\audio\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\audio\player.cpp">
<Filter>Source Files\audio</Filter>
</ClCompile>
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp">
<Filter>Source Files\detail\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp">
<Filter>Source Files\filesystem</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\filesystem\filesystem.cpp"> <ClCompile Include="..\..\source\filesystem\filesystem.cpp">
<Filter>Source Files\nana\filesystem</Filter> <Filter>Source Files\filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp">
<Filter>Source Files\filesystem</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\basic_window.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\bedrock_pi.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\color_schemes.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\drawer.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\element_store.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\events_operation.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\native_window_interface.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\window_layout.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\window_manager.cpp">
<Filter>Source Files\gui\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\detail\win32\bedrock.cpp">
<Filter>Source Files\gui\detail\win32</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\skeletons\text_editor.cpp">
<Filter>Source Files\gui\widgets\skeletons</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\button.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\categorize.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\checkbox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\combox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\date_chooser.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\float_listbox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\form.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\frame.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\source\gui\widgets\group.cpp"> <ClCompile Include="..\..\source\gui\widgets\group.cpp">
<Filter>Source Files\nana\gui\widgets</Filter> <Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\label.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\listbox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\menu.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\menubar.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\panel.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\picture.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\progress.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\scroll.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\slider.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\spinbox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\tabbar.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\textbox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\toolbar.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\treebox.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\widgets\widget.cpp">
<Filter>Source Files\gui\widgets</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\animation.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\basis.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\dragger.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\drawing.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\effects.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\element.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\filebox.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\layout_utility.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\msgbox.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\notifier.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\place.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\programming_interface.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\screen.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\state_cursor.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\timer.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\tooltip.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\gui\wvl.cpp">
<Filter>Source Files\gui</Filter>
</ClCompile>
<ClCompile Include="..\..\source\threads\pool.cpp">
<Filter>Source Files\threads</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\dataexch.cpp">
<Filter>Source Files\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\platform.cpp">
<Filter>Source Files\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\system\timepiece.cpp">
<Filter>Source Files\system</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\detail\image_process_provider.cpp">
<Filter>Source Files\paint\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\detail\native_paint_interface.cpp">
<Filter>Source Files\paint\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\graphics.cpp">
<Filter>Source Files\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\image.cpp">
<Filter>Source Files\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\image_process_selector.cpp">
<Filter>Source Files\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\pixel_buffer.cpp">
<Filter>Source Files\paint</Filter>
</ClCompile>
<ClCompile Include="..\..\source\paint\text_renderer.cpp">
<Filter>Source Files\paint</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1 +0,0 @@
The libpng.a is for MinGW(Not linux), and other .lib files are for VS2013

View File

@ -1 +1,5 @@
You can download the precompiled external libraries at http://sourceforge.net/projects/nanapro/files/extrlib/ You can download the precompiled external libraries at http://sourceforge.net/projects/nanapro/files/extrlib/
Extract the ZIP file to the directory nana/extrlib. Then modify the marco switch defined in nana/include/config.hpp header file and rebuild the nana library.
您可以下载预先编译的外部程序库下载地址http://sourceforge.net/projects/nanapro/files/extrlib/
将ZIP文件释放到nana/extrlib目录。然后修改nana/include/config.hpp文件中对应的标志重新编译Nana库即可。

View File

@ -37,7 +37,6 @@
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
//Windows: //Windows:
#define NANA_WINDOWS 1 #define NANA_WINDOWS 1
#define PLATFORM_SPEC_HPP <nana/detail/win32/platform_spec.hpp>
//Test if it is MINGW //Test if it is MINGW
#if defined(__MINGW32__) || defined(__MINGW64__) #if defined(__MINGW32__) || defined(__MINGW64__)
@ -52,7 +51,6 @@
//Linux: //Linux:
#define NANA_LINUX 1 #define NANA_LINUX 1
#define NANA_X11 1 #define NANA_X11 1
#define PLATFORM_SPEC_HPP <nana/detail/linux_X11/platform_spec.hpp>
#define STD_CODECVT_NOT_SUPPORTED #define STD_CODECVT_NOT_SUPPORTED
#else #else
# static_assert(false, "Only Windows and Unix are supported now"); # static_assert(false, "Only Windows and Unix are supported now");
@ -78,12 +76,22 @@
#endif #endif
#endif #endif
///////////////////
//Support for PNG //Support for PNG
// Comment it to disable the feature of support for PNG. // Define the NANA_ENABLE_PNG to enable the support of PNG.
//#define NANA_ENABLE_PNG //
//#define NANA_ENABLE_PNG //!
#if defined(NANA_ENABLE_PNG) #if defined(NANA_ENABLE_PNG)
//Comment it to use libpng from operating system. #define NANA_LIBPNG //Comment it to use libpng from operating system.
#define NANA_LIBPNG #endif
///////////////////
//Support for JPEG
// Define the NANA_ENABLE_JPEG to enable the support of JPEG.
//
//#define NANA_ENABLE_JPEG //!
#if defined(NANA_ENABLE_JPEG)
#define NANA_LIBJPEG //Comment this whole line to use libjpeg from operating system.
#endif #endif

View File

@ -106,6 +106,8 @@ namespace detail
~drawable_impl_type(); ~drawable_impl_type();
void fgcolor(const ::nana::color&); //deprecated void fgcolor(const ::nana::color&); //deprecated
unsigned get_color() const;
unsigned get_text_color() const;
void set_color(const ::nana::color&); void set_color(const ::nana::color&);
void set_text_color(const ::nana::color&); void set_text_color(const ::nana::color&);

View File

@ -0,0 +1,21 @@
/*
* Selector of Platform Specification
* 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/detail/platform_spec_selector.hpp
*
* Selects the proper platform_spec header file for the current platform
*/
#include <nana/config.hpp>
#if defined(NANA_WINDOWS)
#include <nana/detail/win32/platform_spec.hpp>
#else
#include <nana/detail/linux_X11/platform_spec.hpp>
#endif

View File

@ -1,7 +1,7 @@
/* /*
* Platform Specification Implementation * Platform Specification Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -146,6 +146,7 @@ namespace detail
void fgcolor(const ::nana::color&); //deprecated void fgcolor(const ::nana::color&); //deprecated
unsigned get_color() const; unsigned get_color() const;
unsigned get_text_color() const;
void set_color(const ::nana::color&); void set_color(const ::nana::color&);
void set_text_color(const ::nana::color&); void set_text_color(const ::nana::color&);

View File

@ -1,95 +0,0 @@
/*
* Exception Definition
* Copyright(C) 2003-2013 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/exceptions.hpp
*/
#ifndef NANA_EXCEPTIONS_H
#define NANA_EXCEPTIONS_H
#include <exception>
#include <string>
namespace nana
{
/**
* nana::threads::thread::exit throws this exception to exit thread
* this exception is not allowed to be catch by programmer,
* otherwise the thread may not exit
*/
class thrd_exit: public std::exception
{
public:
thrd_exit(unsigned retval);
~thrd_exit() throw();
const char* what() const throw();
unsigned retval() const;
private:
unsigned retval_;
};
/**
* nana::text::settings_t throws this exception if it dose not found a given member
* in a scope
*/
class bad_member: public std::exception
{
public:
bad_member(const std::string& what);
~bad_member() throw();
const char* what() const throw();
private:
std::string what_;
};
/**
* nana::text::settings_t throws this exception if there is a syntax error
*/
class bad_syntax: public std::exception
{
public:
bad_syntax(const std::string& what);
~bad_syntax() throw();
const char* what() const throw();
private:
std::string what_;
};
class bad_error: public std::exception
{
public:
bad_error(const std::string& what);
~bad_error() throw();
const char* what() const throw();
private:
std::string what_;
};
class bad_handle: public std::exception
{
public:
bad_handle(const std::string& what);
~bad_handle() throw();
const char* what() const throw();
private:
std::string what_;
};
class bad_window
:public std::exception
{
public:
bad_window(const char* what);
~bad_window() throw();
const char* what() const throw();
private:
std::string what_;
};
}// end namespace nana
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,596 +0,0 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.8 - February 1, 2012
*
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
*/
/* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text,
* and png_info.
*/
#ifndef PNGCONF_H
#define PNGCONF_H
#ifndef PNG_BUILDING_SYMBOL_TABLE
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
* definition file for machine specific limits, this may impact the
* correctness of the definitons below (see uses of INT_MAX).
*/
# ifndef PNG_NO_LIMITS_H
# include <limits.h>
# endif
/* For the memory copy APIs (i.e. the standard definitions of these),
* because this file defines png_memcpy and so on the base APIs must
* be defined here.
*/
# ifdef BSD
# include <strings.h>
# else
# include <string.h>
# endif
/* For png_FILE_p - this provides the standard definition of a
* FILE
*/
# ifdef PNG_STDIO_SUPPORTED
# include <stdio.h>
# endif
#endif
/* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used to the function is called.
* The library builder sets the default, if read functions are not
* built into the library the macro implementation is forced on.
*/
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
# define PNG_USE_READ_MACROS
#endif
#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
# if PNG_DEFAULT_READ_MACROS
# define PNG_USE_READ_MACROS
# endif
#endif
/* COMPILER SPECIFIC OPTIONS.
*
* These options are provided so that a variety of difficult compilers
* can be used. Some are fixed at build time (e.g. PNG_API_RULE
* below) but still have compiler specific implementations, others
* may be changed on a per-file basis when compiling against libpng.
*/
/* The PNGARG macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr.
* I've always been able to use _NO_PROTO as the indicator, but you may
* need to drag the empty declaration out in front of here, or change the
* ifdef to suit your own needs.
*/
#ifndef PNGARG
# ifdef OF /* zlib prototype munger */
# define PNGARG(arglist) OF(arglist)
# else
# ifdef _NO_PROTO
# define PNGARG(arglist) ()
# else
# define PNGARG(arglist) arglist
# endif /* _NO_PROTO */
# endif /* OF */
#endif /* PNGARG */
/* Function calling conventions.
* =============================
* Normally it is not necessary to specify to the compiler how to call
* a function - it just does it - however on x86 systems derived from
* Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
* and some others) there are multiple ways to call a function and the
* default can be changed on the compiler command line. For this reason
* libpng specifies the calling convention of every exported function and
* every function called via a user supplied function pointer. This is
* done in this file by defining the following macros:
*
* PNGAPI Calling convention for exported functions.
* PNGCBAPI Calling convention for user provided (callback) functions.
* PNGCAPI Calling convention used by the ANSI-C library (required
* for longjmp callbacks and sometimes used internally to
* specify the calling convention for zlib).
*
* These macros should never be overridden. If it is necessary to
* change calling convention in a private build this can be done
* by setting PNG_API_RULE (which defaults to 0) to one of the values
* below to select the correct 'API' variants.
*
* PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
* This is correct in every known environment.
* PNG_API_RULE=1 Use the operating system convention for PNGAPI and
* the 'C' calling convention (from PNGCAPI) for
* callbacks (PNGCBAPI). This is no longer required
* in any known environment - if it has to be used
* please post an explanation of the problem to the
* libpng mailing list.
*
* These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases
* (x86 DOS/Windows sytems) and, even then, this does not apply to
* Cygwin running on those systems.
*
* Note that the value must be defined in pnglibconf.h so that what
* the application uses to call the library matches the conventions
* set when building the library.
*/
/* Symbol export
* =============
* When building a shared library it is almost always necessary to tell
* the compiler which symbols to export. The png.h macro 'PNG_EXPORT'
* is used to mark the symbols. On some systems these symbols can be
* extracted at link time and need no special processing by the compiler,
* on other systems the symbols are flagged by the compiler and just
* the declaration requires a special tag applied (unfortunately) in a
* compiler dependent way. Some systems can do either.
*
* A small number of older systems also require a symbol from a DLL to
* be flagged to the program that calls it. This is a problem because
* we do not know in the header file included by application code that
* the symbol will come from a shared library, as opposed to a statically
* linked one. For this reason the application must tell us by setting
* the magic flag PNG_USE_DLL to turn on the special processing before
* it includes png.h.
*
* Four additional macros are used to make this happen:
*
* PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
* the build or imported if PNG_USE_DLL is set - compiler
* and system specific.
*
* PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
* 'type', compiler specific.
*
* PNG_DLL_EXPORT Set to the magic to use during a libpng build to
* make a symbol exported from the DLL. Not used in the
* public header files; see pngpriv.h for how it is used
* in the libpng build.
*
* PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
* from a DLL - used to define PNG_IMPEXP when
* PNG_USE_DLL is set.
*/
/* System specific discovery.
* ==========================
* This code is used at build time to find PNG_IMPEXP, the API settings
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
* import processing is possible. On Windows/x86 systems it also sets
* compiler-specific macros to the values required to change the calling
* conventions of the various functions.
*/
#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
defined(_M_X64) || defined(_M_IA64) )
/* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
* builds under Cygwin or MinGW. Also includes Watcom builds but these need
* special treatment because they are not compatible with GCC or Visual C
* because of different calling conventions.
*/
# if PNG_API_RULE == 2
/* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom!
*/
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
# define PNGAPI __stdcall
# endif
# else
/* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct
* variants for the compiler.
*/
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
# if PNG_API_RULE == 1 && !defined(PNGAPI)
# define PNGAPI _stdcall
# endif
# endif /* compiler/api */
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
# endif
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
* compilers used '__export' and required this to be after
* the type.
*/
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
#else /* !Windows/x86 */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */
/* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!)
*/
# endif /* other system, !OS/2 */
#endif /* !Windows/x86 */
/* Now do all the defaulting . */
#ifndef PNGCAPI
# define PNGCAPI
#endif
#ifndef PNGCBAPI
# define PNGCBAPI PNGCAPI
#endif
#ifndef PNGAPI
# define PNGAPI PNGCAPI
#endif
/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
* then in an internal header file when building the library, otherwise (when
* using the library) it is set here.
*/
#ifndef PNG_IMPEXP
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
/* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT
# endif
# ifndef PNG_IMPEXP
# define PNG_IMPEXP
# endif
#endif
/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
* 'attributes' as a storage class - the attributes go at the start of the
* function definition, and attributes are always appended regardless of the
* compiler. This considerably simplifies these macros but may cause problems
* if any compilers both need function attributes and fail to handle them as
* a storage class (this is unlikely.)
*/
#ifndef PNG_FUNCTION
# define PNG_FUNCTION(type, name, args, attributes) attributes type name args
#endif
#ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif
/* The ordinal value is only relevant when preprocessing png.h for symbol
* table entries, so we discard it here. See the .dfn files in the
* scripts directory.
*/
#ifndef PNG_EXPORTA
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
extern attributes)
#endif
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
* so make something non-empty to satisfy the requirement:
*/
#define PNG_EMPTY /*empty list*/
#define PNG_EXPORT(ordinal, type, name, args)\
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
/* Use PNG_REMOVED to comment out a removed interface. */
#ifndef PNG_REMOVED
# define PNG_REMOVED(ordinal, type, name, args, attributes)
#endif
#ifndef PNG_CALLBACK
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
#endif
/* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API
* functions in png.h will generate compiler warnings.
*
* Added at libpng-1.2.41.
*/
#ifndef PNG_NO_PEDANTIC_WARNINGS
# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
# define PNG_PEDANTIC_WARNINGS_SUPPORTED
# endif
#endif
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
/* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API
* functions in png.h will generate compiler warnings. Added at libpng
* version 1.2.41.
*/
# if defined(__GNUC__)
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__))
# endif
# ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__))
# endif
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng.")))
# else
# define PNG_PRIVATE \
__attribute__((__deprecated__))
# endif
# endif
# endif /* __GNUC__ */
# if defined(_MSC_VER) && (_MSC_VER >= 1300)
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* not supported */
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __declspec(noreturn)
# endif
# ifndef PNG_ALLOCATED
# if (_MSC_VER >= 1400)
# define PNG_ALLOCATED __declspec(restrict)
# endif
# endif
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __declspec(deprecated)
# endif
# ifndef PNG_PRIVATE
# define PNG_PRIVATE __declspec(deprecated)
# endif
# endif /* _MSC_VER */
#endif /* PNG_PEDANTIC_WARNINGS */
#ifndef PNG_DEPRECATED
# define PNG_DEPRECATED /* Use of this function is deprecated */
#endif
#ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* The result of this function must be checked */
#endif
#ifndef PNG_NORETURN
# define PNG_NORETURN /* This function does not return */
#endif
#ifndef PNG_ALLOCATED
# define PNG_ALLOCATED /* The result of the function is new memory */
#endif
#ifndef PNG_PRIVATE
# define PNG_PRIVATE /* This is a private libpng function */
#endif
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args)
# else /* No floating point APIs */
# define PNG_FP_EXPORT(ordinal, type, name, args)
# endif
#endif
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args)
# else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
# endif
#endif
/* The following uses const char * instead of char * for error
* and warning message functions, so some compilers won't complain.
* If you do not want to use const, define PNG_NO_CONST here.
*
* This should not change how the APIs are called, so it can be done
* on a per-file basis in the application.
*/
#ifndef PNG_CONST
# ifndef PNG_NO_CONST
# define PNG_CONST const
# else
# define PNG_CONST
# endif
#endif
/* Some typedefs to get us started. These should be safe on most of the
* common platforms. The typedefs should be at least as large as the
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
* don't have to be exactly that size. Some compilers dislike passing
* unsigned shorts as function parameters, so you may be better off using
* unsigned int for png_uint_16.
*/
#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
typedef unsigned int png_uint_32;
typedef int png_int_32;
#else
typedef unsigned long png_uint_32;
typedef long png_int_32;
#endif
typedef unsigned short png_uint_16;
typedef short png_int_16;
typedef unsigned char png_byte;
#ifdef PNG_NO_SIZE_T
typedef unsigned int png_size_t;
#else
typedef size_t png_size_t;
#endif
#define png_sizeof(x) (sizeof (x))
/* The following is needed for medium model support. It cannot be in the
* pngpriv.h header. Needs modification for other compilers besides
* MSC. Model independent support declares all arrays and pointers to be
* large using the far keyword. The zlib version used must also support
* model independent data. As of version zlib 1.0.4, the necessary changes
* have been made in zlib. The USE_FAR_KEYWORD define triggers other
* changes that are needed. (Tim Wegner)
*/
/* Separate compiler dependencies (problem here is that zlib.h always
* defines FAR. (SJT)
*/
#ifdef __BORLANDC__
# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
# define LDATA 1
# else
# define LDATA 0
# endif
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
# define PNG_MAX_MALLOC_64K /* only used in build */
# if (LDATA != 1)
# ifndef FAR
# define FAR __far
# endif
# define USE_FAR_KEYWORD
# endif /* LDATA != 1 */
/* Possibly useful for moving data out of default segment.
* Uncomment it if you want. Could also define FARDATA as
* const if your compiler supports it. (SJT)
# define FARDATA FAR
*/
# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
#endif /* __BORLANDC__ */
/* Suggest testing for specific compiler first before testing for
* FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
* making reliance oncertain keywords suspect. (SJT)
*/
/* MSC Medium model */
#ifdef FAR
# ifdef M_I86MM
# define USE_FAR_KEYWORD
# define FARDATA FAR
# include <dos.h>
# endif
#endif
/* SJT: default case */
#ifndef FAR
# define FAR
#endif
/* At this point FAR is always defined */
#ifndef FARDATA
# define FARDATA
#endif
/* Typedef for floating-point numbers that are converted
* to fixed-point with a multiple of 100,000, e.g., gamma
*/
typedef png_int_32 png_fixed_point;
/* Add typedefs for pointers */
typedef void FAR * png_voidp;
typedef PNG_CONST void FAR * png_const_voidp;
typedef png_byte FAR * png_bytep;
typedef PNG_CONST png_byte FAR * png_const_bytep;
typedef png_uint_32 FAR * png_uint_32p;
typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
typedef png_int_32 FAR * png_int_32p;
typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
typedef png_uint_16 FAR * png_uint_16p;
typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
typedef char FAR * png_charp;
typedef PNG_CONST char FAR * png_const_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
typedef png_size_t FAR * png_size_tp;
typedef PNG_CONST png_size_t FAR * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p;
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * png_doublep;
typedef PNG_CONST double FAR * png_const_doublep;
#endif
/* Pointers to pointers; i.e. arrays */
typedef png_byte FAR * FAR * png_bytepp;
typedef png_uint_32 FAR * FAR * png_uint_32pp;
typedef png_int_32 FAR * FAR * png_int_32pp;
typedef png_uint_16 FAR * FAR * png_uint_16pp;
typedef png_int_16 FAR * FAR * png_int_16pp;
typedef PNG_CONST char FAR * FAR * png_const_charpp;
typedef char FAR * FAR * png_charpp;
typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * FAR * png_doublepp;
#endif
/* Pointers to pointers to pointers; i.e., pointer to array */
typedef char FAR * FAR * FAR * png_charppp;
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
* to png_alloc_size_t are not necessary; in fact, it is recommended
* not to use them at all so that the compiler can complain when something
* turns out to be problematic.
* Casts in the other direction (from png_alloc_size_t to png_size_t or
* png_uint_32) should be explicitly applied; however, we do not expect
* to encounter practical situations that require such conversions.
*/
#if defined(__TURBOC__) && !defined(__FLAT__)
typedef unsigned long png_alloc_size_t;
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
typedef unsigned long png_alloc_size_t;
# else
/* This is an attempt to detect an old Windows system where (int) is
* actually 16 bits, in that case png_malloc must have an argument with a
* bigger size to accomodate the requirements of the library.
*/
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
typedef DWORD png_alloc_size_t;
# else
typedef png_size_t png_alloc_size_t;
# endif
# endif
#endif
#endif /* PNGCONF_H */

View File

@ -1,189 +0,0 @@
/* libpng STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
/* Libpng 1.5.8 - February 1, 2012 */
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */
/* and license in png.h */
/* pnglibconf.h */
/* Derived from: scripts/pnglibconf.dfa */
/* If you edit this file by hand you must obey the rules expressed in */
/* pnglibconf.dfa with respect to the dependencies between the following */
/* symbols. It is much better to generate a new file using */
/* scripts/libpngconf.mak */
#ifndef PNGLCONF_H
#define PNGLCONF_H
/* settings */
#define PNG_API_RULE 0
#define PNG_CALLOC_SUPPORTED
#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_MAX_GAMMA_8 11
#define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5
#define PNG_QUANTIZE_RED_BITS 5
#define PNG_sCAL_PRECISION 5
#define PNG_USER_CHUNK_CACHE_MAX 0
#define PNG_USER_CHUNK_MALLOC_MAX 0
#define PNG_USER_HEIGHT_MAX 1000000
#define PNG_USER_WIDTH_MAX 1000000
#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192
/* end of settings */
/* options */
#define PNG_16BIT_SUPPORTED
#define PNG_ALIGN_MEMORY_SUPPORTED
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_bKGD_SUPPORTED
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
#define PNG_CHECK_cHRM_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
#define PNG_FIXED_POINT_SUPPORTED
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
#define PNG_FLOATING_POINT_SUPPORTED
#define PNG_FORMAT_AFIRST_SUPPORTED
#define PNG_FORMAT_BGR_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
#define PNG_READ_ALPHA_MODE_SUPPORTED
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_GAMMA_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_INTERLACING_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#define PNG_READ_INVERT_SUPPORTED
#define PNG_READ_iTXt_SUPPORTED
#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_OPT_PLTE_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
#define PNG_READ_pCAL_SUPPORTED
#define PNG_READ_pHYs_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
#define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
#define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_READ_sPLT_SUPPORTED
#define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_SUPPORTED
#define PNG_READ_tEXt_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_TRANSFORMS_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
#define PNG_SAVE_INT_32_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_tEXt_SUPPORTED
#define PNG_TEXT_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_tRNS_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED
#define PNG_USER_TRANSFORM_INFO_SUPPORTED
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
#define PNG_WARNINGS_SUPPORTED
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED
#define PNG_WRITE_iTXt_SUPPORTED
#define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
#define PNG_WRITE_pCAL_SUPPORTED
#define PNG_WRITE_pHYs_SUPPORTED
#define PNG_WRITE_sBIT_SUPPORTED
#define PNG_WRITE_sCAL_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_WRITE_sPLT_SUPPORTED
#define PNG_WRITE_sRGB_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
#define PNG_WRITE_tEXt_SUPPORTED
#define PNG_WRITE_TEXT_SUPPORTED
#define PNG_WRITE_tIME_SUPPORTED
#define PNG_WRITE_TRANSFORMS_SUPPORTED
#define PNG_WRITE_tRNS_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_zTXt_SUPPORTED
#define PNG_zTXt_SUPPORTED
/* end of options */
#endif /* PNGLCONF_H */

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,7 @@ namespace nana
class performance_manager; class performance_manager;
public: public:
animation(std::size_t fps = 23); animation(std::size_t fps = 23);
~animation();
void push_back(frameset frms); void push_back(frameset frms);
/* /*

View File

@ -12,9 +12,6 @@
#ifndef NANA_GUI_DETAIL_BEDROCK_HPP #ifndef NANA_GUI_DETAIL_BEDROCK_HPP
#define NANA_GUI_DETAIL_BEDROCK_HPP #define NANA_GUI_DETAIL_BEDROCK_HPP
#include "window_manager.hpp"
#include "events_operation.hpp"
#include "runtime_manager.hpp"
#include "general_events.hpp" #include "general_events.hpp"
#include "color_schemes.hpp" #include "color_schemes.hpp"
#include "internal_scope_guard.hpp" #include "internal_scope_guard.hpp"
@ -23,10 +20,12 @@ namespace nana
{ {
namespace detail namespace detail
{ {
struct native_interface;
class element_store; class element_store;
class events_operation;
struct basic_window;
class window_manager;
//class bedrock //class bedrock
//@brief: bedrock is a fundamental core component, it provides a abstract to the OS platform //@brief: bedrock is a fundamental core component, it provides a abstract to the OS platform
// and some basic functions. // and some basic functions.
@ -34,9 +33,7 @@ namespace detail
{ {
bedrock(); bedrock();
public: public:
typedef native_interface interface_type; using core_window_t = basic_window;
typedef window_manager window_manager_t;
typedef window_manager_t::core_window_t core_window_t;
struct thread_context; struct thread_context;
@ -53,7 +50,6 @@ namespace detail
::nana::category::flags category(core_window_t*); ::nana::category::flags category(core_window_t*);
core_window_t* focus(); core_window_t* focus();
native_window_type root(core_window_t*);
void set_menubar_taken(core_window_t*); void set_menubar_taken(core_window_t*);
@ -83,14 +79,13 @@ namespace detail
void undefine_state_cursor(core_window_t*, thread_context*); void undefine_state_cursor(core_window_t*, thread_context*);
widget_colors& get_scheme_template(scheme_factory_base&&); widget_colors& get_scheme_template(scheme_factory_base&&);
std::unique_ptr<widget_colors> make_scheme(scheme_factory_base&&); widget_colors* make_scheme(scheme_factory_base&&);
events_operation& evt_operation();
window_manager& wd_manager();
void manage_form_loader(core_window_t*, bool insert_or_remove);
public: public:
events_operation evt_operation;
window_manager_t wd_manager;
runtime_manager<core_window_t*, bedrock> rt_manager;
bool emit(event_code, core_window_t*, const arg_mouse&, bool ask_update, thread_context*);
bool emit(event_code, core_window_t*, const event_arg&, bool ask_update, thread_context*); bool emit(event_code, core_window_t*, const event_arg&, bool ask_update, thread_context*);
bool emit_drawer(event_code, core_window_t*, const event_arg&, thread_context*); bool emit_drawer(event_code, core_window_t*, const event_arg&, thread_context*);
private: private:

View File

@ -3,6 +3,9 @@
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include "color_schemes.hpp" #include "color_schemes.hpp"
#include "events_operation.hpp"
#include "window_manager.hpp"
#include <set>
namespace nana namespace nana
{ {
@ -11,7 +14,9 @@ namespace nana
struct bedrock::pi_data struct bedrock::pi_data
{ {
color_schemes scheme; color_schemes scheme;
events_operation evt_operation;
window_manager wd_manager;
std::set<core_window_t*> auto_form_set;
}; };
} }
} }

View File

@ -14,7 +14,6 @@
#define NANA_DETAIL_COLOR_SCHEMES_HPP #define NANA_DETAIL_COLOR_SCHEMES_HPP
#include "widget_colors.hpp" #include "widget_colors.hpp"
#include <nana/pat/cloneable.hpp>
namespace nana namespace nana
{ {
@ -27,8 +26,8 @@ namespace nana
virtual ~scheme_factory_base() = default; virtual ~scheme_factory_base() = default;
virtual factory_identifier* get_id() const = 0; virtual factory_identifier* get_id() const = 0;
virtual std::unique_ptr<widget_colors> create() = 0; virtual widget_colors* create() = 0;
virtual std::unique_ptr<widget_colors> create(widget_colors&) = 0; virtual widget_colors* create(widget_colors&) = 0;
}; };
template<typename Scheme> template<typename Scheme>
@ -41,14 +40,14 @@ namespace nana
return &fid_; return &fid_;
} }
std::unique_ptr<widget_colors> create() override widget_colors* create() override
{ {
return std::unique_ptr<widget_colors>(new Scheme); return (new Scheme);
} }
std::unique_ptr<widget_colors> create(widget_colors& other) override widget_colors* create(widget_colors& other) override
{ {
return std::unique_ptr<widget_colors>{new Scheme(static_cast<Scheme&>(other))}; return (new Scheme(static_cast<Scheme&>(other)));
} }
private: private:
static factory_identifier fid_; static factory_identifier fid_;
@ -71,7 +70,7 @@ namespace nana
~color_schemes(); ~color_schemes();
scheme& scheme_template(scheme_factory_base&&); scheme& scheme_template(scheme_factory_base&&);
std::unique_ptr<scheme> create(scheme_factory_base&&); scheme* create(scheme_factory_base&&);
private: private:
implement * impl_; implement * impl_;
}; };

View File

@ -16,7 +16,6 @@
#include <vector> #include <vector>
#include "general_events.hpp" #include "general_events.hpp"
#include <nana/paint/graphics.hpp> #include <nana/paint/graphics.hpp>
//#include <nana/paint/image.hpp> //deprecated
#include <functional> #include <functional>
namespace nana namespace nana

View File

@ -4,6 +4,7 @@
#include <nana/paint/graphics.hpp> #include <nana/paint/graphics.hpp>
#include <nana/paint/pixel_buffer.hpp> #include <nana/paint/pixel_buffer.hpp>
#include <nana/gui/layout_utility.hpp> #include <nana/gui/layout_utility.hpp>
#include <nana/gui/detail/window_layout.hpp>
namespace nana{ namespace nana{
namespace detail namespace detail
@ -14,7 +15,7 @@ namespace nana{
edge_nimbus_renderer() = default; edge_nimbus_renderer() = default;
public: public:
using core_window_t = CoreWindow; using core_window_t = CoreWindow;
using window_layer = window_layout; using window_layer = ::nana::detail::window_layout;
using graph_reference = ::nana::paint::graphics&; using graph_reference = ::nana::paint::graphics&;
static edge_nimbus_renderer& instance() static edge_nimbus_renderer& instance()

View File

@ -6,9 +6,9 @@
#include <unordered_map> #include <unordered_map>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) #if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_mutex.hpp> #include <nana/std_mutex.hpp>
#else #else
#include <mutex> #include <mutex>
#endif #endif
namespace nana namespace nana
@ -24,8 +24,8 @@ namespace nana
void cancel(event_handle); void cancel(event_handle);
void erase(event_handle); void erase(event_handle);
private: private:
mutable std::recursive_mutex mutex_; std::recursive_mutex mutex_;
std::unordered_set<event_handle> register_; std::unordered_set<event_handle> handles_;
std::unordered_map<window, std::shared_ptr<general_events>> evt_table_; std::unordered_map<window, std::shared_ptr<general_events>> evt_table_;
}; };
}//end namespace detail }//end namespace detail

View File

@ -1,100 +0,0 @@
/*
* A Runtime Manager Implementation
* Copyright(C) 2003-2013 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/runtime_manager.hpp
*
*/
#ifndef NANA_GUI_DETAIL_RUNTIME_MANAGER_HPP
#define NANA_GUI_DETAIL_RUNTIME_MANAGER_HPP
#include <map>
namespace nana
{
namespace detail
{
template<typename Window, typename Bedrock>
class runtime_manager
{
public:
typedef Window window_handle;
template<typename Form, typename... Args>
Form* create_form(Args&&... args)
{
widget_placer<Form> * holder = new widget_placer<Form>;
if (holder->create(std::forward<Args>(args)...))
{
holder_[holder->get_handle()] = holder;
return holder->get();
}
delete holder;
return nullptr;
}
void remove_if_exists(window_handle wd)
{
auto i = holder_.find(wd);
if(i != holder_.cend())
{
delete i->second;
holder_.erase(i);
}
}
private:
class widget_holder
{
public:
virtual ~widget_holder(){}
virtual window_handle get_handle() const = 0;
};
template<typename Form>
class widget_placer : public widget_holder
{
public:
widget_placer()
: form_(nullptr)
{}
~widget_placer()
{
delete form_;
}
template<typename... Args>
bool create(Args&&... args)
{
if (nullptr == form_)
form_ = new Form(std::forward<Args>(args)...);
return (form_ && !form_->empty());
}
Form* get() const
{
return form_;
}
window_handle get_handle() const override
{
return reinterpret_cast<window_handle>(form_ ? form_->handle() : nullptr);
}
private:
Form * form_;
};
private:
std::map<window_handle, widget_holder*> holder_;
}; //end class runtime_manager
}//end namespace detail
}//end namespace nana
#endif

View File

@ -134,7 +134,6 @@ namespace detail
bool get_graphics(core_window_t*, nana::paint::graphics&); bool get_graphics(core_window_t*, nana::paint::graphics&);
bool get_visual_rectangle(core_window_t*, nana::rectangle&); bool get_visual_rectangle(core_window_t*, nana::rectangle&);
::nana::widget* get_widget(core_window_t*) const;
std::vector<core_window_t*> get_children(core_window_t*) const; std::vector<core_window_t*> get_children(core_window_t*) const;
bool set_parent(core_window_t* wd, core_window_t* new_parent); bool set_parent(core_window_t* wd, core_window_t* new_parent);
core_window_t* set_focus(core_window_t*, bool root_has_been_focused); core_window_t* set_focus(core_window_t*, bool root_has_been_focused);
@ -161,6 +160,9 @@ namespace detail
std::vector<std::pair<core_window_t*, unsigned long>> shortkeys(core_window_t*, bool with_children); std::vector<std::pair<core_window_t*, unsigned long>> shortkeys(core_window_t*, bool with_children);
core_window_t* find_shortkey(native_window_type, unsigned long key); core_window_t* find_shortkey(native_window_type, unsigned long key);
void set_safe_place(core_window_t* wd, std::function<void()>&& fn);
void call_safe_place(unsigned thread_id);
private: private:
void _m_disengage(core_window_t*, core_window_t* for_new); void _m_disengage(core_window_t*, core_window_t* for_new);
void _m_destroy(core_window_t*); void _m_destroy(core_window_t*);

View File

@ -47,7 +47,7 @@ namespace nana
public: public:
bground_transparent(std::size_t percent); bground_transparent(std::size_t percent);
private: private:
virtual bground_interface* create() const; bground_interface* create() const override;
private: private:
std::size_t percent_; std::size_t percent_;
}; };
@ -58,7 +58,7 @@ namespace nana
public: public:
bground_blur(std::size_t radius); bground_blur(std::size_t radius);
private: private:
virtual bground_interface * create() const; bground_interface * create() const override;
private: private:
std::size_t radius_; std::size_t radius_;
}; };

View File

@ -27,19 +27,35 @@ namespace nana
namespace element namespace element
{ {
class element_interface namespace detail
{
class element_abstract
{ {
public: public:
using graph_reference = paint::graphics&; using graph_reference = ::nana::paint::graphics&;
virtual ~element_abstract() = default;
};
virtual ~element_interface() = default; class factory_abstract
{
public:
virtual ~factory_abstract() = default;
virtual void destroy(element_abstract *);
};
}
class element_interface
: public detail::element_abstract
{
public:
virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) = 0; virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) = 0;
}; };
class crook_interface class crook_interface
: public detail::element_abstract
{ {
public: public:
using graph_reference = paint::graphics&;
using state = checkstate; using state = checkstate;
struct data struct data
@ -48,24 +64,20 @@ namespace nana
bool radio; bool radio;
}; };
virtual ~crook_interface() = default;
virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state, const data&) = 0; virtual bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state, const data&) = 0;
}; };
class border_interface class border_interface
: public detail::element_abstract
{ {
public: public:
using graph_reference = paint::graphics&;
virtual ~border_interface() = default;
virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, unsigned weight) = 0; virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, unsigned weight) = 0;
}; };
class arrow_interface class arrow_interface
: public detail::element_abstract
{ {
public: public:
using graph_reference = paint::graphics&;
virtual ~arrow_interface() = default;
virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, direction) = 0; virtual bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state, direction) = 0;
}; };
@ -74,10 +86,10 @@ namespace nana
public: public:
template<typename ElementInterface> template<typename ElementInterface>
struct factory_interface struct factory_interface
: public detail::factory_abstract
{ {
virtual ~factory_interface(){} virtual ~factory_interface(){}
virtual ElementInterface* create() const = 0; virtual ElementInterface* create() const = 0;
virtual void destroy(ElementInterface*) const = 0;
}; };
template<typename Element, typename ElementInterface> template<typename Element, typename ElementInterface>
@ -85,38 +97,39 @@ namespace nana
: public factory_interface<ElementInterface> : public factory_interface<ElementInterface>
{ {
public: public:
typedef factory_interface<ElementInterface> interface_type; using interface_type = factory_interface<ElementInterface>;
ElementInterface * create() const override ElementInterface * create() const override
{ {
return (new Element); return (new Element);
} }
void destroy(ElementInterface * p) const override
{
delete p;
}
}; };
void add_crook(const std::string& name, const pat::cloneable<factory_interface<crook_interface>>&);
crook_interface* const * keeper_crook(const std::string& name);
void add_border(const std::string&, const pat::cloneable<factory_interface<border_interface>>&);
border_interface* const * keeper_border(const std::string&);
void add_arrow(const std::string&, const pat::cloneable<factory_interface<arrow_interface>>&); void add_arrow(const std::string&, const pat::cloneable<factory_interface<arrow_interface>>&);
arrow_interface* const * keeper_arrow(const std::string&); arrow_interface* const * cite_arrow(const std::string&);
void add_border(const std::string&, const pat::cloneable<factory_interface<border_interface>>&);
border_interface* const * cite_border(const std::string&);
void add_button(const std::string&, const pat::cloneable<factory_interface<element_interface>>&); void add_button(const std::string&, const pat::cloneable<factory_interface<element_interface>>&);
element_interface* const* keeper_button(const std::string&); element_interface* const* cite_button(const std::string&);
void add_x_icon(const std::string& name, const pat::cloneable<factory_interface<element_interface>>&);
element_interface* const* cite_x_icon(const std::string&);
void add_crook(const std::string& name, const pat::cloneable<factory_interface<crook_interface>>&);
crook_interface* const * cite_crook(const std::string& name);
void add_cross(const std::string& name, const pat::cloneable<factory_interface<element_interface>>&);
element_interface* const* cite_cross(const std::string&);
}; };
class crook; class arrow;
template<typename UserElement> template<typename ArrowElement>
void add_crook(const std::string& name) void add_arrow(const std::string& name)
{ {
using factory_t = provider::factory<UserElement, crook_interface>; using factory_t = provider::factory<ArrowElement, arrow_interface>;
provider().add_crook(name, pat::cloneable<typename factory_t::interface_type>(factory_t())); provider().add_arrow(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
} }
class border; class border;
@ -127,14 +140,6 @@ namespace nana
provider().add_border(name, pat::cloneable<typename factory_t::interface_type>(factory_t())); provider().add_border(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
} }
class arrow;
template<typename ArrowElement>
void add_arrow(const std::string& name)
{
using factory_t = provider::factory<ArrowElement, arrow_interface>;
provider().add_arrow(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
}
class button; class button;
template<typename ButtonElement> template<typename ButtonElement>
void add_button(const std::string& name) void add_button(const std::string& name)
@ -142,6 +147,30 @@ namespace nana
using factory_t = provider::factory<ButtonElement, element_interface>; using factory_t = provider::factory<ButtonElement, element_interface>;
provider().add_button(name, pat::cloneable<typename factory_t::interface_type>(factory_t())); provider().add_button(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
} }
class x_icon;
template<typename UserElement>
void add_x_icon(const std::string& name)
{
using factory_t = provider::factory<UserElement, element_interface>;
provider().add_x_icon(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
}
class crook;
template<typename UserElement>
void add_crook(const std::string& name)
{
using factory_t = provider::factory<UserElement, crook_interface>;
provider().add_crook(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
}
class cross;
template<typename UserElement>
void add_cross(const std::string& name)
{
using factory_t = provider::factory<UserElement, element_interface>;
provider().add_cross(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
}
}//end namespace element }//end namespace element
template<typename Element> class facade; template<typename Element> class facade;
@ -169,9 +198,27 @@ namespace nana
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state) override; bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state) override;
private: private:
element::crook_interface::data data_; element::crook_interface::data data_;
element::crook_interface* const * keeper_; element::crook_interface* const * cite_;
}; //end class facade<element::crook> }; //end class facade<element::crook>
template<> class facade<element::cross>
: public element::element_interface
{
public:
facade(const char* name = nullptr);
void switch_to(const char*);
void thickness(unsigned thk);
void size(unsigned size_pixels);
public:
//Implement element_interface
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
private:
unsigned thickness_{6};
unsigned size_{ 14 };
element::element_interface* const * cite_;
};
template<> template<>
class facade<element::border> class facade<element::border>
: public element::element_interface : public element::element_interface
@ -185,7 +232,7 @@ namespace nana
//Implement element_interface //Implement element_interface
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override; bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
private: private:
element::border_interface* const * keeper_; element::border_interface* const * cite_;
};//end class facade<element::border> };//end class facade<element::border>
template<> template<>
@ -207,7 +254,7 @@ namespace nana
//Implement element_interface //Implement element_interface
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override; bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
private: private:
element::arrow_interface* const * keeper_; element::arrow_interface* const * cite_;
::nana::direction dir_{::nana::direction::north}; ::nana::direction dir_{::nana::direction::north};
};//end class facade<element::arrow> };//end class facade<element::arrow>
@ -222,9 +269,22 @@ namespace nana
//Implement element_interface //Implement element_interface
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override; bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
private: private:
element::element_interface* const * keeper_; element::element_interface* const * cite_;
};//end class facade<element::button> };//end class facade<element::button>
template<>
class facade<element::x_icon>
: public element::element_interface
{
public:
facade(const char* name = nullptr);
void switch_to(const char*);
public:
//Implement element_interface
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
private:
element::element_interface* const * cite_;
};//end class facade<element::button>
namespace element namespace element
{ {

View File

@ -109,9 +109,11 @@ namespace nana
window window_handle() const; window window_handle() const;
void div(const char* s); ///< Divides the attached widget into fields. void div(const char* s); ///< Divides the attached widget into fields.
void modify(const char* field_name, const char* div_text); ///< Modifies a specified field.
field_reference field(const char* name);///< Returns a field with the specified name. field_reference field(const char* name);///< Returns a field with the specified name.
void field_visible(const char* filed_name, bool visible); ///<<Shows/Hides an existing field. void field_visible(const char* field_name, bool visible); ///<<Shows/Hides an existing field.
bool field_visible(const char* field_name) const; ///<Determines whether the specified field is visible. bool field_visible(const char* field_name) const; ///<Determines whether the specified field is visible.
void field_display(const char* field_name, bool display); ///<Displays/Discards an existing field. void field_display(const char* field_name, bool display); ///<Displays/Discards an existing field.
@ -122,6 +124,19 @@ namespace nana
void erase(window handle); ///< Erases a window from field. void erase(window handle); ///< Erases a window from field.
field_reference operator[](const char* name); ///< Returns a field with the specified name. Equal to field(); field_reference operator[](const char* name); ///< Returns a field with the specified name. Equal to field();
/// Add a panel factory
template<typename Panel, typename ...Args>
place& dock(const std::string& dockname, const std::string& factory_name, Args&& ... args)
{
return dock(dockname, factory_name, std::bind([](window parent, Args & ... args)
{
return std::unique_ptr<widget>(new Panel(parent, std::forward<Args>(args)...));
}, std::placeholders::_1, args...));
}
place& dock(const std::string& dockname, std::string factory_name, std::function<std::unique_ptr<widget>(window)> factory);
place& dock_create(const std::string& factory);
private: private:
implement * impl_; implement * impl_;
}; };

View File

@ -13,9 +13,9 @@
#ifndef NANA_GUI_PROGRAMMING_INTERFACE_HPP #ifndef NANA_GUI_PROGRAMMING_INTERFACE_HPP
#define NANA_GUI_PROGRAMMING_INTERFACE_HPP #define NANA_GUI_PROGRAMMING_INTERFACE_HPP
#include <nana/config.hpp> #include <nana/config.hpp>
#include "detail/bedrock.hpp"
#include "effects.hpp" #include "effects.hpp"
#include "detail/general_events.hpp" #include "detail/general_events.hpp"
#include "detail/color_schemes.hpp"
#include <nana/paint/image.hpp> #include <nana/paint/image.hpp>
#include <memory> #include <memory>
@ -29,6 +29,13 @@ namespace nana
/// Traits for widget classes /// Traits for widget classes
template<typename Widget> template<typename Widget>
struct widget_traits struct widget_traits
{
using event_type = typename Widget::event_type;
using scheme_type = typename Widget::scheme_type;
};
template<>
struct widget_traits<widget>
{ {
using event_type = ::nana::general_events; using event_type = ::nana::general_events;
using scheme_type = ::nana::widget_colors; using scheme_type = ::nana::widget_colors;
@ -37,6 +44,11 @@ namespace nana
namespace API namespace API
{ {
namespace detail
{
::nana::widget_colors* make_scheme(::nana::detail::scheme_factory_base&&);
}
void effects_edge_nimbus(window, effects::edge_nimbus); void effects_edge_nimbus(window, effects::edge_nimbus);
effects::edge_nimbus effects_edge_nimbus(window); effects::edge_nimbus effects_edge_nimbus(window);
@ -53,8 +65,7 @@ namespace API
template<typename Scheme> template<typename Scheme>
std::unique_ptr<Scheme> make_scheme() std::unique_ptr<Scheme> make_scheme()
{ {
return std::unique_ptr<Scheme>( return std::unique_ptr<Scheme>{static_cast<Scheme*>(API::detail::make_scheme(::nana::detail::scheme_factory<Scheme>()))};
static_cast<Scheme*>(::nana::detail::bedrock::instance().make_scheme(::nana::detail::scheme_factory<Scheme>()).release()));
} }
void set_scheme(window, widget_colors*); void set_scheme(window, widget_colors*);
@ -75,9 +86,56 @@ namespace API
}//end namespace dev }//end namespace dev
widget* get_widget(window);
namespace detail namespace detail
{ {
general_events* get_general_events(window); general_events* get_general_events(window);
bool emit_event(event_code, window, const ::nana::event_arg&);
class enum_widgets_function_base
{
public:
virtual ~enum_widgets_function_base() = default;
void enum_widgets(window, bool recursive);
private:
virtual bool _m_enum_fn(::nana::widget*) = 0;
};
template<typename Widget, typename EnumFunction>
class enum_widgets_function
: public enum_widgets_function_base
{
public:
enum_widgets_function(EnumFunction && enum_fn)
: enum_fn_(static_cast<EnumFunction&&>(enum_fn))
{}
private:
bool _m_enum_fn(::nana::widget* wd) override
{
return _m_enum_call<Widget>(wd, nullptr);
}
template<typename T, typename std::enable_if<std::is_same<::nana::widget, T>::value>::type* = nullptr>
bool _m_enum_call(::nana::widget* wd)
{
enum_fn_(*wd);
return true;
}
template<typename T, typename std::enable_if<!std::is_same<::nana::widget, T>::value>::type* = nullptr>
bool _m_enum_call(::nana::widget* wd)
{
auto ptr = dynamic_cast<Widget*>(wd);
if (nullptr == ptr)
return false;
enum_fn_(*ptr);
return true;
}
private:
EnumFunction && enum_fn_;
};
}//end namespace detail }//end namespace detail
void exit(); void exit();
@ -91,25 +149,12 @@ namespace API
rectangle make_center(window, unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the window rectangle make_center(window, unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the window
template<typename Widget=::nana::widget, typename EnumFunction> template<typename Widget=::nana::widget, typename EnumFunction>
void enum_widgets(window wd, bool recursive, EnumFunction && ef) void enum_widgets(window wd, bool recursive, EnumFunction && fn)
{ {
static_assert(std::is_convertible<Widget, ::nana::widget>::value, "enum_widgets<Widget>: The specified Widget is not a widget type."); static_assert(std::is_convertible<Widget, ::nana::widget>::value, "enum_widgets<Widget>: The specified Widget is not a widget type.");
typedef ::nana::detail::basic_window core_window_t; detail::enum_widgets_function<Widget, EnumFunction> enum_fn(static_cast<EnumFunction&&>(fn));
auto & brock = ::nana::detail::bedrock::instance(); enum_fn.enum_widgets(wd, recursive);
internal_scope_guard lock;
auto children = brock.wd_manager.get_children(reinterpret_cast<core_window_t*>(wd));
for (auto child : children)
{
auto wgt = dynamic_cast<Widget*>(brock.wd_manager.get_widget(child));
if (nullptr == wgt)
continue;
ef(*wgt);
if (recursive)
enum_widgets<Widget>(wd, recursive, std::forward<EnumFunction>(ef));
}
} }
void window_icon_default(const paint::image& small_icon, const paint::image& big_icon = {}); void window_icon_default(const paint::image& small_icon, const paint::image& big_icon = {});
@ -165,8 +210,7 @@ namespace API
template<typename EventArg, typename std::enable_if<std::is_base_of< ::nana::event_arg, EventArg>::value>::type* = nullptr> template<typename EventArg, typename std::enable_if<std::is_base_of< ::nana::event_arg, EventArg>::value>::type* = nullptr>
bool emit_event(event_code evt_code, window wd, const EventArg& arg) bool emit_event(event_code evt_code, window wd, const EventArg& arg)
{ {
auto & brock = ::nana::detail::bedrock::instance(); return detail::emit_event(evt_code, wd, arg);
return brock.emit(evt_code, reinterpret_cast< ::nana::detail::bedrock::core_window_t*>(wd), arg, true, brock.get_thread_context());
} }
void umake_event(event_handle); void umake_event(event_handle);
@ -191,7 +235,7 @@ namespace API
} }
point window_position(window); point window_position(window);
void move_window(window, int x, int y); void move_window(window, const point&);
void move_window(window wd, const rectangle&); void move_window(window wd, const rectangle&);
void bring_top(window, bool activated); void bring_top(window, bool activated);
@ -298,6 +342,8 @@ namespace API
bool ignore_mouse_focus(window, bool ignore); ///< Enables/disables the mouse focus, it returns the previous state 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 bool ignore_mouse_focus(window); ///< Determines whether the mouse focus is enabled
void at_safe_place(window, std::function<void()>);
}//end namespace API }//end namespace API
}//end namespace nana }//end namespace nana

View File

@ -87,9 +87,6 @@ namespace drawerbase
void add(checkbox&); void add(checkbox&);
std::size_t checked() const; ///< Retrieves the index of the checkbox which is checked. std::size_t checked() const; ///< Retrieves the index of the checkbox which is checked.
std::size_t size() const; std::size_t size() const;
private:
void _m_checked(const arg_click&);
void _m_destroy(const arg_destroy&);
private: private:
std::vector<element_tag> ui_container_; std::vector<element_tag> ui_container_;
}; };

View File

@ -14,7 +14,7 @@
#define NANA_GUI_WIDGETS_COMBOX_HPP #define NANA_GUI_WIDGETS_COMBOX_HPP
#include "widget.hpp" #include "widget.hpp"
#include "float_listbox.hpp" #include "float_listbox.hpp"
#include "skeletons/text_editor_scheme.hpp" #include "skeletons/text_editor_part.hpp"
#include <nana/key_type.hpp> #include <nana/key_type.hpp>
#include <nana/concepts.hpp> #include <nana/concepts.hpp>
#include <functional> #include <functional>
@ -228,15 +228,5 @@ namespace nana
void _m_caption(nana::string&&) override; void _m_caption(nana::string&&) override;
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override; nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
}; };
namespace dev
{
template<>
struct widget_traits<combox>
{
using event_type = drawerbase::combox::combox_events;
using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
};
}
} }
#endif #endif

View File

@ -166,9 +166,7 @@ namespace nana
std::size_t pos_{0}; std::size_t pos_{0};
}; };
using selection = std::vector<index_pair>;
typedef std::vector<index_pair> selection;
/// struct essence_t /// struct essence_t
///@brief: this struct gives many data for listbox, ///@brief: this struct gives many data for listbox,
@ -185,9 +183,7 @@ namespace nana
public: public:
trigger(); trigger();
~trigger(); ~trigger();
//essence_t& essence(); //deprecated
essence_t& essence() const; essence_t& essence() const;
void draw();
private: private:
void _m_draw_border(); void _m_draw_border();
private: private:
@ -372,6 +368,9 @@ namespace nana
item_proxy iter{ ess_, index_pair(pos_, size() - 1) }; item_proxy iter{ ess_, index_pair(pos_, size() - 1) };
if (set_value) if (set_value)
iter.value(std::forward<T>(t)); iter.value(std::forward<T>(t));
_m_update();
return iter; return iter;
} }
@ -441,6 +440,7 @@ namespace nana
private: private:
void _m_append(std::vector<cell> && cells); void _m_append(std::vector<cell> && cells);
void _m_cat_by_pos(); void _m_cat_by_pos();
void _m_update();
private: private:
essence_t* ess_{nullptr}; essence_t* ess_{nullptr};
category_t* cat_{nullptr}; category_t* cat_{nullptr};
@ -450,7 +450,7 @@ namespace nana
struct export_options struct export_options
{ {
nana::string sep = nana::string {STR("\t" )}, nana::string sep = nana::string {STR("\t" )},
endl= nana::string {STR("\n")} ; endl= nana::string {STR("\n")};
bool only_selected_items{true}, bool only_selected_items{true},
only_checked_items {false}, only_checked_items {false},
only_visible_columns{true}; only_visible_columns{true};
@ -558,7 +558,11 @@ By \a clicking on one header the list get \a reordered, first up, and then down
listbox(window, bool visible); listbox(window, bool visible);
listbox(window, const rectangle& = {}, bool visible = true); listbox(window, const rectangle& = {}, bool visible = true);
void auto_draw(bool); ///< Set state: Redraw automatically after an operation? void auto_draw(bool); ///< Set state: Redraw automatically after an operation
/// Scrolls the view to the first or last item of a specified category
void scroll(bool to_bottom, size_type cat_pos = ::nana::npos);
void scroll(bool to_bottom, const index_pair& pos);
/// Appends a new column with a header text and the specified width at the end, and return it position /// Appends a new column with a header text and the specified width at the end, and return it position
size_type append_header(nana::string header_text, unsigned width = 120); size_type append_header(nana::string header_text, unsigned width = 120);
@ -663,15 +667,5 @@ By \a clicking on one header the list get \a reordered, first up, and then down
drawerbase::listbox::category_t* _m_at_key(std::shared_ptr<nana::detail::key_interface>); drawerbase::listbox::category_t* _m_at_key(std::shared_ptr<nana::detail::key_interface>);
void _m_erase_key(nana::detail::key_interface*); void _m_erase_key(nana::detail::key_interface*);
}; };
namespace dev
{
template<>
struct widget_traits<listbox>
{
using event_type = drawerbase::listbox::listbox_events;
using scheme_type = drawerbase::listbox::scheme;
};
}
}//end namespace nana }//end namespace nana
#endif #endif

View File

@ -14,7 +14,6 @@
#define NANA_GUI_WIDGET_SCROLL_HPP #define NANA_GUI_WIDGET_SCROLL_HPP
#include "widget.hpp" #include "widget.hpp"
#include <nana/paint/gadget.hpp>
#include <nana/gui/timer.hpp> #include <nana/gui/timer.hpp>
namespace nana namespace nana
@ -150,8 +149,9 @@ namespace nana
bool make_step(bool forward, unsigned multiple) bool make_step(bool forward, unsigned multiple)
{ {
if (graph_) if (!graph_)
{ return false;
size_type step = (multiple > 1 ? metrics_.step * multiple : metrics_.step); size_type step = (multiple > 1 ? metrics_.step * multiple : metrics_.step);
size_type value = metrics_.value; size_type value = metrics_.value;
if (forward) if (forward)
@ -181,8 +181,6 @@ namespace nana
} }
return false; return false;
} }
return false;
}
private: private:
void attached(widget_reference widget, graph_reference graph) override void attached(widget_reference widget, graph_reference graph) override
{ {
@ -244,6 +242,11 @@ namespace nana
} }
} }
void dbl_click(graph_reference graph, const arg_mouse& arg) override
{
mouse_down(graph, arg);
}
void mouse_down(graph_reference graph, const arg_mouse& arg) override void mouse_down(graph_reference graph, const arg_mouse& arg) override
{ {
if (arg.left_button) if (arg.left_button)
@ -330,14 +333,61 @@ namespace nana
}//end namespace scroll }//end namespace scroll
}//end namespace drawerbase }//end namespace drawerbase
class scroll_interface
{
public:
using size_type = std::size_t;
virtual ~scroll_interface() = default;
/// \brief Determines whether it is scrollable.
/// @param for_less whether it can be scrolled for a less value (backward or "up" if true, forward or "down" if false).
virtual bool scrollable(bool for_less) const = 0;
/// the whole total (peak)
virtual size_type amount() const = 0;
virtual void amount(size_type peak) = 0;
/// Get the range of the widget (how many is shonw on a page, that is, How many to scroll after click on first or second)
virtual size_type range() const = 0;
/// Set the range of the widget.
virtual void range(size_type r) = 0;
/// \brief Get the value (current offset calculated from the very beginnig)
/// @return the value.
virtual size_type value() const = 0;
/// \brief Set the value.
/// @param s a new value.
virtual void value(size_type s) = 0;
/// \brief Get the step of the sroll widget. The step indicates a variation of the value.
/// @return the step.
virtual size_type step() const = 0;
/// \brief Set the step.
/// @param s a value for step.
virtual void step(size_type s) = 0;
/// \brief Increase/decrease values by a step (alternativelly by some number of steps).
/// @param forward it determines whether increase or decrease.
/// @return true if the value is changed.
virtual bool make_step(bool forward, unsigned steps = 1) = 0;
virtual window window_handle() const = 0;
};
/// Provides a way to display an object which is larger than the window's client area. /// Provides a way to display an object which is larger than the window's client area.
template<bool Vertical> template<bool Vertical>
class scroll // add a widget scheme? class scroll // add a widget scheme?
: public widget_object<category::widget_tag, drawerbase::scroll::trigger<Vertical>, drawerbase::scroll::scroll_events> : public widget_object<category::widget_tag, drawerbase::scroll::trigger<Vertical>, drawerbase::scroll::scroll_events>,
public scroll_interface
{ {
typedef widget_object<category::widget_tag, drawerbase::scroll::trigger<Vertical> > base_type; typedef widget_object<category::widget_tag, drawerbase::scroll::trigger<Vertical> > base_type;
public: public:
typedef std::size_t size_type;
/// \brief The default constructor without creating the widget. /// \brief The default constructor without creating the widget.
scroll(){} scroll(){}
@ -361,59 +411,58 @@ namespace nana
/// \brief Determines whether it is scrollable. /// \brief Determines whether it is scrollable.
/// @param for_less whether it can be scrolled for a less value (backward or "up" if true, forward or "down" if false). /// @param for_less whether it can be scrolled for a less value (backward or "up" if true, forward or "down" if false).
bool scrollable(bool for_less) const bool scrollable(bool for_less) const override
{ {
auto & m = this->get_drawer_trigger().metrics(); auto & m = this->get_drawer_trigger().metrics();
return (for_less ? (0 != m.value) : (m.value < m.peak - m.range)); return (for_less ? (0 != m.value) : (m.value < m.peak - m.range));
} }
/// the whole total (peak) /// the whole total (peak)
size_type amount() const size_type amount() const override
{ {
return this->get_drawer_trigger().metrics().peak; return this->get_drawer_trigger().metrics().peak;
} }
void amount(size_type Max) void amount(size_type peak) override
{ {
return this->get_drawer_trigger().peak(Max); return this->get_drawer_trigger().peak(peak);
} }
/// Get the range of the widget (how many is shonw on a page, that is, How many to scroll after click on first or second) /// Get the range of the widget (how many is shonw on a page, that is, How many to scroll after click on first or second)
size_type range() const size_type range() const override
{ {
return this->get_drawer_trigger().metrics().range; return this->get_drawer_trigger().metrics().range;
} }
/// Set the range of the widget. /// Set the range of the widget.
void range(size_type r) void range(size_type r) override
{ {
return this->get_drawer_trigger().range(r); return this->get_drawer_trigger().range(r);
} }
/// \brief Get the value (current offset calculated from the very beginnig) /// \brief Get the value (current offset calculated from the very beginnig)
/// @return the value. /// @return the value.
size_type value() const size_type value() const override
{ {
return this->get_drawer_trigger().metrics().value; return this->get_drawer_trigger().metrics().value;
} }
/// \brief Set the value. /// \brief Set the value.
/// @param s a new value. /// @param s a new value.
void value(size_type s) void value(size_type s) override
{ {
return this->get_drawer_trigger().value(s); return this->get_drawer_trigger().value(s);
} }
/// \brief Get the step of the sroll widget. The step indicates a variation of the value. /// \brief Get the step of the sroll widget. The step indicates a variation of the value.
/// @return the step. /// @return the step.
size_type step() const size_type step() const override
{ {
return this->get_drawer_trigger().metrics().step; return this->get_drawer_trigger().metrics().step;
} }
/// \brief Set the step. /// \brief Set the step.
/// @param s a value for step. /// @param s a value for step.
void step(size_type s) void step(size_type s) override
{ {
return this->get_drawer_trigger().step(s); return this->get_drawer_trigger().step(s);
} }
@ -421,7 +470,7 @@ namespace nana
/// \brief Increase/decrease values by a step (alternativelly by some number of steps). /// \brief Increase/decrease values by a step (alternativelly by some number of steps).
/// @param forward it determines whether increase or decrease. /// @param forward it determines whether increase or decrease.
/// @return true if the value is changed. /// @return true if the value is changed.
bool make_step(bool forward, unsigned steps = 1) bool make_step(bool forward, unsigned steps = 1) override
{ {
if (this->get_drawer_trigger().make_step(forward, steps)) if (this->get_drawer_trigger().make_step(forward, steps))
{ {
@ -431,6 +480,11 @@ namespace nana
return false; return false;
} }
window window_handle() const override
{
return this->handle();
}
/// \brief Increase/decrease values by steps as if it is scrolled through mouse wheel. /// \brief Increase/decrease values by steps as if it is scrolled through mouse wheel.
/// @param forward it determines whether increase or decrease. /// @param forward it determines whether increase or decrease.
/// @return true if the vlaue is changed. /// @return true if the vlaue is changed.
@ -444,7 +498,7 @@ namespace nana
/// @return true if the vlaue is changed. /// @return true if the vlaue is changed.
bool make_page_scroll(bool forward) bool make_page_scroll(bool forward)
{ {
return this->make_step(forward, range() - 1); return this->make_step(forward, static_cast<unsigned>(range() - 1));
} }
};//end class scroll };//end class scroll
}//end namespace nana }//end namespace nana

View File

@ -14,7 +14,7 @@
#ifndef NANA_GUI_SKELETONS_TEXT_EDITOR_HPP #ifndef NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#define NANA_GUI_SKELETONS_TEXT_EDITOR_HPP #define NANA_GUI_SKELETONS_TEXT_EDITOR_HPP
#include "textbase.hpp" #include "textbase.hpp"
#include "text_editor_scheme.hpp" #include "text_editor_part.hpp"
#include <nana/gui/widgets/scroll.hpp> #include <nana/gui/widgets/scroll.hpp>
#include <nana/unicode_bidi.hpp> #include <nana/unicode_bidi.hpp>
@ -135,6 +135,8 @@ namespace nana{ namespace widgets
using size_type = textbase<char_type>::size_type; using size_type = textbase<char_type>::size_type;
using string_type = textbase<char_type>::string_type; using string_type = textbase<char_type>::string_type;
using event_interface = text_editor_event_interface;
using graph_reference = ::nana::paint::graphics&; using graph_reference = ::nana::paint::graphics&;
struct ext_renderer_tag struct ext_renderer_tag
@ -162,6 +164,9 @@ namespace nana{ namespace widgets
void typeface_changed(); void typeface_changed();
void indent(bool, std::function<nana::string()> generator);
void set_event(event_interface*);
/// Determine whether the text_editor is line wrapped. /// Determine whether the text_editor is line wrapped.
bool line_wrapped() const; bool line_wrapped() const;
/// Set the text_editor whether it is line wrapped, it returns false if the state is not changed. /// Set the text_editor whether it is line wrapped, it returns false if the state is not changed.
@ -174,6 +179,10 @@ namespace nana{ namespace widgets
/// Sets the text area. /// Sets the text area.
/// @return true if the area is changed with the new value. /// @return true if the area is changed with the new value.
bool text_area(const nana::rectangle&); bool text_area(const nana::rectangle&);
/// Returns the text area
rectangle text_area(bool including_scroll) const;
bool tip_string(nana::string&&); bool tip_string(nana::string&&);
const attributes & attr() const; const attributes & attr() const;
@ -199,7 +208,7 @@ namespace nana{ namespace widgets
/// Sets caret position through text coordinate. /// Sets caret position through text coordinate.
void move_caret(const upoint&); void move_caret(const upoint&);
void move_caret_end(); void move_caret_end();
void reset_caret_height() const; void reset_caret_pixels() const;
void reset_caret(); void reset_caret();
void show_caret(bool isshow); void show_caret(bool isshow);
@ -207,16 +216,21 @@ namespace nana{ namespace widgets
bool select(bool); bool select(bool);
/// Sets the end position of a selected string. /// Sets the end position of a selected string.
void set_end_caret(); void set_end_caret();
bool hit_text_area(const point&) const; bool hit_text_area(const point&) const;
bool hit_select_area(nana::upoint pos) const; bool hit_select_area(nana::upoint pos) const;
bool move_select(); bool move_select();
bool mask(char_t); bool mask(char_t);
/// Returns width of text area excluding the vscroll size. /// Returns width of text area excluding the vscroll size.
unsigned width_pixels() const; unsigned width_pixels() const;
window window_handle() const; window window_handle() const;
/// Returns text position of each line that currently displays on screen
const std::vector<upoint>& text_position() const;
public: public:
void draw_scroll_rectangle(); void draw_corner();
void render(bool focused); void render(bool focused);
public: public:
void put(nana::string); void put(nana::string);
@ -231,14 +245,13 @@ namespace nana{ namespace widgets
void move_ns(bool to_north); //Moves up and down void move_ns(bool to_north); //Moves up and down
void move_left(); void move_left();
void move_right(); void move_right();
upoint mouse_caret(const point& screen_pos); const upoint& mouse_caret(const point& screen_pos);
upoint caret() const; const upoint& caret() const;
point caret_screen_pos() const; point caret_screen_pos() const;
bool scroll(bool upwards, bool vertical); bool scroll(bool upwards, bool vertical);
bool mouse_enter(bool); bool mouse_enter(bool);
bool mouse_down(::nana::mouse, const point& screen_pos);
bool mouse_move(bool left_button, const point& screen_pos); bool mouse_move(bool left_button, const point& screen_pos);
bool mouse_up(::nana::mouse, const point& screen_pos); bool mouse_pressed(const arg_mouse& arg);
skeletons::textbase<nana::char_t>& textbase(); skeletons::textbase<nana::char_t>& textbase();
const skeletons::textbase<nana::char_t>& textbase() const; const skeletons::textbase<nana::char_t>& textbase() const;
@ -267,10 +280,8 @@ namespace nana{ namespace widgets
int _m_text_top_base() const; int _m_text_top_base() const;
/// Returns the right point of text area. /// Returns the right/bottom point of text area.
int _m_endx() const; int _m_end_pos(bool right) const;
/// Returns the bottom point of text area.
int _m_endy() const;
void _m_draw_parse_string(const keyword_parser&, bool rtl, ::nana::point pos, const ::nana::color& fgcolor, const ::nana::char_t*, std::size_t len) const; void _m_draw_parse_string(const keyword_parser&, bool rtl, ::nana::point pos, const ::nana::color& fgcolor, const ::nana::char_t*, std::size_t len) const;
//_m_draw_string //_m_draw_string
@ -286,7 +297,6 @@ 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_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; 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); void _handle_move_key(const arg_keyboard& arg);
private: private:
@ -295,6 +305,7 @@ namespace nana{ namespace widgets
nana::window window_; nana::window window_;
graph_reference graph_; graph_reference graph_;
const text_editor_scheme* scheme_; const text_editor_scheme* scheme_;
event_interface * event_handler_{ nullptr };
std::unique_ptr<keywords> keywords_; std::unique_ptr<keywords> keywords_;
skeletons::textbase<nana::char_t> textbase_; skeletons::textbase<nana::char_t> textbase_;
@ -302,6 +313,14 @@ namespace nana{ namespace widgets
mutable ext_renderer_tag ext_renderer_; mutable ext_renderer_tag ext_renderer_;
std::vector<upoint> text_position_; //position of text from last rendering.
struct indent_rep
{
bool enabled{ false };
std::function<nana::string()> generator;
}indent_;
struct attributes struct attributes
{ {
accepts acceptive{ accepts::no_restrict }; accepts acceptive{ accepts::no_restrict };
@ -345,6 +364,7 @@ namespace nana{ namespace widgets
{ {
nana::point offset; //x stands for pixels, y for lines nana::point offset; //x stands for pixels, y for lines
nana::upoint caret; //position of caret by text, it specifies the position of a new character nana::upoint caret; //position of caret by text, it specifies the position of a new character
nana::upoint shift_begin_caret;
unsigned xpos{0}; //This data is used for move up/down unsigned xpos{0}; //This data is used for move up/down
}points_; }points_;
}; };

View File

@ -3,6 +3,7 @@
#define NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP #define NANA_WIDGETS_SKELETONS_TEXT_EDITOR_SCHEME_HPP
#include "../../detail/widget_colors.hpp" #include "../../detail/widget_colors.hpp"
#include <vector>
namespace nana namespace nana
{ {
@ -10,12 +11,23 @@ namespace nana
{ {
namespace skeletons namespace skeletons
{ {
//forward declaration
class text_editor;
struct text_editor_scheme struct text_editor_scheme
: public ::nana::widget_colors : public ::nana::widget_colors
{ {
color_proxy selection{static_cast<color_rgb>(0x3399FF)}; color_proxy selection{static_cast<color_rgb>(0x3399FF)};
color_proxy selection_text{colors::white}; color_proxy selection_text{colors::white};
}; };
class text_editor_event_interface
{
public:
virtual ~text_editor_event_interface() = default;
virtual void text_exposed(const std::vector<upoint>&) = 0;
};
} }
} }
} }

View File

@ -249,36 +249,19 @@ namespace skeletons
return true; return true;
} }
void store(nana::string fs) const void store(nana::string fs, bool is_unicode, ::nana::unicode encoding) const
{ {
std::string fs_mbs = nana::charset(fs); std::string fs_mbs = nana::charset(fs);
std::ofstream ofs(fs_mbs.data(), std::ios::binary); std::ofstream ofs(fs_mbs.data(), std::ios::binary);
if(ofs && text_cont_.size()) if(ofs && text_cont_.size())
{ {
if(text_cont_.size() > 1) std::string last_mbs;
{
for(auto i = text_cont_.cbegin(), end = text_cont_.cend() - 1; i != end; ++i)
{
std::string mbs = nana::charset(*i);
ofs.write(mbs.c_str(), mbs.size());
ofs.write("\r\n", 2);
}
}
std::string mbs = nana::charset(text_cont_.back());
ofs.write(mbs.c_str(), mbs.size());
_m_saved(std::move(fs));
}
}
void store(nana::string fs, nana::unicode encoding) const if (is_unicode)
{ {
std::string fs_mbs = nana::charset(fs); const char * le_boms[] = { "\xEF\xBB\xBF", "\xFF\xFE", "\xFF\xFE\x0\x0" }; //BOM for little-endian
std::ofstream ofs(fs_mbs.data(), std::ios::binary);
if(ofs && text_cont_.size())
{
const char * le_boms[] = {"\xEF\xBB\xBF", "\xFF\xFE", "\xFF\xFE\x0\x0"}; //BOM for little-endian
int bytes = 0; int bytes = 0;
switch(encoding) switch (encoding)
{ {
case nana::unicode::utf8: case nana::unicode::utf8:
bytes = 3; break; bytes = 3; break;
@ -288,21 +271,36 @@ namespace skeletons
bytes = 4; break; bytes = 4; break;
} }
if(bytes) if (bytes)
ofs.write(le_boms[static_cast<int>(encoding)], bytes); ofs.write(le_boms[static_cast<int>(encoding)], bytes);
if(text_cont_.size() > 1) if (text_cont_.size() > 1)
{ {
std::string mbs; std::string mbs;
for(auto i = text_cont_.cbegin(), end = text_cont_.cend() - 1; i != end; ++i) for (auto i = text_cont_.cbegin(), end = text_cont_.cend() - 1; i != end; ++i)
{ {
mbs = nana::charset(*i).to_bytes(encoding); std::string(nana::charset(*i).to_bytes(encoding)).swap(mbs);
mbs += "\r\n"; mbs += "\r\n";
ofs.write(mbs.c_str(), static_cast<std::streamsize>(mbs.size())); ofs.write(mbs.c_str(), static_cast<std::streamsize>(mbs.size()));
} }
} }
std::string mbs = nana::charset(text_cont_.back()).to_bytes(encoding);
ofs.write(mbs.c_str(), static_cast<std::streamsize>(mbs.size())); last_mbs = nana::charset(text_cont_.back()).to_bytes(encoding);
}
else
{
if (text_cont_.size() > 1)
{
for (auto i = text_cont_.cbegin(), end = text_cont_.cend() - 1; i != end; ++i)
{
std::string mbs = nana::charset(*i);
ofs.write(mbs.c_str(), mbs.size());
ofs.write("\r\n", 2);
}
}
last_mbs = nana::charset(text_cont_.back());
}
ofs.write(last_mbs.c_str(), static_cast<std::streamsize>(last_mbs.size()));
_m_saved(std::move(fs)); _m_saved(std::move(fs));
} }
} }

View File

@ -13,7 +13,7 @@
#ifndef NANA_GUI_WIDGET_SPINBOX_HPP #ifndef NANA_GUI_WIDGET_SPINBOX_HPP
#define NANA_GUI_WIDGET_SPINBOX_HPP #define NANA_GUI_WIDGET_SPINBOX_HPP
#include "widget.hpp" #include "widget.hpp"
#include "skeletons/text_editor_scheme.hpp" #include "skeletons/text_editor_part.hpp"
namespace nana namespace nana
{ {
@ -109,16 +109,6 @@ namespace nana
::nana::string _m_caption() const throw(); ::nana::string _m_caption() const throw();
void _m_caption(::nana::string&&); void _m_caption(::nana::string&&);
}; //end class spinbox }; //end class spinbox
namespace dev
{
template<>
struct widget_traits<spinbox>
{
using event_type = drawerbase::spinbox::spinbox_events;
using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
};
}
}//end namespace nana }//end namespace nana
#endif //NANA_GUI_WIDGET_SPINBOX_HPP #endif //NANA_GUI_WIDGET_SPINBOX_HPP

View File

@ -14,7 +14,6 @@
#ifndef NANA_GUI_WIDGET_TABBAR_HPP #ifndef NANA_GUI_WIDGET_TABBAR_HPP
#define NANA_GUI_WIDGET_TABBAR_HPP #define NANA_GUI_WIDGET_TABBAR_HPP
#include "widget.hpp" #include "widget.hpp"
#include "../../paint/gadget.hpp"
#include <nana/pat/cloneable.hpp> #include <nana/pat/cloneable.hpp>
#include <nana/any.hpp> #include <nana/any.hpp>
@ -30,7 +29,7 @@ namespace nana
T & value; T & value;
arg_tabbar(tabbar<T>& wdg, T& v) arg_tabbar(tabbar<T>& wdg, T& v)
: widget{ wdg }, value{ v } : widget(wdg), value{ v }
{} {}
}; };
@ -141,7 +140,16 @@ namespace nana
: public drawer_trigger : public drawer_trigger
{ {
public: public:
enum toolbox_button_t{ButtonAdd, ButtonScroll, ButtonList, ButtonClose}; //enum toolbox_button_t{ButtonAdd, ButtonScroll, ButtonList, ButtonClose}; //deprecated
enum class kits
{
add,
scroll,
list,
close
};
trigger(); trigger();
~trigger(); ~trigger();
void activate(std::size_t); void activate(std::size_t);
@ -159,7 +167,7 @@ namespace nana
void tab_image(size_t, const nana::paint::image&); void tab_image(size_t, const nana::paint::image&);
void text(std::size_t, const nana::string&); void text(std::size_t, const nana::string&);
nana::string text(std::size_t) const; nana::string text(std::size_t) const;
bool toolbox_button(toolbox_button_t, bool); bool toolbox(kits, bool);
private: private:
void attached(widget_reference, graph_reference) override; void attached(widget_reference, graph_reference) override;
void detached() override; void detached() override;
@ -183,18 +191,28 @@ namespace nana
typedef Type value_type; ///< The type of element data which is stored in the tabbar. typedef Type value_type; ///< The type of element data which is stored in the tabbar.
typedef drawerbase::tabbar::item_renderer item_renderer; ///< A user-defined item renderer should be derived from this interface. typedef drawerbase::tabbar::item_renderer item_renderer; ///< A user-defined item renderer should be derived from this interface.
//These member types is deprecated, they will be removed in Nana 1.3
struct button_add{}; ///< The type identifies the add button of the tabbar's toolbox. struct button_add{}; ///< The type identifies the add button of the tabbar's toolbox.
struct button_scroll{}; ///< The type identifies the scroll button of the tabbar's toolbox. struct button_scroll{}; ///< The type identifies the scroll button of the tabbar's toolbox.
struct button_list{}; ///< The type identifies the list button of the tabbar's toolbox. struct button_list{}; ///< The type identifies the list button of the tabbar's toolbox.
struct button_close{}; ///< The type identifies the close button of the tabbar's toolbox. struct button_close{}; ///< The type identifies the close button of the tabbar's toolbox.
/// A template class identifies the buttons of the tabbars toolbox. Refer to notes for more details. //This template class is deprecated, it will be removed in 1.3
/// A template class identifies the buttons of the tabbar's toolbox. Refer to notes for more details.
template<typename ButtonAdd = nana::null_type, typename ButtonScroll = nana::null_type, typename ButtonList = nana::null_type, typename ButtonClose = nana::null_type> template<typename ButtonAdd = nana::null_type, typename ButtonScroll = nana::null_type, typename ButtonList = nana::null_type, typename ButtonClose = nana::null_type>
struct button_container struct button_container
{ {
typedef meta::fixed_type_set<ButtonAdd, ButtonScroll, ButtonList, ButtonClose> type_set; typedef meta::fixed_type_set<ButtonAdd, ButtonScroll, ButtonList, ButtonClose> type_set;
}; };
enum class kits
{
add, ///< The type identifies the add button of the tabbar's toolbox.
scroll, ///< The type identifies the scroll button of the tabbar's toolbox
list, ///< The type identifies the list button of the tabbar's toolbox
close ///< The type identifies the close button of the tabbar's toolbox
};
tabbar() tabbar()
{ {
evt_agent_.reset(new drawerbase::tabbar::event_agent<value_type, drawer_trigger_t>(*this, this->get_drawer_trigger())); evt_agent_.reset(new drawerbase::tabbar::event_agent<value_type, drawer_trigger_t>(*this, this->get_drawer_trigger()));
@ -305,22 +323,30 @@ namespace nana
auto & tg = this->get_drawer_trigger(); auto & tg = this->get_drawer_trigger();
bool redraw = false; bool redraw = false;
using inner_kits = drawerbase::tabbar::trigger::kits;
if(type_set::template count<button_add>::value) if(type_set::template count<button_add>::value)
redraw |= tg.toolbox_button(tg.ButtonAdd, enable); redraw |= tg.toolbox(inner_kits::add, enable);
if(type_set::template count<button_scroll>::value) if(type_set::template count<button_scroll>::value)
redraw |= tg.toolbox_button(tg.ButtonScroll, enable); redraw |= tg.toolbox(inner_kits::scroll, enable);
if(type_set::template count<button_list>::value) if(type_set::template count<button_list>::value)
redraw |= tg.toolbox_button(tg.ButtonList, enable); redraw |= tg.toolbox(inner_kits::add, enable);
if(type_set::template count<button_close>::value) if(type_set::template count<button_close>::value)
redraw |= tg.toolbox_button(tg.ButtonClose, enable); redraw |= tg.toolbox(inner_kits::close, enable);
if(redraw) if(redraw)
API::refresh_window(this->handle()); API::refresh_window(this->handle());
} }
void toolbox(kits kit, bool enable)
{
if (this->get_drawer_trigger().toolbox(kit, enable))
API::refresh_window(this->handle());
}
void text(std::size_t pos, const nana::string& str) /// Sets the title of the specified item, If pos is invalid, the method throws an std::out_of_range object. void text(std::size_t pos, const nana::string& str) /// Sets the title of the specified item, If pos is invalid, the method throws an std::out_of_range object.
{ {
this->get_drawer_trigger().text(pos, str); this->get_drawer_trigger().text(pos, str);
@ -338,14 +364,18 @@ namespace nana
namespace nana namespace nana
{ {
namespace ng
{
namespace drawerbase namespace drawerbase
{ {
namespace tabbar_lite namespace tabbar_lite
{ {
class model; class model;
struct events
: public general_events
{
basic_event<event_arg> selected;
};
class driver class driver
: public drawer_trigger : public drawer_trigger
{ {
@ -353,7 +383,7 @@ namespace nana
driver(); driver();
~driver(); ~driver();
model* get_model(); model* get_model() const throw();
private: private:
//Overrides drawer_trigger's method //Overrides drawer_trigger's method
void attached(widget_reference, graph_reference) override; void attached(widget_reference, graph_reference) override;
@ -368,17 +398,25 @@ namespace nana
}//end namespace drawerbase }//end namespace drawerbase
class tabbar_lite class tabbar_lite
: public widget_object<category::widget_tag, drawerbase::tabbar_lite::driver> : public widget_object<category::widget_tag, drawerbase::tabbar_lite::driver, drawerbase::tabbar_lite::events>
{ {
public: public:
tabbar_lite() = default; tabbar_lite() = default;
tabbar_lite(window, bool visible = true, const::nana::rectangle& = {}); tabbar_lite(window, bool visible = true, const::nana::rectangle& = {});
public: //capacity
std::size_t length() const;
public: //modifiers
void attach(std::size_t pos, window);
window attach(std::size_t pos) const;
void push_back(std::string text, ::nana::any par = {}); void push_back(std::string text, ::nana::any par = {});
void push_front(std::string text, ::nana::any par = {}); void push_front(std::string text, ::nana::any par = {});
std::size_t selected() const;
void erase(std::size_t pos, bool close_attached = true);
}; };
}
} }
#endif #endif

View File

@ -13,7 +13,7 @@
#define NANA_GUI_WIDGET_TEXTBOX_HPP #define NANA_GUI_WIDGET_TEXTBOX_HPP
#include <nana/gui/widgets/widget.hpp> #include <nana/gui/widgets/widget.hpp>
#include "skeletons/textbase_export_interface.hpp" #include "skeletons/textbase_export_interface.hpp"
#include "skeletons/text_editor_scheme.hpp" #include "skeletons/text_editor_part.hpp"
namespace nana namespace nana
{ {
@ -23,18 +23,11 @@ namespace nana
: public event_arg : public event_arg
{ {
textbox& widget; textbox& widget;
const std::vector<upoint>& text_position; ///< position of characters that the first character of line which are displayed
arg_textbox(textbox&); arg_textbox(textbox&, const std::vector<upoint>&);
}; };
namespace widgets
{
namespace skeletons
{
class text_editor;
}
}
namespace drawerbase namespace drawerbase
{ {
namespace textbox namespace textbox
@ -44,17 +37,25 @@ namespace nana
{ {
basic_event<arg_textbox> first_change; basic_event<arg_textbox> first_change;
basic_event<arg_textbox> text_changed; basic_event<arg_textbox> text_changed;
basic_event<arg_textbox> text_exposed;
}; };
class event_agent class event_agent
: public widgets::skeletons::textbase_event_agent_interface : public widgets::skeletons::textbase_event_agent_interface,
public widgets::skeletons::text_editor_event_interface
{ {
public: public:
event_agent(::nana::textbox&); event_agent(::nana::textbox&, const std::vector<upoint>&);
private:
//Overrides textbase_event_agent_interface
void first_change() override; void first_change() override;
void text_changed() override; void text_changed() override;
private:
//Overrides text_editor_event_interface
void text_exposed(const std::vector<upoint>&) override;
private: private:
::nana::textbox & widget_; ::nana::textbox & widget_;
const std::vector<upoint>& text_position_;
}; };
//class drawer //class drawer
@ -97,6 +98,7 @@ namespace nana
:public widget_object<category::widget_tag, drawerbase::textbox::drawer, drawerbase::textbox::textbox_events, ::nana::widgets::skeletons::text_editor_scheme> :public widget_object<category::widget_tag, drawerbase::textbox::drawer, drawerbase::textbox::textbox_events, ::nana::widgets::skeletons::text_editor_scheme>
{ {
public: public:
using text_positions = std::vector<upoint>;
/// The default constructor without creating the widget. /// The default constructor without creating the widget.
textbox(); textbox();
@ -128,8 +130,12 @@ namespace nana
void store(nana::string file); void store(nana::string file);
void store(nana::string file, nana::unicode encoding); void store(nana::string file, nana::unicode encoding);
/// Enables/disables the textbox to indent a line. Idents a new line when it is created by pressing enter.
/// @param generator generates text for identing a line. If it is empty, textbox indents the line according to last line.
textbox& indention(bool, std::function<nana::string()> generator = {});
//A workaround for reset, explicit default constructor syntax, because VC2013 incorrectly treats {} as {0}. //A workaround for reset, explicit default constructor syntax, because VC2013 incorrectly treats {} as {0}.
textbox& reset(nana::string = nana::string()); ///< discard the old text and set a newtext textbox& reset(nana::string = nana::string()); ///< discard the old text and set a new text
/// The file of last store operation. /// The file of last store operation.
nana::string filename() const; nana::string filename() const;
@ -147,8 +153,12 @@ namespace nana
bool getline(std::size_t pos, nana::string&) const; bool getline(std::size_t pos, nana::string&) const;
/// Gets the caret position /// Gets the caret position
/// Returns true if the caret is in the area of display, false otherwise.
bool caret_pos(point& pos, bool text_coordinate) const; bool caret_pos(point& pos, bool text_coordinate) const;
/// Sets the caret position with a text position
textbox& caret_pos(const upoint&);
/// 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. /// 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); textbox& append(const nana::string& text, bool at_caret);
@ -188,22 +198,21 @@ namespace nana
void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<nana::string> kw_list); void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<nana::string> kw_list);
void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::string> kw_list_utf8); void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::string> kw_list_utf8);
void erase_keyword(const nana::string& kw); void erase_keyword(const nana::string& kw);
/// Returns the text position of each line that currently displays on screen.
text_positions text_position() const;
/// Returns the rectangle of text area
rectangle text_area() const;
/// Returns the height of line in pixels
unsigned line_pixels() const;
protected: protected:
//Overrides widget's virtual functions //Overrides widget's virtual functions
::nana::string _m_caption() const throw() override; ::nana::string _m_caption() const throw() override;
void _m_caption(::nana::string&&) override; void _m_caption(::nana::string&&) override;
void _m_typeface(const paint::font&) override; void _m_typeface(const paint::font&) override;
}; };
namespace dev
{
/// Traits for widget classes
template<>
struct widget_traits<textbox>
{
using event_type = drawerbase::textbox::textbox_events;
using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
};
}
}//end namespace nana }//end namespace nana
#endif #endif

View File

@ -19,7 +19,6 @@
#define NANA_GUI_WIDGETS_TREEBOX_HPP #define NANA_GUI_WIDGETS_TREEBOX_HPP
#include "widget.hpp" #include "widget.hpp"
#include "detail/compset.hpp" #include "detail/compset.hpp"
#include <nana/paint/gadget.hpp>
#include "detail/tree_cont.hpp" #include "detail/tree_cont.hpp"
#include <nana/gui/timer.hpp> #include <nana/gui/timer.hpp>
#include <nana/any.hpp> #include <nana/any.hpp>
@ -167,8 +166,6 @@ namespace nana
void resized(graph_reference, const arg_resized&) override; void resized(graph_reference, const arg_resized&) override;
void key_press(graph_reference, const arg_keyboard&) override; void key_press(graph_reference, const arg_keyboard&) override;
void key_char(graph_reference, const arg_keyboard&) override; void key_char(graph_reference, const arg_keyboard&) override;
private:
void _m_deal_adjust();
private: private:
implement * const impl_; implement * const impl_;
}; //end class trigger }; //end class trigger

View File

@ -135,6 +135,7 @@ namespace nana
typedef DrawerTrigger drawer_trigger_t; typedef DrawerTrigger drawer_trigger_t;
public: public:
using scheme_type = Scheme; using scheme_type = Scheme;
using event_type = Events;
widget_object() widget_object()
: events_{ std::make_shared<Events>() }, : events_{ std::make_shared<Events>() },
@ -147,7 +148,7 @@ namespace nana
API::close_window(handle_); API::close_window(handle_);
} }
Events& events() const event_type& events() const
{ {
return *events_; return *events_;
} }
@ -228,6 +229,7 @@ namespace nana
typedef DrawerTrigger drawer_trigger_t; typedef DrawerTrigger drawer_trigger_t;
public: public:
using scheme_type = Scheme; using scheme_type = Scheme;
using event_type = Events;
widget_object() widget_object()
: events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() } : events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() }
@ -239,7 +241,7 @@ namespace nana
API::close_window(handle_); API::close_window(handle_);
} }
Events& events() const event_type& events() const
{ {
return *events_; return *events_;
} }
@ -297,6 +299,7 @@ namespace nana
typedef DrawerTrigger drawer_trigger_t; typedef DrawerTrigger drawer_trigger_t;
public: public:
using scheme_type = Scheme; using scheme_type = Scheme;
using event_type = Events;
widget_object() widget_object()
{ {
@ -322,7 +325,7 @@ namespace nana
API::close_window(handle_); API::close_window(handle_);
} }
Events& events() const event_type& events() const
{ {
return *events_; return *events_;
} }
@ -451,6 +454,7 @@ namespace nana
typedef int drawer_trigger_t; typedef int drawer_trigger_t;
public: public:
using scheme_type = Scheme; using scheme_type = Scheme;
using event_type = Events;
widget_object() widget_object()
: events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() } : events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() }
@ -462,7 +466,7 @@ namespace nana
API::close_window(handle_); API::close_window(handle_);
} }
Events& events() const event_type& events() const
{ {
return *events_; return *events_;
} }

View File

@ -1,7 +1,7 @@
/* /*
* Nana GUI Library Definition * Nana GUI Library Definition
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -20,27 +20,43 @@
#include "widgets/form.hpp" #include "widgets/form.hpp"
#include "drawing.hpp" #include "drawing.hpp"
#include "msgbox.hpp" #include "msgbox.hpp"
#include "../exceptions.hpp" #include "place.hpp"
namespace nana namespace nana
{ {
template<typename Form, bool IsMakeVisible = true> namespace detail
{
struct form_loader_private
{
template<typename, bool> friend class form_loader;
private:
static void insert_form(::nana::widget*);
};
template<typename Form, bool IsVisible>
class form_loader class form_loader
{ {
public: public:
template<typename... Args> template<typename... Args>
Form & operator()(Args &&... args) const Form & operator()(Args &&... args) const
{ {
Form* res = detail::bedrock::instance().rt_manager.create_form<Form>(std::forward<Args>(args)...); auto p = new Form(std::forward<Args>(args)...);
if (nullptr == res)
throw nana::bad_window("form_loader.operator(): failed to create a window");
if (IsMakeVisible) res->show(); if (p->empty())
throw std::logic_error("form_loader failed to create the form");
return *res; detail::form_loader_private::insert_form(p);
if (IsVisible)
p->show();
return *p;
} }
}; };
}
template<typename Form, bool IsVisible = true>
using form_loader = detail::form_loader<Form, IsVisible>;
void exec(); void exec();
}//end namespace nana }//end namespace nana

View File

@ -1,7 +1,7 @@
/* /*
* Image Processor Algorithm Implementation * Image Processor Algorithm Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -28,6 +28,18 @@ namespace detail
{ {
namespace algorithms namespace algorithms
{ {
///@brief Seek a pixel address by using offset bytes
///@return the specified pixel address
inline pixel_color_t * pixel_at(pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<pixel_color_t*>(reinterpret_cast<char*>(p) + bytes);
}
inline const pixel_color_t * pixel_at(const pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<const pixel_color_t*>(reinterpret_cast<const char*>(p) + bytes);
}
class proximal_interoplation class proximal_interoplation
: public image_process::stretch_interface : public image_process::stretch_interface
{ {
@ -233,9 +245,9 @@ namespace detail
std::size_t coef2 = el.iu * iv_minus_coef; std::size_t coef2 = el.iu * iv_minus_coef;
std::size_t coef3 = el.iu * iv; std::size_t coef3 = el.iu * iv;
i->element.red = static_cast<unsigned>((coef0 * col0.element.red + coef1 * col1.element.red + (coef2 * col2.element.red + coef3 * col3.element.red)) >> double_shift_size); i->element.red = static_cast<unsigned char>((coef0 * col0.element.red + coef1 * col1.element.red + (coef2 * col2.element.red + coef3 * col3.element.red)) >> double_shift_size);
i->element.green = static_cast<unsigned>((coef0 * col0.element.green + coef1 * col1.element.green + (coef2 * col2.element.green + coef3 * col3.element.green)) >> double_shift_size); i->element.green = static_cast<unsigned char>((coef0 * col0.element.green + coef1 * col1.element.green + (coef2 * col2.element.green + coef3 * col3.element.green)) >> double_shift_size);
i->element.blue = static_cast<unsigned>((coef0 * col0.element.blue + coef1 * col1.element.blue + (coef2 * col2.element.blue + coef3 * col3.element.blue)) >> double_shift_size); i->element.blue = static_cast<unsigned char>((coef0 * col0.element.blue + coef1 * col1.element.blue + (coef2 * col2.element.blue + coef3 * col3.element.blue)) >> double_shift_size);
} }
} }
} }

View File

@ -1,33 +0,0 @@
/*
* Graphics Gadget 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/paint/gadget.hpp
*/
#ifndef NANA_PAINT_GADGET_HPP
#define NANA_PAINT_GADGET_HPP
#include "graphics.hpp"
#include "image.hpp"
#include <nana/basic_types.hpp>
namespace nana
{
namespace paint
{
namespace gadget
{
void close_16_pixels(::nana::paint::graphics&, int x, int y, unsigned style, const color&);
void cross(::nana::paint::graphics&, int x, int y, unsigned size, unsigned thickness, const nana::color&);
}//end namespace gadget
}//end namespace paint
}//end namespace nana
#endif

View File

@ -136,8 +136,11 @@ namespace nana
/// @param file_utf8 A UTF-8 string to a filename /// @param file_utf8 A UTF-8 string to a filename
void save_as_file(const char* file_utf8) const throw(); void save_as_file(const char* file_utf8) const throw();
void set_color(const ::nana::color&); void set_color(const ::nana::color&); //deprecated, graphics::palette() instead
void set_text_color(const ::nana::color&); void set_text_color(const ::nana::color&); //deprecated, graphics::palette() instead
::nana::color palette(bool for_text) const;
graphics& palette(bool for_text, const ::nana::color&);
unsigned bidi_string(const nana::point&, const char_t *, std::size_t len); unsigned bidi_string(const nana::point&, const char_t *, std::size_t len);
unsigned bidi_string(const point& pos, const char*, std::size_t len); unsigned bidi_string(const point& pos, const char*, std::size_t len);

View File

@ -1,7 +1,7 @@
/* /*
* Pixel Buffer Implementation * Pixel Buffer Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -18,18 +18,6 @@
namespace nana{ namespace paint namespace nana{ namespace paint
{ {
///@brief Seek a pixel address by using offset bytes
///@return the specified pixel address
inline pixel_color_t * pixel_at(pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<pixel_color_t*>(reinterpret_cast<char*>(p)+bytes);
}
inline const pixel_color_t * pixel_at(const pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<const pixel_color_t*>(reinterpret_cast<const char*>(p)+bytes);
}
class pixel_buffer class pixel_buffer
{ {
struct pixel_buffer_storage; struct pixel_buffer_storage;
@ -65,6 +53,8 @@ namespace nana{ namespace paint
pixel_color_t * raw_ptr(std::size_t row) const; pixel_color_t * raw_ptr(std::size_t row) const;
pixel_color_t * operator[](std::size_t row) const; pixel_color_t * operator[](std::size_t row) const;
void fill_row(std::size_t row, const unsigned char* buffer, std::size_t bytes, unsigned bits_per_pixel);
void put(const unsigned char* rawbits, std::size_t width, std::size_t height, std::size_t bits_per_pixel, std::size_t bytes_per_line, bool is_negative); void put(const unsigned char* rawbits, std::size_t width, std::size_t height, std::size_t bits_per_pixel, std::size_t bytes_per_line, bool is_negative);
void line(const std::string& name); void line(const std::string& name);

View File

@ -13,6 +13,7 @@
#ifndef NANA_PAT_ABSFACTORY_HPP #ifndef NANA_PAT_ABSFACTORY_HPP
#define NANA_PAT_ABSFACTORY_HPP #define NANA_PAT_ABSFACTORY_HPP
#include "cloneable.hpp"
#include <memory> #include <memory>
namespace nana namespace nana

View File

@ -21,62 +21,50 @@ namespace nana{ namespace pat{
namespace detail namespace detail
{ {
template<typename T>
class cloneable_interface class cloneable_interface
{ {
public: public:
typedef T interface_t;
typedef cloneable_interface cloneable_t;
virtual ~cloneable_interface() = default; virtual ~cloneable_interface() = default;
virtual interface_t& refer() = 0; virtual void * get() = 0;
virtual const interface_t& refer() const = 0; virtual cloneable_interface* clone() const = 0;
virtual cloneable_t* clone() const = 0;
virtual void self_delete() const = 0; virtual void self_delete() const = 0;
}; };
struct cloneable_interface_deleter
{
void operator()(cloneable_interface * p)
{
if (p)
p->self_delete();
}
};
template<typename T, typename SuperOfT> template<typename T>
class cloneable_wrapper class cloneable_wrapper
: public cloneable_interface<SuperOfT> : public cloneable_interface
{ {
public: public:
typedef T value_t; using value_type = T;
typedef typename cloneable_interface<SuperOfT>::interface_t interface_t;
cloneable_wrapper() cloneable_wrapper() = default;
cloneable_wrapper(const value_type& obj)
:value_obj_(obj)
{} {}
cloneable_wrapper(const value_t& obj) cloneable_wrapper(value_type&& rv)
:object_(obj) :value_obj_(std::move(rv))
{} {}
private:
cloneable_wrapper(value_t&& rv) //Implement cloneable_interface
:object_(std::move(rv)) virtual void* get() override
{}
template<typename U>
cloneable_wrapper(const U& u)
: object_(u)
{}
template<typename U>
cloneable_wrapper(U& u)
:object_(u)
{}
virtual interface_t& refer() override
{ {
return object_; return &value_obj_;
} }
virtual const interface_t& refer() const override virtual cloneable_interface* clone() const override
{ {
return object_; return (new cloneable_wrapper{ value_obj_ });
}
virtual cloneable_interface<interface_t>* clone() const override
{
return (new cloneable_wrapper(object_));
} }
virtual void self_delete() const override virtual void self_delete() const override
@ -84,28 +72,20 @@ namespace nana{ namespace pat{
(delete this); (delete this);
} }
private: private:
value_t object_; value_type value_obj_;
}; };
}//end namespace detail }//end namespace detail
template<typename Base, bool Mutable = false> template<typename Base, bool Mutable = false>
class cloneable class cloneable
{ {
using base_t = Base; using base_t = Base;
using interface_t = detail::cloneable_interface < base_t > ; using cloneable_interface = detail::cloneable_interface;
using const_base_ptr = typename std::conditional<Mutable, base_t*, const base_t*>::type; using const_base_ptr = typename std::conditional<Mutable, base_t*, const base_t*>::type;
using const_base_ref = typename std::conditional<Mutable, base_t&, const base_t&>::type; using const_base_ref = typename std::conditional<Mutable, base_t&, const base_t&>::type;
struct deleter template<typename OtherBase, bool OtherMutable> friend class cloneable;
{
void operator()(interface_t * p)
{
if(p)
p->self_delete();
}
};
struct inner_bool struct inner_bool
{ {
@ -125,16 +105,16 @@ namespace nana{ namespace pat{
template<typename T, typename member_enabled<T>::type* = nullptr> template<typename T, typename member_enabled<T>::type* = nullptr>
cloneable(T&& t) cloneable(T&& t)
: cwrapper_(new detail::cloneable_wrapper<typename std::remove_cv<typename std::remove_reference<T>::type>::type, base_t>(std::forward<T>(t)), deleter()), : cwrapper_(new detail::cloneable_wrapper<typename std::remove_cv<typename std::remove_reference<T>::type>::type>(std::forward<T>(t)), detail::cloneable_interface_deleter()),
fast_ptr_(&(cwrapper_->refer())) fast_ptr_(reinterpret_cast<typename std::remove_cv<typename std::remove_reference<T>::type>::type*>(cwrapper_->get()))
{} {}
cloneable(const cloneable& r) cloneable(const cloneable& r)
{ {
if(r.cwrapper_) if(r.cwrapper_)
{ {
cwrapper_ = std::shared_ptr<interface_t>(r.cwrapper_->clone(), deleter()); cwrapper_ = std::move(std::shared_ptr<cloneable_interface>(r.cwrapper_->clone(), detail::cloneable_interface_deleter{}));
fast_ptr_ = &(cwrapper_->refer()); fast_ptr_ = reinterpret_cast<base_t*>(cwrapper_->get());
} }
} }
@ -145,12 +125,27 @@ namespace nana{ namespace pat{
r.fast_ptr_ = nullptr; r.fast_ptr_ = nullptr;
} }
template<typename OtherBase, typename std::enable_if<std::is_base_of<base_t, OtherBase>::value>::type* = nullptr>
cloneable(const cloneable<OtherBase, Mutable>& other)
{
if (other)
{
char* value_ptr = reinterpret_cast<char*>(other.cwrapper_->get());
char* base_ptr = reinterpret_cast<char*>(other.fast_ptr_);
auto ptr_diff = std::distance(base_ptr, value_ptr);
cwrapper_.reset(other.cwrapper_->clone(), detail::cloneable_interface_deleter{});
fast_ptr_ = reinterpret_cast<OtherBase*>(reinterpret_cast<char*>(cwrapper_->get()) - ptr_diff);
}
}
cloneable & operator=(const cloneable& r) cloneable & operator=(const cloneable& r)
{ {
if((this != &r) && r.cwrapper_) if((this != &r) && r.cwrapper_)
{ {
cwrapper_ = std::shared_ptr<interface_t>(r.cwrapper_->clone(), deleter()); cwrapper_ = std::shared_ptr<cloneable_interface>(r.cwrapper_->clone(), detail::cloneable_interface_deleter());
fast_ptr_ = &(cwrapper_->refer()); fast_ptr_ = reinterpret_cast<base_t*>(cwrapper_->get());
} }
return *this; return *this;
} }
@ -159,10 +154,8 @@ namespace nana{ namespace pat{
{ {
if(this != &r) if(this != &r)
{ {
cwrapper_ = r.cwrapper_; cwrapper_ = std::move(r.cwrapper_);
fast_ptr_ = r.fast_ptr_; fast_ptr_ = r.fast_ptr_;
r.cwrapper_.reset();
r.fast_ptr_ = nullptr; r.fast_ptr_ = nullptr;
} }
return *this; return *this;
@ -204,12 +197,12 @@ namespace nana{ namespace pat{
return (fast_ptr_ ? &inner_bool::true_stand : nullptr); return (fast_ptr_ ? &inner_bool::true_stand : nullptr);
} }
private: private:
std::shared_ptr<interface_t> cwrapper_; std::shared_ptr<cloneable_interface> cwrapper_;
base_t * fast_ptr_{nullptr}; base_t * fast_ptr_{nullptr};
}; };
template<typename T> template<typename T>
using mutable_cloneable = cloneable < T, true > ; using mutable_cloneable = cloneable<T, true>;
}//end namespace pat }//end namespace pat
}//end namespace nana }//end namespace nana

View File

@ -14,7 +14,7 @@
#include <nana/deploy.hpp> #include <nana/deploy.hpp>
#include <nana/traits.hpp> #include <nana/traits.hpp>
#include <nana/exceptions.hpp> #include <stdexcept>
namespace nana namespace nana
@ -70,19 +70,19 @@ namespace system
typedef typename function_ptr<Function>::type fptr_type; typedef typename function_ptr<Function>::type fptr_type;
if(nana::traits::is_function_pointer<fptr_type>::value == false) if(nana::traits::is_function_pointer<fptr_type>::value == false)
throw nana::bad_error("shared_wrapper::symbols, template<_Function> is not a function type or a function pointer type"); throw std::invalid_argument("shared_wrapper::symbols, template<_Function> is not a function type or a function pointer type");
if(symbol == 0) if(symbol == 0)
throw nana::bad_handle("shared_wrapper::symbols, symbol is null string"); throw std::invalid_argument("shared_wrapper::symbols, symbol is null string");
if(impl_.handle == 0) if(impl_.handle == 0)
throw nana::bad_handle("shared_wrapper::symbols, empty handle"); throw std::logic_error("shared_wrapper::symbols, empty handle");
if(impl_.symbol != symbol) if(impl_.symbol != symbol)
{ {
void *result = detail::shared_helper::symbols(impl_.handle, symbol); void *result = detail::shared_helper::symbols(impl_.handle, symbol);
if(result == 0) if(result == 0)
throw nana::bad_handle("shared_wrapper::symbols, empty proc address"); throw std::logic_error("shared_wrapper::symbols, empty proc address");
impl_.proc_address = result; impl_.proc_address = result;
impl_.symbol = symbol; impl_.symbol = symbol;

View File

@ -20,7 +20,7 @@
#include <windows.h> #include <windows.h>
#elif defined(NANA_LINUX) #elif defined(NANA_LINUX)
#include <string.h> #include <string.h>
#include PLATFORM_SPEC_HPP #include <nana/detail/platform_spec_selector.hpp>
#endif #endif
//Implement workarounds for GCC/MinGW which version is below 4.8.2 //Implement workarounds for GCC/MinGW which version is below 4.8.2

View File

@ -13,9 +13,7 @@
* *
* http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt * http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <X11/Xlocale.h> #include <X11/Xlocale.h>
#include <locale> #include <locale>
#include <map> #include <map>
@ -24,6 +22,7 @@
#include <nana/paint/graphics.hpp> #include <nana/paint/graphics.hpp>
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/basic_window.hpp> #include <nana/gui/detail/basic_window.hpp>
#include <nana/gui/detail/window_manager.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#include <errno.h> #include <errno.h>
#include <sstream> #include <sstream>
@ -302,14 +301,24 @@ namespace detail
#endif #endif
} }
unsigned drawable_impl_type::get_color() const
{
return color_;
}
unsigned drawable_impl_type::get_text_color() const
{
return text_color_;
}
void drawable_impl_type::set_color(const ::nana::color& clr) void drawable_impl_type::set_color(const ::nana::color& clr)
{ {
color_ = clr.px_color().value; color_ = (clr.px_color().value & 0xFFFFFF);
} }
void drawable_impl_type::set_text_color(const ::nana::color& clr) void drawable_impl_type::set_text_color(const ::nana::color& clr)
{ {
text_color_ = clr.px_color().value; text_color_ = (clr.px_color().value & 0xFFFFFF);
update_text_color(); update_text_color();
} }
@ -686,7 +695,7 @@ namespace detail
if(vec) if(vec)
{ {
set_error_handler(); set_error_handler();
auto & wd_manager = detail::bedrock::instance().wd_manager; auto & wd_manager = detail::bedrock::instance().wd_manager();
for(auto u = vec->rbegin(); u != vec->rend(); ++u) for(auto u = vec->rbegin(); u != vec->rend(); ++u)
wd_manager.close(wd_manager.root(*u)); wd_manager.close(wd_manager.root(*u));
@ -1352,7 +1361,7 @@ namespace detail
::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child); ::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child);
typedef detail::bedrock bedrock; typedef detail::bedrock bedrock;
auto wd = bedrock::instance().wd_manager.find_window(reinterpret_cast<native_window_type>(evt.xclient.window), self.xdnd_.pos.x, self.xdnd_.pos.y); auto wd = bedrock::instance().wd_manager().find_window(reinterpret_cast<native_window_type>(evt.xclient.window), self.xdnd_.pos.x, self.xdnd_.pos.y);
if(wd && wd->flags.dropable) if(wd && wd->flags.dropable)
{ {
accepted = true; accepted = true;

View File

@ -11,9 +11,7 @@
* *
* This file provides basis class and data structrue that required by nana * This file provides basis class and data structrue that required by nana
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <shellapi.h> #include <shellapi.h>
#include <stdexcept> #include <stdexcept>
@ -63,14 +61,19 @@ namespace detail
return color_; return color_;
} }
unsigned drawable_impl_type::get_text_color() const
{
return text_color_;
}
void drawable_impl_type::set_color(const ::nana::color& clr) void drawable_impl_type::set_color(const ::nana::color& clr)
{ {
color_ = clr.px_color().value; color_ = (clr.px_color().value & 0xFFFFFF);
} }
void drawable_impl_type::set_text_color(const ::nana::color& clr) void drawable_impl_type::set_text_color(const ::nana::color& clr)
{ {
auto rgb = clr.px_color().value; auto rgb = (clr.px_color().value & 0xFFFFFF);
if (text_color_ != rgb) if (text_color_ != rgb)
{ {
::SetTextColor(context, NANA_RGB(rgb)); ::SetTextColor(context, NANA_RGB(rgb));

View File

@ -1,71 +0,0 @@
/*
* Exception Definition
* Copyright(C) 2003-2013 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/exceptions.cpp
*/
#include <nana/exceptions.hpp>
namespace nana
{
//class thrd_exit
thrd_exit::thrd_exit(unsigned retval):retval_(retval){}
thrd_exit::~thrd_exit() throw(){}
const char* thrd_exit::what() const throw(){ return "Exit-Threading Exception"; }
unsigned thrd_exit::retval() const { return retval_; }
//end class thrd_exit
//class bad_member
bad_member::bad_member(const std::string& what):what_(what){}
bad_member::~bad_member() throw(){}
const char* bad_member::what() const throw()
{
return what_.c_str();
}
//end class bad_member
//class bad_syntax
bad_syntax::bad_syntax(const std::string& what):what_(what){}
bad_syntax::~bad_syntax() throw(){}
const char* bad_syntax::what() const throw()
{
return what_.c_str();
}
//end class bad_syntax
//class bad_error
bad_error::bad_error(const std::string& what):what_(what){}
bad_error::~bad_error() throw(){}
const char* bad_error::what() const throw()
{
return what_.c_str();
}
//end class bad_error
//class bad_handle: public std::exception
bad_handle::bad_handle(const std::string& what):what_(what){}
bad_handle::~bad_handle() throw(){}
const char* bad_handle::what() const throw()
{
return what_.c_str();
}
//end class bad_handle
//class bad_window
bad_window::bad_window(const char* what)
:what_(what)
{}
bad_window::~bad_window() throw(){}
const char* bad_window::what() const throw()
{
return what_.c_str();
}
//end class bad_window
} //end namespace nana

View File

@ -430,7 +430,7 @@ namespace nana {
delete[] p; delete[] p;
return s; return s;
} }
return buf; return nana::string(buf);
} }
#elif defined(NANA_LINUX) #elif defined(NANA_LINUX)
const char * s = ::getenv("PWD"); const char * s = ::getenv("PWD");

View File

@ -18,6 +18,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <map>
#include <algorithm> #include <algorithm>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) #if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
@ -181,12 +182,11 @@ namespace nana
//Only list whos iterator would not invalided after a insertion. //Only list whos iterator would not invalided after a insertion.
std::list<frame> frames; std::list<frame> frames;
std::list<frame>::iterator this_frame; std::list<frame>::iterator this_frame;
std::size_t pos_in_this_frame; std::size_t pos_in_this_frame{ 0 };
mutable bool good_frame_by_frmbuilder; //It indicates the state of frame whether is valid. mutable bool good_frame_by_frmbuilder{ false }; //It indicates the state of frame whether is valid.
impl() impl()
: this_frame(frames.end()), pos_in_this_frame(0), : this_frame(frames.end())
good_frame_by_frmbuilder(false)
{} {}
//Render A frame on the set of windows. //Render A frame on the set of windows.
@ -342,8 +342,6 @@ namespace nana
void set_fps(impl*, std::size_t new_fps); void set_fps(impl*, std::size_t new_fps);
void close(impl* p); void close(impl* p);
bool empty() const; bool empty() const;
private:
void _m_perf_thread(thread_variable* thrvar);
private: private:
mutable std::recursive_mutex mutex_; mutable std::recursive_mutex mutex_;
std::vector<thread_variable*> threads_; std::vector<thread_variable*> threads_;
@ -457,7 +455,48 @@ namespace nana
thr->interval = 1000.0 / double(p->fps); thr->interval = 1000.0 / double(p->fps);
thr->thread = std::make_shared<std::thread>([this, thr]() thr->thread = std::make_shared<std::thread>([this, thr]()
{ {
_m_perf_thread(thr); nana::system::timepiece tmpiece;
while (true)
{
thr->active = 0;
tmpiece.start();
{
std::lock_guard<decltype(thr->mutex)> lock(thr->mutex);
for (auto ani : thr->animations)
{
if (ani->paused)
continue;
ani->render_this_frame();
if (false == ani->move_to_next())
{
if (ani->looped)
{
ani->reset();
++thr->active;
}
}
else
++thr->active;
}
}
if (thr->active)
{
thr->performance_parameter = tmpiece.calc();
if (thr->performance_parameter < thr->interval)
nana::system::sleep(static_cast<unsigned>(thr->interval - thr->performance_parameter));
}
else
{
//There isn't an active frame, then let the thread
//wait for a signal for an active animation
std::unique_lock<std::mutex> lock(thr->mutex);
if (0 == thr->active)
thr->condvar.wait(lock);
}
}
}); });
threads_.push_back(thr); threads_.push_back(thr);
@ -519,58 +558,16 @@ namespace nana
} }
return true; return true;
} }
void animation::performance_manager::_m_perf_thread(thread_variable* thrvar)
{
nana::system::timepiece tmpiece;
while(true)
{
thrvar->active = 0;
tmpiece.start();
{
std::lock_guard<decltype(thrvar->mutex)> lock(thrvar->mutex);
for(auto ani : thrvar->animations)
{
if(ani->paused)
continue;
ani->render_this_frame();
if(false == ani->move_to_next())
{
if(ani->looped)
{
ani->reset();
++thrvar->active;
}
}
else
++thrvar->active;
}
}
if(thrvar->active)
{
thrvar->performance_parameter = tmpiece.calc();
if(thrvar->performance_parameter < thrvar->interval)
nana::system::sleep(static_cast<unsigned>(thrvar->interval - thrvar->performance_parameter));
}
else
{
//There isn't an active frame, then let the thread
//wait for a signal for an active animation
std::unique_lock<std::mutex> lock(thrvar->mutex);
if(0 == thrvar->active)
thrvar->condvar.wait(lock);
}
}
}
//end class animation::performance_manager //end class animation::performance_manager
animation::animation(std::size_t fps) animation::animation(std::size_t fps)
: impl_(new impl(fps)) : impl_(new impl(fps))
{ {
}
animation::~animation()
{
delete impl_;
} }
void animation::push_back(frameset frms) void animation::push_back(frameset frms)

View File

@ -10,8 +10,7 @@
* @file: nana/gui/detail/bedrock_pi.cpp * @file: nana/gui/detail/bedrock_pi.cpp
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <nana/gui/detail/bedrock_pi_data.hpp> #include <nana/gui/detail/bedrock_pi_data.hpp>
#include <nana/gui/detail/event_code.hpp> #include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
@ -29,12 +28,12 @@ namespace nana
//class internal_scope_guard //class internal_scope_guard
internal_scope_guard::internal_scope_guard() internal_scope_guard::internal_scope_guard()
{ {
detail::bedrock::instance().wd_manager.internal_lock().lock(); detail::bedrock::instance().wd_manager().internal_lock().lock();
} }
internal_scope_guard::~internal_scope_guard() internal_scope_guard::~internal_scope_guard()
{ {
detail::bedrock::instance().wd_manager.internal_lock().unlock(); detail::bedrock::instance().wd_manager().internal_lock().unlock();
} }
//end class internal_scope_guard //end class internal_scope_guard
@ -54,12 +53,12 @@ namespace nana
{ {
void events_operation_register(event_handle evt) void events_operation_register(event_handle evt)
{ {
bedrock::instance().evt_operation.register_evt(evt); bedrock::instance().evt_operation().register_evt(evt);
} }
void events_operation_cancel(event_handle evt) void events_operation_cancel(event_handle evt)
{ {
bedrock::instance().evt_operation.cancel(evt); bedrock::instance().evt_operation().cancel(evt);
} }
class bedrock::flag_guard class bedrock::flag_guard
@ -73,7 +72,7 @@ namespace nana
~flag_guard() ~flag_guard()
{ {
if (brock_->wd_manager.available((wd_))) if (brock_->wd_manager().available((wd_)))
wd_->flags.refreshing = false; wd_->flags.refreshing = false;
} }
private: private:
@ -82,6 +81,31 @@ namespace nana
}; };
events_operation& bedrock::evt_operation()
{
return pi_data_->evt_operation;
}
window_manager& bedrock::wd_manager()
{
return pi_data_->wd_manager;
}
void bedrock::manage_form_loader(core_window_t* wd, bool insert_or_remove)
{
if (insert_or_remove)
{
pi_data_->auto_form_set.insert(wd);
return;
}
if (pi_data_->auto_form_set.erase(wd))
{
auto p = wd->widget_notifier->widget_ptr();
delete p;
}
}
void bedrock::event_expose(core_window_t * wd, bool exposed) void bedrock::event_expose(core_window_t * wd, bool exposed)
{ {
if (nullptr == wd) return; if (nullptr == wd) return;
@ -113,11 +137,11 @@ namespace nana
wd = wd->seek_non_lite_widget_ancestor(); wd = wd->seek_non_lite_widget_ancestor();
} }
else if (category::flags::frame == wd->other.category) else if (category::flags::frame == wd->other.category)
wd = wd_manager.find_window(wd->root, wd->pos_root.x, wd->pos_root.y); wd = wd_manager().find_window(wd->root, wd->pos_root.x, wd->pos_root.y);
} }
wd_manager.refresh_tree(wd); wd_manager().refresh_tree(wd);
wd_manager.map(wd, false); wd_manager().map(wd, false);
} }
} }
@ -130,13 +154,13 @@ namespace nana
arg.x = x; arg.x = x;
arg.y = y; arg.y = y;
if (emit(event_code::move, wd, arg, false, get_thread_context())) if (emit(event_code::move, wd, arg, false, get_thread_context()))
wd_manager.update(wd, false, true); wd_manager().update(wd, false, true);
} }
} }
bool bedrock::event_msleave(core_window_t* hovered) bool bedrock::event_msleave(core_window_t* hovered)
{ {
if (wd_manager.available(hovered) && hovered->flags.enabled) if (wd_manager().available(hovered) && hovered->flags.enabled)
{ {
hovered->flags.action = mouse_action::normal; hovered->flags.action = mouse_action::normal;
@ -155,7 +179,7 @@ namespace nana
void bedrock::update_cursor(core_window_t * wd) void bedrock::update_cursor(core_window_t * wd)
{ {
internal_scope_guard isg; internal_scope_guard isg;
if (wd_manager.available(wd)) if (wd_manager().available(wd))
{ {
auto * thrd = get_thread_context(wd->thread_id); auto * thrd = get_thread_context(wd->thread_id);
if (nullptr == thrd) if (nullptr == thrd)
@ -167,7 +191,7 @@ namespace nana
return; return;
native_interface::calc_window_point(native_handle, pos); native_interface::calc_window_point(native_handle, pos);
if (wd != wd_manager.find_window(native_handle, pos.x, pos.y)) if (wd != wd_manager().find_window(native_handle, pos.x, pos.y))
return; return;
set_cursor(wd, wd->predef_cursor, thrd); set_cursor(wd, wd->predef_cursor, thrd);
@ -179,7 +203,7 @@ namespace nana
return pi_data_->scheme.scheme_template(std::move(factory)); return pi_data_->scheme.scheme_template(std::move(factory));
} }
std::unique_ptr<widget_colors> bedrock::make_scheme(scheme_factory_base&& factory) widget_colors* bedrock::make_scheme(scheme_factory_base&& factory)
{ {
return pi_data_->scheme.create(std::move(factory)); return pi_data_->scheme.create(std::move(factory));
} }
@ -415,7 +439,7 @@ namespace nana
void bedrock::_m_except_handler() void bedrock::_m_except_handler()
{ {
std::vector<core_window_t*> v; std::vector<core_window_t*> v;
wd_manager.all_handles(v); wd_manager().all_handles(v);
if (v.size()) if (v.size())
{ {
std::vector<native_window_type> roots; std::vector<native_window_type> roots;
@ -432,7 +456,7 @@ namespace nana
} }
for (auto i : roots) for (auto i : roots)
interface_type::close_window(i); native_interface::close_window(i);
} }
} }
}//end namespace detail }//end namespace detail

View File

@ -76,12 +76,12 @@ namespace nana
//Creates a scheme template if no template //Creates a scheme template if no template
if (!tmpl_scheme) if (!tmpl_scheme)
factory.create().swap(tmpl_scheme); tmpl_scheme.reset(factory.create());
return *tmpl_scheme.get(); return *tmpl_scheme.get();
} }
std::unique_ptr<widget_colors> color_schemes::create(scheme_factory_base&& factory) widget_colors* color_schemes::create(scheme_factory_base&& factory)
{ {
return factory.create(scheme_template(std::move(factory))); return factory.create(scheme_template(std::move(factory)));
} }

View File

@ -5,7 +5,7 @@ namespace nana
namespace detail namespace detail
{ {
//class events_operation //class events_operation
typedef std::lock_guard<std::recursive_mutex> lock_guard; using lock_guard = std::lock_guard<std::recursive_mutex>;
void events_operation::make(window wd, const std::shared_ptr<general_events>& sp) void events_operation::make(window wd, const std::shared_ptr<general_events>& sp)
{ {
@ -22,21 +22,21 @@ namespace nana
void events_operation::register_evt(event_handle evt) void events_operation::register_evt(event_handle evt)
{ {
lock_guard lock(mutex_); lock_guard lock(mutex_);
register_.insert(evt); handles_.insert(evt);
} }
void events_operation::cancel(event_handle evt) void events_operation::cancel(event_handle evt)
{ {
lock_guard lock(mutex_); lock_guard lock(mutex_);
register_.erase(evt); handles_.erase(evt);
} }
void events_operation::erase(event_handle evt) void events_operation::erase(event_handle evt)
{ {
lock_guard lock(mutex_); lock_guard lock(mutex_);
auto i = register_.find(evt); auto i = handles_.find(evt);
if (i != register_.end()) if (i != handles_.end())
{ {
reinterpret_cast<detail::docker_interface*>(evt)->get_event()->remove(evt); reinterpret_cast<detail::docker_interface*>(evt)->get_event()->remove(evt);
} }

View File

@ -10,8 +10,7 @@
* @file: nana/gui/detail/linux_X11/bedrock.cpp * @file: nana/gui/detail/linux_X11/bedrock.cpp
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <nana/gui/detail/bedrock_pi_data.hpp> #include <nana/gui/detail/bedrock_pi_data.hpp>
#include <nana/gui/detail/event_code.hpp> #include <nana/gui/detail/event_code.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
@ -233,7 +232,7 @@ namespace detail
if(wd) if(wd)
{ {
internal_scope_guard isg; internal_scope_guard isg;
if(wd_manager.available(wd)) if(wd_manager().available(wd))
return wd->other.category; return wd->other.category;
} }
return category::flags::super; return category::flags::super;
@ -241,21 +240,10 @@ namespace detail
bedrock::core_window_t* bedrock::focus() bedrock::core_window_t* bedrock::focus()
{ {
core_window_t* wd = wd_manager.root(native_interface::get_focus_window()); core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
return (wd ? wd->other.attribute.root->focus : 0); return (wd ? wd->other.attribute.root->focus : 0);
} }
native_window_type bedrock::root(core_window_t* wd)
{
if(wd)
{
internal_scope_guard isg;
if(wd_manager.available(wd))
return wd->root;
}
return nullptr;
}
void bedrock::set_menubar_taken(core_window_t* wd) void bedrock::set_menubar_taken(core_window_t* wd)
{ {
auto pre = impl_->menu.taken_window; auto pre = impl_->menu.taken_window;
@ -265,8 +253,8 @@ namespace detail
if ((!wd) && pre) if ((!wd) && pre)
{ {
internal_scope_guard lock; internal_scope_guard lock;
wd_manager.set_focus(pre, false); wd_manager().set_focus(pre, false);
wd_manager.update(pre, true, false); wd_manager().update(pre, true, false);
} }
} }
@ -381,17 +369,9 @@ namespace detail
//No implementation for Linux //No implementation for Linux
} }
bool bedrock::emit(event_code evt_code, core_window_t* wd, const arg_mouse& arg, bool ask_update, thread_context* thrd)
{
if(evt_code != arg.evt_code)
throw std::runtime_error("Nana.bedrock: Invalid event arg.");
return emit(evt_code, wd, static_cast<const ::nana::event_arg&>(arg), ask_update, thrd);
}
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd) bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd)
{ {
if(wd_manager.available(wd) == false) if(wd_manager().available(wd) == false)
return false; return false;
core_window_t * prev_wd; core_window_t * prev_wd;
@ -408,7 +388,7 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg); _m_emit_core(evt_code, wd, false, arg);
if(ask_update) if(ask_update)
wd_manager.do_lazy_refresh(wd, false); wd_manager().do_lazy_refresh(wd, false);
else else
wd->other.upd_state = core_window_t::update_state::none; wd->other.upd_state = core_window_t::update_state::none;
@ -418,7 +398,7 @@ namespace detail
bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd) bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd)
{ {
if(wd_manager.available(wd) == false) if(wd_manager().available(wd) == false)
return false; return false;
core_window_t * prev_wd; core_window_t * prev_wd;
@ -541,7 +521,7 @@ namespace detail
static auto& brock = detail::bedrock::instance(); static auto& brock = detail::bedrock::instance();
auto native_window = reinterpret_cast<native_window_type>(msg.u.packet_window); auto native_window = reinterpret_cast<native_window_type>(msg.u.packet_window);
auto root_runtime = brock.wd_manager.root_runtime(native_window); auto root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime) if(root_runtime)
{ {
@ -550,7 +530,7 @@ namespace detail
switch(msg.kind) switch(msg.kind)
{ {
case nana::detail::msg_packet_tag::kind_mouse_drop: case nana::detail::msg_packet_tag::kind_mouse_drop:
msgwd = brock.wd_manager.find_window(native_window, msg.u.mouse_drop.x, msg.u.mouse_drop.y); msgwd = brock.wd_manager().find_window(native_window, msg.u.mouse_drop.x, msg.u.mouse_drop.y);
if(msgwd) if(msgwd)
{ {
arg_dropfiles arg; arg_dropfiles arg;
@ -560,7 +540,7 @@ namespace detail
arg.pos.x = msg.u.mouse_drop.x - msgwd->pos_root.x; arg.pos.x = msg.u.mouse_drop.x - msgwd->pos_root.x;
arg.pos.y = msg.u.mouse_drop.y - msgwd->pos_root.y; arg.pos.y = msg.u.mouse_drop.y - msgwd->pos_root.y;
msgwd->together.events_ptr->mouse_dropfiles.emit(arg); msgwd->together.events_ptr->mouse_dropfiles.emit(arg);
brock.wd_manager.do_lazy_refresh(msgwd, false); brock.wd_manager().do_lazy_refresh(msgwd, false);
} }
break; break;
default: default:
@ -572,7 +552,7 @@ namespace detail
template<typename Arg> template<typename Arg>
void emit_drawer(void(::nana::detail::drawer::*event_ptr)(const Arg&), basic_window* wd, const Arg& arg, bedrock::thread_context* thrd) void emit_drawer(void(::nana::detail::drawer::*event_ptr)(const Arg&), basic_window* wd, const Arg& arg, bedrock::thread_context* thrd)
{ {
if(bedrock::instance().wd_manager.available(wd) == false) if(bedrock::instance().wd_manager().available(wd) == false)
return; return;
basic_window * pre_wd; basic_window * pre_wd;
if(thrd) if(thrd)
@ -597,7 +577,7 @@ namespace detail
static core_window_t* last_mouse_down_window; static core_window_t* last_mouse_down_window;
auto native_window = reinterpret_cast<native_window_type>(event_window(xevent)); auto native_window = reinterpret_cast<native_window_type>(event_window(xevent));
auto root_runtime = brock.wd_manager.root_runtime(native_window); auto root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime) if(root_runtime)
{ {
@ -612,7 +592,7 @@ namespace detail
switch(xevent.type) switch(xevent.type)
{ {
case EnterNotify: case EnterNotify:
msgwnd = brock.wd_manager.find_window(native_window, xevent.xcrossing.x, xevent.xcrossing.y); msgwnd = brock.wd_manager().find_window(native_window, xevent.xcrossing.x, xevent.xcrossing.y);
if(msgwnd) if(msgwnd)
{ {
if (mouse_action::pressed != msgwnd->flags.action) if (mouse_action::pressed != msgwnd->flags.action)
@ -626,7 +606,7 @@ namespace detail
arg.evt_code = event_code::mouse_move; arg.evt_code = event_code::mouse_move;
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context); brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
if (!brock.wd_manager.available(hovered_wd)) if (!brock.wd_manager().available(hovered_wd))
hovered_wd = nullptr; hovered_wd = nullptr;
} }
break; break;
@ -646,7 +626,7 @@ namespace detail
arg.receiver = native_window; arg.receiver = native_window;
arg.getting = true; arg.getting = true;
if(!brock.emit(event_code::focus, focus, arg, true, &context)) if(!brock.emit(event_code::focus, focus, arg, true, &context))
brock.wd_manager.set_focus(msgwnd, true); brock.wd_manager().set_focus(msgwnd, true);
} }
break; break;
case FocusOut: case FocusOut:
@ -672,7 +652,7 @@ namespace detail
if(msgwnd->dimension.width != static_cast<unsigned>(xevent.xconfigure.width) || msgwnd->dimension.height != static_cast<unsigned>(xevent.xconfigure.height)) if(msgwnd->dimension.width != static_cast<unsigned>(xevent.xconfigure.width) || msgwnd->dimension.height != static_cast<unsigned>(xevent.xconfigure.height))
{ {
auto & cf = xevent.xconfigure; auto & cf = xevent.xconfigure;
brock.wd_manager.size(msgwnd, nana::size{static_cast<unsigned>(cf.width), static_cast<unsigned>(cf.height)}, true, true); brock.wd_manager().size(msgwnd, nana::size{static_cast<unsigned>(cf.width), static_cast<unsigned>(cf.height)}, true, true);
} }
if(msgwnd->pos_native.x != xevent.xconfigure.x || msgwnd->pos_native.y != xevent.xconfigure.y) if(msgwnd->pos_native.x != xevent.xconfigure.x || msgwnd->pos_native.y != xevent.xconfigure.y)
@ -686,7 +666,7 @@ namespace detail
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5) if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
break; break;
msgwnd = brock.wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y); msgwnd = brock.wd_manager().find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
if(nullptr == msgwnd) break; if(nullptr == msgwnd) break;
if ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true)) if ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true))
@ -706,9 +686,9 @@ namespace detail
if (new_focus && !new_focus->flags.ignore_mouse_focus) if (new_focus && !new_focus->flags.ignore_mouse_focus)
{ {
context.event_window = new_focus; context.event_window = new_focus;
auto kill_focus = brock.wd_manager.set_focus(new_focus, false); auto kill_focus = brock.wd_manager().set_focus(new_focus, false);
if (kill_focus != new_focus) if (kill_focus != new_focus)
brock.wd_manager.do_lazy_refresh(kill_focus, false); brock.wd_manager().do_lazy_refresh(kill_focus, false);
} }
} }
@ -722,7 +702,7 @@ namespace detail
arg.evt_code = dbl_click ? event_code::dbl_click : event_code::mouse_down; arg.evt_code = dbl_click ? event_code::dbl_click : event_code::mouse_down;
if(brock.emit(arg.evt_code, msgwnd, arg, true, &context)) if(brock.emit(arg.evt_code, msgwnd, arg, true, &context))
{ {
if (brock.wd_manager.available(msgwnd)) if (brock.wd_manager().available(msgwnd))
{ {
pressed_wd = msgwnd; pressed_wd = msgwnd;
//If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event. //If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
@ -731,7 +711,7 @@ namespace detail
//call the drawer mouse up event for restoring the surface graphics //call the drawer mouse up event for restoring the surface graphics
msgwnd->flags.action = mouse_action::normal; msgwnd->flags.action = mouse_action::normal;
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context); emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
} }
} }
@ -758,7 +738,7 @@ namespace detail
} }
else else
{ {
msgwnd = brock.wd_manager.find_window(native_window, xevent.xbutton.x, xevent.xbutton.y); msgwnd = brock.wd_manager().find_window(native_window, xevent.xbutton.x, xevent.xbutton.y);
if(nullptr == msgwnd) if(nullptr == msgwnd)
break; break;
@ -786,7 +766,7 @@ namespace detail
} }
//Do mouse_up, this handle may be closed by click handler. //Do mouse_up, this handle may be closed by click handler.
if(brock.wd_manager.available(msgwnd) && msgwnd->flags.enabled) if(brock.wd_manager().available(msgwnd) && msgwnd->flags.enabled)
{ {
if(hit) if(hit)
msgwnd->flags.action = mouse_action::over; msgwnd->flags.action = mouse_action::over;
@ -805,7 +785,7 @@ namespace detail
evt_ptr->click.emit(arg); evt_ptr->click.emit(arg);
} }
if (brock.wd_manager.available(msgwnd)) if (brock.wd_manager().available(msgwnd))
{ {
arg.evt_code = event_code::mouse_up; arg.evt_code = event_code::mouse_up;
evt_ptr->mouse_up.emit(arg); evt_ptr->mouse_up.emit(arg);
@ -818,7 +798,7 @@ namespace detail
arg.by_mouse = true; arg.by_mouse = true;
msgwnd->together.events_ptr->click.emit(arg); msgwnd->together.events_ptr->click.emit(arg);
} }
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
pressed_wd = nullptr; pressed_wd = nullptr;
} }
@ -826,7 +806,7 @@ namespace detail
case DestroyNotify: case DestroyNotify:
{ {
auto & spec = nana::detail::platform_spec::instance(); auto & spec = nana::detail::platform_spec::instance();
if(brock.wd_manager.available(msgwnd)) if(brock.wd_manager().available(msgwnd))
{ {
//The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window(). //The msgwnd may be destroyed if the window is destroyed by calling native interface of close_window().
if (msgwnd->root == brock.get_menu()) if (msgwnd->root == brock.get_menu())
@ -836,10 +816,10 @@ namespace detail
} }
spec.remove(native_window); spec.remove(native_window);
brock.wd_manager.destroy(msgwnd); brock.wd_manager().destroy(msgwnd);
brock.rt_manager.remove_if_exists(msgwnd); brock.manage_form_loader(msgwnd, false);
brock.wd_manager.destroy_handle(msgwnd); brock.wd_manager().destroy_handle(msgwnd);
} }
} }
break; break;
@ -854,8 +834,8 @@ namespace detail
else else
break; break;
msgwnd = brock.wd_manager.find_window(native_window, xevent.xmotion.x, xevent.xmotion.y); msgwnd = brock.wd_manager().find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
if (brock.wd_manager.available(hovered_wd) && (msgwnd != hovered_wd)) if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
{ {
brock.event_msleave(hovered_wd); brock.event_msleave(hovered_wd);
hovered_wd->flags.action = mouse_action::normal; hovered_wd->flags.action = mouse_action::normal;
@ -863,14 +843,14 @@ namespace detail
//if msgwnd is neither a captured window nor a child of captured window, //if msgwnd is neither a captured window nor a child of captured window,
//redirect the msgwnd to the captured window. //redirect the msgwnd to the captured window.
auto cap_wd = brock.wd_manager.capture_redirect(msgwnd); auto cap_wd = brock.wd_manager().capture_redirect(msgwnd);
if(cap_wd) if(cap_wd)
msgwnd = cap_wd; msgwnd = cap_wd;
} }
else if(msgwnd) else if(msgwnd)
{ {
bool prev_captured_inside; bool prev_captured_inside;
if(brock.wd_manager.capture_window_entered(xevent.xmotion.x, xevent.xmotion.y, prev_captured_inside)) if(brock.wd_manager().capture_window_entered(xevent.xmotion.x, xevent.xmotion.y, prev_captured_inside))
{ {
event_code evt_code; event_code evt_code;
if(prev_captured_inside) if(prev_captured_inside)
@ -909,7 +889,7 @@ namespace detail
arg.evt_code = event_code::mouse_move; arg.evt_code = event_code::mouse_move;
brock.emit(event_code::mouse_move, msgwnd, arg, true, &context); brock.emit(event_code::mouse_move, msgwnd, arg, true, &context);
} }
if (!brock.wd_manager.available(hovered_wd)) if (!brock.wd_manager().available(hovered_wd))
hovered_wd = nullptr; hovered_wd = nullptr;
break; break;
case MapNotify: case MapNotify:
@ -1010,11 +990,11 @@ namespace detail
{ {
arg_keyboard argkey; arg_keyboard argkey;
brock.get_key_state(argkey); brock.get_key_state(argkey);
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, !argkey.shift); auto tstop_wd = brock.wd_manager().tabstop(msgwnd, !argkey.shift);
if (tstop_wd) if (tstop_wd)
{ {
brock.wd_manager.set_focus(tstop_wd, false); brock.wd_manager().set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true); brock.wd_manager().do_lazy_refresh(tstop_wd, true);
} }
} }
else if(keyboard::alt == keychar) else if(keyboard::alt == keychar)
@ -1050,7 +1030,7 @@ namespace detail
arg.window_handle = reinterpret_cast<window>(msgwnd); arg.window_handle = reinterpret_cast<window>(msgwnd);
brock.emit(event_code::key_press, msgwnd, arg, true, &context); brock.emit(event_code::key_press, msgwnd, arg, true, &context);
if((XLookupKeySym == status) && (brock.wd_manager.available(msgwnd))) if((XLookupKeySym == status) && (brock.wd_manager().available(msgwnd)))
{ {
//call key_char event if status is XLookupKeySym to avaid calling key_char //call key_char event if status is XLookupKeySym to avaid calling key_char
//twice, because the status would be equal to XLookupChars if the input method is //twice, because the status would be equal to XLookupChars if the input method is
@ -1069,7 +1049,7 @@ namespace detail
if(XLookupKeySym == status) if(XLookupKeySym == status)
{ {
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
break; break;
} }
case XLookupChars: case XLookupChars:
@ -1099,7 +1079,7 @@ namespace detail
arg.ctrl = arg.shift = false; arg.ctrl = arg.shift = false;
arg.evt_code = event_code::shortkey; arg.evt_code = event_code::shortkey;
brock.set_keyboard_shortkey(true); brock.set_keyboard_shortkey(true);
auto shr_wd = brock.wd_manager.find_shortkey(native_window, arg.key); auto shr_wd = brock.wd_manager().find_shortkey(native_window, arg.key);
if(shr_wd) if(shr_wd)
{ {
arg.window_handle = reinterpret_cast<window>(shr_wd); arg.window_handle = reinterpret_cast<window>(shr_wd);
@ -1112,7 +1092,7 @@ namespace detail
brock.get_key_state(arg); brock.get_key_state(arg);
msgwnd->together.events_ptr->key_char.emit(arg); msgwnd->together.events_ptr->key_char.emit(arg);
if(arg.ignore == false && brock.wd_manager.available(msgwnd)) if(arg.ignore == false && brock.wd_manager().available(msgwnd))
brock.emit_drawer(event_code::key_char, msgwnd, arg, &context); brock.emit_drawer(event_code::key_char, msgwnd, arg, &context);
} }
@ -1121,7 +1101,7 @@ namespace detail
} }
break; break;
} }
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
if(keybuf != fixbuf) if(keybuf != fixbuf)
delete [] keybuf; delete [] keybuf;
} }
@ -1156,7 +1136,7 @@ namespace detail
{ {
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus); bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
if (set_focus) if (set_focus)
brock.wd_manager.set_focus(msgwnd, false); brock.wd_manager().set_focus(msgwnd, false);
arg_keyboard arg; arg_keyboard arg;
arg.evt_code = event_code::key_release; arg.evt_code = event_code::key_release;
@ -1194,7 +1174,7 @@ namespace detail
} }
} }
root_runtime = brock.wd_manager.root_runtime(native_window); root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime) if(root_runtime)
{ {
context.event_window = pre_event_window; context.event_window = pre_event_window;
@ -1207,8 +1187,11 @@ namespace detail
if(context) context->event_window = pre_event_window; if(context) context->event_window = pre_event_window;
} }
auto thread_id = ::nana::system::this_thread_id();
brock.wd_manager().call_safe_place(thread_id);
if(msgwnd) if(msgwnd)
brock.wd_manager.remove_trash_handle(::nana::system::this_thread_id()); brock.wd_manager().remove_trash_handle(thread_id);
} }
} }
@ -1223,18 +1206,18 @@ namespace detail
} }
++(context->event_pump_ref_count); ++(context->event_pump_ref_count);
wd_manager.internal_lock().revert(); wd_manager().internal_lock().revert();
native_window_type owner_native = 0; native_window_type owner_native = 0;
core_window_t * owner = 0; core_window_t * owner = 0;
if(modal_window) if(modal_window)
{ {
native_window_type modal = root(reinterpret_cast<core_window_t*>(modal_window)); native_window_type modal = reinterpret_cast<core_window_t*>(modal_window)->root;
owner_native = native_interface::get_owner_window(modal); owner_native = native_interface::get_owner_window(modal);
if(owner_native) if(owner_native)
{ {
native_interface::enable_window(owner_native, false); native_interface::enable_window(owner_native, false);
owner = wd_manager.root(owner_native); owner = wd_manager().root(owner_native);
if(owner) if(owner)
owner->flags.enabled = false; owner->flags.enabled = false;
} }
@ -1249,7 +1232,7 @@ namespace detail
native_interface::enable_window(owner_native, true); native_interface::enable_window(owner_native, true);
} }
wd_manager.internal_lock().forward(); wd_manager().internal_lock().forward();
if(0 == --(context->event_pump_ref_count)) if(0 == --(context->event_pump_ref_count))
{ {
if(0 == modal_window || 0 == context->window_count) if(0 == modal_window || 0 == context->window_count)
@ -1335,7 +1318,7 @@ namespace detail
void bedrock::undefine_state_cursor(core_window_t * wd, thread_context* thrd) void bedrock::undefine_state_cursor(core_window_t * wd, thread_context* thrd)
{ {
if (!wd_manager.available(wd)) if (!wd_manager().available(wd))
return; return;
wd->root_widget->other.attribute.root->state_cursor = nana::cursor::arrow; wd->root_widget->other.attribute.root->state_cursor = nana::cursor::arrow;
@ -1347,7 +1330,7 @@ namespace detail
return; return;
native_interface::calc_window_point(native_handle, pos); native_interface::calc_window_point(native_handle, pos);
auto rev_wd = wd_manager.find_window(native_handle, pos.x, pos.y); auto rev_wd = wd_manager().find_window(native_handle, pos.x, pos.y);
if (rev_wd) if (rev_wd)
set_cursor(rev_wd, rev_wd->predef_cursor, thrd); set_cursor(rev_wd, rev_wd->predef_cursor, thrd);
} }

View File

@ -1,7 +1,7 @@
/* /*
* Platform Implementation * Platform Implementation
* Nana C++ Library(http://www.nanapro.org) * 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. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -10,8 +10,7 @@
* @file: nana/gui/detail/native_window_interface.cpp * @file: nana/gui/detail/native_window_interface.cpp
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <nana/gui/detail/native_window_interface.hpp> #include <nana/gui/detail/native_window_interface.hpp>
#include <nana/gui/screen.hpp> #include <nana/gui/screen.hpp>
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
@ -25,6 +24,7 @@
#elif defined(NANA_X11) #elif defined(NANA_X11)
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/window_manager.hpp>
#endif #endif
namespace nana{ namespace nana{
@ -542,32 +542,6 @@ namespace nana{
return false; return false;
} }
/*
bool native_interface::window_icon(native_window_type wd, const paint::image& big_icon, const paint::image& small_icon) //deprecated
{
#if defined(NANA_WINDOWS)
HICON h_big_icon = paint::image_accessor::icon(big_icon);
HICON h_small_icon = paint::image_accessor::icon(small_icon);
if (h_big_icon || h_small_icon)
{
nana::detail::platform_spec::instance().keep_window_icon(wd, (!big_icon.empty() ? big_icon : small_icon));
if (h_big_icon) {
::SendMessage(reinterpret_cast<HWND>(wd), WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(h_big_icon));
}
if (h_small_icon) {
::SendMessage(reinterpret_cast<HWND>(wd), WM_SETICON, ICON_SMALL, reinterpret_cast<WPARAM>(h_small_icon));
}
return true;
}
#elif defined(NANA_X11)
return window_icon(wd, big_icon);
#endif
return false;
}
*/
void native_interface::activate_owner(native_window_type wd) void native_interface::activate_owner(native_window_type wd)
{ {
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
@ -621,7 +595,7 @@ namespace nana{
Display* disp = restrict::spec.open_display(); Display* disp = restrict::spec.open_display();
restrict::spec.remove(wd); restrict::spec.remove(wd);
auto iwd = brock.wd_manager.root(wd); auto iwd = brock.wd_manager().root(wd);
if(iwd) if(iwd)
{ {
{ {
@ -633,9 +607,9 @@ namespace nana{
::XFlush(disp); ::XFlush(disp);
restrict::spec.rev_error_handler(); restrict::spec.rev_error_handler();
} }
brock.wd_manager.destroy(iwd); brock.wd_manager().destroy(iwd);
brock.rt_manager.remove_if_exists(iwd); brock.manage_form_loader(iwd, false);
brock.wd_manager.destroy_handle(iwd); brock.wd_manager().destroy_handle(iwd);
} }
nana::detail::platform_scope_guard psg; nana::detail::platform_scope_guard psg;

View File

@ -11,9 +11,7 @@
* @contributors: Ariel Vina-Rodriguez * @contributors: Ariel Vina-Rodriguez
*/ */
#include <nana/config.hpp> #include <nana/detail/platform_spec_selector.hpp>
#include PLATFORM_SPEC_HPP
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/bedrock_pi_data.hpp> #include <nana/gui/detail/bedrock_pi_data.hpp>
#include <nana/gui/detail/event_code.hpp> #include <nana/gui/detail/event_code.hpp>
@ -251,10 +249,10 @@ namespace detail
bedrock::~bedrock() bedrock::~bedrock()
{ {
if(wd_manager.number_of_core_window()) if(wd_manager().number_of_core_window())
{ {
std::stringstream ss; std::stringstream ss;
ss<<"Nana.GUI detects a memory leaks in window_manager, "<<static_cast<unsigned>(wd_manager.number_of_core_window())<<" window(s) are not uninstalled."; ss<<"Nana.GUI detects a memory leaks in window_manager, "<<static_cast<unsigned>(wd_manager().number_of_core_window())<<" window(s) are not uninstalled.";
::MessageBoxA(0, ss.str().c_str(), ("Nana C++ Library"), MB_OK); ::MessageBoxA(0, ss.str().c_str(), ("Nana C++ Library"), MB_OK);
} }
@ -364,7 +362,7 @@ namespace detail
++(context->event_pump_ref_count); ++(context->event_pump_ref_count);
auto & intr_locker = wd_manager.internal_lock(); auto & intr_locker = wd_manager().internal_lock();
intr_locker.revert(); intr_locker.revert();
try try
@ -372,8 +370,7 @@ namespace detail
MSG msg; MSG msg;
if(modal_window) if(modal_window)
{ {
HWND native_handle = reinterpret_cast<HWND>( HWND native_handle = reinterpret_cast<HWND>(reinterpret_cast<core_window_t*>(modal_window)->root);
root(reinterpret_cast<core_window_t*>(modal_window)));
if (is_modal) if (is_modal)
{ {
HWND owner = ::GetWindow(native_handle, GW_OWNER); HWND owner = ::GetWindow(native_handle, GW_OWNER);
@ -395,7 +392,7 @@ namespace detail
::TranslateMessage(&msg); ::TranslateMessage(&msg);
::DispatchMessage(&msg); ::DispatchMessage(&msg);
wd_manager.remove_trash_handle(tid); wd_manager().remove_trash_handle(tid);
} }
} }
} }
@ -413,7 +410,8 @@ namespace detail
::DispatchMessage(&msg); ::DispatchMessage(&msg);
} }
wd_manager.remove_trash_handle(tid); wd_manager().call_safe_place(tid);
wd_manager().remove_trash_handle(tid);
if (msg.message == WM_DESTROY && msg.hwnd == native_handle) if (msg.message == WM_DESTROY && msg.hwnd == native_handle)
break; break;
}//end while }//end while
@ -432,7 +430,8 @@ namespace detail
::DispatchMessage(&msg); ::DispatchMessage(&msg);
} }
wd_manager.remove_trash_handle(tid); wd_manager().call_safe_place(tid);
wd_manager().remove_trash_handle(tid);
}//end while }//end while
//Empty these rest messages, there is not a window to process these messages. //Empty these rest messages, there is not a window to process these messages.
@ -605,7 +604,7 @@ namespace detail
case nana::detail::messages::map_thread_root_buffer: case nana::detail::messages::map_thread_root_buffer:
{ {
auto stru = reinterpret_cast<detail::messages::map_thread*>(lParam); auto stru = reinterpret_cast<detail::messages::map_thread*>(lParam);
bedrock.wd_manager.map(reinterpret_cast<bedrock::core_window_t*>(wParam), stru->forced, (stru->ignore_update_area ? nullptr : &stru->update_area)); bedrock.wd_manager().map(reinterpret_cast<bedrock::core_window_t*>(wParam), stru->forced, (stru->ignore_update_area ? nullptr : &stru->update_area));
::UpdateWindow(wd); ::UpdateWindow(wd);
::HeapFree(::GetProcessHeap(), 0, stru); ::HeapFree(::GetProcessHeap(), 0, stru);
} }
@ -758,7 +757,7 @@ namespace detail
template<typename Arg> template<typename Arg>
void emit_drawer(void (::nana::detail::drawer::*event_ptr)(const Arg&), basic_window* wd, const Arg& arg, bedrock::thread_context* thrd) void emit_drawer(void (::nana::detail::drawer::*event_ptr)(const Arg&), basic_window* wd, const Arg& arg, bedrock::thread_context* thrd)
{ {
if (bedrock::instance().wd_manager.available(wd) == false) if (bedrock::instance().wd_manager().available(wd) == false)
return; return;
basic_window* prev_event_wd; basic_window* prev_event_wd;
@ -786,7 +785,7 @@ namespace detail
static restrict::TRACKMOUSEEVENT track = {sizeof track, 0x00000002}; static restrict::TRACKMOUSEEVENT track = {sizeof track, 0x00000002};
auto native_window = reinterpret_cast<native_window_type>(root_window); auto native_window = reinterpret_cast<native_window_type>(root_window);
auto* root_runtime = brock.wd_manager.root_runtime(native_window); auto* root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime) if(root_runtime)
{ {
@ -882,7 +881,7 @@ namespace detail
arg_focus arg; arg_focus arg;
assign_arg(arg, focus, native_window, true); assign_arg(arg, focus, native_window, true);
if (!brock.emit(event_code::focus, focus, arg, true, &context)) if (!brock.emit(event_code::focus, focus, arg, true, &context))
brock.wd_manager.set_focus(msgwnd, true); brock.wd_manager().set_focus(msgwnd, true);
} }
def_window_proc = true; def_window_proc = true;
break; break;
@ -913,21 +912,21 @@ namespace detail
break; break;
case WM_LBUTTONDBLCLK: case WM_MBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_LBUTTONDBLCLK: case WM_MBUTTONDBLCLK: case WM_RBUTTONDBLCLK:
pressed_wd = nullptr; pressed_wd = nullptr;
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y); msgwnd = brock.wd_manager().find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if(msgwnd && msgwnd->flags.enabled) if(msgwnd && msgwnd->flags.enabled)
{ {
if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus) if (msgwnd->flags.take_active && !msgwnd->flags.ignore_mouse_focus)
{ {
auto killed = brock.wd_manager.set_focus(msgwnd, false); auto killed = brock.wd_manager().set_focus(msgwnd, false);
if (killed != msgwnd) if (killed != msgwnd)
brock.wd_manager.do_lazy_refresh(killed, false); brock.wd_manager().do_lazy_refresh(killed, false);
} }
arg_mouse arg; arg_mouse arg;
assign_arg(arg, msgwnd, message, pmdec); assign_arg(arg, msgwnd, message, pmdec);
if (brock.emit(arg.evt_code, msgwnd, arg, true, &context)) if (brock.emit(arg.evt_code, msgwnd, arg, true, &context))
{ {
if (brock.wd_manager.available(msgwnd)) if (brock.wd_manager().available(msgwnd))
pressed_wd = msgwnd; pressed_wd = msgwnd;
} }
} }
@ -937,7 +936,7 @@ namespace detail
def_window_proc = true; def_window_proc = true;
break; break;
case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_RBUTTONDOWN:
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y); msgwnd = brock.wd_manager().find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if(nullptr == msgwnd) break; if(nullptr == msgwnd) break;
//if event on the menubar, just remove the menu if it is not associating with the menubar //if event on the menubar, just remove the menu if it is not associating with the menubar
@ -955,9 +954,9 @@ namespace detail
auto new_focus = (msgwnd->flags.take_active ? msgwnd : msgwnd->other.active_window); auto new_focus = (msgwnd->flags.take_active ? msgwnd : msgwnd->other.active_window);
if (new_focus && (!new_focus->flags.ignore_mouse_focus)) if (new_focus && (!new_focus->flags.ignore_mouse_focus))
{ {
auto kill_focus = brock.wd_manager.set_focus(new_focus, false); auto kill_focus = brock.wd_manager().set_focus(new_focus, false);
if (kill_focus != new_focus) if (kill_focus != new_focus)
brock.wd_manager.do_lazy_refresh(kill_focus, false); brock.wd_manager().do_lazy_refresh(kill_focus, false);
} }
} }
@ -974,14 +973,14 @@ namespace detail
auto pos = native_interface::cursor_position(); auto pos = native_interface::cursor_position();
auto rootwd = native_interface::find_window(pos.x, pos.y); auto rootwd = native_interface::find_window(pos.x, pos.y);
native_interface::calc_window_point(rootwd, pos); native_interface::calc_window_point(rootwd, pos);
if(msgwnd != brock.wd_manager.find_window(rootwd, pos.x, pos.y)) if(msgwnd != brock.wd_manager().find_window(rootwd, pos.x, pos.y))
{ {
//call the drawer mouse up event for restoring the surface graphics //call the drawer mouse up event for restoring the surface graphics
msgwnd->flags.action = mouse_action::normal; msgwnd->flags.action = mouse_action::normal;
arg.evt_code = event_code::mouse_up; arg.evt_code = event_code::mouse_up;
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context); emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
} }
} }
@ -993,7 +992,7 @@ namespace detail
case WM_LBUTTONUP: case WM_LBUTTONUP:
case WM_MBUTTONUP: case WM_MBUTTONUP:
case WM_RBUTTONUP: case WM_RBUTTONUP:
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y); msgwnd = brock.wd_manager().find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if(nullptr == msgwnd) if(nullptr == msgwnd)
break; break;
@ -1020,7 +1019,7 @@ namespace detail
} }
//Do mouse_up, this handle may be closed by click handler. //Do mouse_up, this handle may be closed by click handler.
if(brock.wd_manager.available(msgwnd) && msgwnd->flags.enabled) if(brock.wd_manager().available(msgwnd) && msgwnd->flags.enabled)
{ {
arg.evt_code = event_code::mouse_up; arg.evt_code = event_code::mouse_up;
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context); emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
@ -1033,7 +1032,7 @@ namespace detail
retain->click.emit(arg); retain->click.emit(arg);
} }
if (brock.wd_manager.available(msgwnd)) if (brock.wd_manager().available(msgwnd))
{ {
arg.evt_code = event_code::mouse_up; arg.evt_code = event_code::mouse_up;
retain->mouse_up.emit(arg); retain->mouse_up.emit(arg);
@ -1046,13 +1045,13 @@ namespace detail
arg.by_mouse = true; arg.by_mouse = true;
retain->click.emit(arg); retain->click.emit(arg);
} }
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
pressed_wd = nullptr; pressed_wd = nullptr;
break; break;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y); msgwnd = brock.wd_manager().find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if (brock.wd_manager.available(hovered_wd) && (msgwnd != hovered_wd)) if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
{ {
brock.event_msleave(hovered_wd); brock.event_msleave(hovered_wd);
hovered_wd->flags.action = mouse_action::normal; hovered_wd->flags.action = mouse_action::normal;
@ -1060,7 +1059,7 @@ namespace detail
//if msgwnd is neither captured window nor the child of captured window, //if msgwnd is neither captured window nor the child of captured window,
//redirect the msgwnd to the captured window. //redirect the msgwnd to the captured window.
auto wd = brock.wd_manager.capture_redirect(msgwnd); auto wd = brock.wd_manager().capture_redirect(msgwnd);
if(wd) if(wd)
msgwnd = wd; msgwnd = wd;
} }
@ -1068,7 +1067,7 @@ namespace detail
else if(msgwnd) else if(msgwnd)
{ {
bool prev_captured_inside; bool prev_captured_inside;
if(brock.wd_manager.capture_window_entered(pmdec.mouse.x, pmdec.mouse.y, prev_captured_inside)) if(brock.wd_manager().capture_window_entered(pmdec.mouse.x, pmdec.mouse.y, prev_captured_inside))
{ {
event_code evt_code; event_code evt_code;
if(prev_captured_inside) if(prev_captured_inside)
@ -1113,7 +1112,7 @@ namespace detail
track.hwndTrack = native_window; track.hwndTrack = native_window;
restrict::track_mouse_event(&track); restrict::track_mouse_event(&track);
} }
if (!brock.wd_manager.available(hovered_wd)) if (!brock.wd_manager().available(hovered_wd))
hovered_wd = nullptr; hovered_wd = nullptr;
break; break;
case WM_MOUSELEAVE: case WM_MOUSELEAVE:
@ -1129,7 +1128,7 @@ namespace detail
if (pointer_wd == root_window) if (pointer_wd == root_window)
{ {
::ScreenToClient(pointer_wd, &scr_pos); ::ScreenToClient(pointer_wd, &scr_pos);
auto scrolled_wd = brock.wd_manager.find_window(reinterpret_cast<native_window_type>(pointer_wd), scr_pos.x, scr_pos.y); auto scrolled_wd = brock.wd_manager().find_window(reinterpret_cast<native_window_type>(pointer_wd), scr_pos.x, scr_pos.y);
def_window_proc = true; def_window_proc = true;
auto evt_wd = scrolled_wd; auto evt_wd = scrolled_wd;
@ -1139,7 +1138,7 @@ namespace detail
{ {
def_window_proc = false; def_window_proc = false;
nana::point mspos{ scr_pos.x, scr_pos.y }; nana::point mspos{ scr_pos.x, scr_pos.y };
brock.wd_manager.calc_window_point(evt_wd, mspos); brock.wd_manager().calc_window_point(evt_wd, mspos);
arg_wheel arg; arg_wheel arg;
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical); arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
@ -1153,13 +1152,13 @@ namespace detail
if (scrolled_wd && (nullptr == evt_wd)) if (scrolled_wd && (nullptr == evt_wd))
{ {
nana::point mspos{ scr_pos.x, scr_pos.y }; nana::point mspos{ scr_pos.x, scr_pos.y };
brock.wd_manager.calc_window_point(scrolled_wd, mspos); brock.wd_manager().calc_window_point(scrolled_wd, mspos);
arg_wheel arg; arg_wheel arg;
arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical); arg.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
assign_arg(arg, scrolled_wd, pmdec); assign_arg(arg, scrolled_wd, pmdec);
brock.emit_drawer(event_code::mouse_wheel, scrolled_wd, arg, &context); brock.emit_drawer(event_code::mouse_wheel, scrolled_wd, arg, &context);
brock.wd_manager.do_lazy_refresh(scrolled_wd, false); brock.wd_manager().do_lazy_refresh(scrolled_wd, false);
} }
} }
else else
@ -1177,7 +1176,7 @@ namespace detail
POINT pos; POINT pos;
::DragQueryPoint(drop, &pos); ::DragQueryPoint(drop, &pos);
msgwnd = brock.wd_manager.find_window(native_window, pos.x, pos.y); msgwnd = brock.wd_manager().find_window(native_window, pos.x, pos.y);
if(msgwnd) if(msgwnd)
{ {
arg_dropfiles dropfiles; arg_dropfiles dropfiles;
@ -1207,11 +1206,11 @@ namespace detail
dropfiles.pos.x = pos.x; dropfiles.pos.x = pos.x;
dropfiles.pos.y = pos.y; dropfiles.pos.y = pos.y;
brock.wd_manager.calc_window_point(msgwnd, dropfiles.pos); brock.wd_manager().calc_window_point(msgwnd, dropfiles.pos);
dropfiles.window_handle = reinterpret_cast<window>(msgwnd); dropfiles.window_handle = reinterpret_cast<window>(msgwnd);
msgwnd->together.events_ptr->mouse_dropfiles.emit(dropfiles); msgwnd->together.events_ptr->mouse_dropfiles.emit(dropfiles);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
} }
@ -1299,7 +1298,7 @@ namespace detail
break; break;
case WM_SIZE: case WM_SIZE:
if(wParam != SIZE_MINIMIZED) if(wParam != SIZE_MINIMIZED)
brock.wd_manager.size(msgwnd, size(pmdec.size.width, pmdec.size.height), true, true); brock.wd_manager().size(msgwnd, size(pmdec.size.width, pmdec.size.height), true, true);
break; break;
case WM_MOVE: case WM_MOVE:
brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam)); brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
@ -1325,7 +1324,7 @@ namespace detail
case WM_SYSCHAR: case WM_SYSCHAR:
def_window_proc = true; def_window_proc = true;
brock.set_keyboard_shortkey(true); brock.set_keyboard_shortkey(true);
msgwnd = brock.wd_manager.find_shortkey(native_window, static_cast<unsigned long>(wParam)); msgwnd = brock.wd_manager().find_shortkey(native_window, static_cast<unsigned long>(wParam));
if(msgwnd) if(msgwnd)
{ {
arg_keyboard arg; arg_keyboard arg;
@ -1372,7 +1371,7 @@ namespace detail
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus); bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
if (set_focus) if (set_focus)
brock.wd_manager.set_focus(msgwnd, false); brock.wd_manager().set_focus(msgwnd, false);
arg_keyboard arg; arg_keyboard arg;
arg.evt_code = event_code::key_release; arg.evt_code = event_code::key_release;
@ -1406,12 +1405,12 @@ namespace detail
{ {
bool is_forward = (::GetKeyState(VK_SHIFT) >= 0); bool is_forward = (::GetKeyState(VK_SHIFT) >= 0);
auto tstop_wd = brock.wd_manager.tabstop(msgwnd, is_forward); auto tstop_wd = brock.wd_manager().tabstop(msgwnd, is_forward);
if (tstop_wd) if (tstop_wd)
{ {
brock.wd_manager.set_focus(tstop_wd, false); brock.wd_manager().set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true); brock.wd_manager().do_lazy_refresh(tstop_wd, true);
} }
} }
else else
@ -1453,10 +1452,10 @@ namespace detail
arg.ignore = false; arg.ignore = false;
msgwnd->together.events_ptr->key_char.emit(arg); msgwnd->together.events_ptr->key_char.emit(arg);
if ((false == arg.ignore) && brock.wd_manager.available(msgwnd)) if ((false == arg.ignore) && brock.wd_manager().available(msgwnd))
brock.emit_drawer(event_code::key_char, msgwnd, arg, &context); brock.emit_drawer(event_code::key_char, msgwnd, arg, &context);
brock.wd_manager.do_lazy_refresh(msgwnd, false); brock.wd_manager().do_lazy_refresh(msgwnd, false);
} }
} }
return 0; return 0;
@ -1504,12 +1503,12 @@ namespace detail
brock.erase_menu(false); brock.erase_menu(false);
brock.delay_restore(3); //Restores if delay_restore not decleared brock.delay_restore(3); //Restores if delay_restore not decleared
} }
brock.wd_manager.destroy(msgwnd); brock.wd_manager().destroy(msgwnd);
nana::detail::platform_spec::instance().release_window_icon(msgwnd->root); nana::detail::platform_spec::instance().release_window_icon(msgwnd->root);
break; break;
case WM_NCDESTROY: case WM_NCDESTROY:
brock.rt_manager.remove_if_exists(msgwnd); brock.manage_form_loader(msgwnd, false);
brock.wd_manager.destroy_handle(msgwnd); brock.wd_manager().destroy_handle(msgwnd);
if(--context.window_count <= 0) if(--context.window_count <= 0)
{ {
@ -1521,7 +1520,7 @@ namespace detail
def_window_proc = true; def_window_proc = true;
} }
root_runtime = brock.wd_manager.root_runtime(native_window); root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime) if(root_runtime)
{ {
root_runtime->condition.pressed = pressed_wd; root_runtime->condition.pressed = pressed_wd;
@ -1538,21 +1537,15 @@ namespace detail
::nana::category::flags bedrock::category(core_window_t* wd) ::nana::category::flags bedrock::category(core_window_t* wd)
{ {
internal_scope_guard lock; internal_scope_guard lock;
return (wd_manager.available(wd) ? wd->other.category : ::nana::category::flags::super); return (wd_manager().available(wd) ? wd->other.category : ::nana::category::flags::super);
} }
auto bedrock::focus() ->core_window_t* auto bedrock::focus() ->core_window_t*
{ {
core_window_t* wd = wd_manager.root(native_interface::get_focus_window()); core_window_t* wd = wd_manager().root(native_interface::get_focus_window());
return (wd ? wd->other.attribute.root->focus : nullptr); return (wd ? wd->other.attribute.root->focus : nullptr);
} }
native_window_type bedrock::root(core_window_t* wd)
{
internal_scope_guard lock;
return (wd_manager.available(wd) ? wd->root : nullptr);
}
void bedrock::set_menubar_taken(core_window_t* wd) void bedrock::set_menubar_taken(core_window_t* wd)
{ {
auto pre = impl_->menu.taken_window; auto pre = impl_->menu.taken_window;
@ -1563,8 +1556,8 @@ namespace detail
if ((!wd) && pre && (pre->root != get_menu())) if ((!wd) && pre && (pre->root != get_menu()))
{ {
internal_scope_guard lock; internal_scope_guard lock;
wd_manager.set_focus(pre, false); wd_manager().set_focus(pre, false);
wd_manager.update(pre, true, false); wd_manager().update(pre, true, false);
} }
} }
@ -1692,17 +1685,9 @@ namespace detail
#endif #endif
} }
bool bedrock::emit(event_code evt_code, core_window_t* wd, const arg_mouse& arg, bool ask_update, thread_context* thrd)
{
if (evt_code != arg.evt_code)
throw std::runtime_error("Nana.bedrock: invalid event arg.");
return emit(evt_code, wd, static_cast<const ::nana::event_arg&>(arg), ask_update, thrd);
}
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd) bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd)
{ {
if (wd_manager.available(wd) == false) if (wd_manager().available(wd) == false)
return false; return false;
basic_window* prev_event_wd; basic_window* prev_event_wd;
@ -1719,8 +1704,8 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg); _m_emit_core(evt_code, wd, false, arg);
if (ask_update) if (ask_update)
wd_manager.do_lazy_refresh(wd, false); wd_manager().do_lazy_refresh(wd, false);
else if (wd_manager.available(wd)) else if (wd_manager().available(wd))
wd->other.upd_state = basic_window::update_state::none; wd->other.upd_state = basic_window::update_state::none;
if (thrd) thrd->event_window = prev_event_wd; if (thrd) thrd->event_window = prev_event_wd;
@ -1729,7 +1714,7 @@ namespace detail
bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd) bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd)
{ {
if (bedrock_object.wd_manager.available(wd) == false) if (bedrock_object.wd_manager().available(wd) == false)
return false; return false;
core_window_t* prev_event_wd; core_window_t* prev_event_wd;
@ -1854,7 +1839,7 @@ namespace detail
thrd = get_thread_context(wd->thread_id); thrd = get_thread_context(wd->thread_id);
HCURSOR rev_handle = ::LoadCursor(nullptr, IDC_ARROW); HCURSOR rev_handle = ::LoadCursor(nullptr, IDC_ARROW);
if (!wd_manager.available(wd)) if (!wd_manager().available(wd))
{ {
::ShowCursor(FALSE); ::ShowCursor(FALSE);
::SetCursor(rev_handle); ::SetCursor(rev_handle);
@ -1875,7 +1860,7 @@ namespace detail
} }
native_interface::calc_window_point(native_handle, pos); native_interface::calc_window_point(native_handle, pos);
auto rev_wd = wd_manager.find_window(native_handle, pos.x, pos.y); auto rev_wd = wd_manager().find_window(native_handle, pos.x, pos.y);
if (rev_wd) if (rev_wd)
{ {
set_cursor(rev_wd, rev_wd->predef_cursor, thrd); set_cursor(rev_wd, rev_wd->predef_cursor, thrd);

View File

@ -8,12 +8,12 @@
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
* *
* @file: nana/gui/detail/window_manager.cpp * @file: nana/gui/detail/window_manager.cpp
* @author: Jinhao
* @contributors: Katsuhisa Yuasa * @contributors: Katsuhisa Yuasa
*/ */
#include <nana/config.hpp> #include <nana/config.hpp>
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/events_operation.hpp>
#include <nana/gui/detail/handle_manager.hpp> #include <nana/gui/detail/handle_manager.hpp>
#include <nana/gui/detail/window_manager.hpp> #include <nana/gui/detail/window_manager.hpp>
#include <nana/gui/detail/native_window_interface.hpp> #include <nana/gui/detail/native_window_interface.hpp>
@ -28,15 +28,75 @@ namespace nana
namespace detail namespace detail
{ {
template<typename Key, typename Value>
class lite_map
{
struct key_value_rep
{
Key first;
Value second;
key_value_rep()
: first{}, second{}
{}
key_value_rep(const Key& k)
: first(k), second{}
{
}
};
public:
using iterator = typename std::vector<key_value_rep>::iterator;
Value& operator[](const Key& key)
{
for (auto& kv : table_)
{
if (kv.first == key)
return kv.second;
}
table_.emplace_back(key);
return table_.back().second;
}
iterator find(const Key& key)
{
for (auto i = table_.begin(); i != table_.end(); ++i)
if (i->first == key)
return i;
return table_.end();
}
iterator erase(iterator pos)
{
return table_.erase(pos);
}
iterator begin()
{
return table_.begin();
}
iterator end()
{
return table_.end();
}
private:
std::vector<key_value_rep> table_;
};
//class window_manager //class window_manager
struct window_handle_deleter struct window_handle_deleter
{ {
void operator()(basic_window* wd) const void operator()(basic_window* wd) const
{ {
bedrock::instance().evt_operation.umake(reinterpret_cast<window>(wd)); bedrock::instance().evt_operation().umake(reinterpret_cast<window>(wd));
delete wd; delete wd;
} }
}; };
//struct wdm_private_impl //struct wdm_private_impl
struct window_manager::wdm_private_impl struct window_manager::wdm_private_impl
{ {
@ -44,6 +104,8 @@ namespace detail
handle_manager<core_window_t*, window_manager, window_handle_deleter> wd_register; handle_manager<core_window_t*, window_manager, window_handle_deleter> wd_register;
paint::image default_icon_big; paint::image default_icon_big;
paint::image default_icon_small; paint::image default_icon_small;
lite_map<core_window_t*, std::vector<std::function<void()>>> safe_place;
}; };
//end struct wdm_private_impl //end struct wdm_private_impl
@ -153,7 +215,7 @@ namespace detail
bool window_manager::is_queue(core_window_t* wd) bool window_manager::is_queue(core_window_t* wd)
{ {
return (wd && (wd->other.category == category::root_tag::value)); return (wd && (category::flags::root == wd->other.category));
} }
std::size_t window_manager::number_of_core_window() const std::size_t window_manager::number_of_core_window() const
@ -216,7 +278,7 @@ namespace detail
if (owner->flags.destroying) if (owner->flags.destroying)
throw std::logic_error("the specified owner is destory"); throw std::logic_error("the specified owner is destory");
native = (owner->other.category == category::frame_tag::value ? native = (category::flags::frame == owner->other.category ?
owner->other.attribute.frame->container : owner->root_widget->root); owner->other.attribute.frame->container : owner->root_widget->root);
r.x += owner->pos_root.x; r.x += owner->pos_root.x;
r.y += owner->pos_root.y; r.y += owner->pos_root.y;
@ -674,6 +736,14 @@ namespace detail
std::lock_guard<decltype(mutex_)> lock(mutex_); std::lock_guard<decltype(mutex_)> lock(mutex_);
if (impl_->wd_register.available(wd) && !wd->is_draw_through()) if (impl_->wd_register.available(wd) && !wd->is_draw_through())
{ {
auto parent = wd->parent;
while (parent)
{
if (parent->flags.refreshing)
return;
parent = parent->parent;
}
//Copy the root buffer that wd specified into DeviceContext //Copy the root buffer that wd specified into DeviceContext
#if defined(NANA_LINUX) #if defined(NANA_LINUX)
wd->drawer.map(reinterpret_cast<window>(wd), forced, update_area); wd->drawer.map(reinterpret_cast<window>(wd), forced, update_area);
@ -786,12 +856,6 @@ namespace detail
false); false);
} }
::nana::widget* window_manager::get_widget(core_window_t* wd) const
{
std::lock_guard<decltype(mutex_)> lock(mutex_);
return (impl_->wd_register.available(wd) ? wd->widget_notifier->widget_ptr() : nullptr);
}
std::vector<window_manager::core_window_t*> window_manager::get_children(core_window_t* wd) const std::vector<window_manager::core_window_t*> window_manager::get_children(core_window_t* wd) const
{ {
std::lock_guard<decltype(mutex_)> lock(mutex_); std::lock_guard<decltype(mutex_)> lock(mutex_);
@ -1192,6 +1256,37 @@ namespace detail
return nullptr; return nullptr;
} }
void window_manager::set_safe_place(core_window_t* wd, std::function<void()>&& fn)
{
if (fn)
{
std::lock_guard<decltype(mutex_)> lock(mutex_);
if (!available(wd))
return;
impl_->safe_place[wd].emplace_back(std::move(fn));
}
}
void window_manager::call_safe_place(unsigned thread_id)
{
std::lock_guard<decltype(mutex_)> lock(mutex_);
for (auto i = impl_->safe_place.begin(); i != impl_->safe_place.end();)
{
if (i->first->thread_id == thread_id)
{
for (auto & fn : i->second)
fn();
i = impl_->safe_place.erase(i);
}
else
++i;
}
}
bool check_tree(basic_window* wd, basic_window* const cond) bool check_tree(basic_window* wd, basic_window* const cond)
{ {
if (wd == cond) return true; if (wd == cond) return true;

View File

@ -26,13 +26,17 @@ namespace nana
event_handle destroy; event_handle destroy;
}; };
public: public:
dragger_impl_t()
: dragging_(false)
{}
~dragger_impl_t() ~dragger_impl_t()
{ {
_m_clear_triggers(); //Clear triggers
for (auto & t : triggers_)
{
API::umake_event(t.press);
API::umake_event(t.over);
API::umake_event(t.release);
API::umake_event(t.destroy);
API::capture_window(t.wd, false);
}
} }
void drag_target(window wd, const rectangle& restrict_area, arrange arg) void drag_target(window wd, const rectangle& restrict_area, arrange arg)
@ -65,84 +69,31 @@ namespace nana
{ {
trigger_t tg; trigger_t tg;
tg.wd = wd; tg.wd = wd;
auto fn = std::bind(&dragger_impl_t::_m_trace, this, std::placeholders::_1); auto fn = [this](const arg_mouse& arg)
auto & events = API::events(wd);
tg.press = events.mouse_down.connect(fn);
tg.over = events.mouse_move.connect(fn);
tg.release = events.mouse_up.connect(fn);
tg.destroy = events.destroy.connect([this](const arg_destroy& arg){
_m_destroy(arg.window_handle);
});
triggers_.push_back(tg);
}
private:
void _m_clear_triggers()
{ {
for(auto & t : triggers_) switch (arg.evt_code)
{
API::umake_event(t.press);
API::umake_event(t.over);
API::umake_event(t.release);
API::umake_event(t.destroy);
API::capture_window(t.wd, false);
}
triggers_.clear();
}
void _m_destroy(::nana::window wd)
{
for(auto i = triggers_.begin(), end = triggers_.end(); i != end; ++i)
{
if(i->wd == wd)
{
triggers_.erase(i);
API::capture_window(wd, false);
return;
}
}
}
void _m_check_restrict_area(nana::point & pos, const nana::size & size, const nana::rectangle& restr_area)
{
if ((pos.x > 0) && (static_cast<int>(size.width) + pos.x > restr_area.right()))
pos.x = restr_area.right() - static_cast<int>(size.width);
if (pos.x < restr_area.x)
pos.x = restr_area.x;
if ((pos.y > 0) && (static_cast<int>(size.height) + pos.y > restr_area.bottom()))
pos.y = restr_area.bottom() - static_cast<int>(size.height);
if (pos.y < restr_area.y)
pos.y = restr_area.y;
}
void _m_trace(const arg_mouse& arg)
{
switch(arg.evt_code)
{ {
case event_code::mouse_down: case event_code::mouse_down:
dragging_ = true; dragging_ = true;
API::capture_window(arg.window_handle, true); API::capture_window(arg.window_handle, true);
origin_ = API::cursor_position(); origin_ = API::cursor_position();
for(auto & t : targets_) for (auto & t : targets_)
{ {
t.origin = API::window_position(t.wd); t.origin = API::window_position(t.wd);
window owner = API::get_owner_window(t.wd); window owner = API::get_owner_window(t.wd);
if(owner) if (owner)
API::calc_screen_point(owner, t.origin); API::calc_screen_point(owner, t.origin);
} }
break; break;
case event_code::mouse_move: case event_code::mouse_move:
if(dragging_ && arg.left_button) if (dragging_ && arg.left_button)
{ {
auto pos = API::cursor_position(); auto pos = API::cursor_position();
pos -= origin_; pos -= origin_;
for(auto & t : targets_) for (auto & t : targets_)
{ {
if(API::is_window_zoomed(t.wd, true) == false) if (API::is_window_zoomed(t.wd, true) == false)
{ {
auto owner = API::get_owner_window(t.wd); auto owner = API::get_owner_window(t.wd);
auto wdps = t.origin; auto wdps = t.origin;
@ -164,7 +115,7 @@ namespace nana
if (!t.restrict_area.empty()) if (!t.restrict_area.empty())
_m_check_restrict_area(wdps, API::window_size(t.wd), t.restrict_area); _m_check_restrict_area(wdps, API::window_size(t.wd), t.restrict_area);
API::move_window(t.wd, wdps.x, wdps.y); API::move_window(t.wd, wdps);
} }
} }
} }
@ -176,10 +127,43 @@ namespace nana
default: default:
break; break;
} }
};
auto & events = API::events(wd);
tg.press = events.mouse_down.connect(fn);
tg.over = events.mouse_move.connect(fn);
tg.release = events.mouse_up.connect(fn);
tg.destroy = events.destroy.connect([this](const arg_destroy& arg)
{
for (auto i = triggers_.begin(), end = triggers_.end(); i != end; ++i)
{
if (i->wd == arg.window_handle)
{
triggers_.erase(i);
API::capture_window(arg.window_handle, false);
return;
} }
}
});
triggers_.push_back(tg);
}
private: private:
bool dragging_; static void _m_check_restrict_area(nana::point & pos, const nana::size & size, const nana::rectangle& restr_area)
{
if ((pos.x > 0) && (static_cast<int>(size.width) + pos.x > restr_area.right()))
pos.x = restr_area.right() - static_cast<int>(size.width);
if (pos.x < restr_area.x)
pos.x = restr_area.x;
if ((pos.y > 0) && (static_cast<int>(size.height) + pos.y > restr_area.bottom()))
pos.y = restr_area.bottom() - static_cast<int>(size.height);
if (pos.y < restr_area.y)
pos.y = restr_area.y;
}
private:
bool dragging_{ false };
nana::point origin_; nana::point origin_;
std::vector<drag_target_t> targets_; std::vector<drag_target_t> targets_;
std::vector<trigger_t> triggers_; std::vector<trigger_t> triggers_;

View File

@ -22,7 +22,7 @@ namespace nana
{ {
namespace namespace
{ {
using core_window_t = detail::bedrock::core_window_t; using core_window_t = detail::basic_window;
inline detail::drawer& get_drawer(window wd) inline detail::drawer& get_drawer(window wd)
{ {

View File

@ -28,6 +28,14 @@ namespace nana
//Element definitions //Element definitions
namespace element namespace element
{ {
namespace detail
{
void factory_abstract::destroy(element_abstract* ptr)
{
delete ptr;
}
}
class crook class crook
: public crook_interface : public crook_interface
{ {
@ -141,7 +149,7 @@ namespace nana
} }
else else
{ {
::nana::color highlighted(static_cast<color_rgb>(0x5eb6f7)); ::nana::color highlighted(0x5e, 0xb6, 0xf7);
auto bld_bgcolor = bgcolor; auto bld_bgcolor = bgcolor;
auto bld_fgcolor = fgcolor; auto bld_fgcolor = fgcolor;
switch(es) switch(es)
@ -156,7 +164,7 @@ namespace nana
bld_fgcolor = fgcolor.blend(highlighted, 0.4); bld_fgcolor = fgcolor.blend(highlighted, 0.4);
break; break;
case element_state::disabled: case element_state::disabled:
bld_bgcolor = bld_fgcolor.from_rgb(0xb2, 0xb7, 0xbc); bld_bgcolor = bld_fgcolor = nana::color(0xb2, 0xb7, 0xbc);
break; break;
default: default:
//Leave things as they are //Leave things as they are
@ -529,14 +537,71 @@ namespace nana
return true; return true;
} }
};//end class annex_button };//end class annex_button
class x_icon
: public element_interface
{
bool draw(graph_reference graph, const ::nana::color&, const ::nana::color& fgcolor, const rectangle& r, element_state estate) override
{
auto clr = fgcolor;
switch (estate)
{
case element_state::hovered:
case element_state::pressed:
clr = clr.blend(colors::black, 0.8);
break;
case element_state::disabled:
clr = colors::dark_gray;
default:
break;
}
graph.set_color(clr);
const int x = r.x + 4;
const int y = r.y + 4;
point p1{ x, y }, p2{ x + 7, y + 7 };
graph.line(p1, p2);
++p1.x;
--p2.y;
graph.line(p1, p2);
p1.x = x;
++p1.y;
p2.x = x + 6;
p2.y = y + 7;
graph.line(p1, p2);
p1.x += 7;
p1.y = y;
p2.x = x;
graph.line(p1, p2);
p1.x = x + 6;
p2.y = y + 6;
graph.line(p1, p2);
++p1.x;
++p1.y;
++p2.x;
++p2.y;
graph.line(p1, p2);
return true;
}
};
}//end namespace element }//end namespace element
template<typename ElementInterface> template<typename ElementInterface>
class element_object class element_object
: nana::noncopyable, nana::nonmovable : nana::noncopyable, nana::nonmovable
{ {
typedef ElementInterface element_t; using element_type = ElementInterface;
typedef pat::cloneable<element::provider::factory_interface<element_t>> factory_interface; using factory_interface = pat::cloneable<element::detail::factory_abstract>;
public: public:
~element_object() ~element_object()
@ -551,7 +616,7 @@ namespace nana
auto keep_e = element_ptr_; auto keep_e = element_ptr_;
factory_ = rhs; factory_ = rhs;
element_ptr_ = factory_->create(); element_ptr_ = static_cast<element_type*>(static_cast<element::provider::factory_interface<element_type>&>(*factory_).create());
if(nullptr == factory_ || nullptr == element_ptr_) if(nullptr == factory_ || nullptr == element_ptr_)
{ {
@ -567,14 +632,14 @@ namespace nana
spare_.emplace_back(keep_e, keep_f); spare_.emplace_back(keep_e, keep_f);
} }
element_t * const * keeper() const element_type * const * cite() const
{ {
return &element_ptr_; return &element_ptr_;
} }
private: private:
factory_interface factory_; //Keep the factory for destroying the element factory_interface factory_; //Keep the factory for destroying the element
element_t * element_ptr_{nullptr}; element_type * element_ptr_{nullptr};
std::vector<std::pair<element_t*, factory_interface>> spare_; std::vector<std::pair<element_type*, factory_interface>> spare_;
}; };
class element_manager class element_manager
@ -613,6 +678,8 @@ namespace nana
element::add_arrow<element::arrow_hollow_triangle>("hollow_triangle"); element::add_arrow<element::arrow_hollow_triangle>("hollow_triangle");
element::add_button<element::annex_button>(""); //"annex" in default element::add_button<element::annex_button>(""); //"annex" in default
element::add_x_icon<element::x_icon>("");
} }
return obj; return obj;
} }
@ -624,7 +691,17 @@ namespace nana
element::crook_interface * const * crook(const std::string& name) const element::crook_interface * const * crook(const std::string& name) const
{ {
return _m_get(name, crook_).keeper(); return _m_get(name, crook_).cite();
}
void cross(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
{
_m_add(name, cross_, factory);
}
element::element_interface* const * cross(const std::string& name) const
{
return _m_get(name, cross_).cite();
} }
void border(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::border_interface>>& factory) void border(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::border_interface>>& factory)
@ -634,7 +711,7 @@ namespace nana
element::border_interface * const * border(const std::string& name) const element::border_interface * const * border(const std::string& name) const
{ {
return _m_get(name, border_).keeper(); return _m_get(name, border_).cite();
} }
void arrow(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::arrow_interface>>& factory) void arrow(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::arrow_interface>>& factory)
@ -644,7 +721,7 @@ namespace nana
element::arrow_interface * const * arrow(const std::string& name) const element::arrow_interface * const * arrow(const std::string& name) const
{ {
return _m_get((name.empty() ? "arrowhead" : name), arrow_).keeper(); return _m_get((name.empty() ? "arrowhead" : name), arrow_).cite();
} }
void button(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory) void button(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
@ -654,7 +731,17 @@ namespace nana
element::element_interface * const * button(const std::string& name) const element::element_interface * const * button(const std::string& name) const
{ {
return _m_get((name.empty() ? "annex" : name), button_).keeper(); return _m_get((name.empty() ? "annex" : name), button_).cite();
}
void x_icon(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
{
_m_add(name, x_icon_, factory);
}
element::element_interface * const * x_icon(const std::string& name) const
{
return _m_get(name, x_icon_).cite();
} }
private: private:
using lock_guard = std::lock_guard<std::recursive_mutex>; using lock_guard = std::lock_guard<std::recursive_mutex>;
@ -689,9 +776,11 @@ namespace nana
private: private:
mutable std::recursive_mutex mutex_; mutable std::recursive_mutex mutex_;
item<element::crook_interface> crook_; item<element::crook_interface> crook_;
item<element::element_interface> cross_;
item<element::border_interface> border_; item<element::border_interface> border_;
item<element::arrow_interface> arrow_; item<element::arrow_interface> arrow_;
item<element::element_interface> button_; item<element::element_interface> button_;
item<element::element_interface> x_icon_;
}; };
namespace element namespace element
@ -702,17 +791,27 @@ namespace nana
element_manager::instance().crook(name, factory); element_manager::instance().crook(name, factory);
} }
crook_interface* const * provider::keeper_crook(const std::string& name) crook_interface* const * provider::cite_crook(const std::string& name)
{ {
return element_manager::instance().crook(name); return element_manager::instance().crook(name);
} }
void provider::add_cross(const std::string& name, const pat::cloneable<factory_interface<element_interface>>& factory)
{
element_manager::instance().cross(name, factory);
}
element_interface* const* provider::cite_cross(const std::string& name)
{
return element_manager::instance().cross(name);
}
void provider::add_border(const std::string& name, const pat::cloneable<factory_interface<border_interface>>& factory) void provider::add_border(const std::string& name, const pat::cloneable<factory_interface<border_interface>>& factory)
{ {
element_manager::instance().border(name, factory); element_manager::instance().border(name, factory);
} }
border_interface* const * provider::keeper_border(const std::string& name) border_interface* const * provider::cite_border(const std::string& name)
{ {
return element_manager::instance().border(name); return element_manager::instance().border(name);
} }
@ -722,7 +821,7 @@ namespace nana
element_manager::instance().arrow(name, factory); element_manager::instance().arrow(name, factory);
} }
arrow_interface* const * provider::keeper_arrow(const std::string& name) arrow_interface* const * provider::cite_arrow(const std::string& name)
{ {
return element_manager::instance().arrow(name); return element_manager::instance().arrow(name);
} }
@ -732,16 +831,26 @@ namespace nana
element_manager::instance().button(name, factory); element_manager::instance().button(name, factory);
} }
element_interface* const* provider::keeper_button(const std::string& name) element_interface* const* provider::cite_button(const std::string& name)
{ {
return element_manager::instance().button(name); return element_manager::instance().button(name);
} }
void provider::add_x_icon(const std::string& name, const pat::cloneable<factory_interface<element_interface>>& factory)
{
element_manager::instance().x_icon(name, factory);
}
element_interface* const* provider::cite_x_icon(const std::string& name)
{
return element_manager::instance().x_icon(name);
}
}//end namespace element }//end namespace element
//facades //facades
//template<> class facade<element::crook> //template<> class facade<element::crook>
facade<element::crook>::facade(const char* name) facade<element::crook>::facade(const char* name)
: keeper_(element::provider().keeper_crook(name ? name : "")) : cite_(element::provider().cite_crook(name ? name : ""))
{ {
data_.check_state = state::unchecked; data_.check_state = state::unchecked;
data_.radio = false; data_.radio = false;
@ -777,40 +886,120 @@ namespace nana
void facade<element::crook>::switch_to(const char* name) void facade<element::crook>::switch_to(const char* name)
{ {
keeper_ = element::provider().keeper_crook(name ? name : ""); cite_ = element::provider().cite_crook(name ? name : "");
} }
bool facade<element::crook>::draw(graph_reference graph, const ::nana::color& bgcol, const ::nana::color& fgcol, const nana::rectangle& r, element_state es) bool facade<element::crook>::draw(graph_reference graph, const ::nana::color& bgcol, const ::nana::color& fgcol, const nana::rectangle& r, element_state es)
{ {
return (*keeper_)->draw(graph, bgcol, fgcol, r, es, data_); return (*cite_)->draw(graph, bgcol, fgcol, r, es, data_);
} }
//end class facade<element::crook> //end class facade<element::crook>
//class facade<element::cross>
facade<element::cross>::facade(const char* name)
: cite_(element::provider().cite_cross(name ? name : ""))
{
}
void facade<element::cross>::switch_to(const char* name)
{
cite_ = element::provider().cite_cross(name ? name : "");
}
void facade<element::cross>::thickness(unsigned thk)
{
thickness_ = thk;
}
void facade<element::cross>::size(unsigned size_px)
{
size_ = size_px;
}
//Implement element_interface
bool facade<element::cross>::draw(graph_reference graph, const ::nana::color&, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state)
{
if (thickness_ + 2 <= size_)
{
int gap = (static_cast<int>(size_) - static_cast<int>(thickness_)) / 2;
nana::point ps[12];
ps[0].x = r.x + gap;
ps[1].x = ps[0].x + static_cast<int>(thickness_) - 1;
ps[1].y = ps[0].y = r.y;
ps[2].x = ps[1].x;
ps[2].y = r.y + gap;
ps[3].x = ps[2].x + gap;
ps[3].y = ps[2].y;
ps[4].x = ps[3].x;
ps[4].y = ps[3].y + static_cast<int>(thickness_)-1;
ps[5].x = ps[1].x;
ps[5].y = ps[4].y;
ps[6].x = ps[5].x;
ps[6].y = ps[5].y + gap;
ps[7].x = r.x + gap;
ps[7].y = ps[6].y;
ps[8].x = ps[7].x;
ps[8].y = ps[4].y;
ps[9].x = r.x;
ps[9].y = ps[4].y;
ps[10].x = r.x;
ps[10].y = r.y + gap;
ps[11].x = r.x + gap;
ps[11].y = r.y + gap;
graph.set_color(fgcolor.blend(colors::black, true));
for (int i = 0; i < 11; ++i)
graph.line(ps[i], ps[i + 1]);
graph.line(ps[11], ps[0]);
graph.set_color(fgcolor);
unsigned thk_minus_2 = thickness_ - 2;
graph.rectangle(rectangle{ ps[10].x + 1, ps[10].y + 1, (gap << 1) + thk_minus_2, thk_minus_2 }, true);
graph.rectangle(rectangle{ ps[0].x + 1, ps[0].y + 1, thk_minus_2, (gap << 1) + thk_minus_2 }, true);
}
return true;
}
//end class facade<element::cross>
//class facade<element::border> //class facade<element::border>
facade<element::border>::facade(const char* name) facade<element::border>::facade(const char* name)
: keeper_(element::provider().keeper_border(name ? name : "")) : cite_(element::provider().cite_border(name ? name : ""))
{} {}
void facade<element::border>::switch_to(const char* name) void facade<element::border>::switch_to(const char* name)
{ {
keeper_ = element::provider().keeper_border(name ? name : ""); cite_ = element::provider().cite_border(name ? name : "");
} }
bool facade<element::border>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state es) bool facade<element::border>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state es)
{ {
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, es, 2); return (*cite_)->draw(graph, bgcolor, fgcolor, r, es, 2);
} }
//end class facade<element::border> //end class facade<element::border>
//class facade<element::arrow> //class facade<element::arrow>
facade<element::arrow>::facade(const char* name) facade<element::arrow>::facade(const char* name)
: keeper_(element::provider().keeper_arrow(name ? name : "")) : cite_(element::provider().cite_arrow(name ? name : ""))
{ {
} }
void facade<element::arrow>::switch_to(const char* name) void facade<element::arrow>::switch_to(const char* name)
{ {
keeper_ = element::provider().keeper_arrow(name ? name : ""); cite_ = element::provider().cite_arrow(name ? name : "");
} }
void facade<element::arrow>::direction(::nana::direction dir) void facade<element::arrow>::direction(::nana::direction dir)
@ -822,42 +1011,62 @@ namespace nana
bool facade<element::arrow>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state estate) bool facade<element::arrow>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state estate)
{ {
graph.set_color(fgcolor); graph.set_color(fgcolor);
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, estate, dir_); return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate, dir_);
} }
//end class facade<element::arrow> //end class facade<element::arrow>
//class facade<element::button>:: //class facade<element::button>::
facade<element::button>::facade(const char* name) facade<element::button>::facade(const char* name)
: keeper_(element::provider().keeper_button(name ? name : "")) : cite_(element::provider().cite_button(name ? name : ""))
{} {}
void facade<element::button>::switch_to(const char* name) void facade<element::button>::switch_to(const char* name)
{ {
keeper_ = element::provider().keeper_button(name ? name : ""); cite_ = element::provider().cite_button(name ? name : "");
} }
//Implement element_interface //Implement element_interface
bool facade<element::button>::draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate) bool facade<element::button>::draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate)
{ {
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, estate); return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate);
} }
//end class facade<element::button> //end class facade<element::button>
//class facade<element::x_icon>
facade<element::x_icon>::facade(const char* name)
: cite_(element::provider().cite_x_icon(name ? name : ""))
{}
void facade<element::x_icon>::switch_to(const char* name)
{
cite_ = element::provider().cite_x_icon(name ? name : "");
}
//Implement element_interface
bool facade<element::x_icon>::draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate)
{
return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate);
}
//end class facade<element::x_icon>
namespace element namespace element
{ {
using brock = ::nana::detail::bedrock;
void set_bground(const char* name, const pat::cloneable<element_interface>& obj) void set_bground(const char* name, const pat::cloneable<element_interface>& obj)
{ {
detail::bedrock::instance().get_element_store().bground(name, obj); brock::instance().get_element_store().bground(name, obj);
} }
void set_bground(const char* name, pat::cloneable<element_interface> && obj) void set_bground(const char* name, pat::cloneable<element_interface> && obj)
{ {
detail::bedrock::instance().get_element_store().bground(name, std::move(obj)); brock::instance().get_element_store().bground(name, std::move(obj));
} }
//class cite //class cite
cite_bground::cite_bground(const char* name) cite_bground::cite_bground(const char* name)
: ref_ptr_(detail::bedrock::instance().get_element_store().bground(name)) : ref_ptr_(brock::instance().get_element_store().bground(name))
{ {
} }
@ -871,7 +1080,7 @@ namespace nana
void cite_bground::set(const char* name) void cite_bground::set(const char* name)
{ {
holder_.reset(); holder_.reset();
ref_ptr_ = detail::bedrock::instance().get_element_store().bground(name); ref_ptr_ = brock::instance().get_element_store().bground(name);
} }
bool cite_bground::draw(graph_reference dst, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const nana::rectangle& r, element_state state) bool cite_bground::draw(graph_reference dst, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const nana::rectangle& r, element_state state)

View File

@ -959,7 +959,7 @@ namespace nana
int inputbox::date::month() const int inputbox::date::month() const
{ {
if (!impl_->wdg_month.empty()) if (!impl_->wdg_month.empty())
return impl_->wdg_month.option() + 1; return static_cast<int>(impl_->wdg_month.option()) + 1;
return impl_->month; return impl_->month;
} }
@ -1028,7 +1028,7 @@ namespace nana
impl->wdg_day.events().destroy.connect_unignorable([impl] impl->wdg_day.events().destroy.connect_unignorable([impl]
{ {
impl->day = impl->wdg_day.to_int(); impl->day = impl->wdg_day.to_int();
impl->month = impl->wdg_month.option() + 1; impl->month = static_cast<int>(impl->wdg_month.option()) + 1;
}); });
impl->wdg_year.events().destroy.connect_unignorable([impl] impl->wdg_year.events().destroy.connect_unignorable([impl]
@ -1040,7 +1040,7 @@ namespace nana
{ {
auto month = impl->wdg_month.option() + 1; auto month = impl->wdg_month.option() + 1;
auto year = impl->wdg_year.to_int(); auto year = impl->wdg_year.to_int();
int days = ::nana::date::month_days(year, month); int days = ::nana::date::month_days(year, static_cast<unsigned>(month));
auto day = impl->wdg_day.to_int(); auto day = impl->wdg_day.to_int();
impl->wdg_day.range(1, days, 1); //It resets the current value of wdg_day impl->wdg_day.range(1, days, 1); //It resets the current value of wdg_day

View File

@ -24,10 +24,9 @@
#include <mutex> #include <mutex>
#endif #endif
#if defined(NANA_WINDOWS) #include <nana/detail/platform_spec_selector.hpp>
#include <nana/detail/win32/platform_spec.hpp>
#elif defined(NANA_LINUX) #if defined(NANA_LINUX)
#include PLATFORM_SPEC_HPP
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#include <iostream> #include <iostream>
#endif #endif
@ -241,11 +240,15 @@ namespace nana
} }
#endif #endif
typedef ::nana::detail::bedrock bedrock;
//class notifier //class notifier
notifier::notifier(window wd) notifier::notifier(window wd)
: impl_(new implement) : impl_(new implement)
{ {
impl_->handle = wd;
impl_->native_handle = API::root(wd);
if (!impl_->native_handle)
throw std::invalid_argument("Invalid window handle");
impl_->ani_timer.elapse([this] impl_->ani_timer.elapse([this]
{ {
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
@ -257,9 +260,6 @@ namespace nana
#endif #endif
}); });
auto & brock = bedrock::instance();
impl_->handle = wd;
impl_->native_handle = brock.root(reinterpret_cast<bedrock::core_window_t*>(wd));
impl_->evt_destroy = API::events(wd).destroy([this] impl_->evt_destroy = API::events(wd).destroy([this]
{ {
close(); close();

File diff suppressed because it is too large Load Diff

692
source/gui/place_parts.hpp Normal file
View File

@ -0,0 +1,692 @@
/*
* Parts of Class Place
* 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/place_parts.hpp
*/
#ifndef NANA_GUI_PLACE_PARTS_HPP
#define NANA_GUI_PLACE_PARTS_HPP
#include <nana/gui/widgets/form.hpp>
#include <nana/gui/widgets/tabbar.hpp>
#include <nana/gui/element.hpp>
#include <nana/paint/text_renderer.hpp>
#include <stdexcept>
#include <deque>
namespace nana
{
namespace place_parts
{
class splitter_interface
{
public:
virtual ~splitter_interface(){}
};
class splitter_dtrigger
: public drawer_trigger
{
};
template<bool IsLite>
class splitter
: public widget_object <typename std::conditional<IsLite, category::lite_widget_tag, category::widget_tag>::type, splitter_dtrigger>,
public splitter_interface
{
private:
void _m_complete_creation() override
{
this->caption("place-splitter");
widget_object <typename std::conditional<IsLite, category::lite_widget_tag, category::widget_tag>::type, splitter_dtrigger>::_m_complete_creation();
}
};
class dock_notifier_interface
{
public:
virtual ~dock_notifier_interface() = default;
virtual void notify_float() = 0;
virtual void notify_dock() = 0;
virtual void notify_move() = 0;
virtual void notify_move_stopped() = 0;
//a dockarea requests to close the dockpane
virtual void request_close() = 0;
};
class dockcaption_dtrigger
: public drawer_trigger
{
public:
void on_close(std::function<void()>&& fn)
{
close_fn_ = std::move(fn);
}
private:
virtual void attached(widget_reference wdg, graph_reference graph) override
{
window_handle_ = wdg;
text_rd_.reset(new paint::text_renderer(graph));
}
void refresh(graph_reference& graph) override
{
graph.set_color(static_cast<color_rgb>(0x83EB));
graph.set_text_color(colors::white);
graph.rectangle(true);
//draw caption
auto text = API::window_caption(window_handle_);
text_rd_->render({ 3, 1 }, text.data(), text.size(), graph.size().width - 20, true);
//draw x button
auto r = _m_button_area();
if (x_pointed_)
{
color xclr = colors::red;
if(x_state_ == ::nana::mouse_action::pressed)
xclr = xclr.blend(colors::white, 0.8);
graph.rectangle(r, true, xclr);
}
r.x += (r.width - 16) / 2;
r.y = (r.height - 16) / 2;
x_icon_.draw(graph, colors::red, colors::white, r, element_state::normal);
}
void mouse_move(graph_reference graph, const arg_mouse& arg) override
{
x_pointed_ = _m_button_area().is_hit(arg.pos);
refresh(graph);
API::lazy_refresh();
}
void mouse_leave(graph_reference graph, const arg_mouse&) override
{
x_pointed_ = false;
refresh(graph);
API::lazy_refresh();
}
void mouse_down(graph_reference graph, const arg_mouse&) override
{
if (!x_pointed_)
return;
x_state_ = ::nana::mouse_action::pressed;
refresh(graph);
API::lazy_refresh();
}
void mouse_up(graph_reference graph, const arg_mouse&) override
{
if (!x_pointed_)
return;
x_state_ = ::nana::mouse_action::over;
refresh(graph);
API::lazy_refresh();
close_fn_();
}
private:
::nana::rectangle _m_button_area() const
{
::nana::rectangle r{API::window_size(window_handle_)};
r.x = r.right() - 20;
r.width = 20;
return r;
}
public:
window window_handle_;
std::unique_ptr<paint::text_renderer> text_rd_;
bool x_pointed_{ false };
::nana::mouse_action x_state_{ ::nana::mouse_action::normal };
facade<element::x_icon> x_icon_;
std::function<void()> close_fn_;
};
class dockarea_caption
: public widget_object < category::widget_tag, dockcaption_dtrigger >
{
public:
void on_close(std::function<void()> fn)
{
get_drawer_trigger().on_close(std::move(fn));
}
};
class dock_page
: public form
{
public:
dock_page(window host, const rectangle& r, const rectangle & tab_r)
: form(host, r, form::appear::bald<>())
{
tab_form_.reset(new form(handle(), tab_r, form::appear::bald<>()));
}
private:
std::unique_ptr<form> tab_form_;
};
class dockarea
: public widget_object <category::lite_widget_tag, drawer_trigger>
{
using base_type = widget_object<category::lite_widget_tag, drawer_trigger>;
using factory = std::function<std::unique_ptr<widget>(window)>;
struct panel
{
std::unique_ptr<widget> widget_ptr;
};
public:
void set_notifier(place_parts::dock_notifier_interface* notifier)
{
notifier_ = notifier;
}
void create(window parent)
{
host_window_ = parent;
base_type::create(parent, true);
this->caption("dockarea");
caption_.create(*this, true);
caption_.on_close([this]
{
bool destroy_dockarea = true;
if (tabbar_)
{
tabbar_->erase(tabbar_->selected());
destroy_dockarea = (0 == tabbar_->length());
}
if (destroy_dockarea)
notifier_->request_close();
});
this->events().resized([this](const arg_resized& arg)
{
rectangle r{ 0, 0, arg.width, 20 };
caption_.move(r);
if (arg.height > 20)
{
r.y = 20;
if (tabbar_)
{
tabbar_->move({ 0, int(arg.height) - 20, arg.width, 20 });
r.height = arg.height - 40;
}
else
r.height = arg.height - 20;
}
for (auto & pn : panels_)
{
if (pn.widget_ptr)
pn.widget_ptr->move(r);
}
});
caption_.events().mouse_down([this](const arg_mouse& arg)
{
if (::nana::mouse::left_button == arg.button)
{
moves_.started = true;
moves_.start_pos = API::cursor_position();
moves_.start_container_pos = (floating() ? container_->pos() : this->pos());
API::capture_window(caption_, true);
}
});
caption_.events().mouse_move([this](const arg_mouse& arg)
{
if (arg.left_button && moves_.started)
{
auto move_pos = API::cursor_position() - moves_.start_pos;
if (!floating())
{
if (std::abs(move_pos.x) > 4 || std::abs(move_pos.y) > 4)
float_away(move_pos);
}
else
{
move_pos += moves_.start_container_pos;
API::move_window(container_->handle(), move_pos);
notifier_->notify_move();
}
}
});
caption_.events().mouse_up([this](const arg_mouse& arg)
{
if ((::nana::mouse::left_button == arg.button) && moves_.started)
{
moves_.started = false;
API::capture_window(caption_, false);
notifier_->notify_move_stopped();
}
});
}
void add_pane(factory & fn)
{
rectangle r{ point(), this->size()};
//get a rectangle excluding caption
r.y = 20;
if (r.height > 20)
r.height -= 20;
else
r.height = 0;
if (!tabbar_)
{
if (panels_.size() > 0)
{
tabbar_.reset(new tabbar_lite(*this));
tabbar_->events().selected.clear();
tabbar_->events().selected([this]
{
auto handle = tabbar_->attach(tabbar_->selected());
if (handle)
caption_.caption(API::window_caption(handle));
else
caption_.caption(::nana::string());
});
tabbar_->move({ 0, r.bottom() - 20, r.width, 20 });
r.height -= 20;
std::size_t pos = 0;
for (auto & pn : panels_)
{
tabbar_->push_back(::nana::charset(pn.widget_ptr->caption()));
tabbar_->attach(pos++, *pn.widget_ptr);
}
}
}
else
r.height -= 20;
auto wdg = fn(*this);
if (tabbar_)
{
tabbar_->push_back(::nana::charset(wdg->caption()));
tabbar_->attach(panels_.size(), wdg->handle());
}
if (panels_.empty())
{
caption_.caption(wdg->caption());
}
panels_.emplace_back();
panels_.back().widget_ptr.swap(wdg);
for (auto & pn : panels_)
{
if (pn.widget_ptr)
pn.widget_ptr->move(r);
}
}
void float_away(const ::nana::point& move_pos)
{
if (container_)
return;
API::capture_window(caption_, false);
rectangle r{ pos() + move_pos, size() };
container_.reset(new form(host_window_, r.pare_off(-1), form::appear::bald<>()));
drawing dw(container_->handle());
dw.draw([](paint::graphics& graph)
{
graph.rectangle(false, colors::coral);
});
API::set_parent_window(handle(), container_->handle());
this->move({ 1, 1 });
container_->show();
API::capture_window(caption_, true);
notifier_->notify_float();
}
void dock()
{
API::capture_window(caption_, false);
API::set_parent_window(handle(), host_window_);
container_.reset();
notifier_->notify_dock();
}
bool floating() const
{
return (nullptr != container_);
}
private:
window host_window_{nullptr};
place_parts::dock_notifier_interface* notifier_{ nullptr };
std::unique_ptr<form> container_;
dockarea_caption caption_;
std::deque<panel> panels_;
std::unique_ptr<tabbar_lite> tabbar_;
struct moves
{
bool started{ false };
::nana::point start_pos;
::nana::point start_container_pos;
}moves_;
};//class dockarea
//number_t is used for storing a number type variable
//such as integer, real and percent. Essentially, percent is a typo of real.
class number_t
{
public:
enum class kind{ none, integer, real, percent };
number_t()
: kind_(kind::none)
{
value_.integer = 0;
}
void reset()
{
kind_ = kind::none;
value_.integer = 0;
}
bool is_negative() const
{
switch (kind_)
{
case kind::integer:
return (value_.integer < 0);
case kind::real:
case kind::percent:
return (value_.real < 0);
default:
break;
}
return false;
}
bool empty() const throw()
{
return (kind::none == kind_);
}
kind kind_of() const
{
return kind_;
}
double get_value(int ref_percent) const
{
switch (kind_)
{
case kind::integer:
return value_.integer;
case kind::real:
return value_.real;
case kind::percent:
return value_.real * ref_percent;
default:
break;
}
return 0;
}
int integer() const
{
if (kind::integer == kind_)
return value_.integer;
return static_cast<int>(value_.real);
}
double real() const
{
if (kind::integer == kind_)
return value_.integer;
return value_.real;
}
void assign(int i)
{
kind_ = kind::integer;
value_.integer = i;
}
void assign(double d)
{
kind_ = kind::real;
value_.real = d;
}
void assign_percent(double d)
{
kind_ = kind::percent;
value_.real = d / 100;
}
private:
kind kind_;
union valueset
{
int integer;
double real;
}value_;
};//end class number_t
class margin
{
public:
margin& operator=(margin&& rhs)
{
if (this != &rhs)
{
all_edges_ = rhs.all_edges_;
margins_ = std::move(rhs.margins_);
}
return *this;
}
void clear()
{
all_edges_ = true;
margins_.clear();
}
void push(const number_t& v)
{
margins_.emplace_back(v);
}
void set_value(const number_t& v)
{
clear();
margins_.emplace_back(v);
}
void set_array(const std::vector<number_t>& v)
{
all_edges_ = false;
margins_ = v;
}
nana::rectangle area(const ::nana::rectangle& field_area) const
{
if (margins_.empty())
return field_area;
auto r = field_area;
if (all_edges_)
{
auto px = static_cast<int>(margins_.back().get_value(static_cast<int>(r.width)));
const auto dbl_px = static_cast<unsigned>(px << 1);
r.x += px;
r.width = (r.width < dbl_px ? 0 : r.width - dbl_px);
r.y += px;
r.height = (r.height < dbl_px ? 0 : r.height - dbl_px);
}
else
{
int il{ -1 }, ir{ -1 }, it{ -1 }, ib{ -1 }; //index of four corners in margin
switch (margins_.size())
{
case 0: break;
case 1: //top
it = 0;
break;
case 2://top,bottom and left,right
it = ib = 0;
il = ir = 1;
break;
default:
il = 3; //left
case 3: //top, right, bottom
it = 0;
ir = 1;
ib = 2;
}
typedef decltype(r.height) px_type;
auto calc = [](px_type a, px_type b)
{
return (a > b ? a - b : 0);
};
if (0 == it) //top
{
auto px = static_cast<int>(margins_[it].get_value(static_cast<int>(field_area.height)));
r.y += px;
r.height = calc(r.height, static_cast<px_type>(px));
}
if (-1 != ib) //bottom
{
auto px = static_cast<int>(margins_[ib].get_value(static_cast<int>(field_area.height)));
r.height = calc(r.height, static_cast<px_type>(px));
}
if (-1 != il) //left
{
auto px = static_cast<px_type>(margins_[il].get_value(static_cast<int>(field_area.width)));
r.x += px;
r.width = calc(r.width, static_cast<px_type>(px));
}
if (-1 != ir) //right
{
auto px = static_cast<int>(margins_[ir].get_value(static_cast<int>(field_area.width)));
r.width = calc(r.width, static_cast<px_type>(px));
}
}
return r;
}
private:
bool all_edges_ = true;
std::vector<number_t> margins_;
};//end class margin
class repeated_array
{
public:
//A workaround for VC2013, becuase it does not generated an implicit declared move-constructor as defaulted.
repeated_array() = default;
repeated_array(repeated_array && other)
: repeated_{ other.repeated_ },
values_(std::move(other.values_))
{
}
repeated_array& operator=(repeated_array&& other)
{
if (this != &other)
{
repeated_ = other.repeated_;
other.repeated_ = false;
values_ = std::move(other.values_);
}
return *this;
}
void assign(std::vector<number_t>&& c)
{
values_ = std::move(c);
}
bool empty() const
{
return values_.empty();
}
void reset()
{
repeated_ = false;
values_.clear();
}
void repeated()
{
repeated_ = true;
}
void push(const number_t& n)
{
values_.emplace_back(n);
}
number_t at(std::size_t pos) const
{
if (values_.empty())
return{};
if (repeated_)
pos %= values_.size();
else if (pos >= values_.size())
return{};
return values_[pos];
}
private:
bool repeated_ = false;
std::vector<number_t> values_;
};
}//end namespace place_parts
}//end namespace nana
#endif //NANA_GUI_PLACE_PARTS_HPP

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
#include <nana/gui/state_cursor.hpp> #include <nana/gui/state_cursor.hpp>
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/basic_window.hpp> #include <nana/gui/detail/basic_window.hpp>
#include <nana/gui/detail/window_manager.hpp>
namespace nana namespace nana
{ {
@ -20,7 +21,7 @@ namespace nana
{ {
auto & brock = detail::bedrock::instance(); auto & brock = detail::bedrock::instance();
auto wd = reinterpret_cast<detail::basic_window*>(handle); auto wd = reinterpret_cast<detail::basic_window*>(handle);
if (brock.wd_manager.available(wd)) if (brock.wd_manager().available(wd))
brock.define_state_cursor(wd, cur, nullptr); brock.define_state_cursor(wd, cur, nullptr);
else else
handle_ = nullptr; handle_ = nullptr;
@ -40,7 +41,7 @@ namespace nana
{ {
auto & brock = detail::bedrock::instance(); auto & brock = detail::bedrock::instance();
auto wd = reinterpret_cast<detail::basic_window*>(handle_); auto wd = reinterpret_cast<detail::basic_window*>(handle_);
if (brock.wd_manager.available(wd)) if (brock.wd_manager().available(wd))
brock.undefine_state_cursor(wd, nullptr); brock.undefine_state_cursor(wd, nullptr);
} }
handle_ = rhs.handle_; handle_ = rhs.handle_;
@ -55,7 +56,7 @@ namespace nana
{ {
auto & brock = detail::bedrock::instance(); auto & brock = detail::bedrock::instance();
auto wd = reinterpret_cast<detail::basic_window*>(handle_); auto wd = reinterpret_cast<detail::basic_window*>(handle_);
if (brock.wd_manager.available(wd)) if (brock.wd_manager().available(wd))
brock.undefine_state_cursor(wd, nullptr); brock.undefine_state_cursor(wd, nullptr);
} }
} }

View File

@ -27,7 +27,7 @@
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
#include <windows.h> #include <windows.h>
#elif defined(NANA_LINUX) #elif defined(NANA_LINUX)
#include PLATFORM_SPEC_HPP #include <nana/detail/platform_spec_selector.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#endif #endif

View File

@ -147,7 +147,6 @@ namespace nana
timer_.reset(); timer_.reset();
this->close(); this->close();
} }
private: private:
timer timer_; timer timer_;
nana::label label_; nana::label label_;
@ -256,25 +255,6 @@ namespace nana
instance(true); instance(true);
} }
private: private:
void _m_enter(const arg_mouse& arg)
{
pair_t & pr = _m_get(arg.window_handle);
if(pr.second.size())
{
this->show(pr.second);
}
}
void _m_leave(const arg_mouse&)
{
close();
}
void _m_destroy(const arg_destroy& arg)
{
_m_untip(arg.window_handle);
}
void _m_untip(window wd) void _m_untip(window wd)
{ {
for (auto i = cont_.begin(); i != cont_.end(); ++i) for (auto i = cont_.begin(); i != cont_.end(); ++i)
@ -303,15 +283,19 @@ namespace nana
auto & events = API::events(wd); auto & events = API::events(wd);
events.mouse_enter.connect([this](const arg_mouse& arg){ events.mouse_enter.connect([this](const arg_mouse& arg){
_m_enter(arg); auto & pr = _m_get(arg.window_handle);
if (pr.second.size())
this->show(pr.second);
}); });
auto leave_fn = std::bind(&controller::_m_leave, this, std::placeholders::_1); auto leave_fn = [this]{
this->close();
};
events.mouse_leave.connect(leave_fn); events.mouse_leave.connect(leave_fn);
events.mouse_down.connect(leave_fn); events.mouse_down.connect(leave_fn);
events.destroy.connect([this](const arg_destroy& arg){ events.destroy.connect([this](const arg_destroy& arg){
_m_destroy(arg); _m_untip(arg.window_handle);
}); });
cont_.emplace_back(wd, nana::string()); cont_.emplace_back(wd, nana::string());

View File

@ -14,7 +14,6 @@
#include <nana/gui/widgets/categorize.hpp> #include <nana/gui/widgets/categorize.hpp>
#include <nana/gui/widgets/float_listbox.hpp> #include <nana/gui/widgets/float_listbox.hpp>
#include <nana/gui/element.hpp> #include <nana/gui/element.hpp>
#include <nana/paint/gadget.hpp>
#include <nana/gui/widgets/detail/tree_cont.hpp> #include <nana/gui/widgets/detail/tree_cont.hpp>
#include <stdexcept> #include <stdexcept>

View File

@ -11,7 +11,6 @@
*/ */
#include <nana/gui/widgets/checkbox.hpp> #include <nana/gui/widgets/checkbox.hpp>
#include <nana/paint/gadget.hpp>
#include <nana/paint/text_renderer.hpp> #include <nana/paint/text_renderer.hpp>
#include <nana/gui/element.hpp> #include <nana/gui/element.hpp>
#include <algorithm> #include <algorithm>
@ -214,39 +213,41 @@ namespace checkbox
element_tag el; element_tag el;
el.uiobj = &uiobj; el.uiobj = &uiobj;
el.eh_checked = uiobj.events().click.connect_unignorable(std::bind(&radio_group::_m_checked, this, std::placeholders::_1), true); el.eh_checked = uiobj.events().click.connect_unignorable([this](const arg_click& arg)
el.eh_destroy = uiobj.events().destroy.connect_unignorable(std::bind(&radio_group::_m_destroy, this, std::placeholders::_1)); {
for (auto & i : ui_container_)
i.uiobj->check(arg.window_handle == i.uiobj->handle());
}, true);
el.eh_destroy = uiobj.events().destroy.connect_unignorable([this](const arg_destroy& arg)
{
for (auto i = ui_container_.begin(); i != ui_container_.end(); ++i)
{
if (arg.window_handle == i->uiobj->handle())
{
ui_container_.erase(i);
return;
}
}
});
ui_container_.push_back(el); ui_container_.push_back(el);
} }
std::size_t radio_group::checked() const std::size_t radio_group::checked() const
{ {
auto i = std::find_if(ui_container_.cbegin(), ui_container_.cend(), [](decltype(*ui_container_.cbegin())& x) for (auto i = ui_container_.cbegin(); i != ui_container_.cend(); ++i)
{ {
return (x.uiobj->checked()); if (i->uiobj->checked())
});
return static_cast<std::size_t>(i - ui_container_.cbegin()); return static_cast<std::size_t>(i - ui_container_.cbegin());
} }
return ui_container_.size();
}
std::size_t radio_group::size() const std::size_t radio_group::size() const
{ {
return ui_container_.size(); return ui_container_.size();
} }
void radio_group::_m_checked(const arg_click& arg)
{
for (auto & i : ui_container_)
i.uiobj->check(arg.window_handle == i.uiobj->handle());
}
void radio_group::_m_destroy(const arg_destroy& arg)
{
auto i = std::find_if(ui_container_.begin(), ui_container_.end(), [&arg](decltype(*ui_container_.begin()) & x)
{
return (arg.window_handle == x.uiobj->handle());
});
if(i != ui_container_.end())
ui_container_.erase(i);
}
//end class radio_group //end class radio_group
}//end namespace nana }//end namespace nana

View File

@ -172,10 +172,25 @@ namespace nana
{ {
editor_->editable(enb); editor_->editable(enb);
if(enb) if (!enb)
editor_->ext_renderer().background = nullptr; {
editor_->ext_renderer().background = [this](graph_reference graph, const ::nana::rectangle&, const ::nana::color&)
{
auto clr_from = colors::button_face_shadow_start;
auto clr_to = colors::button_face_shadow_end;
int pare_off_px = 1;
if (element_state::pressed == state_.button_state)
{
pare_off_px = 2;
std::swap(clr_from, clr_to);
}
graph.gradual_rectangle(::nana::rectangle(graph.size()).pare_off(pare_off_px), clr_from, clr_to, true);
};
}
else else
editor_->ext_renderer().background = std::bind(&drawer_impl::_m_draw_background, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); editor_->ext_renderer().background = nullptr;
editor_->enable_background(enb); editor_->enable_background(enb);
editor_->enable_background_counterpart(!enb); editor_->enable_background_counterpart(!enb);
@ -434,21 +449,6 @@ namespace nana
} }
} }
void _m_draw_background(graph_reference graph, const rectangle&, const ::nana::color&)
{
auto clr_from = colors::button_face_shadow_start;
auto clr_to = colors::button_face_shadow_end;
int pare_off_px = 1;
if (element_state::pressed == state_.button_state)
{
pare_off_px = 2;
std::swap(clr_from, clr_to);
}
graph.gradual_rectangle(::nana::rectangle(graph.size()).pare_off(pare_off_px), clr_from, clr_to, true);
}
void _m_draw_push_button(bool enabled) void _m_draw_push_button(bool enabled)
{ {
::nana::rectangle r{graph_->size()}; ::nana::rectangle r{graph_->size()};
@ -622,7 +622,7 @@ namespace nana
if(drawer_->widget_ptr()->enabled()) if(drawer_->widget_ptr()->enabled())
{ {
auto * editor = drawer_->editor(); auto * editor = drawer_->editor();
if(false == editor->mouse_down(arg.button, arg.pos)) if (!editor->mouse_pressed(arg))
drawer_->open_lister_if_push_button_positioned(); drawer_->open_lister_if_push_button_positioned();
drawer_->draw(); drawer_->draw();
@ -637,7 +637,7 @@ namespace nana
{ {
if (drawer_->widget_ptr()->enabled() && !drawer_->has_lister()) if (drawer_->widget_ptr()->enabled() && !drawer_->has_lister())
{ {
drawer_->editor()->mouse_up(arg.button, arg.pos); drawer_->editor()->mouse_pressed(arg);
drawer_->set_button_state(element_state::hovered, false); drawer_->set_button_state(element_state::hovered, false);
drawer_->draw(); drawer_->draw();
API::lazy_refresh(); API::lazy_refresh();

View File

@ -12,7 +12,6 @@
#include <nana/gui/widgets/date_chooser.hpp> #include <nana/gui/widgets/date_chooser.hpp>
#include <nana/gui/element.hpp> #include <nana/gui/element.hpp>
#include <nana/paint/gadget.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#include <sstream> #include <sstream>

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
#include <nana/gui/widgets/menu.hpp> #include <nana/gui/widgets/menu.hpp>
#include <nana/system/platform.hpp> #include <nana/system/platform.hpp>
#include <nana/paint/gadget.hpp>
#include <nana/gui/element.hpp> #include <nana/gui/element.hpp>
#include <nana/gui/wvl.hpp> #include <nana/gui/wvl.hpp>
#include <nana/paint/text_renderer.hpp> #include <nana/paint/text_renderer.hpp>

View File

@ -578,66 +578,6 @@ namespace nana
return false; return false;
} }
/*
void trigger::_m_draw()
{
auto bgcolor = API::bgcolor(*widget_);
graph_->rectangle(true, bgcolor);
item_renderer ird(*widget_, *graph_);
nana::point item_pos(2, 2);
nana::size item_s(0, 23);
unsigned long index = 0;
for(auto i : items_->cont())
{
//Transform the text if it contains the hotkey character
::nana::char_t hotkey;
::nana::string::size_type hotkey_pos;
auto text = API::transform_shortkey_text(i->text, hotkey, &hotkey_pos);
nana::size text_s = graph_->text_extent_size(text);
item_s.width = text_s.width + 16;
i->pos = item_pos;
i->size = item_s;
using state = item_renderer::state;
state item_state = (index != state_.active ? state::normal : (state_.menu_active ? state::selected : state::highlighted));
ird.background(item_pos, item_s, item_state);
if (state::selected == item_state)
{
int x = item_pos.x + item_s.width;
int y1 = item_pos.y + 2, y2 = item_pos.y + item_s.height - 1;
graph_->line({ x, y1 }, { x, y2 }, bgcolor.blend(colors::gray_border, 0.4));
graph_->line({ x + 1, y1 }, { x + 1, y2 }, bgcolor.blend(colors::button_face_shadow_end, 0.5));
}
//Draw text, the text is transformed from orignal for hotkey character
int text_top_off = (item_s.height - text_s.height) / 2;
ird.caption({ item_pos.x + 8, item_pos.y + text_top_off }, text);
if(hotkey)
{
unsigned off_w = (hotkey_pos ? graph_->text_extent_size(text, static_cast<unsigned>(hotkey_pos)).width : 0);
nana::size hotkey_size = graph_->text_extent_size(text.c_str() + hotkey_pos, 1);
unsigned ascent, descent, inleading;
graph_->text_metrics(ascent, descent, inleading);
int x = item_pos.x + 8 + off_w;
int y = item_pos.y + text_top_off + ascent + 1;
graph_->line({ x, y }, { x + static_cast<int>(hotkey_size.width) - 1, y }, ::nana::colors::black);
}
item_pos.x += i->size.width;
++index;
}
}
*/
//struct state_type //struct state_type
trigger::state_type::state_type() trigger::state_type::state_type()
: active(npos), : active(npos),

View File

@ -90,7 +90,11 @@ namespace nana
metrics_.scroll_pos = pos; metrics_.scroll_pos = pos;
auto value_max = metrics_.peak - metrics_.range; auto value_max = metrics_.peak - metrics_.range;
//Check scroll_area to avoiding division by zero.
if (scroll_area)
metrics_.value = pos * value_max / scroll_area; metrics_.value = pos * value_max / scroll_area;
if(metrics_.value < value_max) if(metrics_.value < value_max)
{ {
int selfpos = static_cast<int>(metrics_.value * scroll_area / value_max); int selfpos = static_cast<int>(metrics_.value * scroll_area / value_max);

View File

@ -217,13 +217,13 @@ namespace nana{ namespace widgets
editor_.select_.a = sel_a_; editor_.select_.a = sel_a_;
editor_.select_.b = sel_b_; editor_.select_.b = sel_b_;
editor_.points_.caret = pos_; editor_.points_.caret = pos_;
editor_._m_move_select(false);
return;
} }
else
{
editor_.select_.a = dest_a_; editor_.select_.a = dest_a_;
editor_.select_.b = dest_b_; editor_.select_.b = dest_b_;
editor_.points_.caret = sel_a_; editor_.points_.caret = sel_a_;
}
editor_._m_move_select(false); editor_._m_move_select(false);
} }
@ -252,13 +252,18 @@ namespace nana{ namespace widgets
virtual std::size_t take_lines(std::size_t pos) const = 0; virtual std::size_t take_lines(std::size_t pos) const = 0;
virtual void update_line(std::size_t textline, std::size_t secondary_before) = 0; virtual void update_line(std::size_t textline, std::size_t secondary_before) = 0;
virtual void render(const ::nana::color& fgcolor) = 0; virtual std::vector<::nana::upoint> render(const ::nana::color& fgcolor) = 0;
virtual nana::point caret_to_screen(upoint) = 0; virtual nana::point caret_to_screen(upoint) = 0;
virtual nana::upoint screen_to_caret(point scrpos) = 0; virtual nana::upoint screen_to_caret(point scrpos) = 0;
virtual bool move_caret_ns(bool to_north) = 0; virtual bool move_caret_ns(bool to_north) = 0;
virtual bool adjust_caret_into_screen() = 0; virtual bool adjust_caret_into_screen() = 0;
}; };
inline bool is_right_text(const unicode_bidi::entity& e)
{
return ((e.bidi_char_type != unicode_bidi::bidi_char::L) && (e.level & 1));
}
class text_editor::behavior_normal class text_editor::behavior_normal
: public editor_behavior_interface : public editor_behavior_interface
@ -290,8 +295,10 @@ namespace nana{ namespace widgets
editor_._m_draw_string(top, API::fgcolor(editor_.window_), nana::upoint(0, editor_.points_.caret.y), editor_.textbase_.getline(textline), true); editor_._m_draw_string(top, API::fgcolor(editor_.window_), nana::upoint(0, editor_.points_.caret.y), editor_.textbase_.getline(textline), true);
} }
void render(const ::nana::color& fgcolor) override std::vector<upoint> render(const ::nana::color& fgcolor) override
{ {
std::vector<upoint> line_index;
::nana::upoint str_pos(0, static_cast<unsigned>(editor_.points_.offset.y)); ::nana::upoint str_pos(0, static_cast<unsigned>(editor_.points_.offset.y));
std::size_t scrlines = editor_.screen_lines() + str_pos.y; std::size_t scrlines = editor_.screen_lines() + str_pos.y;
@ -304,9 +311,12 @@ namespace nana{ namespace widgets
while( str_pos.y < scrlines) while( str_pos.y < scrlines)
{ {
editor_._m_draw_string(top, fgcolor, str_pos, editor_.textbase_.getline(str_pos.y), true); editor_._m_draw_string(top, fgcolor, str_pos, editor_.textbase_.getline(str_pos.y), true);
line_index.push_back(str_pos);
++str_pos.y; ++str_pos.y;
top += pixels; top += pixels;
} }
return line_index;
} }
nana::point caret_to_screen(nana::upoint pos) override nana::point caret_to_screen(nana::upoint pos) override
@ -357,7 +367,7 @@ namespace nana{ namespace widgets
{ {
std::unique_ptr<unsigned[]> pxbuf(new unsigned[len]); std::unique_ptr<unsigned[]> pxbuf(new unsigned[len]);
res.x = editor_._m_char_by_pixels(ent.begin, len, pxbuf.get(), str_px, scrpos.x, _m_is_right_text(ent)); res.x = editor_._m_char_by_pixels(ent.begin, len, pxbuf.get(), str_px, scrpos.x, is_right_text(ent));
res.x += static_cast<unsigned>(ent.begin - lnstr.data()); res.x += static_cast<unsigned>(ent.begin - lnstr.data());
return res; return res;
} }
@ -420,19 +430,21 @@ namespace nana{ namespace widgets
editor_._m_get_scrollbar_size(); editor_._m_get_scrollbar_size();
const auto delta_pixels = editor_._m_text_extent_size(STR(" "), 4).width;
auto x = points.caret.x; auto x = points.caret.x;
const string_type& lnstr = textbase.getline(points.caret.y); auto& lnstr = textbase.getline(points.caret.y);
if (x > lnstr.size()) x = static_cast<unsigned>(lnstr.size()); if (x > lnstr.size()) x = static_cast<unsigned>(lnstr.size());
unsigned text_w = editor_._m_pixels_by_char(lnstr, x); auto const text_w = editor_._m_pixels_by_char(lnstr, x);
unsigned area_w = editor_._m_text_area().width; unsigned area_w = editor_._m_text_area().width;
bool adjusted_cond = true; bool adjusted_cond = true;
if (static_cast<int>(text_w) < points.offset.x) if (static_cast<int>(text_w) < points.offset.x)
{
auto delta_pixels = editor_._m_text_extent_size(STR(" "), 4).width;
points.offset.x = (text_w > delta_pixels ? text_w - delta_pixels : 0); points.offset.x = (text_w > delta_pixels ? text_w - delta_pixels : 0);
}
else if (area_w && (text_w >= points.offset.x + area_w)) else if (area_w && (text_w >= points.offset.x + area_w))
points.offset.x = text_w - area_w + 2; points.offset.x = text_w - area_w + 2;
else else
@ -692,12 +704,14 @@ namespace nana{ namespace widgets
editor_.render(API::is_focus_ready(editor_.window_)); editor_.render(API::is_focus_ready(editor_.window_));
} }
void render(const ::nana::color& fgcolor) override std::vector<upoint> render(const ::nana::color& fgcolor) override
{ {
std::vector<upoint> line_index;
std::size_t secondary; std::size_t secondary;
auto primary = _m_textline_from_screen(0, secondary); auto primary = _m_textline_from_screen(0, secondary);
if (primary >= linemtr_.size() || secondary >= linemtr_[primary].line_sections.size()) if (primary >= linemtr_.size() || secondary >= linemtr_[primary].line_sections.size())
return; return line_index;
nana::upoint str_pos(0, static_cast<unsigned>(primary)); nana::upoint str_pos(0, static_cast<unsigned>(primary));
str_pos.x = static_cast<unsigned>(linemtr_[primary].line_sections[secondary].begin - editor_.textbase_.getline(primary).data()); str_pos.x = static_cast<unsigned>(linemtr_[primary].line_sections[secondary].begin - editor_.textbase_.getline(primary).data());
@ -715,6 +729,7 @@ namespace nana{ namespace widgets
nana::string text(section.begin, section.end); nana::string text(section.begin, section.end);
editor_._m_draw_string(top, fgcolor, str_pos, text, true); editor_._m_draw_string(top, fgcolor, str_pos, text, true);
line_index.push_back(str_pos);
++secondary; ++secondary;
if (secondary >= mtr.line_sections.size()) if (secondary >= mtr.line_sections.size())
{ {
@ -729,6 +744,8 @@ namespace nana{ namespace widgets
else else
break; break;
} }
return line_index;
} }
nana::point caret_to_screen(upoint pos) override nana::point caret_to_screen(upoint pos) override
@ -818,7 +835,7 @@ namespace nana{ namespace widgets
{ {
std::unique_ptr<unsigned[]> pxbuf(new unsigned[len]); std::unique_ptr<unsigned[]> pxbuf(new unsigned[len]);
res.x += editor_._m_char_by_pixels(ent.begin, len, pxbuf.get(), str_px, scrpos.x, _m_is_right_text(ent)); res.x += editor_._m_char_by_pixels(ent.begin, len, pxbuf.get(), str_px, scrpos.x, is_right_text(ent));
res.x += static_cast<unsigned>(ent.begin - str); res.x += static_cast<unsigned>(ent.begin - str);
return res; return res;
} }
@ -1222,7 +1239,6 @@ namespace nana{ namespace widgets
auto ki = kwptr->schemes.find(ds.scheme); auto ki = kwptr->schemes.find(ds.scheme);
if (ki != kwptr->schemes.end() && ki->second) if (ki != kwptr->schemes.end() && ki->second)
{ {
schemes_.emplace(ds.scheme, ki->second);
entities.emplace_back(); entities.emplace_back();
auto & last = entities.back(); auto & last = entities.back();
last.begin = text.data() + pos; last.begin = text.data() + pos;
@ -1259,7 +1275,6 @@ namespace nana{ namespace widgets
} }
private: private:
std::vector<entity> entities_; std::vector<entity> entities_;
std::map<std::string, std::shared_ptr<keyword_scheme>> schemes_;
}; };
//class text_editor //class text_editor
@ -1331,12 +1346,12 @@ namespace nana{ namespace widgets
void text_editor::erase_keyword(const ::nana::string& kw) void text_editor::erase_keyword(const ::nana::string& kw)
{ {
auto i = std::find_if(keywords_->kwbase.begin(), keywords_->kwbase.end(), [&kw](keyword_desc& kd){ for (auto i = keywords_->kwbase.begin(); i != keywords_->kwbase.end(); ++i)
return (kd.text == kw); if (i->text == kw)
}); {
if (i != keywords_->kwbase.end())
keywords_->kwbase.erase(i); keywords_->kwbase.erase(i);
return;
}
} }
void text_editor::set_accept(std::function<bool(char_type)> pred) void text_editor::set_accept(std::function<bool(char_type)> pred)
@ -1438,6 +1453,17 @@ namespace nana{ namespace widgets
behavior_->pre_calc_lines(width_pixels()); behavior_->pre_calc_lines(width_pixels());
} }
void text_editor::indent(bool enb, std::function<nana::string()> generator)
{
indent_.enabled = enb;
indent_.generator.swap(generator);
}
void text_editor::set_event(event_interface* ptr)
{
event_handler_ = ptr;
}
bool text_editor::line_wrapped() const bool text_editor::line_wrapped() const
{ {
return attributes_.line_wrapped; return attributes_.line_wrapped;
@ -1502,6 +1528,18 @@ namespace nana{ namespace widgets
return true; return true;
} }
rectangle text_editor::text_area(bool including_scroll) const
{
if (including_scroll)
return text_area_.area;
auto r = text_area_.area;
r.width = text_area_.area.width > text_area_.vscroll ? text_area_.area.width - text_area_.vscroll : 0;
r.height = text_area_.area.height > text_area_.hscroll ? text_area_.area.height - text_area_.hscroll : 0;
return r;
}
bool text_editor::tip_string(nana::string&& str) bool text_editor::tip_string(nana::string&& str)
{ {
if(attributes_.tip_string == str) if(attributes_.tip_string == str)
@ -1608,30 +1646,6 @@ namespace nana{ namespace widgets
return true; return true;
} }
bool text_editor::mouse_down(::nana::mouse button, const point& scrpos)
{
if (!hit_text_area(scrpos))
return false;
if(::nana::mouse::left_button == button)
{
API::capture_window(window_, true);
text_area_.captured = true;
//Set caret pos by screen point and get the caret pos.
mouse_caret(scrpos);
if(!select(false))
{
select_.a = points_.caret; //Set begin caret
set_end_caret();
}
select_.mode_selection = selection::mode_mouse_selected;
}
text_area_.border_renderer(graph_, _m_bgcolor());
return true;
}
bool text_editor::mouse_move(bool left_button, const point& scrpos) bool text_editor::mouse_move(bool left_button, const point& scrpos)
{ {
cursor cur = cursor::iterm; cursor cur = cursor::iterm;
@ -1656,25 +1670,62 @@ namespace nana{ namespace widgets
return false; return false;
} }
bool text_editor::mouse_up(::nana::mouse button, const point& scrpos) bool text_editor::mouse_pressed(const arg_mouse& arg)
{
if (event_code::mouse_down == arg.evt_code)
{
if (!hit_text_area(arg.pos))
return false;
if (::nana::mouse::left_button == arg.button)
{
API::capture_window(window_, true);
text_area_.captured = true;
//Set caret pos by screen point and get the caret pos.
mouse_caret(arg.pos);
if (arg.shift)
{
if (points_.shift_begin_caret != points_.caret)
{
select_.a = points_.shift_begin_caret;
select_.b = points_.caret;
}
}
else
{
if (!select(false))
{
select_.a = points_.caret; //Set begin caret
set_end_caret();
}
points_.shift_begin_caret = points_.caret;
}
select_.mode_selection = selection::mode_mouse_selected;
}
text_area_.border_renderer(graph_, _m_bgcolor());
return true;
}
else if (event_code::mouse_up == arg.evt_code)
{ {
auto is_prev_no_selected = (select_.mode_selection == selection::mode_no_selected); auto is_prev_no_selected = (select_.mode_selection == selection::mode_no_selected);
if(select_.mode_selection == selection::mode_mouse_selected) if (select_.mode_selection == selection::mode_mouse_selected)
{ {
select_.mode_selection = selection::mode_no_selected; select_.mode_selection = selection::mode_no_selected;
set_end_caret(); set_end_caret();
} }
else if (is_prev_no_selected) else if (is_prev_no_selected)
{ {
if((!select_.dragged) || (!move_select())) if ((!select_.dragged) || (!move_select()))
select(false); select(false);
} }
select_.dragged = false; select_.dragged = false;
API::capture_window(window_, false); API::capture_window(window_, false);
text_area_.captured = false; text_area_.captured = false;
if (hit_text_area(scrpos) == false) if (hit_text_area(arg.pos) == false)
API::window_cursor(window_, nana::cursor::arrow); API::window_cursor(window_, nana::cursor::arrow);
text_area_.border_renderer(graph_, _m_bgcolor()); text_area_.border_renderer(graph_, _m_bgcolor());
@ -1682,6 +1733,8 @@ namespace nana{ namespace widgets
//Redraw if is_prev_no_selected is true //Redraw if is_prev_no_selected is true
return is_prev_no_selected; return is_prev_no_selected;
} }
return false;
}
textbase<nana::char_t> & text_editor::textbase() textbase<nana::char_t> & text_editor::textbase()
{ {
@ -1734,16 +1787,16 @@ namespace nana{ namespace widgets
const unsigned line_pixels = line_height(); const unsigned line_pixels = line_height();
auto pos = this->behavior_->caret_to_screen(crtpos); auto pos = this->behavior_->caret_to_screen(crtpos);
const int end_y = pos.y + static_cast<int>(line_pixels); const int line_bottom = pos.y + static_cast<int>(line_pixels);
bool visible = false; bool visible = false;
if (hit_text_area(pos) && (end_y > text_area_.area.y)) if (hit_text_area(pos) && (line_bottom > text_area_.area.y))
{ {
visible = true; visible = true;
if (end_y > _m_endy()) if (line_bottom > _m_end_pos(false))
API::caret_size(window_, nana::size(1, line_pixels - (end_y - _m_endy()))); API::caret_size(window_, nana::size(1, line_pixels - (line_bottom - _m_end_pos(false))));
else if (API::caret_size(window_).height != line_pixels) else if (API::caret_size(window_).height != line_pixels)
reset_caret_height(); reset_caret_pixels();
} }
API::caret_visible(window_, visible); API::caret_visible(window_, visible);
@ -1759,7 +1812,7 @@ namespace nana{ namespace widgets
points_.caret.x = static_cast<unsigned>(textbase_.getline(points_.caret.y).size()); points_.caret.x = static_cast<unsigned>(textbase_.getline(points_.caret.y).size());
} }
void text_editor::reset_caret_height() const void text_editor::reset_caret_pixels() const
{ {
API::caret_size(window_, nana::size(1, line_height())); API::caret_size(window_, nana::size(1, line_height()));
} }
@ -1814,7 +1867,7 @@ namespace nana{ namespace widgets
bool text_editor::hit_text_area(const point& pos) const bool text_editor::hit_text_area(const point& pos) const
{ {
return ((text_area_.area.x <= pos.x && pos.x < _m_endx()) && (text_area_.area.y <= pos.y && pos.y < _m_endy())); return ((text_area_.area.x <= pos.x && pos.x < _m_end_pos(true)) && (text_area_.area.y <= pos.y && pos.y < _m_end_pos(false)));
} }
bool text_editor::hit_select_area(nana::upoint pos) const bool text_editor::hit_select_area(nana::upoint pos) const
@ -1875,7 +1928,12 @@ namespace nana{ namespace widgets
return window_; return window_;
} }
void text_editor::draw_scroll_rectangle() const std::vector<upoint>& text_editor::text_position() const
{
return text_position_;
}
void text_editor::draw_corner()
{ {
if(text_area_.vscroll && text_area_.hscroll) if(text_area_.vscroll && text_area_.hscroll)
{ {
@ -1908,11 +1966,27 @@ namespace nana{ namespace widgets
//Render the content when the text isn't empty or the window has got focus, //Render the content when the text isn't empty or the window has got focus,
//otherwise draw the tip string. //otherwise draw the tip string.
if ((false == textbase_.empty()) || has_focus) if ((false == textbase_.empty()) || has_focus)
behavior_->render(fgcolor); {
else //Draw tip string auto && text_pos = behavior_->render(fgcolor);
graph_.string({ text_area_.area.x - points_.offset.x, text_area_.area.y }, attributes_.tip_string, { 0x78, 0x78, 0x78 });
draw_scroll_rectangle();
if (text_pos.empty())
text_pos.push_back({ 0, 0 });
if (text_pos != text_position_)
{
text_position_.swap(text_pos);
if (event_handler_)
event_handler_->text_exposed(text_position_);
}
}
else //Draw tip string
graph_.string({ text_area_.area.x - points_.offset.x, text_area_.area.y }, attributes_.tip_string, static_cast<color_rgb>(0x787878));
if (text_position_.empty())
text_position_.push_back({ 0, 0 });
draw_corner();
text_area_.border_renderer(graph_, bgcolor); text_area_.border_renderer(graph_, bgcolor);
} }
@ -1963,7 +2037,7 @@ namespace nana{ namespace widgets
if (refresh || _m_update_caret_line(secondary_before)) if (refresh || _m_update_caret_line(secondary_before))
render(true); render(true);
else else
draw_scroll_rectangle(); draw_corner();
_m_scrollbar(); _m_scrollbar();
@ -2051,6 +2125,29 @@ namespace nana{ namespace widgets
need_refresh = true; need_refresh = true;
} }
if (indent_.enabled)
{
nana::string indent_text;
if (indent_.generator)
{
indent_text = indent_.generator();
}
else
{
auto & text = textbase_.getline(points_.caret.y - 1);
auto indent_pos = text.find_first_not_of(L"\t ");
if (indent_pos != std::wstring::npos)
indent_text = text.substr(0, indent_pos);
else
indent_text = text;
}
if (indent_text.size())
put(indent_text);
}
if (behavior_->adjust_caret_into_screen() || need_refresh) if (behavior_->adjust_caret_into_screen() || need_refresh)
render(true); render(true);
@ -2110,7 +2207,7 @@ namespace nana{ namespace widgets
if(_m_move_offset_x_while_over_border(-2) == false) if(_m_move_offset_x_while_over_border(-2) == false)
{ {
behavior_->update_line(points_.caret.y, secondary); behavior_->update_line(points_.caret.y, secondary);
draw_scroll_rectangle(); draw_corner();
has_to_redraw = false; has_to_redraw = false;
} }
} }
@ -2250,7 +2347,7 @@ namespace nana{ namespace widgets
break; break;
case keyboard::os_end: case keyboard::os_end:
if (caret.y != nlines - 1) { if (caret.y != nlines - 1) {
caret.y = nlines - 1; caret.y = static_cast<decltype(caret.y)>(nlines - 1);
changed = true; changed = true;
} }
break; break;
@ -2265,7 +2362,7 @@ namespace nana{ namespace widgets
}else { }else {
if (caret.y != 0) { if (caret.y != 0) {
--caret.y; --caret.y;
caret.x = textbase_.getline(caret.y).size(); caret.x = static_cast<decltype(caret.x)>(textbase_.getline(caret.y).size());
changed = true; changed = true;
} }
} }
@ -2309,7 +2406,7 @@ namespace nana{ namespace widgets
break; break;
case keyboard::os_end: case keyboard::os_end:
if (caret.x < lnsz) { if (caret.x < lnsz) {
caret.x = lnsz; caret.x = static_cast<decltype(caret.x)>(lnsz);
changed = true; changed = true;
} }
break; break;
@ -2359,7 +2456,7 @@ namespace nana{ namespace widgets
} }
} }
upoint text_editor::mouse_caret(const point& scrpos) //From screen position const upoint& text_editor::mouse_caret(const point& scrpos) //From screen position
{ {
points_.caret = behavior_->screen_to_caret(scrpos); points_.caret = behavior_->screen_to_caret(scrpos);
@ -2370,7 +2467,7 @@ namespace nana{ namespace widgets
return points_.caret; return points_.caret;
} }
upoint text_editor::caret() const const upoint& text_editor::caret() const
{ {
return points_.caret; return points_.caret;
} }
@ -2413,7 +2510,7 @@ namespace nana{ namespace widgets
::nana::color text_editor::_m_bgcolor() const ::nana::color text_editor::_m_bgcolor() const
{ {
return (!API::window_enabled(window_) ? color{ 0xE0, 0xE0, 0xE0 } : API::bgcolor(window_)); return (!API::window_enabled(window_) ? static_cast<color_rgb>(0xE0E0E0) : API::bgcolor(window_));
} }
bool text_editor::_m_scroll_text(bool vert) bool text_editor::_m_scroll_text(bool vert)
@ -2459,8 +2556,12 @@ namespace nana{ namespace widgets
void text_editor::_m_scrollbar() void text_editor::_m_scrollbar()
{ {
_m_get_scrollbar_size(); _m_get_scrollbar_size();
nana::size tx_area = _m_text_area(); nana::size tx_area = _m_text_area();
auto scroll_fn = [this](const arg_mouse& arg) {
_m_on_scroll(arg);
};
if (text_area_.vscroll) if (text_area_.vscroll)
{ {
const int x = text_area_.area.x + static_cast<int>(tx_area.width); const int x = text_area_.area.x + static_cast<int>(tx_area.width);
@ -2472,15 +2573,10 @@ namespace nana{ namespace widgets
wdptr->create(window_, nana::rectangle(x, text_area_.area.y, text_area_.vscroll, tx_area.height)); wdptr->create(window_, nana::rectangle(x, text_area_.area.y, text_area_.vscroll, tx_area.height));
auto & evts = wdptr->events(); auto & evts = wdptr->events();
auto fn = [this](const arg_mouse& arg){ evts.mouse_down(scroll_fn);
_m_on_scroll(arg); evts.mouse_move(scroll_fn);
}; evts.mouse_wheel(scroll_fn);
evts.mouse_down(fn);
evts.mouse_move(fn);
evts.mouse_wheel([this](const arg_wheel& arg)
{
_m_on_scroll(arg);
});
API::take_active(wdptr->handle(), false, window_); API::take_active(wdptr->handle(), false, window_);
} }
@ -2510,13 +2606,10 @@ namespace nana{ namespace widgets
wdptr->create(window_, nana::rectangle(text_area_.area.x, y, tx_area.width, text_area_.hscroll)); wdptr->create(window_, nana::rectangle(text_area_.area.x, y, tx_area.width, text_area_.hscroll));
auto & evts = wdptr->events(); auto & evts = wdptr->events();
auto fn = [this](const arg_mouse& arg) evts.mouse_down(scroll_fn);
{ evts.mouse_move(scroll_fn);
_m_on_scroll(arg); evts.mouse_wheel(scroll_fn);
};
evts.mouse_down(fn);
evts.mouse_move(fn);
evts.mouse_wheel(fn);
wdptr->step(20); wdptr->step(20);
API::take_active(wdptr->handle(), false, window_); API::take_active(wdptr->handle(), false, window_);
} }
@ -2553,12 +2646,16 @@ namespace nana{ namespace widgets
return; return;
} }
//Only the textbox is multi_lines, it enables the scrollbars //No scrollbar if it is not multi-line
if(attributes_.multi_lines) if (!attributes_.multi_lines)
{ {
text_area_.vscroll = 0;
return;
}
text_area_.vscroll = (textbase_.lines() > screen_lines() ? text_area_.scroll_pixels : 0); text_area_.vscroll = (textbase_.lines() > screen_lines() ? text_area_.scroll_pixels : 0);
std::pair<size_t, size_t> max_line = textbase_.max_line(); auto max_line = textbase_.max_line();
if(max_line.second) if(max_line.second)
{ {
if(points_.offset.x || _m_text_extent_size(textbase_.getline(max_line.first).c_str(), max_line.second).width > _m_text_area().width) if(points_.offset.x || _m_text_extent_size(textbase_.getline(max_line.first).c_str(), max_line.second).width > _m_text_area().width)
@ -2569,9 +2666,6 @@ namespace nana{ namespace widgets
} }
} }
} }
else
text_area_.vscroll = 0;
}
void text_editor::_m_reset() void text_editor::_m_reset()
{ {
@ -2818,9 +2912,9 @@ namespace nana{ namespace widgets
else else
{ {
width += text_area_.area.x; width += text_area_.area.x;
if(static_cast<int>(width) - points_.offset.x >= _m_endx()) if(static_cast<int>(width) - points_.offset.x >= _m_end_pos(true))
{ //Out of screen text area { //Out of screen text area
points_.offset.x = static_cast<int>(width) -_m_endx() + 1; points_.offset.x = static_cast<int>(width) -_m_end_pos(false) + 1;
auto rest_size = lnstr.size() - points_.caret.x; auto rest_size = lnstr.size() - points_.caret.x;
points_.offset.x += static_cast<int>(_m_text_extent_size(lnstr.c_str() + points_.caret.x, (rest_size >= static_cast<unsigned>(many) ? static_cast<unsigned>(many) : rest_size)).width); points_.offset.x += static_cast<int>(_m_text_extent_size(lnstr.c_str() + points_.caret.x, (rest_size >= static_cast<unsigned>(many) ? static_cast<unsigned>(many) : rest_size)).width);
return true; return true;
@ -2886,17 +2980,11 @@ namespace nana{ namespace widgets
return text_area_.area.y; return text_area_.area.y;
} }
//_m_endx int text_editor::_m_end_pos(bool right) const
//@brief: Get the right point of text area
int text_editor::_m_endx() const
{ {
if(right)
return static_cast<int>(text_area_.area.x + text_area_.area.width - text_area_.vscroll); return static_cast<int>(text_area_.area.x + text_area_.area.width - text_area_.vscroll);
}
//_m_endy
//@brief: Get the bottom point of text area
int text_editor::_m_endy() const
{
return static_cast<int>(text_area_.area.y + text_area_.area.height - text_area_.hscroll); return static_cast<int>(text_area_.area.y + text_area_.area.height - text_area_.hscroll);
} }
@ -2965,7 +3053,7 @@ namespace nana{ namespace widgets
void text_editor::_m_draw_string(int top, const ::nana::color& clr, const nana::upoint& str_pos, const nana::string& str, bool if_mask) const void text_editor::_m_draw_string(int top, const ::nana::color& clr, const nana::upoint& str_pos, const nana::string& str, bool if_mask) const
{ {
::nana::point text_pos{ text_area_.area.x - points_.offset.x, top }; ::nana::point text_pos{ text_area_.area.x - points_.offset.x, top };
const int xend = text_area_.area.x + static_cast<int>(text_area_.area.width); const int text_right = text_area_.area.right();
std::unique_ptr<nana::string> mask_str; std::unique_ptr<nana::string> mask_str;
if (if_mask && mask_char_) if (if_mask && mask_char_)
@ -3002,7 +3090,7 @@ namespace nana{ namespace widgets
std::size_t len = ent.end - ent.begin; std::size_t len = ent.end - ent.begin;
unsigned str_w = graph_.text_extent_size(ent.begin, len).width; unsigned str_w = graph_.text_extent_size(ent.begin, len).width;
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < xend)) if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{ {
if (selected && focused) if (selected && focused)
{ {
@ -3011,7 +3099,7 @@ namespace nana{ namespace widgets
graph_.string(text_pos, ent.begin, len); graph_.string(text_pos, ent.begin, len);
} }
else else
_m_draw_parse_string(parser, _m_is_right_text(ent), text_pos, clr, ent.begin, len); _m_draw_parse_string(parser, is_right_text(ent), text_pos, clr, ent.begin, len);
} }
text_pos.x += static_cast<int>(str_w); text_pos.x += static_cast<int>(str_w);
} }
@ -3042,7 +3130,7 @@ namespace nana{ namespace widgets
{ {
std::size_t len = ent.end - ent.begin; std::size_t len = ent.end - ent.begin;
unsigned str_w = graph_.text_extent_size(ent.begin, len).width; unsigned str_w = graph_.text_extent_size(ent.begin, len).width;
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < xend)) if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{ {
std::size_t pos = ent.begin - strbeg + str_pos.x; std::size_t pos = ent.begin - strbeg + str_pos.x;
const auto str_end = pos + len; const auto str_end = pos + len;
@ -3071,7 +3159,7 @@ namespace nana{ namespace widgets
auto sel_w = std::accumulate(pxbuf + (a.x - pos), pxbuf + (endpos - pos), unsigned()); auto sel_w = std::accumulate(pxbuf + (a.x - pos), pxbuf + (endpos - pos), unsigned());
graph_.set_text_color(clr); graph_.set_text_color(clr);
if (_m_is_right_text(ent)) if (is_right_text(ent))
{ //RTL { //RTL
rtl_string(text_pos, ent.begin, len, str_w, head_w, sel_w); rtl_string(text_pos, ent.begin, len, str_w, head_w, sel_w);
} }
@ -3100,7 +3188,7 @@ namespace nana{ namespace widgets
int endpos = b.x; int endpos = b.x;
unsigned sel_w = graph_.glyph_extent_size(ent.begin, len, 0, endpos - pos).width; unsigned sel_w = graph_.glyph_extent_size(ent.begin, len, 0, endpos - pos).width;
if (_m_is_right_text(ent)) if (is_right_text(ent))
{ //RTL { //RTL
graph_.set_text_color(clr); graph_.set_text_color(clr);
rtl_string(text_pos, ent.begin, len, str_w, 0, sel_w); rtl_string(text_pos, ent.begin, len, str_w, 0, sel_w);
@ -3125,7 +3213,7 @@ namespace nana{ namespace widgets
{ {
std::size_t len = ent.end - ent.begin; std::size_t len = ent.end - ent.begin;
unsigned str_w = graph_.text_extent_size(ent.begin, len).width; unsigned str_w = graph_.text_extent_size(ent.begin, len).width;
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < xend)) if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{ {
graph_.set_text_color(clr); graph_.set_text_color(clr);
std::size_t pos = ent.begin - strbeg + str_pos.x; std::size_t pos = ent.begin - strbeg + str_pos.x;
@ -3144,7 +3232,7 @@ namespace nana{ namespace widgets
else else
{ {
unsigned head_w = graph_.glyph_extent_size(ent.begin, len, 0, a.x - pos).width; unsigned head_w = graph_.glyph_extent_size(ent.begin, len, 0, a.x - pos).width;
if (_m_is_right_text(ent)) if (is_right_text(ent))
{ //RTL { //RTL
rtl_string(text_pos, ent.begin, len, str_w, head_w, str_w - head_w); rtl_string(text_pos, ent.begin, len, str_w, head_w, str_w - head_w);
} }
@ -3177,7 +3265,7 @@ namespace nana{ namespace widgets
{ {
std::size_t len = ent.end - ent.begin; std::size_t len = ent.end - ent.begin;
unsigned str_w = graph_.text_extent_size(ent.begin, len).width; unsigned str_w = graph_.text_extent_size(ent.begin, len).width;
if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < xend)) if ((text_pos.x + static_cast<int>(str_w) > text_area_.area.x) && (text_pos.x < text_right))
{ {
std::size_t pos = ent.begin - strbeg + str_pos.x; std::size_t pos = ent.begin - strbeg + str_pos.x;
graph_.set_text_color(clr); graph_.set_text_color(clr);
@ -3191,7 +3279,7 @@ namespace nana{ namespace widgets
else if (pos <= b.x && b.x < pos + len) else if (pos <= b.x && b.x < pos + len)
{ {
unsigned sel_w = graph_.glyph_extent_size(ent.begin, len, 0, b.x - pos).width; unsigned sel_w = graph_.glyph_extent_size(ent.begin, len, 0, b.x - pos).width;
if (_m_is_right_text(ent)) if (is_right_text(ent))
{ //RTL { //RTL
rtl_string(text_pos, ent.begin, len, str_w, 0, sel_w); rtl_string(text_pos, ent.begin, len, str_w, 0, sel_w);
} }
@ -3218,7 +3306,7 @@ namespace nana{ namespace widgets
{ {
if (false == behavior_->adjust_caret_into_screen()) if (false == behavior_->adjust_caret_into_screen())
{ {
if (behavior_->caret_to_screen(points_.caret).x < _m_endx()) if (behavior_->caret_to_screen(points_.caret).x < _m_end_pos(true))
{ {
behavior_->update_line(points_.caret.y, secondary_before); behavior_->update_line(points_.caret.y, secondary_before);
return false; return false;
@ -3306,7 +3394,7 @@ namespace nana{ namespace widgets
std::size_t len = ent.end - ent.begin; std::size_t len = ent.end - ent.begin;
if (ent.begin <= ch && ch <= ent.end) if (ent.begin <= ch && ch <= ent.end)
{ {
if (_m_is_right_text(ent)) if (is_right_text(ent))
{ {
//Characters of some bidi languages may transform in a word. //Characters of some bidi languages may transform in a word.
//RTL //RTL
@ -3323,11 +3411,6 @@ namespace nana{ namespace widgets
return text_w; return text_w;
} }
bool text_editor::_m_is_right_text(const unicode_bidi::entity& e)
{
return ((e.bidi_char_type != unicode_bidi::bidi_char::L) && (e.level & 1));
}
//end class text_editor //end class text_editor
}//end namespace skeletons }//end namespace skeletons
}//end namespace widgets }//end namespace widgets

View File

@ -151,6 +151,7 @@ namespace nana
if(dir != attr_.dir) if(dir != attr_.dir)
{ {
attr_.dir = dir; attr_.dir = dir;
_m_mk_slider_pos_by_value();
this->draw(); this->draw();
} }
} }
@ -425,7 +426,7 @@ namespace nana
default: default:
break; break;
} }
return pos; return (pos < 0 ? 0 : pos);
} }
int _m_slider_refpos() const int _m_slider_refpos() const
@ -443,6 +444,12 @@ namespace nana
if(_m_scale()) if(_m_scale())
{ {
auto cmpvalue = static_cast<int>(attr_.vcur); auto cmpvalue = static_cast<int>(attr_.vcur);
if (style::vertical == attr_.dir)
{
double scl = _m_scale();
attr_.vcur = (scl - attr_.pos) * attr_.vmax / scl;
}
else
attr_.vcur = (attr_.pos * attr_.vmax / _m_scale()); attr_.vcur = (attr_.pos * attr_.vmax / _m_scale());
if (cmpvalue != static_cast<int>(attr_.vcur)) if (cmpvalue != static_cast<int>(attr_.vcur))
_m_emit_value_changed(); _m_emit_value_changed();
@ -453,6 +460,9 @@ namespace nana
{ {
attr_.pos = double(_m_scale()) * attr_.vcur / attr_.vmax; attr_.pos = double(_m_scale()) * attr_.vcur / attr_.vmax;
if (style::vertical == attr_.dir)
attr_.pos = _m_scale() - attr_.pos;
if(slider_state_.trace == slider_state_.TraceNone) if(slider_state_.trace == slider_state_.TraceNone)
attr_.adorn_pos = attr_.pos; attr_.adorn_pos = attr_.pos;
} }
@ -480,8 +490,16 @@ namespace nana
//adorn //adorn
renderer::adorn_t adorn; renderer::adorn_t adorn;
adorn.horizontal = bar.horizontal; adorn.horizontal = bar.horizontal;
adorn.bound.x = (bar.horizontal ? bar.r.x : bar.r.y) + attr_.border; if (adorn.horizontal)
{
adorn.bound.x = bar.r.x + attr_.border;
adorn.bound.y = adorn.bound.x + static_cast<int>(attr_.adorn_pos); adorn.bound.y = adorn.bound.x + static_cast<int>(attr_.adorn_pos);
}
else
{
adorn.bound.y = static_cast<int>(other_.graph->height()) - static_cast<int>(attr_.border + bar.r.y);
adorn.bound.x = static_cast<int>(attr_.adorn_pos + attr_.border + bar.r.y);
}
adorn.vcur_scale = static_cast<unsigned>(attr_.pos); adorn.vcur_scale = static_cast<unsigned>(attr_.pos);
adorn.block = (bar.horizontal ? bar.r.height : bar.r.width) - attr_.border * 2; adorn.block = (bar.horizontal ? bar.r.height : bar.r.width) - attr_.border * 2;
adorn.fixedpos = static_cast<int>((bar.horizontal ? bar.r.y : bar.r.x) + attr_.border); adorn.fixedpos = static_cast<int>((bar.horizontal ? bar.r.y : bar.r.x) + attr_.border);

View File

@ -193,12 +193,11 @@ namespace nana
if (str.empty()) if (str.empty())
return true; return true;
auto i = std::find_if(texts_.cbegin(), texts_.cend(), [&str](const std::wstring& value) for (auto i = texts_.cbegin(); i != texts_.cend(); ++i)
{ if (i->find(str) != str.npos)
return (value.find(str) != value.npos); return false;
});
return (i != texts_.cend()); return true;
} }
void spin(bool increase) override void spin(bool increase) override
@ -368,17 +367,13 @@ namespace nana
return true; return true;
} }
if (editor_->mouse_pressed(arg))
bool refreshed = false; {
if (pressed)
refreshed = editor_->mouse_down(arg.button, arg.pos);
else
refreshed = editor_->mouse_up(arg.button, arg.pos);
if (refreshed)
_m_draw_spins(buttons::none); _m_draw_spins(buttons::none);
return true;
}
return refreshed; return false;
} }
bool mouse_move(bool left_button, const ::nana::point& pos) bool mouse_move(bool left_button, const ::nana::point& pos)
@ -411,7 +406,7 @@ namespace nana
{ {
auto spins_r = _m_spins_area(); auto spins_r = _m_spins_area();
if (spins_r.x == 0) if (spins_r.x == 0)
editor_->text_area({}); editor_->text_area(rectangle{});
else else
editor_->text_area({ 2, 2, graph_->width() - spins_r.width - 2, spins_r.height - 2 }); editor_->text_area({ 2, 2, graph_->width() - spins_r.width - 2, spins_r.height - 2 });
} }

View File

@ -103,23 +103,25 @@ namespace nana
switch(sta) switch(sta)
{ {
case item_renderer::highlight: case item_renderer::highlight:
clr = { colors::white }; break; clr = colors::white; break;
case item_renderer::press: case item_renderer::press:
clr = { 0xA0, 0xA0, 0xA0 }; break; clr = static_cast<color_rgb>(0xA0A0A0); break;
case item_renderer::disable: case item_renderer::disable:
clr = { 0x80, 0x80, 0x80 }; break; clr = static_cast<color_rgb>(0x808080); break;
default: default:
clr = { 0xF0, 0xF0, 0xF0 }; clr = static_cast<color_rgb>(0xF0F0F0);
} }
graph.rectangle(r, true, bgcolor_); graph.rectangle(r, true, bgcolor_);
nana::paint::gadget::cross(graph, x, y, 14, 6, clr); facade<element::cross> cross;
cross.draw(graph, {}, clr, { x, y, 14, 6 }, element_state::normal);
} }
virtual void close(graph_reference graph, const nana::rectangle& r, state_t sta) virtual void close(graph_reference graph, const nana::rectangle& r, state_t sta)
{ {
nana::paint::gadget::close_16_pixels(graph, r.x + (r.width - 16) / 2, r.y + (r.height - 16) / 2, 1, colors::black); facade<element::x_icon> x_icon;
x_icon.draw(graph, {}, colors::black, { r.x + static_cast<int>(r.width - 16) / 2, r.y + static_cast<int>(r.height - 16) / 2, 16, 16 }, element_state::normal);
if(item_renderer::highlight == sta) if(item_renderer::highlight == sta)
graph.rectangle(r, false, {0xa0, 0xa0, 0xa0}); graph.rectangle(r, false, static_cast<color_rgb>(0xa0a0a0));
} }
virtual void close_fly(graph_reference graph, const nana::rectangle& r, bool active, state_t sta) virtual void close_fly(graph_reference graph, const nana::rectangle& r, bool active, state_t sta)
@ -129,8 +131,8 @@ namespace nana
if (sta == item_renderer::highlight) if (sta == item_renderer::highlight)
{ {
::nana::color bgcolor{ 0xCC, 0xD2, 0xDD }; ::nana::color bgcolor{ static_cast<color_rgb>(0xCCD2DD) };
::nana::color rect_clr{0x9d, 0xa3, 0xab}; ::nana::color rect_clr{ static_cast<color_rgb>(0x9da3ab) };
graph.round_rectangle(r, 1, 1, rect_clr, false, {}); graph.round_rectangle(r, 1, 1, rect_clr, false, {});
nana::rectangle draw_r(r); nana::rectangle draw_r(r);
graph.rectangle(draw_r.pare_off(1), false, rect_clr.blend(bgcolor, 0.8)); graph.rectangle(draw_r.pare_off(1), false, rect_clr.blend(bgcolor, 0.8));
@ -138,26 +140,25 @@ namespace nana
graph.rectangle(draw_r.pare_off(1), false, rect_clr.blend(bgcolor, 0.2)); graph.rectangle(draw_r.pare_off(1), false, rect_clr.blend(bgcolor, 0.2));
} }
else if (!active) else if (!active)
clr = ::nana::color{ 0x92, 0x99, 0xA4 }; clr = static_cast<color_rgb>(0x9299a4);
facade<element::x_icon> x_icon;
x_icon.draw(graph, {}, colors::black, { r.x + static_cast<int>(r.width - 16) / 2, r.y + static_cast<int>(r.height - 16) / 2, 16, 16 }, element_state::normal);
gadget::close_16_pixels(graph, r.x - (16 - r.width) / 2, r.y - (16 - r.height) / 2, 1, clr);
} }
virtual void back(graph_reference graph, const nana::rectangle& r, state_t sta) virtual void back(graph_reference graph, const nana::rectangle& r, state_t sta)
{ {
using namespace nana::paint::gadget;
_m_draw_arrow(graph, r, sta, direction::west); _m_draw_arrow(graph, r, sta, direction::west);
} }
virtual void next(graph_reference graph, const nana::rectangle& r, state_t sta) virtual void next(graph_reference graph, const nana::rectangle& r, state_t sta)
{ {
using namespace nana::paint::gadget;
_m_draw_arrow(graph, r, sta, direction::east); _m_draw_arrow(graph, r, sta, direction::east);
} }
virtual void list(graph_reference graph, const nana::rectangle& r, state_t sta) virtual void list(graph_reference graph, const nana::rectangle& r, state_t sta)
{ {
using namespace nana::paint::gadget;
_m_draw_arrow(graph, r, sta, direction::south); _m_draw_arrow(graph, r, sta, direction::south);
} }
private: private:
@ -343,7 +344,7 @@ namespace nana
{ {
if(i < list_.size()) if(i < list_.size())
return at_no_bound_check(i); return at_no_bound_check(i);
throw std::out_of_range("Nana.GUI.tabbar::at() is out of range"); throw std::out_of_range("invalid position of tabbar");
} }
iterator iterator_at(std::size_t pos) iterator iterator_at(std::size_t pos)
@ -369,7 +370,7 @@ namespace nana
{ {
if(pos < list_.size()) if(pos < list_.size())
return at_no_bound_check(pos); return at_no_bound_check(pos);
throw std::out_of_range("Nana.GUI.tabbar::at() const is out of range"); throw std::out_of_range("invalid position of tabbar");
} }
const nana::any& at_no_bound_check(std::size_t pos) const const nana::any& at_no_bound_check(std::size_t pos) const
@ -434,6 +435,7 @@ namespace nana
{ {
if ((nullptr == evt_agent_) || evt_agent_->removed(pos)) if ((nullptr == evt_agent_) || evt_agent_->removed(pos))
{ {
API::show_window(iterator_at(pos)->relative, false);
list_.erase(iterator_at(pos)); list_.erase(iterator_at(pos));
_m_adjust(); _m_adjust();
@ -458,6 +460,8 @@ namespace nana
basis_.scroll_pixels = 0; basis_.scroll_pixels = 0;
} }
if (basis_.active != ::nana::npos)
API::show_window(iterator_at(basis_.active)->relative, true);
if(evt_agent_) if(evt_agent_)
evt_agent_->activated(basis_.active); evt_agent_->activated(basis_.active);
return true; return true;
@ -765,22 +769,20 @@ namespace nana
void _m_open_menulister() void _m_open_menulister()
{ {
menulister_.clear(); menulister_.clear();
auto fn = [this](::nana::menu::item_proxy& ipx)
{
if (this->activate(ipx.index()))
API::refresh_window(basis_.wd);
};
auto f = std::bind(&layouter::_m_click_menulister, this, std::placeholders::_1);
for(auto & m : list_) for(auto & m : list_)
menulister_.append(m.text, f); menulister_.append(m.text, fn);
auto r = toolbox_.area(toolbox_.ButtonList, basis_.graph->height()); auto r = toolbox_.area(toolbox_.ButtonList, basis_.graph->height());
r.x += _m_toolbox_pos(); r.x += _m_toolbox_pos();
menulister_.popup(basis_.wd, r.x, r.bottom()); menulister_.popup(basis_.wd, r.x, r.bottom());
} }
void _m_click_menulister(nana::menu::item_proxy& ip)
{
if(this->activate(ip.index()))
API::refresh_window(basis_.wd);
}
//the begin pos of toolbox //the begin pos of toolbox
int _m_toolbox_pos() const int _m_toolbox_pos() const
{ {
@ -1009,12 +1011,12 @@ namespace nana
int x = _m_itembar_right(); int x = _m_itembar_right();
if (x > 0) if (x > 0)
{ {
basis_.graph->line({ x - 2, 0 }, { x - 2, bottom }, { 0x80, 0x80, 0x80 }); basis_.graph->line({ x - 2, 0 }, { x - 2, bottom }, static_cast<color_rgb>(0x808080));
basis_.graph->line({ x - 1, 0 }, { x - 1, bottom }, {0xf0, 0xf0, 0xf0}); basis_.graph->line({ x - 1, 0 }, { x - 1, bottom }, static_cast<color_rgb>(0xf0f0f0));
} }
} }
basis_.graph->set_color({ 0x80, 0x80, 0x80 }); basis_.graph->set_color(static_cast<color_rgb>(0x808080));
int right = static_cast<int>(basis_.graph->width()); int right = static_cast<int>(basis_.graph->width());
int end = active_m.r.x + static_cast<int>(active_m.r.width); int end = active_m.r.x + static_cast<int>(active_m.r.width);
@ -1193,23 +1195,23 @@ namespace nana
return layouter_->text(i); return layouter_->text(i);
} }
bool trigger::toolbox_button(toolbox_button_t btn, bool enable) bool trigger::toolbox(kits btn, bool enable)
{ {
toolbox::button_t tb = toolbox::ButtonSize; auto tb = toolbox::ButtonSize;
toolbox & tbobj = layouter_->toolbox_object(); auto& tbox = layouter_->toolbox_object();
switch(btn) switch(btn)
{ {
case trigger::ButtonAdd: case kits::add:
tb = toolbox::ButtonAdd; break; tb = toolbox::ButtonAdd; break;
case trigger::ButtonList: case kits::list:
tb = toolbox::ButtonList; break; tb = toolbox::ButtonList; break;
case trigger::ButtonClose: case kits::close:
tb = toolbox::ButtonClose; break; tb = toolbox::ButtonClose; break;
case trigger::ButtonScroll: case kits::scroll:
tbobj.enable(toolbox::ButtonScrollBack, enable); tbox.enable(toolbox::ButtonScrollBack, enable);
return tbobj.enable(tbobj.ButtonScrollNext, enable); return tbox.enable(tbox.ButtonScrollNext, enable);
} }
return (tb != toolbox::ButtonSize ? tbobj.enable(tb, enable) : false); return (tb != toolbox::ButtonSize ? tbox.enable(tb, enable) : false);
} }
void trigger::attached(widget_reference widget, graph_reference graph) void trigger::attached(widget_reference widget, graph_reference graph)
@ -1274,8 +1276,6 @@ namespace nana
#include <forward_list> #include <forward_list>
namespace nana namespace nana
{ {
namespace ng
{
namespace drawerbase namespace drawerbase
{ {
namespace tabbar_lite namespace tabbar_lite
@ -1285,6 +1285,7 @@ namespace nana
::std::string text; ::std::string text;
::nana::any value; ::nana::any value;
::std::pair<int, int> pos_ends; ::std::pair<int, int> pos_ends;
::nana::window attached_window{ nullptr };
item(std::string t, ::nana::any v) item(std::string t, ::nana::any v)
: text(std::move(t)), value(std::move(v)) : text(std::move(t)), value(std::move(v))
@ -1345,14 +1346,14 @@ namespace nana
using graph_reference = ::nana::paint::graphics&; using graph_reference = ::nana::paint::graphics&;
static const std::size_t npos = static_cast<std::size_t>(-1); static const std::size_t npos = static_cast<std::size_t>(-1);
void set_widget(widget& wdg) void set_widget(::nana::tabbar_lite& wdg)
{ {
widget_ = &wdg; widget_ = &wdg;
} }
::nana::dev::widget_traits<widget>::scheme_type & scheme() ::nana::tabbar_lite* widget_ptr() const
{ {
return API::scheme(*widget_); return widget_;
} }
std::forward_list<item>& items() std::forward_list<item>& items()
@ -1360,6 +1361,23 @@ namespace nana
return items_; return items_;
} }
void show_attached_window()
{
if (indexes_.active_pos != npos)
{
auto i = items_.cbegin();
std::advance(i, indexes_.active_pos);
API::show_window(i->attached_window, true);
std::size_t pos = 0;
for (auto & m : items_)
{
if (pos++ != indexes_.active_pos)
API::show_window(m.attached_window, false);
}
}
}
bool track_pointer(const point& pos) bool track_pointer(const point& pos)
{ {
std::size_t item_pos = 0; std::size_t item_pos = 0;
@ -1390,7 +1408,7 @@ namespace nana
return indexes_; return indexes_;
} }
private: private:
widget * widget_{ nullptr }; ::nana::tabbar_lite * widget_{ nullptr };
std::forward_list<item> items_; std::forward_list<item> items_;
indexes indexes_; indexes indexes_;
}; };
@ -1404,7 +1422,7 @@ namespace nana
{ {
_m_calc_metrics(graph, model.items()); _m_calc_metrics(graph, model.items());
auto & scheme = model.scheme(); auto & scheme = model.widget_ptr()->scheme();
//draw background //draw background
graph.rectangle(true, scheme.background); graph.rectangle(true, scheme.background);
@ -1475,14 +1493,14 @@ namespace nana
delete model_; delete model_;
} }
model* driver::get_model() model* driver::get_model() const throw()
{ {
return model_; return model_;
} }
void driver::attached(widget_reference wdg, graph_reference) void driver::attached(widget_reference wdg, graph_reference)
{ {
model_->set_widget(wdg); model_->set_widget(dynamic_cast<nana::tabbar_lite&>(wdg));
} }
//Overrides drawer_trigger's method //Overrides drawer_trigger's method
@ -1513,12 +1531,20 @@ namespace nana
void driver::mouse_down(graph_reference graph, const arg_mouse&) void driver::mouse_down(graph_reference graph, const arg_mouse&)
{ {
auto & indexes = model_->get_indexes(); auto & indexes = model_->get_indexes();
if (indexes.hovered_pos == model_->npos) if ((indexes.hovered_pos == model_->npos) || (indexes.active_pos == indexes.hovered_pos))
return; return;
if (indexes.active_pos != indexes.hovered_pos)
{
indexes.active_pos = indexes.hovered_pos; indexes.active_pos = indexes.hovered_pos;
model_->show_attached_window();
refresh(graph); refresh(graph);
API::lazy_refresh(); API::lazy_refresh();
event_arg arg;
model_->widget_ptr()->events().selected.emit(arg);
}
} }
//end class driver //end class driver
} }
@ -1531,6 +1557,47 @@ namespace nana
this->create(parent_wd, r, visible); this->create(parent_wd, r, visible);
} }
//capacity
std::size_t tabbar_lite::length() const
{
auto& items = get_drawer_trigger().get_model()->items();
internal_scope_guard lock;
return static_cast<std::size_t>(std::distance(items.cbegin(), items.cend()));
}
//modifiers
void tabbar_lite::attach(std::size_t pos_set, window wd)
{
auto model = get_drawer_trigger().get_model();
internal_scope_guard lock;
for (auto & m : model->items())
{
if (0 == pos_set--)
{
m.attached_window = wd;
model->show_attached_window();
return;
}
}
throw std::out_of_range("invalid position of tabbar_lite");
}
window tabbar_lite::attach(std::size_t pos_set) const
{
auto model = get_drawer_trigger().get_model();
internal_scope_guard lock;
for (auto & m : model->items())
{
if (0 == pos_set--)
return m.attached_window;
}
throw std::out_of_range("invalid position of tabbar_lite");
}
void tabbar_lite::push_back(std::string text, ::nana::any any) void tabbar_lite::push_back(std::string text, ::nana::any any)
{ {
auto & items = get_drawer_trigger().get_model()->items(); auto & items = get_drawer_trigger().get_model()->items();
@ -1559,6 +1626,64 @@ namespace nana
items.emplace_front(std::move(text), std::move(any)); items.emplace_front(std::move(text), std::move(any));
API::refresh_window(handle()); API::refresh_window(handle());
} }
//end class tabbar
std::size_t tabbar_lite::selected() const
{
auto model = get_drawer_trigger().get_model();
internal_scope_guard lock;
return model->get_indexes().active_pos;
} }
void tabbar_lite::erase(std::size_t pos, bool close_attached)
{
auto model = get_drawer_trigger().get_model();
internal_scope_guard lock;
const auto len = length();
if (len <= pos)
throw std::out_of_range("invalid position of tabbar_lite");
auto active_pos = model->get_indexes().active_pos;
//selection_changed is used to determine whether the title will be updated
bool selection_changed = true;
if (pos == active_pos)
{
if (active_pos + 1 == len)
{
if (active_pos)
--active_pos;
else
active_pos = npos;
}
}
else if (pos < active_pos)
--active_pos;
else
selection_changed = false;
model->get_indexes().active_pos = active_pos;
auto i = model->items().cbefore_begin();
std::advance(i, pos);
auto attached_wd = std::next(i)->attached_window;
model->items().erase_after(i);
model->show_attached_window();
API::refresh_window(handle());
if (close_attached && attached_wd)
API::close_window(attached_wd);
if (selection_changed && (active_pos != npos))
{
event_arg arg;
events().selected.emit(arg);
}
}
//end class tabbar
}//end namespace nana }//end namespace nana

View File

@ -20,26 +20,32 @@
namespace nana namespace nana
{ {
arg_textbox::arg_textbox(textbox& wdg) arg_textbox::arg_textbox(textbox& wdg, const std::vector<upoint>& text_pos)
: widget(wdg) : widget(wdg), text_position(text_pos)
{} {}
namespace drawerbase { namespace drawerbase {
namespace textbox namespace textbox
{ {
//class event_agent //class event_agent
event_agent::event_agent(::nana::textbox& wdg) event_agent::event_agent(::nana::textbox& wdg, const std::vector<upoint>& text_pos)
:widget_(wdg) :widget_(wdg), text_position_(text_pos)
{} {}
void event_agent::first_change() void event_agent::first_change()
{ {
widget_.events().first_change.emit(::nana::arg_textbox{ widget_ }); widget_.events().first_change.emit(::nana::arg_textbox{ widget_, text_position_ });
} }
void event_agent::text_changed() void event_agent::text_changed()
{ {
widget_.events().text_changed.emit(::nana::arg_textbox{ widget_ }); widget_.events().text_changed.emit(::nana::arg_textbox{ widget_, text_position_ });
}
void event_agent::text_exposed(const std::vector<upoint>& text_pos)
{
::nana::arg_textbox arg(widget_, text_pos);
widget_.events().text_exposed.emit(arg);
} }
//end class event_agent //end class event_agent
@ -63,12 +69,13 @@ namespace drawerbase {
{ {
auto wd = wdg.handle(); auto wd = wdg.handle();
widget_ = &wdg; widget_ = &wdg;
evt_agent_.reset(new event_agent(static_cast< ::nana::textbox&>(wdg))); evt_agent_.reset(new event_agent(static_cast<::nana::textbox&>(wdg), editor_->text_position()));
auto scheme = API::dev::get_scheme(wdg); auto scheme = API::dev::get_scheme(wdg);
editor_ = new text_editor(wd, graph, dynamic_cast<::nana::widgets::skeletons::text_editor_scheme*>(scheme)); editor_ = new text_editor(wd, graph, dynamic_cast<::nana::widgets::skeletons::text_editor_scheme*>(scheme));
editor_->textbase().set_event_agent(evt_agent_.get()); editor_->textbase().set_event_agent(evt_agent_.get());
editor_->set_event(evt_agent_.get());
_m_text_area(graph.width(), graph.height()); _m_text_area(graph.width(), graph.height());
@ -104,9 +111,12 @@ namespace drawerbase {
void drawer::mouse_down(graph_reference, const arg_mouse& arg) void drawer::mouse_down(graph_reference, const arg_mouse& arg)
{ {
if(editor_->mouse_down(arg.button, arg.pos)) if (editor_->mouse_pressed(arg))
{
editor_->render(true);
API::lazy_refresh(); API::lazy_refresh();
} }
}
void drawer::mouse_move(graph_reference, const arg_mouse& arg) void drawer::mouse_move(graph_reference, const arg_mouse& arg)
{ {
@ -116,7 +126,7 @@ namespace drawerbase {
void drawer::mouse_up(graph_reference graph, const arg_mouse& arg) void drawer::mouse_up(graph_reference graph, const arg_mouse& arg)
{ {
if(editor_->mouse_up(arg.button, arg.pos)) if(editor_->mouse_pressed(arg))
API::lazy_refresh(); API::lazy_refresh();
} }
@ -229,7 +239,7 @@ namespace drawerbase {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
editor->textbase().store(std::move(file)); editor->textbase().store(std::move(file), false, nana::unicode::utf8); //3rd parameter is just for syntax, it will be ignored
} }
void textbox::store(nana::string file, nana::unicode encoding) void textbox::store(nana::string file, nana::unicode encoding)
@ -237,7 +247,18 @@ namespace drawerbase {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
editor->textbase().store(std::move(file), encoding); editor->textbase().store(std::move(file), true, encoding);
}
/// Enables/disables the textbox to indent a line. Idents a new line when it is created by pressing enter.
/// @param generator generates text for identing a line. If it is empty, textbox indents the line according to last line.
textbox& textbox::indention(bool enb, std::function<nana::string()> generator)
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if (editor)
editor->indent(enb, generator);
return *this;
} }
textbox& textbox::reset(nana::string str) textbox& textbox::reset(nana::string str)
@ -297,8 +318,10 @@ namespace drawerbase {
/// Gets the caret position /// Gets the caret position
bool textbox::caret_pos(point& pos, bool text_coordinate) const bool textbox::caret_pos(point& pos, bool text_coordinate) const
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
internal_scope_guard lock;
if (!editor)
return false;
auto scr_pos = editor->caret_screen_pos(); auto scr_pos = editor->caret_screen_pos();
@ -314,6 +337,16 @@ namespace drawerbase {
return editor->hit_text_area(scr_pos); return editor->hit_text_area(scr_pos);
} }
textbox& textbox::caret_pos(const upoint& pos)
{
auto editor = get_drawer_trigger().editor();
internal_scope_guard lock;
if (editor)
editor->move_caret(pos);
return *this;
}
textbox& textbox::append(const nana::string& text, bool at_caret) textbox& textbox::append(const nana::string& text, bool at_caret)
{ {
internal_scope_guard lock; internal_scope_guard lock;
@ -495,6 +528,7 @@ namespace drawerbase {
void textbox::set_highlight(const std::string& name, const ::nana::color& fgcolor, const ::nana::color& bgcolor) void textbox::set_highlight(const std::string& name, const ::nana::color& fgcolor, const ::nana::color& bgcolor)
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
editor->set_highlight(name, fgcolor, bgcolor); editor->set_highlight(name, fgcolor, bgcolor);
@ -502,6 +536,7 @@ namespace drawerbase {
void textbox::erase_highlight(const std::string& name) void textbox::erase_highlight(const std::string& name)
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
editor->erase_highlight(name); editor->erase_highlight(name);
@ -509,6 +544,7 @@ namespace drawerbase {
void textbox::set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<nana::string> kw_list) void textbox::set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<nana::string> kw_list)
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
{ {
@ -519,6 +555,7 @@ namespace drawerbase {
void textbox::set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::string> kw_list_utf8) void textbox::set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::string> kw_list_utf8)
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
{ {
@ -529,11 +566,39 @@ namespace drawerbase {
void textbox::erase_keyword(const nana::string& kw) void textbox::erase_keyword(const nana::string& kw)
{ {
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if (editor) if (editor)
editor->erase_keyword(kw); editor->erase_keyword(kw);
} }
std::vector<upoint> textbox::text_position() const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if (editor)
return editor->text_position();
return{};
}
rectangle textbox::text_area() const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
if (editor)
return editor->text_area(false);
return{};
}
unsigned textbox::line_pixels() const
{
internal_scope_guard lock;
auto editor = get_drawer_trigger().editor();
return (editor ? editor->line_height() : 0);
}
//Override _m_caption for caption() //Override _m_caption for caption()
nana::string textbox::_m_caption() const throw() nana::string textbox::_m_caption() const throw()
{ {
@ -559,7 +624,7 @@ namespace drawerbase {
widget::_m_typeface(font); widget::_m_typeface(font);
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();
if(editor) if(editor)
editor->reset_caret_height(); editor->reset_caret_pixels();
} }
//end class textbox //end class textbox
}//end namespace nana }//end namespace nana

View File

@ -1491,7 +1491,60 @@ namespace nana
impl_->data.trigger_ptr = this; impl_->data.trigger_ptr = this;
impl_->data.renderer = nana::pat::cloneable<renderer_interface>(internal_renderer()); impl_->data.renderer = nana::pat::cloneable<renderer_interface>(internal_renderer());
impl_->data.comp_placer = nana::pat::cloneable<compset_placer_interface>(internal_placer()); impl_->data.comp_placer = nana::pat::cloneable<compset_placer_interface>(internal_placer());
impl_->adjust.timer.elapse(std::bind(&trigger::_m_deal_adjust, this));
impl_->adjust.timer.elapse([this]
{
auto & adjust = impl_->adjust;
if (adjust.scroll_timestamp && (nana::system::timestamp() - adjust.scroll_timestamp >= 500))
{
if (0 == adjust.offset_x_adjust)
{
if (!impl_->make_adjust(adjust.node ? adjust.node : impl_->shape.first, 1))
{
adjust.offset_x_adjust = 0;
adjust.node = nullptr;
adjust.scroll_timestamp = 0;
adjust.timer.stop();
return;
}
}
auto & shape = impl_->shape;
const int delta = 5;
int old = shape.offset_x;
if (shape.offset_x < adjust.offset_x_adjust)
{
shape.offset_x += delta;
if (shape.offset_x > adjust.offset_x_adjust)
shape.offset_x = adjust.offset_x_adjust;
}
else if (shape.offset_x > adjust.offset_x_adjust)
{
shape.offset_x -= delta;
if (shape.offset_x < adjust.offset_x_adjust)
shape.offset_x = adjust.offset_x_adjust;
}
impl_->draw(false);
API::update_window(impl_->data.widget_ptr->handle());
if (impl_->node_state.tooltip)
{
nana::point pos = impl_->node_state.tooltip->pos();
impl_->node_state.tooltip->move(pos.x - shape.offset_x + old, pos.y);
}
if (shape.offset_x == adjust.offset_x_adjust)
{
adjust.offset_x_adjust = 0;
adjust.node = nullptr;
adjust.scroll_timestamp = 0;
adjust.timer.stop();
}
}
});
impl_->adjust.timer.interval(16); impl_->adjust.timer.interval(16);
impl_->adjust.timer.start(); impl_->adjust.timer.start();
} }
@ -2098,59 +2151,6 @@ namespace nana
API::lazy_refresh(); API::lazy_refresh();
} }
} }
void trigger::_m_deal_adjust()
{
auto & adjust = impl_->adjust;
if(adjust.scroll_timestamp && (nana::system::timestamp() - adjust.scroll_timestamp >= 500))
{
if(adjust.offset_x_adjust == 0)
{
if(!impl_->make_adjust(adjust.node ? adjust.node : impl_->shape.first, 1))
{
adjust.offset_x_adjust = 0;
adjust.node = nullptr;
adjust.scroll_timestamp = 0;
adjust.timer.stop();
return;
}
}
auto & shape = impl_->shape;
const int delta = 5;
int old = shape.offset_x;
if(shape.offset_x < adjust.offset_x_adjust)
{
shape.offset_x += delta;
if(shape.offset_x > adjust.offset_x_adjust)
shape.offset_x = adjust.offset_x_adjust;
}
else if(shape.offset_x > adjust.offset_x_adjust)
{
shape.offset_x -= delta;
if(shape.offset_x < adjust.offset_x_adjust)
shape.offset_x = adjust.offset_x_adjust;
}
impl_->draw(false);
API::update_window(impl_->data.widget_ptr->handle());
if(impl_->node_state.tooltip)
{
nana::point pos = impl_->node_state.tooltip->pos();
impl_->node_state.tooltip->move(pos.x - shape.offset_x + old, pos.y);
}
if(shape.offset_x == adjust.offset_x_adjust)
{
adjust.offset_x_adjust = 0;
adjust.node = nullptr;
adjust.scroll_timestamp = 0;
adjust.timer.stop();
}
}
}
//end class trigger //end class trigger
}//end namespace treebox }//end namespace treebox
}//end namespace drawerbase }//end namespace drawerbase

View File

@ -305,7 +305,7 @@ namespace nana
void widget::_m_move(int x, int y) void widget::_m_move(int x, int y)
{ {
API::move_window(handle(), x, y); API::move_window(handle(), { x, y });
} }
void widget::_m_move(const rectangle& r) void widget::_m_move(const rectangle& r)

View File

@ -1,6 +1,6 @@
/* /*
* Nana GUI Library Definition * Nana GUI Library Definition
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -12,9 +12,17 @@
*/ */
#include <nana/gui/wvl.hpp> #include <nana/gui/wvl.hpp>
#include <nana/gui/detail/bedrock.hpp>
namespace nana namespace nana
{ {
namespace detail
{
void form_loader_private::insert_form(::nana::widget* p)
{
bedrock::instance().manage_form_loader(reinterpret_cast<basic_window*>(p->handle()), true);
}
}
void exec() void exec()
{ {
detail::bedrock::instance().pump_event(nullptr, false); detail::bedrock::instance().pump_event(nullptr, false);

View File

@ -16,6 +16,8 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <memory> #include <memory>
#include <mutex>
#include <map>
namespace nana namespace nana
{ {

View File

@ -13,7 +13,8 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_BMP_HPP #ifndef NANA_PAINT_DETAIL_IMAGE_BMP_HPP
#define NANA_PAINT_DETAIL_IMAGE_BMP_HPP #define NANA_PAINT_DETAIL_IMAGE_BMP_HPP
#include <nana/paint/detail/image_impl_interface.hpp> #include "image_pixbuf.hpp"
#include <memory> #include <memory>
namespace nana{ namespace paint namespace nana{ namespace paint
@ -65,7 +66,7 @@ namespace nana{ namespace paint
#endif #endif
class image_bmp class image_bmp
:public image::image_impl_interface :public basic_image_pixbuf
{ {
public: public:
image_bmp(){} image_bmp(){}
@ -340,35 +341,6 @@ namespace nana{ namespace paint
{ {
return false; return false;
} }
bool empty() const override
{
return pixbuf_.empty();
}
void close() override
{
pixbuf_.close();
}
nana::size size() const override
{
return pixbuf_.size();
}
void paste(const nana::rectangle& src_r, graph_reference graph, const point& p_dst) const override
{
if(graph && pixbuf_)
pixbuf_.paste(src_r, graph.handle(), p_dst);
}
void stretch(const nana::rectangle& src_r, graph_reference graph, const nana::rectangle& r) const override
{
if(graph && pixbuf_)
pixbuf_.stretch(src_r, graph.handle(), r);
}
private:
nana::paint::pixel_buffer pixbuf_;
};//end class bmpfile };//end class bmpfile
}//end namespace detail }//end namespace detail
}//end namespace paint }//end namespace paint

View File

@ -0,0 +1,96 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_JPEG_HPP
#define NANA_PAINT_DETAIL_IMAGE_JPEG_HPP
#include "image_pixbuf.hpp"
//Separate the libpng from the package that system provides.
#if defined(NANA_LIBJPEG)
#include <nana_extrlib/jpeglib.h>
#else
#include <jpeglib.h>
#endif
#include <stdio.h>
#include <csetjmp>
namespace nana
{
namespace paint{ namespace detail{
class image_jpeg
: public basic_image_pixbuf
{
struct error_mgr
{
struct ::jpeg_error_mgr pub;
std::jmp_buf setjmp_buf;
};
public:
bool open(const nana::char_t* jpeg_file) override
{
#ifdef NANA_UNICODE
FILE * fp = ::fopen(static_cast<std::string>(nana::charset(jpeg_file)).c_str(), "rb");
#else
FILE* fp = ::fopen(jpeg_file, "rb");
#endif
if(nullptr == fp) return false;
bool is_opened = false;
struct ::jpeg_decompress_struct jdstru;
error_mgr jerr;
jdstru.err = ::jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = _m_error_handler;
if (!setjmp(jerr.setjmp_buf))
{
::jpeg_create_decompress(&jdstru);
::jpeg_stdio_src(&jdstru, fp);
::jpeg_read_header(&jdstru, true); //Reject a tables-only JPEG file as an error
::jpeg_start_decompress(&jdstru);
//JSAMPLEs per row in output buffer
auto row_stride = jdstru.output_width * jdstru.output_components;
pixbuf_.open(jdstru.output_width, jdstru.output_height);
auto row_buf = jdstru.mem->alloc_sarray(reinterpret_cast<j_common_ptr>(&jdstru), JPOOL_IMAGE, row_stride, 1);
while (jdstru.output_scanline < jdstru.output_height)
{
::jpeg_read_scanlines(&jdstru, row_buf, 1);
pixbuf_.fill_row(jdstru.output_scanline - 1, reinterpret_cast<unsigned char*>(*row_buf), row_stride, jdstru.output_components * 8);
}
jpeg_finish_decompress(&jdstru);
}
::jpeg_destroy_decompress(&jdstru);
::fclose(fp);
return is_opened;
}
bool open(const void* data, std::size_t bytes) override
{
throw std::logic_error("JPEG is not supported for raw data buffer");
return false;
}
private:
static void _m_error_handler(::j_common_ptr jdstru)
{
auto err_ptr = reinterpret_cast<error_mgr*>(jdstru->err);
err_ptr->pub.output_message(jdstru);
longjmp(err_ptr->setjmp_buf, 1);
}
};
}//end namespace detail
}//end namespace paint
}//end namespace nana
#endif

View File

@ -0,0 +1,63 @@
/*
* Basic Image PixelBuffer 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/paint/detail/image_pixbuf.hpp
*/
#ifndef NANA_PAINT_DETAIL_IMAGE_PIXBUF_HPP
#define NANA_PAINT_DETAIL_IMAGE_PIXBUF_HPP
#include <nana/paint/detail/image_impl_interface.hpp>
#include <nana/paint/pixel_buffer.hpp>
namespace nana
{
namespace paint{ namespace detail{
class basic_image_pixbuf
: public image::image_impl_interface
{
public:
bool alpha_channel() const override
{
return pixbuf_.alpha_channel();
}
bool empty() const override
{
return pixbuf_.empty();
}
void close() override
{
pixbuf_.close();
}
::nana::size size() const override
{
return pixbuf_.size();
}
void paste(const ::nana::rectangle& src_r, graph_reference graph, const point& p_dst) const override
{
pixbuf_.paste(src_r, graph.handle(), p_dst);
}
void stretch(const ::nana::rectangle& src_r, graph_reference dst, const nana::rectangle& r) const override
{
pixbuf_.stretch(src_r, dst.handle(), r);
}
protected:
pixel_buffer pixbuf_;
};
}//end namespace detail
}//end namespace paint
}//end namespace nana
#endif

View File

@ -1,24 +1,23 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_PNG_HPP #ifndef NANA_PAINT_DETAIL_IMAGE_PNG_HPP
#define NANA_PAINT_DETAIL_IMAGE_PNG_HPP #define NANA_PAINT_DETAIL_IMAGE_PNG_HPP
#include <nana/paint/detail/image_impl_interface.hpp> #include "image_pixbuf.hpp"
//Separate the libpng from the package that system provides. //Separate the libpng from the package that system provides.
#if defined(NANA_LIBPNG) #if defined(NANA_LIBPNG)
#include <nana/extrlib/png.h> #include <nana_extrlib/png.h>
#else #else
#include <png.h> #include <png.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <nana/paint/pixel_buffer.hpp>
namespace nana namespace nana
{ {
namespace paint{ namespace detail{ namespace paint{ namespace detail{
class image_png class image_png
: public image::image_impl_interface : public basic_image_pixbuf
{ {
public: public:
bool open(const nana::char_t* png_file) override bool open(const nana::char_t* png_file) override
@ -164,39 +163,6 @@ namespace nana
throw std::logic_error("PNG is not supported for raw data buffer"); throw std::logic_error("PNG is not supported for raw data buffer");
return false; return false;
} }
bool alpha_channel() const override
{
return pixbuf_.alpha_channel();
}
virtual bool empty() const override
{
return pixbuf_.empty();
}
virtual void close() override
{
pixbuf_.close();
}
virtual nana::size size() const override
{
return pixbuf_.size();
}
void paste(const nana::rectangle& src_r, graph_reference graph, const point& p_dst) const override
{
pixbuf_.paste(src_r, graph.handle(), p_dst);
}
void stretch(const nana::rectangle& src_r, graph_reference dst, const nana::rectangle& r) const override
{
pixbuf_.stretch(src_r, dst.handle(), r);
}
private:
nana::paint::pixel_buffer pixbuf_;
}; };
}//end namespace detail }//end namespace detail
}//end namespace paint }//end namespace paint

Some files were not shown because too many files have changed in this diff Show More