code reviews

This commit is contained in:
Jinhao 2015-10-13 01:38:53 +08:00
parent 500aa030ae
commit 1b5aed2e5f
41 changed files with 830 additions and 1001 deletions

View File

@ -44,7 +44,6 @@
<Unit filename="../../source/datetime.cpp" />
<Unit filename="../../source/deploy.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/fs_utility.cpp" />
<Unit filename="../../source/gui/animation.cpp" />

View File

@ -598,13 +598,13 @@
"win32/platform_spec.cpp"
"linux_X11/platform_spec.cpp"
1439496157 d:\git.repo\nana\source\detail\win32\platform_spec.cpp
1443581342 d:\git.repo\nana\source\detail\win32\platform_spec.cpp
<nana/config.hpp>
<shellapi.h>
<stdexcept>
<VersionHelpers.h>
1439496157 d:\git.repo\nana\source\detail\linux_x11\platform_spec.cpp
1443581342 d:\git.repo\nana\source\detail\linux_x11\platform_spec.cpp
<nana/config.hpp>
<X11/Xlocale.h>
<locale>
@ -653,13 +653,14 @@
<unistd.h>
<stdlib.h>
1439496157 source:d:\git.repo\nana\source\gui\animation.cpp
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>
@ -675,7 +676,7 @@
<nana/gui/detail/basic_window.hpp>
<nana/gui/detail/native_window_interface.hpp>
1439496157 source:d:\git.repo\nana\source\gui\detail\bedrock_pi.cpp
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>
@ -694,7 +695,7 @@
"win32/bedrock.cpp"
"linux_X11/bedrock.cpp"
1439496157 d:\git.repo\nana\source\gui\detail\win32\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>
@ -709,7 +710,7 @@
<nana/gui/detail/element_store.hpp>
<nana/gui/detail/color_schemes.hpp>
1439496157 d:\git.repo\nana\source\gui\detail\linux_x11\bedrock.cpp
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>
@ -720,7 +721,7 @@
<nana/gui/detail/element_store.hpp>
<errno.h>
1423350892 source:d:\git.repo\nana\source\gui\detail\color_schemes.cpp
1444567878 source:d:\git.repo\nana\source\gui\detail\color_schemes.cpp
<nana/gui/detail/color_schemes.hpp>
<map>
@ -736,10 +737,10 @@
1408986718 source:d:\git.repo\nana\source\gui\detail\element_store.cpp
<nana/gui/detail/element_store.hpp>
1439496157 source:d:\git.repo\nana\source\gui\detail\events_operation.cpp
1444470665 source:d:\git.repo\nana\source\gui\detail\events_operation.cpp
<nana/gui/detail/events_operation.hpp>
1439828940 source:d:\git.repo\nana\source\gui\detail\native_window_interface.cpp
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>
@ -760,9 +761,10 @@
<nana/gui/layout_utility.hpp>
<algorithm>
1439496157 source:d:\git.repo\nana\source\gui\detail\window_manager.cpp
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>
@ -772,10 +774,10 @@
<stdexcept>
<algorithm>
1439746409 source:d:\git.repo\nana\source\gui\dragger.cpp
1444585885 source:d:\git.repo\nana\source\gui\dragger.cpp
<nana/gui/dragger.hpp>
1423350892 source:d:\git.repo\nana\source\gui\drawing.cpp
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>
@ -784,7 +786,7 @@
<nana/gui/effects.hpp>
<nana/gui/programming_interface.hpp>
1439829040 source:d:\git.repo\nana\source\gui\element.cpp
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>
@ -814,7 +816,7 @@
1439496157 source:d:\git.repo\nana\source\gui\layout_utility.cpp
<nana/gui/layout_utility.hpp>
1439496157 source:d:\git.repo\nana\source\gui\msgbox.cpp
1444585885 source:d:\git.repo\nana\source\gui\msgbox.cpp
<nana/gui.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/widgets/button.hpp>
@ -833,7 +835,7 @@
<nana/gui/widgets/picture.hpp>
<nana/paint/pixel_buffer.hpp>
1439496157 source:d:\git.repo\nana\source\gui\notifier.cpp
1444647352 source:d:\git.repo\nana\source\gui\notifier.cpp
<nana/deploy.hpp>
<nana/gui/programming_interface.hpp>
<nana/gui/notifier.hpp>
@ -846,12 +848,15 @@
<nana/system/platform.hpp>
<iostream>
1439746410 source:d:\git.repo\nana\source\gui\programming_interface.cpp
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>
@ -861,10 +866,11 @@
<nana/gui/programming_interface.hpp>
<windows.h>
1415011766 source:d:\git.repo\nana\source\gui\state_cursor.cpp
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>
@ -876,7 +882,7 @@
<windows.h>
<nana/system/platform.hpp>
1439496158 source:d:\git.repo\nana\source\gui\tooltip.cpp
1444585886 source:d:\git.repo\nana\source\gui\tooltip.cpp
<nana/gui/tooltip.hpp>
<nana/gui/widgets/label.hpp>
<nana/gui/timer.hpp>
@ -1167,3 +1173,28 @@
<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,74 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<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\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\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>
<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">
<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="6160" topLine="196" />
<Cursor1 position="4739" topLine="194" />
</Cursor>
</File>
<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">
<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="5894" topLine="205" />
<Cursor1 position="5569" topLine="249" />
</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">
<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="7080" topLine="291" />
<Cursor1 position="1316" topLine="59" />
</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">
<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="12428" topLine="532" />
</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\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\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\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\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\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" />
<Cursor1 position="48249" topLine="407" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -76,11 +41,41 @@
<Cursor1 position="37420" topLine="1435" />
</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="67946" topLine="2580" />
</Cursor>
</File>
<File name="..\..\source\gui\place.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="49985" topLine="1908" />
</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\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\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\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\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\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" />
@ -91,29 +86,14 @@
<Cursor1 position="15535" topLine="539" />
</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\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\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\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\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<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="11188" topLine="459" />
<Cursor1 position="16572" topLine="610" />
</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">
@ -121,34 +101,29 @@
<Cursor1 position="20890" topLine="542" />
</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">
<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="5569" topLine="249" />
<Cursor1 position="11188" topLine="459" />
</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">
<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="6256" topLine="215" />
<Cursor1 position="457" topLine="3" />
</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">
<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="48249" topLine="407" />
<Cursor1 position="1562" topLine="57" />
</Cursor>
</File>
<File name="..\..\source\gui\place.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<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="63864" topLine="2449" />
<Cursor1 position="27717" topLine="1044" />
</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">
<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="4739" topLine="194" />
</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" />
<Cursor1 position="4901" topLine="171" />
</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">
@ -156,4 +131,29 @@
<Cursor1 position="22934" topLine="871" />
</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\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\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\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\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>
</CodeBlocks_layout_file>

View File

@ -184,7 +184,6 @@
<ClCompile Include="..\..\source\datetime.cpp" />
<ClCompile Include="..\..\source\deploy.cpp" />
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" />
<ClCompile Include="..\..\source\exceptions.cpp" />
<ClCompile Include="..\..\source\filesystem\filesystem.cpp" />
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp" />
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp" />
@ -272,7 +271,6 @@
<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\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" />

View File

