├── README.md ├── 360SafeDemo ├── 360Safe.h ├── 360Safe.cpp ├── CMakeLists.txt ├── StdAfx.h ├── ControlEx.h └── StdAfx.cpp ├── nsi ├── main.nsi └── 360SafeRes │ ├── cloud.png │ ├── icon.ico │ ├── icon.png │ ├── logo.png │ ├── start.png │ ├── commmon.png │ ├── firewall.png │ ├── antivirus.png │ ├── scanbutton.png │ ├── scrollbar.bmp │ ├── button_hover.png │ ├── button_normal.png │ ├── button_pushed.png │ ├── firewall_ok.png │ ├── navigationbar.bmp │ ├── networkshield.png │ ├── preventnumber.png │ ├── sys_dlg_close.png │ ├── sys_dlg_max.png │ ├── sys_dlg_menu.png │ ├── sys_dlg_min.png │ ├── tabbar_hover.png │ ├── tabbar_normal.png │ ├── tabbar_pushed.png │ ├── toolbar_hover.png │ ├── softwaremanager.png │ ├── sys_dlg_restore.png │ ├── toolbar_normal.png │ ├── toolbar_pushed.png │ ├── vertical_border.bmp │ ├── examine_background.bmp │ ├── horizontal_border.bmp │ ├── ComputerExamine.xml │ └── skin.xml ├── DuiLib ├── StdAfx.h ├── Core │ ├── UIBase.cpp │ ├── UIBase.h │ ├── UIDefine.h │ ├── UIRender.h │ ├── UIControl.h │ ├── UIMarkup.cpp │ ├── UIRender.cpp │ ├── UIContainer.cpp │ ├── UIContainer.h │ ├── UIManager.cpp │ ├── UIDlgBuilder.cpp │ ├── UIDlgBuilder.h │ └── UIMarkup.h ├── Utils │ ├── Utils.cpp │ ├── WndShadow.h │ ├── WinImplBase.h │ ├── WinImplBase.cpp │ ├── FlashEventHandler.h │ ├── WebBrowserEventHandler.h │ ├── UIDelegate.cpp │ ├── UIDelegate.h │ ├── downloadmgr.h │ ├── Utils.h │ └── flash11.tlh ├── Control │ ├── UIFlash.h │ ├── UIList.h │ ├── UIButton.h │ ├── UICheckBox.h │ ├── UICombo.cpp │ ├── UIDateTime.h │ ├── UIEdit.cpp │ ├── UIFlash.cpp │ ├── UIGifAnim.h │ ├── UIList.cpp │ ├── UIRichEdit.h │ ├── UIActiveX.cpp │ ├── UIDateTime.cpp │ ├── UIGifAnim.cpp │ ├── UIRichEdit.cpp │ ├── UITreeView.cpp │ ├── UIWebBrowser.h │ ├── UIWebBrowser.cpp │ ├── UICheckBox.cpp │ ├── UIText.h │ ├── UIProgress.h │ ├── UISlider.h │ ├── UIOption.h │ ├── UIActiveX.h │ ├── UIEdit.h │ ├── UIProgress.cpp │ ├── UILabel.h │ ├── UIText.cpp │ ├── UIScrollBar.h │ ├── UITreeView.h │ ├── UICombo.h │ ├── UIOption.cpp │ ├── UISlider.cpp │ └── UIButton.cpp ├── StdAfx.cpp ├── Layout │ ├── UIChildLayout.h │ ├── UITabLayout.h │ ├── UITileLayout.h │ ├── UIVerticalLayout.h │ ├── UIHorizontalLayout.h │ ├── UIChildLayout.cpp │ ├── UITabLayout.cpp │ ├── UIVerticalLayout.cpp │ ├── UIHorizontalLayout.cpp │ └── UITileLayout.cpp ├── CMakeLists.txt ├── UIlib.cpp └── UIlib.h ├── NsisPlugin ├── src │ └── exdll.cpp ├── lib │ └── nsis │ │ ├── pluginapi-x86-ansi.lib │ │ └── pluginapi-x86-unicode.lib ├── CMakeLists.txt └── include │ └── nsis │ ├── api.h │ ├── pluginapi.h │ └── nsis_tchar.h ├── .gitignore ├── nsi-build.bat └── CMakeLists.txt /README.md: -------------------------------------------------------------------------------- 1 | # nsis-plugins-duilib 2 | 使用duilib库开发的nsis插件库 3 | -------------------------------------------------------------------------------- /360SafeDemo/360Safe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int MainFrame360(HINSTANCE hInstance); -------------------------------------------------------------------------------- /nsi/main.nsi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/main.nsi -------------------------------------------------------------------------------- /DuiLib/StdAfx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/StdAfx.h -------------------------------------------------------------------------------- /DuiLib/Core/UIBase.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIBase.cpp -------------------------------------------------------------------------------- /DuiLib/Core/UIBase.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIBase.h -------------------------------------------------------------------------------- /DuiLib/Core/UIDefine.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIDefine.h -------------------------------------------------------------------------------- /DuiLib/Core/UIRender.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIRender.h -------------------------------------------------------------------------------- /DuiLib/Utils/Utils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/Utils.cpp -------------------------------------------------------------------------------- /360SafeDemo/360Safe.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/360SafeDemo/360Safe.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIFlash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIFlash.h -------------------------------------------------------------------------------- /DuiLib/Control/UIList.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIList.h -------------------------------------------------------------------------------- /DuiLib/Core/UIControl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIControl.h -------------------------------------------------------------------------------- /DuiLib/Core/UIMarkup.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIMarkup.cpp -------------------------------------------------------------------------------- /DuiLib/Core/UIRender.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIRender.cpp -------------------------------------------------------------------------------- /DuiLib/Utils/WndShadow.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/WndShadow.h -------------------------------------------------------------------------------- /NsisPlugin/src/exdll.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/NsisPlugin/src/exdll.cpp -------------------------------------------------------------------------------- /nsi/360SafeRes/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/cloud.png -------------------------------------------------------------------------------- /nsi/360SafeRes/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/icon.ico -------------------------------------------------------------------------------- /nsi/360SafeRes/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/icon.png -------------------------------------------------------------------------------- /nsi/360SafeRes/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/logo.png -------------------------------------------------------------------------------- /nsi/360SafeRes/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/start.png -------------------------------------------------------------------------------- /DuiLib/Control/UIButton.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIButton.h -------------------------------------------------------------------------------- /DuiLib/Control/UICheckBox.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UICheckBox.h -------------------------------------------------------------------------------- /DuiLib/Control/UICombo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UICombo.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIDateTime.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIDateTime.h -------------------------------------------------------------------------------- /DuiLib/Control/UIEdit.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIEdit.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIFlash.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIFlash.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIGifAnim.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIGifAnim.h -------------------------------------------------------------------------------- /DuiLib/Control/UIList.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIList.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIRichEdit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIRichEdit.h -------------------------------------------------------------------------------- /DuiLib/Core/UIContainer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIContainer.cpp -------------------------------------------------------------------------------- /DuiLib/Core/UIContainer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIContainer.h -------------------------------------------------------------------------------- /DuiLib/Core/UIManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIManager.cpp -------------------------------------------------------------------------------- /DuiLib/Utils/WinImplBase.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/WinImplBase.h -------------------------------------------------------------------------------- /nsi/360SafeRes/commmon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/commmon.png -------------------------------------------------------------------------------- /nsi/360SafeRes/firewall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/firewall.png -------------------------------------------------------------------------------- /DuiLib/Control/UIActiveX.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIActiveX.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIDateTime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIDateTime.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIGifAnim.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIGifAnim.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIRichEdit.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIRichEdit.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UITreeView.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UITreeView.cpp -------------------------------------------------------------------------------- /DuiLib/Control/UIWebBrowser.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIWebBrowser.h -------------------------------------------------------------------------------- /DuiLib/Core/UIDlgBuilder.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Core/UIDlgBuilder.cpp -------------------------------------------------------------------------------- /DuiLib/Utils/WinImplBase.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/WinImplBase.cpp -------------------------------------------------------------------------------- /nsi/360SafeRes/antivirus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/antivirus.png -------------------------------------------------------------------------------- /nsi/360SafeRes/scanbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/scanbutton.png -------------------------------------------------------------------------------- /nsi/360SafeRes/scrollbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/scrollbar.bmp -------------------------------------------------------------------------------- /DuiLib/Control/UIWebBrowser.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Control/UIWebBrowser.cpp -------------------------------------------------------------------------------- /DuiLib/Utils/FlashEventHandler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/FlashEventHandler.h -------------------------------------------------------------------------------- /nsi/360SafeRes/button_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/button_hover.png -------------------------------------------------------------------------------- /nsi/360SafeRes/button_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/button_normal.png -------------------------------------------------------------------------------- /nsi/360SafeRes/button_pushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/button_pushed.png -------------------------------------------------------------------------------- /nsi/360SafeRes/firewall_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/firewall_ok.png -------------------------------------------------------------------------------- /nsi/360SafeRes/navigationbar.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/navigationbar.bmp -------------------------------------------------------------------------------- /nsi/360SafeRes/networkshield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/networkshield.png -------------------------------------------------------------------------------- /nsi/360SafeRes/preventnumber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/preventnumber.png -------------------------------------------------------------------------------- /nsi/360SafeRes/sys_dlg_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/sys_dlg_close.png -------------------------------------------------------------------------------- /nsi/360SafeRes/sys_dlg_max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/sys_dlg_max.png -------------------------------------------------------------------------------- /nsi/360SafeRes/sys_dlg_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/sys_dlg_menu.png -------------------------------------------------------------------------------- /nsi/360SafeRes/sys_dlg_min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/sys_dlg_min.png -------------------------------------------------------------------------------- /nsi/360SafeRes/tabbar_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/tabbar_hover.png -------------------------------------------------------------------------------- /nsi/360SafeRes/tabbar_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/tabbar_normal.png -------------------------------------------------------------------------------- /nsi/360SafeRes/tabbar_pushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/tabbar_pushed.png -------------------------------------------------------------------------------- /nsi/360SafeRes/toolbar_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/toolbar_hover.png -------------------------------------------------------------------------------- /nsi/360SafeRes/softwaremanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/softwaremanager.png -------------------------------------------------------------------------------- /nsi/360SafeRes/sys_dlg_restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/sys_dlg_restore.png -------------------------------------------------------------------------------- /nsi/360SafeRes/toolbar_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/toolbar_normal.png -------------------------------------------------------------------------------- /nsi/360SafeRes/toolbar_pushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/toolbar_pushed.png -------------------------------------------------------------------------------- /nsi/360SafeRes/vertical_border.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/vertical_border.bmp -------------------------------------------------------------------------------- /DuiLib/Utils/WebBrowserEventHandler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/DuiLib/Utils/WebBrowserEventHandler.h -------------------------------------------------------------------------------- /nsi/360SafeRes/examine_background.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/examine_background.bmp -------------------------------------------------------------------------------- /nsi/360SafeRes/horizontal_border.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/nsi/360SafeRes/horizontal_border.bmp -------------------------------------------------------------------------------- /NsisPlugin/lib/nsis/pluginapi-x86-ansi.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/NsisPlugin/lib/nsis/pluginapi-x86-ansi.lib -------------------------------------------------------------------------------- /NsisPlugin/lib/nsis/pluginapi-x86-unicode.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Macrored/nsis-plugins-duilib/HEAD/NsisPlugin/lib/nsis/pluginapi-x86-unicode.lib -------------------------------------------------------------------------------- /DuiLib/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // UIlib.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "StdAfx.h" 6 | 7 | 8 | #pragma comment( lib, "winmm.lib" ) 9 | #pragma comment( lib, "comctl32.lib" ) 10 | -------------------------------------------------------------------------------- /360SafeDemo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Cmake file for 360SafeDemo 2 | #Author: Qi Gao(monkgau@gmail.com) 3 | #Date: 2012/9/17 4 | 5 | set(source_files 360safe.cpp stdafx.cpp) 6 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 7 | 8 | set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 9 | add_library(360safedemo STATIC ${source_files}) 10 | set_target_properties(360safedemo PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") 11 | add_dependencies(360safedemo duilib) 12 | target_link_libraries(360safedemo duilib) 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # Zip 35 | *.zip 36 | *.tar 37 | *.7z 38 | 39 | # Folders 40 | build 41 | .vscode -------------------------------------------------------------------------------- /nsi-build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set ProjectPath=%~dp0 4 | set NsisPath=%ProjectPath%\..\NSIS 5 | set NsisCompiler=%NsisPath%\Bin\makensis.exe 6 | 7 | echo %ProjectPath% 8 | 9 | REM 判断dll是否编译完成 10 | if not exist %ProjectPath%\build\bin\Release\NsisPluginsDemo.dll echo [error] %ProjectPath%\build\Release\NsisPluginsDemo.dll not find. && exit /b 1 11 | 12 | REM 拷贝dll文件到NSIS编译器插件库 13 | copy /y %ProjectPath%\build\bin\Release\NsisPluginsDemo.dll %NsisPath%\Plugins\x86-unicode 14 | 15 | REM 开始编译 16 | %NsisCompiler% %ProjectPath%\nsi\main.nsi 17 | 18 | 19 | pause -------------------------------------------------------------------------------- /DuiLib/Layout/UIChildLayout.h: -------------------------------------------------------------------------------- 1 | #ifndef __UICHILDLAYOUT_H__ 2 | #define __UICHILDLAYOUT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CChildLayoutUI : public CContainerUI 9 | { 10 | public: 11 | CChildLayoutUI(); 12 | 13 | void Init(); 14 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 15 | void SetChildLayoutXML(CDuiString pXML); 16 | CDuiString GetChildLayoutXML(); 17 | virtual LPVOID GetInterface(LPCTSTR pstrName); 18 | virtual LPCTSTR GetClass() const; 19 | 20 | private: 21 | CDuiString m_pstrXMLFile; 22 | }; 23 | } // namespace DuiLib 24 | #endif // __UICHILDLAYOUT_H__ 25 | -------------------------------------------------------------------------------- /DuiLib/Control/UICheckBox.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UICheckBox.h" 3 | 4 | namespace DuiLib 5 | { 6 | LPCTSTR CCheckBoxUI::GetClass() const 7 | { 8 | return DUI_CTR_CHECKBOX; 9 | } 10 | 11 | LPVOID CCheckBoxUI::GetInterface(LPCTSTR pstrName) 12 | { 13 | if( _tcscmp(pstrName, DUI_CTR_CHECKBOX) == 0 ) return static_cast(this); 14 | return COptionUI::GetInterface(pstrName); 15 | } 16 | 17 | void CCheckBoxUI::SetCheck(bool bCheck, bool bTriggerEvent) 18 | { 19 | Selected(bCheck, bTriggerEvent); 20 | } 21 | 22 | bool CCheckBoxUI::GetCheck() const 23 | { 24 | return IsSelected(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /360SafeDemo/StdAfx.h: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) 3 | #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ 4 | 5 | #pragma once 6 | 7 | #define WIN32_LEAN_AND_MEAN 8 | #define _CRT_SECURE_NO_DEPRECATE 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "..\DuiLib\UIlib.h" 15 | 16 | using namespace DuiLib; 17 | 18 | //{{AFX_INSERT_LOCATION}} 19 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 20 | 21 | #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) 22 | -------------------------------------------------------------------------------- /360SafeDemo/ControlEx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ComputerExamineUI : public CContainerUI 4 | { 5 | public: 6 | ComputerExamineUI() 7 | { 8 | CDialogBuilder builder; 9 | CContainerUI* pComputerExamine = static_cast(builder.Create(_T("ComputerExamine.xml"), (UINT)0)); 10 | if( pComputerExamine ) { 11 | this->Add(pComputerExamine); 12 | } 13 | else { 14 | this->RemoveAll(); 15 | return; 16 | } 17 | } 18 | }; 19 | 20 | class CDialogBuilderCallbackEx : public IDialogBuilderCallback 21 | { 22 | public: 23 | CControlUI* CreateControl(LPCTSTR pstrClass) 24 | { 25 | if( _tcscmp(pstrClass, _T("ComputerExamine")) == 0 ) return new ComputerExamineUI; 26 | return NULL; 27 | } 28 | }; -------------------------------------------------------------------------------- /DuiLib/Control/UIText.h: -------------------------------------------------------------------------------- 1 | #ifndef __UITEXT_H__ 2 | #define __UITEXT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CTextUI : public CLabelUI 9 | { 10 | public: 11 | CTextUI(); 12 | ~CTextUI(); 13 | 14 | LPCTSTR GetClass() const; 15 | UINT GetControlFlags() const; 16 | LPVOID GetInterface(LPCTSTR pstrName); 17 | 18 | CDuiString* GetLinkContent(int iIndex); 19 | 20 | void DoEvent(TEventUI& event); 21 | 22 | void PaintText(HDC hDC); 23 | 24 | protected: 25 | enum { MAX_LINK = 8 }; 26 | int m_nLinks; 27 | RECT m_rcLinks[MAX_LINK]; 28 | CDuiString m_sLinks[MAX_LINK]; 29 | int m_nHoverLink; 30 | }; 31 | 32 | } // namespace DuiLib 33 | 34 | #endif //__UITEXT_H__ -------------------------------------------------------------------------------- /DuiLib/Layout/UITabLayout.h: -------------------------------------------------------------------------------- 1 | #ifndef __UITABLAYOUT_H__ 2 | #define __UITABLAYOUT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CTabLayoutUI : public CContainerUI 9 | { 10 | public: 11 | CTabLayoutUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | LPVOID GetInterface(LPCTSTR pstrName); 15 | 16 | bool Add(CControlUI* pControl); 17 | bool AddAt(CControlUI* pControl, int iIndex); 18 | bool Remove(CControlUI* pControl, bool bDoNotDestroy=false); 19 | void RemoveAll(); 20 | int GetCurSel() const; 21 | bool SelectItem(int iIndex, bool bTriggerEvent=true); 22 | bool SelectItem(CControlUI* pControl, bool bTriggerEvent=true); 23 | 24 | void SetPos(RECT rc, bool bNeedInvalidate = true); 25 | 26 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 27 | 28 | protected: 29 | int m_iCurSel; 30 | }; 31 | } 32 | #endif // __UITABLAYOUT_H__ 33 | -------------------------------------------------------------------------------- /DuiLib/Layout/UITileLayout.h: -------------------------------------------------------------------------------- 1 | #ifndef __UITILELAYOUT_H__ 2 | #define __UITILELAYOUT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CTileLayoutUI : public CContainerUI 9 | { 10 | public: 11 | CTileLayoutUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | LPVOID GetInterface(LPCTSTR pstrName); 15 | 16 | void SetPos(RECT rc, bool bNeedInvalidate = true); 17 | 18 | int GetFixedColumns() const; 19 | void SetFixedColumns(int iColums); 20 | int GetChildVPadding() const; 21 | void SetChildVPadding(int iPadding); 22 | 23 | SIZE GetItemSize() const; 24 | void SetItemSize(SIZE szSize); 25 | int GetColumns() const; 26 | int GetRows() const; 27 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 28 | 29 | protected: 30 | SIZE m_szItem; 31 | int m_nColumns; 32 | int m_nRows; 33 | 34 | int m_nColumnsFixed; 35 | int m_iChildVPadding; 36 | bool m_bIgnoreItemPadding; 37 | }; 38 | } 39 | #endif // __UITILELAYOUT_H__ 40 | -------------------------------------------------------------------------------- /DuiLib/Control/UIProgress.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIPROGRESS_H__ 2 | #define __UIPROGRESS_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CProgressUI : public CLabelUI 9 | { 10 | public: 11 | CProgressUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | LPVOID GetInterface(LPCTSTR pstrName); 15 | 16 | bool IsHorizontal(); 17 | void SetHorizontal(bool bHorizontal = true); 18 | int GetMinValue() const; 19 | void SetMinValue(int nMin); 20 | int GetMaxValue() const; 21 | void SetMaxValue(int nMax); 22 | int GetValue() const; 23 | void SetValue(int nValue); 24 | LPCTSTR GetForeImage() const; 25 | void SetForeImage(LPCTSTR pStrImage); 26 | 27 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 28 | void PaintStatusImage(HDC hDC); 29 | 30 | protected: 31 | bool m_bHorizontal; 32 | int m_nMax; 33 | int m_nMin; 34 | int m_nValue; 35 | 36 | TDrawInfo m_diFore; 37 | }; 38 | 39 | } // namespace DuiLib 40 | 41 | #endif // __UIPROGRESS_H__ 42 | -------------------------------------------------------------------------------- /DuiLib/Layout/UIVerticalLayout.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIVERTICALLAYOUT_H__ 2 | #define __UIVERTICALLAYOUT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CVerticalLayoutUI : public CContainerUI 9 | { 10 | public: 11 | CVerticalLayoutUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | LPVOID GetInterface(LPCTSTR pstrName); 15 | UINT GetControlFlags() const; 16 | 17 | void SetSepHeight(int iHeight); 18 | int GetSepHeight() const; 19 | void SetSepImmMode(bool bImmediately); 20 | bool IsSepImmMode() const; 21 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 22 | void DoEvent(TEventUI& event); 23 | 24 | void SetPos(RECT rc, bool bNeedInvalidate = true); 25 | void DoPostPaint(HDC hDC, const RECT& rcPaint); 26 | 27 | RECT GetThumbRect(bool bUseNew = false) const; 28 | 29 | protected: 30 | int m_iSepHeight; 31 | UINT m_uButtonState; 32 | POINT m_ptLastMouse; 33 | RECT m_rcNewPos; 34 | bool m_bImmMode; 35 | }; 36 | } 37 | #endif // __UIVERTICALLAYOUT_H__ 38 | -------------------------------------------------------------------------------- /DuiLib/Layout/UIHorizontalLayout.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIHORIZONTALLAYOUT_H__ 2 | #define __UIHORIZONTALLAYOUT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CHorizontalLayoutUI : public CContainerUI 9 | { 10 | public: 11 | CHorizontalLayoutUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | LPVOID GetInterface(LPCTSTR pstrName); 15 | UINT GetControlFlags() const; 16 | 17 | void SetSepWidth(int iWidth); 18 | int GetSepWidth() const; 19 | void SetSepImmMode(bool bImmediately); 20 | bool IsSepImmMode() const; 21 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 22 | void DoEvent(TEventUI& event); 23 | 24 | void SetPos(RECT rc, bool bNeedInvalidate = true); 25 | void DoPostPaint(HDC hDC, const RECT& rcPaint); 26 | 27 | RECT GetThumbRect(bool bUseNew = false) const; 28 | 29 | protected: 30 | int m_iSepWidth; 31 | UINT m_uButtonState; 32 | POINT m_ptLastMouse; 33 | RECT m_rcNewPos; 34 | bool m_bImmMode; 35 | }; 36 | } 37 | #endif // __UIHORIZONTALLAYOUT_H__ 38 | -------------------------------------------------------------------------------- /NsisPlugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") 2 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKR_FLAGS} /SAFESEH:NO /NODEFAULTLIB:libc.lib") 3 | # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKR_FLAGS} /NODEFAULTLIB:libc.lib") 4 | # set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKR_FLAGS} /SAFESEH:NO") 5 | # set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") 6 | 7 | set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) 8 | 9 | aux_source_directory(./src Main_Source_Files) 10 | 11 | include_directories( 12 | ${CMAKE_CURRENT_SOURCE_DIR}/include 13 | ${PROJECT_SOURCE_DIR}/360SafeDemo 14 | ) 15 | 16 | # 指定库文件链接路径 17 | link_directories( 18 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/nsis 19 | ) 20 | 21 | # 指定生成目标 22 | add_library(NsisPluginsDemo SHARED ${Main_Source_Files}) 23 | add_dependencies(NsisPluginsDemo 360safedemo) 24 | 25 | # 指定目标文件链接的库名 26 | target_link_libraries(NsisPluginsDemo 360safedemo) 27 | target_link_libraries(NsisPluginsDemo pluginapi-x86-unicode.lib) 28 | 29 | -------------------------------------------------------------------------------- /360SafeDemo/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // App.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | #if defined _M_IX86 8 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 9 | #elif defined _M_IA64 10 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") 11 | #elif defined _M_X64 12 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 13 | #else 14 | #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 15 | #endif 16 | -------------------------------------------------------------------------------- /DuiLib/Core/UIDlgBuilder.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIDLGBUILDER_H__ 2 | #define __UIDLGBUILDER_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib { 7 | 8 | class IDialogBuilderCallback 9 | { 10 | public: 11 | virtual CControlUI* CreateControl(LPCTSTR pstrClass) = 0; 12 | }; 13 | 14 | 15 | class DUILIB_API CDialogBuilder 16 | { 17 | public: 18 | CDialogBuilder(); 19 | CControlUI* Create(STRINGorID xml, LPCTSTR type = NULL, IDialogBuilderCallback* pCallback = NULL, 20 | CPaintManagerUI* pManager = NULL, CControlUI* pParent = NULL); 21 | CControlUI* Create(IDialogBuilderCallback* pCallback = NULL, CPaintManagerUI* pManager = NULL, 22 | CControlUI* pParent = NULL); 23 | 24 | CMarkup* GetMarkup(); 25 | 26 | void GetLastErrorMessage(LPTSTR pstrMessage, SIZE_T cchMax) const; 27 | void GetLastErrorLocation(LPTSTR pstrSource, SIZE_T cchMax) const; 28 | private: 29 | CControlUI* _Parse(CMarkupNode* parent, CControlUI* pParent = NULL, CPaintManagerUI* pManager = NULL); 30 | 31 | CMarkup m_xml; 32 | IDialogBuilderCallback* m_pCallback; 33 | LPCTSTR m_pstrtype; 34 | }; 35 | 36 | } // namespace DuiLib 37 | 38 | #endif // __UIDLGBUILDER_H__ 39 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | 3 | # 设置工程属性 4 | project(NsisPluginsDemo) 5 | add_definitions(-DUNICODE -D_UNICODE) # 定义工程的字符编码为Unicode编码 6 | set(CMAKE_CXX_FLAGS_RELEASE "/MT") # Release模式使用静态链接其他动态库 7 | set(CMAKE_CXX_FLAGS_DEBUG "/MTd") # Debug模式使用静态链接其他动态库 8 | 9 | # 引用Boost库 10 | find_package(Boost 1.7.0 REQUIRED COMPONENTS system) 11 | set(Boost_USE_STATIC_LIBS ON) 12 | 13 | # 编译参数 14 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 15 | add_definitions(-std=c++14) # c++14标准 16 | add_compile_options(-g) # gdb调试模式,默认则是三级二进制优化模式-O3 17 | elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") 18 | add_definitions(/std:c++14) 19 | endif(CMAKE_SYSTEM_NAME MATCHES "Linux") 20 | 21 | # 获取源文件 22 | aux_source_directory(. SourceFiles) 23 | message(STATUS "Boost_INCLUDE_DIRS:${Boost_INCLUDE_DIRS}") 24 | message(STATUS "Boost_LIBRARY_DIRS:${Boost_LIBRARY_DIRS}") 25 | message(STATUS "Boost_LIBRARIES:${Boost_LIBRARIES}") 26 | 27 | # 头文件查找路径 28 | include_directories( 29 | ${PROJECT_SOURCE_DIR} 30 | ${CMAKE_CURRENT_SOURCE_DIR}/include 31 | ${Boost_INCLUDE_DIRS}) 32 | # 库文件查找路径 33 | link_directories(${Boost_LIBRARY_DIRS}) 34 | 35 | add_subdirectory(DuiLib) 36 | add_subdirectory(360SafeDemo) 37 | add_subdirectory(NsisPlugin) -------------------------------------------------------------------------------- /DuiLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cmake file for duilib 2 | #Author Qi Gao(monkgau@gmail.com) 3 | #Created: 2012/09/16 4 | 5 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} Root_src) 6 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/Control Control_src) 7 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/Core Core_src) 8 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/Layout Layout_src) 9 | aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/Utils Utils_src) 10 | 11 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 12 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Control) 13 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Core) 14 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Layout) 15 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Utils) 16 | 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) 18 | add_library(duilib STATIC ${Control_src} ${Core_src} ${Layout_src} ${Utils_src} ${Root_src}) 19 | 20 | add_definitions(-DUILIB_EXPORTS) 21 | target_link_libraries(duilib comctl32) 22 | set_target_properties(duilib PROPERTIES OUTPUT_NAME "duilib") 23 | # add_custom_command(TARGET duilib POST_BUILD 24 | # COMMAND ${CMAKE_COMMAND} -E copy_if_different 25 | # ${PROJECT_BINARY_DIR}/lib/Release/duilib.dll ${PROJECT_BINARY_DIR}/bin/Release/duilib.dll) 26 | -------------------------------------------------------------------------------- /DuiLib/Control/UISlider.h: -------------------------------------------------------------------------------- 1 | #ifndef __UISLIDER_H__ 2 | #define __UISLIDER_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API CSliderUI : public CProgressUI 9 | { 10 | public: 11 | CSliderUI(); 12 | 13 | LPCTSTR GetClass() const; 14 | UINT GetControlFlags() const; 15 | LPVOID GetInterface(LPCTSTR pstrName); 16 | 17 | void SetEnabled(bool bEnable = true); 18 | 19 | int GetChangeStep(); 20 | void SetChangeStep(int step); 21 | void SetThumbSize(SIZE szXY); 22 | RECT GetThumbRect() const; 23 | bool IsImmMode() const; 24 | void SetImmMode(bool bImmMode); 25 | LPCTSTR GetThumbImage() const; 26 | void SetThumbImage(LPCTSTR pStrImage); 27 | LPCTSTR GetThumbHotImage() const; 28 | void SetThumbHotImage(LPCTSTR pStrImage); 29 | LPCTSTR GetThumbPushedImage() const; 30 | void SetThumbPushedImage(LPCTSTR pStrImage); 31 | 32 | void DoEvent(TEventUI& event); 33 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 34 | void PaintStatusImage(HDC hDC); 35 | 36 | protected: 37 | SIZE m_szThumb; 38 | UINT m_uButtonState; 39 | int m_nStep; 40 | bool m_bImmMode; 41 | 42 | TDrawInfo m_diThumb; 43 | TDrawInfo m_diThumbHot; 44 | TDrawInfo m_diThumbPushed; 45 | }; 46 | } 47 | 48 | #endif // __UISLIDER_H__ -------------------------------------------------------------------------------- /DuiLib/Layout/UIChildLayout.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UIChildLayout.h" 3 | 4 | namespace DuiLib 5 | { 6 | CChildLayoutUI::CChildLayoutUI() 7 | { 8 | 9 | } 10 | 11 | void CChildLayoutUI::Init() 12 | { 13 | if (!m_pstrXMLFile.IsEmpty()) 14 | { 15 | CDialogBuilder builder; 16 | CContainerUI* pChildWindow = static_cast(builder.Create(m_pstrXMLFile.GetData(), (UINT)0, NULL, m_pManager)); 17 | if (pChildWindow) 18 | { 19 | this->Add(pChildWindow); 20 | } 21 | else 22 | { 23 | this->RemoveAll(); 24 | } 25 | } 26 | } 27 | 28 | void CChildLayoutUI::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue ) 29 | { 30 | if( _tcscmp(pstrName, _T("xmlfile")) == 0 ) 31 | SetChildLayoutXML(pstrValue); 32 | else 33 | CContainerUI::SetAttribute(pstrName,pstrValue); 34 | } 35 | 36 | void CChildLayoutUI::SetChildLayoutXML( CDuiString pXML ) 37 | { 38 | m_pstrXMLFile=pXML; 39 | } 40 | 41 | CDuiString CChildLayoutUI::GetChildLayoutXML() 42 | { 43 | return m_pstrXMLFile; 44 | } 45 | 46 | LPVOID CChildLayoutUI::GetInterface( LPCTSTR pstrName ) 47 | { 48 | if( _tcscmp(pstrName, DUI_CTR_CHILDLAYOUT) == 0 ) return static_cast(this); 49 | return CControlUI::GetInterface(pstrName); 50 | } 51 | 52 | LPCTSTR CChildLayoutUI::GetClass() const 53 | { 54 | return DUI_CTR_CHILDLAYOUT; 55 | } 56 | } // namespace DuiLib 57 | -------------------------------------------------------------------------------- /DuiLib/Control/UIOption.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIOPTION_H__ 2 | #define __UIOPTION_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class DUILIB_API COptionUI : public CButtonUI 9 | { 10 | public: 11 | COptionUI(); 12 | ~COptionUI(); 13 | 14 | LPCTSTR GetClass() const; 15 | LPVOID GetInterface(LPCTSTR pstrName); 16 | 17 | void SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit = true); 18 | 19 | bool Activate(); 20 | void SetEnabled(bool bEnable = true); 21 | 22 | LPCTSTR GetSelectedImage(); 23 | void SetSelectedImage(LPCTSTR pStrImage); 24 | 25 | LPCTSTR GetSelectedHotImage(); 26 | void SetSelectedHotImage(LPCTSTR pStrImage); 27 | 28 | void SetSelectedTextColor(DWORD dwTextColor); 29 | DWORD GetSelectedTextColor(); 30 | 31 | void SetSelectedBkColor(DWORD dwBkColor); 32 | DWORD GetSelectedBkColor(); 33 | DUI_DEPRECATED DWORD GetSelectBkColor(); // deprecated, use GetSelectedBkColor instead 34 | 35 | LPCTSTR GetForeImage(); 36 | void SetForeImage(LPCTSTR pStrImage); 37 | 38 | LPCTSTR GetGroup() const; 39 | void SetGroup(LPCTSTR pStrGroupName = NULL); 40 | bool IsSelected() const; 41 | virtual void Selected(bool bSelected, bool bTriggerEvent=true); 42 | 43 | SIZE EstimateSize(SIZE szAvailable); 44 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 45 | 46 | void PaintStatusImage(HDC hDC); 47 | void PaintText(HDC hDC); 48 | 49 | protected: 50 | bool m_bSelected; 51 | CDuiString m_sGroupName; 52 | 53 | DWORD m_dwSelectedBkColor; 54 | DWORD m_dwSelectedTextColor; 55 | 56 | TDrawInfo m_diSelected; 57 | TDrawInfo m_diSelectedHot; 58 | TDrawInfo m_diFore; 59 | }; 60 | 61 | } // namespace DuiLib 62 | 63 | #endif // __UIOPTION_H__ -------------------------------------------------------------------------------- /DuiLib/Control/UIActiveX.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIACTIVEX_H__ 2 | #define __UIACTIVEX_H__ 3 | 4 | #pragma once 5 | 6 | struct IOleObject; 7 | 8 | 9 | namespace DuiLib { 10 | ///////////////////////////////////////////////////////////////////////////////////// 11 | // 12 | 13 | class CActiveXCtrl; 14 | 15 | template< class T > 16 | class CSafeRelease 17 | { 18 | public: 19 | CSafeRelease(T* p) : m_p(p) { }; 20 | ~CSafeRelease() { if( m_p != NULL ) m_p->Release(); }; 21 | T* Detach() { T* t = m_p; m_p = NULL; return t; }; 22 | T* m_p; 23 | }; 24 | 25 | ///////////////////////////////////////////////////////////////////////////////////// 26 | // 27 | 28 | class DUILIB_API CActiveXUI : public CControlUI, public IMessageFilterUI 29 | { 30 | friend class CActiveXCtrl; 31 | public: 32 | CActiveXUI(); 33 | virtual ~CActiveXUI(); 34 | 35 | LPCTSTR GetClass() const; 36 | LPVOID GetInterface(LPCTSTR pstrName); 37 | UINT GetControlFlags() const; 38 | HWND GetNativeWindow() const; 39 | 40 | bool IsDelayCreate() const; 41 | void SetDelayCreate(bool bDelayCreate = true); 42 | 43 | bool CreateControl(const CLSID clsid); 44 | bool CreateControl(LPCTSTR pstrCLSID); 45 | HRESULT GetControl(const IID iid, LPVOID* ppRet); 46 | CLSID GetClisd() const; 47 | CDuiString GetModuleName() const; 48 | void SetModuleName(LPCTSTR pstrText); 49 | 50 | void SetVisible(bool bVisible = true); 51 | void SetInternVisible(bool bVisible = true); 52 | void SetPos(RECT rc, bool bNeedInvalidate = true); 53 | void Move(SIZE szOffset, bool bNeedInvalidate = true); 54 | bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl); 55 | 56 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 57 | 58 | LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled); 59 | 60 | protected: 61 | virtual void ReleaseControl(); 62 | virtual bool DoCreateControl(); 63 | 64 | protected: 65 | CLSID m_clsid; 66 | CDuiString m_sModuleName; 67 | bool m_bCreated; 68 | bool m_bDelayCreate; 69 | IOleObject* m_pUnk; 70 | CActiveXCtrl* m_pControl; 71 | HWND m_hwndHost; 72 | }; 73 | 74 | } // namespace DuiLib 75 | 76 | #endif // __UIACTIVEX_H__ 77 | -------------------------------------------------------------------------------- /DuiLib/Utils/UIDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | 3 | namespace DuiLib { 4 | 5 | CDelegateBase::CDelegateBase(void* pObject, void* pFn) 6 | { 7 | m_pObject = pObject; 8 | m_pFn = pFn; 9 | } 10 | 11 | CDelegateBase::CDelegateBase(const CDelegateBase& rhs) 12 | { 13 | m_pObject = rhs.m_pObject; 14 | m_pFn = rhs.m_pFn; 15 | } 16 | 17 | CDelegateBase::~CDelegateBase() 18 | { 19 | 20 | } 21 | 22 | bool CDelegateBase::Equals(const CDelegateBase& rhs) const 23 | { 24 | return m_pObject == rhs.m_pObject && m_pFn == rhs.m_pFn; 25 | } 26 | 27 | bool CDelegateBase::operator() (void* param) 28 | { 29 | return Invoke(param); 30 | } 31 | 32 | void* CDelegateBase::GetFn() 33 | { 34 | return m_pFn; 35 | } 36 | 37 | void* CDelegateBase::GetObject() 38 | { 39 | return m_pObject; 40 | } 41 | 42 | CEventSource::~CEventSource() 43 | { 44 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) { 45 | CDelegateBase* pObject = static_cast(m_aDelegates[i]); 46 | if( pObject) delete pObject; 47 | } 48 | } 49 | 50 | CEventSource::operator bool() 51 | { 52 | return m_aDelegates.GetSize() > 0; 53 | } 54 | 55 | void CEventSource::operator+= (const CDelegateBase& d) 56 | { 57 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) { 58 | CDelegateBase* pObject = static_cast(m_aDelegates[i]); 59 | if( pObject && pObject->Equals(d) ) return; 60 | } 61 | 62 | m_aDelegates.Add(d.Copy()); 63 | } 64 | 65 | void CEventSource::operator+= (FnType pFn) 66 | { 67 | (*this) += MakeDelegate(pFn); 68 | } 69 | 70 | void CEventSource::operator-= (const CDelegateBase& d) 71 | { 72 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) { 73 | CDelegateBase* pObject = static_cast(m_aDelegates[i]); 74 | if( pObject && pObject->Equals(d) ) { 75 | delete pObject; 76 | m_aDelegates.Remove(i); 77 | return; 78 | } 79 | } 80 | } 81 | void CEventSource::operator-= (FnType pFn) 82 | { 83 | (*this) -= MakeDelegate(pFn); 84 | } 85 | 86 | bool CEventSource::operator() (void* param) 87 | { 88 | for( int i = 0; i < m_aDelegates.GetSize(); i++ ) { 89 | CDelegateBase* pObject = static_cast(m_aDelegates[i]); 90 | if( pObject && !(*pObject)(param) ) return false; 91 | } 92 | return true; 93 | } 94 | 95 | } // namespace DuiLib 96 | -------------------------------------------------------------------------------- /DuiLib/Control/UIEdit.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIEDIT_H__ 2 | #define __UIEDIT_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib 7 | { 8 | class CEditWnd; 9 | 10 | class DUILIB_API CEditUI : public CLabelUI 11 | { 12 | friend class CEditWnd; 13 | public: 14 | CEditUI(); 15 | 16 | LPCTSTR GetClass() const; 17 | LPVOID GetInterface(LPCTSTR pstrName); 18 | UINT GetControlFlags() const; 19 | HWND GetNativeWindow() const; 20 | 21 | void SetEnabled(bool bEnable = true); 22 | void SetText(LPCTSTR pstrText); 23 | void SetMaxChar(UINT uMax); 24 | UINT GetMaxChar(); 25 | void SetReadOnly(bool bReadOnly); 26 | bool IsReadOnly() const; 27 | void SetPasswordMode(bool bPasswordMode); 28 | bool IsPasswordMode() const; 29 | void SetPasswordChar(TCHAR cPasswordChar); 30 | TCHAR GetPasswordChar() const; 31 | bool IsAutoSelAll(); 32 | void SetAutoSelAll(bool bAutoSelAll); 33 | void SetNumberOnly(bool bNumberOnly); 34 | bool IsNumberOnly() const; 35 | int GetWindowStyls() const; 36 | HWND GetNativeEditHWND() const; 37 | 38 | LPCTSTR GetNormalImage(); 39 | void SetNormalImage(LPCTSTR pStrImage); 40 | LPCTSTR GetHotImage(); 41 | void SetHotImage(LPCTSTR pStrImage); 42 | LPCTSTR GetFocusedImage(); 43 | void SetFocusedImage(LPCTSTR pStrImage); 44 | LPCTSTR GetDisabledImage(); 45 | void SetDisabledImage(LPCTSTR pStrImage); 46 | void SetNativeEditBkColor(DWORD dwBkColor); 47 | DWORD GetNativeEditBkColor() const; 48 | 49 | void SetSel(long nStartChar, long nEndChar); 50 | void SetSelAll(); 51 | void SetReplaceSel(LPCTSTR lpszReplace); 52 | 53 | void SetPos(RECT rc, bool bNeedInvalidate = true); 54 | void Move(SIZE szOffset, bool bNeedInvalidate = true); 55 | void SetVisible(bool bVisible = true); 56 | void SetInternVisible(bool bVisible = true); 57 | SIZE EstimateSize(SIZE szAvailable); 58 | void DoEvent(TEventUI& event); 59 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 60 | 61 | void PaintStatusImage(HDC hDC); 62 | void PaintText(HDC hDC); 63 | 64 | protected: 65 | CEditWnd* m_pWindow; 66 | 67 | UINT m_uMaxChar; 68 | bool m_bReadOnly; 69 | bool m_bPasswordMode; 70 | bool m_bAutoSelAll; 71 | TCHAR m_cPasswordChar; 72 | UINT m_uButtonState; 73 | DWORD m_dwEditbkColor; 74 | int m_iWindowStyls; 75 | 76 | TDrawInfo m_diNormal; 77 | TDrawInfo m_diHot; 78 | TDrawInfo m_diFocused; 79 | TDrawInfo m_diDisabled; 80 | }; 81 | } 82 | #endif // __UIEDIT_H__ -------------------------------------------------------------------------------- /DuiLib/Utils/UIDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIDELEGATE_H__ 2 | #define __UIDELEGATE_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib { 7 | 8 | class DUILIB_API CDelegateBase 9 | { 10 | public: 11 | CDelegateBase(void* pObject, void* pFn); 12 | CDelegateBase(const CDelegateBase& rhs); 13 | virtual ~CDelegateBase(); 14 | bool Equals(const CDelegateBase& rhs) const; 15 | bool operator() (void* param); 16 | virtual CDelegateBase* Copy() const = 0; // add const for gcc 17 | 18 | protected: 19 | void* GetFn(); 20 | void* GetObject(); 21 | virtual bool Invoke(void* param) = 0; 22 | 23 | private: 24 | void* m_pObject; 25 | void* m_pFn; 26 | }; 27 | 28 | class CDelegateStatic: public CDelegateBase 29 | { 30 | typedef bool (*Fn)(void*); 31 | public: 32 | CDelegateStatic(Fn pFn) : CDelegateBase(NULL, pFn) { } 33 | CDelegateStatic(const CDelegateStatic& rhs) : CDelegateBase(rhs) { } 34 | virtual CDelegateBase* Copy() const { return new CDelegateStatic(*this); } 35 | 36 | protected: 37 | virtual bool Invoke(void* param) 38 | { 39 | Fn pFn = (Fn)GetFn(); 40 | return (*pFn)(param); 41 | } 42 | }; 43 | 44 | template 45 | class CDelegate : public CDelegateBase 46 | { 47 | typedef bool (T::* Fn)(void*); 48 | public: 49 | CDelegate(O* pObj, Fn pFn) : CDelegateBase(pObj, *(void**)&pFn) { } 50 | CDelegate(const CDelegate& rhs) : CDelegateBase(rhs) { } 51 | virtual CDelegateBase* Copy() const { return new CDelegate(*this); } 52 | 53 | protected: 54 | virtual bool Invoke(void* param) 55 | { 56 | O* pObject = (O*) GetObject(); 57 | union 58 | { 59 | void* ptr; 60 | Fn fn; 61 | } func = { GetFn() }; 62 | return (pObject->*func.fn)(param); 63 | } 64 | 65 | private: 66 | Fn m_pFn; 67 | }; 68 | 69 | template 70 | CDelegate MakeDelegate(O* pObject, bool (T::* pFn)(void*)) 71 | { 72 | return CDelegate(pObject, pFn); 73 | } 74 | 75 | inline CDelegateStatic MakeDelegate(bool (*pFn)(void*)) 76 | { 77 | return CDelegateStatic(pFn); 78 | } 79 | 80 | class DUILIB_API CEventSource 81 | { 82 | typedef bool (*FnType)(void*); 83 | public: 84 | ~CEventSource(); 85 | operator bool(); 86 | void operator+= (const CDelegateBase& d); // add const for gcc 87 | void operator+= (FnType pFn); 88 | void operator-= (const CDelegateBase& d); 89 | void operator-= (FnType pFn); 90 | bool operator() (void* param); 91 | 92 | protected: 93 | CDuiPtrArray m_aDelegates; 94 | }; 95 | 96 | } // namespace DuiLib 97 | 98 | #endif // __UIDELEGATE_H__ -------------------------------------------------------------------------------- /DuiLib/UIlib.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2010-2011, duilib develop team(www.duilib.com). 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or 5 | // without modification, are permitted provided that the 6 | // following conditions are met. 7 | // 8 | // Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // 11 | // Redistributions in binary form must reproduce the above 12 | // copyright notice, this list of conditions and the following 13 | // disclaimer in the documentation and/or other materials 14 | // provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 17 | // CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 18 | // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // 31 | // DirectUI - UI Library 32 | // 33 | // Written by Bjarke Viksoe (bjarke@viksoe.dk) 34 | // Copyright (c) 2006-2007 Bjarke Viksoe. 35 | // 36 | // This code may be used in compiled form in any way you desire. These 37 | // source files may be redistributed by any means PROVIDING it is 38 | // not sold for profit without the authors written consent, and 39 | // providing that this notice and the authors name is included. 40 | // 41 | // This file is provided "as is" with no expressed or implied warranty. 42 | // The author accepts no liability if it causes any damage to you or your 43 | // computer whatsoever. It's free, so don't hassle me about it. 44 | // 45 | // Beware of bugs. 46 | // 47 | // 48 | 49 | 50 | #include "stdafx.h" 51 | #include "UIlib.h" 52 | 53 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID /*lpReserved*/) 54 | { 55 | switch (dwReason) { 56 | case DLL_PROCESS_ATTACH: 57 | case DLL_THREAD_ATTACH: 58 | case DLL_THREAD_DETACH: 59 | case DLL_PROCESS_DETACH: 60 | ::DisableThreadLibraryCalls((HMODULE)hModule); 61 | break; 62 | } 63 | return TRUE; 64 | } 65 | -------------------------------------------------------------------------------- /DuiLib/Control/UIProgress.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "UIProgress.h" 3 | 4 | namespace DuiLib 5 | { 6 | CProgressUI::CProgressUI() : m_bHorizontal(true), m_nMin(0), m_nMax(100), m_nValue(0) 7 | { 8 | m_uTextStyle = DT_SINGLELINE | DT_CENTER; 9 | SetFixedHeight(12); 10 | } 11 | 12 | LPCTSTR CProgressUI::GetClass() const 13 | { 14 | return DUI_CTR_PROGRESS; 15 | } 16 | 17 | LPVOID CProgressUI::GetInterface(LPCTSTR pstrName) 18 | { 19 | if( _tcscmp(pstrName, DUI_CTR_PROGRESS) == 0 ) return static_cast(this); 20 | return CLabelUI::GetInterface(pstrName); 21 | } 22 | 23 | bool CProgressUI::IsHorizontal() 24 | { 25 | return m_bHorizontal; 26 | } 27 | 28 | void CProgressUI::SetHorizontal(bool bHorizontal) 29 | { 30 | if( m_bHorizontal == bHorizontal ) return; 31 | 32 | m_bHorizontal = bHorizontal; 33 | Invalidate(); 34 | } 35 | 36 | int CProgressUI::GetMinValue() const 37 | { 38 | return m_nMin; 39 | } 40 | 41 | void CProgressUI::SetMinValue(int nMin) 42 | { 43 | m_nMin = nMin; 44 | Invalidate(); 45 | } 46 | 47 | int CProgressUI::GetMaxValue() const 48 | { 49 | return m_nMax; 50 | } 51 | 52 | void CProgressUI::SetMaxValue(int nMax) 53 | { 54 | m_nMax = nMax; 55 | Invalidate(); 56 | } 57 | 58 | int CProgressUI::GetValue() const 59 | { 60 | return m_nValue; 61 | } 62 | 63 | void CProgressUI::SetValue(int nValue) 64 | { 65 | m_nValue = nValue; 66 | if (m_nValue > m_nMax) m_nValue = m_nMax; 67 | if (m_nValue < m_nMin) m_nValue = m_nMin; 68 | Invalidate(); 69 | } 70 | 71 | LPCTSTR CProgressUI::GetForeImage() const 72 | { 73 | return m_diFore.sDrawString; 74 | } 75 | 76 | void CProgressUI::SetForeImage(LPCTSTR pStrImage) 77 | { 78 | if( m_diFore.sDrawString == pStrImage && m_diFore.pImageInfo != NULL ) return; 79 | m_diFore.Clear(); 80 | m_diFore.sDrawString = pStrImage; 81 | Invalidate(); 82 | } 83 | 84 | void CProgressUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) 85 | { 86 | if( _tcscmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue); 87 | else if( _tcscmp(pstrName, _T("hor")) == 0 ) SetHorizontal(_tcscmp(pstrValue, _T("true")) == 0); 88 | else if( _tcscmp(pstrName, _T("min")) == 0 ) SetMinValue(_ttoi(pstrValue)); 89 | else if( _tcscmp(pstrName, _T("max")) == 0 ) SetMaxValue(_ttoi(pstrValue)); 90 | else if( _tcscmp(pstrName, _T("value")) == 0 ) SetValue(_ttoi(pstrValue)); 91 | else CLabelUI::SetAttribute(pstrName, pstrValue); 92 | } 93 | 94 | void CProgressUI::PaintStatusImage(HDC hDC) 95 | { 96 | if( m_nMax <= m_nMin ) m_nMax = m_nMin + 1; 97 | if( m_nValue > m_nMax ) m_nValue = m_nMax; 98 | if( m_nValue < m_nMin ) m_nValue = m_nMin; 99 | 100 | RECT rc = {0}; 101 | if( m_bHorizontal ) { 102 | rc.right = (m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left) / (m_nMax - m_nMin); 103 | rc.bottom = m_rcItem.bottom - m_rcItem.top; 104 | } 105 | else { 106 | rc.top = (m_rcItem.bottom - m_rcItem.top) * (m_nMax - m_nValue) / (m_nMax - m_nMin); 107 | rc.right = m_rcItem.right - m_rcItem.left; 108 | rc.bottom = m_rcItem.bottom - m_rcItem.top; 109 | } 110 | m_diFore.rcDestOffset = rc; 111 | if( DrawImage(hDC, m_diFore) ) return; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /DuiLib/Core/UIMarkup.h: -------------------------------------------------------------------------------- 1 | #ifndef __UIMARKUP_H__ 2 | #define __UIMARKUP_H__ 3 | 4 | #pragma once 5 | 6 | namespace DuiLib { 7 | 8 | enum 9 | { 10 | XMLFILE_ENCODING_UTF8 = 0, 11 | XMLFILE_ENCODING_UNICODE = 1, 12 | XMLFILE_ENCODING_ASNI = 2, 13 | }; 14 | 15 | class CMarkup; 16 | class CMarkupNode; 17 | 18 | 19 | class DUILIB_API CMarkup 20 | { 21 | friend class CMarkupNode; 22 | public: 23 | CMarkup(LPCTSTR pstrXML = NULL); 24 | ~CMarkup(); 25 | 26 | bool Load(LPCTSTR pstrXML); 27 | bool LoadFromMem(BYTE* pByte, DWORD dwSize, int encoding = XMLFILE_ENCODING_UTF8); 28 | bool LoadFromFile(LPCTSTR pstrFilename, int encoding = XMLFILE_ENCODING_UTF8); 29 | void Release(); 30 | bool IsValid() const; 31 | 32 | void SetPreserveWhitespace(bool bPreserve = true); 33 | void GetLastErrorMessage(LPTSTR pstrMessage, SIZE_T cchMax) const; 34 | void GetLastErrorLocation(LPTSTR pstrSource, SIZE_T cchMax) const; 35 | 36 | CMarkupNode GetRoot(); 37 | 38 | private: 39 | typedef struct tagXMLELEMENT 40 | { 41 | ULONG iStart; 42 | ULONG iChild; 43 | ULONG iNext; 44 | ULONG iParent; 45 | ULONG iData; 46 | } XMLELEMENT; 47 | 48 | LPTSTR m_pstrXML; 49 | XMLELEMENT* m_pElements; 50 | ULONG m_nElements; 51 | ULONG m_nReservedElements; 52 | TCHAR m_szErrorMsg[100]; 53 | TCHAR m_szErrorXML[50]; 54 | bool m_bPreserveWhitespace; 55 | 56 | private: 57 | bool _Parse(); 58 | bool _Parse(LPTSTR& pstrText, ULONG iParent); 59 | XMLELEMENT* _ReserveElement(); 60 | inline void _SkipWhitespace(LPTSTR& pstr) const; 61 | inline void _SkipWhitespace(LPCTSTR& pstr) const; 62 | inline void _SkipIdentifier(LPTSTR& pstr) const; 63 | inline void _SkipIdentifier(LPCTSTR& pstr) const; 64 | bool _ParseData(LPTSTR& pstrText, LPTSTR& pstrData, char cEnd); 65 | void _ParseMetaChar(LPTSTR& pstrText, LPTSTR& pstrDest); 66 | bool _ParseAttributes(LPTSTR& pstrText); 67 | bool _Failed(LPCTSTR pstrError, LPCTSTR pstrLocation = NULL); 68 | }; 69 | 70 | 71 | class DUILIB_API CMarkupNode 72 | { 73 | friend class CMarkup; 74 | private: 75 | CMarkupNode(); 76 | CMarkupNode(CMarkup* pOwner, int iPos); 77 | 78 | public: 79 | bool IsValid() const; 80 | 81 | CMarkupNode GetParent(); 82 | CMarkupNode GetSibling(); 83 | CMarkupNode GetChild(); 84 | CMarkupNode GetChild(LPCTSTR pstrName); 85 | 86 | bool HasSiblings() const; 87 | bool HasChildren() const; 88 | LPCTSTR GetName() const; 89 | LPCTSTR GetValue() const; 90 | 91 | bool HasAttributes(); 92 | bool HasAttribute(LPCTSTR pstrName); 93 | int GetAttributeCount(); 94 | LPCTSTR GetAttributeName(int iIndex); 95 | LPCTSTR GetAttributeValue(int iIndex); 96 | LPCTSTR GetAttributeValue(LPCTSTR pstrName); 97 | bool GetAttributeValue(int iIndex, LPTSTR pstrValue, SIZE_T cchMax); 98 | bool GetAttributeValue(LPCTSTR pstrName, LPTSTR pstrValue, SIZE_T cchMax); 99 | 100 | private: 101 | void _MapAttributes(); 102 | 103 | enum { MAX_XML_ATTRIBUTES = 64 }; 104 | 105 | typedef struct 106 | { 107 | ULONG iName; 108 | ULONG iValue; 109 | } XMLATTRIBUTE; 110 | 111 | int m_iPos; 112 | int m_nAttributes; 113 | XMLATTRIBUTE m_aAttributes[MAX_XML_ATTRIBUTES]; 114 | CMarkup* m_pOwner; 115 | }; 116 | 117 | } // namespace DuiLib 118 | 119 | #endif // __UIMARKUP_H__ 120 | -------------------------------------------------------------------------------- /NsisPlugin/include/nsis/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * apih 3 | * 4 | * This file is a part of NSIS. 5 | * 6 | * Copyright (C) 1999-2019 Nullsoft and Contributors 7 | * 8 | * Licensed under the zlib/libpng license (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * 11 | * Licence details can be found in the file COPYING. 12 | * 13 | * This software is provided 'as-is', without any express or implied 14 | * warranty. 15 | */ 16 | 17 | #ifndef _NSIS_EXEHEAD_API_H_ 18 | #define _NSIS_EXEHEAD_API_H_ 19 | 20 | // Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version 21 | // The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x)) 22 | // When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {} 23 | 24 | #define NSISPIAPIVER_1_0 0x00010000 25 | #define NSISPIAPIVER_CURR NSISPIAPIVER_1_0 26 | 27 | // NSIS Plug-In Callback Messages 28 | enum NSPIM 29 | { 30 | NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup 31 | NSPIM_GUIUNLOAD, // Called after .onGUIEnd 32 | }; 33 | 34 | // Prototype for callbacks registered with extra_parameters->RegisterPluginCallback() 35 | // Return NULL for unknown messages 36 | // Should always be __cdecl for future expansion possibilities 37 | typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM); 38 | 39 | // extra_parameters data structure containing other interesting stuff 40 | // besides the stack, variables and HWND passed on to plug-ins. 41 | typedef struct 42 | { 43 | int autoclose; // SetAutoClose 44 | int all_user_var; // SetShellVarContext: User context = 0, Machine context = 1 45 | int exec_error; // IfErrors 46 | int abort; // IfAbort 47 | int exec_reboot; // IfRebootFlag (NSIS_SUPPORT_REBOOT) 48 | int reboot_called; // NSIS_SUPPORT_REBOOT 49 | int XXX_cur_insttype; // Deprecated 50 | int plugin_api_version; // Plug-in ABI. See NSISPIAPIVER_CURR (Note: used to be XXX_insttype_changed) 51 | int silent; // IfSilent (NSIS_CONFIG_SILENT_SUPPORT) 52 | int instdir_error; // GetInstDirError 53 | int rtl; // 1 if $LANGUAGE is a RTL language 54 | int errlvl; // SetErrorLevel 55 | int alter_reg_view; // SetRegView: Default View = 0, Alternative View = (sizeof(void*) > 4 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY) 56 | int status_update; // SetDetailsPrint 57 | } exec_flags_t; 58 | 59 | #ifndef NSISCALL 60 | # define NSISCALL __stdcall 61 | #endif 62 | #if !defined(_WIN32) && !defined(LPTSTR) 63 | # define LPTSTR TCHAR* 64 | #endif 65 | 66 | typedef struct { 67 | exec_flags_t *exec_flags; 68 | int (NSISCALL *ExecuteCodeSegment)(int, HWND); 69 | void (NSISCALL *validate_filename)(LPTSTR); 70 | int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors 71 | } extra_parameters; 72 | 73 | // Definitions for page showing plug-ins 74 | // See Ui.c to understand better how they're used 75 | 76 | // sent to the outer window to tell it to go to the next inner window 77 | #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) 78 | 79 | // custom pages should send this message to let NSIS know they're ready 80 | #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) 81 | 82 | // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning 83 | #define NOTIFY_BYE_BYE 'x' 84 | 85 | #endif /* _NSIS_EXEHEAD_API_H_ */ 86 | -------------------------------------------------------------------------------- /DuiLib/Control/UILabel.h: -------------------------------------------------------------------------------- 1 | #ifndef __UILABEL_H__ 2 | #define __UILABEL_H__ 3 | 4 | #pragma once 5 | 6 | #define _USE_GDIPLUS 1 7 | 8 | #ifdef _USE_GDIPLUS 9 | #include 10 | #pragma comment( lib, "GdiPlus.lib" ) 11 | // UMU: DO NOT use "using namespace" in .h file 12 | //using namespace Gdiplus; 13 | class DUILIB_API Gdiplus::RectF; 14 | struct DUILIB_API Gdiplus::GdiplusStartupInput; 15 | 16 | using Gdiplus::RectF; 17 | using Gdiplus::GdiplusStartupInput; 18 | #endif 19 | 20 | 21 | namespace DuiLib 22 | { 23 | class DUILIB_API CLabelUI : public CControlUI 24 | { 25 | public: 26 | CLabelUI(); 27 | ~CLabelUI(); 28 | 29 | LPCTSTR GetClass() const; 30 | LPVOID GetInterface(LPCTSTR pstrName); 31 | 32 | void SetFixedWidth(int cx); 33 | void SetFixedHeight(int cy); 34 | void SetText(LPCTSTR pstrText); 35 | 36 | void SetTextStyle(UINT uStyle); 37 | UINT GetTextStyle() const; 38 | bool IsMultiLine(); 39 | void SetMultiLine(bool bMultiLine = true); 40 | void SetTextColor(DWORD dwTextColor); 41 | DWORD GetTextColor() const; 42 | void SetDisabledTextColor(DWORD dwTextColor); 43 | DWORD GetDisabledTextColor() const; 44 | void SetFont(int index); 45 | int GetFont() const; 46 | RECT GetTextPadding() const; 47 | void SetTextPadding(RECT rc); 48 | bool IsShowHtml(); 49 | void SetShowHtml(bool bShowHtml = true); 50 | 51 | SIZE EstimateSize(SIZE szAvailable); 52 | void DoEvent(TEventUI& event); 53 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); 54 | 55 | void PaintText(HDC hDC); 56 | 57 | #ifdef _USE_GDIPLUS 58 | void SetEnabledEffect(bool _EnabledEffect); 59 | bool GetEnabledEffect(); 60 | void SetEnabledLuminous(bool bEnableLuminous); 61 | bool GetEnabledLuminous(); 62 | void SetLuminousFuzzy(float fFuzzy); 63 | float GetLuminousFuzzy(); 64 | void SetGradientLength(int _GradientLength); 65 | int GetGradientLength(); 66 | void SetShadowOffset(int _offset,int _angle); 67 | RectF GetShadowOffset(); 68 | void SetTextColor1(DWORD _TextColor1); 69 | DWORD GetTextColor1(); 70 | void SetTextShadowColorA(DWORD _TextShadowColorA); 71 | DWORD GetTextShadowColorA(); 72 | void SetTextShadowColorB(DWORD _TextShadowColorB); 73 | DWORD GetTextShadowColorB(); 74 | void SetStrokeColor(DWORD _StrokeColor); 75 | DWORD GetStrokeColor(); 76 | void SetGradientAngle(int _SetGradientAngle); 77 | int GetGradientAngle(); 78 | void SetEnabledStroke(bool _EnabledStroke); 79 | bool GetEnabledStroke(); 80 | void SetEnabledShadow(bool _EnabledShadowe); 81 | bool GetEnabledShadow(); 82 | #endif 83 | 84 | protected: 85 | LPWSTR m_pWideText; 86 | DWORD m_dwTextColor; 87 | DWORD m_dwDisabledTextColor; 88 | int m_iFont; 89 | UINT m_uTextStyle; 90 | RECT m_rcTextPadding; 91 | bool m_bShowHtml; 92 | SIZE m_szAvailableLast; 93 | SIZE m_cxyFixedLast; 94 | bool m_bNeedEstimateSize; 95 | 96 | float m_fLuminousFuzzy; 97 | int m_GradientLength; 98 | int m_GradientAngle; 99 | bool m_EnableEffect; 100 | bool m_bEnableLuminous; 101 | bool m_EnabledStroke; 102 | bool m_EnabledShadow; 103 | DWORD m_dwTextColor1; 104 | DWORD m_dwTextShadowColorA; 105 | DWORD m_dwTextShadowColorB; 106 | DWORD m_dwStrokeColor; 107 | RectF m_ShadowOffset; 108 | ULONG_PTR m_gdiplusToken; 109 | #ifdef _USE_GDIPLUS 110 | GdiplusStartupInput m_gdiplusStartupInput; 111 | #endif 112 | }; 113 | } 114 | 115 | #endif // __UILABEL_H__ -------------------------------------------------------------------------------- /NsisPlugin/include/nsis/pluginapi.h: -------------------------------------------------------------------------------- 1 | #ifndef ___NSIS_PLUGIN__H___ 2 | #define ___NSIS_PLUGIN__H___ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "api.h" 9 | #include "nsis_tchar.h" // BUGBUG: Why cannot our plugins use the compilers tchar.h? 10 | 11 | #ifndef NSISCALL 12 | # define NSISCALL WINAPI 13 | #endif 14 | 15 | #define EXDLL_INIT() { \ 16 | g_stringsize=string_size; \ 17 | g_stacktop=stacktop; \ 18 | g_variables=variables; } 19 | 20 | typedef struct _stack_t { 21 | struct _stack_t *next; 22 | #ifdef UNICODE 23 | WCHAR text[1]; // this should be the length of g_stringsize when allocating 24 | #else 25 | char text[1]; 26 | #endif 27 | } stack_t; 28 | 29 | enum 30 | { 31 | INST_0, // $0 32 | INST_1, // $1 33 | INST_2, // $2 34 | INST_3, // $3 35 | INST_4, // $4 36 | INST_5, // $5 37 | INST_6, // $6 38 | INST_7, // $7 39 | INST_8, // $8 40 | INST_9, // $9 41 | INST_R0, // $R0 42 | INST_R1, // $R1 43 | INST_R2, // $R2 44 | INST_R3, // $R3 45 | INST_R4, // $R4 46 | INST_R5, // $R5 47 | INST_R6, // $R6 48 | INST_R7, // $R7 49 | INST_R8, // $R8 50 | INST_R9, // $R9 51 | INST_CMDLINE, // $CMDLINE 52 | INST_INSTDIR, // $INSTDIR 53 | INST_OUTDIR, // $OUTDIR 54 | INST_EXEDIR, // $EXEDIR 55 | INST_LANG, // $LANGUAGE 56 | __INST_LAST 57 | }; 58 | 59 | extern unsigned int g_stringsize; 60 | extern stack_t **g_stacktop; 61 | extern LPTSTR g_variables; 62 | 63 | void NSISCALL pushstring(LPCTSTR str); 64 | void NSISCALL pushintptr(INT_PTR value); 65 | #define pushint(v) pushintptr((INT_PTR)(v)) 66 | int NSISCALL popstring(LPTSTR str); // 0 on success, 1 on empty stack 67 | int NSISCALL popstringn(LPTSTR str, int maxlen); // with length limit, pass 0 for g_stringsize 68 | INT_PTR NSISCALL popintptr(); 69 | #define popint() ( (int) popintptr() ) 70 | int NSISCALL popint_or(); // with support for or'ing (2|4|8) 71 | INT_PTR NSISCALL nsishelper_str_to_ptr(LPCTSTR s); 72 | #define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer 73 | unsigned int NSISCALL myatou(LPCTSTR s); // converts a string to an unsigned integer, decimal only 74 | int NSISCALL myatoi_or(LPCTSTR s); // with support for or'ing (2|4|8) 75 | LPTSTR NSISCALL getuservariable(const int varnum); 76 | void NSISCALL setuservariable(const int varnum, LPCTSTR var); 77 | 78 | #ifdef UNICODE 79 | #define PopStringW(x) popstring(x) 80 | #define PushStringW(x) pushstring(x) 81 | #define SetUserVariableW(x,y) setuservariable(x,y) 82 | 83 | int NSISCALL PopStringA(LPSTR ansiStr); 84 | void NSISCALL PushStringA(LPCSTR ansiStr); 85 | void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr); 86 | void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr); 87 | void NSISCALL SetUserVariableA(const int varnum, LPCSTR ansiStr); 88 | 89 | #else 90 | // ANSI defs 91 | 92 | #define PopStringA(x) popstring(x) 93 | #define PushStringA(x) pushstring(x) 94 | #define SetUserVariableA(x,y) setuservariable(x,y) 95 | 96 | int NSISCALL PopStringW(LPWSTR wideStr); 97 | void NSISCALL PushStringW(LPWSTR wideStr); 98 | void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr); 99 | void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr); 100 | void NSISCALL SetUserVariableW(const int varnum, LPCWSTR wideStr); 101 | 102 | #endif 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif//!___NSIS_PLUGIN__H___ 109 | -------------------------------------------------------------------------------- /nsi/360SafeRes/ComputerExamine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |