diff --git a/README.md b/README.md
index a9201c8a..ba113804 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ NIM Duilib 包含了一整套桌面软件的开发部件,与其说这是一个
git clone https://github.com/netease-im/NIM_Duilib_Framework
```
-进入 `NIM_Duilib_Framework/samples` 目录,使用 Visual Studio 2013 Update 5 以上版本 IDE 打开 `samples.sln`,按下 F7 即可编译所有示例程序
+进入 `NIM_Duilib_Framework/examples` 目录,使用 Visual Studio 2013 Update 5 以上版本 IDE 打开 `examples.sln`,按下 F7 即可编译所有示例程序
## 文档
@@ -38,19 +38,17 @@ git clone https://github.com/netease-im/NIM_Duilib_Framework
## 目录
+├─`base` 基础类库
├─`bin` 各个示例程序输出目录,包含预设的皮肤和语言文件以及 CEF 依赖
├─`docs` duilib 接口的说明文档
+├─`duilib` duilib 核心代码,依赖 base 但不依赖 shared
├─`libs` 静态库编译后的输出目录,包含预设的一些 CEF 组件静态库
-├─`samples` 各类示例程序
+├─`examples` 各类示例程序源代码
├─`third_party` 第三方库,目前仅有 cef_control 有依赖
-├─`toolkits`
-│ ├─`base` 基础类库
-│ ├─`duilib` duilib 核心代码,依赖 base 但不依赖 shared
-│ ├─`shared` 包含一些工具的封装,如命令行解析、日志、路径处理等
-│ ├─`ui_components` 基于 duilib 封装的常用组件库如 `msgbox`、`toast`、`cef_control` 等
+├─`ui_components` 基于 duilib 封装的常用组件库如 `msgbox`、`toast`、`cef_control` 等
## 交流
- - 遇到问题:欢迎查看我们整理过的[中文文档](docs/SUMMARY.md)参考[示例程序](samples/README.md)来帮助你解决疑惑
+ - 遇到问题:欢迎查看我们整理过的[中文文档](docs/SUMMARY.md)参考[示例程序](examples/README.md)来帮助你解决疑惑
- 提交缺陷:在确保使用最新版本依然存在问题时请尽量以简洁的语言描述清楚复现该问题的步骤并提交 issue
- 功能建议:如果你有什么好的想法或者提案,欢迎提交 issue 与我们交流
diff --git a/README_en-US.md b/README_en-US.md
index 66bd5587..9169f4f2 100644
--- a/README_en-US.md
+++ b/README_en-US.md
@@ -29,7 +29,7 @@ Clone the repo into your disk.
git clone https://github.com/netease-im/NIM_Duilib_Framework
```
-Enter the `NIM_Duilib_Framework/samples` directory,Open `samples.sln` with Visual Studio 2013 Update 5 or higher ,press `F7` to compile all projects.
+Enter the `NIM_Duilib_Framework/examples` directory,Open `examples.sln` with Visual Studio 2013 Update 5 or higher ,press `F7` to compile all projects.
## Documentation
@@ -38,19 +38,17 @@ Enter the `NIM_Duilib_Framework/samples` directory,Open `samples.sln` with Vis
## Structure
-├─`bin` Samples output directories,include skin and language files and CEF dependencies.
+├─`base` Base libraries.
+├─`bin` Examples output directories,include skin and language files and CEF dependencies.
├─`docs` Documentation of Duilib.
+├─`duilib` Duilib core, depend on base project.
├─`libs` Static library output directories, include CEF static library.
-├─`samples` Samples of Duilib.
+├─`examples` Examples of Duilib.
├─`third_party` Third party for CEF.
-├─`toolkits`
-│ ├─`base` Base libraries.
-│ ├─`duilib` Duilib core, depend on base project.
-│ ├─`shared` Utils, such as logs/string/path utils.
-│ ├─`ui_components` UI components based on Duilib, such as `msgbox`,`toast`,`cef_control`
+├─`ui_components` UI components based on Duilib, such as `msgbox`,`toast`,`cef_control`
## Communication
- - Question: Read the [Documentation](docs/SUMMARY.md) and [Samples code](samples/README.md) to help you.
+ - Question: Read the [Documentation](docs/SUMMARY.md) and [Examples code](examples/README.md) to help you.
- Report: File a bug in GitHub issues.
- Suggestion: Request a new feature in Github issues.
diff --git a/tool_kits/base/base.h b/base/base.h
similarity index 100%
rename from tool_kits/base/base.h
rename to base/base.h
diff --git a/tool_kits/base/base.vcxproj b/base/base.vcxproj
similarity index 96%
rename from tool_kits/base/base.vcxproj
rename to base/base.vcxproj
index 8d25f940..54673877 100644
--- a/tool_kits/base/base.vcxproj
+++ b/base/base.vcxproj
@@ -175,28 +175,28 @@
- ..\..\libs\
+ $(ProjectDir)..\libs\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
$(ProjectName)_d
- ..\..\libs\x64\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\libs\x64\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
- ..\..\libs\
+ $(ProjectDir)..\libs\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
- ..\..\libs\x64\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ $(ProjectDir)..\libs\x64\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
diff --git a/tool_kits/base/base.vcxproj.filters b/base/base.vcxproj.filters
similarity index 100%
rename from tool_kits/base/base.vcxproj.filters
rename to base/base.vcxproj.filters
diff --git a/tool_kits/base/base_config.h b/base/base_config.h
similarity index 100%
rename from tool_kits/base/base_config.h
rename to base/base_config.h
diff --git a/tool_kits/base/base_export.h b/base/base_export.h
similarity index 100%
rename from tool_kits/base/base_export.h
rename to base/base_export.h
diff --git a/tool_kits/base/base_types.h b/base/base_types.h
similarity index 100%
rename from tool_kits/base/base_types.h
rename to base/base_types.h
diff --git a/tool_kits/base/callback/callback.h b/base/callback/callback.h
similarity index 100%
rename from tool_kits/base/callback/callback.h
rename to base/callback/callback.h
diff --git a/tool_kits/base/compiler_specific.h b/base/compiler_specific.h
similarity index 100%
rename from tool_kits/base/compiler_specific.h
rename to base/compiler_specific.h
diff --git a/tool_kits/base/encrypt/des.cpp b/base/encrypt/des.cpp
similarity index 100%
rename from tool_kits/base/encrypt/des.cpp
rename to base/encrypt/des.cpp
diff --git a/tool_kits/base/encrypt/des.h b/base/encrypt/des.h
similarity index 100%
rename from tool_kits/base/encrypt/des.h
rename to base/encrypt/des.h
diff --git a/tool_kits/base/encrypt/encrypt.h b/base/encrypt/encrypt.h
similarity index 100%
rename from tool_kits/base/encrypt/encrypt.h
rename to base/encrypt/encrypt.h
diff --git a/tool_kits/base/encrypt/encrypt_impl.h b/base/encrypt/encrypt_impl.h
similarity index 100%
rename from tool_kits/base/encrypt/encrypt_impl.h
rename to base/encrypt/encrypt_impl.h
diff --git a/tool_kits/base/error.h b/base/error.h
similarity index 100%
rename from tool_kits/base/error.h
rename to base/error.h
diff --git a/tool_kits/base/file/file_path.h b/base/file/file_path.h
similarity index 100%
rename from tool_kits/base/file/file_path.h
rename to base/file/file_path.h
diff --git a/tool_kits/base/file/file_util.cpp b/base/file/file_util.cpp
similarity index 100%
rename from tool_kits/base/file/file_util.cpp
rename to base/file/file_util.cpp
diff --git a/tool_kits/base/file/file_util.h b/base/file/file_util.h
similarity index 100%
rename from tool_kits/base/file/file_util.h
rename to base/file/file_util.h
diff --git a/tool_kits/base/file/file_util_posix.cpp b/base/file/file_util_posix.cpp
similarity index 100%
rename from tool_kits/base/file/file_util_posix.cpp
rename to base/file/file_util_posix.cpp
diff --git a/tool_kits/base/file/file_util_win.cpp b/base/file/file_util_win.cpp
similarity index 100%
rename from tool_kits/base/file/file_util_win.cpp
rename to base/file/file_util_win.cpp
diff --git a/tool_kits/base/framework/default_message_pump.cpp b/base/framework/default_message_pump.cpp
similarity index 100%
rename from tool_kits/base/framework/default_message_pump.cpp
rename to base/framework/default_message_pump.cpp
diff --git a/tool_kits/base/framework/default_message_pump.h b/base/framework/default_message_pump.h
similarity index 100%
rename from tool_kits/base/framework/default_message_pump.h
rename to base/framework/default_message_pump.h
diff --git a/tool_kits/base/framework/message_loop.cpp b/base/framework/message_loop.cpp
similarity index 100%
rename from tool_kits/base/framework/message_loop.cpp
rename to base/framework/message_loop.cpp
diff --git a/tool_kits/base/framework/message_loop.h b/base/framework/message_loop.h
similarity index 100%
rename from tool_kits/base/framework/message_loop.h
rename to base/framework/message_loop.h
diff --git a/tool_kits/base/framework/message_loop_proxy.cpp b/base/framework/message_loop_proxy.cpp
similarity index 100%
rename from tool_kits/base/framework/message_loop_proxy.cpp
rename to base/framework/message_loop_proxy.cpp
diff --git a/tool_kits/base/framework/message_loop_proxy.h b/base/framework/message_loop_proxy.h
similarity index 100%
rename from tool_kits/base/framework/message_loop_proxy.h
rename to base/framework/message_loop_proxy.h
diff --git a/tool_kits/base/framework/message_pump.cpp b/base/framework/message_pump.cpp
similarity index 100%
rename from tool_kits/base/framework/message_pump.cpp
rename to base/framework/message_pump.cpp
diff --git a/tool_kits/base/framework/message_pump.h b/base/framework/message_pump.h
similarity index 100%
rename from tool_kits/base/framework/message_pump.h
rename to base/framework/message_pump.h
diff --git a/tool_kits/base/framework/observer_list.h b/base/framework/observer_list.h
similarity index 100%
rename from tool_kits/base/framework/observer_list.h
rename to base/framework/observer_list.h
diff --git a/tool_kits/base/framework/readme.txt b/base/framework/readme.txt
similarity index 100%
rename from tool_kits/base/framework/readme.txt
rename to base/framework/readme.txt
diff --git a/tool_kits/base/framework/task.h b/base/framework/task.h
similarity index 100%
rename from tool_kits/base/framework/task.h
rename to base/framework/task.h
diff --git a/tool_kits/base/framework/win_io_message_pump.cpp b/base/framework/win_io_message_pump.cpp
similarity index 100%
rename from tool_kits/base/framework/win_io_message_pump.cpp
rename to base/framework/win_io_message_pump.cpp
diff --git a/tool_kits/base/framework/win_io_message_pump.h b/base/framework/win_io_message_pump.h
similarity index 100%
rename from tool_kits/base/framework/win_io_message_pump.h
rename to base/framework/win_io_message_pump.h
diff --git a/tool_kits/base/framework/win_message_pump.cpp b/base/framework/win_message_pump.cpp
similarity index 100%
rename from tool_kits/base/framework/win_message_pump.cpp
rename to base/framework/win_message_pump.cpp
diff --git a/tool_kits/base/framework/win_message_pump.h b/base/framework/win_message_pump.h
similarity index 100%
rename from tool_kits/base/framework/win_message_pump.h
rename to base/framework/win_message_pump.h
diff --git a/tool_kits/base/framework/win_ui_message_pump.cpp b/base/framework/win_ui_message_pump.cpp
similarity index 100%
rename from tool_kits/base/framework/win_ui_message_pump.cpp
rename to base/framework/win_ui_message_pump.cpp
diff --git a/tool_kits/base/framework/win_ui_message_pump.h b/base/framework/win_ui_message_pump.h
similarity index 100%
rename from tool_kits/base/framework/win_ui_message_pump.h
rename to base/framework/win_ui_message_pump.h
diff --git a/tool_kits/base/hardware/cpu.cpp b/base/hardware/cpu.cpp
similarity index 100%
rename from tool_kits/base/hardware/cpu.cpp
rename to base/hardware/cpu.cpp
diff --git a/tool_kits/base/hardware/cpu.h b/base/hardware/cpu.h
similarity index 100%
rename from tool_kits/base/hardware/cpu.h
rename to base/hardware/cpu.h
diff --git a/tool_kits/base/macros.h b/base/macros.h
similarity index 100%
rename from tool_kits/base/macros.h
rename to base/macros.h
diff --git a/tool_kits/base/memory/blockbuffer.h b/base/memory/blockbuffer.h
similarity index 100%
rename from tool_kits/base/memory/blockbuffer.h
rename to base/memory/blockbuffer.h
diff --git a/tool_kits/base/memory/deleter.h b/base/memory/deleter.h
similarity index 100%
rename from tool_kits/base/memory/deleter.h
rename to base/memory/deleter.h
diff --git a/tool_kits/base/memory/lazy_instance.h b/base/memory/lazy_instance.h
similarity index 100%
rename from tool_kits/base/memory/lazy_instance.h
rename to base/memory/lazy_instance.h
diff --git a/tool_kits/base/memory/singleton.h b/base/memory/singleton.h
similarity index 100%
rename from tool_kits/base/memory/singleton.h
rename to base/memory/singleton.h
diff --git a/tool_kits/base/network/network_util.cpp b/base/network/network_util.cpp
similarity index 100%
rename from tool_kits/base/network/network_util.cpp
rename to base/network/network_util.cpp
diff --git a/tool_kits/base/network/network_util.h b/base/network/network_util.h
similarity index 100%
rename from tool_kits/base/network/network_util.h
rename to base/network/network_util.h
diff --git a/tool_kits/base/network/nio_base.h b/base/network/nio_base.h
similarity index 100%
rename from tool_kits/base/network/nio_base.h
rename to base/network/nio_base.h
diff --git a/tool_kits/base/port.h b/base/port.h
similarity index 100%
rename from tool_kits/base/port.h
rename to base/port.h
diff --git a/tool_kits/base/synchronization/lock.h b/base/synchronization/lock.h
similarity index 100%
rename from tool_kits/base/synchronization/lock.h
rename to base/synchronization/lock.h
diff --git a/tool_kits/base/synchronization/lock_posix.cpp b/base/synchronization/lock_posix.cpp
similarity index 100%
rename from tool_kits/base/synchronization/lock_posix.cpp
rename to base/synchronization/lock_posix.cpp
diff --git a/tool_kits/base/synchronization/lock_win.cpp b/base/synchronization/lock_win.cpp
similarity index 100%
rename from tool_kits/base/synchronization/lock_win.cpp
rename to base/synchronization/lock_win.cpp
diff --git a/tool_kits/base/synchronization/semaphore.h b/base/synchronization/semaphore.h
similarity index 100%
rename from tool_kits/base/synchronization/semaphore.h
rename to base/synchronization/semaphore.h
diff --git a/tool_kits/base/synchronization/semaphore_posix.cpp b/base/synchronization/semaphore_posix.cpp
similarity index 100%
rename from tool_kits/base/synchronization/semaphore_posix.cpp
rename to base/synchronization/semaphore_posix.cpp
diff --git a/tool_kits/base/synchronization/semaphore_win.cpp b/base/synchronization/semaphore_win.cpp
similarity index 100%
rename from tool_kits/base/synchronization/semaphore_win.cpp
rename to base/synchronization/semaphore_win.cpp
diff --git a/tool_kits/base/synchronization/waitable_event.h b/base/synchronization/waitable_event.h
similarity index 100%
rename from tool_kits/base/synchronization/waitable_event.h
rename to base/synchronization/waitable_event.h
diff --git a/tool_kits/base/synchronization/waitable_event_posix.cpp b/base/synchronization/waitable_event_posix.cpp
similarity index 100%
rename from tool_kits/base/synchronization/waitable_event_posix.cpp
rename to base/synchronization/waitable_event_posix.cpp
diff --git a/tool_kits/base/synchronization/waitable_event_win.cpp b/base/synchronization/waitable_event_win.cpp
similarity index 100%
rename from tool_kits/base/synchronization/waitable_event_win.cpp
rename to base/synchronization/waitable_event_win.cpp
diff --git a/tool_kits/base/third_party/chrome/atomicops.h b/base/third_party/chrome/atomicops.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops.h
rename to base/third_party/chrome/atomicops.h
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_arm_gcc.h b/base/third_party/chrome/atomicops_internals_arm_gcc.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_arm_gcc.h
rename to base/third_party/chrome/atomicops_internals_arm_gcc.h
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_atomicword_compat.h b/base/third_party/chrome/atomicops_internals_atomicword_compat.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_atomicword_compat.h
rename to base/third_party/chrome/atomicops_internals_atomicword_compat.h
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_x86_gcc.cc b/base/third_party/chrome/atomicops_internals_x86_gcc.cc
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_x86_gcc.cc
rename to base/third_party/chrome/atomicops_internals_x86_gcc.cc
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_x86_gcc.h b/base/third_party/chrome/atomicops_internals_x86_gcc.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_x86_gcc.h
rename to base/third_party/chrome/atomicops_internals_x86_gcc.h
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_x86_macosx.h b/base/third_party/chrome/atomicops_internals_x86_macosx.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_x86_macosx.h
rename to base/third_party/chrome/atomicops_internals_x86_macosx.h
diff --git a/tool_kits/base/third_party/chrome/atomicops_internals_x86_msvc.h b/base/third_party/chrome/atomicops_internals_x86_msvc.h
similarity index 100%
rename from tool_kits/base/third_party/chrome/atomicops_internals_x86_msvc.h
rename to base/third_party/chrome/atomicops_internals_x86_msvc.h
diff --git a/tool_kits/base/third_party/convert_utf/ConvertUTF.c b/base/third_party/convert_utf/ConvertUTF.c
similarity index 100%
rename from tool_kits/base/third_party/convert_utf/ConvertUTF.c
rename to base/third_party/convert_utf/ConvertUTF.c
diff --git a/tool_kits/base/third_party/convert_utf/ConvertUTF.h b/base/third_party/convert_utf/ConvertUTF.h
similarity index 100%
rename from tool_kits/base/third_party/convert_utf/ConvertUTF.h
rename to base/third_party/convert_utf/ConvertUTF.h
diff --git a/tool_kits/base/third_party/convert_utf/readme.txt b/base/third_party/convert_utf/readme.txt
similarity index 100%
rename from tool_kits/base/third_party/convert_utf/readme.txt
rename to base/third_party/convert_utf/readme.txt
diff --git a/tool_kits/base/third_party/modp_b64/Readme.txt b/base/third_party/modp_b64/Readme.txt
similarity index 100%
rename from tool_kits/base/third_party/modp_b64/Readme.txt
rename to base/third_party/modp_b64/Readme.txt
diff --git a/tool_kits/base/third_party/modp_b64/modp_b64.cc b/base/third_party/modp_b64/modp_b64.cc
similarity index 100%
rename from tool_kits/base/third_party/modp_b64/modp_b64.cc
rename to base/third_party/modp_b64/modp_b64.cc
diff --git a/tool_kits/base/third_party/modp_b64/modp_b64.h b/base/third_party/modp_b64/modp_b64.h
similarity index 100%
rename from tool_kits/base/third_party/modp_b64/modp_b64.h
rename to base/third_party/modp_b64/modp_b64.h
diff --git a/tool_kits/base/third_party/modp_b64/modp_b64_data.h b/base/third_party/modp_b64/modp_b64_data.h
similarity index 100%
rename from tool_kits/base/third_party/modp_b64/modp_b64_data.h
rename to base/third_party/modp_b64/modp_b64_data.h
diff --git a/tool_kits/base/thread/framework_thread.cpp b/base/thread/framework_thread.cpp
similarity index 100%
rename from tool_kits/base/thread/framework_thread.cpp
rename to base/thread/framework_thread.cpp
diff --git a/tool_kits/base/thread/framework_thread.h b/base/thread/framework_thread.h
similarity index 100%
rename from tool_kits/base/thread/framework_thread.h
rename to base/thread/framework_thread.h
diff --git a/tool_kits/base/thread/thread.h b/base/thread/thread.h
similarity index 100%
rename from tool_kits/base/thread/thread.h
rename to base/thread/thread.h
diff --git a/tool_kits/base/thread/thread_local.h b/base/thread/thread_local.h
similarity index 100%
rename from tool_kits/base/thread/thread_local.h
rename to base/thread/thread_local.h
diff --git a/tool_kits/base/thread/thread_local_posix.cpp b/base/thread/thread_local_posix.cpp
similarity index 100%
rename from tool_kits/base/thread/thread_local_posix.cpp
rename to base/thread/thread_local_posix.cpp
diff --git a/tool_kits/base/thread/thread_local_win.cpp b/base/thread/thread_local_win.cpp
similarity index 100%
rename from tool_kits/base/thread/thread_local_win.cpp
rename to base/thread/thread_local_win.cpp
diff --git a/tool_kits/base/thread/thread_manager.cpp b/base/thread/thread_manager.cpp
similarity index 100%
rename from tool_kits/base/thread/thread_manager.cpp
rename to base/thread/thread_manager.cpp
diff --git a/tool_kits/base/thread/thread_manager.h b/base/thread/thread_manager.h
similarity index 95%
rename from tool_kits/base/thread/thread_manager.h
rename to base/thread/thread_manager.h
index 91cca119..75b1ceda 100644
--- a/tool_kits/base/thread/thread_manager.h
+++ b/base/thread/thread_manager.h
@@ -9,6 +9,16 @@
#include "base/thread/framework_thread.h"
#include "base/memory/singleton.h"
+/**
+ * 一些预定义的线程 ID 值,提供开发者使用
+ */
+enum ThreadIds
+{
+ kThreadMain,
+ kThreadDatabase,
+ kThreadGlobalMisc,
+};
+
namespace nbase
{
class MessageLoop;
diff --git a/tool_kits/base/thread/thread_posix.cpp b/base/thread/thread_posix.cpp
similarity index 100%
rename from tool_kits/base/thread/thread_posix.cpp
rename to base/thread/thread_posix.cpp
diff --git a/tool_kits/base/thread/thread_win.cpp b/base/thread/thread_win.cpp
similarity index 100%
rename from tool_kits/base/thread/thread_win.cpp
rename to base/thread/thread_win.cpp
diff --git a/tool_kits/base/time/time.cpp b/base/time/time.cpp
similarity index 100%
rename from tool_kits/base/time/time.cpp
rename to base/time/time.cpp
diff --git a/tool_kits/base/time/time.h b/base/time/time.h
similarity index 100%
rename from tool_kits/base/time/time.h
rename to base/time/time.h
diff --git a/tool_kits/base/time/time_posix.cpp b/base/time/time_posix.cpp
similarity index 100%
rename from tool_kits/base/time/time_posix.cpp
rename to base/time/time_posix.cpp
diff --git a/tool_kits/base/time/time_win.cpp b/base/time/time_win.cpp
similarity index 100%
rename from tool_kits/base/time/time_win.cpp
rename to base/time/time_win.cpp
diff --git a/tool_kits/base/util/at_exit.cpp b/base/util/at_exit.cpp
similarity index 100%
rename from tool_kits/base/util/at_exit.cpp
rename to base/util/at_exit.cpp
diff --git a/tool_kits/base/util/at_exit.h b/base/util/at_exit.h
similarity index 100%
rename from tool_kits/base/util/at_exit.h
rename to base/util/at_exit.h
diff --git a/tool_kits/base/util/base64.cpp b/base/util/base64.cpp
similarity index 100%
rename from tool_kits/base/util/base64.cpp
rename to base/util/base64.cpp
diff --git a/tool_kits/base/util/base64.h b/base/util/base64.h
similarity index 100%
rename from tool_kits/base/util/base64.h
rename to base/util/base64.h
diff --git a/tool_kits/base/util/callback_unittest.cpp b/base/util/callback_unittest.cpp
similarity index 100%
rename from tool_kits/base/util/callback_unittest.cpp
rename to base/util/callback_unittest.cpp
diff --git a/tool_kits/base/util/cmd_line_args.cpp b/base/util/cmd_line_args.cpp
similarity index 100%
rename from tool_kits/base/util/cmd_line_args.cpp
rename to base/util/cmd_line_args.cpp
diff --git a/tool_kits/base/util/cmd_line_args.h b/base/util/cmd_line_args.h
similarity index 100%
rename from tool_kits/base/util/cmd_line_args.h
rename to base/util/cmd_line_args.h
diff --git a/tool_kits/base/util/string_number_conversions.cpp b/base/util/string_number_conversions.cpp
similarity index 100%
rename from tool_kits/base/util/string_number_conversions.cpp
rename to base/util/string_number_conversions.cpp
diff --git a/tool_kits/base/util/string_number_conversions.h b/base/util/string_number_conversions.h
similarity index 100%
rename from tool_kits/base/util/string_number_conversions.h
rename to base/util/string_number_conversions.h
diff --git a/tool_kits/base/util/string_util.cpp b/base/util/string_util.cpp
similarity index 100%
rename from tool_kits/base/util/string_util.cpp
rename to base/util/string_util.cpp
diff --git a/tool_kits/base/util/string_util.h b/base/util/string_util.h
similarity index 100%
rename from tool_kits/base/util/string_util.h
rename to base/util/string_util.h
diff --git a/tool_kits/base/util/stringize_macros.h b/base/util/stringize_macros.h
similarity index 100%
rename from tool_kits/base/util/stringize_macros.h
rename to base/util/stringize_macros.h
diff --git a/tool_kits/base/util/template_util.h b/base/util/template_util.h
similarity index 100%
rename from tool_kits/base/util/template_util.h
rename to base/util/template_util.h
diff --git a/tool_kits/base/util/unicode.h b/base/util/unicode.h
similarity index 100%
rename from tool_kits/base/util/unicode.h
rename to base/util/unicode.h
diff --git a/tool_kits/base/util/valuemap.h b/base/util/valuemap.h
similarity index 100%
rename from tool_kits/base/util/valuemap.h
rename to base/util/valuemap.h
diff --git a/tool_kits/base/win32/object_watcher.cpp b/base/win32/object_watcher.cpp
similarity index 100%
rename from tool_kits/base/win32/object_watcher.cpp
rename to base/win32/object_watcher.cpp
diff --git a/tool_kits/base/win32/object_watcher.h b/base/win32/object_watcher.h
similarity index 100%
rename from tool_kits/base/win32/object_watcher.h
rename to base/win32/object_watcher.h
diff --git a/tool_kits/base/win32/path_util.cpp b/base/win32/path_util.cpp
similarity index 100%
rename from tool_kits/base/win32/path_util.cpp
rename to base/win32/path_util.cpp
diff --git a/tool_kits/base/win32/path_util.h b/base/win32/path_util.h
similarity index 100%
rename from tool_kits/base/win32/path_util.h
rename to base/win32/path_util.h
diff --git a/tool_kits/base/win32/platform_string_util.cpp b/base/win32/platform_string_util.cpp
similarity index 100%
rename from tool_kits/base/win32/platform_string_util.cpp
rename to base/win32/platform_string_util.cpp
diff --git a/tool_kits/base/win32/platform_string_util.h b/base/win32/platform_string_util.h
similarity index 100%
rename from tool_kits/base/win32/platform_string_util.h
rename to base/win32/platform_string_util.h
diff --git a/tool_kits/base/win32/scoped_win_handle.h b/base/win32/scoped_win_handle.h
similarity index 100%
rename from tool_kits/base/win32/scoped_win_handle.h
rename to base/win32/scoped_win_handle.h
diff --git a/tool_kits/base/win32/security_util.cpp b/base/win32/security_util.cpp
similarity index 100%
rename from tool_kits/base/win32/security_util.cpp
rename to base/win32/security_util.cpp
diff --git a/tool_kits/base/win32/security_util.h b/base/win32/security_util.h
similarity index 100%
rename from tool_kits/base/win32/security_util.h
rename to base/win32/security_util.h
diff --git a/tool_kits/base/win32/shared_memory.cpp b/base/win32/shared_memory.cpp
similarity index 100%
rename from tool_kits/base/win32/shared_memory.cpp
rename to base/win32/shared_memory.cpp
diff --git a/tool_kits/base/win32/shared_memory.h b/base/win32/shared_memory.h
similarity index 100%
rename from tool_kits/base/win32/shared_memory.h
rename to base/win32/shared_memory.h
diff --git a/tool_kits/base/win32/win_util.cpp b/base/win32/win_util.cpp
similarity index 100%
rename from tool_kits/base/win32/win_util.cpp
rename to base/win32/win_util.cpp
diff --git a/tool_kits/base/win32/win_util.h b/base/win32/win_util.h
similarity index 100%
rename from tool_kits/base/win32/win_util.h
rename to base/win32/win_util.h
diff --git a/tool_kits/build/build_config.h b/build/build_config.h
similarity index 100%
rename from tool_kits/build/build_config.h
rename to build/build_config.h
diff --git a/tool_kits/build/stdafx.cpp b/build/stdafx.cpp
similarity index 100%
rename from tool_kits/build/stdafx.cpp
rename to build/stdafx.cpp
diff --git a/tool_kits/build/stdafx.h b/build/stdafx.h
similarity index 100%
rename from tool_kits/build/stdafx.h
rename to build/stdafx.h
diff --git a/tool_kits/build/uac_require_admin_win.manifest b/build/uac_require_admin_win.manifest
similarity index 100%
rename from tool_kits/build/uac_require_admin_win.manifest
rename to build/uac_require_admin_win.manifest
diff --git a/tool_kits/build/winsdk_config.h b/build/winsdk_config.h
similarity index 100%
rename from tool_kits/build/winsdk_config.h
rename to build/winsdk_config.h
diff --git a/tool_kits/build/xp_style_manifest_win.h b/build/xp_style_manifest_win.h
similarity index 100%
rename from tool_kits/build/xp_style_manifest_win.h
rename to build/xp_style_manifest_win.h
diff --git a/docs/PREVIEW.gif b/docs/PREVIEW.gif
index 890a7182..9e82d53e 100644
Binary files a/docs/PREVIEW.gif and b/docs/PREVIEW.gif differ
diff --git a/tool_kits/duilib/Animation/AnimationManager.cpp b/duilib/Animation/AnimationManager.cpp
similarity index 100%
rename from tool_kits/duilib/Animation/AnimationManager.cpp
rename to duilib/Animation/AnimationManager.cpp
diff --git a/tool_kits/duilib/Animation/AnimationManager.h b/duilib/Animation/AnimationManager.h
similarity index 100%
rename from tool_kits/duilib/Animation/AnimationManager.h
rename to duilib/Animation/AnimationManager.h
diff --git a/tool_kits/duilib/Animation/AnimationPlayer.cpp b/duilib/Animation/AnimationPlayer.cpp
similarity index 100%
rename from tool_kits/duilib/Animation/AnimationPlayer.cpp
rename to duilib/Animation/AnimationPlayer.cpp
diff --git a/tool_kits/duilib/Animation/AnimationPlayer.h b/duilib/Animation/AnimationPlayer.h
similarity index 100%
rename from tool_kits/duilib/Animation/AnimationPlayer.h
rename to duilib/Animation/AnimationPlayer.h
diff --git a/tool_kits/duilib/Box/ChildBox.cpp b/duilib/Box/ChildBox.cpp
similarity index 100%
rename from tool_kits/duilib/Box/ChildBox.cpp
rename to duilib/Box/ChildBox.cpp
diff --git a/tool_kits/duilib/Box/ChildBox.h b/duilib/Box/ChildBox.h
similarity index 100%
rename from tool_kits/duilib/Box/ChildBox.h
rename to duilib/Box/ChildBox.h
diff --git a/tool_kits/duilib/Box/HBox.cpp b/duilib/Box/HBox.cpp
similarity index 100%
rename from tool_kits/duilib/Box/HBox.cpp
rename to duilib/Box/HBox.cpp
diff --git a/tool_kits/duilib/Box/HBox.h b/duilib/Box/HBox.h
similarity index 100%
rename from tool_kits/duilib/Box/HBox.h
rename to duilib/Box/HBox.h
diff --git a/tool_kits/duilib/Box/TabBox.cpp b/duilib/Box/TabBox.cpp
similarity index 100%
rename from tool_kits/duilib/Box/TabBox.cpp
rename to duilib/Box/TabBox.cpp
diff --git a/tool_kits/duilib/Box/TabBox.h b/duilib/Box/TabBox.h
similarity index 100%
rename from tool_kits/duilib/Box/TabBox.h
rename to duilib/Box/TabBox.h
diff --git a/tool_kits/duilib/Box/TileBox.cpp b/duilib/Box/TileBox.cpp
similarity index 100%
rename from tool_kits/duilib/Box/TileBox.cpp
rename to duilib/Box/TileBox.cpp
diff --git a/tool_kits/duilib/Box/TileBox.h b/duilib/Box/TileBox.h
similarity index 100%
rename from tool_kits/duilib/Box/TileBox.h
rename to duilib/Box/TileBox.h
diff --git a/tool_kits/duilib/Box/VBox.cpp b/duilib/Box/VBox.cpp
similarity index 100%
rename from tool_kits/duilib/Box/VBox.cpp
rename to duilib/Box/VBox.cpp
diff --git a/tool_kits/duilib/Box/VBox.h b/duilib/Box/VBox.h
similarity index 100%
rename from tool_kits/duilib/Box/VBox.h
rename to duilib/Box/VBox.h
diff --git a/tool_kits/duilib/Control/Button.h b/duilib/Control/Button.h
similarity index 100%
rename from tool_kits/duilib/Control/Button.h
rename to duilib/Control/Button.h
diff --git a/tool_kits/duilib/Control/CheckBox.h b/duilib/Control/CheckBox.h
similarity index 100%
rename from tool_kits/duilib/Control/CheckBox.h
rename to duilib/Control/CheckBox.h
diff --git a/tool_kits/duilib/Control/CircleProgress.cpp b/duilib/Control/CircleProgress.cpp
similarity index 96%
rename from tool_kits/duilib/Control/CircleProgress.cpp
rename to duilib/Control/CircleProgress.cpp
index 63355586..c9b818b8 100644
--- a/tool_kits/duilib/Control/CircleProgress.cpp
+++ b/duilib/Control/CircleProgress.cpp
@@ -1,205 +1,205 @@
-#include "stdafx.h"
-#include "CircleProgress.h"
-#include "shlwapi.h"
-
-namespace ui
-{
-
-CircleProgress::CircleProgress() :
- m_bCircular(true),
- m_bClockwise(true),
- m_nCircleWidth(1),
- m_dwBackgroundColor(0),
- m_dwForegroundColor(0),
- m_dwGradientColor(0),
- m_pIndicator(nullptr)
-{
-
-}
-
-void CircleProgress::SetAttribute(const std::wstring& srName, const std::wstring& strValue)
-{
- if (srName == _T("circular")) SetCircular(strValue == _T("true"));
- else if (srName == _T("circlewidth")) SetCircleWidth(_ttoi(strValue.c_str()));
- else if (srName == _T("indicator")) SetIndicator(strValue);
- else if (srName == _T("clockwise")) SetClockwiseRotation(strValue == _T("true"));
- else if (srName == _T("bgcolor")) {
- LPCTSTR pValue = strValue.c_str();
- while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
- SetBackgroudColor(pValue);
- }
- else if (srName == _T("fgcolor")) {
- LPCTSTR pValue = strValue.c_str();
- while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
- SetForegroudColor(pValue);
- }
- else if (srName == _T("gradientcolor")) {
- LPCTSTR pValue = strValue.c_str();
- while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
- SetCircleGradientColor(pValue);
- }
- else Progress::SetAttribute(srName, strValue);
-}
-
-void CircleProgress::PaintStatusImage(IRenderContext* pRender)
-{
- Progress::PaintStatusImage(pRender);
- if (m_bCircular)
- {
- //ĿǰIRenderContextкܶGDI+ӿδʵ֣ʱֱgdi+ͼ
- //Ժܻʵ1DrawArc 2Penbrush() 3Graphics
- int direction = m_bClockwise ? 1 : -1; //ת
- int bordersize = 1; //ȿĿǰʹ1
-
- Gdiplus::Graphics graphics(pRender->GetDC());
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- Gdiplus::Pen bgPen(m_dwBackgroundColor, m_nCircleWidth);
- // Բ
- CPoint center;
- center.x = m_rcItem.left + (m_rcItem.right - m_rcItem.left) / 2;
- center.y = m_rcItem.top + (m_rcItem.bottom - m_rcItem.top) / 2;
-
- // ؼڵεı߽
- int side = min(m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top);
- //UiRect rcBorder; ȻUiRect RectFתֱgdiRectF
- Gdiplus::RectF rcBorder;
- rcBorder.X = center.x - side / 2;
- rcBorder.Y = center.y - side / 2;
- rcBorder.Width = rcBorder.Height = side;
-
- Gdiplus::RectF outer = rcBorder;
- if (m_pIndicator) {
- outer.Inflate(-1.0F *m_pIndicator->GetWidth() / 2, -1.0F * m_pIndicator->GetWidth() / 2);
- }
- else
- {
- outer.Inflate(-0.5 * m_nCircleWidth, -0.5 * m_nCircleWidth);
- }
- outer.Inflate(-1, -1);
-
-
- if (m_dwGradientColor == 0)
- {
- //ʹýɫֱǰɫ
- Gdiplus::Pen fgPen(m_dwForegroundColor, m_nCircleWidth);
- graphics.DrawArc(&bgPen, outer, 270, 360); //270濪ʼΪ0Ļұ߿ʼ
- graphics.DrawArc(&fgPen, outer, 270, direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin));
- }
- else
- {
- Gdiplus::REAL factors[4] = { 0.0f, 0.4f, 0.6f, 1.0f };
- Gdiplus::REAL positions[4] = { 0.0f, 0.2f, 0.8f, 1.0f };
-
- Gdiplus::LinearGradientBrush lgbrush(rcBorder, m_dwForegroundColor, m_dwGradientColor, Gdiplus::LinearGradientModeVertical);
- lgbrush.SetBlend(factors, positions, 4);
- graphics.DrawArc(&bgPen, outer, 270, 360);
- Gdiplus::Pen fgPen(&lgbrush, m_nCircleWidth);
- graphics.DrawArc(&fgPen, outer, 270, direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin));
-
- }
-
- //תָʾͼ꣬Ҫõ
- if (m_pIndicator)
- {
- Gdiplus::Matrix matrix;
- matrix.RotateAt(direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin), Gdiplus::PointF(center.x, center.y), Gdiplus::MatrixOrderAppend);
- graphics.SetTransform(&matrix);
- Gdiplus::RectF rectf;
- rectf.X = center.x - m_pIndicator->GetWidth() / 2;
- rectf.Y = outer.Y + bordersize / 2 - m_pIndicator->GetHeight() / 2;
- rectf.Width = m_pIndicator->GetWidth();
- rectf.Height = m_pIndicator->GetHeight();
- graphics.DrawImage(m_pIndicator, rectf);
- }
-
- }
-}
-
-void CircleProgress::ClearImageCache()
-{
- __super::ClearImageCache();
- if (m_pIndicator)
- {
- delete m_pIndicator;
- m_pIndicator = nullptr;
- }
-}
-
-void CircleProgress::SetCircular(bool bCircular /*= true*/)
-{
- m_bCircular = bCircular;
- Invalidate();
-}
-
-void CircleProgress::SetClockwiseRotation(bool bClockwise /*= true*/)
-{
- if (bClockwise != m_bClockwise)
- {
- m_bClockwise = bClockwise;
- if (m_pIndicator)
- {
- //ѾתͼƬת෴ķ
- m_pIndicator->RotateFlip(Gdiplus::Rotate180FlipNone);
- }
-
- }
-}
-
-void CircleProgress::SetCircleWidth(int nCircleWidth)
-{
- m_nCircleWidth = nCircleWidth;
- Invalidate();
-}
-
-
-void CircleProgress::SetBackgroudColor(const std::wstring& strColor)
-{
- m_dwBackgroundColor = GlobalManager::GetTextColor(strColor);
- ASSERT(m_dwBackgroundColor != 0);
- Invalidate();
-}
-
-void CircleProgress::SetForegroudColor(const std::wstring& strColor)
-{
- m_dwForegroundColor = GlobalManager::GetTextColor(strColor);
- ASSERT(m_dwForegroundColor != 0);
- Invalidate();
-}
-
-void CircleProgress::SetIndicator(const std::wstring& sIndicatorImage)
-{
- if (m_sIndicatorImage != sIndicatorImage)
- {
- m_sIndicatorImage = sIndicatorImage;
- if (m_pIndicator)
- {
- delete m_pIndicator;
- m_pIndicator = nullptr;
- }
- std::wstring imagepath = m_sIndicatorImage;
- if (!::PathFileExistsW(imagepath.c_str())) {
- imagepath = GlobalManager::GetResourcePath() + m_pWindow->GetWindowResourcePath() + imagepath;
- }
- if (!::PathFileExistsW(imagepath.c_str())) {
- return;
- }
- m_pIndicator = new Gdiplus::Image(imagepath.c_str());
-
- Gdiplus::Status state = m_pIndicator->GetLastStatus();
- if (Gdiplus::Ok == state)
- {
- // ٶͼƬָ
- m_pIndicator->RotateFlip(m_bClockwise ? Gdiplus::Rotate90FlipNone : Gdiplus::Rotate270FlipNone);
- Invalidate();
- }
- }
-}
-
-void CircleProgress::SetCircleGradientColor(const std::wstring& strColor)
-{
- m_dwGradientColor = GlobalManager::GetTextColor(strColor);
- ASSERT(m_dwGradientColor != 0);
- Invalidate();
-}
-
-}
+#include "stdafx.h"
+#include "CircleProgress.h"
+#include "shlwapi.h"
+
+namespace ui
+{
+
+CircleProgress::CircleProgress() :
+ m_bCircular(true),
+ m_bClockwise(true),
+ m_nCircleWidth(1),
+ m_dwBackgroundColor(0),
+ m_dwForegroundColor(0),
+ m_dwGradientColor(0),
+ m_pIndicator(nullptr)
+{
+
+}
+
+void CircleProgress::SetAttribute(const std::wstring& srName, const std::wstring& strValue)
+{
+ if (srName == _T("circular")) SetCircular(strValue == _T("true"));
+ else if (srName == _T("circlewidth")) SetCircleWidth(_ttoi(strValue.c_str()));
+ else if (srName == _T("indicator")) SetIndicator(strValue);
+ else if (srName == _T("clockwise")) SetClockwiseRotation(strValue == _T("true"));
+ else if (srName == _T("bgcolor")) {
+ LPCTSTR pValue = strValue.c_str();
+ while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
+ SetBackgroudColor(pValue);
+ }
+ else if (srName == _T("fgcolor")) {
+ LPCTSTR pValue = strValue.c_str();
+ while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
+ SetForegroudColor(pValue);
+ }
+ else if (srName == _T("gradientcolor")) {
+ LPCTSTR pValue = strValue.c_str();
+ while (*pValue > _T('\0') && *pValue <= _T(' ')) pValue = ::CharNext(pValue);
+ SetCircleGradientColor(pValue);
+ }
+ else Progress::SetAttribute(srName, strValue);
+}
+
+void CircleProgress::PaintStatusImage(IRenderContext* pRender)
+{
+ Progress::PaintStatusImage(pRender);
+ if (m_bCircular)
+ {
+ //ĿǰIRenderContextкܶGDI+ӿδʵ֣ʱֱgdi+ͼ
+ //Ժܻʵ1DrawArc 2Penbrush() 3Graphics
+ int direction = m_bClockwise ? 1 : -1; //ת
+ int bordersize = 1; //ȿĿǰʹ1
+
+ Gdiplus::Graphics graphics(pRender->GetDC());
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::Pen bgPen(m_dwBackgroundColor, m_nCircleWidth);
+ // Բ
+ CPoint center;
+ center.x = m_rcItem.left + (m_rcItem.right - m_rcItem.left) / 2;
+ center.y = m_rcItem.top + (m_rcItem.bottom - m_rcItem.top) / 2;
+
+ // ؼڵεı߽
+ int side = min(m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top);
+ //UiRect rcBorder; ȻUiRect RectFתֱgdiRectF
+ Gdiplus::RectF rcBorder;
+ rcBorder.X = center.x - side / 2;
+ rcBorder.Y = center.y - side / 2;
+ rcBorder.Width = rcBorder.Height = side;
+
+ Gdiplus::RectF outer = rcBorder;
+ if (m_pIndicator) {
+ outer.Inflate(-1.0F *m_pIndicator->GetWidth() / 2, -1.0F * m_pIndicator->GetWidth() / 2);
+ }
+ else
+ {
+ outer.Inflate(-0.5 * m_nCircleWidth, -0.5 * m_nCircleWidth);
+ }
+ outer.Inflate(-1, -1);
+
+
+ if (m_dwGradientColor == 0)
+ {
+ //ʹýɫֱǰɫ
+ Gdiplus::Pen fgPen(m_dwForegroundColor, m_nCircleWidth);
+ graphics.DrawArc(&bgPen, outer, 270, 360); //270濪ʼΪ0Ļұ߿ʼ
+ graphics.DrawArc(&fgPen, outer, 270, direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin));
+ }
+ else
+ {
+ Gdiplus::REAL factors[4] = { 0.0f, 0.4f, 0.6f, 1.0f };
+ Gdiplus::REAL positions[4] = { 0.0f, 0.2f, 0.8f, 1.0f };
+
+ Gdiplus::LinearGradientBrush lgbrush(rcBorder, m_dwForegroundColor, m_dwGradientColor, Gdiplus::LinearGradientModeVertical);
+ lgbrush.SetBlend(factors, positions, 4);
+ graphics.DrawArc(&bgPen, outer, 270, 360);
+ Gdiplus::Pen fgPen(&lgbrush, m_nCircleWidth);
+ graphics.DrawArc(&fgPen, outer, 270, direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin));
+
+ }
+
+ //תָʾͼ꣬Ҫõ
+ if (m_pIndicator)
+ {
+ Gdiplus::Matrix matrix;
+ matrix.RotateAt(direction * 360 * (m_nValue - m_nMin) / (m_nMax - m_nMin), Gdiplus::PointF(center.x, center.y), Gdiplus::MatrixOrderAppend);
+ graphics.SetTransform(&matrix);
+ Gdiplus::RectF rectf;
+ rectf.X = center.x - m_pIndicator->GetWidth() / 2;
+ rectf.Y = outer.Y + bordersize / 2 - m_pIndicator->GetHeight() / 2;
+ rectf.Width = m_pIndicator->GetWidth();
+ rectf.Height = m_pIndicator->GetHeight();
+ graphics.DrawImage(m_pIndicator, rectf);
+ }
+
+ }
+}
+
+void CircleProgress::ClearImageCache()
+{
+ __super::ClearImageCache();
+ if (m_pIndicator)
+ {
+ delete m_pIndicator;
+ m_pIndicator = nullptr;
+ }
+}
+
+void CircleProgress::SetCircular(bool bCircular /*= true*/)
+{
+ m_bCircular = bCircular;
+ Invalidate();
+}
+
+void CircleProgress::SetClockwiseRotation(bool bClockwise /*= true*/)
+{
+ if (bClockwise != m_bClockwise)
+ {
+ m_bClockwise = bClockwise;
+ if (m_pIndicator)
+ {
+ //ѾתͼƬת෴ķ
+ m_pIndicator->RotateFlip(Gdiplus::Rotate180FlipNone);
+ }
+
+ }
+}
+
+void CircleProgress::SetCircleWidth(int nCircleWidth)
+{
+ m_nCircleWidth = nCircleWidth;
+ Invalidate();
+}
+
+
+void CircleProgress::SetBackgroudColor(const std::wstring& strColor)
+{
+ m_dwBackgroundColor = GlobalManager::GetTextColor(strColor);
+ ASSERT(m_dwBackgroundColor != 0);
+ Invalidate();
+}
+
+void CircleProgress::SetForegroudColor(const std::wstring& strColor)
+{
+ m_dwForegroundColor = GlobalManager::GetTextColor(strColor);
+ ASSERT(m_dwForegroundColor != 0);
+ Invalidate();
+}
+
+void CircleProgress::SetIndicator(const std::wstring& sIndicatorImage)
+{
+ if (m_sIndicatorImage != sIndicatorImage)
+ {
+ m_sIndicatorImage = sIndicatorImage;
+ if (m_pIndicator)
+ {
+ delete m_pIndicator;
+ m_pIndicator = nullptr;
+ }
+ std::wstring imagepath = m_sIndicatorImage;
+ if (!::PathFileExistsW(imagepath.c_str())) {
+ imagepath = GlobalManager::GetResourcePath() + m_pWindow->GetWindowResourcePath() + imagepath;
+ }
+ if (!::PathFileExistsW(imagepath.c_str())) {
+ return;
+ }
+ m_pIndicator = new Gdiplus::Image(imagepath.c_str());
+
+ Gdiplus::Status state = m_pIndicator->GetLastStatus();
+ if (Gdiplus::Ok == state)
+ {
+ // ٶͼƬָ
+ m_pIndicator->RotateFlip(m_bClockwise ? Gdiplus::Rotate90FlipNone : Gdiplus::Rotate270FlipNone);
+ Invalidate();
+ }
+ }
+}
+
+void CircleProgress::SetCircleGradientColor(const std::wstring& strColor)
+{
+ m_dwGradientColor = GlobalManager::GetTextColor(strColor);
+ ASSERT(m_dwGradientColor != 0);
+ Invalidate();
+}
+
+}
diff --git a/tool_kits/duilib/Control/CircleProgress.h b/duilib/Control/CircleProgress.h
similarity index 96%
rename from tool_kits/duilib/Control/CircleProgress.h
rename to duilib/Control/CircleProgress.h
index c3e4c008..f0d1ba10 100644
--- a/tool_kits/duilib/Control/CircleProgress.h
+++ b/duilib/Control/CircleProgress.h
@@ -1,89 +1,89 @@
-/** @file CircleProgress.h
-* @brief ͽؼԲмı85%
-* @copyright (c) 2019-2022, NetEase Inc. All rights reserved
-* @author Xuhuajie
-* @date 2019/8/14
-*/
-
-#ifndef UI_CONTROL_CIRCLEPROGRESS_H_
-#define UI_CONTROL_CIRCLEPROGRESS_H_
-
-#pragma once
-
-namespace ui
-{
-
-class UILIB_API CircleProgress : public Progress
-{
-public:
- CircleProgress();
-
- /// дṩԻܣο
- virtual void SetAttribute(const std::wstring& strName, const std::wstring& strValue) override;
- virtual void PaintStatusImage(IRenderContext* pRender) override;
- virtual void ClearImageCache() override;
-
- /**
- * @brief ûͽĬΪͨ
- * @param[in] bCircular Ϊ true ʱΪͽfalse ʱΪʽĬΪ true
- * @return
- */
- void SetCircular(bool bCircular = true);
-
- /**
- * @brief õ
- * @param[in] bClockwise Ϊ true ʱΪ˳ʱ룬false ʱΪʱ룬ĬΪ true
- * @return
- */
- void SetClockwiseRotation(bool bClockwise = true);
-
- /**
- * @brief Բ
- * @param[in] nCircleWidth ֵ
- * @return
- */
- void SetCircleWidth(int nCircleWidth);
-
- /**
- * @brief ýɫ
- * @param[in] strColorҪõıɫַַ global.xml д
- * @return
- */
- void SetBackgroudColor(const std::wstring& strColor);
-
- /**
- * @brief ýǰɫ
- * @param[in] strColorҪõǰɫַַ global.xml д
- * @return
- */
- void SetForegroudColor(const std::wstring& strColor);
-
- /**
- * @brief ýǰɫ SetForegroudColor ͬʱʹãԲ,Ч
- * @param[in] strColorҪõǰɫַַ global.xml д
- * @return
- */
- void SetCircleGradientColor(const std::wstring& strColor);
-
- /**
- * @brief ýָʾƶͼ
- * @param[in] sIndicatorImage ҪõͼƬ
- * @return
- */
- void SetIndicator(const std::wstring& sIndicatorImage);
-
-protected:
- bool m_bCircular;
- bool m_bClockwise;
- int m_nCircleWidth;
- DWORD m_dwBackgroundColor;
- DWORD m_dwForegroundColor;
- DWORD m_dwGradientColor;
- Gdiplus::Image* m_pIndicator; //ĿǰάԴ
- std::wstring m_sIndicatorImage;
-
-};
-
-} // namespace ui
-
-#endif // UI_CONTROL_CIRCLEPROGRESS_H_
+/** @file CircleProgress.h
+* @brief ͽؼԲмı85%
+* @copyright (c) 2019-2022, NetEase Inc. All rights reserved
+* @author Xuhuajie
+* @date 2019/8/14
+*/
+
+#ifndef UI_CONTROL_CIRCLEPROGRESS_H_
+#define UI_CONTROL_CIRCLEPROGRESS_H_
+
+#pragma once
+
+namespace ui
+{
+
+class UILIB_API CircleProgress : public Progress
+{
+public:
+ CircleProgress();
+
+ /// дṩԻܣο
+ virtual void SetAttribute(const std::wstring& strName, const std::wstring& strValue) override;
+ virtual void PaintStatusImage(IRenderContext* pRender) override;
+ virtual void ClearImageCache() override;
+
+ /**
+ * @brief ûͽĬΪͨ
+ * @param[in] bCircular Ϊ true ʱΪͽfalse ʱΪʽĬΪ true
+ * @return
+ */
+ void SetCircular(bool bCircular = true);
+
+ /**
+ * @brief õ
+ * @param[in] bClockwise Ϊ true ʱΪ˳ʱ룬false ʱΪʱ룬ĬΪ true
+ * @return
+ */
+ void SetClockwiseRotation(bool bClockwise = true);
+
+ /**
+ * @brief Բ
+ * @param[in] nCircleWidth ֵ
+ * @return
+ */
+ void SetCircleWidth(int nCircleWidth);
+
+ /**
+ * @brief ýɫ
+ * @param[in] strColorҪõıɫַַ global.xml д
+ * @return
+ */
+ void SetBackgroudColor(const std::wstring& strColor);
+
+ /**
+ * @brief ýǰɫ
+ * @param[in] strColorҪõǰɫַַ global.xml д
+ * @return
+ */
+ void SetForegroudColor(const std::wstring& strColor);
+
+ /**
+ * @brief ýǰɫ SetForegroudColor ͬʱʹãԲ,Ч
+ * @param[in] strColorҪõǰɫַַ global.xml д
+ * @return
+ */
+ void SetCircleGradientColor(const std::wstring& strColor);
+
+ /**
+ * @brief ýָʾƶͼ
+ * @param[in] sIndicatorImage ҪõͼƬ
+ * @return
+ */
+ void SetIndicator(const std::wstring& sIndicatorImage);
+
+protected:
+ bool m_bCircular;
+ bool m_bClockwise;
+ int m_nCircleWidth;
+ DWORD m_dwBackgroundColor;
+ DWORD m_dwForegroundColor;
+ DWORD m_dwGradientColor;
+ Gdiplus::Image* m_pIndicator; //ĿǰάԴ
+ std::wstring m_sIndicatorImage;
+
+};
+
+} // namespace ui
+
+#endif // UI_CONTROL_CIRCLEPROGRESS_H_
diff --git a/tool_kits/duilib/Control/Combo.cpp b/duilib/Control/Combo.cpp
similarity index 100%
rename from tool_kits/duilib/Control/Combo.cpp
rename to duilib/Control/Combo.cpp
diff --git a/tool_kits/duilib/Control/Combo.h b/duilib/Control/Combo.h
similarity index 100%
rename from tool_kits/duilib/Control/Combo.h
rename to duilib/Control/Combo.h
diff --git a/tool_kits/duilib/Control/Label.h b/duilib/Control/Label.h
similarity index 100%
rename from tool_kits/duilib/Control/Label.h
rename to duilib/Control/Label.h
diff --git a/tool_kits/duilib/Control/List.cpp b/duilib/Control/List.cpp
similarity index 100%
rename from tool_kits/duilib/Control/List.cpp
rename to duilib/Control/List.cpp
diff --git a/tool_kits/duilib/Control/List.h b/duilib/Control/List.h
similarity index 100%
rename from tool_kits/duilib/Control/List.h
rename to duilib/Control/List.h
diff --git a/tool_kits/duilib/Control/Option.h b/duilib/Control/Option.h
similarity index 100%
rename from tool_kits/duilib/Control/Option.h
rename to duilib/Control/Option.h
diff --git a/tool_kits/duilib/Control/Progress.cpp b/duilib/Control/Progress.cpp
similarity index 100%
rename from tool_kits/duilib/Control/Progress.cpp
rename to duilib/Control/Progress.cpp
diff --git a/tool_kits/duilib/Control/Progress.h b/duilib/Control/Progress.h
similarity index 100%
rename from tool_kits/duilib/Control/Progress.h
rename to duilib/Control/Progress.h
diff --git a/tool_kits/duilib/Control/RichEdit.cpp b/duilib/Control/RichEdit.cpp
similarity index 100%
rename from tool_kits/duilib/Control/RichEdit.cpp
rename to duilib/Control/RichEdit.cpp
diff --git a/tool_kits/duilib/Control/RichEdit.h b/duilib/Control/RichEdit.h
similarity index 100%
rename from tool_kits/duilib/Control/RichEdit.h
rename to duilib/Control/RichEdit.h
diff --git a/tool_kits/duilib/Control/ScrollBar.cpp b/duilib/Control/ScrollBar.cpp
similarity index 100%
rename from tool_kits/duilib/Control/ScrollBar.cpp
rename to duilib/Control/ScrollBar.cpp
diff --git a/tool_kits/duilib/Control/ScrollBar.h b/duilib/Control/ScrollBar.h
similarity index 100%
rename from tool_kits/duilib/Control/ScrollBar.h
rename to duilib/Control/ScrollBar.h
diff --git a/tool_kits/duilib/Control/Slider.cpp b/duilib/Control/Slider.cpp
similarity index 100%
rename from tool_kits/duilib/Control/Slider.cpp
rename to duilib/Control/Slider.cpp
diff --git a/tool_kits/duilib/Control/Slider.h b/duilib/Control/Slider.h
similarity index 100%
rename from tool_kits/duilib/Control/Slider.h
rename to duilib/Control/Slider.h
diff --git a/tool_kits/duilib/Control/TreeView.cpp b/duilib/Control/TreeView.cpp
similarity index 100%
rename from tool_kits/duilib/Control/TreeView.cpp
rename to duilib/Control/TreeView.cpp
diff --git a/tool_kits/duilib/Control/TreeView.h b/duilib/Control/TreeView.h
similarity index 100%
rename from tool_kits/duilib/Control/TreeView.h
rename to duilib/Control/TreeView.h
diff --git a/tool_kits/duilib/Control/VirtualListBox.cpp b/duilib/Control/VirtualListBox.cpp
similarity index 100%
rename from tool_kits/duilib/Control/VirtualListBox.cpp
rename to duilib/Control/VirtualListBox.cpp
diff --git a/tool_kits/duilib/Control/VirtualListBox.h b/duilib/Control/VirtualListBox.h
similarity index 100%
rename from tool_kits/duilib/Control/VirtualListBox.h
rename to duilib/Control/VirtualListBox.h
diff --git a/tool_kits/duilib/Core/Box.cpp b/duilib/Core/Box.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Box.cpp
rename to duilib/Core/Box.cpp
diff --git a/tool_kits/duilib/Core/Box.h b/duilib/Core/Box.h
similarity index 100%
rename from tool_kits/duilib/Core/Box.h
rename to duilib/Core/Box.h
diff --git a/tool_kits/duilib/Core/Control.cpp b/duilib/Core/Control.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Control.cpp
rename to duilib/Core/Control.cpp
diff --git a/tool_kits/duilib/Core/Control.h b/duilib/Core/Control.h
similarity index 100%
rename from tool_kits/duilib/Core/Control.h
rename to duilib/Core/Control.h
diff --git a/tool_kits/duilib/Core/Define.cpp b/duilib/Core/Define.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Define.cpp
rename to duilib/Core/Define.cpp
diff --git a/tool_kits/duilib/Core/Define.h b/duilib/Core/Define.h
similarity index 100%
rename from tool_kits/duilib/Core/Define.h
rename to duilib/Core/Define.h
diff --git a/tool_kits/duilib/Core/GlobalManager.cpp b/duilib/Core/GlobalManager.cpp
similarity index 100%
rename from tool_kits/duilib/Core/GlobalManager.cpp
rename to duilib/Core/GlobalManager.cpp
diff --git a/tool_kits/duilib/Core/GlobalManager.h b/duilib/Core/GlobalManager.h
similarity index 100%
rename from tool_kits/duilib/Core/GlobalManager.h
rename to duilib/Core/GlobalManager.h
diff --git a/tool_kits/duilib/Core/Image.cpp b/duilib/Core/Image.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Image.cpp
rename to duilib/Core/Image.cpp
diff --git a/tool_kits/duilib/Core/Image.h b/duilib/Core/Image.h
similarity index 100%
rename from tool_kits/duilib/Core/Image.h
rename to duilib/Core/Image.h
diff --git a/tool_kits/duilib/Core/Markup.cpp b/duilib/Core/Markup.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Markup.cpp
rename to duilib/Core/Markup.cpp
diff --git a/tool_kits/duilib/Core/Markup.h b/duilib/Core/Markup.h
similarity index 100%
rename from tool_kits/duilib/Core/Markup.h
rename to duilib/Core/Markup.h
diff --git a/tool_kits/duilib/Core/Placeholder.cpp b/duilib/Core/Placeholder.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Placeholder.cpp
rename to duilib/Core/Placeholder.cpp
diff --git a/tool_kits/duilib/Core/Placeholder.h b/duilib/Core/Placeholder.h
similarity index 100%
rename from tool_kits/duilib/Core/Placeholder.h
rename to duilib/Core/Placeholder.h
diff --git a/tool_kits/duilib/Core/Window.cpp b/duilib/Core/Window.cpp
similarity index 100%
rename from tool_kits/duilib/Core/Window.cpp
rename to duilib/Core/Window.cpp
diff --git a/tool_kits/duilib/Core/Window.h b/duilib/Core/Window.h
similarity index 100%
rename from tool_kits/duilib/Core/Window.h
rename to duilib/Core/Window.h
diff --git a/tool_kits/duilib/Core/WindowBuilder.cpp b/duilib/Core/WindowBuilder.cpp
similarity index 100%
rename from tool_kits/duilib/Core/WindowBuilder.cpp
rename to duilib/Core/WindowBuilder.cpp
diff --git a/tool_kits/duilib/Core/WindowBuilder.h b/duilib/Core/WindowBuilder.h
similarity index 100%
rename from tool_kits/duilib/Core/WindowBuilder.h
rename to duilib/Core/WindowBuilder.h
diff --git a/tool_kits/duilib/Render/Bitmap.cpp b/duilib/Render/Bitmap.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Bitmap.cpp
rename to duilib/Render/Bitmap.cpp
diff --git a/tool_kits/duilib/Render/Bitmap.h b/duilib/Render/Bitmap.h
similarity index 100%
rename from tool_kits/duilib/Render/Bitmap.h
rename to duilib/Render/Bitmap.h
diff --git a/tool_kits/duilib/Render/Brush.cpp b/duilib/Render/Brush.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Brush.cpp
rename to duilib/Render/Brush.cpp
diff --git a/tool_kits/duilib/Render/Brush.h b/duilib/Render/Brush.h
similarity index 100%
rename from tool_kits/duilib/Render/Brush.h
rename to duilib/Render/Brush.h
diff --git a/tool_kits/duilib/Render/Clip.cpp b/duilib/Render/Clip.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Clip.cpp
rename to duilib/Render/Clip.cpp
diff --git a/tool_kits/duilib/Render/Clip.h b/duilib/Render/Clip.h
similarity index 100%
rename from tool_kits/duilib/Render/Clip.h
rename to duilib/Render/Clip.h
diff --git a/tool_kits/duilib/Render/Factory.cpp b/duilib/Render/Factory.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Factory.cpp
rename to duilib/Render/Factory.cpp
diff --git a/tool_kits/duilib/Render/Factory.h b/duilib/Render/Factory.h
similarity index 100%
rename from tool_kits/duilib/Render/Factory.h
rename to duilib/Render/Factory.h
diff --git a/tool_kits/duilib/Render/IRender.cpp b/duilib/Render/IRender.cpp
similarity index 100%
rename from tool_kits/duilib/Render/IRender.cpp
rename to duilib/Render/IRender.cpp
diff --git a/tool_kits/duilib/Render/IRender.h b/duilib/Render/IRender.h
similarity index 100%
rename from tool_kits/duilib/Render/IRender.h
rename to duilib/Render/IRender.h
diff --git a/tool_kits/duilib/Render/Matrix.cpp b/duilib/Render/Matrix.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Matrix.cpp
rename to duilib/Render/Matrix.cpp
diff --git a/tool_kits/duilib/Render/Matrix.h b/duilib/Render/Matrix.h
similarity index 100%
rename from tool_kits/duilib/Render/Matrix.h
rename to duilib/Render/Matrix.h
diff --git a/tool_kits/duilib/Render/Path.cpp b/duilib/Render/Path.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Path.cpp
rename to duilib/Render/Path.cpp
diff --git a/tool_kits/duilib/Render/Path.h b/duilib/Render/Path.h
similarity index 100%
rename from tool_kits/duilib/Render/Path.h
rename to duilib/Render/Path.h
diff --git a/tool_kits/duilib/Render/Pen.cpp b/duilib/Render/Pen.cpp
similarity index 100%
rename from tool_kits/duilib/Render/Pen.cpp
rename to duilib/Render/Pen.cpp
diff --git a/tool_kits/duilib/Render/Pen.h b/duilib/Render/Pen.h
similarity index 100%
rename from tool_kits/duilib/Render/Pen.h
rename to duilib/Render/Pen.h
diff --git a/tool_kits/duilib/Render/Render.cpp b/duilib/Render/Render.cpp
similarity index 97%
rename from tool_kits/duilib/Render/Render.cpp
rename to duilib/Render/Render.cpp
index 452a85a2..cb6a7682 100644
--- a/tool_kits/duilib/Render/Render.cpp
+++ b/duilib/Render/Render.cpp
@@ -1,626 +1,626 @@
-#include "StdAfx.h"
-
-namespace ui {
-
-static inline void DrawFunction(HDC hDC, bool bTransparent, UiRect rcDest, HDC hdcSrc, UiRect rcSrc, bool bAlphaChannel, int uFade)
-{
- if (bTransparent || bAlphaChannel || uFade < 255
- || (rcSrc.GetWidth() == rcDest.GetWidth() && rcSrc.GetHeight() == rcDest.GetHeight())) {
- BLENDFUNCTION ftn = { AC_SRC_OVER, 0, uFade, AC_SRC_ALPHA };
- ::AlphaBlend(hDC, rcDest.left, rcDest.top, rcDest.GetWidth(), rcDest.GetHeight(),
- hdcSrc, rcSrc.left, rcSrc.top, rcSrc.GetWidth(), rcSrc.GetHeight(), ftn);
- }
- else {
- ::StretchBlt(hDC, rcDest.left, rcDest.top, rcDest.GetWidth(), rcDest.GetHeight(),
- hdcSrc, rcSrc.left, rcSrc.top, rcSrc.GetWidth(), rcSrc.GetHeight(), SRCCOPY);
- }
-}
-
-RenderContext_GdiPlus::RenderContext_GdiPlus()
- : m_hDC(NULL)
- , m_hOldBitmap(NULL)
- , m_bTransparent(false)
-{
- HDC hDC = ::GetDC(NULL);
- m_hDC = ::CreateCompatibleDC(hDC);
- ::ReleaseDC(NULL, hDC);
- ASSERT(m_hDC);
-}
-
-RenderContext_GdiPlus::~RenderContext_GdiPlus()
-{
- if (m_hOldBitmap != NULL)
- {
- ::SelectObject(m_hDC, m_hOldBitmap);
- m_hOldBitmap = NULL;
- }
-
- if (m_hDC != NULL)
- {
- ::DeleteDC(m_hDC);
- m_hDC = NULL;
- }
-}
-
-HDC RenderContext_GdiPlus::GetDC()
-{
- return m_hDC;
-}
-
-bool RenderContext_GdiPlus::Resize(int width, int height, bool flipBItmap)
-{
- ASSERT(m_hDC);
- if (m_bitmap.GetWidth() == width && m_bitmap.GetHeight() == height)
- return false;
-
- if (m_hOldBitmap != NULL)
- {
- ::SelectObject(m_hDC, m_hOldBitmap);
- }
-
- bool ret = m_bitmap.Init(m_hDC, width, height, flipBItmap);
- m_hOldBitmap = (HBITMAP)::SelectObject(m_hDC, m_bitmap.GetBitmap());
- return ret;
-}
-
-void RenderContext_GdiPlus::Clear()
-{
- ASSERT(m_hDC);
- m_bitmap.Clear();
-}
-
-std::unique_ptr RenderContext_GdiPlus::Clone()
-{
- std::unique_ptr pClone = std::make_unique();
- pClone->Resize(GetWidth(), GetHeight());
- pClone->BitBlt(0, 0, GetWidth(), GetHeight(), m_hDC);
- return pClone;
-}
-
-HBITMAP RenderContext_GdiPlus::DetachBitmap()
-{
- ASSERT(m_hDC && m_hOldBitmap);
- ASSERT(m_bitmap.GetHeight() != 0 && m_bitmap.GetWidth() != 0);
- if (m_hOldBitmap == NULL)
- return NULL;
-
- ::SelectObject(m_hDC, m_hOldBitmap);
- return m_bitmap.DetachBitmap();
-}
-
-BYTE* RenderContext_GdiPlus::GetBits()
-{
- return m_bitmap.GetBits();
-}
-
-int RenderContext_GdiPlus::GetWidth()
-{
- return m_bitmap.GetWidth();
-}
-
-int RenderContext_GdiPlus::GetHeight()
-{
- return m_bitmap.GetHeight();
-}
-
-void RenderContext_GdiPlus::ClearAlpha(const UiRect& rcDirty, int alpha)
-{
- m_bitmap.ClearAlpha(rcDirty, alpha);
-}
-
-void RenderContext_GdiPlus::RestoreAlpha(const UiRect& rcDirty, const UiRect& rcShadowPadding, int alpha)
-{
- m_bitmap.RestoreAlpha(rcDirty, rcShadowPadding, alpha);
-}
-
-bool RenderContext_GdiPlus::IsRenderTransparent() const
-{
- return m_bTransparent;
-}
-
-bool RenderContext_GdiPlus::SetRenderTransparent(bool bTransparent)
-{
- bool oldValue = m_bTransparent;
- m_bTransparent = bTransparent;
- return oldValue;
-}
-
-void RenderContext_GdiPlus::Save()
-{
- m_saveDC = SaveDC(m_hDC);
-}
-
-void RenderContext_GdiPlus::Restore()
-{
- RestoreDC(m_hDC, m_saveDC);
-}
-
-CPoint RenderContext_GdiPlus::OffsetWindowOrg(CPoint ptOffset)
-{
- CPoint ptOldWindowOrg;
- GetWindowOrgEx(m_hDC, &ptOldWindowOrg);
- ptOffset.Offset(ptOldWindowOrg.x, ptOldWindowOrg.y);
- ::SetWindowOrgEx(m_hDC, ptOffset.x, ptOffset.y, NULL);
- return ptOldWindowOrg;
-}
-
-CPoint RenderContext_GdiPlus::SetWindowOrg(CPoint ptOffset)
-{
- CPoint ptOldWindowOrg;
- GetWindowOrgEx(m_hDC, &ptOldWindowOrg);
- ::SetWindowOrgEx(m_hDC, ptOffset.x, ptOffset.y, NULL);
- return ptOldWindowOrg;
-}
-
-CPoint RenderContext_GdiPlus::GetWindowOrg() const
-{
- CPoint ptWindowOrg;
- GetWindowOrgEx(m_hDC, &ptWindowOrg);
- return ptWindowOrg;
-}
-
-void RenderContext_GdiPlus::SetClip(const UiRect& rc)
-{
- m_clip.CreateClip(m_hDC, rc);
-}
-
-void RenderContext_GdiPlus::SetRoundClip(const UiRect& rc, int width, int height)
-{
- m_clip.CreateRoundClip(m_hDC, rc, width, height);
-}
-
-void RenderContext_GdiPlus::ClearClip()
-{
- m_clip.ClearClip(m_hDC);
-}
-
-HRESULT RenderContext_GdiPlus::BitBlt(int x, int y, int cx, int cy, HDC hdcSrc, int xSrc /*= 0*/, int yScr /*= 0*/, DWORD rop /*= SRCCOPY*/)
-{
- return ::BitBlt(m_hDC, x, y, cx, cy, hdcSrc, xSrc, yScr, rop);
-}
-
-bool RenderContext_GdiPlus::AlphaBlend(int xDest, int yDest, int widthDest, int heightDest, HDC hdcSrc, int xSrc, int yScr, int widthSrc, int heightSrc, BYTE uFade /*= 255*/)
-{
- BLENDFUNCTION bf = { AC_SRC_OVER, 0, uFade, AC_SRC_ALPHA };
- return (TRUE == ::AlphaBlend(m_hDC, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc, yScr, widthSrc, heightSrc, bf));
-}
-
-void RenderContext_GdiPlus::DrawImage(const UiRect& rcPaint, HBITMAP hBitmap, bool bAlphaChannel,
- const UiRect& rcImageDest, const UiRect& rcImageSource, const UiRect& rcCorners, BYTE uFade /*= 255*/, bool xtiled /*= false*/, bool ytiled /*= false*/)
-{
- UiRect rcTestTemp;
- if (!::IntersectRect(&rcTestTemp, &rcImageDest, &rcPaint)) return;
-
- ASSERT(::GetObjectType(m_hDC) == OBJ_DC || ::GetObjectType(m_hDC) == OBJ_MEMDC);
-
- if (hBitmap == NULL) return;
-
- HDC hCloneDC = ::CreateCompatibleDC(m_hDC);
- HBITMAP hOldBitmap = (HBITMAP) ::SelectObject(hCloneDC, hBitmap);
- int stretchBltMode = ::SetStretchBltMode(m_hDC, HALFTONE);
-
- UiRect rcTemp;
- UiRect rcSource;
- UiRect rcDest;
- UiRect rcDpiCorner = rcCorners;
- DpiManager::GetInstance()->ScaleRect(rcDpiCorner);
-
- // middle
- rcDest.left = rcImageDest.left + rcDpiCorner.left;
- rcDest.top = rcImageDest.top + rcDpiCorner.top;
- rcDest.right = rcImageDest.right - rcDpiCorner.right;
- rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcImageSource.right - rcCorners.right;
- rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- if (!xtiled && !ytiled) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- else if (xtiled && ytiled) {
- LONG lWidth = rcImageSource.right - rcImageSource.left - rcCorners.left - rcCorners.right;
- LONG lHeight = rcImageSource.bottom - rcImageSource.top - rcCorners.top - rcCorners.bottom;
- int iTimesX = (rcDest.right - rcDest.left + lWidth - 1) / lWidth;
- int iTimesY = (rcDest.bottom - rcDest.top + lHeight - 1) / lHeight;
- for (int j = 0; j < iTimesY; ++j) {
- LONG lDestTop = rcDest.top + lHeight * j;
- LONG lDestBottom = rcDest.top + lHeight * (j + 1);
- LONG lDrawHeight = lHeight;
- if (lDestBottom > rcDest.bottom) {
- lDrawHeight -= lDestBottom - rcDest.bottom;
- lDestBottom = rcDest.bottom;
- }
- for (int i = 0; i < iTimesX; ++i) {
- LONG lDestLeft = rcDest.left + lWidth * i;
- LONG lDestRight = rcDest.left + lWidth * (i + 1);
- LONG lDrawWidth = lWidth;
- if (lDestRight > rcDest.right) {
- lDrawWidth -= lDestRight - rcDest.right;
- lDestRight = rcDest.right;
- }
- rcDest.left = rcDest.left + lWidth * i;
- rcDest.top = rcDest.top + lHeight * j;
- rcDest.right = rcDest.left + lDestRight - lDestLeft;
- rcDest.bottom = rcDest.top + lDestBottom - lDestTop;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcSource.left + lDrawWidth;
- rcSource.bottom = rcSource.top + lDrawHeight;
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- }
- else if (xtiled) {
- LONG lWidth = rcImageSource.right - rcImageSource.left - rcCorners.left - rcCorners.right;
- int iTimes = (rcDest.right - rcDest.left + lWidth - 1) / lWidth;
- for (int i = 0; i < iTimes; ++i) {
- LONG lDestLeft = rcDest.left + lWidth * i;
- LONG lDestRight = rcDest.left + lWidth * (i + 1);
- LONG lDrawWidth = lWidth;
- if (lDestRight > rcDest.right) {
- lDrawWidth -= lDestRight - rcDest.right;
- lDestRight = rcDest.right;
- }
- rcDest.left = lDestLeft;
- rcDest.top = rcDest.top;
- rcDest.right = lDestRight;
- rcDest.bottom = rcDest.top + rcDest.bottom;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcSource.left + lDrawWidth;
- rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- else { // ytiled
- LONG lHeight = rcImageSource.bottom - rcImageSource.top - rcCorners.top - rcCorners.bottom;
- int iTimes = (rcDest.bottom - rcDest.top + lHeight - 1) / lHeight;
- for (int i = 0; i < iTimes; ++i) {
- LONG lDestTop = rcDest.top + lHeight * i;
- LONG lDestBottom = rcDest.top + lHeight * (i + 1);
- LONG lDrawHeight = lHeight;
- if (lDestBottom > rcDest.bottom) {
- lDrawHeight -= lDestBottom - rcDest.bottom;
- lDestBottom = rcDest.bottom;
- }
- rcDest.left = rcDest.left;
- rcDest.top = rcDest.top + lHeight * i;
- rcDest.right = rcDest.left + rcDest.right;
- rcDest.bottom = rcDest.top + lDestBottom - lDestTop;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcImageSource.right - rcCorners.right;
- rcSource.bottom = rcSource.top + lDrawHeight;
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- }
-
- // left-top
- if (rcCorners.left > 0 && rcCorners.top > 0) {
- rcDest.left = rcImageDest.left;
- rcDest.top = rcImageDest.top;
- rcDest.right = rcImageDest.left + rcDpiCorner.left;
- rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
- rcSource.left = rcImageSource.left;
- rcSource.top = rcImageSource.top;
- rcSource.right = rcImageSource.left + rcCorners.left;
- rcSource.bottom = rcImageSource.top + rcCorners.top;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // top
- if (rcCorners.top > 0) {
- rcDest.left = rcImageDest.left + rcDpiCorner.left;
- rcDest.top = rcImageDest.top;
- rcDest.right = rcImageDest.right - rcDpiCorner.right;
- rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.top;
- rcSource.right = rcImageSource.right - rcCorners.right;
- rcSource.bottom = rcImageSource.top + rcCorners.top;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // right-top
- if (rcCorners.right > 0 && rcCorners.top > 0) {
- rcDest.left = rcImageDest.right - rcDpiCorner.right;
- rcDest.top = rcImageDest.top;
- rcDest.right = rcImageDest.right;
- rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
- rcSource.left = rcImageSource.right - rcCorners.right;
- rcSource.top = rcImageSource.top;
- rcSource.right = rcImageSource.right;
- rcSource.bottom = rcImageSource.top + rcCorners.top;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // left
- if (rcCorners.left > 0) {
- rcDest.left = rcImageDest.left;
- rcDest.top = rcImageDest.top + rcDpiCorner.top;
- rcDest.right = rcImageDest.left + rcDpiCorner.left;
- rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
- rcSource.left = rcImageSource.left;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcImageSource.left + rcCorners.left;
- rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // right
- if (rcCorners.right > 0) {
- rcDest.left = rcImageDest.right - rcDpiCorner.right;
- rcDest.top = rcImageDest.top + rcDpiCorner.top;
- rcDest.right = rcImageDest.right;
- rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
- rcSource.left = rcImageSource.right - rcCorners.right;
- rcSource.top = rcImageSource.top + rcCorners.top;
- rcSource.right = rcImageSource.right;
- rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // left-bottom
- if (rcCorners.left > 0 && rcCorners.bottom > 0) {
- rcDest.left = rcImageDest.left;
- rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
- rcDest.right = rcImageDest.left + rcDpiCorner.left;
- rcDest.bottom = rcImageDest.bottom;
- rcSource.left = rcImageSource.left;
- rcSource.top = rcImageSource.bottom - rcCorners.bottom;
- rcSource.right = rcImageSource.left + rcCorners.left;
- rcSource.bottom = rcImageSource.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // bottom
- if (rcCorners.bottom > 0) {
- rcDest.left = rcImageDest.left + rcDpiCorner.left;
- rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
- rcDest.right = rcImageDest.right - rcDpiCorner.right;
- rcDest.bottom = rcImageDest.bottom;
- rcSource.left = rcImageSource.left + rcCorners.left;
- rcSource.top = rcImageSource.bottom - rcCorners.bottom;
- rcSource.right = rcImageSource.right - rcCorners.right;
- rcSource.bottom = rcImageSource.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
- // right-bottom
- if (rcCorners.right > 0 && rcCorners.bottom > 0) {
- rcDest.left = rcImageDest.right - rcDpiCorner.right;
- rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
- rcDest.right = rcImageDest.right;
- rcDest.bottom = rcImageDest.bottom;
- rcSource.left = rcImageSource.right - rcCorners.right;
- rcSource.top = rcImageSource.bottom - rcCorners.bottom;
- rcSource.right = rcImageSource.right;
- rcSource.bottom = rcImageSource.bottom;
- if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
- DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
- }
- }
-
- ::SetStretchBltMode(m_hDC, stretchBltMode);
- ::SelectObject(hCloneDC, hOldBitmap);
- ::DeleteDC(hCloneDC);
-}
-
-void RenderContext_GdiPlus::DrawColor(const UiRect& rc, DWORD dwColor, BYTE uFade)
-{
- DWORD dwNewColor = dwColor;
- if (uFade < 255) {
- int alpha = dwColor >> 24;
- dwNewColor = dwColor % 0xffffff;
- alpha *= double(uFade) / 255;
- dwNewColor += alpha << 24;
- }
-
- Gdiplus::Graphics graphics(m_hDC);
- Gdiplus::Color color(dwNewColor);
- Gdiplus::SolidBrush brush(color);
- Gdiplus::RectF rcFill(rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
- graphics.FillRectangle(&brush, rcFill);
-}
-
-void RenderContext_GdiPlus::DrawColor(const UiRect& rc, const std::wstring& colorStr, BYTE uFade)
-{
- if (colorStr.empty()) {
- return;
- }
-
- DWORD dwColor = GlobalManager::GetTextColor(colorStr);
- DrawColor(rc, dwColor, uFade);
-}
-
-void RenderContext_GdiPlus::DrawLine(const UiRect& rc, int nSize, DWORD dwPenColor)
-{
- Gdiplus::Graphics graphics(m_hDC);
- Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
- graphics.DrawLine(&pen, Gdiplus::Point(rc.left, rc.top), Gdiplus::Point(rc.right, rc.bottom));
-}
-
-void RenderContext_GdiPlus::DrawLine(const IPen* pen, int x1, int y1, int x2, int y2)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- graphics.DrawLine(((Pen_GdiPlus*)pen)->GetPen(), x1, y1, x2, y2);
-}
-
-void RenderContext_GdiPlus::DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- graphics.DrawBezier(((Pen_GdiPlus*)pen)->GetPen(), x1, y1, x2, y2, x3, y3, x4, y4);
-}
-
-void RenderContext_GdiPlus::DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor)
-{
- Gdiplus::Graphics graphics(m_hDC);
- Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
- graphics.DrawRectangle(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
-}
-
-
-void RenderContext_GdiPlus::DrawRoundRect(const UiRect& rc, const CSize& roundSize, int nSize, DWORD dwPenColor)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
-
- // ü±߿ʱȫһ
- // UiRect rcInflate = rc;
- // rcInflate.Inflate({ -1, -1, -1, -1 });
-
- Gdiplus::GraphicsPath pPath;
- pPath.AddArc(rc.left, rc.top, roundSize.cx, roundSize.cy, 180, 90);
- pPath.AddLine(rc.left + roundSize.cx, rc.top, rc.right - roundSize.cx, rc.top);
- pPath.AddArc(rc.right - roundSize.cx, rc.top, roundSize.cx, roundSize.cy, 270, 90);
- pPath.AddLine(rc.right, rc.top + roundSize.cy, rc.right, rc.bottom - roundSize.cy);
- pPath.AddArc(rc.right - roundSize.cx, rc.bottom - roundSize.cy, roundSize.cx, roundSize.cy, 0, 90);
- pPath.AddLine(rc.right - roundSize.cx, rc.bottom, rc.left + roundSize.cx, rc.bottom);
- pPath.AddArc(rc.left, rc.bottom - roundSize.cy, roundSize.cx, roundSize.cy, 90, 90);
- pPath.AddLine(rc.left, rc.bottom - roundSize.cy, rc.left, rc.top + roundSize.cy);
- pPath.CloseFigure();
-
- graphics.DrawPath(&pen, &pPath);
-}
-
-void RenderContext_GdiPlus::DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, const std::wstring& strFontId, UINT uStyle, BYTE uFade /*= 255*/, bool bLineLimit /*= false*/)
-{
- ASSERT(::GetObjectType(m_hDC) == OBJ_DC || ::GetObjectType(m_hDC) == OBJ_MEMDC);
- if (strText.empty()) return;
-
- Gdiplus::Graphics graphics(m_hDC);
- Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
- Gdiplus::RectF rcPaint((Gdiplus::REAL)rc.left, (Gdiplus::REAL)rc.top, (Gdiplus::REAL)(rc.right - rc.left), (Gdiplus::REAL)(rc.bottom - rc.top));
- int alpha = dwTextColor >> 24;
- uFade *= double(alpha) / 255;
- if (uFade == 255) {
- uFade = 254;
- }
- Gdiplus::SolidBrush tBrush(Gdiplus::Color(uFade, GetBValue(dwTextColor), GetGValue(dwTextColor), GetRValue(dwTextColor)));
-
- Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic();
- if ((uStyle & DT_END_ELLIPSIS) != 0) {
- stringFormat.SetTrimming(Gdiplus::StringTrimmingEllipsisCharacter);
- }
-
- int formatFlags = 0;
- if ((uStyle & DT_NOCLIP) != 0) {
- formatFlags |= Gdiplus::StringFormatFlagsNoClip;
- }
- if ((uStyle & DT_SINGLELINE) != 0) {
- formatFlags |= Gdiplus::StringFormatFlagsNoWrap;
- }
- if (bLineLimit) {
- formatFlags |= Gdiplus::StringFormatFlagsLineLimit;
- }
- stringFormat.SetFormatFlags(formatFlags);
-
- if ((uStyle & DT_LEFT) != 0) {
- stringFormat.SetAlignment(Gdiplus::StringAlignmentNear);
- }
- else if ((uStyle & DT_CENTER) != 0) {
- stringFormat.SetAlignment(Gdiplus::StringAlignmentCenter);
- }
- else if ((uStyle & DT_RIGHT) != 0) {
- stringFormat.SetAlignment(Gdiplus::StringAlignmentFar);
- }
- else {
- stringFormat.SetAlignment(Gdiplus::StringAlignmentNear);
- }
-
- if ((uStyle & DT_TOP) != 0) {
- stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear);
- }
- else if ((uStyle & DT_VCENTER) != 0) {
- TFontInfo* fontInfo = GlobalManager::GetTFontInfo(strFontId);
- if (fontInfo->sFontName == L"") {
- if (rcPaint.Height >= fontInfo->iSize + 2) {
- rcPaint.Offset(0, 1);
- }
- }
- stringFormat.SetLineAlignment(Gdiplus::StringAlignmentCenter);
- }
- else if ((uStyle & DT_BOTTOM) != 0) {
- stringFormat.SetLineAlignment(Gdiplus::StringAlignmentFar);
- }
- else {
- stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear);
- }
-
- graphics.DrawString(strText.c_str(), (int)strText.length(), &font, rcPaint, &stringFormat, &tBrush);
-}
-
-void RenderContext_GdiPlus::DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- Gdiplus::Pen pen(dwColor, nSize);
- graphics.DrawEllipse(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
-}
-
-void RenderContext_GdiPlus::FillEllipse(const UiRect& rc, DWORD dwColor)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- Gdiplus::SolidBrush brush(dwColor);
- graphics.FillEllipse(&brush, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
-}
-
-void RenderContext_GdiPlus::DrawPath(const IPath* path, const IPen* pen)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- graphics.DrawPath(((Pen_GdiPlus*)pen)->GetPen(), ((Path_Gdiplus*)path)->GetPath());
-}
-
-void RenderContext_GdiPlus::FillPath(const IPath* path, const IBrush* brush)
-{
- Gdiplus::Graphics graphics(m_hDC);
- graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- graphics.FillPath(((Brush_Gdiplus*)brush)->GetBrush(), ((Path_Gdiplus*)path)->GetPath());
-}
-
-ui::UiRect RenderContext_GdiPlus::MeasureText(const std::wstring& strText, const std::wstring& strFontId, UINT uStyle, int width /*= DUI_NOSET_VALUE*/)
-{
- Gdiplus::Graphics graphics(m_hDC);
- Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
- Gdiplus::RectF bounds;
-
- Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic();
- int formatFlags = 0;
- if ((uStyle & DT_SINGLELINE) != 0) {
- formatFlags |= Gdiplus::StringFormatFlagsNoWrap;
- }
- stringFormat.SetFormatFlags(formatFlags);
-
- if (width == DUI_NOSET_VALUE) {
- graphics.MeasureString(strText.c_str(), (int)strText.length(), &font, Gdiplus::PointF(), &stringFormat, &bounds);
- }
- else {
- Gdiplus::REAL height = 0;
- if ((uStyle & DT_SINGLELINE) != 0) {
- Gdiplus::RectF rcEmpty((Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)0);
- graphics.MeasureString(L"", 2, &font, rcEmpty, &stringFormat, &bounds);
- height = bounds.Height;
- }
- Gdiplus::RectF rcText((Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)width, height);
- graphics.MeasureString(strText.c_str(), (int)strText.length(), &font, rcText, &stringFormat, &bounds);
- }
-
- UiRect rc(int(bounds.GetLeft()), int(bounds.GetTop()), int(bounds.GetRight() + 1), int(bounds.GetBottom() + 1));
- return rc;
-}
-
-} // namespace ui
+#include "StdAfx.h"
+
+namespace ui {
+
+static inline void DrawFunction(HDC hDC, bool bTransparent, UiRect rcDest, HDC hdcSrc, UiRect rcSrc, bool bAlphaChannel, int uFade)
+{
+ if (bTransparent || bAlphaChannel || uFade < 255
+ || (rcSrc.GetWidth() == rcDest.GetWidth() && rcSrc.GetHeight() == rcDest.GetHeight())) {
+ BLENDFUNCTION ftn = { AC_SRC_OVER, 0, uFade, AC_SRC_ALPHA };
+ ::AlphaBlend(hDC, rcDest.left, rcDest.top, rcDest.GetWidth(), rcDest.GetHeight(),
+ hdcSrc, rcSrc.left, rcSrc.top, rcSrc.GetWidth(), rcSrc.GetHeight(), ftn);
+ }
+ else {
+ ::StretchBlt(hDC, rcDest.left, rcDest.top, rcDest.GetWidth(), rcDest.GetHeight(),
+ hdcSrc, rcSrc.left, rcSrc.top, rcSrc.GetWidth(), rcSrc.GetHeight(), SRCCOPY);
+ }
+}
+
+RenderContext_GdiPlus::RenderContext_GdiPlus()
+ : m_hDC(NULL)
+ , m_hOldBitmap(NULL)
+ , m_bTransparent(false)
+{
+ HDC hDC = ::GetDC(NULL);
+ m_hDC = ::CreateCompatibleDC(hDC);
+ ::ReleaseDC(NULL, hDC);
+ ASSERT(m_hDC);
+}
+
+RenderContext_GdiPlus::~RenderContext_GdiPlus()
+{
+ if (m_hOldBitmap != NULL)
+ {
+ ::SelectObject(m_hDC, m_hOldBitmap);
+ m_hOldBitmap = NULL;
+ }
+
+ if (m_hDC != NULL)
+ {
+ ::DeleteDC(m_hDC);
+ m_hDC = NULL;
+ }
+}
+
+HDC RenderContext_GdiPlus::GetDC()
+{
+ return m_hDC;
+}
+
+bool RenderContext_GdiPlus::Resize(int width, int height, bool flipBItmap)
+{
+ ASSERT(m_hDC);
+ if (m_bitmap.GetWidth() == width && m_bitmap.GetHeight() == height)
+ return false;
+
+ if (m_hOldBitmap != NULL)
+ {
+ ::SelectObject(m_hDC, m_hOldBitmap);
+ }
+
+ bool ret = m_bitmap.Init(m_hDC, width, height, flipBItmap);
+ m_hOldBitmap = (HBITMAP)::SelectObject(m_hDC, m_bitmap.GetBitmap());
+ return ret;
+}
+
+void RenderContext_GdiPlus::Clear()
+{
+ ASSERT(m_hDC);
+ m_bitmap.Clear();
+}
+
+std::unique_ptr RenderContext_GdiPlus::Clone()
+{
+ std::unique_ptr pClone = std::make_unique();
+ pClone->Resize(GetWidth(), GetHeight());
+ pClone->BitBlt(0, 0, GetWidth(), GetHeight(), m_hDC);
+ return pClone;
+}
+
+HBITMAP RenderContext_GdiPlus::DetachBitmap()
+{
+ ASSERT(m_hDC && m_hOldBitmap);
+ ASSERT(m_bitmap.GetHeight() != 0 && m_bitmap.GetWidth() != 0);
+ if (m_hOldBitmap == NULL)
+ return NULL;
+
+ ::SelectObject(m_hDC, m_hOldBitmap);
+ return m_bitmap.DetachBitmap();
+}
+
+BYTE* RenderContext_GdiPlus::GetBits()
+{
+ return m_bitmap.GetBits();
+}
+
+int RenderContext_GdiPlus::GetWidth()
+{
+ return m_bitmap.GetWidth();
+}
+
+int RenderContext_GdiPlus::GetHeight()
+{
+ return m_bitmap.GetHeight();
+}
+
+void RenderContext_GdiPlus::ClearAlpha(const UiRect& rcDirty, int alpha)
+{
+ m_bitmap.ClearAlpha(rcDirty, alpha);
+}
+
+void RenderContext_GdiPlus::RestoreAlpha(const UiRect& rcDirty, const UiRect& rcShadowPadding, int alpha)
+{
+ m_bitmap.RestoreAlpha(rcDirty, rcShadowPadding, alpha);
+}
+
+bool RenderContext_GdiPlus::IsRenderTransparent() const
+{
+ return m_bTransparent;
+}
+
+bool RenderContext_GdiPlus::SetRenderTransparent(bool bTransparent)
+{
+ bool oldValue = m_bTransparent;
+ m_bTransparent = bTransparent;
+ return oldValue;
+}
+
+void RenderContext_GdiPlus::Save()
+{
+ m_saveDC = SaveDC(m_hDC);
+}
+
+void RenderContext_GdiPlus::Restore()
+{
+ RestoreDC(m_hDC, m_saveDC);
+}
+
+CPoint RenderContext_GdiPlus::OffsetWindowOrg(CPoint ptOffset)
+{
+ CPoint ptOldWindowOrg;
+ GetWindowOrgEx(m_hDC, &ptOldWindowOrg);
+ ptOffset.Offset(ptOldWindowOrg.x, ptOldWindowOrg.y);
+ ::SetWindowOrgEx(m_hDC, ptOffset.x, ptOffset.y, NULL);
+ return ptOldWindowOrg;
+}
+
+CPoint RenderContext_GdiPlus::SetWindowOrg(CPoint ptOffset)
+{
+ CPoint ptOldWindowOrg;
+ GetWindowOrgEx(m_hDC, &ptOldWindowOrg);
+ ::SetWindowOrgEx(m_hDC, ptOffset.x, ptOffset.y, NULL);
+ return ptOldWindowOrg;
+}
+
+CPoint RenderContext_GdiPlus::GetWindowOrg() const
+{
+ CPoint ptWindowOrg;
+ GetWindowOrgEx(m_hDC, &ptWindowOrg);
+ return ptWindowOrg;
+}
+
+void RenderContext_GdiPlus::SetClip(const UiRect& rc)
+{
+ m_clip.CreateClip(m_hDC, rc);
+}
+
+void RenderContext_GdiPlus::SetRoundClip(const UiRect& rc, int width, int height)
+{
+ m_clip.CreateRoundClip(m_hDC, rc, width, height);
+}
+
+void RenderContext_GdiPlus::ClearClip()
+{
+ m_clip.ClearClip(m_hDC);
+}
+
+HRESULT RenderContext_GdiPlus::BitBlt(int x, int y, int cx, int cy, HDC hdcSrc, int xSrc /*= 0*/, int yScr /*= 0*/, DWORD rop /*= SRCCOPY*/)
+{
+ return ::BitBlt(m_hDC, x, y, cx, cy, hdcSrc, xSrc, yScr, rop);
+}
+
+bool RenderContext_GdiPlus::AlphaBlend(int xDest, int yDest, int widthDest, int heightDest, HDC hdcSrc, int xSrc, int yScr, int widthSrc, int heightSrc, BYTE uFade /*= 255*/)
+{
+ BLENDFUNCTION bf = { AC_SRC_OVER, 0, uFade, AC_SRC_ALPHA };
+ return (TRUE == ::AlphaBlend(m_hDC, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc, yScr, widthSrc, heightSrc, bf));
+}
+
+void RenderContext_GdiPlus::DrawImage(const UiRect& rcPaint, HBITMAP hBitmap, bool bAlphaChannel,
+ const UiRect& rcImageDest, const UiRect& rcImageSource, const UiRect& rcCorners, BYTE uFade /*= 255*/, bool xtiled /*= false*/, bool ytiled /*= false*/)
+{
+ UiRect rcTestTemp;
+ if (!::IntersectRect(&rcTestTemp, &rcImageDest, &rcPaint)) return;
+
+ ASSERT(::GetObjectType(m_hDC) == OBJ_DC || ::GetObjectType(m_hDC) == OBJ_MEMDC);
+
+ if (hBitmap == NULL) return;
+
+ HDC hCloneDC = ::CreateCompatibleDC(m_hDC);
+ HBITMAP hOldBitmap = (HBITMAP) ::SelectObject(hCloneDC, hBitmap);
+ int stretchBltMode = ::SetStretchBltMode(m_hDC, HALFTONE);
+
+ UiRect rcTemp;
+ UiRect rcSource;
+ UiRect rcDest;
+ UiRect rcDpiCorner = rcCorners;
+ DpiManager::GetInstance()->ScaleRect(rcDpiCorner);
+
+ // middle
+ rcDest.left = rcImageDest.left + rcDpiCorner.left;
+ rcDest.top = rcImageDest.top + rcDpiCorner.top;
+ rcDest.right = rcImageDest.right - rcDpiCorner.right;
+ rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcImageSource.right - rcCorners.right;
+ rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ if (!xtiled && !ytiled) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ else if (xtiled && ytiled) {
+ LONG lWidth = rcImageSource.right - rcImageSource.left - rcCorners.left - rcCorners.right;
+ LONG lHeight = rcImageSource.bottom - rcImageSource.top - rcCorners.top - rcCorners.bottom;
+ int iTimesX = (rcDest.right - rcDest.left + lWidth - 1) / lWidth;
+ int iTimesY = (rcDest.bottom - rcDest.top + lHeight - 1) / lHeight;
+ for (int j = 0; j < iTimesY; ++j) {
+ LONG lDestTop = rcDest.top + lHeight * j;
+ LONG lDestBottom = rcDest.top + lHeight * (j + 1);
+ LONG lDrawHeight = lHeight;
+ if (lDestBottom > rcDest.bottom) {
+ lDrawHeight -= lDestBottom - rcDest.bottom;
+ lDestBottom = rcDest.bottom;
+ }
+ for (int i = 0; i < iTimesX; ++i) {
+ LONG lDestLeft = rcDest.left + lWidth * i;
+ LONG lDestRight = rcDest.left + lWidth * (i + 1);
+ LONG lDrawWidth = lWidth;
+ if (lDestRight > rcDest.right) {
+ lDrawWidth -= lDestRight - rcDest.right;
+ lDestRight = rcDest.right;
+ }
+ rcDest.left = rcDest.left + lWidth * i;
+ rcDest.top = rcDest.top + lHeight * j;
+ rcDest.right = rcDest.left + lDestRight - lDestLeft;
+ rcDest.bottom = rcDest.top + lDestBottom - lDestTop;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcSource.left + lDrawWidth;
+ rcSource.bottom = rcSource.top + lDrawHeight;
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ }
+ else if (xtiled) {
+ LONG lWidth = rcImageSource.right - rcImageSource.left - rcCorners.left - rcCorners.right;
+ int iTimes = (rcDest.right - rcDest.left + lWidth - 1) / lWidth;
+ for (int i = 0; i < iTimes; ++i) {
+ LONG lDestLeft = rcDest.left + lWidth * i;
+ LONG lDestRight = rcDest.left + lWidth * (i + 1);
+ LONG lDrawWidth = lWidth;
+ if (lDestRight > rcDest.right) {
+ lDrawWidth -= lDestRight - rcDest.right;
+ lDestRight = rcDest.right;
+ }
+ rcDest.left = lDestLeft;
+ rcDest.top = rcDest.top;
+ rcDest.right = lDestRight;
+ rcDest.bottom = rcDest.top + rcDest.bottom;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcSource.left + lDrawWidth;
+ rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ else { // ytiled
+ LONG lHeight = rcImageSource.bottom - rcImageSource.top - rcCorners.top - rcCorners.bottom;
+ int iTimes = (rcDest.bottom - rcDest.top + lHeight - 1) / lHeight;
+ for (int i = 0; i < iTimes; ++i) {
+ LONG lDestTop = rcDest.top + lHeight * i;
+ LONG lDestBottom = rcDest.top + lHeight * (i + 1);
+ LONG lDrawHeight = lHeight;
+ if (lDestBottom > rcDest.bottom) {
+ lDrawHeight -= lDestBottom - rcDest.bottom;
+ lDestBottom = rcDest.bottom;
+ }
+ rcDest.left = rcDest.left;
+ rcDest.top = rcDest.top + lHeight * i;
+ rcDest.right = rcDest.left + rcDest.right;
+ rcDest.bottom = rcDest.top + lDestBottom - lDestTop;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcImageSource.right - rcCorners.right;
+ rcSource.bottom = rcSource.top + lDrawHeight;
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ }
+
+ // left-top
+ if (rcCorners.left > 0 && rcCorners.top > 0) {
+ rcDest.left = rcImageDest.left;
+ rcDest.top = rcImageDest.top;
+ rcDest.right = rcImageDest.left + rcDpiCorner.left;
+ rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
+ rcSource.left = rcImageSource.left;
+ rcSource.top = rcImageSource.top;
+ rcSource.right = rcImageSource.left + rcCorners.left;
+ rcSource.bottom = rcImageSource.top + rcCorners.top;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // top
+ if (rcCorners.top > 0) {
+ rcDest.left = rcImageDest.left + rcDpiCorner.left;
+ rcDest.top = rcImageDest.top;
+ rcDest.right = rcImageDest.right - rcDpiCorner.right;
+ rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.top;
+ rcSource.right = rcImageSource.right - rcCorners.right;
+ rcSource.bottom = rcImageSource.top + rcCorners.top;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // right-top
+ if (rcCorners.right > 0 && rcCorners.top > 0) {
+ rcDest.left = rcImageDest.right - rcDpiCorner.right;
+ rcDest.top = rcImageDest.top;
+ rcDest.right = rcImageDest.right;
+ rcDest.bottom = rcImageDest.top + rcDpiCorner.top;
+ rcSource.left = rcImageSource.right - rcCorners.right;
+ rcSource.top = rcImageSource.top;
+ rcSource.right = rcImageSource.right;
+ rcSource.bottom = rcImageSource.top + rcCorners.top;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // left
+ if (rcCorners.left > 0) {
+ rcDest.left = rcImageDest.left;
+ rcDest.top = rcImageDest.top + rcDpiCorner.top;
+ rcDest.right = rcImageDest.left + rcDpiCorner.left;
+ rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcSource.left = rcImageSource.left;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcImageSource.left + rcCorners.left;
+ rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // right
+ if (rcCorners.right > 0) {
+ rcDest.left = rcImageDest.right - rcDpiCorner.right;
+ rcDest.top = rcImageDest.top + rcDpiCorner.top;
+ rcDest.right = rcImageDest.right;
+ rcDest.bottom = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcSource.left = rcImageSource.right - rcCorners.right;
+ rcSource.top = rcImageSource.top + rcCorners.top;
+ rcSource.right = rcImageSource.right;
+ rcSource.bottom = rcImageSource.bottom - rcCorners.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // left-bottom
+ if (rcCorners.left > 0 && rcCorners.bottom > 0) {
+ rcDest.left = rcImageDest.left;
+ rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcDest.right = rcImageDest.left + rcDpiCorner.left;
+ rcDest.bottom = rcImageDest.bottom;
+ rcSource.left = rcImageSource.left;
+ rcSource.top = rcImageSource.bottom - rcCorners.bottom;
+ rcSource.right = rcImageSource.left + rcCorners.left;
+ rcSource.bottom = rcImageSource.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // bottom
+ if (rcCorners.bottom > 0) {
+ rcDest.left = rcImageDest.left + rcDpiCorner.left;
+ rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcDest.right = rcImageDest.right - rcDpiCorner.right;
+ rcDest.bottom = rcImageDest.bottom;
+ rcSource.left = rcImageSource.left + rcCorners.left;
+ rcSource.top = rcImageSource.bottom - rcCorners.bottom;
+ rcSource.right = rcImageSource.right - rcCorners.right;
+ rcSource.bottom = rcImageSource.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+ // right-bottom
+ if (rcCorners.right > 0 && rcCorners.bottom > 0) {
+ rcDest.left = rcImageDest.right - rcDpiCorner.right;
+ rcDest.top = rcImageDest.bottom - rcDpiCorner.bottom;
+ rcDest.right = rcImageDest.right;
+ rcDest.bottom = rcImageDest.bottom;
+ rcSource.left = rcImageSource.right - rcCorners.right;
+ rcSource.top = rcImageSource.bottom - rcCorners.bottom;
+ rcSource.right = rcImageSource.right;
+ rcSource.bottom = rcImageSource.bottom;
+ if (::IntersectRect(&rcTemp, &rcPaint, &rcDest)) {
+ DrawFunction(m_hDC, m_bTransparent, rcDest, hCloneDC, rcSource, bAlphaChannel, uFade);
+ }
+ }
+
+ ::SetStretchBltMode(m_hDC, stretchBltMode);
+ ::SelectObject(hCloneDC, hOldBitmap);
+ ::DeleteDC(hCloneDC);
+}
+
+void RenderContext_GdiPlus::DrawColor(const UiRect& rc, DWORD dwColor, BYTE uFade)
+{
+ DWORD dwNewColor = dwColor;
+ if (uFade < 255) {
+ int alpha = dwColor >> 24;
+ dwNewColor = dwColor % 0xffffff;
+ alpha *= double(uFade) / 255;
+ dwNewColor += alpha << 24;
+ }
+
+ Gdiplus::Graphics graphics(m_hDC);
+ Gdiplus::Color color(dwNewColor);
+ Gdiplus::SolidBrush brush(color);
+ Gdiplus::RectF rcFill(rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
+ graphics.FillRectangle(&brush, rcFill);
+}
+
+void RenderContext_GdiPlus::DrawColor(const UiRect& rc, const std::wstring& colorStr, BYTE uFade)
+{
+ if (colorStr.empty()) {
+ return;
+ }
+
+ DWORD dwColor = GlobalManager::GetTextColor(colorStr);
+ DrawColor(rc, dwColor, uFade);
+}
+
+void RenderContext_GdiPlus::DrawLine(const UiRect& rc, int nSize, DWORD dwPenColor)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
+ graphics.DrawLine(&pen, Gdiplus::Point(rc.left, rc.top), Gdiplus::Point(rc.right, rc.bottom));
+}
+
+void RenderContext_GdiPlus::DrawLine(const IPen* pen, int x1, int y1, int x2, int y2)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ graphics.DrawLine(((Pen_GdiPlus*)pen)->GetPen(), x1, y1, x2, y2);
+}
+
+void RenderContext_GdiPlus::DrawBezier(const IPen* pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ graphics.DrawBezier(((Pen_GdiPlus*)pen)->GetPen(), x1, y1, x2, y2, x3, y3, x4, y4);
+}
+
+void RenderContext_GdiPlus::DrawRect(const UiRect& rc, int nSize, DWORD dwPenColor)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
+ graphics.DrawRectangle(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
+}
+
+
+void RenderContext_GdiPlus::DrawRoundRect(const UiRect& rc, const CSize& roundSize, int nSize, DWORD dwPenColor)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::Pen pen(Gdiplus::Color(dwPenColor), (Gdiplus::REAL)nSize);
+
+ // ü±߿ʱȫһ
+ // UiRect rcInflate = rc;
+ // rcInflate.Inflate({ -1, -1, -1, -1 });
+
+ Gdiplus::GraphicsPath pPath;
+ pPath.AddArc(rc.left, rc.top, roundSize.cx, roundSize.cy, 180, 90);
+ pPath.AddLine(rc.left + roundSize.cx, rc.top, rc.right - roundSize.cx, rc.top);
+ pPath.AddArc(rc.right - roundSize.cx, rc.top, roundSize.cx, roundSize.cy, 270, 90);
+ pPath.AddLine(rc.right, rc.top + roundSize.cy, rc.right, rc.bottom - roundSize.cy);
+ pPath.AddArc(rc.right - roundSize.cx, rc.bottom - roundSize.cy, roundSize.cx, roundSize.cy, 0, 90);
+ pPath.AddLine(rc.right - roundSize.cx, rc.bottom, rc.left + roundSize.cx, rc.bottom);
+ pPath.AddArc(rc.left, rc.bottom - roundSize.cy, roundSize.cx, roundSize.cy, 90, 90);
+ pPath.AddLine(rc.left, rc.bottom - roundSize.cy, rc.left, rc.top + roundSize.cy);
+ pPath.CloseFigure();
+
+ graphics.DrawPath(&pen, &pPath);
+}
+
+void RenderContext_GdiPlus::DrawText(const UiRect& rc, const std::wstring& strText, DWORD dwTextColor, const std::wstring& strFontId, UINT uStyle, BYTE uFade /*= 255*/, bool bLineLimit /*= false*/)
+{
+ ASSERT(::GetObjectType(m_hDC) == OBJ_DC || ::GetObjectType(m_hDC) == OBJ_MEMDC);
+ if (strText.empty()) return;
+
+ Gdiplus::Graphics graphics(m_hDC);
+ Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
+ Gdiplus::RectF rcPaint((Gdiplus::REAL)rc.left, (Gdiplus::REAL)rc.top, (Gdiplus::REAL)(rc.right - rc.left), (Gdiplus::REAL)(rc.bottom - rc.top));
+ int alpha = dwTextColor >> 24;
+ uFade *= double(alpha) / 255;
+ if (uFade == 255) {
+ uFade = 254;
+ }
+ Gdiplus::SolidBrush tBrush(Gdiplus::Color(uFade, GetBValue(dwTextColor), GetGValue(dwTextColor), GetRValue(dwTextColor)));
+
+ Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic();
+ if ((uStyle & DT_END_ELLIPSIS) != 0) {
+ stringFormat.SetTrimming(Gdiplus::StringTrimmingEllipsisCharacter);
+ }
+
+ int formatFlags = 0;
+ if ((uStyle & DT_NOCLIP) != 0) {
+ formatFlags |= Gdiplus::StringFormatFlagsNoClip;
+ }
+ if ((uStyle & DT_SINGLELINE) != 0) {
+ formatFlags |= Gdiplus::StringFormatFlagsNoWrap;
+ }
+ if (bLineLimit) {
+ formatFlags |= Gdiplus::StringFormatFlagsLineLimit;
+ }
+ stringFormat.SetFormatFlags(formatFlags);
+
+ if ((uStyle & DT_LEFT) != 0) {
+ stringFormat.SetAlignment(Gdiplus::StringAlignmentNear);
+ }
+ else if ((uStyle & DT_CENTER) != 0) {
+ stringFormat.SetAlignment(Gdiplus::StringAlignmentCenter);
+ }
+ else if ((uStyle & DT_RIGHT) != 0) {
+ stringFormat.SetAlignment(Gdiplus::StringAlignmentFar);
+ }
+ else {
+ stringFormat.SetAlignment(Gdiplus::StringAlignmentNear);
+ }
+
+ if ((uStyle & DT_TOP) != 0) {
+ stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear);
+ }
+ else if ((uStyle & DT_VCENTER) != 0) {
+ TFontInfo* fontInfo = GlobalManager::GetTFontInfo(strFontId);
+ if (fontInfo->sFontName == L"") {
+ if (rcPaint.Height >= fontInfo->iSize + 2) {
+ rcPaint.Offset(0, 1);
+ }
+ }
+ stringFormat.SetLineAlignment(Gdiplus::StringAlignmentCenter);
+ }
+ else if ((uStyle & DT_BOTTOM) != 0) {
+ stringFormat.SetLineAlignment(Gdiplus::StringAlignmentFar);
+ }
+ else {
+ stringFormat.SetLineAlignment(Gdiplus::StringAlignmentNear);
+ }
+
+ graphics.DrawString(strText.c_str(), (int)strText.length(), &font, rcPaint, &stringFormat, &tBrush);
+}
+
+void RenderContext_GdiPlus::DrawEllipse(const UiRect& rc, int nSize, DWORD dwColor)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::Pen pen(dwColor, nSize);
+ graphics.DrawEllipse(&pen, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
+}
+
+void RenderContext_GdiPlus::FillEllipse(const UiRect& rc, DWORD dwColor)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::SolidBrush brush(dwColor);
+ graphics.FillEllipse(&brush, rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
+}
+
+void RenderContext_GdiPlus::DrawPath(const IPath* path, const IPen* pen)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ graphics.DrawPath(((Pen_GdiPlus*)pen)->GetPen(), ((Path_Gdiplus*)path)->GetPath());
+}
+
+void RenderContext_GdiPlus::FillPath(const IPath* path, const IBrush* brush)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ graphics.FillPath(((Brush_Gdiplus*)brush)->GetBrush(), ((Path_Gdiplus*)path)->GetPath());
+}
+
+ui::UiRect RenderContext_GdiPlus::MeasureText(const std::wstring& strText, const std::wstring& strFontId, UINT uStyle, int width /*= DUI_NOSET_VALUE*/)
+{
+ Gdiplus::Graphics graphics(m_hDC);
+ Gdiplus::Font font(m_hDC, GlobalManager::GetFont(strFontId));
+ Gdiplus::RectF bounds;
+
+ Gdiplus::StringFormat stringFormat = Gdiplus::StringFormat::GenericTypographic();
+ int formatFlags = 0;
+ if ((uStyle & DT_SINGLELINE) != 0) {
+ formatFlags |= Gdiplus::StringFormatFlagsNoWrap;
+ }
+ stringFormat.SetFormatFlags(formatFlags);
+
+ if (width == DUI_NOSET_VALUE) {
+ graphics.MeasureString(strText.c_str(), (int)strText.length(), &font, Gdiplus::PointF(), &stringFormat, &bounds);
+ }
+ else {
+ Gdiplus::REAL height = 0;
+ if ((uStyle & DT_SINGLELINE) != 0) {
+ Gdiplus::RectF rcEmpty((Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)0);
+ graphics.MeasureString(L"", 2, &font, rcEmpty, &stringFormat, &bounds);
+ height = bounds.Height;
+ }
+ Gdiplus::RectF rcText((Gdiplus::REAL)0, (Gdiplus::REAL)0, (Gdiplus::REAL)width, height);
+ graphics.MeasureString(strText.c_str(), (int)strText.length(), &font, rcText, &stringFormat, &bounds);
+ }
+
+ UiRect rc(int(bounds.GetLeft()), int(bounds.GetTop()), int(bounds.GetRight() + 1), int(bounds.GetBottom() + 1));
+ return rc;
+}
+
+} // namespace ui
diff --git a/tool_kits/duilib/Render/Render.h b/duilib/Render/Render.h
similarity index 100%
rename from tool_kits/duilib/Render/Render.h
rename to duilib/Render/Render.h
diff --git a/tool_kits/duilib/StdAfx.cpp b/duilib/StdAfx.cpp
similarity index 100%
rename from tool_kits/duilib/StdAfx.cpp
rename to duilib/StdAfx.cpp
diff --git a/tool_kits/duilib/StdAfx.h b/duilib/StdAfx.h
similarity index 100%
rename from tool_kits/duilib/StdAfx.h
rename to duilib/StdAfx.h
diff --git a/tool_kits/duilib/UIlib.cpp b/duilib/UIlib.cpp
similarity index 100%
rename from tool_kits/duilib/UIlib.cpp
rename to duilib/UIlib.cpp
diff --git a/tool_kits/duilib/UIlib.h b/duilib/UIlib.h
similarity index 100%
rename from tool_kits/duilib/UIlib.h
rename to duilib/UIlib.h
diff --git a/tool_kits/duilib/Utils/ApiWrapper.cpp b/duilib/Utils/ApiWrapper.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/ApiWrapper.cpp
rename to duilib/Utils/ApiWrapper.cpp
diff --git a/tool_kits/duilib/Utils/ApiWrapper.h b/duilib/Utils/ApiWrapper.h
similarity index 100%
rename from tool_kits/duilib/Utils/ApiWrapper.h
rename to duilib/Utils/ApiWrapper.h
diff --git a/tool_kits/duilib/Utils/Delegate.h b/duilib/Utils/Delegate.h
similarity index 100%
rename from tool_kits/duilib/Utils/Delegate.h
rename to duilib/Utils/Delegate.h
diff --git a/tool_kits/duilib/Utils/DpiManager.cpp b/duilib/Utils/DpiManager.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/DpiManager.cpp
rename to duilib/Utils/DpiManager.cpp
diff --git a/tool_kits/duilib/Utils/DpiManager.h b/duilib/Utils/DpiManager.h
similarity index 100%
rename from tool_kits/duilib/Utils/DpiManager.h
rename to duilib/Utils/DpiManager.h
diff --git a/tool_kits/duilib/Utils/Macros.h b/duilib/Utils/Macros.h
similarity index 100%
rename from tool_kits/duilib/Utils/Macros.h
rename to duilib/Utils/Macros.h
diff --git a/tool_kits/duilib/Utils/MultiLangSupport.cpp b/duilib/Utils/MultiLangSupport.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/MultiLangSupport.cpp
rename to duilib/Utils/MultiLangSupport.cpp
diff --git a/tool_kits/duilib/Utils/MultiLangSupport.h b/duilib/Utils/MultiLangSupport.h
similarity index 100%
rename from tool_kits/duilib/Utils/MultiLangSupport.h
rename to duilib/Utils/MultiLangSupport.h
diff --git a/tool_kits/duilib/Utils/OnScreenKeyboardManager.cpp b/duilib/Utils/OnScreenKeyboardManager.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/OnScreenKeyboardManager.cpp
rename to duilib/Utils/OnScreenKeyboardManager.cpp
diff --git a/tool_kits/duilib/Utils/OnScreenKeyboardManager.h b/duilib/Utils/OnScreenKeyboardManager.h
similarity index 100%
rename from tool_kits/duilib/Utils/OnScreenKeyboardManager.h
rename to duilib/Utils/OnScreenKeyboardManager.h
diff --git a/tool_kits/duilib/Utils/Shadow.cpp b/duilib/Utils/Shadow.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/Shadow.cpp
rename to duilib/Utils/Shadow.cpp
diff --git a/tool_kits/duilib/Utils/Shadow.h b/duilib/Utils/Shadow.h
similarity index 100%
rename from tool_kits/duilib/Utils/Shadow.h
rename to duilib/Utils/Shadow.h
diff --git a/tool_kits/duilib/Utils/StringUtil.cpp b/duilib/Utils/StringUtil.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/StringUtil.cpp
rename to duilib/Utils/StringUtil.cpp
diff --git a/tool_kits/duilib/Utils/StringUtil.h b/duilib/Utils/StringUtil.h
similarity index 100%
rename from tool_kits/duilib/Utils/StringUtil.h
rename to duilib/Utils/StringUtil.h
diff --git a/tool_kits/duilib/Utils/TimerManager.cpp b/duilib/Utils/TimerManager.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/TimerManager.cpp
rename to duilib/Utils/TimerManager.cpp
diff --git a/tool_kits/duilib/Utils/TimerManager.h b/duilib/Utils/TimerManager.h
similarity index 100%
rename from tool_kits/duilib/Utils/TimerManager.h
rename to duilib/Utils/TimerManager.h
diff --git a/tool_kits/duilib/Utils/UnZip.cpp b/duilib/Utils/UnZip.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/UnZip.cpp
rename to duilib/Utils/UnZip.cpp
diff --git a/tool_kits/duilib/Utils/UnZip.h b/duilib/Utils/UnZip.h
similarity index 100%
rename from tool_kits/duilib/Utils/UnZip.h
rename to duilib/Utils/UnZip.h
diff --git a/tool_kits/duilib/Utils/Utils.h b/duilib/Utils/Utils.h
similarity index 100%
rename from tool_kits/duilib/Utils/Utils.h
rename to duilib/Utils/Utils.h
diff --git a/tool_kits/duilib/Utils/VersionHelpers.h b/duilib/Utils/VersionHelpers.h
similarity index 100%
rename from tool_kits/duilib/Utils/VersionHelpers.h
rename to duilib/Utils/VersionHelpers.h
diff --git a/tool_kits/duilib/Utils/WinImplBase.cpp b/duilib/Utils/WinImplBase.cpp
similarity index 100%
rename from tool_kits/duilib/Utils/WinImplBase.cpp
rename to duilib/Utils/WinImplBase.cpp
diff --git a/tool_kits/duilib/Utils/WinImplBase.h b/duilib/Utils/WinImplBase.h
similarity index 100%
rename from tool_kits/duilib/Utils/WinImplBase.h
rename to duilib/Utils/WinImplBase.h
diff --git a/tool_kits/duilib/Utils/flash11.tlh b/duilib/Utils/flash11.tlh
similarity index 100%
rename from tool_kits/duilib/Utils/flash11.tlh
rename to duilib/Utils/flash11.tlh
diff --git a/tool_kits/duilib/duilib.sln b/duilib/duilib.sln
similarity index 100%
rename from tool_kits/duilib/duilib.sln
rename to duilib/duilib.sln
diff --git a/tool_kits/duilib/duilib.vcxproj b/duilib/duilib.vcxproj
similarity index 96%
rename from tool_kits/duilib/duilib.vcxproj
rename to duilib/duilib.vcxproj
index 6177fdf3..aab42c50 100644
--- a/tool_kits/duilib/duilib.vcxproj
+++ b/duilib/duilib.vcxproj
@@ -1,422 +1,422 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}
- duilib
-
-
-
- StaticLibrary
- false
- Unicode
- v120_xp
-
-
- StaticLibrary
- false
- Unicode
- v120_xp
-
-
- StaticLibrary
- false
- Unicode
- v120_xp
-
-
- StaticLibrary
- false
- Unicode
- v120_xp
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.40219.1
- $(ProjectDir)..\..\libs\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
- false
- false
- false
- false
- false
- false
- $(ProjectDir)..\..\libs\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
- false
- false
- false
- false
- false
- false
- AllRules.ruleset
- AllRules.ruleset
-
-
-
-
- AllRules.ruleset
- AllRules.ruleset
-
-
-
-
- $(ProjectName)_d
- $(ProjectName)_d
-
-
- $(ProjectDir)..\..\libs\x64\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
-
-
- $(ProjectDir)..\..\libs\x64\
- $(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
-
-
-
- _DEBUG;%(PreprocessorDefinitions)
- true
- true
- Win32
- .\Debug/duilib.tlb
-
-
-
-
- Disabled
- .\;..\;%(AdditionalIncludeDirectories)
- WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
- true
- EnableFastChecks
- MultiThreadedDebug
- Use
- stdafx.h
- $(IntDir)$(TargetName).pch
- Level4
- true
- EditAndContinue
- false
- 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
-
-
- _DEBUG;%(PreprocessorDefinitions)
- 0x0409
-
-
- $(ProjectDir)..\..\..\bin\$(ProjectName)_d.dll
- true
- %(AdditionalLibraryDirectories)
- %(DelayLoadDLLs)
- true
- $(ProjectDir)..\..\..\bin\$(TargetName).pdb
- 0x11000000
- $(ProjectDir)..\..\..\libs\duilib_d.lib
- MachineX86
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
-
-
- true
- .\Debug/duilib.bsc
-
-
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
- /IGNORE:4006,4221 %(AdditionalOptions)
-
-
-
-
- _DEBUG;%(PreprocessorDefinitions)
- true
- true
- .\Debug/duilib.tlb
-
-
-
-
- Disabled
- .\;..\;%(AdditionalIncludeDirectories)
- WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
- EnableFastChecks
- MultiThreadedDebug
- Use
- stdafx.h
- $(IntDir)$(TargetName).pch
- Level4
- true
- ProgramDatabase
- false
- 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
-
-
- _DEBUG;%(PreprocessorDefinitions)
- 0x0409
-
-
- $(ProjectDir)..\..\..\bin\$(ProjectName)_d.dll
- true
- %(AdditionalLibraryDirectories)
- %(DelayLoadDLLs)
- true
- $(ProjectDir)..\..\..\bin\$(TargetName).pdb
- 0x11000000
- $(ProjectDir)..\..\..\libs\duilib_d.lib
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
-
-
- true
- .\Debug/duilib.bsc
-
-
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
- /IGNORE:4006,4221 %(AdditionalOptions)
-
-
-
-
- NDEBUG;%(PreprocessorDefinitions)
- true
- true
- Win32
- .\Release/duilib.tlb
-
-
-
-
- MaxSpeed
- Default
- .\;..\;%(AdditionalIncludeDirectories)
- WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
- true
- true
- Use
- $(IntDir)$(TargetName).pch
- Level4
- true
- true
- true
- MultiThreaded
- 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
-
-
- NDEBUG;%(PreprocessorDefinitions)
- 0x0406
-
-
- $(ProjectDir)..\..\..\bin\$(ProjectName).dll
- true
- %(AdditionalLibraryDirectories)
- %(DelayLoadDLLs)
- 0x11000000
- $(ProjectDir)..\..\..\libs\duilib.lib
- MachineX86
- $(ProjectDir)..\..\..\bin\$(TargetName).pdb
- true
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
-
-
- true
- .\Release/duilib.bsc
-
-
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
- /IGNORE:4006,4221 %(AdditionalOptions)
-
-
-
-
- NDEBUG;%(PreprocessorDefinitions)
- true
- true
- .\Release/duilib.tlb
-
-
-
-
- MaxSpeed
- Default
- .\;..\;%(AdditionalIncludeDirectories)
- WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
- true
- true
- Use
- $(IntDir)$(TargetName).pch
- Level4
- true
- true
- true
- MultiThreaded
- 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
-
-
- NDEBUG;%(PreprocessorDefinitions)
- 0x0406
-
-
- $(ProjectDir)..\..\..\bin\$(ProjectName).dll
- true
- %(AdditionalLibraryDirectories)
- %(DelayLoadDLLs)
- 0x11000000
- $(ProjectDir)..\..\..\libs\duilib.lib
- $(ProjectDir)..\..\..\bin\$(TargetName).pdb
- true
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
-
-
- true
- .\Release/duilib.bsc
-
-
- comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
- /IGNORE:4006,4221 %(AdditionalOptions)
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Create
- Create
- Create
- Create
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}
+ duilib
+
+
+
+ StaticLibrary
+ false
+ Unicode
+ v120_xp
+
+
+ StaticLibrary
+ false
+ Unicode
+ v120_xp
+
+
+ StaticLibrary
+ false
+ Unicode
+ v120_xp
+
+
+ StaticLibrary
+ false
+ Unicode
+ v120_xp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.40219.1
+ $(ProjectDir)..\libs\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ false
+ false
+ false
+ false
+ false
+ false
+ $(ProjectDir)..\libs\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+ false
+ false
+ false
+ false
+ false
+ false
+ AllRules.ruleset
+ AllRules.ruleset
+
+
+
+
+ AllRules.ruleset
+ AllRules.ruleset
+
+
+
+
+ $(ProjectName)_d
+ $(ProjectName)_d
+
+
+ $(ProjectDir)..\libs\x64\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+
+
+ $(ProjectDir)..\libs\x64\
+ $(ProjectDir)..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\Debug/duilib.tlb
+
+
+
+
+ Disabled
+ .\;..\;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebug
+ Use
+ stdafx.h
+ $(IntDir)$(TargetName).pch
+ Level4
+ true
+ EditAndContinue
+ false
+ 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ $(ProjectDir)..\..\..\bin\$(ProjectName)_d.dll
+ true
+ %(AdditionalLibraryDirectories)
+ %(DelayLoadDLLs)
+ true
+ $(ProjectDir)..\..\..\bin\$(TargetName).pdb
+ 0x11000000
+ $(ProjectDir)..\..\..\libs\duilib_d.lib
+ MachineX86
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Debug/duilib.bsc
+
+
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
+ /IGNORE:4006,4221 %(AdditionalOptions)
+
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ .\Debug/duilib.tlb
+
+
+
+
+ Disabled
+ .\;..\;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ EnableFastChecks
+ MultiThreadedDebug
+ Use
+ stdafx.h
+ $(IntDir)$(TargetName).pch
+ Level4
+ true
+ ProgramDatabase
+ false
+ 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ $(ProjectDir)..\..\..\bin\$(ProjectName)_d.dll
+ true
+ %(AdditionalLibraryDirectories)
+ %(DelayLoadDLLs)
+ true
+ $(ProjectDir)..\..\..\bin\$(TargetName).pdb
+ 0x11000000
+ $(ProjectDir)..\..\..\libs\duilib_d.lib
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Debug/duilib.bsc
+
+
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
+ /IGNORE:4006,4221 %(AdditionalOptions)
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\Release/duilib.tlb
+
+
+
+
+ MaxSpeed
+ Default
+ .\;..\;%(AdditionalIncludeDirectories)
+ WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ true
+ true
+ Use
+ $(IntDir)$(TargetName).pch
+ Level4
+ true
+ true
+ true
+ MultiThreaded
+ 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0406
+
+
+ $(ProjectDir)..\..\..\bin\$(ProjectName).dll
+ true
+ %(AdditionalLibraryDirectories)
+ %(DelayLoadDLLs)
+ 0x11000000
+ $(ProjectDir)..\..\..\libs\duilib.lib
+ MachineX86
+ $(ProjectDir)..\..\..\bin\$(TargetName).pdb
+ true
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Release/duilib.bsc
+
+
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
+ /IGNORE:4006,4221 %(AdditionalOptions)
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ .\Release/duilib.tlb
+
+
+
+
+ MaxSpeed
+ Default
+ .\;..\;%(AdditionalIncludeDirectories)
+ WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ true
+ true
+ Use
+ $(IntDir)$(TargetName).pch
+ Level4
+ true
+ true
+ true
+ MultiThreaded
+ 4100;4121;4127;4244;4310;4355;4481;4505;4512;4702;%(DisableSpecificWarnings)
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0406
+
+
+ $(ProjectDir)..\..\..\bin\$(ProjectName).dll
+ true
+ %(AdditionalLibraryDirectories)
+ %(DelayLoadDLLs)
+ 0x11000000
+ $(ProjectDir)..\..\..\libs\duilib.lib
+ $(ProjectDir)..\..\..\bin\$(TargetName).pdb
+ true
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;%(AdditionalDependencies)
+
+
+ true
+ .\Release/duilib.bsc
+
+
+ comctl32.lib;gdiplus.lib;msimg32.lib;winmm.lib;imm32.lib;shlwapi.lib
+ /IGNORE:4006,4221 %(AdditionalOptions)
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tool_kits/duilib/duilib.vcxproj.filters b/duilib/duilib.vcxproj.filters
similarity index 97%
rename from tool_kits/duilib/duilib.vcxproj.filters
rename to duilib/duilib.vcxproj.filters
index ab7a238e..219366eb 100644
--- a/tool_kits/duilib/duilib.vcxproj.filters
+++ b/duilib/duilib.vcxproj.filters
@@ -1,347 +1,347 @@
-
-
-
-
- {8fc45193-00aa-405d-8445-6f6619d94834}
- cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
-
-
- {b7a95a7b-1188-487e-b75b-a6e6fe6055f7}
-
-
- {ef45879d-87a5-4d7f-9a92-fdf97778b304}
-
-
- {f70f6171-d9fd-4189-b1d7-5250e2d6f0fd}
-
-
- {b7a7aeb7-2adb-4395-b80d-4922bd4efc19}
- h;hpp;hxx;hm;inl
-
-
- {3472fe0b-1976-4ada-9c67-2f07b06068d2}
-
-
- {1a8a45f1-b601-4178-b118-b282f71c4dec}
-
-
- {6eb00376-1e2b-4faf-9eaa-bdc915049307}
-
-
- {38a8cc27-53b9-4413-8919-ae7448229ad2}
-
-
- {101719c8-36d9-454c-be9a-d0f158cf21b4}
-
-
- {4f978102-2279-42b9-ab99-8a719e9fdf53}
-
-
- {2069d257-49fd-4283-9999-19e7dda732c8}
-
-
- {ab59d168-e65b-4cf4-aff6-a2a07e35d058}
-
-
- {93308611-e7ba-4331-845a-700f5b457c52}
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files\Utils
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Control
-
-
- Source Files\Core
-
-
- Source Files\Core
-
-
- Source Files\Utils
-
-
- Source Files\Core
-
-
- Source Files\Core
-
-
- Source Files\Core
-
-
- Source Files\Box
-
-
- Source Files\Box
-
-
- Source Files\Box
-
-
- Source Files\Box
-
-
- Source Files\Box
-
-
- Source Files\Utils
-
-
- Source Files\Animation
-
-
- Source Files\Core
-
-
- Source Files\Utils
-
-
- Source Files\Core
-
-
- Source Files\Animation
-
-
- Source Files\Utils
-
-
- Source Files\Core
-
-
- Source Files\Utils
-
-
- Source Files\Control
-
-
- Source Files\Utils
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Utils
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Render
-
-
- Source Files\Utils
-
-
- Source Files\Control
-
-
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Control
-
-
- Header Files\Core
-
-
- Header Files\Core
-
-
- Header Files\Core
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Core
-
-
- Header Files\Core
-
-
- Header Files\Core
-
-
- Header Files\Box
-
-
- Header Files\Box
-
-
- Header Files\Box
-
-
- Header Files\Box
-
-
- Header Files\Box
-
-
- Header Files\Animation
-
-
- Header Files\Core
-
-
- Header Files\Utils
-
-
- Header Files\Core
-
-
- Header Files\Animation
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Utils
-
-
- Header Files\Control
-
-
- Header Files\Utils
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Utils
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Render
-
-
- Header Files\Utils
-
-
- Header Files\Control
-
-
+
+
+
+
+ {8fc45193-00aa-405d-8445-6f6619d94834}
+ cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
+
+
+ {b7a95a7b-1188-487e-b75b-a6e6fe6055f7}
+
+
+ {ef45879d-87a5-4d7f-9a92-fdf97778b304}
+
+
+ {f70f6171-d9fd-4189-b1d7-5250e2d6f0fd}
+
+
+ {b7a7aeb7-2adb-4395-b80d-4922bd4efc19}
+ h;hpp;hxx;hm;inl
+
+
+ {3472fe0b-1976-4ada-9c67-2f07b06068d2}
+
+
+ {1a8a45f1-b601-4178-b118-b282f71c4dec}
+
+
+ {6eb00376-1e2b-4faf-9eaa-bdc915049307}
+
+
+ {38a8cc27-53b9-4413-8919-ae7448229ad2}
+
+
+ {101719c8-36d9-454c-be9a-d0f158cf21b4}
+
+
+ {4f978102-2279-42b9-ab99-8a719e9fdf53}
+
+
+ {2069d257-49fd-4283-9999-19e7dda732c8}
+
+
+ {ab59d168-e65b-4cf4-aff6-a2a07e35d058}
+
+
+ {93308611-e7ba-4331-845a-700f5b457c52}
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files\Utils
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Control
+
+
+ Source Files\Core
+
+
+ Source Files\Core
+
+
+ Source Files\Utils
+
+
+ Source Files\Core
+
+
+ Source Files\Core
+
+
+ Source Files\Core
+
+
+ Source Files\Box
+
+
+ Source Files\Box
+
+
+ Source Files\Box
+
+
+ Source Files\Box
+
+
+ Source Files\Box
+
+
+ Source Files\Utils
+
+
+ Source Files\Animation
+
+
+ Source Files\Core
+
+
+ Source Files\Utils
+
+
+ Source Files\Core
+
+
+ Source Files\Animation
+
+
+ Source Files\Utils
+
+
+ Source Files\Core
+
+
+ Source Files\Utils
+
+
+ Source Files\Control
+
+
+ Source Files\Utils
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Utils
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Render
+
+
+ Source Files\Utils
+
+
+ Source Files\Control
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Control
+
+
+ Header Files\Core
+
+
+ Header Files\Core
+
+
+ Header Files\Core
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Core
+
+
+ Header Files\Core
+
+
+ Header Files\Core
+
+
+ Header Files\Box
+
+
+ Header Files\Box
+
+
+ Header Files\Box
+
+
+ Header Files\Box
+
+
+ Header Files\Box
+
+
+ Header Files\Animation
+
+
+ Header Files\Core
+
+
+ Header Files\Utils
+
+
+ Header Files\Core
+
+
+ Header Files\Animation
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Utils
+
+
+ Header Files\Control
+
+
+ Header Files\Utils
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Utils
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Render
+
+
+ Header Files\Utils
+
+
+ Header Files\Control
+
+
\ No newline at end of file
diff --git a/samples/README.md b/examples/README.md
similarity index 95%
rename from samples/README.md
rename to examples/README.md
index a8063264..e54aa7f4 100644
--- a/samples/README.md
+++ b/examples/README.md
@@ -8,6 +8,7 @@
- `layouts` 包含一个登录窗口和一个模拟微信 PC 聊天布局的窗口示例
- `multi_browser` 基于 CEF 的自定义多标签可拖曳浏览器示例
- `richlist` 演示了一个列表控件中插入自定义列表项的用法
+ - `virtualbox` 演示了多列虚拟列表的使用
## Demos
@@ -16,4 +17,3 @@
- [NetEase IM Demo](https://github.com/netease-im/NIM_PC_Demo)
- [NetEase Interact Live Demo](https://yx-web-nosdn.netease.im/package/1542889389/NIM_InteractLive_PC_Demo_v2.9.0.zip?download=NIM_InteractLive_PC_Demo_v2.9.0.zip)
- [NetEase Education Demo](https://yx-web-nosdn.netease.im/package/1537445692/NIM_Education_PC_Demo_v2.3.0.zip?download=NIM_Education_PC_Demo_v2.3.0.zip)
-
\ No newline at end of file
diff --git a/samples/basic/basic.ico b/examples/basic/basic.ico
similarity index 100%
rename from samples/basic/basic.ico
rename to examples/basic/basic.ico
diff --git a/samples/basic/basic.rc b/examples/basic/basic.rc
similarity index 100%
rename from samples/basic/basic.rc
rename to examples/basic/basic.rc
diff --git a/samples/basic/basic.vcxproj b/examples/basic/basic.vcxproj
similarity index 94%
rename from samples/basic/basic.vcxproj
rename to examples/basic/basic.vcxproj
index c3f39261..7b88b773 100644
--- a/samples/basic/basic.vcxproj
+++ b/examples/basic/basic.vcxproj
@@ -1,4 +1,4 @@
-
+
@@ -75,7 +75,7 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
@@ -83,21 +83,21 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
$(ProjectName)64
@@ -194,18 +194,15 @@
-
+
+
+
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
-
-
-
diff --git a/samples/basic/basic.vcxproj.filters b/examples/basic/basic.vcxproj.filters
similarity index 100%
rename from samples/basic/basic.vcxproj.filters
rename to examples/basic/basic.vcxproj.filters
diff --git a/samples/basic/basic_form.cpp b/examples/basic/basic_form.cpp
similarity index 100%
rename from samples/basic/basic_form.cpp
rename to examples/basic/basic_form.cpp
diff --git a/samples/basic/basic_form.h b/examples/basic/basic_form.h
similarity index 100%
rename from samples/basic/basic_form.h
rename to examples/basic/basic_form.h
diff --git a/samples/basic/main.cpp b/examples/basic/main.cpp
similarity index 93%
rename from samples/basic/main.cpp
rename to examples/basic/main.cpp
index 1fee9cfe..feab5a63 100644
--- a/samples/basic/main.cpp
+++ b/examples/basic/main.cpp
@@ -24,10 +24,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// 获取资源路径,初始化全局参数
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
#ifdef _DEBUG
// Debug 模式下使用本地文件夹作为资源
// 默认皮肤使用 resources\\themes\\default
diff --git a/samples/basic/main.h b/examples/basic/main.h
similarity index 100%
rename from samples/basic/main.h
rename to examples/basic/main.h
diff --git a/samples/basic/resource.h b/examples/basic/resource.h
similarity index 100%
rename from samples/basic/resource.h
rename to examples/basic/resource.h
diff --git a/samples/basic/small.ico b/examples/basic/small.ico
similarity index 100%
rename from samples/basic/small.ico
rename to examples/basic/small.ico
diff --git a/samples/basic/stdafx.cpp b/examples/basic/stdafx.cpp
similarity index 100%
rename from samples/basic/stdafx.cpp
rename to examples/basic/stdafx.cpp
diff --git a/samples/layouts/stdafx.h b/examples/basic/stdafx.h
similarity index 88%
rename from samples/layouts/stdafx.h
rename to examples/basic/stdafx.h
index 9fae117e..95611366 100644
--- a/samples/layouts/stdafx.h
+++ b/examples/basic/stdafx.h
@@ -16,8 +16,5 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/basic/targetver.h b/examples/basic/targetver.h
similarity index 100%
rename from samples/basic/targetver.h
rename to examples/basic/targetver.h
diff --git a/samples/cef/cef.ico b/examples/cef/cef.ico
similarity index 100%
rename from samples/cef/cef.ico
rename to examples/cef/cef.ico
diff --git a/samples/cef/cef.rc b/examples/cef/cef.rc
similarity index 100%
rename from samples/cef/cef.rc
rename to examples/cef/cef.rc
diff --git a/samples/cef/cef.vcxproj b/examples/cef/cef.vcxproj
similarity index 92%
rename from samples/cef/cef.vcxproj
rename to examples/cef/cef.vcxproj
index e563046e..98cd777f 100644
--- a/samples/cef/cef.vcxproj
+++ b/examples/cef/cef.vcxproj
@@ -75,7 +75,7 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
..\..\bin\
- ..\..\tool_kits\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ ..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\;$(LibraryPath)
@@ -83,21 +83,21 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
..\..\bin\
- ..\..\tool_kits\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ ..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\x64\;$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ ..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\;$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ ..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\x64\;$(LibraryPath)
$(ProjectName)64
@@ -198,16 +198,13 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
-
+
{0149ba6e-3c0a-426d-aa0a-0b9ec7742f19}
diff --git a/samples/cef/cef.vcxproj.filters b/examples/cef/cef.vcxproj.filters
similarity index 100%
rename from samples/cef/cef.vcxproj.filters
rename to examples/cef/cef.vcxproj.filters
diff --git a/samples/cef/cef_form.cpp b/examples/cef/cef_form.cpp
similarity index 96%
rename from samples/cef/cef_form.cpp
rename to examples/cef/cef_form.cpp
index bc3c23f8..1a7fd3d6 100644
--- a/samples/cef/cef_form.cpp
+++ b/examples/cef/cef_form.cpp
@@ -62,7 +62,7 @@ void CefForm::InitWindow()
cef_control_->AttachDevTools(cef_control_dev_);
// ƤĿ¼µ html ļ
- cef_control_->LoadURL(QPath::GetAppPath() + L"resources\\themes\\default\\cef\\cef.html");
+ cef_control_->LoadURL(nbase::win32::GetCurrentModuleDirectory() + L"resources\\themes\\default\\cef\\cef.html");
if (!nim_cef::CefManager::GetInstance()->IsEnableOffsetRender())
cef_control_dev_->SetVisible(false);
diff --git a/samples/cef/cef_form.h b/examples/cef/cef_form.h
similarity index 100%
rename from samples/cef/cef_form.h
rename to examples/cef/cef_form.h
diff --git a/samples/cef/main.cpp b/examples/cef/main.cpp
similarity index 87%
rename from samples/cef/main.cpp
rename to examples/cef/main.cpp
index e740026a..0f199790 100644
--- a/samples/cef/main.cpp
+++ b/examples/cef/main.cpp
@@ -25,7 +25,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
// 初始化 CEF
CefSettings settings;
- if (!nim_cef::CefManager::GetInstance()->Initialize(QPath::GetAppPath() + L"cef_temp\\", settings, kEnableOffsetRender))
+ if (!nim_cef::CefManager::GetInstance()->Initialize(nbase::win32::GetCurrentModuleDirectory() + L"cef_temp\\", settings, kEnableOffsetRender))
{
return 0;
}
@@ -46,13 +46,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// 获取资源路径,初始化全局参数
// 默认皮肤使用 resources\\themes\\default
// 默认语言使用 resources\\lang\\zh_CN
// 如需修改请指定 Startup 最后两个参数
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
// 创建一个默认带有阴影的居中窗口
diff --git a/samples/cef/main.h b/examples/cef/main.h
similarity index 100%
rename from samples/cef/main.h
rename to examples/cef/main.h
diff --git a/samples/cef/resource.h b/examples/cef/resource.h
similarity index 100%
rename from samples/cef/resource.h
rename to examples/cef/resource.h
diff --git a/samples/cef/small.ico b/examples/cef/small.ico
similarity index 100%
rename from samples/cef/small.ico
rename to examples/cef/small.ico
diff --git a/samples/cef/stdafx.cpp b/examples/cef/stdafx.cpp
similarity index 100%
rename from samples/cef/stdafx.cpp
rename to examples/cef/stdafx.cpp
diff --git a/samples/cef/stdafx.h b/examples/cef/stdafx.h
similarity index 90%
rename from samples/cef/stdafx.h
rename to examples/cef/stdafx.h
index f0832686..4a9d4a42 100644
--- a/samples/cef/stdafx.h
+++ b/examples/cef/stdafx.h
@@ -16,9 +16,6 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/cef/targetver.h b/examples/cef/targetver.h
similarity index 100%
rename from samples/cef/targetver.h
rename to examples/cef/targetver.h
diff --git a/samples/controls/controls.ico b/examples/controls/controls.ico
similarity index 100%
rename from samples/controls/controls.ico
rename to examples/controls/controls.ico
diff --git a/samples/controls/controls.rc b/examples/controls/controls.rc
similarity index 100%
rename from samples/controls/controls.rc
rename to examples/controls/controls.rc
diff --git a/samples/controls/controls.vcxproj b/examples/controls/controls.vcxproj
similarity index 93%
rename from samples/controls/controls.vcxproj
rename to examples/controls/controls.vcxproj
index 246ad58a..456957b6 100644
--- a/samples/controls/controls.vcxproj
+++ b/examples/controls/controls.vcxproj
@@ -75,7 +75,7 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
@@ -83,21 +83,21 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
$(ProjectName)64
@@ -194,16 +194,13 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
-
+
{0149ba6e-3c0a-426d-aa0a-0b9ec7742f19}
diff --git a/samples/controls/controls.vcxproj.filters b/examples/controls/controls.vcxproj.filters
similarity index 100%
rename from samples/controls/controls.vcxproj.filters
rename to examples/controls/controls.vcxproj.filters
diff --git a/samples/controls/controls_form.cpp b/examples/controls/controls_form.cpp
similarity index 90%
rename from samples/controls/controls_form.cpp
rename to examples/controls/controls_form.cpp
index 03ed699e..257bfe5e 100644
--- a/samples/controls/controls_form.cpp
+++ b/examples/controls/controls_form.cpp
@@ -103,17 +103,15 @@ void ControlForm::InitWindow()
}
// Post task to UI thread
- nbase::ThreadManager::PostTask(kThreadUI, nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml)); // or Post2UI(nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml));
+ nbase::ThreadManager::PostTask(kThreadMain, nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml)); // or Post2UI(nbase::Bind(&ControlForm::OnLoadedResourceFile, this, xml));
};
// Using ToWeakCallback to protect closure when if [ControlForm] was destoryed
nbase::ThreadManager::PostTask(kThreadGlobalMisc, ToWeakCallback(closure)); // or Post2GlobalMisc(ToWeakCallback(closure));
/* Post repeat task to update progress value 200 milliseconds once */
StdClosure repeat_task = [this]() {
- auto timestamp = shared::tools::GenerateTimeStamp();
- int64_t timestamp_num = 0;
- nbase::StringToInt64(timestamp, ×tamp_num);
- nbase::ThreadManager::PostTask(kThreadUI, nbase::Bind(&ControlForm::OnProgressValueChagned, this, timestamp_num % 100));
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ nbase::ThreadManager::PostTask(kThreadMain, nbase::Bind(&ControlForm::OnProgressValueChagned, this, time_delta.ToMilliseconds() % 100));
};
nbase::ThreadManager::PostRepeatedTask(kThreadGlobalMisc, ToWeakCallback(repeat_task), nbase::TimeDelta::FromMilliseconds(200));
@@ -156,7 +154,7 @@ void ControlForm::OnProgressValueChagned(float value)
progress->SetValue(value);
auto circleprogress = dynamic_cast(FindControl(L"circleprogress"));
circleprogress->SetValue(value);
- TCHAR szBuffer[32] = {0};
+ TCHAR szBuffer[32] = {0};
swprintf_s(szBuffer, _T("%.0f%%"), value);
circleprogress->SetText(szBuffer);
}
diff --git a/samples/controls/controls_form.h b/examples/controls/controls_form.h
similarity index 100%
rename from samples/controls/controls_form.h
rename to examples/controls/controls_form.h
diff --git a/samples/controls/main.cpp b/examples/controls/main.cpp
similarity index 81%
rename from samples/controls/main.cpp
rename to examples/controls/main.cpp
index 4006ff65..97608de5 100644
--- a/samples/controls/main.cpp
+++ b/examples/controls/main.cpp
@@ -18,16 +18,26 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
return 0;
}
+void MiscThread::Init()
+{
+ nbase::ThreadManager::RegisterThread(thread_id_);
+}
+
+void MiscThread::Cleanup()
+{
+ nbase::ThreadManager::UnregisterThread();
+}
+
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// 启动杂事处理线程
misc_thread_.reset(new MiscThread(kThreadGlobalMisc, "Global Misc Thread"));
misc_thread_->Start();
// 获取资源路径,初始化全局参数
- std::wstring app_dir = QPath::GetAppPath();
+ std::wstring app_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(app_dir + L"resources\\", ui::CreateControlCallback(), false);
// 创建一个默认带有阴影的居中窗口
diff --git a/samples/controls/main.h b/examples/controls/main.h
similarity index 51%
rename from samples/controls/main.h
rename to examples/controls/main.h
index 40980e10..cc822498 100644
--- a/samples/controls/main.h
+++ b/examples/controls/main.h
@@ -2,10 +2,40 @@
#include "resource.h"
+/** @class ߳
+* @brief ̳߳࣬ nbase::FrameworkThread
+* @copyright (c) 2015, NetEase Inc. All rights reserved
+* @date 2015/1/1
+*/
+class MiscThread : public nbase::FrameworkThread
+{
+public:
+ MiscThread(enum ThreadIds thread_id, const char *name)
+ : FrameworkThread(name)
+ , thread_id_(thread_id) {}
+
+ ~MiscThread(void) {}
+
+private:
+ /**
+ * 麯ʼ߳
+ * @return void ֵ
+ */
+ virtual void Init() override;
+
+ /**
+ * 麯߳˳ʱһЩ
+ * @return void ֵ
+ */
+ virtual void Cleanup() override;
+
+private:
+ enum ThreadIds thread_id_;
+};
+
/** @class MainThread
* @brief ̣߳UỊ̳߳࣬ nbase::FrameworkThread
* @copyright (c) 2015, NetEase Inc. All rights reserved
-* @author towik
* @date 2015/1/1
*/
class MainThread : public nbase::FrameworkThread
diff --git a/samples/controls/resource.h b/examples/controls/resource.h
similarity index 100%
rename from samples/controls/resource.h
rename to examples/controls/resource.h
diff --git a/samples/controls/small.ico b/examples/controls/small.ico
similarity index 100%
rename from samples/controls/small.ico
rename to examples/controls/small.ico
diff --git a/samples/controls/stdafx.cpp b/examples/controls/stdafx.cpp
similarity index 100%
rename from samples/controls/stdafx.cpp
rename to examples/controls/stdafx.cpp
diff --git a/samples/controls/stdafx.h b/examples/controls/stdafx.h
similarity index 89%
rename from samples/controls/stdafx.h
rename to examples/controls/stdafx.h
index d15652aa..337ee2a2 100644
--- a/samples/controls/stdafx.h
+++ b/examples/controls/stdafx.h
@@ -16,9 +16,6 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/controls/targetver.h b/examples/controls/targetver.h
similarity index 100%
rename from samples/controls/targetver.h
rename to examples/controls/targetver.h
diff --git a/samples/samples.sln b/examples/examples.sln
similarity index 84%
rename from samples/samples.sln
rename to examples/examples.sln
index b6b79bde..639e2c63 100644
--- a/samples/samples.sln
+++ b/examples/examples.sln
@@ -1,15 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
+VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tool_kits", "tool_kits", "{66F85B8F-11B7-4964-B51E-99DF85D8FE00}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "duilib", "..\tool_kits\duilib\duilib.vcxproj", "{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\tool_kits\base\base.vcxproj", "{8D9A6595-717A-41C8-B468-0011A72BE3D1}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{B2087994-3DF6-4A57-B8C6-6F744520D7FA}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B2087994-3DF6-4A57-B8C6-6F744520D7FA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic", "basic\basic.vcxproj", "{F1A9371F-9A34-45A0-98EB-83FF371F067F}"
EndProject
@@ -21,17 +15,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "richlist", "richlist\richli
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "multi_browser", "multi_browser\multi_browser.vcxproj", "{FDB5539F-1060-4975-B603-B66454C8C897}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "..\tool_kits\shared\shared.vcxproj", "{9951345F-620B-4BED-BB51-4F928CAFD454}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_components", "..\tool_kits\ui_components\ui_components.vcxproj", "{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{1DA0A8E2-5832-42FC-83F7-2CDCAD379C90}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcef_dll_wrapper", "..\third_party\cef_wrapper\libcef_dll_wrapper.vcxproj", "{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controls", "controls\controls.vcxproj", "{8BD95440-9000-4745-8011-27DD553EF06F}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VirtualBox", "VirtualBox\VirtualBox.vcxproj", "{E35589C6-9509-4116-996F-1D045C2DACAE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtualbox", "VirtualBox\VirtualBox.vcxproj", "{E35589C6-9509-4116-996F-1D045C2DACAE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\base\base.vcxproj", "{8D9A6595-717A-41C8-B468-0011A72BE3D1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "duilib", "..\duilib\duilib.vcxproj", "{E106ACD7-4E53-4AEE-942B-D0DD426DB34E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ui_components", "..\ui_components\ui_components.vcxproj", "{0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -41,22 +37,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.ActiveCfg = Debug|Win32
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.Build.0 = Debug|Win32
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|x64.ActiveCfg = Debug|x64
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|x64.Build.0 = Debug|x64
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.ActiveCfg = Release|Win32
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.Build.0 = Release|Win32
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.ActiveCfg = Release|x64
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.Build.0 = Release|x64
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|Win32.ActiveCfg = Debug|Win32
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|Win32.Build.0 = Debug|Win32
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|x64.ActiveCfg = Debug|x64
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|x64.Build.0 = Debug|x64
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|Win32.ActiveCfg = Release|Win32
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|Win32.Build.0 = Release|Win32
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|x64.ActiveCfg = Release|x64
- {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|x64.Build.0 = Release|x64
{F1A9371F-9A34-45A0-98EB-83FF371F067F}.Debug|Win32.ActiveCfg = Debug|Win32
{F1A9371F-9A34-45A0-98EB-83FF371F067F}.Debug|Win32.Build.0 = Debug|Win32
{F1A9371F-9A34-45A0-98EB-83FF371F067F}.Debug|x64.ActiveCfg = Debug|x64
@@ -97,22 +77,6 @@ Global
{FDB5539F-1060-4975-B603-B66454C8C897}.Release|Win32.Build.0 = Release|Win32
{FDB5539F-1060-4975-B603-B66454C8C897}.Release|x64.ActiveCfg = Release|x64
{FDB5539F-1060-4975-B603-B66454C8C897}.Release|x64.Build.0 = Release|x64
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Debug|Win32.ActiveCfg = Debug|Win32
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Debug|Win32.Build.0 = Debug|Win32
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Debug|x64.ActiveCfg = Debug|x64
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Debug|x64.Build.0 = Debug|x64
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Release|Win32.ActiveCfg = Release|Win32
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Release|Win32.Build.0 = Release|Win32
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Release|x64.ActiveCfg = Release|x64
- {9951345F-620B-4BED-BB51-4F928CAFD454}.Release|x64.Build.0 = Release|x64
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|Win32.ActiveCfg = Debug|Win32
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|Win32.Build.0 = Debug|Win32
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|x64.ActiveCfg = Debug|x64
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|x64.Build.0 = Debug|x64
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.ActiveCfg = Release|Win32
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.Build.0 = Release|Win32
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.ActiveCfg = Release|x64
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.Build.0 = Release|x64
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}.Debug|Win32.ActiveCfg = Debug|Win32
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}.Debug|Win32.Build.0 = Debug|Win32
{A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9}.Debug|x64.ActiveCfg = Debug|x64
@@ -135,23 +99,43 @@ Global
{E35589C6-9509-4116-996F-1D045C2DACAE}.Release|Win32.ActiveCfg = Release|Win32
{E35589C6-9509-4116-996F-1D045C2DACAE}.Release|Win32.Build.0 = Release|Win32
{E35589C6-9509-4116-996F-1D045C2DACAE}.Release|x64.ActiveCfg = Release|Win32
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|Win32.Build.0 = Debug|Win32
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|x64.ActiveCfg = Debug|x64
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Debug|x64.Build.0 = Debug|x64
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|Win32.ActiveCfg = Release|Win32
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|Win32.Build.0 = Release|Win32
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|x64.ActiveCfg = Release|x64
+ {8D9A6595-717A-41C8-B468-0011A72BE3D1}.Release|x64.Build.0 = Release|x64
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|Win32.Build.0 = Debug|Win32
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|x64.ActiveCfg = Debug|x64
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Debug|x64.Build.0 = Debug|x64
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.ActiveCfg = Release|Win32
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|Win32.Build.0 = Release|Win32
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.ActiveCfg = Release|x64
+ {E106ACD7-4E53-4AEE-942B-D0DD426DB34E}.Release|x64.Build.0 = Release|x64
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|Win32.Build.0 = Debug|Win32
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|x64.ActiveCfg = Debug|x64
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Debug|x64.Build.0 = Debug|x64
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.ActiveCfg = Release|Win32
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|Win32.Build.0 = Release|Win32
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.ActiveCfg = Release|x64
+ {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {66F85B8F-11B7-4964-B51E-99DF85D8FE00}
- {8D9A6595-717A-41C8-B468-0011A72BE3D1} = {66F85B8F-11B7-4964-B51E-99DF85D8FE00}
- {9951345F-620B-4BED-BB51-4F928CAFD454} = {66F85B8F-11B7-4964-B51E-99DF85D8FE00}
- {0149BA6E-3C0A-426D-AA0A-0B9EC7742F19} = {66F85B8F-11B7-4964-B51E-99DF85D8FE00}
{F1A9371F-9A34-45A0-98EB-83FF371F067F} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
{2BFFA1EE-039D-479E-9BCC-2D12F8AEDD16} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
{B8588C07-9CE2-456C-83B1-86E4B65D4108} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
{878F5BF0-652A-4FDB-992B-BB7F26D62F0D} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
{FDB5539F-1060-4975-B603-B66454C8C897} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
+ {A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {1DA0A8E2-5832-42FC-83F7-2CDCAD379C90}
{8BD95440-9000-4745-8011-27DD553EF06F} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
{E35589C6-9509-4116-996F-1D045C2DACAE} = {B2087994-3DF6-4A57-B8C6-6F744520D7FA}
- {A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9} = {1DA0A8E2-5832-42FC-83F7-2CDCAD379C90}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {68CA0970-4242-4E4F-94D2-C19760FCA05D}
diff --git a/samples/layouts/layouts.ico b/examples/layouts/layouts.ico
similarity index 100%
rename from samples/layouts/layouts.ico
rename to examples/layouts/layouts.ico
diff --git a/samples/layouts/layouts.rc b/examples/layouts/layouts.rc
similarity index 100%
rename from samples/layouts/layouts.rc
rename to examples/layouts/layouts.rc
diff --git a/samples/layouts/layouts.vcxproj b/examples/layouts/layouts.vcxproj
similarity index 94%
rename from samples/layouts/layouts.vcxproj
rename to examples/layouts/layouts.vcxproj
index c4e738f2..09e6bd26 100644
--- a/samples/layouts/layouts.vcxproj
+++ b/examples/layouts/layouts.vcxproj
@@ -1,4 +1,4 @@
-
+
@@ -75,7 +75,7 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
@@ -83,21 +83,21 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
$(ProjectName)64
@@ -194,15 +194,12 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
diff --git a/samples/layouts/layouts.vcxproj.filters b/examples/layouts/layouts.vcxproj.filters
similarity index 100%
rename from samples/layouts/layouts.vcxproj.filters
rename to examples/layouts/layouts.vcxproj.filters
diff --git a/samples/layouts/layouts_form.cpp b/examples/layouts/layouts_form.cpp
similarity index 100%
rename from samples/layouts/layouts_form.cpp
rename to examples/layouts/layouts_form.cpp
diff --git a/samples/layouts/layouts_form.h b/examples/layouts/layouts_form.h
similarity index 100%
rename from samples/layouts/layouts_form.h
rename to examples/layouts/layouts_form.h
diff --git a/samples/layouts/main.cpp b/examples/layouts/main.cpp
similarity index 91%
rename from samples/layouts/main.cpp
rename to examples/layouts/main.cpp
index 806a015f..d4e08fa4 100644
--- a/samples/layouts/main.cpp
+++ b/examples/layouts/main.cpp
@@ -24,13 +24,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// 获取资源路径,初始化全局参数
// 默认皮肤使用 resources\\themes\\default
// 默认语言使用 resources\\lang\\zh_CN
// 如需修改请指定 Startup 最后两个参数
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
// 一个仿微信的布局示例
diff --git a/samples/layouts/main.h b/examples/layouts/main.h
similarity index 100%
rename from samples/layouts/main.h
rename to examples/layouts/main.h
diff --git a/samples/layouts/resource.h b/examples/layouts/resource.h
similarity index 100%
rename from samples/layouts/resource.h
rename to examples/layouts/resource.h
diff --git a/samples/layouts/small.ico b/examples/layouts/small.ico
similarity index 100%
rename from samples/layouts/small.ico
rename to examples/layouts/small.ico
diff --git a/samples/layouts/stdafx.cpp b/examples/layouts/stdafx.cpp
similarity index 100%
rename from samples/layouts/stdafx.cpp
rename to examples/layouts/stdafx.cpp
diff --git a/samples/basic/stdafx.h b/examples/layouts/stdafx.h
similarity index 88%
rename from samples/basic/stdafx.h
rename to examples/layouts/stdafx.h
index 9fae117e..95611366 100644
--- a/samples/basic/stdafx.h
+++ b/examples/layouts/stdafx.h
@@ -16,8 +16,5 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/layouts/targetver.h b/examples/layouts/targetver.h
similarity index 100%
rename from samples/layouts/targetver.h
rename to examples/layouts/targetver.h
diff --git a/samples/multi_browser/Resource.h b/examples/multi_browser/Resource.h
similarity index 100%
rename from samples/multi_browser/Resource.h
rename to examples/multi_browser/Resource.h
diff --git a/samples/multi_browser/browser/browser_box.cpp b/examples/multi_browser/browser/browser_box.cpp
similarity index 97%
rename from samples/multi_browser/browser/browser_box.cpp
rename to examples/multi_browser/browser/browser_box.cpp
index ef1cd5c7..234d36fd 100644
--- a/samples/multi_browser/browser/browser_box.cpp
+++ b/examples/multi_browser/browser/browser_box.cpp
@@ -48,7 +48,7 @@ void BrowserBox::InitBrowserBox(const std::wstring &url)
// Ĭҳ
std::wstring html_path = url;
if (html_path.empty())
- html_path = QPath::GetAppPath() + L"resources\\themes\\default\\cef\\cef.html";
+ html_path = nbase::win32::GetCurrentModuleDirectory() + L"resources\\themes\\default\\cef\\cef.html";
cef_control_->LoadURL(html_path);
diff --git a/samples/multi_browser/browser/browser_box.h b/examples/multi_browser/browser/browser_box.h
similarity index 100%
rename from samples/multi_browser/browser/browser_box.h
rename to examples/multi_browser/browser/browser_box.h
diff --git a/samples/multi_browser/browser/custom_layout.cpp b/examples/multi_browser/browser/custom_layout.cpp
similarity index 100%
rename from samples/multi_browser/browser/custom_layout.cpp
rename to examples/multi_browser/browser/custom_layout.cpp
diff --git a/samples/multi_browser/browser/custom_layout.h b/examples/multi_browser/browser/custom_layout.h
similarity index 100%
rename from samples/multi_browser/browser/custom_layout.h
rename to examples/multi_browser/browser/custom_layout.h
diff --git a/samples/multi_browser/browser/multi_browser_form.cpp b/examples/multi_browser/browser/multi_browser_form.cpp
similarity index 96%
rename from samples/multi_browser/browser/multi_browser_form.cpp
rename to examples/multi_browser/browser/multi_browser_form.cpp
index 54aaf5df..e7aa0b92 100644
--- a/samples/multi_browser/browser/multi_browser_form.cpp
+++ b/examples/multi_browser/browser/multi_browser_form.cpp
@@ -249,7 +249,9 @@ bool MultiBrowserForm::OnClicked( ui::EventArgs* arg )
}
else if (name == L"btn_add")
{
- MultiBrowserManager::GetInstance()->CreateBorwserBox(this, shared::tools::GenerateTimeStamp(), L"");
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ std::string timeStamp = nbase::StringPrintf("%I64u", time_delta.ToMilliseconds());
+ MultiBrowserManager::GetInstance()->CreateBorwserBox(this, timeStamp, L"");
}
else if (active_browser_box_)
{
@@ -279,12 +281,16 @@ bool MultiBrowserForm::OnReturn(ui::EventArgs* arg)
std::wstring name = arg->pSender->GetName();
if (name == L"edit_url")
{
-// // ڵǰҳת
-// auto cef_control = active_browser_box_->GetCefControl();
-// if (cef_control)
-// cef_control->LoadURL(edit_url_->GetText());
+#if 0
+ // ڵǰҳת
+ auto cef_control = active_browser_box_->GetCefControl();
+ if (cef_control)
+ cef_control->LoadURL(edit_url_->GetText());
+#endif
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ std::string timeStamp = nbase::StringPrintf("%I64u", time_delta.ToMilliseconds());
// ½ǩҳ
- MultiBrowserManager::GetInstance()->CreateBorwserBox(this, shared::tools::GenerateTimeStamp(), edit_url_->GetText());
+ MultiBrowserManager::GetInstance()->CreateBorwserBox(this, timeStamp, edit_url_->GetText());
}
return false;
diff --git a/samples/multi_browser/browser/multi_browser_form.h b/examples/multi_browser/browser/multi_browser_form.h
similarity index 100%
rename from samples/multi_browser/browser/multi_browser_form.h
rename to examples/multi_browser/browser/multi_browser_form.h
diff --git a/samples/multi_browser/browser/multi_browser_form_dragdrop.cpp b/examples/multi_browser/browser/multi_browser_form_dragdrop.cpp
similarity index 92%
rename from samples/multi_browser/browser/multi_browser_form_dragdrop.cpp
rename to examples/multi_browser/browser/multi_browser_form_dragdrop.cpp
index bc6d6332..6c8fb66d 100644
--- a/samples/multi_browser/browser/multi_browser_form_dragdrop.cpp
+++ b/examples/multi_browser/browser/multi_browser_form_dragdrop.cpp
@@ -23,17 +23,14 @@ bool MultiBrowserForm::InitDragDrop()
IID_IDropTargetHelper,
(void**)&drop_helper_)))
{
- QLOG_ERR(L"MultiBrowserForm::InitDragDrop Create CLSID_DragDropHelper faild");
return false;
}
if (FAILED(RegisterDragDrop(this->GetHWND(), this)))
{
- QLOG_ERR(L"MultiBrowserForm::InitDragDrop RegisterDragDrop faild");
return false;
}
- QLOG_APP(L"MultiBrowserForm::InitDragDrop succeed");
return true;
}
@@ -85,7 +82,6 @@ HRESULT MultiBrowserForm::DragEnter(IDataObject * pDataObject, DWORD grfKeyState
}
else
{
- QLOG_APP(L"MultiBrowserForm::Drop receive a BrowserBox");
*pdwEffect = DROPEFFECT_MOVE;
}
@@ -138,14 +134,15 @@ HRESULT MultiBrowserForm::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL
// 如果不是拖拽浏览器盒子
if (!MultiBrowserManager::GetInstance()->IsDragingBorwserBox())
{
-// if (NULL != active_browser_box_ && active_browser_box_->CheckDropEnable(pt))
-// {
-// /ctive_browser_box_->Drop(pDataObj, grfKeyState, pt, pdwEffect);
-// }
+#if 0
+ if (NULL != active_browser_box_ && active_browser_box_->CheckDropEnable(pt))
+ {
+ active_browser_box_->Drop(pDataObj, grfKeyState, pt, pdwEffect);
+ }
+#endif
}
else
{
- QLOG_APP(L"MultiBrowserForm::Drop drop a BrowserBox");
*pdwEffect = DROPEFFECT_MOVE;
MultiBrowserManager::GetInstance()->SetDropForm(this);
}
@@ -189,7 +186,7 @@ bool MultiBrowserForm::OnProcessTabItemDrag(ui::EventArgs* param)
StdClosure cb = [=]{
MultiBrowserManager::GetInstance()->DoDragBorwserBox(active_browser_box_, bitmap, pt);
};
- nbase::ThreadManager::PostTask(kThreadUI, cb);
+ nbase::ThreadManager::PostTask(kThreadMain, cb);
}
}
break;
diff --git a/samples/multi_browser/browser/multi_browser_manager.cpp b/examples/multi_browser/browser/multi_browser_manager.cpp
similarity index 100%
rename from samples/multi_browser/browser/multi_browser_manager.cpp
rename to examples/multi_browser/browser/multi_browser_manager.cpp
diff --git a/samples/multi_browser/browser/multi_browser_manager.h b/examples/multi_browser/browser/multi_browser_manager.h
similarity index 100%
rename from samples/multi_browser/browser/multi_browser_manager.h
rename to examples/multi_browser/browser/multi_browser_manager.h
diff --git a/samples/multi_browser/control/browser_tab_item.cpp b/examples/multi_browser/control/browser_tab_item.cpp
similarity index 100%
rename from samples/multi_browser/control/browser_tab_item.cpp
rename to examples/multi_browser/control/browser_tab_item.cpp
diff --git a/samples/multi_browser/control/browser_tab_item.h b/examples/multi_browser/control/browser_tab_item.h
similarity index 100%
rename from samples/multi_browser/control/browser_tab_item.h
rename to examples/multi_browser/control/browser_tab_item.h
diff --git a/samples/multi_browser/dragdrop/bitmap_control.cpp b/examples/multi_browser/dragdrop/bitmap_control.cpp
similarity index 100%
rename from samples/multi_browser/dragdrop/bitmap_control.cpp
rename to examples/multi_browser/dragdrop/bitmap_control.cpp
diff --git a/samples/multi_browser/dragdrop/bitmap_control.h b/examples/multi_browser/dragdrop/bitmap_control.h
similarity index 100%
rename from samples/multi_browser/dragdrop/bitmap_control.h
rename to examples/multi_browser/dragdrop/bitmap_control.h
diff --git a/samples/multi_browser/dragdrop/drag_drop.cpp b/examples/multi_browser/dragdrop/drag_drop.cpp
similarity index 100%
rename from samples/multi_browser/dragdrop/drag_drop.cpp
rename to examples/multi_browser/dragdrop/drag_drop.cpp
diff --git a/samples/multi_browser/dragdrop/drag_drop.h b/examples/multi_browser/dragdrop/drag_drop.h
similarity index 100%
rename from samples/multi_browser/dragdrop/drag_drop.h
rename to examples/multi_browser/dragdrop/drag_drop.h
diff --git a/samples/multi_browser/dragdrop/drag_form.cpp b/examples/multi_browser/dragdrop/drag_form.cpp
similarity index 100%
rename from samples/multi_browser/dragdrop/drag_form.cpp
rename to examples/multi_browser/dragdrop/drag_form.cpp
diff --git a/samples/multi_browser/dragdrop/drag_form.h b/examples/multi_browser/dragdrop/drag_form.h
similarity index 100%
rename from samples/multi_browser/dragdrop/drag_form.h
rename to examples/multi_browser/dragdrop/drag_form.h
diff --git a/samples/multi_browser/main.cpp b/examples/multi_browser/main.cpp
similarity index 74%
rename from samples/multi_browser/main.cpp
rename to examples/multi_browser/main.cpp
index 1b0dc600..86003e91 100644
--- a/samples/multi_browser/main.cpp
+++ b/examples/multi_browser/main.cpp
@@ -34,7 +34,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
// 初始化 CEF
CefSettings settings;
- if (!nim_cef::CefManager::GetInstance()->Initialize(QPath::GetAppPath() + L"cef_temp\\", settings, true))
+ if (!nim_cef::CefManager::GetInstance()->Initialize(nbase::win32::GetCurrentModuleDirectory() + L"cef_temp\\", settings, true))
{
return 0;
}
@@ -55,12 +55,14 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
- MultiBrowserManager::GetInstance()->CreateBorwserBox(NULL, shared::tools::GenerateTimeStamp(), L"");
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ std::string timeStamp = nbase::StringPrintf("%I64u", time_delta.ToMilliseconds());
+ MultiBrowserManager::GetInstance()->CreateBorwserBox(NULL, timeStamp, L"");
}
void MainThread::Cleanup()
diff --git a/samples/multi_browser/main.h b/examples/multi_browser/main.h
similarity index 100%
rename from samples/multi_browser/main.h
rename to examples/multi_browser/main.h
diff --git a/samples/multi_browser/multi_browser.ico b/examples/multi_browser/multi_browser.ico
similarity index 100%
rename from samples/multi_browser/multi_browser.ico
rename to examples/multi_browser/multi_browser.ico
diff --git a/samples/multi_browser/multi_browser.rc b/examples/multi_browser/multi_browser.rc
similarity index 100%
rename from samples/multi_browser/multi_browser.rc
rename to examples/multi_browser/multi_browser.rc
diff --git a/samples/multi_browser/multi_browser.vcxproj b/examples/multi_browser/multi_browser.vcxproj
similarity index 90%
rename from samples/multi_browser/multi_browser.vcxproj
rename to examples/multi_browser/multi_browser.vcxproj
index 450fdedc..71731080 100644
--- a/samples/multi_browser/multi_browser.vcxproj
+++ b/examples/multi_browser/multi_browser.vcxproj
@@ -59,12 +59,12 @@
..\..\bin\
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
- .\;..\;..\..\;..\..\tool_kits\;..\..\tool_kits\ui_components\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ .\;..\;..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\;$(LibraryPath)
false
- .\;..\;..\..\;..\..\tool_kits\;..\..\tool_kits\ui_components\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ .\;..\;..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\;$(LibraryPath)
..\..\bin\
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
@@ -73,11 +73,11 @@
..\..\bin\
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
- .\;..\;..\..\;..\..\tool_kits\;..\..\tool_kits\ui_components\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ .\;..\;..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\x64\;$(LibraryPath)
- .\;..\;..\..\;..\..\tool_kits\;..\..\tool_kits\ui_components\;..\..\third_party\cef_wrapper\;$(IncludePath)
+ .\;..\;..\..\;..\..\third_party\cef_wrapper\;$(IncludePath)
..\..\libs\x64\;$(LibraryPath)
..\..\bin\
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
@@ -180,16 +180,13 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
-
+
{0149ba6e-3c0a-426d-aa0a-0b9ec7742f19}
diff --git a/samples/multi_browser/multi_browser.vcxproj.filters b/examples/multi_browser/multi_browser.vcxproj.filters
similarity index 100%
rename from samples/multi_browser/multi_browser.vcxproj.filters
rename to examples/multi_browser/multi_browser.vcxproj.filters
diff --git a/samples/multi_browser/small.ico b/examples/multi_browser/small.ico
similarity index 100%
rename from samples/multi_browser/small.ico
rename to examples/multi_browser/small.ico
diff --git a/samples/multi_browser/stdafx.cpp b/examples/multi_browser/stdafx.cpp
similarity index 100%
rename from samples/multi_browser/stdafx.cpp
rename to examples/multi_browser/stdafx.cpp
diff --git a/samples/multi_browser/stdafx.h b/examples/multi_browser/stdafx.h
similarity index 89%
rename from samples/multi_browser/stdafx.h
rename to examples/multi_browser/stdafx.h
index 014638e1..4afaa671 100644
--- a/samples/multi_browser/stdafx.h
+++ b/examples/multi_browser/stdafx.h
@@ -16,9 +16,6 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/multi_browser/targetver.h b/examples/multi_browser/targetver.h
similarity index 100%
rename from samples/multi_browser/targetver.h
rename to examples/multi_browser/targetver.h
diff --git a/samples/multi_browser/taskbar/dwm_util.cpp b/examples/multi_browser/taskbar/dwm_util.cpp
similarity index 100%
rename from samples/multi_browser/taskbar/dwm_util.cpp
rename to examples/multi_browser/taskbar/dwm_util.cpp
diff --git a/samples/multi_browser/taskbar/dwm_util.h b/examples/multi_browser/taskbar/dwm_util.h
similarity index 100%
rename from samples/multi_browser/taskbar/dwm_util.h
rename to examples/multi_browser/taskbar/dwm_util.h
diff --git a/samples/multi_browser/taskbar/taskbar_manager.cpp b/examples/multi_browser/taskbar/taskbar_manager.cpp
similarity index 99%
rename from samples/multi_browser/taskbar/taskbar_manager.cpp
rename to examples/multi_browser/taskbar/taskbar_manager.cpp
index ab00cb45..a0280bf5 100644
--- a/samples/multi_browser/taskbar/taskbar_manager.cpp
+++ b/examples/multi_browser/taskbar/taskbar_manager.cpp
@@ -37,7 +37,6 @@ void TaskbarTabItem::Init(const std::wstring &taskbar_title, const std::string &
if (ret != S_OK)
{
is_win7_or_greater_ = false;
- QLOG_ERR(L"DwmSetWindowAttribute error: {0}") << ret;
}
}
diff --git a/samples/multi_browser/taskbar/taskbar_manager.h b/examples/multi_browser/taskbar/taskbar_manager.h
similarity index 100%
rename from samples/multi_browser/taskbar/taskbar_manager.h
rename to examples/multi_browser/taskbar/taskbar_manager.h
diff --git a/samples/richlist/item.cpp b/examples/richlist/item.cpp
similarity index 80%
rename from samples/richlist/item.cpp
rename to examples/richlist/item.cpp
index 9072186b..ee50c78c 100644
--- a/samples/richlist/item.cpp
+++ b/examples/richlist/item.cpp
@@ -20,14 +20,12 @@ void Item::InitSubControls(const std::wstring& img, const std::wstring& title)
btn_del_ = dynamic_cast(FindSubControl(L"btn_del"));
// ģ
- auto timestamp = shared::tools::GenerateTimeStamp();
- int64_t timestamp_num = 0;
- nbase::StringToInt64(timestamp, ×tamp_num);
- progress_->SetValue((double)(timestamp_num % 100));
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ progress_->SetValue((double)(time_delta.ToMilliseconds() % 100));
// ͼ
control_img_->SetBkImage(img);
- label_title_->SetText(nbase::StringPrintf(L"%s %d%%", title.c_str(), timestamp_num % 100));
+ label_title_->SetText(nbase::StringPrintf(L"%s %d%%", title.c_str(), time_delta.ToMilliseconds() % 100));
// ɾ
btn_del_->AttachClick(nbase::Bind(&Item::OnRemove, this, std::placeholders::_1));
diff --git a/samples/richlist/item.h b/examples/richlist/item.h
similarity index 100%
rename from samples/richlist/item.h
rename to examples/richlist/item.h
diff --git a/samples/richlist/main.cpp b/examples/richlist/main.cpp
similarity index 90%
rename from samples/richlist/main.cpp
rename to examples/richlist/main.cpp
index 2de54cd6..4ffa5464 100644
--- a/samples/richlist/main.cpp
+++ b/examples/richlist/main.cpp
@@ -24,10 +24,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// 获取资源路径,初始化全局参数
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(theme_dir + L"resources\\", ui::CreateControlCallback(), false);
// 创建一个默认带有阴影的居中窗口
diff --git a/samples/richlist/main.h b/examples/richlist/main.h
similarity index 100%
rename from samples/richlist/main.h
rename to examples/richlist/main.h
diff --git a/samples/richlist/resource.h b/examples/richlist/resource.h
similarity index 100%
rename from samples/richlist/resource.h
rename to examples/richlist/resource.h
diff --git a/samples/richlist/richlist.ico b/examples/richlist/richlist.ico
similarity index 100%
rename from samples/richlist/richlist.ico
rename to examples/richlist/richlist.ico
diff --git a/samples/richlist/richlist.rc b/examples/richlist/richlist.rc
similarity index 100%
rename from samples/richlist/richlist.rc
rename to examples/richlist/richlist.rc
diff --git a/samples/richlist/richlist.vcxproj b/examples/richlist/richlist.vcxproj
similarity index 93%
rename from samples/richlist/richlist.vcxproj
rename to examples/richlist/richlist.vcxproj
index 21dd5e21..176fa5f7 100644
--- a/samples/richlist/richlist.vcxproj
+++ b/examples/richlist/richlist.vcxproj
@@ -75,7 +75,7 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
@@ -83,21 +83,21 @@
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
$(ProjectName)64_d
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
false
$(ProjectDir)..\..\tmp\$(PlatformName)\$(ProjectName)\$(Configuration)\
..\..\bin\
- ..\..\tool_kits\;$(IncludePath)
+ ..\..\;$(IncludePath)
$(LibraryPath)
$(ProjectName)64
@@ -196,16 +196,13 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
-
+
{0149ba6e-3c0a-426d-aa0a-0b9ec7742f19}
diff --git a/samples/richlist/richlist.vcxproj.filters b/examples/richlist/richlist.vcxproj.filters
similarity index 100%
rename from samples/richlist/richlist.vcxproj.filters
rename to examples/richlist/richlist.vcxproj.filters
diff --git a/samples/richlist/richlist_form.cpp b/examples/richlist/richlist_form.cpp
similarity index 100%
rename from samples/richlist/richlist_form.cpp
rename to examples/richlist/richlist_form.cpp
diff --git a/samples/richlist/richlist_form.h b/examples/richlist/richlist_form.h
similarity index 100%
rename from samples/richlist/richlist_form.h
rename to examples/richlist/richlist_form.h
diff --git a/samples/richlist/small.ico b/examples/richlist/small.ico
similarity index 100%
rename from samples/richlist/small.ico
rename to examples/richlist/small.ico
diff --git a/samples/richlist/stdafx.cpp b/examples/richlist/stdafx.cpp
similarity index 100%
rename from samples/richlist/stdafx.cpp
rename to examples/richlist/stdafx.cpp
diff --git a/samples/richlist/stdafx.h b/examples/richlist/stdafx.h
similarity index 89%
rename from samples/richlist/stdafx.h
rename to examples/richlist/stdafx.h
index d15652aa..337ee2a2 100644
--- a/samples/richlist/stdafx.h
+++ b/examples/richlist/stdafx.h
@@ -16,9 +16,6 @@
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/richlist/targetver.h b/examples/richlist/targetver.h
similarity index 100%
rename from samples/richlist/targetver.h
rename to examples/richlist/targetver.h
diff --git a/samples/virtualbox/Resource.h b/examples/virtualbox/Resource.h
similarity index 100%
rename from samples/virtualbox/Resource.h
rename to examples/virtualbox/Resource.h
diff --git a/samples/virtualbox/VirtualTileBox.cpp b/examples/virtualbox/VirtualTileBox.cpp
similarity index 100%
rename from samples/virtualbox/VirtualTileBox.cpp
rename to examples/virtualbox/VirtualTileBox.cpp
diff --git a/samples/virtualbox/VirtualTileBox.h b/examples/virtualbox/VirtualTileBox.h
similarity index 97%
rename from samples/virtualbox/VirtualTileBox.h
rename to examples/virtualbox/VirtualTileBox.h
index ecd8913f..6566e35b 100644
--- a/samples/virtualbox/VirtualTileBox.h
+++ b/examples/virtualbox/VirtualTileBox.h
@@ -1,7 +1,7 @@
#pragma once
-typedef function DataChangedNotify;
-typedef function CountChangedNotify;
+typedef std::function DataChangedNotify;
+typedef std::function CountChangedNotify;
class UILIB_API VirtualTileInterface: public nbase::SupportWeakCallback
{
diff --git a/samples/virtualbox/item.cpp b/examples/virtualbox/item.cpp
similarity index 84%
rename from samples/virtualbox/item.cpp
rename to examples/virtualbox/item.cpp
index 8af32a0e..d9dff7a3 100644
--- a/samples/virtualbox/item.cpp
+++ b/examples/virtualbox/item.cpp
@@ -22,11 +22,9 @@ void Item::InitSubControls(const std::wstring& img, const std::wstring& title, i
progress_ = dynamic_cast(FindSubControl(L"progress"));
btn_del_ = dynamic_cast(FindSubControl(L"btn_del"));
// ģ
- auto timestamp = shared::tools::GenerateTimeStamp();
- int64_t timestamp_num = 0;
- nbase::StringToInt64(timestamp, ×tamp_num);
- t_time = timestamp_num;
- progress_->SetValue((double)(timestamp_num % 100));
+ nbase::TimeDelta time_delta = nbase::TimeDelta::FromMicroseconds(nbase::Time::Now().ToInternalValue());
+ t_time = time_delta.ToMilliseconds();
+ progress_->SetValue((double)(time_delta.ToMilliseconds() % 100));
// ͼ
control_img_->SetBkImage(img);
// ɾ
diff --git a/samples/virtualbox/item.h b/examples/virtualbox/item.h
similarity index 100%
rename from samples/virtualbox/item.h
rename to examples/virtualbox/item.h
diff --git a/samples/virtualbox/main.cpp b/examples/virtualbox/main.cpp
similarity index 90%
rename from samples/virtualbox/main.cpp
rename to examples/virtualbox/main.cpp
index d316f2e8..4f9993b0 100644
--- a/samples/virtualbox/main.cpp
+++ b/examples/virtualbox/main.cpp
@@ -34,10 +34,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
void MainThread::Init()
{
- nbase::ThreadManager::RegisterThread(kThreadUI);
+ nbase::ThreadManager::RegisterThread(kThreadMain);
// ȡԴ·ʼȫֲ
- std::wstring theme_dir = QPath::GetAppPath();
+ std::wstring theme_dir = nbase::win32::GetCurrentModuleDirectory();
ui::GlobalManager::Startup(theme_dir + L"resources\\", MyCreateControlCallback, false);
// һĬϴӰľд
diff --git a/samples/virtualbox/main.h b/examples/virtualbox/main.h
similarity index 100%
rename from samples/virtualbox/main.h
rename to examples/virtualbox/main.h
diff --git a/samples/virtualbox/main_form.cpp b/examples/virtualbox/main_form.cpp
similarity index 100%
rename from samples/virtualbox/main_form.cpp
rename to examples/virtualbox/main_form.cpp
diff --git a/samples/virtualbox/main_form.h b/examples/virtualbox/main_form.h
similarity index 100%
rename from samples/virtualbox/main_form.h
rename to examples/virtualbox/main_form.h
diff --git a/samples/virtualbox/provider.cpp b/examples/virtualbox/provider.cpp
similarity index 91%
rename from samples/virtualbox/provider.cpp
rename to examples/virtualbox/provider.cpp
index ea40c1b2..b60a734b 100644
--- a/samples/virtualbox/provider.cpp
+++ b/examples/virtualbox/provider.cpp
@@ -74,9 +74,9 @@ void Provider::RemoveTask(int nIndex)
EmitCountChanged();
}
-void Provider::ChangeTaskName(int nIndex, const wstring& sName)
+void Provider::ChangeTaskName(int nIndex, const std::wstring& sName)
{
- if (nIndex > 0 && nIndex < m_vTasks.size())
+ if (nIndex > 0 && nIndex < (int)m_vTasks.size())
{
m_vTasks[nIndex].sName = sName;
}
diff --git a/samples/virtualbox/provider.h b/examples/virtualbox/provider.h
similarity index 89%
rename from samples/virtualbox/provider.h
rename to examples/virtualbox/provider.h
index 5fdb8b60..f18205e9 100644
--- a/samples/virtualbox/provider.h
+++ b/examples/virtualbox/provider.h
@@ -6,7 +6,7 @@
struct DownloadTask
{
int nId;
- wstring sName;
+ std::wstring sName;
};
class Provider : public VirtualTileInterface
@@ -34,7 +34,7 @@ class Provider : public VirtualTileInterface
public:
void SetTotal(int nTotal);
void RemoveTask(int nIndex);
- void ChangeTaskName(int nIndex, const wstring& sName);
+ void ChangeTaskName(int nIndex, const std::wstring& sName);
private:
int m_nTotal;
diff --git a/samples/virtualbox/small.ico b/examples/virtualbox/small.ico
similarity index 100%
rename from samples/virtualbox/small.ico
rename to examples/virtualbox/small.ico
diff --git a/samples/virtualbox/stdafx.cpp b/examples/virtualbox/stdafx.cpp
similarity index 100%
rename from samples/virtualbox/stdafx.cpp
rename to examples/virtualbox/stdafx.cpp
diff --git a/samples/virtualbox/stdafx.h b/examples/virtualbox/stdafx.h
similarity index 90%
rename from samples/virtualbox/stdafx.h
rename to examples/virtualbox/stdafx.h
index e0159f3f..35e2d627 100644
--- a/samples/virtualbox/stdafx.h
+++ b/examples/virtualbox/stdafx.h
@@ -16,15 +16,11 @@
#include
#include
#include
-
-
+#include
// base header
#include "base/base.h"
-// shared project
-#include "shared/shared.h"
-
// duilib
#include "duilib/UIlib.h"
diff --git a/samples/virtualbox/targetver.h b/examples/virtualbox/targetver.h
similarity index 100%
rename from samples/virtualbox/targetver.h
rename to examples/virtualbox/targetver.h
diff --git a/samples/virtualbox/virtualbox.filters b/examples/virtualbox/virtualbox.filters
similarity index 100%
rename from samples/virtualbox/virtualbox.filters
rename to examples/virtualbox/virtualbox.filters
diff --git a/samples/virtualbox/virtualbox.ico b/examples/virtualbox/virtualbox.ico
similarity index 100%
rename from samples/virtualbox/virtualbox.ico
rename to examples/virtualbox/virtualbox.ico
diff --git a/samples/virtualbox/virtualbox.rc b/examples/virtualbox/virtualbox.rc
similarity index 100%
rename from samples/virtualbox/virtualbox.rc
rename to examples/virtualbox/virtualbox.rc
diff --git a/samples/virtualbox/virtualbox.vcxproj b/examples/virtualbox/virtualbox.vcxproj
similarity index 92%
rename from samples/virtualbox/virtualbox.vcxproj
rename to examples/virtualbox/virtualbox.vcxproj
index 688aa885..0fbb98c1 100644
--- a/samples/virtualbox/virtualbox.vcxproj
+++ b/examples/virtualbox/virtualbox.vcxproj
@@ -59,7 +59,7 @@
WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
MultiThreadedDebug
- ..\..\tool_kits\;
+ ..\..\
Windows
@@ -76,7 +76,7 @@
WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
true
MultiThreaded
- ..\..\tool_kits\;
+ ..\..\
Windows
@@ -114,15 +114,12 @@
-
+
{8d9a6595-717a-41c8-b468-0011a72be3d1}
-
+
{e106acd7-4e53-4aee-942b-d0dd426db34e}
-
- {9951345f-620b-4bed-bb51-4f928cafd454}
-
diff --git a/tool_kits/shared/base.h b/tool_kits/shared/base.h
deleted file mode 100644
index cf63ddde..00000000
--- a/tool_kits/shared/base.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#pragma once
-#include "log.h"
-#include "closure.h"
-#include "zoom_image.h"
\ No newline at end of file
diff --git a/tool_kits/shared/closure.cpp b/tool_kits/shared/closure.cpp
deleted file mode 100644
index d0fa3ca4..00000000
--- a/tool_kits/shared/closure.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "stdafx.h"
-#include "closure.h"
-#include "shared/threads.h"
-#include "base/thread/thread_manager.h"
-
-void Post2UI(const StdClosure &closure)
-{
- nbase::ThreadManager::PostTask(kThreadUI, closure);
-}
-
-void Post2GlobalMisc(const StdClosure &closure)
-{
- nbase::ThreadManager::PostTask(kThreadGlobalMisc, closure);
-}
-
-void Post2Database(const StdClosure &closure)
-{
- nbase::ThreadManager::PostTask(kThreadDatabase, closure);
-}
diff --git a/tool_kits/shared/closure.h b/tool_kits/shared/closure.h
deleted file mode 100644
index 38eaf562..00000000
--- a/tool_kits/shared/closure.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-//#include "util.h"
-#include "base/callback/callback.h"
-
-//ͶUI߳
-void Post2UI(const StdClosure &closure);
-
-//ͶȫMisc߳
-void Post2GlobalMisc(const StdClosure &closure);
-
-//ͶDB߳
-void Post2Database(const StdClosure &closure);
\ No newline at end of file
diff --git a/tool_kits/shared/cmd_line.cpp b/tool_kits/shared/cmd_line.cpp
deleted file mode 100644
index 887ded7e..00000000
--- a/tool_kits/shared/cmd_line.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "stdafx.h"
-#include "cmd_line.h"
-#include "base/util/string_util.h"
-
-namespace shared
-{
-CommandLine::CommandLine(const std::wstring &cmd) : cmd_(cmd)
-{
- Parse(cmd_, map_);
-}
-
-CommandLine::~CommandLine()
-{
-
-}
-
-bool CommandLine::Parse(const std::wstring &cmd, std::map ¶m_map)
-{
- std::list param_list;
- if (nbase::StringTokenize(cmd, L"/", param_list) == 0)
- return false;
-
- std::wstring token, key, value;
- size_t pos;
- for (std::list::iterator it = param_list.begin(); it != param_list.end(); ++it)
- {
- token = *it;
- key = L"";
- value = L"";
- pos = token.find(L' ', 0);
- if (pos < 0 || pos >= token.size())
- pos = token.size();
- key = token.substr(0, pos);
- if (pos < token.size())
- {
- value = token.substr(pos, token.size() - pos);
- value = nbase::StringTrim(value.c_str());
- if (value.size() >= 2 && value[0] == '"' && value[value.size()-1] == '"')
- {
- std::wstring str = value.substr(1, value.size() - 2);
- value = str;
- }
- }
- param_map[key] = value;
- }
-
- return true;
-}
-
-bool CommandLine::Get(const std::wstring &key, std::wstring &value)
-{
- value = L"";
- if (map_.size() == 0)
- return false;
-
- std::map::iterator it = map_.find(key);
- if (it == map_.end())
- return false;
-
- value = it->second;
-
- return true;
-}
-
-std::map CommandLine::GetMap(void)
-{
- return map_;
-}
-
-bool CommandLine::IsExist(const std::wstring &key)
-{
- return (map_.find(key) != map_.end());
-}
-}//namespace shared
\ No newline at end of file
diff --git a/tool_kits/shared/cmd_line.h b/tool_kits/shared/cmd_line.h
deleted file mode 100644
index 0f2bd9f0..00000000
--- a/tool_kits/shared/cmd_line.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef SHARED_CMD_LINE_H_
-#define SHARED_CMD_LINE_H_
-
-#include
-#include