@ -306,9 +306,6 @@
<ClCompile Include="..\..\source\deploy.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\exceptions.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
<ClCompile Include="..\..\source\traits.cpp">
<Filter>Source Files\nana</Filter>
</ClCompile>
@ -577,9 +574,6 @@
<ClInclude Include="..\..\include\nana\deploy.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\exceptions.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\nana\fwd.hpp">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -156,7 +156,6 @@
<ClCompile Include="..\..\source\datetime.cpp" />
<ClCompile Include="..\..\source\deploy.cpp" />
<ClCompile Include="..\..\source\detail\win32\platform_spec.cpp" />
<ClCompile Include="..\..\source\exceptions.cpp" />
<ClCompile Include="..\..\source\filesystem\filesystem.cpp" />
<ClCompile Include="..\..\source\filesystem\file_iterator.cpp" />
<ClCompile Include="..\..\source\filesystem\fs_utility.cpp" />

View File

@ -72,9 +72,6 @@
<ClCompile Include="..\..\source\deploy.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\exceptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\internationalization.cpp">
<Filter>Source Files</Filter>
</ClCompile>

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

View File

@ -12,9 +12,6 @@
#ifndef 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 "color_schemes.hpp"
#include "internal_scope_guard.hpp"
@ -23,9 +20,11 @@ namespace nana
{
namespace detail
{
struct native_interface;
class element_store;
class element_store;
class events_operation;
struct basic_window;
class window_manager;
//class bedrock
//@brief: bedrock is a fundamental core component, it provides a abstract to the OS platform
@ -34,9 +33,7 @@ namespace detail
{
bedrock();
public:
typedef native_interface interface_type;
typedef window_manager window_manager_t;
typedef window_manager_t::core_window_t core_window_t;
using core_window_t = basic_window;
struct thread_context;
@ -53,7 +50,6 @@ namespace detail
::nana::category::flags category(core_window_t*);
core_window_t* focus();
native_window_type root(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*);
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:
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_drawer(event_code, core_window_t*, const event_arg&, thread_context*);
private:

View File

@ -3,6 +3,9 @@
#include <nana/gui/detail/bedrock.hpp>
#include "color_schemes.hpp"
#include "events_operation.hpp"
#include "window_manager.hpp"
#include <set>
namespace nana
{
@ -10,8 +13,10 @@ namespace nana
{
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
#include "widget_colors.hpp"
#include <nana/pat/cloneable.hpp>
namespace nana
{
@ -27,8 +26,8 @@ namespace nana
virtual ~scheme_factory_base() = default;
virtual factory_identifier* get_id() const = 0;
virtual std::unique_ptr<widget_colors> create() = 0;
virtual std::unique_ptr<widget_colors> create(widget_colors&) = 0;
virtual widget_colors* create() = 0;
virtual widget_colors* create(widget_colors&) = 0;
};
template<typename Scheme>
@ -41,14 +40,14 @@ namespace nana
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:
static factory_identifier fid_;
@ -71,7 +70,7 @@ namespace nana
~color_schemes();
scheme& scheme_template(scheme_factory_base&&);
std::unique_ptr<scheme> create(scheme_factory_base&&);
scheme* create(scheme_factory_base&&);
private:
implement * impl_;
};

View File

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

View File

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

View File

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

View File

@ -13,9 +13,9 @@
#ifndef NANA_GUI_PROGRAMMING_INTERFACE_HPP
#define NANA_GUI_PROGRAMMING_INTERFACE_HPP
#include <nana/config.hpp>
#include "detail/bedrock.hpp"
#include "effects.hpp"
#include "detail/general_events.hpp"
#include "detail/color_schemes.hpp"
#include <nana/paint/image.hpp>
#include <memory>
@ -44,6 +44,11 @@ namespace nana
namespace API
{
namespace detail
{
::nana::widget_colors* make_scheme(::nana::detail::scheme_factory_base&&);
}
void effects_edge_nimbus(window, effects::edge_nimbus);
effects::edge_nimbus effects_edge_nimbus(window);
@ -60,8 +65,7 @@ namespace API
template<typename Scheme>
std::unique_ptr<Scheme> make_scheme()
{
return std::unique_ptr<Scheme>(
static_cast<Scheme*>(::nana::detail::bedrock::instance().make_scheme(::nana::detail::scheme_factory<Scheme>()).release()));
return std::unique_ptr<Scheme>{static_cast<Scheme*>(API::detail::make_scheme(::nana::detail::scheme_factory<Scheme>()))};
}
void set_scheme(window, widget_colors*);
@ -82,9 +86,56 @@ namespace API
}//end namespace dev
widget* get_widget(window);
namespace detail
{
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
void exit();
@ -98,25 +149,12 @@ namespace API
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>
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.");
typedef ::nana::detail::basic_window core_window_t;
auto & brock = ::nana::detail::bedrock::instance();
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));
}
detail::enum_widgets_function<Widget, EnumFunction> enum_fn(static_cast<EnumFunction&&>(fn));
enum_fn.enum_widgets(wd, recursive);
}
void window_icon_default(const paint::image& small_icon, const paint::image& big_icon = {});
@ -172,8 +210,7 @@ namespace API
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)
{
auto & brock = ::nana::detail::bedrock::instance();
return brock.emit(evt_code, reinterpret_cast< ::nana::detail::bedrock::core_window_t*>(wd), arg, true, brock.get_thread_context());
return detail::emit_event(evt_code, wd, arg);
}
void umake_event(event_handle);

View File

@ -166,9 +166,7 @@ namespace nana
std::size_t pos_{0};
};
typedef std::vector<index_pair> selection;
using selection = std::vector<index_pair>;
/// struct essence_t
///@brief: this struct gives many data for listbox,
@ -180,7 +178,7 @@ namespace nana
class drawer_lister_impl;
/// mostly works on display positions
class trigger: public drawer_trigger
class trigger: public drawer_trigger
{
public:
trigger();
@ -208,9 +206,9 @@ namespace nana
drawer_lister_impl *drawer_lister_;
};//end class trigger
/// operate with absolute positions and contain only the position but montain pointers to parts of the real items
/// operate with absolute positions and contain only the position but montain pointers to parts of the real items
/// item_proxy self, it references and iterators are not invalidated by sort()
class item_proxy
class item_proxy
: public std::iterator<std::input_iterator_tag, item_proxy>
{
public:
@ -445,18 +443,18 @@ namespace nana
size_type pos_{0}; ///< Absolute position, not relative to display, and dont change during sort()
};
struct export_options
{
nana::string sep = nana::string {STR("\t" )},
endl= nana::string {STR("\n")} ;
bool only_selected_items{true},
only_checked_items {false},
only_visible_columns{true};
struct export_options
{
nana::string sep = nana::string {STR("\t" )},
endl= nana::string {STR("\n")};
bool only_selected_items{true},
only_checked_items {false},
only_visible_columns{true};
using columns_indexs = std::vector<size_type>;
columns_indexs columns_order;
};
}
using columns_indexs = std::vector<size_type>;
columns_indexs columns_order;
};
}
}//end namespace drawerbase
struct arg_listbox

View File

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

View File

@ -1,7 +1,7 @@
/*
* Image Processor Algorithm Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -233,9 +233,9 @@ namespace detail
std::size_t coef2 = el.iu * iv_minus_coef;
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.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.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.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 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 char>((coef0 * col0.element.blue + coef1 * col1.element.blue + (coef2 * col2.element.blue + coef3 * col3.element.blue)) >> double_shift_size);
}
}
}

View File

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

View File

@ -14,7 +14,7 @@
#include <nana/deploy.hpp>
#include <nana/traits.hpp>
#include <nana/exceptions.hpp>
#include <stdexcept>
namespace nana
@ -70,19 +70,19 @@ namespace system
typedef typename function_ptr<Function>::type fptr_type;
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)
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)
throw nana::bad_handle("shared_wrapper::symbols, empty handle");
throw std::logic_error("shared_wrapper::symbols, empty handle");
if(impl_.symbol != symbol)
{
void *result = detail::shared_helper::symbols(impl_.handle, symbol);
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_.symbol = symbol;

View File

@ -24,6 +24,7 @@
#include <nana/paint/graphics.hpp>
#include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/basic_window.hpp>
#include <nana/gui/detail/window_manager.hpp>
#include <nana/system/platform.hpp>
#include <errno.h>
#include <sstream>
@ -696,7 +697,7 @@ namespace detail
if(vec)
{
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)
wd_manager.close(wd_manager.root(*u));
@ -1362,7 +1363,7 @@ namespace detail
::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child);
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)
{
accepted = true;

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

@ -18,6 +18,7 @@
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)

View File

@ -29,12 +29,12 @@ namespace nana
//class 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()
{
detail::bedrock::instance().wd_manager.internal_lock().unlock();
detail::bedrock::instance().wd_manager().internal_lock().unlock();
}
//end class internal_scope_guard
@ -54,12 +54,12 @@ namespace nana
{
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)
{
bedrock::instance().evt_operation.cancel(evt);
bedrock::instance().evt_operation().cancel(evt);
}
class bedrock::flag_guard
@ -73,7 +73,7 @@ namespace nana
~flag_guard()
{
if (brock_->wd_manager.available((wd_)))
if (brock_->wd_manager().available((wd_)))
wd_->flags.refreshing = false;
}
private:
@ -82,6 +82,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)
{
if (nullptr == wd) return;
@ -113,11 +138,11 @@ namespace nana
wd = wd->seek_non_lite_widget_ancestor();
}
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.map(wd, false);
wd_manager().refresh_tree(wd);
wd_manager().map(wd, false);
}
}
@ -130,13 +155,13 @@ namespace nana
arg.x = x;
arg.y = y;
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)
{
if (wd_manager.available(hovered) && hovered->flags.enabled)
if (wd_manager().available(hovered) && hovered->flags.enabled)
{
hovered->flags.action = mouse_action::normal;
@ -155,7 +180,7 @@ namespace nana
void bedrock::update_cursor(core_window_t * wd)
{
internal_scope_guard isg;
if (wd_manager.available(wd))
if (wd_manager().available(wd))
{
auto * thrd = get_thread_context(wd->thread_id);
if (nullptr == thrd)
@ -167,7 +192,7 @@ namespace nana
return;
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;
set_cursor(wd, wd->predef_cursor, thrd);
@ -179,7 +204,7 @@ namespace nana
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));
}
@ -415,7 +440,7 @@ namespace nana
void bedrock::_m_except_handler()
{
std::vector<core_window_t*> v;
wd_manager.all_handles(v);
wd_manager().all_handles(v);
if (v.size())
{
std::vector<native_window_type> roots;
@ -432,7 +457,7 @@ namespace nana
}
for (auto i : roots)
interface_type::close_window(i);
native_interface::close_window(i);
}
}
}//end namespace detail

View File

@ -76,12 +76,12 @@ namespace nana
//Creates a scheme template if no template
if (!tmpl_scheme)
factory.create().swap(tmpl_scheme);
tmpl_scheme.reset(factory.create());
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)));
}

View File

@ -5,7 +5,7 @@ namespace nana
namespace detail
{
//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)
{
@ -22,21 +22,21 @@ namespace nana
void events_operation::register_evt(event_handle evt)
{
lock_guard lock(mutex_);
register_.insert(evt);
handles_.insert(evt);
}
void events_operation::cancel(event_handle evt)
{
lock_guard lock(mutex_);
register_.erase(evt);
handles_.erase(evt);
}
void events_operation::erase(event_handle evt)
{
lock_guard lock(mutex_);
auto i = register_.find(evt);
if (i != register_.end())
auto i = handles_.find(evt);
if (i != handles_.end())
{
reinterpret_cast<detail::docker_interface*>(evt)->get_event()->remove(evt);
}

View File

@ -233,7 +233,7 @@ namespace detail
if(wd)
{
internal_scope_guard isg;
if(wd_manager.available(wd))
if(wd_manager().available(wd))
return wd->other.category;
}
return category::flags::super;
@ -241,21 +241,10 @@ namespace detail
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);
}
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)
{
auto pre = impl_->menu.taken_window;
@ -265,8 +254,8 @@ namespace detail
if ((!wd) && pre)
{
internal_scope_guard lock;
wd_manager.set_focus(pre, false);
wd_manager.update(pre, true, false);
wd_manager().set_focus(pre, false);
wd_manager().update(pre, true, false);
}
}
@ -381,17 +370,9 @@ namespace detail
//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)
{
if(wd_manager.available(wd) == false)
if(wd_manager().available(wd) == false)
return false;
core_window_t * prev_wd;
@ -408,7 +389,7 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg);
if(ask_update)
wd_manager.do_lazy_refresh(wd, false);
wd_manager().do_lazy_refresh(wd, false);
else
wd->other.upd_state = core_window_t::update_state::none;
@ -418,7 +399,7 @@ namespace detail
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;
core_window_t * prev_wd;
@ -541,7 +522,7 @@ namespace detail
static auto& brock = detail::bedrock::instance();
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)
{
@ -550,7 +531,7 @@ namespace detail
switch(msg.kind)
{
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)
{
arg_dropfiles arg;
@ -560,7 +541,7 @@ namespace detail
arg.pos.x = msg.u.mouse_drop.x - msgwd->pos_root.x;
arg.pos.y = msg.u.mouse_drop.y - msgwd->pos_root.y;
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;
default:
@ -572,7 +553,7 @@ namespace detail
template<typename Arg>
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;
basic_window * pre_wd;
if(thrd)
@ -597,7 +578,7 @@ namespace detail
static core_window_t* last_mouse_down_window;
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)
{
@ -612,7 +593,7 @@ namespace detail
switch(xevent.type)
{
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 (mouse_action::pressed != msgwnd->flags.action)
@ -626,7 +607,7 @@ namespace detail
arg.evt_code = event_code::mouse_move;
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;
}
break;
@ -646,7 +627,7 @@ namespace detail
arg.receiver = native_window;
arg.getting = true;
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;
case FocusOut:
@ -672,7 +653,7 @@ namespace detail
if(msgwnd->dimension.width != static_cast<unsigned>(xevent.xconfigure.width) || msgwnd->dimension.height != static_cast<unsigned>(xevent.xconfigure.height))
{
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)
@ -686,7 +667,7 @@ namespace detail
if(xevent.xbutton.button == Button4 || xevent.xbutton.button == Button5)
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 ((msgwnd == msgwnd->root_widget->other.attribute.root->menubar) && brock.get_menu(msgwnd->root, true))
@ -706,9 +687,9 @@ namespace detail
if (new_focus && !new_focus->flags.ignore_mouse_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)
brock.wd_manager.do_lazy_refresh(kill_focus, false);
brock.wd_manager().do_lazy_refresh(kill_focus, false);
}
}
@ -722,7 +703,7 @@ namespace detail
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.wd_manager.available(msgwnd))
if (brock.wd_manager().available(msgwnd))
{
pressed_wd = msgwnd;
//If a root window is created during the mouse_down event, Nana.GUI will ignore the mouse_up event.
@ -731,7 +712,7 @@ namespace detail
//call the drawer mouse up event for restoring the surface graphics
msgwnd->flags.action = mouse_action::normal;
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 +739,7 @@ namespace detail
}
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)
break;
@ -786,7 +767,7 @@ namespace detail
}
//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)
msgwnd->flags.action = mouse_action::over;
@ -805,7 +786,7 @@ namespace detail
evt_ptr->click.emit(arg);
}
if (brock.wd_manager.available(msgwnd))
if (brock.wd_manager().available(msgwnd))
{
arg.evt_code = event_code::mouse_up;
evt_ptr->mouse_up.emit(arg);
@ -818,7 +799,7 @@ namespace detail
arg.by_mouse = true;
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;
}
@ -826,7 +807,7 @@ namespace detail
case DestroyNotify:
{
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().
if (msgwnd->root == brock.get_menu())
@ -836,10 +817,10 @@ namespace detail
}
spec.remove(native_window);
brock.wd_manager.destroy(msgwnd);
brock.wd_manager().destroy(msgwnd);
brock.rt_manager.remove_if_exists(msgwnd);
brock.wd_manager.destroy_handle(msgwnd);
brock.manage_form_loader(msgwnd, false);
brock.wd_manager().destroy_handle(msgwnd);
}
}
break;
@ -854,8 +835,8 @@ namespace detail
else
break;
msgwnd = brock.wd_manager.find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
if (brock.wd_manager.available(hovered_wd) && (msgwnd != hovered_wd))
msgwnd = brock.wd_manager().find_window(native_window, xevent.xmotion.x, xevent.xmotion.y);
if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
{
brock.event_msleave(hovered_wd);
hovered_wd->flags.action = mouse_action::normal;
@ -863,14 +844,14 @@ namespace detail
//if msgwnd is neither a captured window nor a child of 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)
msgwnd = cap_wd;
}
else if(msgwnd)
{
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;
if(prev_captured_inside)
@ -909,7 +890,7 @@ namespace detail
arg.evt_code = event_code::mouse_move;
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;
break;
case MapNotify:
@ -1010,11 +991,11 @@ namespace detail
{
arg_keyboard 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)
{
brock.wd_manager.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
brock.wd_manager().set_focus(tstop_wd, false);
brock.wd_manager().do_lazy_refresh(tstop_wd, true);
}
}
else if(keyboard::alt == keychar)
@ -1050,7 +1031,7 @@ namespace detail
arg.window_handle = reinterpret_cast<window>(msgwnd);
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
//twice, because the status would be equal to XLookupChars if the input method is
@ -1069,7 +1050,7 @@ namespace detail
if(XLookupKeySym == status)
{
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
break;
}
case XLookupChars:
@ -1099,7 +1080,7 @@ namespace detail
arg.ctrl = arg.shift = false;
arg.evt_code = event_code::shortkey;
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)
{
arg.window_handle = reinterpret_cast<window>(shr_wd);
@ -1112,7 +1093,7 @@ namespace detail
brock.get_key_state(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);
}
@ -1121,7 +1102,7 @@ namespace detail
}
break;
}
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
if(keybuf != fixbuf)
delete [] keybuf;
}
@ -1156,7 +1137,7 @@ namespace detail
{
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
if (set_focus)
brock.wd_manager.set_focus(msgwnd, false);
brock.wd_manager().set_focus(msgwnd, false);
arg_keyboard arg;
arg.evt_code = event_code::key_release;
@ -1194,7 +1175,7 @@ namespace detail
}
}
root_runtime = brock.wd_manager.root_runtime(native_window);
root_runtime = brock.wd_manager().root_runtime(native_window);
if(root_runtime)
{
context.event_window = pre_event_window;
@ -1207,11 +1188,11 @@ namespace detail
if(context) context->event_window = pre_event_window;
}
auto thread_id = ::nana::system::this_thread_id()
brock.wd_manager.call_safe_place(thread_id);
auto thread_id = ::nana::system::this_thread_id();
brock.wd_manager().call_safe_place(thread_id);
if(msgwnd)
brock.wd_manager.remove_trash_handle(thread_id);
brock.wd_manager().remove_trash_handle(thread_id);
}
}
@ -1226,18 +1207,18 @@ namespace detail
}
++(context->event_pump_ref_count);
wd_manager.internal_lock().revert();
wd_manager().internal_lock().revert();
native_window_type owner_native = 0;
core_window_t * owner = 0;
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);
if(owner_native)
{
native_interface::enable_window(owner_native, false);
owner = wd_manager.root(owner_native);
owner = wd_manager().root(owner_native);
if(owner)
owner->flags.enabled = false;
}
@ -1252,7 +1233,7 @@ namespace detail
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 == modal_window || 0 == context->window_count)
@ -1338,7 +1319,7 @@ namespace detail
void bedrock::undefine_state_cursor(core_window_t * wd, thread_context* thrd)
{
if (!wd_manager.available(wd))
if (!wd_manager().available(wd))
return;
wd->root_widget->other.attribute.root->state_cursor = nana::cursor::arrow;
@ -1350,7 +1331,7 @@ namespace detail
return;
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)
set_cursor(rev_wd, rev_wd->predef_cursor, thrd);
}

View File

@ -1,7 +1,7 @@
/*
* Platform Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -25,6 +25,7 @@
#elif defined(NANA_X11)
#include <nana/system/platform.hpp>
#include <nana/gui/detail/bedrock.hpp>
#include <nana/gui/detail/window_manager.hpp>
#endif
namespace nana{
@ -595,7 +596,7 @@ namespace nana{
Display* disp = restrict::spec.open_display();
restrict::spec.remove(wd);
auto iwd = brock.wd_manager.root(wd);
auto iwd = brock.wd_manager().root(wd);
if(iwd)
{
{
@ -607,9 +608,9 @@ namespace nana{
::XFlush(disp);
restrict::spec.rev_error_handler();
}
brock.wd_manager.destroy(iwd);
brock.rt_manager.remove_if_exists(iwd);
brock.wd_manager.destroy_handle(iwd);
brock.wd_manager().destroy(iwd);
brock.manage_form_loader(iwd, false);
brock.wd_manager().destroy_handle(iwd);
}
nana::detail::platform_scope_guard psg;

View File

@ -251,10 +251,10 @@ namespace detail
bedrock::~bedrock()
{
if(wd_manager.number_of_core_window())
if(wd_manager().number_of_core_window())
{
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);
}
@ -364,7 +364,7 @@ namespace detail
++(context->event_pump_ref_count);
auto & intr_locker = wd_manager.internal_lock();
auto & intr_locker = wd_manager().internal_lock();
intr_locker.revert();
try
@ -372,8 +372,7 @@ namespace detail
MSG msg;
if(modal_window)
{
HWND native_handle = reinterpret_cast<HWND>(
root(reinterpret_cast<core_window_t*>(modal_window)));
HWND native_handle = reinterpret_cast<HWND>(reinterpret_cast<core_window_t*>(modal_window)->root);
if (is_modal)
{
HWND owner = ::GetWindow(native_handle, GW_OWNER);
@ -395,7 +394,7 @@ namespace detail
::TranslateMessage(&msg);
::DispatchMessage(&msg);
wd_manager.remove_trash_handle(tid);
wd_manager().remove_trash_handle(tid);
}
}
}
@ -413,8 +412,8 @@ namespace detail
::DispatchMessage(&msg);
}
wd_manager.call_safe_place(tid);
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)
break;
}//end while
@ -433,8 +432,8 @@ namespace detail
::DispatchMessage(&msg);
}
wd_manager.call_safe_place(tid);
wd_manager.remove_trash_handle(tid);
wd_manager().call_safe_place(tid);
wd_manager().remove_trash_handle(tid);
}//end while
//Empty these rest messages, there is not a window to process these messages.
@ -607,7 +606,7 @@ namespace detail
case nana::detail::messages::map_thread_root_buffer:
{
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);
::HeapFree(::GetProcessHeap(), 0, stru);
}
@ -760,7 +759,7 @@ namespace detail
template<typename Arg>
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;
basic_window* prev_event_wd;
@ -788,7 +787,7 @@ namespace detail
static restrict::TRACKMOUSEEVENT track = {sizeof track, 0x00000002};
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)
{
@ -884,7 +883,7 @@ namespace detail
arg_focus arg;
assign_arg(arg, focus, native_window, true);
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;
break;
@ -915,21 +914,21 @@ namespace detail
break;
case WM_LBUTTONDBLCLK: case WM_MBUTTONDBLCLK: case WM_RBUTTONDBLCLK:
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->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)
brock.wd_manager.do_lazy_refresh(killed, false);
brock.wd_manager().do_lazy_refresh(killed, false);
}
arg_mouse arg;
assign_arg(arg, msgwnd, message, pmdec);
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;
}
}
@ -939,7 +938,7 @@ namespace detail
def_window_proc = true;
break;
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 event on the menubar, just remove the menu if it is not associating with the menubar
@ -957,9 +956,9 @@ namespace detail
auto new_focus = (msgwnd->flags.take_active ? msgwnd : msgwnd->other.active_window);
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)
brock.wd_manager.do_lazy_refresh(kill_focus, false);
brock.wd_manager().do_lazy_refresh(kill_focus, false);
}
}
@ -976,14 +975,14 @@ namespace detail
auto pos = native_interface::cursor_position();
auto rootwd = native_interface::find_window(pos.x, pos.y);
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
msgwnd->flags.action = mouse_action::normal;
arg.evt_code = event_code::mouse_up;
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
}
}
}
@ -995,7 +994,7 @@ namespace detail
case WM_LBUTTONUP:
case WM_MBUTTONUP:
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)
break;
@ -1022,7 +1021,7 @@ namespace detail
}
//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;
emit_drawer(&drawer::mouse_up, msgwnd, arg, &context);
@ -1035,7 +1034,7 @@ namespace detail
retain->click.emit(arg);
}
if (brock.wd_manager.available(msgwnd))
if (brock.wd_manager().available(msgwnd))
{
arg.evt_code = event_code::mouse_up;
retain->mouse_up.emit(arg);
@ -1048,13 +1047,13 @@ namespace detail
arg.by_mouse = true;
retain->click.emit(arg);
}
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
}
pressed_wd = nullptr;
break;
case WM_MOUSEMOVE:
msgwnd = brock.wd_manager.find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if (brock.wd_manager.available(hovered_wd) && (msgwnd != hovered_wd))
msgwnd = brock.wd_manager().find_window(native_window, pmdec.mouse.x, pmdec.mouse.y);
if (brock.wd_manager().available(hovered_wd) && (msgwnd != hovered_wd))
{
brock.event_msleave(hovered_wd);
hovered_wd->flags.action = mouse_action::normal;
@ -1062,7 +1061,7 @@ namespace detail
//if msgwnd is neither captured window nor the child of 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)
msgwnd = wd;
}
@ -1070,7 +1069,7 @@ namespace detail
else if(msgwnd)
{
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;
if(prev_captured_inside)
@ -1115,7 +1114,7 @@ namespace detail
track.hwndTrack = native_window;
restrict::track_mouse_event(&track);
}
if (!brock.wd_manager.available(hovered_wd))
if (!brock.wd_manager().available(hovered_wd))
hovered_wd = nullptr;
break;
case WM_MOUSELEAVE:
@ -1131,7 +1130,7 @@ namespace detail
if (pointer_wd == root_window)
{
::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;
auto evt_wd = scrolled_wd;
@ -1141,7 +1140,7 @@ namespace detail
{
def_window_proc = false;
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.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
@ -1155,13 +1154,13 @@ namespace detail
if (scrolled_wd && (nullptr == evt_wd))
{
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.which = (WM_MOUSEHWHEEL == message ? arg_wheel::wheel::horizontal : arg_wheel::wheel::vertical);
assign_arg(arg, scrolled_wd, pmdec);
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
@ -1179,7 +1178,7 @@ namespace detail
POINT 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)
{
arg_dropfiles dropfiles;
@ -1209,11 +1208,11 @@ namespace detail
dropfiles.pos.x = pos.x;
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);
msgwnd->together.events_ptr->mouse_dropfiles.emit(dropfiles);
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
}
}
@ -1301,7 +1300,7 @@ namespace detail
break;
case WM_SIZE:
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;
case WM_MOVE:
brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
@ -1327,7 +1326,7 @@ namespace detail
case WM_SYSCHAR:
def_window_proc = 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)
{
arg_keyboard arg;
@ -1374,7 +1373,7 @@ namespace detail
bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus);
if (set_focus)
brock.wd_manager.set_focus(msgwnd, false);
brock.wd_manager().set_focus(msgwnd, false);
arg_keyboard arg;
arg.evt_code = event_code::key_release;
@ -1408,12 +1407,12 @@ namespace detail
{
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)
{
brock.wd_manager.set_focus(tstop_wd, false);
brock.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager.do_lazy_refresh(tstop_wd, true);
brock.wd_manager().set_focus(tstop_wd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(tstop_wd, true);
}
}
else
@ -1455,10 +1454,10 @@ namespace detail
arg.ignore = false;
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.wd_manager.do_lazy_refresh(msgwnd, false);
brock.wd_manager().do_lazy_refresh(msgwnd, false);
}
}
return 0;
@ -1506,12 +1505,12 @@ namespace detail
brock.erase_menu(false);
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);
break;
case WM_NCDESTROY:
brock.rt_manager.remove_if_exists(msgwnd);
brock.wd_manager.destroy_handle(msgwnd);
brock.manage_form_loader(msgwnd, false);
brock.wd_manager().destroy_handle(msgwnd);
if(--context.window_count <= 0)
{
@ -1523,7 +1522,7 @@ namespace detail
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)
{
root_runtime->condition.pressed = pressed_wd;
@ -1540,21 +1539,15 @@ namespace detail
::nana::category::flags bedrock::category(core_window_t* wd)
{
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*
{
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);
}
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)
{
auto pre = impl_->menu.taken_window;
@ -1565,8 +1558,8 @@ namespace detail
if ((!wd) && pre && (pre->root != get_menu()))
{
internal_scope_guard lock;
wd_manager.set_focus(pre, false);
wd_manager.update(pre, true, false);
wd_manager().set_focus(pre, false);
wd_manager().update(pre, true, false);
}
}
@ -1694,17 +1687,9 @@ namespace detail
#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)
{
if (wd_manager.available(wd) == false)
if (wd_manager().available(wd) == false)
return false;
basic_window* prev_event_wd;
@ -1721,8 +1706,8 @@ namespace detail
_m_emit_core(evt_code, wd, false, arg);
if (ask_update)
wd_manager.do_lazy_refresh(wd, false);
else if (wd_manager.available(wd))
wd_manager().do_lazy_refresh(wd, false);
else if (wd_manager().available(wd))
wd->other.upd_state = basic_window::update_state::none;
if (thrd) thrd->event_window = prev_event_wd;
@ -1731,7 +1716,7 @@ namespace detail
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;
core_window_t* prev_event_wd;
@ -1856,7 +1841,7 @@ namespace detail
thrd = get_thread_context(wd->thread_id);
HCURSOR rev_handle = ::LoadCursor(nullptr, IDC_ARROW);
if (!wd_manager.available(wd))
if (!wd_manager().available(wd))
{
::ShowCursor(FALSE);
::SetCursor(rev_handle);
@ -1877,7 +1862,7 @@ namespace detail
}
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)
{
set_cursor(rev_wd, rev_wd->predef_cursor, thrd);

View File

@ -8,12 +8,12 @@
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/detail/window_manager.cpp
* @author: Jinhao
* @contributors: Katsuhisa Yuasa
*/
#include <nana/config.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/window_manager.hpp>
#include <nana/gui/detail/native_window_interface.hpp>
@ -33,7 +33,7 @@ namespace detail
{
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;
}
};
@ -788,12 +788,6 @@ namespace detail
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::lock_guard<decltype(mutex_)> lock(mutex_);

View File

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

View File

@ -241,11 +241,15 @@ namespace nana
}
#endif
typedef ::nana::detail::bedrock bedrock;
//class notifier
notifier::notifier(window wd)
: 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]
{
#if defined(NANA_WINDOWS)
@ -257,9 +261,6 @@ namespace nana
#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]
{
close();

View File

@ -1074,7 +1074,6 @@ namespace nana
}
block_px = lowest;
if (blocks > min_count)
rest_px -= (lowest-level_px) * (blocks - min_count);
@ -1141,7 +1140,6 @@ namespace nana
void collocate(window wd) override
{
if (!field || !(visible && display))
return;
@ -1797,14 +1795,16 @@ namespace nana
if (arg.button != ::nana::mouse::left_button)
return;
bool is_vert = _m_is_vert(dir_);
API::capture_window(this->handle(), true);
auto basepos = API::cursor_position();
base_pos_.x = (_m_is_vert(dir_) ? basepos.y : basepos.x);
base_pos_.x = (is_vert ? basepos.y : basepos.x);
basepos = this->pos();
base_pos_.y = (_m_is_vert(dir_) ? basepos.y : basepos.x);
base_pos_.y = (is_vert ? basepos.y : basepos.x);
base_px_ = (_m_is_vert(dir_) ? pane_dv_->field_area.height : pane_dv_->field_area.width);
base_px_ = (is_vert ? pane_dv_->field_area.height : pane_dv_->field_area.width);
});
this->events().mouse_up([this]
@ -1855,6 +1855,8 @@ namespace nana
else
px -= static_cast<unsigned>(delta);
break;
default:
break;
}
auto dock_px = (_m_is_vert(dir_) ? dock_dv_->field_area.height : dock_dv_->field_area.width);
@ -1880,21 +1882,17 @@ namespace nana
};
public:
div_dock(std::string && name, implement* impl)
: division(kind::dock, std::move(name)), impl_(impl)
{}
division* front() const
{
auto i = children.cbegin();
for (auto i = children.cbegin(); i != children.cend(); ++i)
{
if (i->get()->display)
return i->get();
}
return nullptr;
}
@ -1912,8 +1910,6 @@ namespace nana
if (!child->display)
continue;
auto child_dv = dynamic_cast<div_dockpane*>(child.get());
const auto is_vert = _m_is_vert(child->dir);
if (is_first)
{
@ -1930,16 +1926,13 @@ namespace nana
prev_attr = is_vert;
}
if (0 == vert_count)
++vert_count;
vert_count = 1;
if (0 == horz_count)
++horz_count;
horz_count = 1;
//room indicates the size without splitters
::nana::size room(area.width - splitter_px * (horz_count - 1), area.height - splitter_px * (vert_count - 1));
//double auto_horz_w = double(area.width - splitter_px * (horz_count - 1))/ horz_count;
//double auto_vert_w = double(area.height - splitter_px * (vert_count - 1)) / vert_count;
double left = area.x;
double right = area.right();
double top = area.y;
@ -2049,7 +2042,6 @@ namespace nana
if (split_range_begin > -0.5)
split->range(static_cast<int>(split_range_begin), static_cast<int>(split_range_end));
if (is_vert)
{
room.height -= child_r.height;

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/detail/bedrock.hpp>
#include <nana/gui/detail/basic_window.hpp>
#include <nana/gui/detail/window_manager.hpp>
namespace nana
{
@ -20,7 +21,7 @@ namespace nana
{
auto & brock = detail::bedrock::instance();
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);
else
handle_ = nullptr;
@ -40,7 +41,7 @@ namespace nana
{
auto & brock = detail::bedrock::instance();
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);
}
handle_ = rhs.handle_;
@ -55,7 +56,7 @@ namespace nana
{
auto & brock = detail::bedrock::instance();
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);
}
}

View File

@ -297,7 +297,7 @@ namespace nana
return *this;
}
iresolver::iresolver(const std::vector<cell>& cl)
: cells_(cl)
{}
@ -317,7 +317,7 @@ namespace nana
//end class iresolver/oresolver
/// Essence of the columns Header
class es_header
class es_header
{
public:
@ -339,10 +339,10 @@ namespace nana
export_options::columns_indexs all_headers(bool only_visibles) const
{
export_options::columns_indexs idx;
export_options::columns_indexs idx;
for(const auto &header : cont())
{
if(header.visible || !only_visibles)
if(header.visible || !only_visibles)
idx.push_back(header.index);
}
return idx;
@ -350,13 +350,13 @@ namespace nana
nana::string to_string(const export_options& exp_opt) const
{
nana::string head_str;
nana::string head_str;
bool first{true};
for( size_type idx{}; idx<exp_opt.columns_order.size(); ++idx)
{
if(first)
first=false;
else
else
head_str += exp_opt.sep;
head_str += column_ref(exp_opt.columns_order[idx]).text;
@ -668,7 +668,7 @@ namespace nana
category_t(nana::string str)
:text(std::move(str))
{}
bool selected() const
{
for (auto & m : items)
@ -723,7 +723,7 @@ namespace nana
return nullptr;
}
nana::string to_string(const export_options& exp_opt) const;
/// each sort() ivalidate any existing reference from display position to absolute item, that is after sort() display offset point to different items
void sort()
{
@ -872,7 +872,7 @@ namespace nana
list_.back().key_ptr = ptr;
return &list_.back();
}
/// add a new cat created at "pos" and return a ref to it
/// add a new cat created at "pos" and return a ref to it
category_t* create_cat(std::size_t pos, nana::string&& text)
{
return &(*list_.emplace(this->get(pos), std::move(text)));
@ -917,7 +917,7 @@ namespace nana
for (size_type i=0; i<catobj.sorted.size();++i)
if (pos==catobj.sorted[i])
return i;
return npos ;
}
@ -966,7 +966,7 @@ namespace nana
index_pair advance(index_pair from, size_type offset) // <------------- index
{
index_pair dpos{npos, npos};
if(from.cat >= size_categ() || (from.item != npos && from.item >= size_item(from.cat)))
if(from.cat >= size_categ() || (from.item != npos && from.item >= size_item(from.cat)))
return dpos;
dpos = from;
@ -1293,7 +1293,7 @@ namespace nana
for(auto & cat : list_)
{
id.item = 0;
for(auto & m : cat.items)
for(auto & m : cat.items)
{
if(m.flags.selected)
vec.push_back(id); // absolute positions, no relative to display
@ -1302,14 +1302,14 @@ namespace nana
++id.cat;
}
}
index_pair find_first_selected()
{
index_pair id;
for(auto & cat : list_)
{
id.item = 0;
for(auto & m : cat.items)
for(auto & m : cat.items)
{
if(m.flags.selected)
return id; // absolute positions, no relative to display
@ -1659,7 +1659,7 @@ namespace nana
///Translate relative position (position in display) into absolute position (original data order)
size_type absolute(const index_pair& display_pos) const
{
if(sorted_index_ == npos || display_pos.item == npos)
if(sorted_index_ == npos || display_pos.item == npos)
return display_pos.item ;
auto & catobj = *get(display_pos.cat);
@ -1674,11 +1674,11 @@ namespace nana
auto item_pos = absolute(display_pos);
return {item_pos != npos ? display_pos.cat : npos, item_pos};
}
///Translate absolute position (original data order) into relative position (position in display)
size_type relative(const index_pair& pos) const
{
if (sorted_index_ == npos)
if (sorted_index_ == npos)
return pos.item ;
auto& catobj = *get(pos.cat);
@ -1686,7 +1686,7 @@ namespace nana
for (size_type i=0; i<catobj.sorted.size();++i)
if (pos.item == catobj.sorted[i])
return i;
if (catobj.items.empty() && (pos == index_pair{ 0, 0 }))
return 0;
@ -1698,7 +1698,7 @@ namespace nana
auto item_pos = relative(pos);
return {(item_pos != npos ? pos.cat : npos), item_pos};
}
/// all arg are relative to display order, or all are absolute, but not mixed
bool forward(index_pair from, size_type offs, index_pair& item) const
{
@ -1781,7 +1781,7 @@ namespace nana
}
return false;
}
/// categories iterator
container::iterator get(size_type pos)
{
@ -1792,7 +1792,7 @@ namespace nana
std::advance(i, pos);
return i;
}
container::const_iterator get(size_type pos) const
{
if (pos >= list_.size())
@ -1841,12 +1841,6 @@ namespace nana
::nana::listbox::export_options def_exp_options;
::nana::listbox::export_options& def_export_options()
{
return def_exp_options;
}
es_header header;
es_lister lister; // we have at least one emty cat. the #0
@ -1925,7 +1919,7 @@ namespace nana
scroll_y_dpl_refresh() ;
}
/// directly set a tested relative display pos
/// directly set a tested relative display pos
void set_scroll_y_dpl(const index_pair& pos_dpl)
{
scroll.offset_y_dpl = pos_dpl;
@ -1950,7 +1944,7 @@ namespace nana
{
if( dpl_pos.cat < scroll.offset_y_dpl.cat // in prevoious cat ---------------- up ----> we need to move
|| ((dpl_pos.cat == scroll.offset_y_dpl.cat) && ( scroll.offset_y_dpl.item != npos) // is our cat, where we are an item
&& (dpl_pos.item == npos || dpl_pos.item < scroll.offset_y_dpl.item)))
&& (dpl_pos.item == npos || dpl_pos.item < scroll.offset_y_dpl.item)))
// problem!!!!!!
{
if(lister.expand(dpl_pos.cat) == false)
@ -1960,7 +1954,7 @@ namespace nana
else
lister.expand(dpl_pos.cat, true);
}
set_scroll_y_dpl(dpl_pos); // <------------------------- set scroll.offset_y_dpl & scroll.offset_y_abs
set_scroll_y_dpl(dpl_pos); // <------------------------- set scroll.offset_y_dpl & scroll.offset_y_abs
}
else
{
@ -1969,7 +1963,7 @@ namespace nana
if(numbers > off) return;
index_pair n_off = lister.advance(scroll.offset_y_dpl, (off - numbers) + 1);
if(n_off.cat != npos) // <------------------------- set scroll.offset_y_dpl & scroll.offset_y_abs
if(n_off.cat != npos) // <------------------------- set scroll.offset_y_dpl & scroll.offset_y_abs
set_scroll_y_dpl(n_off);
}
@ -1978,7 +1972,7 @@ namespace nana
void trace_item_abs( index_pair abs_pos )
{
if(abs_pos.item == npos && abs_pos.cat == scroll.offset_y_abs.cat
if(abs_pos.item == npos && abs_pos.cat == scroll.offset_y_abs.cat
&& scroll.offset_y_abs.item == npos ) // if item==off y and is a cat
return;
@ -2020,7 +2014,7 @@ namespace nana
scroll.v.value(off);
}
}
void adjust_scroll_life() // at end call adjust_scroll_value();
{
internal_scope_guard lock;
@ -2252,7 +2246,7 @@ namespace nana
if (target == scroll.offset_y_dpl)
return false;
set_scroll_y_dpl ( target );
return true;
}
@ -2465,10 +2459,10 @@ namespace nana
if (good(next_selected_dpl))
{
if (unselect_previous && !single_selection_ )
if (unselect_previous && !single_selection_ )
select_for_all(false);
/// is ignored if no change (maybe set last_selected anyway??), but if change emit event, deselect others if need ans set/unset last_selected
/// is ignored if no change (maybe set last_selected anyway??), but if change emit event, deselect others if need ans set/unset last_selected
item_proxy::from_display(ess_, next_selected_dpl).select(true);
if (trace_selected)
@ -2482,7 +2476,7 @@ namespace nana
nana::string es_lister::to_string(const export_options& exp_opt) const
{
nana::string list_str;
nana::string list_str;
bool first{true};
for(auto & cat: cat_container())
{
@ -2509,8 +2503,7 @@ namespace nana
if (it.selected() != sel)
it.select(sel);
}
last_selected_abs = last_selected_dpl = index_pair {cat, npos};
last_selected_abs = last_selected_dpl = index_pair{cat, npos};
}
class drawer_header_impl
@ -2586,9 +2579,9 @@ namespace nana
const auto& item = essence_->header.column(item_spliter_);
//Resize the item specified by item_spliter_.
auto new_w = orig_item_width_ - (ref_xpos_ - pos.x);
if(static_cast<int>(item.pixels) != new_w)
if(item.pixels != new_w)
{
essence_->header.item_width(item_spliter_, (new_w < static_cast<int>(essence_->suspension_width + 20) ? essence_->suspension_width + 20 : new_w));
essence_->header.item_width(item_spliter_, (new_w < (essence_->suspension_width + 20) ? essence_->suspension_width + 20 : new_w));
new_w = essence_->header.pixels();
if(new_w < (rect.width + essence_->scroll.offset_x))
essence_->scroll.offset_x = (new_w > rect.width ? new_w - rect.width : 0);
@ -2749,8 +2742,8 @@ namespace nana
unsigned header_w = essence_->header.pixels();
essence_->graph->set_color(bgcolor);
if(header_w - essence_->scroll.offset_x < rect.width)
essence_->graph->rectangle(rectangle{ point(rect.x + static_cast<int>(header_w)-essence_->scroll.offset_x, rect.y),
size(static_cast<int>(rect.width) + essence_->scroll.offset_x - static_cast<int>(header_w), rect.height) },
essence_->graph->rectangle(rectangle{ point(rect.x + static_cast<int>(header_w)-essence_->scroll.offset_x, rect.y),
size(static_cast<int>(rect.width) + essence_->scroll.offset_x - static_cast<int>(header_w), rect.height) },
true);
es_lister & lister = essence_->lister;
@ -2801,7 +2794,7 @@ namespace nana
_m_draw_item(*i_categ, item_index, x, y, txtoff, header_w, rect, subitems, bgcolor,fgcolor, state);
y += essence_->item_size;
}
++i_categ;
++idx.cat;
}
@ -2857,7 +2850,7 @@ namespace nana
facade<element::arrow> arrow("double");
arrow.direction(categ.expand ? ::nana::direction::north : ::nana::direction::south);
arrow.draw( *graph, {}, txt_color,
arrow.draw( *graph, {}, txt_color,
{ x + 5, y + static_cast<int>(essence_->item_size - 16) / 2, 16, 16 },
element_state::normal);
@ -2890,7 +2883,7 @@ namespace nana
{
auto & item = cat.items[item_pos.item];
if (item.flags.selected) // fetch the "def" colors
if (item.flags.selected) // fetch the "def" colors
bgcolor = essence_->scheme_ptr->item_selected;
else if (!item.bgcolor.invisible())
bgcolor = item.bgcolor;
@ -3043,7 +3036,7 @@ namespace nana
//The text is painted over the next subitem // here beging the ...
int xpos = item_xpos + static_cast<int>(header.pixels) - static_cast<int>(essence_->suspension_width);
graph->set_color(it_bgcolor); // litter rect with the item bg end ...
graph->set_color(it_bgcolor); // litter rect with the item bg end ...
graph->rectangle(rectangle{ xpos, y + 2, essence_->suspension_width, essence_->item_size - 4 }, true);
graph->string(point{ xpos, y + 2 }, STR("..."));
@ -3315,7 +3308,7 @@ namespace nana
if (arg.shift)
lister.select_display_range(lister.last_selected_abs , item_pos, sel);
else if (arg.ctrl)
sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected();
sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected();
else
lister.select_for_all(false); //cancel all selections
}
@ -3325,7 +3318,7 @@ namespace nana
if(item_ptr)
{
item_ptr->flags.selected = sel;
index_pair last_selected(item_pos.cat, lister.absolute(item_pos));
index_pair last_selected(item_pos.cat, lister.absolute(item_pos));
arg_listbox arg{item_proxy{essence_, last_selected}, sel};
lister.wd_ptr()->events().selected.emit(arg);
@ -3334,7 +3327,7 @@ namespace nana
{
lister.cancel_others_if_single_enabled(true, last_selected);
essence_->lister.last_selected_abs = last_selected;
}
else if (essence_->lister.last_selected_abs == last_selected)
essence_->lister.last_selected_abs.set_both(npos);
@ -3424,7 +3417,7 @@ namespace nana
void trigger::dbl_click(graph_reference graph, const arg_mouse&)
{
if (essence_->pointer_where.first == essence_t::parts::header)
if (cursor::size_we == essence_->lister.wd_ptr()->cursor())
if (cursor::size_we == essence_->lister.wd_ptr()->cursor())
{
if (essence(). auto_width(drawer_header_->item_spliter() )) // ? in order
essence().update();
@ -3471,7 +3464,7 @@ namespace nana
bool up = false;
if (essence_->lister.size_categ()==1 && essence_->lister.size_item(0)==0)
return ;
return ;
switch(arg.key)
{
@ -3494,7 +3487,7 @@ namespace nana
case keyboard::os_pagedown:
{
auto& scrl = essence_->scroll.v;
if (! scrl.make_page_scroll(!up))
if (! scrl.make_page_scroll(!up))
return;
essence_->lister.select_for_all(false);
@ -3504,7 +3497,7 @@ namespace nana
if (idx.is_item())
item_proxy::from_display(essence_, idx).select(true);
else
else
if(!essence_->lister.single_selection())
essence_->lister.categ_selected(idx.cat, true);
@ -3519,7 +3512,7 @@ namespace nana
index_pair frst{essence_->lister.first()};
if (frst.is_item())
item_proxy::from_display(essence_, frst).select(true);
else
else
if(!essence_->lister.single_selection())
essence_->lister.categ_selected(frst.cat, true);
@ -3545,13 +3538,13 @@ namespace nana
{
case keyboard::copy:
{
export_options exp_opt {essence_->def_export_options()};
export_options exp_opt {essence_->def_exp_options};
exp_opt.columns_order = essence_->header.all_headers(true);
exp_opt.only_selected_items = true;
::nana::system::dataexch().set(essence_->to_string(exp_opt));
return;
}
case keyboard::select_all :
case keyboard::select_all :
essence_->lister.select_for_all(true);
refresh(graph);
API::lazy_refresh();
@ -3581,7 +3574,7 @@ namespace nana
}
/// the main porpose of this it to make obvious that item_proxy operate with absolute positions, and dont get moved during sort()
item_proxy item_proxy::from_display(essence_t *ess, const index_pair &relative)
item_proxy item_proxy::from_display(essence_t *ess, const index_pair &relative)
{
return item_proxy{ess, ess->lister.absolute_pair(relative)};
}
@ -3619,7 +3612,7 @@ namespace nana
return cat_->items.at(pos_.item).flags.checked;
}
/// is ignored if no change (maybe set last_selected anyway??), but if change emit event, deselect others if need ans set/unset last_selected
/// is ignored if no change (maybe set last_selected anyway??), but if change emit event, deselect others if need ans set/unset last_selected
item_proxy & item_proxy::select(bool s)
{
auto & m = cat_->items.at(pos_.item); // a ref to the real item // what is pos is a cat?
@ -3638,7 +3631,7 @@ namespace nana
ess_->lister.last_selected_abs.set_both(npos);
ess_->update();
ess_->update();
return *this;
}
@ -3719,7 +3712,7 @@ namespace nana
bool item_proxy::operator==(const char * s) const
{
return (ess_->lister.get_cells(cat_, pos_.item).at(0).text == nana::string(nana::charset(s)));
}
bool item_proxy::operator==(const wchar_t * s) const
@ -4257,8 +4250,8 @@ namespace nana
// from current display position
// move to the cat self if not in first cat
// move to first item ?? if in first cat
ess.scroll_y_abs(ess.scroll_y_abs());
ess.scroll_y_abs(ess.scroll_y_abs());
ess.update();
}
@ -4271,8 +4264,8 @@ namespace nana
// from current display position
// move to the cat self if not in first cat
// move to first item ?? if in first cat
ess.scroll_y_abs(ess.scroll_y_abs());
ess.scroll_y_abs(ess.scroll_y_abs());
ess.update();
}
@ -4300,7 +4293,7 @@ namespace nana
{
auto & ess = _m_ess();
ess.lister.erase();
ess.scroll_y_abs(index_pair());
ess.scroll_y_abs(index_pair());
ess.update();
}
@ -4432,7 +4425,7 @@ namespace nana
listbox::export_options& listbox::def_export_options()
{
return _m_ess().def_export_options();
return _m_ess().def_exp_options;
}
drawerbase::listbox::essence_t & listbox::_m_ess() const

View File

@ -1222,12 +1222,11 @@ namespace nana{ namespace widgets
auto ki = kwptr->schemes.find(ds.scheme);
if (ki != kwptr->schemes.end() && ki->second)
{
schemes_.emplace(ds.scheme, ki->second);
entities.emplace_back();
auto & last = entities.back();
last.begin = text.data() + pos;
last.end = last.begin + ds.text.size();
last.scheme = ki->second.get();
entities.emplace_back();
auto & last = entities.back();
last.begin = text.data() + pos;
last.end = last.begin + ds.text.size();
last.scheme = ki->second.get();
}
}
}
@ -1259,7 +1258,6 @@ namespace nana{ namespace widgets
}
private:
std::vector<entity> entities_;
std::map<std::string, std::shared_ptr<keyword_scheme>> schemes_;
};
//class text_editor

View File

@ -1,6 +1,6 @@
/*
* 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.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -12,9 +12,17 @@
*/
#include <nana/gui/wvl.hpp>
#include <nana/gui/detail/bedrock.hpp>
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()
{
detail::bedrock::instance().pump_event(nullptr, false);

View File

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