├── VERSION
├── base_func.vbs
├── change_dir.vbs
├── change_precomp.vbs
├── check_env.vbs
├── cleanall.bat
├── cmakerun.vbs
├── example
├── 360Safe
│ ├── 360Safe_ud.exe
│ ├── DuiLib_ud.dll
│ └── skin
│ │ └── 360SafeRes
│ │ ├── ComputerExamine.xml
│ │ ├── antivirus.png
│ │ ├── button_hover.png
│ │ ├── button_normal.png
│ │ ├── button_pushed.png
│ │ ├── cloud.png
│ │ ├── commmon.png
│ │ ├── examine_background.bmp
│ │ ├── firewall.png
│ │ ├── firewall_ok.png
│ │ ├── horizontal_border.bmp
│ │ ├── icon.ico
│ │ ├── icon.png
│ │ ├── logo.png
│ │ ├── navigationbar.bmp
│ │ ├── networkshield.png
│ │ ├── preventnumber.png
│ │ ├── scanbutton.png
│ │ ├── scrollbar.bmp
│ │ ├── skin.xml
│ │ ├── softwaremanager.png
│ │ ├── start.png
│ │ ├── sys_dlg_close.png
│ │ ├── sys_dlg_max.png
│ │ ├── sys_dlg_menu.png
│ │ ├── sys_dlg_min.png
│ │ ├── sys_dlg_restore.png
│ │ ├── tabbar_hover.png
│ │ ├── tabbar_normal.png
│ │ ├── tabbar_pushed.png
│ │ ├── toolbar_hover.png
│ │ ├── toolbar_normal.png
│ │ ├── toolbar_pushed.png
│ │ └── vertical_border.bmp
├── 360SafeSetup.nsi
├── algo.nsh
├── basehelp.nsh
├── copymake.bat
├── format.nsh
├── nsduilib.nsh
├── plugin
│ ├── nsduiliba.dll
│ └── nsduilibw.dll
├── setup res
│ ├── Combo_nor.bmp
│ ├── Combo_over.bmp
│ ├── Icon_RedWarning.png
│ ├── InstallPackages.xml
│ ├── Licence.txt
│ ├── MessageBox.xml
│ ├── UninstallPackages.xml
│ ├── btn_close_down.png
│ ├── btn_close_highlight.png
│ ├── btn_close_normal.png
│ ├── btn_hot.png
│ ├── btn_mini_down.png
│ ├── btn_mini_highlight.png
│ ├── btn_mini_normal.png
│ ├── btn_normal.png
│ ├── embed4Page3_1.png
│ ├── embed4Page3_2.png
│ ├── inst_1pg.png
│ ├── inst_2pg.png
│ ├── inst_3pg.png
│ ├── inst_4pg.png
│ ├── install.ico
│ ├── install.png
│ ├── instbkimg.png
│ ├── logo.png
│ ├── messagebox.png
│ ├── progressbar.png
│ ├── progressbar_bkimg.png
│ ├── scroll.png
│ ├── sel.png
│ ├── uninstall.ico
│ ├── uninstall_bkg.png
│ ├── uninsting.png
│ └── unsel.png
└── valid.nsh
├── makeall.bat
├── makedll.bat
├── makefile.win
├── readme.txt
├── reg_op.vbs
├── removetmp.vbs
├── runcompile.vbs
├── runmake.vbs
├── src
├── CMakeLists.txt
├── cmake
│ └── functions.cmake
├── duilib
│ ├── CMakeLists.txt
│ ├── Control
│ │ ├── UIActiveX.cpp
│ │ ├── UIActiveX.h
│ │ ├── UIButton.cpp
│ │ ├── UIButton.h
│ │ ├── UICheckBox.cpp
│ │ ├── UICheckBox.h
│ │ ├── UICombo.cpp
│ │ ├── UICombo.h
│ │ ├── UIDateTime.cpp
│ │ ├── UIDateTime.h
│ │ ├── UIEdit.cpp
│ │ ├── UIEdit.h
│ │ ├── UIFlash.cpp
│ │ ├── UIFlash.h
│ │ ├── UILabel.cpp
│ │ ├── UILabel.h
│ │ ├── UIList.cpp
│ │ ├── UIList.h
│ │ ├── UIOption.cpp
│ │ ├── UIOption.h
│ │ ├── UIProgress.cpp
│ │ ├── UIProgress.h
│ │ ├── UIRichEdit.cpp
│ │ ├── UIRichEdit.h
│ │ ├── UIScrollBar.cpp
│ │ ├── UIScrollBar.h
│ │ ├── UISlider.cpp
│ │ ├── UISlider.h
│ │ ├── UIText.cpp
│ │ ├── UIText.h
│ │ ├── UITreeView.cpp
│ │ ├── UITreeView.h
│ │ ├── UIWebBrowser.cpp
│ │ └── UIWebBrowser.h
│ ├── Core
│ │ ├── UIBase.cpp
│ │ ├── UIBase.h
│ │ ├── UIContainer.cpp
│ │ ├── UIContainer.h
│ │ ├── UIControl.cpp
│ │ ├── UIControl.h
│ │ ├── UIDefine.h
│ │ ├── UIDlgBuilder.cpp
│ │ ├── UIDlgBuilder.h
│ │ ├── UIManager.cpp
│ │ ├── UIManager.h
│ │ ├── UIMarkup.cpp
│ │ ├── UIMarkup.h
│ │ ├── UIRender.cpp
│ │ └── UIRender.h
│ ├── Layout
│ │ ├── UIChildLayout.cpp
│ │ ├── UIChildLayout.h
│ │ ├── UIHorizontalLayout.cpp
│ │ ├── UIHorizontalLayout.h
│ │ ├── UITabLayout.cpp
│ │ ├── UITabLayout.h
│ │ ├── UITileLayout.cpp
│ │ ├── UITileLayout.h
│ │ ├── UIVerticalLayout.cpp
│ │ └── UIVerticalLayout.h
│ ├── StdAfx.cpp
│ ├── StdAfx.h
│ ├── UIlib.cpp
│ ├── UIlib.h
│ ├── Utils
│ │ ├── FlashEventHandler.h
│ │ ├── UIDelegate.cpp
│ │ ├── UIDelegate.h
│ │ ├── Utils.cpp
│ │ ├── Utils.h
│ │ ├── WebBrowserEventHandler.h
│ │ ├── WinImplBase.cpp
│ │ ├── WinImplBase.h
│ │ ├── XUnzip.cpp
│ │ ├── downloadmgr.h
│ │ ├── flash11.tlh
│ │ ├── stb_image.c
│ │ └── stb_image.h
│ ├── duilib.vcxproj
│ └── makefile.win
├── fakewinlib
│ └── CMakelists.txt
├── nsduilib
│ ├── CMakeLists.txt
│ ├── MsgDef.h
│ ├── SkinEngine.cpp
│ ├── SkinEngine.h
│ ├── StdAfx.cpp
│ ├── StdAfx.h
│ ├── api.h
│ ├── dllmain.cpp
│ ├── makefile.win
│ ├── nsduilib.cpp
│ ├── nsduilib.h
│ ├── nsduilib.sln
│ ├── nsduilib.vcxproj
│ ├── pluginapi.c
│ └── pluginapi.h
└── test
│ └── editui
│ ├── CMakeLists.txt
│ ├── duilib.h
│ ├── editui.cpp
│ ├── editui.h
│ ├── main.cpp
│ └── skin
│ ├── BtnStyle
│ ├── BDKV
│ │ ├── button_down.png
│ │ ├── button_nor.png
│ │ └── button_over.png
│ ├── BDKV2
│ │ ├── button_down.png
│ │ ├── button_nor.png
│ │ ├── button_over.png
│ │ └── clear_iepg_btn_normal.png
│ ├── Win7
│ │ ├── button_down.png
│ │ ├── button_focus.png
│ │ ├── button_nor.png
│ │ └── button_over.png
│ └── XP
│ │ ├── button_down.png
│ │ ├── button_focus.png
│ │ ├── button_nor.png
│ │ └── button_over.png
│ ├── CheckBox
│ ├── checked.png
│ └── unchecked.png
│ ├── ComboBox
│ ├── Combo_nor.bmp
│ └── Combo_over.bmp
│ ├── List
│ ├── list_header_bg.png
│ ├── list_header_hot.png
│ ├── list_header_pushed.png
│ └── list_header_sep.png
│ ├── Menu
│ ├── btn_menu_hot.png
│ ├── menu.xml
│ ├── menu_bk.png
│ └── menu_hot_bk.png
│ ├── Progress
│ ├── progress_back.png
│ └── progress_fore.png
│ ├── Radio
│ ├── RadioBtnNon.png
│ └── RadioBtnSel.png
│ ├── ScrollBar
│ ├── scroll.png
│ └── scrollH.png
│ ├── Slider
│ ├── SliderBar.png
│ └── slider_fore.bmp
│ ├── SysBtn
│ ├── CloseFocus.bmp
│ ├── CloseNormal.bmp
│ ├── ComboBox
│ │ ├── Combo_nor.bmp
│ │ └── Combo_over.bmp
│ ├── MaxFocus.bmp
│ ├── MaxNormal.bmp
│ ├── MinFocus.bmp
│ ├── MinNormal.bmp
│ ├── StoreFocus.bmp
│ ├── StoreNormal.bmp
│ ├── down.png
│ └── up.png
│ ├── editui.xml
│ ├── icon.png
│ ├── image
│ ├── menu_bk.png
│ └── tree_expand.png
│ ├── logo.ico
│ └── menutest.xml
├── test
└── tstcompile
│ ├── diffpair.py
│ └── runcompile.bat
├── verify_vs.vbs
├── vs_cmake.vbs
├── vs_find.vbs
└── xmlfunc.vbs
/VERSION:
--------------------------------------------------------------------------------
1 | 1.0.2
--------------------------------------------------------------------------------
/change_dir.vbs:
--------------------------------------------------------------------------------
1 |
2 | Option Explicit
3 |
4 | sub includeFile (fSpec)
5 | dim fileSys, file, fileData
6 | set fileSys = createObject ("Scripting.FileSystemObject")
7 | set file = fileSys.openTextFile (fSpec)
8 | fileData = file.readAll ()
9 | file.close
10 | executeGlobal fileData
11 | set file = nothing
12 | set fileSys = nothing
13 | end sub
14 |
15 | dim fso ,scriptpath
16 | Set fso = CreateObject("Scripting.FileSystemObject")
17 | ScriptPath = fso.GetParentFolderName(Wscript.ScriptFullName)
18 | includeFile scriptpath & "\xmlfunc.vbs"
19 |
20 |
21 | if wscript.Arguments.length < 1 Then
22 | Wscript.stderr.WriteLine("build_chg.vbs vcxproj")
23 | wscript.Quit(4)
24 | End If
25 |
26 | dim xmldom,root,reg,fnd,newelm,retval
27 |
28 | set xmldom = CreateObject("Msxml2.DOMDocument.3.0")
29 |
30 | xmldom.Async = False
31 | xmldom.Load(wscript.Arguments(0))
32 |
33 | if xmldom.parseError.errorCode <> 0 Then
34 | Wscript.stderr.Writeline("can not parse " & wscript.Arguments(0) & " for xml")
35 | Else
36 | Wscript.stdout.Writeline("parse " & wscript.Arguments(0) & " succ")
37 | End If
38 |
39 |
40 | set root = xmldom.documentElement
41 | XmlSetValueChilds root,"//Project/PropertyGroup/OutDir","$(SolutionDir)\$(PlatformTarget)\$(Configuration)\"
42 | XmlSetValueChilds root,"//Project/PropertyGroup/IntDir","$(ProjectDir)\$(PlatformTarget)\$(Configuration)\"
43 | xmldom.save Wscript.Arguments(0)
44 |
45 |
46 |
--------------------------------------------------------------------------------
/change_precomp.vbs:
--------------------------------------------------------------------------------
1 |
2 | Option Explicit
3 |
4 | sub includeFile (fSpec)
5 | dim fileSys, file, fileData
6 | set fileSys = createObject ("Scripting.FileSystemObject")
7 | set file = fileSys.openTextFile (fSpec)
8 | fileData = file.readAll ()
9 | file.close
10 | executeGlobal fileData
11 | set file = nothing
12 | set fileSys = nothing
13 | end sub
14 |
15 | dim fso ,scriptpath
16 | Set fso = CreateObject("Scripting.FileSystemObject")
17 | ScriptPath = fso.GetParentFolderName(Wscript.ScriptFullName)
18 | includeFile scriptpath & "\xmlfunc.vbs"
19 |
20 |
21 | if wscript.Arguments.length < 1 Then
22 | Wscript.stderr.WriteLine("build_chg.vbs vcxproj")
23 | wscript.Quit(4)
24 | End If
25 |
26 | dim xmldom,root,reg,fnd,newelm,retval
27 |
28 | set xmldom = CreateObject("Msxml2.DOMDocument.3.0")
29 |
30 | xmldom.Async = False
31 | xmldom.Load(wscript.Arguments(0))
32 |
33 | if xmldom.parseError.errorCode <> 0 Then
34 | Wscript.stderr.Writeline("can not parse " & wscript.Arguments(0) & " for xml")
35 | Else
36 | Wscript.stdout.Writeline("parse " & wscript.Arguments(0) & " succ")
37 | End If
38 |
39 |
40 | set root = xmldom.documentElement
41 | XmlSetValueChilds root,"//Project/ItemDefinitionGroup/ClCompile/PrecompiledHeader","Use"
42 | SetPreCompileValue xmldom,"stb_image.c","NotUsing"
43 | SetPreCompileValue xmldom,"XUnzip.cpp","NotUsing"
44 | SetPreCompileValue xmldom,"StdAfx.cpp","Create"
45 |
46 |
47 | xmldom.save Wscript.Arguments(0)
48 |
49 |
--------------------------------------------------------------------------------
/cleanall.bat:
--------------------------------------------------------------------------------
1 | set INST_OS=win7
2 | set INST_ARCH=x86
3 | set VC_SETVAR_ARCH=amd64_x86
4 | set GOARCH=386
5 | set APP_NAME=btssdp
6 | set _IsNativeEnvironment=true
7 | set UNICODE_MODE=1
8 | cscript //Nologo runmake.vbs makefile.win clean
--------------------------------------------------------------------------------
/cmakerun.vbs:
--------------------------------------------------------------------------------
1 |
2 | Option Explicit
3 |
4 | Sub includeFile(fSpec)
5 | With CreateObject("Scripting.FileSystemObject")
6 | executeGlobal .openTextFile(fSpec).readAll()
7 | End With
8 | End Sub
9 |
10 | Function GetScriptDir()
11 | dim fso ,scriptpath
12 | Set fso = CreateObject("Scripting.FileSystemObject")
13 | GetScriptDir=fso.GetParentFolderName(Wscript.ScriptFullName)
14 | End Function
15 |
16 |
17 | call includeFile( GetScriptDir() & "\reg_op.vbs")
18 | call includeFile( GetScriptDir() & "\vs_find.vbs")
19 | call includeFile( GetScriptDir() & "\base_func.vbs")
20 | call includeFile( GetScriptDir() & "\vs_cmake.vbs")
21 |
22 |
23 | Function FormatCmakeBatch(outfile,vsver,basedir,compiletarget,platform,abssrc,absdst,args)
24 | dim fso,fh,cmdline,unum
25 | set fso = WScript.CreateObject("Scripting.FileSystemObject")
26 | set fh = fso.CreateTextFile(outfile,True)
27 |
28 | fh.WriteLine(GetVsAllBatchCall(vsver,basedir,compiletarget))
29 | cmdline = "cd " & absdst
30 | fh.WriteLine(cmdline)
31 |
32 | cmdline = "cmake.exe " & platform
33 | On error resume next
34 | Err.Number = 0
35 | unum = Ubound(args)
36 | if Err.Number <> 0 Then
37 | unum = 0
38 | else
39 | for each unum in args
40 | If unum <> "" Then
41 | cmdline = cmdline & " " & chr(34) & unum & chr(34)
42 | End If
43 | Next
44 | End If
45 | cmdline = cmdline & " " & abssrc
46 | fh.WriteLine(cmdline)
47 | fh.Close
48 | set fso = Nothing
49 | set fh = Nothing
50 | End Function
51 |
52 | Function CmakeRun(vsver,basedir,compiletarget,platform,srcdir,dstdir,args)
53 | dim cmd,retdir,curd,absdst,abssrc,unum
54 | dim batchfile
55 | retdir = GetCwd()
56 | abssrc = GetAbsPath(srcdir)
57 | absdst = GetAbsPath(dstdir)
58 | ' for \ is 92
59 | batchfile = absdst & chr(92) & "cmakerun.bat"
60 | Chdir(absdst)
61 | FormatCmakeBatch batchfile,vsver,basedir,compiletarget,platform,abssrc,absdst,args
62 | RunCommand(batchfile)
63 | Chdir(retdir)
64 | End Function
65 |
66 |
67 | Function Usage(ec,fmt)
68 | dim fh
69 | set fh = WScript.Stderr
70 | if ec = 0 Then
71 | set fh = WScript.Stdout
72 | End if
73 |
74 | if fmt <> "" Then
75 | fh.Writeline(fmt)
76 | End if
77 | fh.Writeline(WScript.ScriptName & " [OPTIONS] -- [CMAKE_OPTIONS]")
78 | fh.Writeline(chr(9) &"-h|--help to display this information")
79 | fh.Writeline(chr(9) &"-d|--dir directory to specify the directory running cmake")
80 | fh.Writeline(chr(9) &"-s|--source directory to specify the source directory")
81 | fh.Writeline(chr(9) &"-a|--arch arch to specify arch it can accept(x64|x86)")
82 | fh.Writeline(chr(9) &"-- to stop parse args ,next is for cmake")
83 | WScript.Quit(ec)
84 | End Function
85 |
86 | dim cmakedir,sourcedir,cmakearch
87 | dim cmakeargs()
88 |
89 | sourcedir="."
90 | cmakedir=""
91 | cmakearch="x86"
92 | Function ParseArgs(args)
93 | dim i,j,unum
94 | j = UBound(args)
95 | i = 0
96 | do While i < j
97 | if args(i) = "-h" or args(i) = "--help" Then
98 | Usage 0,""
99 | elseif args(i) = "-d" or args(i) = "--dir" Then
100 | if (i+1) = j Then
101 | Usage 3,args(i) &" need an arg"
102 | End If
103 |
104 | cmakedir = args((i + 1))
105 | i = i + 1
106 | elseif args(i) = "-s" or args(i) = "--source" Then
107 | if (i+1) = j Then
108 | Usage 3,args(i) &" need an arg"
109 | End If
110 | sourcedir = args((i + 1))
111 | i = i + 1
112 | elseif args(i) = "-a" or args(i) = "--arch" Then
113 | if (i+1) = j Then
114 | Usage 3,args(i) &" need an arg"
115 | End If
116 | cmakearch = args((i + 1))
117 | i = i + 1
118 | elseif args(i) = "--" Then
119 | ' we skip this
120 | i = i + 1
121 | while i < j
122 | On error resume next
123 | Err.Number = 0
124 | unum = Ubound(cmakeargs)
125 | if Err.Number <> 0 Then
126 | unum = 0
127 | End If
128 | On error goto 0
129 | unum = unum + 1
130 | redim preserve cmakeargs(unum)
131 | cmakeargs((unum-1)) = args((i))
132 | i = i + 1
133 | Wend
134 | exit do
135 | End if
136 | i = i + 1
137 | Loop
138 |
139 | On error resume next
140 | Err.Number = 0
141 | unum = Ubound(cmakeargs)
142 | if Err.Number <> 0 Then
143 | unum = 0
144 | wscript.stdout.writeline("cmakeargs 0")
145 | else
146 | wscript.stdout.write("cmakeargs:")
147 | for each unum in cmakeargs
148 | wscript.stdout.write(" " & unum)
149 | Next
150 | wscript.stdout.writeline("")
151 | End If
152 |
153 | if cmakedir = "" Then
154 | wscript.stderr.writeline("must specify cmakedir by(-d|--dir)")
155 | wscript.quit(4)
156 | End If
157 | End Function
158 |
159 |
160 |
161 |
162 | dim args(),num,i,vsver,vspdir,basedir,vscmake,platform
163 | num = WScript.Arguments.Count()
164 |
165 | if num = 0 Then
166 | Usage 3,"need args"
167 | End if
168 |
169 | redim args(num)
170 |
171 | for i=0 to (num - 1)
172 | args(i) = WScript.Arguments.Item(i)
173 | next
174 |
175 | ParseArgs(args)
176 |
177 |
178 | vsver=IsInstallVisualStudio(10.0)
179 | If IsEmpty(vsver) Then
180 | wscript.stderr.writeline("can not find visual studio installed")
181 | wscript.Quit(3)
182 | End If
183 | basedir=GetVisualStudioInstdir(10.0)
184 | if IsEmpty(basedir) Then
185 | wscript.stderr.writeline("can not find visual studio install directory")
186 | wscript.quit(5)
187 | End If
188 |
189 | wscript.stdout.writeline("basedir ("& basedir & ")")
190 | dim compiletarget
191 | set vscmake = new VSCMakePlatform
192 | if cmakearch = "x64" Then
193 | platform = vscmake.GetPlatform(vsver,1)
194 | compiletarget = "amd64"
195 | Else
196 | platform = vscmake.GetPlatform(vsver,0)
197 | compiletarget = "amd64_x86"
198 | End If
199 |
200 | wscript.stdout.writeline("Get Platform (" & platform &")")
201 |
202 | call CmakeRun(vsver,basedir,compiletarget,platform, sourcedir,cmakedir,cmakeargs)
203 |
204 |
--------------------------------------------------------------------------------
/example/360Safe/360Safe_ud.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/360Safe_ud.exe
--------------------------------------------------------------------------------
/example/360Safe/DuiLib_ud.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/DuiLib_ud.dll
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/ComputerExamine.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/antivirus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/antivirus.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/button_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/button_hover.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/button_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/button_normal.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/button_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/button_pushed.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/cloud.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/commmon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/commmon.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/examine_background.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/examine_background.bmp
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/firewall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/firewall.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/firewall_ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/firewall_ok.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/horizontal_border.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/horizontal_border.bmp
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/icon.ico
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/icon.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/logo.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/navigationbar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/navigationbar.bmp
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/networkshield.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/networkshield.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/preventnumber.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/preventnumber.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/scanbutton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/scanbutton.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/scrollbar.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/scrollbar.bmp
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/softwaremanager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/softwaremanager.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/start.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/sys_dlg_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/sys_dlg_close.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/sys_dlg_max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/sys_dlg_max.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/sys_dlg_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/sys_dlg_menu.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/sys_dlg_min.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/sys_dlg_min.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/sys_dlg_restore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/sys_dlg_restore.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/tabbar_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/tabbar_hover.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/tabbar_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/tabbar_normal.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/tabbar_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/tabbar_pushed.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/toolbar_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/toolbar_hover.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/toolbar_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/toolbar_normal.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/toolbar_pushed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/toolbar_pushed.png
--------------------------------------------------------------------------------
/example/360Safe/skin/360SafeRes/vertical_border.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360Safe/skin/360SafeRes/vertical_border.bmp
--------------------------------------------------------------------------------
/example/360SafeSetup.nsi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/360SafeSetup.nsi
--------------------------------------------------------------------------------
/example/algo.nsh:
--------------------------------------------------------------------------------
1 | !ifndef __NS_ALGO_NSH__
2 | !define __NS_ALGO_NSH__
3 |
4 |
5 | !macro CompareMustLarge _num _cmpbase _errmsg
6 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
7 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
8 | IntCmp "${_num}" "${_cmpbase}" ${__set_error_${__MACRO__}} ${__set_error_${__MACRO__}} ${__macro_exit_${__MACRO__}}
9 | ${__set_error_${__MACRO__}}:
10 | !insertmacro AbortMessage "${_errmsg}"
11 | ${__macro_exit_${__MACRO__}}:
12 |
13 | !undef __set_error_${__MACRO__}
14 | !undef __macro_exit_${__MACRO__}
15 | !macroend
16 |
17 | !macro CompareMustLess _num _cmpbase _errmsg
18 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
19 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
20 | IntCmp "${_num}" "${_cmpbase}" ${__set_error_${__MACRO__}} ${__macro_exit_${__MACRO__}} ${__set_error_${__MACRO__}}
21 | ${__set_error_${__MACRO__}}:
22 | !insertmacro AbortMessage "${_errmsg}"
23 | ${__macro_exit_${__MACRO__}}:
24 |
25 | !undef __set_error_${__MACRO__}
26 | !undef __macro_exit_${__MACRO__}
27 | !macroend
28 |
29 | !macro CompareMustEqualLarge _num _cmpbase _errmsg
30 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
31 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
32 | IntCmp "${_num}" "${_cmpbase}" ${__macro_exit_${__MACRO__}} ${__set_error_${__MACRO__}} ${__macro_exit_${__MACRO__}}
33 | ${__set_error_${__MACRO__}}:
34 | !insertmacro AbortMessage "${_errmsg}"
35 | ${__macro_exit_${__MACRO__}}:
36 |
37 | !undef __set_error_${__MACRO__}
38 | !undef __macro_exit_${__MACRO__}
39 | !macroend
40 |
41 |
42 | !macro CompareMustEqualLess _num _cmpbase _errmsg
43 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
44 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
45 | IntCmp "${_num}" "${_cmpbase}" ${__macro_exit_${__MACRO__}} ${__macro_exit_${__MACRO__}} ${__set_error_${__MACRO__}}
46 | ${__set_error_${__MACRO__}}:
47 | !insertmacro AbortMessage "${_errmsg}"
48 | ${__macro_exit_${__MACRO__}}:
49 |
50 | !undef __set_error_${__MACRO__}
51 | !undef __macro_exit_${__MACRO__}
52 | !macroend
53 |
54 |
55 | !macro CompareLarge _num _cmpbase _errmsg
56 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
57 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
58 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
59 | IntCmp "${_num}" "${_cmpbase}" ${__set_error_${__MACRO__}} ${__set_error_${__MACRO__}} ${__set_ok_${__MACRO__}}
60 | ${__set_ok_${__MACRO__}}:
61 | StrCpy $R0 "0"
62 | goto ${__macro_exit_${__MACRO__}}
63 |
64 | ${__set_error_${__MACRO__}}:
65 | MessageBox MB_OK "${_errmsg}"
66 | StrCpy $R0 "-1"
67 | goto ${__macro_exit_${__MACRO__}}
68 | ${__macro_exit_${__MACRO__}}:
69 |
70 | !undef __set_ok_${__MACRO__}
71 | !undef __set_error_${__MACRO__}
72 | !undef __macro_exit_${__MACRO__}
73 | !macroend
74 |
75 |
76 | !macro CompareLess _num _cmpbase _errmsg
77 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
78 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
79 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
80 | IntCmp "${_num}" "${_cmpbase}" ${__set_error_${__MACRO__}} ${__set_ok_${__MACRO__}} ${__set_error_${__MACRO__}}
81 | ${__set_ok_${__MACRO__}}:
82 | StrCpy $R0 "0"
83 | goto ${__macro_exit_${__MACRO__}}
84 |
85 | ${__set_error_${__MACRO__}}:
86 | MessageBox MB_OK "${_errmsg}"
87 | StrCpy $R0 "-1"
88 | goto ${__macro_exit_${__MACRO__}}
89 | ${__macro_exit_${__MACRO__}}:
90 |
91 | !undef __set_ok_${__MACRO__}
92 | !undef __set_error_${__MACRO__}
93 | !undef __macro_exit_${__MACRO__}
94 | !macroend
95 |
96 |
97 | !macro CompareEqualLarge _num _cmpbase _errmsg
98 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
99 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
100 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
101 | IntCmp "${_num}" "${_cmpbase}" ${__set_ok_${__MACRO__}} ${__set_error_${__MACRO__}} ${__set_ok_${__MACRO__}}
102 | ${__set_ok_${__MACRO__}}:
103 | StrCpy $R0 "0"
104 | goto ${__macro_exit_${__MACRO__}}
105 |
106 | ${__set_error_${__MACRO__}}:
107 | MessageBox MB_OK "${_errmsg}"
108 | StrCpy $R0 "-1"
109 | goto ${__macro_exit_${__MACRO__}}
110 | ${__macro_exit_${__MACRO__}}:
111 |
112 | !undef __set_ok_${__MACRO__}
113 | !undef __set_error_${__MACRO__}
114 | !undef __macro_exit_${__MACRO__}
115 | !macroend
116 |
117 | !macro CompareEqualLess _num _cmpbase _errmsg
118 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
119 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
120 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
121 | IntCmp "${_num}" "${_cmpbase}" ${__set_ok_${__MACRO__}} ${__set_ok_${__MACRO__}} ${__set_error_${__MACRO__}}
122 | ${__set_ok_${__MACRO__}}:
123 | StrCpy $R0 "0"
124 | goto ${__macro_exit_${__MACRO__}}
125 |
126 | ${__set_error_${__MACRO__}}:
127 | MessageBox MB_OK "${_errmsg}"
128 | StrCpy $R0 "-1"
129 | goto ${__macro_exit_${__MACRO__}}
130 | ${__macro_exit_${__MACRO__}}:
131 |
132 | !undef __set_ok_${__MACRO__}
133 | !undef __set_error_${__MACRO__}
134 | !undef __macro_exit_${__MACRO__}
135 | !macroend
136 |
137 |
138 |
139 | !endif /*__NS_ALGO_NSH__*/
--------------------------------------------------------------------------------
/example/basehelp.nsh:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Function GetWindowsVersion
6 | Push $R0
7 | Push $R1
8 |
9 | ClearErrors
10 |
11 | ReadRegStr $R0 HKLM \
12 | "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
13 |
14 | IfErrors 0 lbl_winnt
15 |
16 | ; 不是 NT
17 | ReadRegStr $R0 HKLM \
18 | "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
19 |
20 | StrCpy $R1 $R0 1
21 | StrCmp $R1 '4' 0 lbl_error
22 |
23 | StrCpy $R1 $R0 3
24 |
25 | StrCmp $R1 '4.0' lbl_win32_95
26 | StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
27 |
28 | lbl_win32_95:
29 | StrCpy $R0 '98'
30 | Goto lbl_done
31 |
32 | lbl_win32_98:
33 | StrCpy $R0 '98'
34 | Goto lbl_done
35 |
36 | lbl_win32_ME:
37 | StrCpy $R0 '98'
38 | Goto lbl_done
39 |
40 | lbl_winnt:
41 |
42 | StrCpy $R1 $R0 1
43 |
44 | StrCmp $R1 '3' lbl_winnt_x
45 | StrCmp $R1 '4' lbl_winnt_x
46 |
47 | StrCpy $R1 $R0 3
48 |
49 | StrCmp $R1 '5.0' lbl_winnt_2000
50 | StrCmp $R1 '5.1' lbl_winnt_XP
51 | StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
52 |
53 | lbl_winnt_x:
54 | StrCpy $R0 "NT $R0" 6
55 | Goto lbl_done
56 |
57 | lbl_winnt_2000:
58 | Strcpy $R0 '2000'
59 | Goto lbl_done
60 |
61 | lbl_winnt_XP:
62 | Strcpy $R0 'XP'
63 | Goto lbl_done
64 |
65 | lbl_winnt_2003:
66 | Strcpy $R0 '2003'
67 | Goto lbl_done
68 |
69 | lbl_error:
70 | Strcpy $R0 ''
71 | lbl_done:
72 |
73 | Pop $R1
74 | Exch $R0
75 | FunctionEnd
76 |
77 |
--------------------------------------------------------------------------------
/example/copymake.bat:
--------------------------------------------------------------------------------
1 | copy /Y ..\build\nsduilib\Release\nsduilib.dll plugin\nsduilib.dll
2 | makensis 360SafeSetup.nsi
--------------------------------------------------------------------------------
/example/format.nsh:
--------------------------------------------------------------------------------
1 |
2 | !ifndef __FORMAT_NSH__
3 | !define __FORMAT_NSH__
4 |
5 | !define NSD1_Debug `System::Call kernel32::OutputDebugString(ts)`
6 | !include "LogicLib.nsh"
7 | !include "WordFunc.nsh"
8 |
9 | !macro DEBUG_INFO _Content
10 | ${NSD1_Debug} "${__FILE__}:${__LINE__} ${_Content}$\n"
11 | !macroend
12 |
13 | !macro FormatString _Result
14 | !define __inner_out_${__MACRO__} `__inner_out_${__MACRO__}_${__FILE__}_${__LINE__}`
15 | !define __inner_again_${__MACRO__} `__inner_agin_${__MACRO__}_${__FILE__}_${__LINE__}`
16 | # to pop the R0
17 | pop ${_Result}
18 | ${__inner_again_${__MACRO__}}:
19 | pop $1
20 | strcmp $1 "" ${__inner_out_${__MACRO__}} ; this is the null ,so just out
21 | !ifdef __UNINSTALL__
22 | ${un.WordReplace} ${_Result} "%s" $1 "+1" ${_Result} ; to replace just once
23 | !else
24 | ${WordReplace} ${_Result} "%s" $1 "+1" ${_Result} ; to replace just once
25 | !endif
26 | goto ${__inner_again_${__MACRO__}}
27 | ${__inner_out_${__MACRO__}}:
28 | # now $R0 is the result
29 | !undef __inner_out_${__MACRO__}
30 | !undef __inner_again_${__MACRO__}
31 | !macroend
32 |
33 |
34 | !macro AbortMessage _Message
35 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
36 | # this is for the safe reason when we not call page callbacks
37 | #set the message when it is ok
38 | !insertmacro DEBUG_INFO ${_Message}
39 | IfSilent ${__set_error_${__MACRO__}} 0
40 | MessageBox MB_OK ${_Message}
41 | ${__set_error_${__MACRO__}}:
42 | SetErrors
43 | !ifdef __UNINSTALL__
44 | call un.onUninstFailed
45 | !else
46 | call .onInstFailed
47 | !endif
48 | Quit
49 | !undef __set_error_${__MACRO__}
50 | !macroend
51 |
52 |
53 | !endif # __FORMAT_NSH__
--------------------------------------------------------------------------------
/example/plugin/nsduiliba.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/plugin/nsduiliba.dll
--------------------------------------------------------------------------------
/example/plugin/nsduilibw.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/plugin/nsduilibw.dll
--------------------------------------------------------------------------------
/example/setup res/Combo_nor.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/Combo_nor.bmp
--------------------------------------------------------------------------------
/example/setup res/Combo_over.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/Combo_over.bmp
--------------------------------------------------------------------------------
/example/setup res/Icon_RedWarning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/Icon_RedWarning.png
--------------------------------------------------------------------------------
/example/setup res/Licence.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/Licence.txt
--------------------------------------------------------------------------------
/example/setup res/MessageBox.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/setup res/btn_close_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_close_down.png
--------------------------------------------------------------------------------
/example/setup res/btn_close_highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_close_highlight.png
--------------------------------------------------------------------------------
/example/setup res/btn_close_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_close_normal.png
--------------------------------------------------------------------------------
/example/setup res/btn_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_hot.png
--------------------------------------------------------------------------------
/example/setup res/btn_mini_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_mini_down.png
--------------------------------------------------------------------------------
/example/setup res/btn_mini_highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_mini_highlight.png
--------------------------------------------------------------------------------
/example/setup res/btn_mini_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_mini_normal.png
--------------------------------------------------------------------------------
/example/setup res/btn_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/btn_normal.png
--------------------------------------------------------------------------------
/example/setup res/embed4Page3_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/embed4Page3_1.png
--------------------------------------------------------------------------------
/example/setup res/embed4Page3_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/embed4Page3_2.png
--------------------------------------------------------------------------------
/example/setup res/inst_1pg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/inst_1pg.png
--------------------------------------------------------------------------------
/example/setup res/inst_2pg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/inst_2pg.png
--------------------------------------------------------------------------------
/example/setup res/inst_3pg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/inst_3pg.png
--------------------------------------------------------------------------------
/example/setup res/inst_4pg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/inst_4pg.png
--------------------------------------------------------------------------------
/example/setup res/install.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/install.ico
--------------------------------------------------------------------------------
/example/setup res/install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/install.png
--------------------------------------------------------------------------------
/example/setup res/instbkimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/instbkimg.png
--------------------------------------------------------------------------------
/example/setup res/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/logo.png
--------------------------------------------------------------------------------
/example/setup res/messagebox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/messagebox.png
--------------------------------------------------------------------------------
/example/setup res/progressbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/progressbar.png
--------------------------------------------------------------------------------
/example/setup res/progressbar_bkimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/progressbar_bkimg.png
--------------------------------------------------------------------------------
/example/setup res/scroll.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/scroll.png
--------------------------------------------------------------------------------
/example/setup res/sel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/sel.png
--------------------------------------------------------------------------------
/example/setup res/uninstall.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/uninstall.ico
--------------------------------------------------------------------------------
/example/setup res/uninstall_bkg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/uninstall_bkg.png
--------------------------------------------------------------------------------
/example/setup res/uninsting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/uninsting.png
--------------------------------------------------------------------------------
/example/setup res/unsel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/example/setup res/unsel.png
--------------------------------------------------------------------------------
/example/valid.nsh:
--------------------------------------------------------------------------------
1 | !ifndef __NS_VALID_NSH__
2 | !define __NS_VALID_NSH__
3 |
4 |
5 | !macro ValidPort
6 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
7 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
8 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
9 | push $R1
10 | !insertmacro nsGetCtrlText "${PORT_EDIT}" "can not get port information"
11 | /*we store the R0 to R1 for it will give */
12 | StrCpy $R1 $R0
13 | ${If} $R1 == "error"
14 | goto ${__set_error_${__MACRO__}}
15 | ${EndIf}
16 | !insertmacro CompareLarge $R1 "0" "please use port must more than 0"
17 | ${If} $R0 <> "0"
18 | goto ${__set_error_${__MACRO__}}
19 | ${EndIf}
20 |
21 | !insertmacro CompareLess $R1 "65536" "please use port less than 65536"
22 | ${If} $R0 <> "0"
23 | goto ${__set_error_${__MACRO__}}
24 | ${EndIf}
25 | /*copy the value store*/
26 | StrCpy $gPort $R1
27 | goto ${__set_ok_${__MACRO__}}
28 | ${__set_ok_${__MACRO__}}:
29 | StrCpy $R0 "0"
30 | goto ${__macro_exit_${__MACRO__}}
31 |
32 | ${__set_error_${__MACRO__}}:
33 | StrCpy $R0 "-1"
34 | goto ${__macro_exit_${__MACRO__}}
35 | ${__macro_exit_${__MACRO__}}:
36 | pop $R1
37 |
38 | !undef __set_error_${__MACRO__}
39 | !undef __set_ok_${__MACRO__}
40 | !undef __macro_exit_${__MACRO__}
41 | !macroend
42 |
43 |
44 | !macro ValidService
45 | !define __macro_exit_${__MACRO__} `__macro_exit_${__MACRO__}_${__FILE__}_${__LINE__}`
46 | !define __set_error_${__MACRO__} `__set_error_${__MACRO__}_${__FILE__}_${__LINE__}`
47 | !define __set_ok_${__MACRO__} `__set_ok_${__MACRO__}_${__FILE__}_${__LINE__}`
48 | push $R1
49 | !insertmacro nsGetCtrlText "${SVC_EDIT}" "can not get service name"
50 | /*we store the R0 to R1 for it will give */
51 | StrCpy $R1 $R0
52 | ${If} $R1 == "error"
53 | goto ${__set_error_${__MACRO__}}
54 | ${EndIf}
55 |
56 | !insertmacro nsValidCharacter $R1 "service name include not [a-zA-Z0-9_] bytes"
57 | ${If} $R0 <> "0"
58 | goto ${__set_error_${__MACRO__}}
59 | ${EndIf}
60 |
61 | /*copy the value store*/
62 | StrCpy $gSvcName $R1
63 | goto ${__set_ok_${__MACRO__}}
64 | ${__set_ok_${__MACRO__}}:
65 | StrCpy $R0 "0"
66 | goto ${__macro_exit_${__MACRO__}}
67 |
68 | ${__set_error_${__MACRO__}}:
69 | StrCpy $R0 "-1"
70 | goto ${__macro_exit_${__MACRO__}}
71 | ${__macro_exit_${__MACRO__}}:
72 | pop $R1
73 |
74 | !undef __set_error_${__MACRO__}
75 | !undef __set_ok_${__MACRO__}
76 | !undef __macro_exit_${__MACRO__}
77 | !macroend
78 |
79 |
80 |
81 | !endif /*__NS_VALID_NSH__*/
--------------------------------------------------------------------------------
/makeall.bat:
--------------------------------------------------------------------------------
1 | set INST_OS=win7
2 | set INST_ARCH=x86
3 | set VC_SETVAR_ARCH=amd64_x86
4 | set GOARCH=386
5 | set APP_NAME=btssdp
6 | set _IsNativeEnvironment=true
7 | set UNICODE_MODE=1
8 | cscript //Nologo runmake.vbs makefile.win all
--------------------------------------------------------------------------------
/makedll.bat:
--------------------------------------------------------------------------------
1 | set INST_OS=win7
2 | set INST_ARCH=x86
3 | set VC_SETVAR_ARCH=amd64_x86
4 | set GOARCH=386
5 | set APP_NAME=btssdp
6 | set _IsNativeEnvironment=true
7 | set UNICODE_MODE=1
8 | cscript //Nologo runmake.vbs makefile.win example\plugin\nsduilib.dll
--------------------------------------------------------------------------------
/makefile.win:
--------------------------------------------------------------------------------
1 |
2 | PATH=$(PATH);\nosuch
3 |
4 | all:check_env example\360SafeSetup.exe
5 |
6 | check_env:check_vs check_nsis check_git
7 |
8 | check_vs:
9 | @cscript //Nologo check_env.vbs visual_studio 10.0 2>>error.txt
10 |
11 |
12 | check_nsis:
13 | @cscript //Nologo check_env.vbs nsis 3.0 2>>error.txt
14 |
15 | check_git:
16 | @cscript //Nologo check_env.vbs git 2.0 2>>error.txt
17 |
18 | example\360SafeSetup.exe:example\plugin\nsduilib.dll example\360SafeSetup.nsi
19 | @cd example && makensis 360SafeSetup.nsi && cd .. || cd ..
20 |
21 | example\plugin\nsduilib.dll:src\nsduilib\nsduilib.dll
22 | @ mkdir example\plugin 2>NUL || echo ""
23 | @ copy /Y $** example\plugin\nsduilib.dll
24 |
25 |
26 | src\nsduilib\nsduilib.dll:
27 | @ pushd . && cd src\nsduilib && nmake /f makefile.win all && popd
28 |
29 |
30 | clean_nsduilib:
31 | @ pushd . && cd src\nsduilib && nmake /f makefile.win clean && popd
32 |
33 |
34 | clibs:
35 | @git clone https://github.com/jeppeter/clibs.git
36 |
37 | clean:clean_nsduilib
38 | @ rmdir /s /q src\winlib 2>NUL || echo "" >NUL
39 | @ rmdir /s /q build 2>NUL || echo "" >NUL
40 | @ del example\plugin\nsduilib.dll 2>NUL
41 | @ del example\360SafeSetup.exe 2>NUL
--------------------------------------------------------------------------------
/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/readme.txt
--------------------------------------------------------------------------------
/reg_op.vbs:
--------------------------------------------------------------------------------
1 | Option Explicit
2 |
3 | Const HKEY_CLASSES_ROOT = &H80000000
4 | Const HKEY_CURRENT_USER = &H80000001
5 | Const HKEY_LOCAL_MACHINE = &H80000002
6 | Const HKEY_USERS = &H80000003
7 | Const HKEY_CURRENT_CONFIG = &H80000004
8 |
9 | Function GetRegSubkeys(root,pathkey)
10 | dim arraykey,objReg,retval,retarr
11 |
12 | set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
13 | err.number=0
14 | retval = objReg.EnumKey(root,pathkey,arraykey)
15 | if retval <> 0 Then
16 | wscript.stderr.writeline( "get "&pathkey & " error["& err.number &"]retval"&retval)
17 | set objReg = Nothing
18 | arraykey=Empty
19 | GetRegSubkeys=Empty
20 | ElseIf not IsArray(arraykey) Then
21 | wscript.stderr.writeline("get["&pathkey&"]ret not array("&arraykey&")")
22 | set objReg = Nothing
23 | redim retarr(0)
24 | retarr(0) = arraykey
25 | arraykey=Empty
26 | GetRegSubkeys=retarr
27 | else
28 | set objReg = Nothing
29 | GetRegSubkeys=arraykey
30 | End If
31 | End Function
32 |
33 |
34 | Function ReadReg(key)
35 | dim objShell,value
36 | Set objShell = WScript.CreateObject("WScript.Shell")
37 | On Error Resume Next
38 | Err.Number = 0
39 | value = objShell.RegRead(key)
40 | if Err.Number <> 0 Then
41 | Wscript.Stderr.Writeline("read["&key&"] error["&Err&"]")
42 | On Error goto 0
43 | ReadReg=Empty
44 | else
45 | On Error goto 0
46 | ReadReg=value
47 | End If
48 | End Function
49 |
50 | Function DeleteRegSubkeysInner(regobj,rootkey,path)
51 | dim arrsubkeys,key,curpath
52 | arrsubkeys=GetRegSubkeys(rootkey, path)
53 | If not IsEmpty(arrsubkeys) Then
54 | For Each key in arrsubkeys
55 | curpath = path & "\" & key
56 | call DeleteRegSubkeysInner(regobj, rootkey, curpath)
57 | Next
58 | End If
59 |
60 | regobj.DeleteKey rootkey,path
61 | End Function
62 |
63 | Function DeleteRegSubkeys(rootkey,path)
64 | dim regobj
65 | set regobj = GetObject("winmgmts:\\.\root\default:StdRegProv")
66 | call DeleteRegSubkeysInner(regobj, rootkey, path)
67 | End Function
68 |
69 |
70 |
--------------------------------------------------------------------------------
/removetmp.vbs:
--------------------------------------------------------------------------------
1 | Option Explicit
2 |
3 | Sub includeFile(fSpec)
4 | With CreateObject("Scripting.FileSystemObject")
5 | executeGlobal .openTextFile(fSpec).readAll()
6 | End With
7 | End Sub
8 |
9 | Function GetAppVersion(fname)
10 | dim objFSO,objReadFile,content
11 | Set objFSO = CreateObject("Scripting.FileSystemObject")
12 | Set objReadFile = objFSO.OpenTextFile(fname, 1, False)
13 | content = objReadFile.ReadAll
14 | content = Replace(content, vbCr, "")
15 | content = Replace(content, vbLf, "")
16 | GetAppVersion=content
17 | End Function
18 |
19 |
20 | dim basedir,vsver,vspdir,iidx,jidx
21 |
22 | Function GetScriptDir()
23 | dim fso ,scriptpath
24 | Set fso = CreateObject("Scripting.FileSystemObject")
25 | GetScriptDir=fso.GetParentFolderName(Wscript.ScriptFullName)
26 | End Function
27 |
28 |
29 | call includeFile( GetScriptDir() & "\base_func.vbs")
30 | call includeFile( GetScriptDir() & "\reg_op.vbs")
31 | call includeFile( GetScriptDir() & "\vs_find.vbs")
32 |
33 | Function RemoveTmpExpr(tmpdir,expr_re1)
34 | dim re
35 | dim curfile
36 | dim listfiles
37 | dim sarr
38 | dim matched,results,a
39 | dim expr_re
40 | dim curdir
41 | expr_re = expr_re1
42 | set re = new regexp
43 | re.Pattern = expr_re
44 | listfiles=ReadDirAll(tmpdir)
45 | sarr=Split(listfiles,";")
46 | For Each curfile in sarr
47 | matched = 0
48 | set results = re.Execute(curfile)
49 | For Each a in results
50 | matched =1
51 | Next
52 |
53 | If matched <> 0 Then
54 | WScript.Stdout.Writeline("match (" & expr_re & ") ("& curfile &")" )
55 | RemoveDir(curfile)
56 | End If
57 | Next
58 | End Function
59 |
60 | Function RemoveNpm(tmpdir)
61 | RemoveTmpExpr tmpdir,"npm(-[a-fA-F0-9]+)+"
62 | End Function
63 |
64 | Function RemoveGoBuild(tmpdir)
65 | RemoveTmpExpr tmpdir,"go-build([a-fA-F0-9]+)"
66 | End Function
67 | dim tmpdirs,tmparrs
68 | dim curtmp
69 |
70 | tmpdirs=GetEnv("TEMP")
71 | tmparrs=Split(tmpdirs,";")
72 |
73 | For Each curtmp in tmparrs
74 | RemoveNpm(curtmp)
75 | RemoveGoBuild(curtmp)
76 | Next
77 |
--------------------------------------------------------------------------------
/runcompile.vbs:
--------------------------------------------------------------------------------
1 |
2 | Option Explicit
3 |
4 |
5 | Function FormatBatch(basedir,compiletarget,slnfile,target,fname,vsver)
6 | dim fso,fh,cmdline
7 | set fso = WScript.CreateObject("Scripting.FileSystemObject")
8 | set fh = fso.CreateTextFile(fname,True)
9 | fh.WriteLine(GetVsAllBatchCall(vsver,basedir,compiletarget))
10 | fh.WriteLine(GetDevenvSlnRun(vsver,slnfile,basedir,target))
11 | fh.Close
12 | set fh = Nothing
13 | set fso = Nothing
14 | End Function
15 |
16 |
17 | Sub includeFile(fSpec)
18 | With CreateObject("Scripting.FileSystemObject")
19 | executeGlobal .openTextFile(fSpec).readAll()
20 | End With
21 | End Sub
22 |
23 |
24 | Function GetScriptDir()
25 | dim fso ,scriptpath
26 | Set fso = CreateObject("Scripting.FileSystemObject")
27 | GetScriptDir=fso.GetParentFolderName(Wscript.ScriptFullName)
28 | End Function
29 |
30 |
31 | call includeFile( GetScriptDir() & "\reg_op.vbs")
32 | call includeFile( GetScriptDir() & "\vs_find.vbs")
33 | call includeFile( GetScriptDir() & "\base_func.vbs")
34 |
35 | dim targets(),models(),sln
36 |
37 | Function Usage(ec,fmt)
38 | dim fh
39 | set fh = WScript.Stderr
40 | if ec = 0 Then
41 | set fh = WScript.Stdout
42 | End if
43 |
44 | if fmt <> "" Then
45 | fh.Writeline(fmt)
46 | End if
47 | fh.Writeline(WScript.ScriptName & " [OPTIONS]")
48 | fh.Writeline(chr(9) &"-h|--help to display this information")
49 | fh.Writeline(chr(9) &"-s|--sln slnfile to specify the sln file name")
50 | fh.Writeline(chr(9) &"-t|--target target model to specify target in sln file")
51 | WScript.Quit(ec)
52 | End Function
53 |
54 | Function ParseArgs(args)
55 | dim i,j,unum
56 | j = UBound(args)
57 | i = 0
58 | While i < j
59 | if args(i) = "-h" or args(i) = "--help" Then
60 | Usage 0,""
61 | elseif args(i) = "-s" or args(i) = "--sln" Then
62 | if (i+1) = j Then
63 | Usage 3,args(i) &" need an arg"
64 | End If
65 |
66 | sln = args((i + 1))
67 | i = i + 1
68 | elseif args(i) = "-t" or args(i) = "--target" Then
69 | if (i+2) = j Then
70 | Usage 3,args(i) &" need an arg"
71 | End If
72 | On error resume next
73 | Err.Number = 0
74 | unum = Ubound(targets)
75 | if Err.Number <> 0 Then
76 | unum = 0
77 | End If
78 | On error goto 0
79 | WScript.Stdout.Writeline("targets "& unum)
80 | unum = unum + 1
81 | redim preserve targets(unum)
82 | targets((unum-1)) = args((i + 1))
83 | WScript.Stdout.Writeline("target add("& targets((unum-1)) &")")
84 | i = i + 1
85 |
86 | On error resume next
87 | Err.Number = 0
88 | unum = Ubound(models)
89 | if Err.Number <> 0 Then
90 | unum = 0
91 | End If
92 | On error goto 0
93 | WScript.Stdout.Writeline("models "& unum)
94 | unum = unum + 1
95 | redim preserve models(unum)
96 | models((unum-1)) = args((i + 1))
97 | WScript.Stdout.Writeline("model add("& models((unum-1)) &")")
98 | i = i + 1
99 | End if
100 | i = i + 1
101 | Wend
102 | End Function
103 |
104 | Function ReplaceString(s,o,p)
105 | dim sarr,i,repl,c
106 | sarr=Split(s,"")
107 | repl=""
108 | for i=0 to len(s)
109 | c=Right(left(s,i),1)
110 | if c = o Then
111 | repl = repl & p
112 | else
113 | repl = repl & c
114 | End If
115 | Next
116 |
117 | ReplaceString=repl
118 | End Function
119 |
120 |
121 | dim args(),num,i
122 | num = WScript.Arguments.Count()
123 |
124 | if num = 0 Then
125 | Usage 3,"need args"
126 | End if
127 |
128 | redim args(num)
129 |
130 | for i=0 to (num - 1)
131 | args(i) = WScript.Arguments.Item(i)
132 | next
133 |
134 | ParseArgs(args)
135 |
136 |
137 | dim basedir,vsver,vspdir,iidx,jidx
138 |
139 | vsver=IsInstallVisualStudio(10.0)
140 | If IsEmpty(vsver) Then
141 | wscript.stderr.writeline("can not find visual studio installed")
142 | wscript.Quit(3)
143 | End If
144 | basedir=GetVisualStudioInstdir(10.0)
145 | if IsEmpty(basedir) Then
146 | wscript.stderr.writeline("can not find visual studio install directory")
147 | wscript.quit(5)
148 | End If
149 |
150 | iidx=0
151 |
152 | do while iidx < Ubound(targets)
153 | dim d,m,fname
154 | if targets(iidx) <> "" Then
155 | d = targets(iidx)
156 | m = models(iidx)
157 | fname = ReplaceString(d,"|","_")
158 | fname = fname & ".bat"
159 | wscript.stderr.writeline("fname " & fname)
160 | call FormatBatch(basedir,m, sln, d, fname,vsver)
161 | call RunCommand(fname)
162 | End If
163 | iidx = iidx + 1
164 | Loop
165 |
166 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 |
3 | project(nsduilib)
4 | include(cmake/functions.cmake)
5 |
6 | CheckMSVC()
7 | add_definitions(-DUNICODE -D_UNICODE)
8 | set(CMAKE_BUILD_TYPE Release)
9 |
10 | set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
11 | add_subdirectory(winlib)
12 | add_subdirectory(duilib)
13 | add_subdirectory(nsduilib)
14 | add_subdirectory(test/editui)
--------------------------------------------------------------------------------
/src/cmake/functions.cmake:
--------------------------------------------------------------------------------
1 | macro(ChangeStaticRuntimeLib)
2 | message(STATUS "change runtime static")
3 | foreach(flag_var
4 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
5 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
6 | if(${flag_var} MATCHES "/MD")
7 | string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
8 | endif(${flag_var} MATCHES "/MD")
9 | if(${flag_var} MATCHES "/MDd")
10 | string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
11 | endif(${flag_var} MATCHES "/MDd")
12 | endforeach(flag_var)
13 | endmacro(ChangeStaticRuntimeLib)
14 |
15 | macro(CheckMSVC)
16 | if (MSVC)
17 | if(${MSVC_VERSION} LESS 1600)
18 | message(FATAL_ERROR "must visual studio 2010 later")
19 | endif()
20 | else()
21 | message(FATAL_ERROR "this is for msvc running")
22 | endif(MSVC)
23 | endmacro(CheckMSVC)
--------------------------------------------------------------------------------
/src/duilib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CMAKE_BUILD_TYPE Release)
2 | add_definitions(/DUILIB_STATIC)
3 | file(GLOB CONTROL_UILIB_SRCS "Control/*.cpp")
4 | file(GLOB CORE_UILIB_SRCS "Core/*.cpp")
5 | file(GLOB LAYOUT_UILIB_SRCS "Layout/*.cpp")
6 | file(GLOB UTILS_UILIB_SRCS "Utils/*.cpp")
7 | file(GLOB UTILS_UILIB_CFILES "Utils/*.c")
8 | add_library(duilib STATIC ${CONTROL_UILIB_SRCS} ${CORE_UILIB_SRCS} ${LAYOUT_UILIB_SRCS} ${UTILS_UILIB_SRCS} ${UTILS_UILIB_CFILES} StdAfx.cpp)
9 |
10 | target_include_directories(duilib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../clibs/winlib ${CMAKE_CURRENT_SOURCE_DIR})
11 | target_link_libraries(duilib winlib)
12 |
13 | ChangeStaticRuntimeLib()
14 |
15 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIActiveX.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIActiveX.cpp
--------------------------------------------------------------------------------
/src/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 UILIB_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 |
38 | HWND GetHostWindow() 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 | void DoPaint(HDC hDC, const RECT& rcPaint);
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 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIButton.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIBUTTON_H__
2 | #define __UIBUTTON_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CButtonUI : public CLabelUI
9 | {
10 | public:
11 | CButtonUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 | UINT GetControlFlags() const;
16 |
17 | bool Activate();
18 | void SetEnabled(bool bEnable = true);
19 | void DoEvent(TEventUI& event);
20 |
21 | LPCTSTR GetNormalImage();
22 | void SetNormalImage(LPCTSTR pStrImage);
23 | LPCTSTR GetHotImage();
24 | void SetHotImage(LPCTSTR pStrImage);
25 | LPCTSTR GetPushedImage();
26 | void SetPushedImage(LPCTSTR pStrImage);
27 | LPCTSTR GetFocusedImage();
28 | void SetFocusedImage(LPCTSTR pStrImage);
29 | LPCTSTR GetDisabledImage();
30 | void SetDisabledImage(LPCTSTR pStrImage);
31 | LPCTSTR GetForeImage();
32 | void SetForeImage(LPCTSTR pStrImage);
33 | LPCTSTR GetHotForeImage();
34 | void SetHotForeImage(LPCTSTR pStrImage);
35 |
36 | void SetHotBkColor(DWORD dwColor);
37 | DWORD GetHotBkColor() const;
38 | void SetHotTextColor(DWORD dwColor);
39 | DWORD GetHotTextColor() const;
40 | void SetPushedTextColor(DWORD dwColor);
41 | DWORD GetPushedTextColor() const;
42 | void SetFocusedTextColor(DWORD dwColor);
43 | DWORD GetFocusedTextColor() const;
44 | SIZE EstimateSize(SIZE szAvailable);
45 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
46 |
47 | void PaintText(HDC hDC);
48 | void PaintStatusImage(HDC hDC);
49 |
50 | protected:
51 | UINT m_uButtonState;
52 |
53 | DWORD m_dwHotBkColor;
54 | DWORD m_dwHotTextColor;
55 | DWORD m_dwPushedTextColor;
56 | DWORD m_dwFocusedTextColor;
57 |
58 | TDrawInfo m_diNormal;
59 | TDrawInfo m_diHot;
60 | TDrawInfo m_diHotFore;
61 | TDrawInfo m_diPushed;
62 | TDrawInfo m_diPushedFore;
63 | TDrawInfo m_diFocused;
64 | TDrawInfo m_diDisabled;
65 | };
66 |
67 | } // namespace DuiLib
68 |
69 | #endif // __UIBUTTON_H__
--------------------------------------------------------------------------------
/src/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 _T("CheckBoxUI");
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)
18 | {
19 | Selected(bCheck);
20 | }
21 |
22 | bool CCheckBoxUI::GetCheck() const
23 | {
24 | return IsSelected();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/duilib/Control/UICheckBox.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UICheckBox.h
--------------------------------------------------------------------------------
/src/duilib/Control/UICombo.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UICombo.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UICombo.h:
--------------------------------------------------------------------------------
1 | #ifndef __UICOMBO_H__
2 | #define __UICOMBO_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 | /////////////////////////////////////////////////////////////////////////////////////
8 | //
9 |
10 | class CComboWnd;
11 |
12 | class UILIB_API CComboUI : public CContainerUI, public IListOwnerUI
13 | {
14 | friend class CComboWnd;
15 | public:
16 | CComboUI();
17 |
18 | LPCTSTR GetClass() const;
19 | LPVOID GetInterface(LPCTSTR pstrName);
20 |
21 | void DoInit();
22 | UINT GetControlFlags() const;
23 |
24 | CDuiString GetText() const;
25 | void SetEnabled(bool bEnable = true);
26 |
27 | CDuiString GetDropBoxAttributeList();
28 | void SetDropBoxAttributeList(LPCTSTR pstrList);
29 | SIZE GetDropBoxSize() const;
30 | void SetDropBoxSize(SIZE szDropBox);
31 |
32 | int GetCurSel() const;
33 | bool GetSelectCloseFlag();
34 | void SetSelectCloseFlag(bool flag);
35 | bool SelectItem(int iIndex, bool bTakeFocus = false);
36 |
37 | bool SetItemIndex(CControlUI* pControl, int iIndex);
38 | bool Add(CControlUI* pControl);
39 | bool AddAt(CControlUI* pControl, int iIndex);
40 | bool Remove(CControlUI* pControl);
41 | bool RemoveAt(int iIndex);
42 | void RemoveAll();
43 |
44 | bool Activate();
45 |
46 | bool GetShowText() const;
47 | void SetShowText(bool flag);
48 | RECT GetTextPadding() const;
49 | void SetTextPadding(RECT rc);
50 | LPCTSTR GetNormalImage() const;
51 | void SetNormalImage(LPCTSTR pStrImage);
52 | LPCTSTR GetHotImage() const;
53 | void SetHotImage(LPCTSTR pStrImage);
54 | LPCTSTR GetPushedImage() const;
55 | void SetPushedImage(LPCTSTR pStrImage);
56 | LPCTSTR GetFocusedImage() const;
57 | void SetFocusedImage(LPCTSTR pStrImage);
58 | LPCTSTR GetDisabledImage() const;
59 | void SetDisabledImage(LPCTSTR pStrImage);
60 |
61 | TListInfoUI* GetListInfo();
62 | void SetItemFont(int index);
63 | void SetItemTextStyle(UINT uStyle);
64 | RECT GetItemTextPadding() const;
65 | void SetItemTextPadding(RECT rc);
66 | DWORD GetItemTextColor() const;
67 | void SetItemTextColor(DWORD dwTextColor);
68 | DWORD GetItemBkColor() const;
69 | void SetItemBkColor(DWORD dwBkColor);
70 | LPCTSTR GetItemBkImage() const;
71 | void SetItemBkImage(LPCTSTR pStrImage);
72 | bool IsAlternateBk() const;
73 | void SetAlternateBk(bool bAlternateBk);
74 | DWORD GetSelectedItemTextColor() const;
75 | void SetSelectedItemTextColor(DWORD dwTextColor);
76 | DWORD GetSelectedItemBkColor() const;
77 | void SetSelectedItemBkColor(DWORD dwBkColor);
78 | LPCTSTR GetSelectedItemImage() const;
79 | void SetSelectedItemImage(LPCTSTR pStrImage);
80 | DWORD GetHotItemTextColor() const;
81 | void SetHotItemTextColor(DWORD dwTextColor);
82 | DWORD GetHotItemBkColor() const;
83 | void SetHotItemBkColor(DWORD dwBkColor);
84 | LPCTSTR GetHotItemImage() const;
85 | void SetHotItemImage(LPCTSTR pStrImage);
86 | DWORD GetDisabledItemTextColor() const;
87 | void SetDisabledItemTextColor(DWORD dwTextColor);
88 | DWORD GetDisabledItemBkColor() const;
89 | void SetDisabledItemBkColor(DWORD dwBkColor);
90 | LPCTSTR GetDisabledItemImage() const;
91 | void SetDisabledItemImage(LPCTSTR pStrImage);
92 | DWORD GetItemLineColor() const;
93 | void SetItemLineColor(DWORD dwLineColor);
94 | bool IsItemShowHtml();
95 | void SetItemShowHtml(bool bShowHtml = true);
96 |
97 | SIZE EstimateSize(SIZE szAvailable);
98 | void SetPos(RECT rc, bool bNeedInvalidate = true);
99 | void Move(SIZE szOffset, bool bNeedInvalidate = true);
100 | void DoEvent(TEventUI& event);
101 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
102 |
103 | void DoPaint(HDC hDC, const RECT& rcPaint);
104 | void PaintText(HDC hDC);
105 | void PaintStatusImage(HDC hDC);
106 |
107 | protected:
108 | CComboWnd* m_pWindow;
109 |
110 | int m_iCurSel;
111 | bool m_bShowText;
112 | bool m_bSelectCloseFlag;
113 | RECT m_rcTextPadding;
114 | CDuiString m_sDropBoxAttributes;
115 | SIZE m_szDropBox;
116 | UINT m_uButtonState;
117 |
118 | TDrawInfo m_diNormal;
119 | TDrawInfo m_diHot;
120 | TDrawInfo m_diPushed;
121 | TDrawInfo m_diFocused;
122 | TDrawInfo m_diDisabled;
123 |
124 | TListInfoUI m_ListInfo;
125 | };
126 |
127 | } // namespace DuiLib
128 |
129 | #endif // __UICOMBO_H__
130 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIDateTime.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIDateTime.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UIDateTime.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIDateTime.h
--------------------------------------------------------------------------------
/src/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 UILIB_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 |
20 | void SetEnabled(bool bEnable = true);
21 | void SetText(LPCTSTR pstrText);
22 | void SetMaxChar(UINT uMax);
23 | UINT GetMaxChar();
24 | void SetReadOnly(bool bReadOnly);
25 | bool IsReadOnly() const;
26 | void SetPasswordMode(bool bPasswordMode);
27 | bool IsPasswordMode() const;
28 | void SetPasswordChar(TCHAR cPasswordChar);
29 | TCHAR GetPasswordChar() const;
30 | void SetNumberOnly(bool bNumberOnly);
31 | bool IsNumberOnly() const;
32 | int GetWindowStyls() const;
33 | HWND GetNativeEditHWND() const;
34 |
35 | LPCTSTR GetNormalImage();
36 | void SetNormalImage(LPCTSTR pStrImage);
37 | LPCTSTR GetHotImage();
38 | void SetHotImage(LPCTSTR pStrImage);
39 | LPCTSTR GetFocusedImage();
40 | void SetFocusedImage(LPCTSTR pStrImage);
41 | LPCTSTR GetDisabledImage();
42 | void SetDisabledImage(LPCTSTR pStrImage);
43 | void SetNativeEditBkColor(DWORD dwBkColor);
44 | DWORD GetNativeEditBkColor() const;
45 |
46 | void SetSel(long nStartChar, long nEndChar);
47 | void SetSelAll();
48 | void SetReplaceSel(LPCTSTR lpszReplace);
49 |
50 | void SetPos(RECT rc, bool bNeedInvalidate = true);
51 | void Move(SIZE szOffset, bool bNeedInvalidate = true);
52 | void SetVisible(bool bVisible = true);
53 | void SetInternVisible(bool bVisible = true);
54 | SIZE EstimateSize(SIZE szAvailable);
55 | void DoEvent(TEventUI& event);
56 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
57 |
58 | void PaintStatusImage(HDC hDC);
59 | void PaintText(HDC hDC);
60 |
61 | protected:
62 | CEditWnd* m_pWindow;
63 |
64 | UINT m_uMaxChar;
65 | bool m_bReadOnly;
66 | bool m_bPasswordMode;
67 | TCHAR m_cPasswordChar;
68 | UINT m_uButtonState;
69 | DWORD m_dwEditbkColor;
70 | int m_iWindowStyls;
71 |
72 | TDrawInfo m_diNormal;
73 | TDrawInfo m_diHot;
74 | TDrawInfo m_diFocused;
75 | TDrawInfo m_diDisabled;
76 | };
77 | }
78 | #endif // __UIEDIT_H__
--------------------------------------------------------------------------------
/src/duilib/Control/UIFlash.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIFlash.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UIFlash.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIFlash.h
--------------------------------------------------------------------------------
/src/duilib/Control/UILabel.h:
--------------------------------------------------------------------------------
1 | #ifndef __UILABEL_H__
2 | #define __UILABEL_H__
3 |
4 | #pragma once
5 |
6 | #include
7 | #pragma comment( lib, "GdiPlus.lib" )
8 | using namespace Gdiplus;
9 | class UILIB_API Gdiplus::RectF;
10 | struct UILIB_API Gdiplus::GdiplusStartupInput;
11 |
12 | namespace DuiLib
13 | {
14 | class UILIB_API CLabelUI : public CControlUI
15 | {
16 | public:
17 | CLabelUI();
18 | ~CLabelUI();
19 |
20 | LPCTSTR GetClass() const;
21 | LPVOID GetInterface(LPCTSTR pstrName);
22 |
23 | void SetTextStyle(UINT uStyle);
24 | UINT GetTextStyle() const;
25 | void SetTextColor(DWORD dwTextColor);
26 | DWORD GetTextColor() const;
27 | void SetDisabledTextColor(DWORD dwTextColor);
28 | DWORD GetDisabledTextColor() const;
29 | void SetFont(int index);
30 | int GetFont() const;
31 | RECT GetTextPadding() const;
32 | void SetTextPadding(RECT rc);
33 | bool IsShowHtml();
34 | void SetShowHtml(bool bShowHtml = true);
35 |
36 | SIZE EstimateSize(SIZE szAvailable);
37 | void DoEvent(TEventUI& event);
38 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
39 |
40 | void PaintText(HDC hDC);
41 |
42 | void SetEnabledEffect(bool _EnabledEffect);
43 | bool GetEnabledEffect();
44 | void SetText(LPCTSTR pstrText);
45 | CDuiString GetText() const;
46 | void SetTransShadow(int _TransShadow);
47 | int GetTransShadow();
48 | void SetTransShadow1(int _TransShadow);
49 | int GetTransShadow1();
50 | void SetTransText(int _TransText);
51 | int GetTransText();
52 | void SetTransText1(int _TransText);
53 | int GetTransText1();
54 | void SetTransStroke(int _TransStroke);
55 | int GetTransStroke();
56 | void SetGradientLength(int _GradientLength);
57 | int GetGradientLength();
58 | void SetTextRenderingHintAntiAlias(int _TextRenderingHintAntiAlias);
59 | int GetTextRenderingHintAntiAlias();
60 | void SetShadowOffset(int _offset,int _angle);
61 | RectF GetShadowOffset();
62 | void SetTextColor1(DWORD _TextColor1);
63 | DWORD GetTextColor1();
64 | void SetTextShadowColorA(DWORD _TextShadowColorA);
65 | DWORD GetTextShadowColorA();
66 | void SetTextShadowColorB(DWORD _TextShadowColorB);
67 | DWORD GetTextShadowColorB();
68 | void SetStrokeColor(DWORD _StrokeColor);
69 | DWORD GetStrokeColor();
70 | void SetGradientAngle(int _SetGradientAngle);
71 | int GetGradientAngle();
72 | void SetEnabledStroke(bool _EnabledStroke);
73 | bool GetEnabledStroke();
74 | void SetEnabledShadow(bool _EnabledShadowe);
75 | bool GetEnabledShadow();
76 |
77 | protected:
78 | DWORD m_dwTextColor;
79 | DWORD m_dwDisabledTextColor;
80 | int m_iFont;
81 | UINT m_uTextStyle;
82 | RECT m_rcTextPadding;
83 | bool m_bShowHtml;
84 |
85 | int m_TransShadow;
86 | int m_TransShadow1;
87 | int m_TransText;
88 | int m_TransText1;
89 | int m_TransStroke;
90 | int m_GradientLength;
91 | int m_GradientAngle;
92 | bool m_EnableEffect;
93 | bool m_EnabledStroke;
94 | bool m_EnabledShadow;
95 | DWORD m_dwTextColor1;
96 | DWORD m_dwTextShadowColorA;
97 | DWORD m_dwTextShadowColorB;
98 | DWORD m_dwStrokeColor;
99 | RectF m_ShadowOffset;
100 | CDuiString m_TextValue;
101 | ULONG_PTR m_gdiplusToken;
102 | GdiplusStartupInput m_gdiplusStartupInput;
103 | TextRenderingHint m_TextRenderingHintAntiAlias;
104 | };
105 | }
106 |
107 | #endif // __UILABEL_H__
--------------------------------------------------------------------------------
/src/duilib/Control/UIList.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIList.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UIList.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIList.h
--------------------------------------------------------------------------------
/src/duilib/Control/UIOption.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIOPTION_H__
2 | #define __UIOPTION_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 GetSelectBkColor();
33 |
34 | LPCTSTR GetForeImage();
35 | void SetForeImage(LPCTSTR pStrImage);
36 |
37 | LPCTSTR GetGroup() const;
38 | void SetGroup(LPCTSTR pStrGroupName = NULL);
39 | bool IsSelected() const;
40 | virtual void Selected(bool bSelected);
41 |
42 | SIZE EstimateSize(SIZE szAvailable);
43 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
44 |
45 | void PaintStatusImage(HDC hDC);
46 | void PaintText(HDC hDC);
47 |
48 | protected:
49 | bool m_bSelected;
50 | CDuiString m_sGroupName;
51 |
52 | DWORD m_dwSelectedBkColor;
53 | DWORD m_dwSelectedTextColor;
54 |
55 | TDrawInfo m_diSelected;
56 | TDrawInfo m_diSelectedHot;
57 | TDrawInfo m_diFore;
58 | };
59 |
60 | } // namespace DuiLib
61 |
62 | #endif // __UIOPTION_H__
--------------------------------------------------------------------------------
/src/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), m_bStretchForeImage(true)
7 | {
8 | m_uTextStyle = DT_SINGLELINE | DT_CENTER;
9 | SetFixedHeight(12);
10 | }
11 |
12 | LPCTSTR CProgressUI::GetClass() const
13 | {
14 | return _T("ProgressUI");
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 | Invalidate();
67 | }
68 |
69 | LPCTSTR CProgressUI::GetForeImage() const
70 | {
71 | return m_diFore.sDrawString;
72 | }
73 |
74 | void CProgressUI::SetForeImage(LPCTSTR pStrImage)
75 | {
76 | if( m_diFore.sDrawString == pStrImage && m_diFore.pImageInfo != NULL ) return;
77 | m_diFore.Clear();
78 | m_diFore.sDrawString = pStrImage;
79 | Invalidate();
80 | }
81 |
82 | void CProgressUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
83 | {
84 | if( _tcscmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue);
85 | else if( _tcscmp(pstrName, _T("hor")) == 0 ) SetHorizontal(_tcscmp(pstrValue, _T("true")) == 0);
86 | else if( _tcscmp(pstrName, _T("min")) == 0 ) SetMinValue(_ttoi(pstrValue));
87 | else if( _tcscmp(pstrName, _T("max")) == 0 ) SetMaxValue(_ttoi(pstrValue));
88 | else if( _tcscmp(pstrName, _T("value")) == 0 ) SetValue(_ttoi(pstrValue));
89 | else if( _tcscmp(pstrName, _T("isstretchfore"))==0) SetStretchForeImage(_tcscmp(pstrValue, _T("true")) == 0? true : false);
90 | else CLabelUI::SetAttribute(pstrName, pstrValue);
91 | }
92 |
93 | void CProgressUI::PaintStatusImage(HDC hDC)
94 | {
95 | if( m_nMax <= m_nMin ) m_nMax = m_nMin + 1;
96 | if( m_nValue > m_nMax ) m_nValue = m_nMax;
97 | if( m_nValue < m_nMin ) m_nValue = m_nMin;
98 |
99 | RECT rc = {0};
100 | if( m_bHorizontal ) {
101 | rc.right = (m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left) / (m_nMax - m_nMin);
102 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
103 | }
104 | else {
105 | rc.top = (m_rcItem.bottom - m_rcItem.top) * (m_nMax - m_nValue) / (m_nMax - m_nMin);
106 | rc.right = m_rcItem.right - m_rcItem.left;
107 | rc.bottom = m_rcItem.bottom - m_rcItem.top;
108 | }
109 | m_diFore.rcDestOffset = rc;
110 | if( DrawImage(hDC, m_diFore) ) return;
111 | }
112 |
113 | bool CProgressUI::IsStretchForeImage()
114 | {
115 | return m_bStretchForeImage;
116 | }
117 |
118 | void CProgressUI::SetStretchForeImage( bool bStretchForeImage /*= true*/ )
119 | {
120 | if (m_bStretchForeImage==bStretchForeImage) return;
121 | m_bStretchForeImage=bStretchForeImage;
122 | Invalidate();
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIProgress.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIPROGRESS_H__
2 | #define __UIPROGRESS_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 | bool IsStretchForeImage();
19 | void SetStretchForeImage(bool bStretchForeImage = true);
20 | int GetMinValue() const;
21 | void SetMinValue(int nMin);
22 | int GetMaxValue() const;
23 | void SetMaxValue(int nMax);
24 | int GetValue() const;
25 | void SetValue(int nValue);
26 | LPCTSTR GetForeImage() const;
27 | void SetForeImage(LPCTSTR pStrImage);
28 |
29 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
30 | void PaintStatusImage(HDC hDC);
31 |
32 | protected:
33 | bool m_bHorizontal;
34 | bool m_bStretchForeImage;
35 | int m_nMax;
36 | int m_nMin;
37 | int m_nValue;
38 |
39 | TDrawInfo m_diFore;
40 | };
41 |
42 | } // namespace DuiLib
43 |
44 | #endif // __UIPROGRESS_H__
45 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIRichEdit.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIRichEdit.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UIRichEdit.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIRichEdit.h
--------------------------------------------------------------------------------
/src/duilib/Control/UIScrollBar.h:
--------------------------------------------------------------------------------
1 | #ifndef __UISCROLLBAR_H__
2 | #define __UISCROLLBAR_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_API CScrollBarUI : public CControlUI
9 | {
10 | public:
11 | CScrollBarUI();
12 |
13 | LPCTSTR GetClass() const;
14 | LPVOID GetInterface(LPCTSTR pstrName);
15 |
16 | CContainerUI* GetOwner() const;
17 | void SetOwner(CContainerUI* pOwner);
18 |
19 | void SetVisible(bool bVisible = true);
20 | void SetEnabled(bool bEnable = true);
21 | void SetFocus();
22 |
23 | bool IsHorizontal();
24 | void SetHorizontal(bool bHorizontal = true);
25 | int GetScrollRange() const;
26 | void SetScrollRange(int nRange);
27 | int GetScrollPos() const;
28 | void SetScrollPos(int nPos);
29 | int GetLineSize() const;
30 | void SetLineSize(int nSize);
31 |
32 | bool GetShowButton1();
33 | void SetShowButton1(bool bShow);
34 | DWORD GetButton1Color() const;
35 | void SetButton1Color(DWORD dwColor);
36 | LPCTSTR GetButton1NormalImage();
37 | void SetButton1NormalImage(LPCTSTR pStrImage);
38 | LPCTSTR GetButton1HotImage();
39 | void SetButton1HotImage(LPCTSTR pStrImage);
40 | LPCTSTR GetButton1PushedImage();
41 | void SetButton1PushedImage(LPCTSTR pStrImage);
42 | LPCTSTR GetButton1DisabledImage();
43 | void SetButton1DisabledImage(LPCTSTR pStrImage);
44 |
45 | bool GetShowButton2();
46 | void SetShowButton2(bool bShow);
47 | DWORD GetButton2Color() const;
48 | void SetButton2Color(DWORD dwColor);
49 | LPCTSTR GetButton2NormalImage();
50 | void SetButton2NormalImage(LPCTSTR pStrImage);
51 | LPCTSTR GetButton2HotImage();
52 | void SetButton2HotImage(LPCTSTR pStrImage);
53 | LPCTSTR GetButton2PushedImage();
54 | void SetButton2PushedImage(LPCTSTR pStrImage);
55 | LPCTSTR GetButton2DisabledImage();
56 | void SetButton2DisabledImage(LPCTSTR pStrImage);
57 |
58 | DWORD GetThumbColor() const;
59 | void SetThumbColor(DWORD dwColor);
60 | LPCTSTR GetThumbNormalImage();
61 | void SetThumbNormalImage(LPCTSTR pStrImage);
62 | LPCTSTR GetThumbHotImage();
63 | void SetThumbHotImage(LPCTSTR pStrImage);
64 | LPCTSTR GetThumbPushedImage();
65 | void SetThumbPushedImage(LPCTSTR pStrImage);
66 | LPCTSTR GetThumbDisabledImage();
67 | void SetThumbDisabledImage(LPCTSTR pStrImage);
68 |
69 | LPCTSTR GetRailNormalImage();
70 | void SetRailNormalImage(LPCTSTR pStrImage);
71 | LPCTSTR GetRailHotImage();
72 | void SetRailHotImage(LPCTSTR pStrImage);
73 | LPCTSTR GetRailPushedImage();
74 | void SetRailPushedImage(LPCTSTR pStrImage);
75 | LPCTSTR GetRailDisabledImage();
76 | void SetRailDisabledImage(LPCTSTR pStrImage);
77 |
78 | LPCTSTR GetBkNormalImage();
79 | void SetBkNormalImage(LPCTSTR pStrImage);
80 | LPCTSTR GetBkHotImage();
81 | void SetBkHotImage(LPCTSTR pStrImage);
82 | LPCTSTR GetBkPushedImage();
83 | void SetBkPushedImage(LPCTSTR pStrImage);
84 | LPCTSTR GetBkDisabledImage();
85 | void SetBkDisabledImage(LPCTSTR pStrImage);
86 |
87 | void SetPos(RECT rc, bool bNeedInvalidate = true);
88 | void DoEvent(TEventUI& event);
89 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
90 |
91 | void DoPaint(HDC hDC, const RECT& rcPaint);
92 |
93 | void PaintBk(HDC hDC);
94 | void PaintButton1(HDC hDC);
95 | void PaintButton2(HDC hDC);
96 | void PaintThumb(HDC hDC);
97 | void PaintRail(HDC hDC);
98 |
99 | protected:
100 |
101 | enum
102 | {
103 | DEFAULT_SCROLLBAR_SIZE = 16,
104 | DEFAULT_TIMERID = 10,
105 | };
106 |
107 | bool m_bHorizontal;
108 | int m_nRange;
109 | int m_nScrollPos;
110 | int m_nLineSize;
111 | CContainerUI* m_pOwner;
112 | POINT ptLastMouse;
113 | int m_nLastScrollPos;
114 | int m_nLastScrollOffset;
115 | int m_nScrollRepeatDelay;
116 |
117 | TDrawInfo m_diBkNormal;
118 | TDrawInfo m_diBkHot;
119 | TDrawInfo m_diBkPushed;
120 | TDrawInfo m_diBkDisabled;
121 |
122 | bool m_bShowButton1;
123 | RECT m_rcButton1;
124 | UINT m_uButton1State;
125 | DWORD m_dwButton1Color;
126 | TDrawInfo m_diButton1Normal;
127 | TDrawInfo m_diButton1Hot;
128 | TDrawInfo m_diButton1Pushed;
129 | TDrawInfo m_diButton1Disabled;
130 |
131 | bool m_bShowButton2;
132 | RECT m_rcButton2;
133 | UINT m_uButton2State;
134 | DWORD m_dwButton2Color;
135 | TDrawInfo m_diButton2Normal;
136 | TDrawInfo m_diButton2Hot;
137 | TDrawInfo m_diButton2Pushed;
138 | TDrawInfo m_diButton2Disabled;
139 |
140 | RECT m_rcThumb;
141 | UINT m_uThumbState;
142 | DWORD m_dwThumbColor;
143 | TDrawInfo m_diThumbNormal;
144 | TDrawInfo m_diThumbHot;
145 | TDrawInfo m_diThumbPushed;
146 | TDrawInfo m_diThumbDisabled;
147 |
148 | TDrawInfo m_diRailNormal;
149 | TDrawInfo m_diRailHot;
150 | TDrawInfo m_diRailPushed;
151 | TDrawInfo m_diRailDisabled;
152 | };
153 | }
154 |
155 | #endif // __UISCROLLBAR_H__
--------------------------------------------------------------------------------
/src/duilib/Control/UISlider.h:
--------------------------------------------------------------------------------
1 | #ifndef __UISLIDER_H__
2 | #define __UISLIDER_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 | LPCTSTR GetThumbImage() const;
24 | void SetThumbImage(LPCTSTR pStrImage);
25 | LPCTSTR GetThumbHotImage() const;
26 | void SetThumbHotImage(LPCTSTR pStrImage);
27 | LPCTSTR GetThumbPushedImage() const;
28 | void SetThumbPushedImage(LPCTSTR pStrImage);
29 |
30 | void DoEvent(TEventUI& event);
31 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
32 | void PaintStatusImage(HDC hDC);
33 |
34 | protected:
35 | SIZE m_szThumb;
36 | UINT m_uButtonState;
37 | int m_nStep;
38 |
39 | TDrawInfo m_diThumb;
40 | TDrawInfo m_diThumbHot;
41 | TDrawInfo m_diThumbPushed;
42 | };
43 | }
44 |
45 | #endif // __UISLIDER_H__
--------------------------------------------------------------------------------
/src/duilib/Control/UIText.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "UIText.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTextUI::CTextUI() : m_nLinks(0), m_nHoverLink(-1)
7 | {
8 | m_uTextStyle = DT_WORDBREAK;
9 | m_rcTextPadding.left = 2;
10 | m_rcTextPadding.right = 2;
11 | ::ZeroMemory(m_rcLinks, sizeof(m_rcLinks));
12 | }
13 |
14 | CTextUI::~CTextUI()
15 | {
16 | }
17 |
18 | LPCTSTR CTextUI::GetClass() const
19 | {
20 | return _T("TextUI");
21 | }
22 |
23 | LPVOID CTextUI::GetInterface(LPCTSTR pstrName)
24 | {
25 | if( _tcscmp(pstrName, DUI_CTR_TEXT) == 0 ) return static_cast(this);
26 | return CLabelUI::GetInterface(pstrName);
27 | }
28 |
29 | UINT CTextUI::GetControlFlags() const
30 | {
31 | if( IsEnabled() && m_nLinks > 0 ) return UIFLAG_SETCURSOR;
32 | else return 0;
33 | }
34 |
35 | CDuiString* CTextUI::GetLinkContent(int iIndex)
36 | {
37 | if( iIndex >= 0 && iIndex < m_nLinks ) return &m_sLinks[iIndex];
38 | return NULL;
39 | }
40 |
41 | void CTextUI::DoEvent(TEventUI& event)
42 | {
43 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
44 | if( m_pParent != NULL ) m_pParent->DoEvent(event);
45 | else CLabelUI::DoEvent(event);
46 | return;
47 | }
48 |
49 | if( event.Type == UIEVENT_SETCURSOR ) {
50 | for( int i = 0; i < m_nLinks; i++ ) {
51 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
52 | ::SetCursor(::LoadCursor(NULL, IDC_HAND));
53 | return;
54 | }
55 | }
56 | }
57 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK && IsEnabled() ) {
58 | for( int i = 0; i < m_nLinks; i++ ) {
59 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
60 | Invalidate();
61 | return;
62 | }
63 | }
64 | }
65 | if( event.Type == UIEVENT_BUTTONUP && IsEnabled() ) {
66 | for( int i = 0; i < m_nLinks; i++ ) {
67 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
68 | m_pManager->SendNotify(this, DUI_MSGTYPE_LINK, i);
69 | return;
70 | }
71 | }
72 | }
73 | if( event.Type == UIEVENT_CONTEXTMENU )
74 | {
75 | return;
76 | }
77 | // When you move over a link
78 | if( m_nLinks > 0 && event.Type == UIEVENT_MOUSEMOVE && IsEnabled() ) {
79 | int nHoverLink = -1;
80 | for( int i = 0; i < m_nLinks; i++ ) {
81 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
82 | nHoverLink = i;
83 | break;
84 | }
85 | }
86 |
87 | if(m_nHoverLink != nHoverLink) {
88 | m_nHoverLink = nHoverLink;
89 | Invalidate();
90 | return;
91 | }
92 | }
93 | if( event.Type == UIEVENT_MOUSELEAVE ) {
94 | if( m_nLinks > 0 && IsEnabled() ) {
95 | if(m_nHoverLink != -1) {
96 | m_nHoverLink = -1;
97 | Invalidate();
98 | return;
99 | }
100 | }
101 | }
102 |
103 | CLabelUI::DoEvent(event);
104 | }
105 |
106 | SIZE CTextUI::EstimateSize(SIZE szAvailable)
107 | {
108 | RECT rcText = { 0, 0, MAX(szAvailable.cx, m_cxyFixed.cx), 9999 };
109 | rcText.left += m_rcTextPadding.left;
110 | rcText.right -= m_rcTextPadding.right;
111 | if( m_bShowHtml ) {
112 | int nLinks = 0;
113 | CRenderEngine::DrawHtmlText(m_pManager->GetPaintDC(), m_pManager, rcText, m_sText, m_dwTextColor, NULL, NULL, nLinks, DT_CALCRECT | m_uTextStyle);
114 | }
115 | else {
116 | CRenderEngine::DrawText(m_pManager->GetPaintDC(), m_pManager, rcText, m_sText, m_dwTextColor, m_iFont, DT_CALCRECT | m_uTextStyle);
117 | }
118 | SIZE cXY = {rcText.right - rcText.left + m_rcTextPadding.left + m_rcTextPadding.right,
119 | rcText.bottom - rcText.top + m_rcTextPadding.top + m_rcTextPadding.bottom};
120 |
121 | if( m_cxyFixed.cy != 0 ) cXY.cy = m_cxyFixed.cy;
122 | return cXY;
123 | }
124 |
125 | void CTextUI::PaintText(HDC hDC)
126 | {
127 | if( m_sText.IsEmpty() ) {
128 | m_nLinks = 0;
129 | return;
130 | }
131 |
132 | if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
133 | if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
134 |
135 | if( m_sText.IsEmpty() ) return;
136 |
137 | m_nLinks = lengthof(m_rcLinks);
138 | RECT rc = m_rcItem;
139 | rc.left += m_rcTextPadding.left;
140 | rc.right -= m_rcTextPadding.right;
141 | rc.top += m_rcTextPadding.top;
142 | rc.bottom -= m_rcTextPadding.bottom;
143 | if( IsEnabled() ) {
144 | if( m_bShowHtml )
145 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
146 | m_rcLinks, m_sLinks, m_nLinks, m_uTextStyle);
147 | else
148 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
149 | m_iFont, m_uTextStyle);
150 | }
151 | else {
152 | if( m_bShowHtml )
153 | CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
154 | m_rcLinks, m_sLinks, m_nLinks, m_uTextStyle);
155 | else
156 | CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
157 | m_iFont, m_uTextStyle);
158 | }
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIText.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITEXT_H__
2 | #define __UITEXT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 | SIZE EstimateSize(SIZE szAvailable);
22 |
23 | void PaintText(HDC hDC);
24 |
25 | protected:
26 | enum { MAX_LINK = 8 };
27 | int m_nLinks;
28 | RECT m_rcLinks[MAX_LINK];
29 | CDuiString m_sLinks[MAX_LINK];
30 | int m_nHoverLink;
31 | };
32 |
33 | } // namespace DuiLib
34 |
35 | #endif //__UITEXT_H__
--------------------------------------------------------------------------------
/src/duilib/Control/UITreeView.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UITreeView.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UITreeView.h:
--------------------------------------------------------------------------------
1 | #ifndef UITreeView_h__
2 | #define UITreeView_h__
3 |
4 | #include
5 | using namespace std;
6 |
7 | #pragma once
8 |
9 | namespace DuiLib
10 | {
11 | class CTreeViewUI;
12 | class CCheckBoxUI;
13 | class CLabelUI;
14 | class COptionUI;
15 |
16 | class UILIB_API CTreeNodeUI : public CListContainerElementUI
17 | {
18 | public:
19 | CTreeNodeUI(CTreeNodeUI* _ParentNode = NULL);
20 | ~CTreeNodeUI(void);
21 |
22 | public:
23 | LPCTSTR GetClass() const;
24 | LPVOID GetInterface(LPCTSTR pstrName);
25 | void DoEvent(TEventUI& event);
26 | void Invalidate();
27 | bool Select(bool bSelect = true);
28 |
29 | bool Add(CControlUI* _pTreeNodeUI);
30 | bool AddAt(CControlUI* pControl, int iIndex);
31 | bool Remove(CControlUI* pControl);
32 |
33 | void SetVisibleTag(bool _IsVisible);
34 | bool GetVisibleTag();
35 | void SetItemText(LPCTSTR pstrValue);
36 | CDuiString GetItemText();
37 | void CheckBoxSelected(bool _Selected);
38 | bool IsCheckBoxSelected() const;
39 | bool IsHasChild() const;
40 | long GetTreeLevel() const;
41 | bool AddChildNode(CTreeNodeUI* _pTreeNodeUI);
42 | bool RemoveAt(CTreeNodeUI* _pTreeNodeUI);
43 | void SetParentNode(CTreeNodeUI* _pParentTreeNode);
44 | CTreeNodeUI* GetParentNode();
45 | long GetCountChild();
46 | void SetTreeView(CTreeViewUI* _CTreeViewUI);
47 | CTreeViewUI* GetTreeView();
48 | CTreeNodeUI* GetChildNode(int _nIndex);
49 | void SetVisibleFolderBtn(bool _IsVisibled);
50 | bool GetVisibleFolderBtn();
51 | void SetVisibleCheckBtn(bool _IsVisibled);
52 | bool GetVisibleCheckBtn();
53 | void SetItemTextColor(DWORD _dwItemTextColor);
54 | DWORD GetItemTextColor() const;
55 | void SetItemHotTextColor(DWORD _dwItemHotTextColor);
56 | DWORD GetItemHotTextColor() const;
57 | void SetSelItemTextColor(DWORD _dwSelItemTextColor);
58 | DWORD GetSelItemTextColor() const;
59 | void SetSelItemHotTextColor(DWORD _dwSelHotItemTextColor);
60 | DWORD GetSelItemHotTextColor() const;
61 |
62 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
63 |
64 | CStdPtrArray GetTreeNodes();
65 |
66 | int GetTreeIndex();
67 | int GetNodeIndex();
68 |
69 | private:
70 | CTreeNodeUI* GetLastNode();
71 | CTreeNodeUI* CalLocation(CTreeNodeUI* _pTreeNodeUI);
72 | public:
73 | CHorizontalLayoutUI* GetTreeNodeHoriznotal() const {return pHoriz;};
74 | CCheckBoxUI* GetFolderButton() const {return pFolderButton;};
75 | CLabelUI* GetDottedLine() const {return pDottedLine;};
76 | CCheckBoxUI* GetCheckBox() const {return pCheckBox;};
77 | COptionUI* GetItemButton() const {return pItemButton;};
78 |
79 | private:
80 | long m_iTreeLavel;
81 | bool m_bIsVisable;
82 | bool m_bIsCheckBox;
83 | DWORD m_dwItemTextColor;
84 | DWORD m_dwItemHotTextColor;
85 | DWORD m_dwSelItemTextColor;
86 | DWORD m_dwSelItemHotTextColor;
87 |
88 | CTreeViewUI* pTreeView;
89 | CHorizontalLayoutUI* pHoriz;
90 | CCheckBoxUI* pFolderButton;
91 | CLabelUI* pDottedLine;
92 | CCheckBoxUI* pCheckBox;
93 | COptionUI* pItemButton;
94 |
95 | CTreeNodeUI* pParentTreeNode;
96 |
97 | CStdPtrArray mTreeNodes;
98 | };
99 |
100 | class UILIB_API CTreeViewUI : public CListUI,public INotifyUI
101 | {
102 | public:
103 | CTreeViewUI(void);
104 | ~CTreeViewUI(void);
105 |
106 | public:
107 | virtual LPCTSTR GetClass() const;
108 | virtual LPVOID GetInterface(LPCTSTR pstrName);
109 | virtual bool Add(CTreeNodeUI* pControl );
110 | virtual long AddAt(CTreeNodeUI* pControl, int iIndex );
111 | virtual bool AddAt(CTreeNodeUI* pControl,CTreeNodeUI* _IndexNode);
112 | virtual bool Remove(CTreeNodeUI* pControl);
113 | virtual bool RemoveAt(int iIndex);
114 | virtual void RemoveAll();
115 | virtual bool OnCheckBoxChanged(void* param);
116 | virtual bool OnFolderChanged(void* param);
117 | virtual bool OnDBClickItem(void* param);
118 | virtual bool SetItemCheckBox(bool _Selected,CTreeNodeUI* _TreeNode = NULL);
119 | virtual void SetItemExpand(bool _Expanded,CTreeNodeUI* _TreeNode = NULL);
120 | virtual void Notify(TNotifyUI& msg);
121 | virtual void SetVisibleFolderBtn(bool _IsVisibled);
122 | virtual bool GetVisibleFolderBtn();
123 | virtual void SetVisibleCheckBtn(bool _IsVisibled);
124 | virtual bool GetVisibleCheckBtn();
125 | virtual void SetItemMinWidth(UINT _ItemMinWidth);
126 | virtual UINT GetItemMinWidth();
127 | virtual void SetItemTextColor(DWORD _dwItemTextColor);
128 | virtual void SetItemHotTextColor(DWORD _dwItemHotTextColor);
129 | virtual void SetSelItemTextColor(DWORD _dwSelItemTextColor);
130 | virtual void SetSelItemHotTextColor(DWORD _dwSelHotItemTextColor);
131 |
132 | virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
133 | private:
134 | UINT m_uItemMinWidth;
135 | bool m_bVisibleFolderBtn;
136 | bool m_bVisibleCheckBtn;
137 | };
138 | }
139 |
140 |
141 | #endif // UITreeView_h__
142 |
--------------------------------------------------------------------------------
/src/duilib/Control/UIWebBrowser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIWebBrowser.cpp
--------------------------------------------------------------------------------
/src/duilib/Control/UIWebBrowser.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Control/UIWebBrowser.h
--------------------------------------------------------------------------------
/src/duilib/Core/UIBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIBase.cpp
--------------------------------------------------------------------------------
/src/duilib/Core/UIBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIBase.h
--------------------------------------------------------------------------------
/src/duilib/Core/UIContainer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIContainer.cpp
--------------------------------------------------------------------------------
/src/duilib/Core/UIContainer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIContainer.h
--------------------------------------------------------------------------------
/src/duilib/Core/UIControl.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIControl.cpp
--------------------------------------------------------------------------------
/src/duilib/Core/UIControl.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIControl.h
--------------------------------------------------------------------------------
/src/duilib/Core/UIDefine.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIDefine.h
--------------------------------------------------------------------------------
/src/duilib/Core/UIDlgBuilder.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIDlgBuilder.cpp
--------------------------------------------------------------------------------
/src/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 UILIB_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 |
--------------------------------------------------------------------------------
/src/duilib/Core/UIManager.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIManager.cpp
--------------------------------------------------------------------------------
/src/duilib/Core/UIMarkup.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIMarkup.cpp
--------------------------------------------------------------------------------
/src/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 UILIB_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 UILIB_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 |
--------------------------------------------------------------------------------
/src/duilib/Core/UIRender.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIRender.cpp
--------------------------------------------------------------------------------
/src/duilib/Core/UIRender.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Core/UIRender.h
--------------------------------------------------------------------------------
/src/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 _T("ChildLayoutUI");
55 | }
56 | } // namespace DuiLib
57 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UIChildLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UICHILDLAYOUT_H__
2 | #define __UICHILDLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UIHorizontalLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIHORIZONTALLAYOUT_H__
2 | #define __UIHORIZONTALLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 ptLastMouse;
33 | RECT m_rcNewPos;
34 | bool m_bImmMode;
35 | };
36 | }
37 | #endif // __UIHORIZONTALLAYOUT_H__
38 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UITabLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UITabLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTabLayoutUI::CTabLayoutUI() : m_iCurSel(-1)
7 | {
8 | }
9 |
10 | LPCTSTR CTabLayoutUI::GetClass() const
11 | {
12 | return _T("TabLayoutUI");
13 | }
14 |
15 | LPVOID CTabLayoutUI::GetInterface(LPCTSTR pstrName)
16 | {
17 | if( _tcscmp(pstrName, DUI_CTR_TABLAYOUT) == 0 ) return static_cast(this);
18 | return CContainerUI::GetInterface(pstrName);
19 | }
20 |
21 | bool CTabLayoutUI::Add(CControlUI* pControl)
22 | {
23 | bool ret = CContainerUI::Add(pControl);
24 | if( !ret ) return ret;
25 |
26 | if(m_iCurSel == -1 && pControl->IsVisible())
27 | {
28 | m_iCurSel = GetItemIndex(pControl);
29 | }
30 | else
31 | {
32 | pControl->SetVisible(false);
33 | }
34 |
35 | return ret;
36 | }
37 |
38 | bool CTabLayoutUI::AddAt(CControlUI* pControl, int iIndex)
39 | {
40 | bool ret = CContainerUI::AddAt(pControl, iIndex);
41 | if( !ret ) return ret;
42 |
43 | if(m_iCurSel == -1 && pControl->IsVisible())
44 | {
45 | m_iCurSel = GetItemIndex(pControl);
46 | }
47 | else if( m_iCurSel != -1 && iIndex <= m_iCurSel )
48 | {
49 | m_iCurSel += 1;
50 | }
51 | else
52 | {
53 | pControl->SetVisible(false);
54 | }
55 |
56 | return ret;
57 | }
58 |
59 | bool CTabLayoutUI::Remove(CControlUI* pControl)
60 | {
61 | if( pControl == NULL) return false;
62 |
63 | int index = GetItemIndex(pControl);
64 | bool ret = CContainerUI::Remove(pControl);
65 | if( !ret ) return false;
66 |
67 | if( m_iCurSel == index)
68 | {
69 | if( GetCount() > 0 )
70 | {
71 | m_iCurSel=0;
72 | GetItemAt(m_iCurSel)->SetVisible(true);
73 | }
74 | else
75 | m_iCurSel=-1;
76 | NeedParentUpdate();
77 | }
78 | else if( m_iCurSel > index )
79 | {
80 | m_iCurSel -= 1;
81 | }
82 |
83 | return ret;
84 | }
85 |
86 | void CTabLayoutUI::RemoveAll()
87 | {
88 | m_iCurSel = -1;
89 | CContainerUI::RemoveAll();
90 | NeedParentUpdate();
91 | }
92 |
93 | int CTabLayoutUI::GetCurSel() const
94 | {
95 | return m_iCurSel;
96 | }
97 |
98 | bool CTabLayoutUI::SelectItem(int iIndex)
99 | {
100 | if( iIndex < 0 || iIndex >= m_items.GetSize() ) return false;
101 | if( iIndex == m_iCurSel ) return true;
102 |
103 | int iOldSel = m_iCurSel;
104 | m_iCurSel = iIndex;
105 | for( int it = 0; it < m_items.GetSize(); it++ )
106 | {
107 | if( it == iIndex ) {
108 | GetItemAt(it)->SetVisible(true);
109 | GetItemAt(it)->SetFocus();
110 | }
111 | else GetItemAt(it)->SetVisible(false);
112 | }
113 | NeedParentUpdate();
114 |
115 | if( m_pManager != NULL ) {
116 | m_pManager->SetNextTabControl();
117 | m_pManager->SendNotify(this, DUI_MSGTYPE_TABSELECT, m_iCurSel, iOldSel);
118 | }
119 | return true;
120 | }
121 |
122 | bool CTabLayoutUI::SelectItem( CControlUI* pControl )
123 | {
124 | int iIndex=GetItemIndex(pControl);
125 | if (iIndex==-1)
126 | return false;
127 | else
128 | return SelectItem(iIndex);
129 | }
130 |
131 | void CTabLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
132 | {
133 | if( _tcscmp(pstrName, _T("selectedid")) == 0 ) SelectItem(_ttoi(pstrValue));
134 | return CContainerUI::SetAttribute(pstrName, pstrValue);
135 | }
136 |
137 | void CTabLayoutUI::SetPos(RECT rc, bool bNeedInvalidate)
138 | {
139 | CControlUI::SetPos(rc, bNeedInvalidate);
140 | rc = m_rcItem;
141 |
142 | // Adjust for inset
143 | rc.left += m_rcInset.left;
144 | rc.top += m_rcInset.top;
145 | rc.right -= m_rcInset.right;
146 | rc.bottom -= m_rcInset.bottom;
147 |
148 | for( int it = 0; it < m_items.GetSize(); it++ ) {
149 | CControlUI* pControl = static_cast(m_items[it]);
150 | if( !pControl->IsVisible() ) continue;
151 | if( pControl->IsFloat() ) {
152 | SetFloatPos(it);
153 | continue;
154 | }
155 |
156 | if( it != m_iCurSel ) continue;
157 |
158 | RECT rcPadding = pControl->GetPadding();
159 | rc.left += rcPadding.left;
160 | rc.top += rcPadding.top;
161 | rc.right -= rcPadding.right;
162 | rc.bottom -= rcPadding.bottom;
163 |
164 | SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top };
165 |
166 | SIZE sz = pControl->EstimateSize(szAvailable);
167 | if( sz.cx == 0 ) {
168 | sz.cx = MAX(0, szAvailable.cx);
169 | }
170 | if( sz.cx < pControl->GetMinWidth() ) sz.cx = pControl->GetMinWidth();
171 | if( sz.cx > pControl->GetMaxWidth() ) sz.cx = pControl->GetMaxWidth();
172 |
173 | if(sz.cy == 0) {
174 | sz.cy = MAX(0, szAvailable.cy);
175 | }
176 | if( sz.cy < pControl->GetMinHeight() ) sz.cy = pControl->GetMinHeight();
177 | if( sz.cy > pControl->GetMaxHeight() ) sz.cy = pControl->GetMaxHeight();
178 |
179 | RECT rcCtrl = { rc.left, rc.top, rc.left + sz.cx, rc.top + sz.cy};
180 | pControl->SetPos(rcCtrl, false);
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UITabLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITABLAYOUT_H__
2 | #define __UITABLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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);
19 | void RemoveAll();
20 | int GetCurSel() const;
21 | bool SelectItem(int iIndex);
22 | bool SelectItem(CControlUI* pControl);
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 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UITileLayout.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "UITileLayout.h"
3 |
4 | namespace DuiLib
5 | {
6 | CTileLayoutUI::CTileLayoutUI() : m_nColumns(1)
7 | {
8 | m_szItem.cx = m_szItem.cy = 0;
9 | }
10 |
11 | LPCTSTR CTileLayoutUI::GetClass() const
12 | {
13 | return _T("TileLayoutUI");
14 | }
15 |
16 | LPVOID CTileLayoutUI::GetInterface(LPCTSTR pstrName)
17 | {
18 | if( _tcscmp(pstrName, DUI_CTR_TILELAYOUT) == 0 ) return static_cast(this);
19 | return CContainerUI::GetInterface(pstrName);
20 | }
21 |
22 | SIZE CTileLayoutUI::GetItemSize() const
23 | {
24 | return m_szItem;
25 | }
26 |
27 | void CTileLayoutUI::SetItemSize(SIZE szItem)
28 | {
29 | if( m_szItem.cx != szItem.cx || m_szItem.cy != szItem.cy ) {
30 | m_szItem = szItem;
31 | NeedUpdate();
32 | }
33 | }
34 |
35 | int CTileLayoutUI::GetColumns() const
36 | {
37 | return m_nColumns;
38 | }
39 |
40 | void CTileLayoutUI::SetColumns(int nCols)
41 | {
42 | if( nCols <= 0 ) return;
43 | m_nColumns = nCols;
44 | NeedUpdate();
45 | }
46 |
47 | void CTileLayoutUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
48 | {
49 | if( _tcscmp(pstrName, _T("itemsize")) == 0 ) {
50 | SIZE szItem = { 0 };
51 | LPTSTR pstr = NULL;
52 | szItem.cx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
53 | szItem.cy = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
54 | SetItemSize(szItem);
55 | }
56 | else if( _tcscmp(pstrName, _T("columns")) == 0 ) SetColumns(_ttoi(pstrValue));
57 | else CContainerUI::SetAttribute(pstrName, pstrValue);
58 | }
59 |
60 | void CTileLayoutUI::SetPos(RECT rc, bool bNeedInvalidate)
61 | {
62 | CControlUI::SetPos(rc, bNeedInvalidate);
63 | rc = m_rcItem;
64 |
65 | // Adjust for inset
66 | rc.left += m_rcInset.left;
67 | rc.top += m_rcInset.top;
68 | rc.right -= m_rcInset.right;
69 | rc.bottom -= m_rcInset.bottom;
70 |
71 | if( m_items.GetSize() == 0) {
72 | ProcessScrollBar(rc, 0, 0);
73 | return;
74 | }
75 |
76 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) rc.right -= m_pVerticalScrollBar->GetFixedWidth();
77 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
78 |
79 | // Position the elements
80 | if( m_szItem.cx > 0 ) m_nColumns = (rc.right - rc.left) / m_szItem.cx;
81 | if( m_nColumns == 0 ) m_nColumns = 1;
82 |
83 | int cyNeeded = 0;
84 | int cxWidth = (rc.right - rc.left) / m_nColumns;
85 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
86 | cxWidth = (rc.right - rc.left + m_pHorizontalScrollBar->GetScrollRange() ) / m_nColumns; ;
87 |
88 | int cyHeight = 0;
89 | int iCount = 0;
90 | POINT ptTile = { rc.left, rc.top };
91 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) {
92 | ptTile.y -= m_pVerticalScrollBar->GetScrollPos();
93 | }
94 | int iPosX = rc.left;
95 | if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() ) {
96 | iPosX -= m_pHorizontalScrollBar->GetScrollPos();
97 | ptTile.x = iPosX;
98 | }
99 | for( int it1 = 0; it1 < m_items.GetSize(); it1++ ) {
100 | CControlUI* pControl = static_cast(m_items[it1]);
101 | if( !pControl->IsVisible() ) continue;
102 | if( pControl->IsFloat() ) {
103 | SetFloatPos(it1);
104 | continue;
105 | }
106 |
107 | // Determine size
108 | RECT rcTile = { ptTile.x, ptTile.y, ptTile.x + cxWidth, ptTile.y };
109 | if( (iCount % m_nColumns) == 0 )
110 | {
111 | int iIndex = iCount;
112 | for( int it2 = it1; it2 < m_items.GetSize(); it2++ ) {
113 | CControlUI* pLineControl = static_cast(m_items[it2]);
114 | if( !pLineControl->IsVisible() ) continue;
115 | if( pLineControl->IsFloat() ) continue;
116 |
117 | RECT rcPadding = pLineControl->GetPadding();
118 | SIZE szAvailable = { rcTile.right - rcTile.left - rcPadding.left - rcPadding.right, 9999 };
119 | if( iIndex == iCount || (iIndex + 1) % m_nColumns == 0 ) {
120 | szAvailable.cx -= m_iChildPadding / 2;
121 | }
122 | else {
123 | szAvailable.cx -= m_iChildPadding;
124 | }
125 |
126 | if( szAvailable.cx < pControl->GetMinWidth() ) szAvailable.cx = pControl->GetMinWidth();
127 | if( szAvailable.cx > pControl->GetMaxWidth() ) szAvailable.cx = pControl->GetMaxWidth();
128 |
129 | SIZE szTile = pLineControl->EstimateSize(szAvailable);
130 | if( szTile.cx < pControl->GetMinWidth() ) szTile.cx = pControl->GetMinWidth();
131 | if( szTile.cx > pControl->GetMaxWidth() ) szTile.cx = pControl->GetMaxWidth();
132 | if( szTile.cy < pControl->GetMinHeight() ) szTile.cy = pControl->GetMinHeight();
133 | if( szTile.cy > pControl->GetMaxHeight() ) szTile.cy = pControl->GetMaxHeight();
134 |
135 | cyHeight = MAX(cyHeight, szTile.cy + rcPadding.top + rcPadding.bottom);
136 | if( (++iIndex % m_nColumns) == 0) break;
137 | }
138 | }
139 |
140 | RECT rcPadding = pControl->GetPadding();
141 |
142 | rcTile.left += rcPadding.left + m_iChildPadding / 2;
143 | rcTile.right -= rcPadding.right + m_iChildPadding / 2;
144 | if( (iCount % m_nColumns) == 0 ) {
145 | rcTile.left -= m_iChildPadding / 2;
146 | }
147 |
148 | if( ( (iCount + 1) % m_nColumns) == 0 ) {
149 | rcTile.right += m_iChildPadding / 2;
150 | }
151 |
152 | // Set position
153 | rcTile.top = ptTile.y + rcPadding.top;
154 | rcTile.bottom = ptTile.y + cyHeight;
155 |
156 | SIZE szAvailable = { rcTile.right - rcTile.left, rcTile.bottom - rcTile.top };
157 | SIZE szTile = pControl->EstimateSize(szAvailable);
158 | if( szTile.cx == 0 ) szTile.cx = szAvailable.cx;
159 | if( szTile.cy == 0 ) szTile.cy = szAvailable.cy;
160 | if( szTile.cx < pControl->GetMinWidth() ) szTile.cx = pControl->GetMinWidth();
161 | if( szTile.cx > pControl->GetMaxWidth() ) szTile.cx = pControl->GetMaxWidth();
162 | if( szTile.cy < pControl->GetMinHeight() ) szTile.cy = pControl->GetMinHeight();
163 | if( szTile.cy > pControl->GetMaxHeight() ) szTile.cy = pControl->GetMaxHeight();
164 | RECT rcPos = {(rcTile.left + rcTile.right - szTile.cx) / 2, (rcTile.top + rcTile.bottom - szTile.cy) / 2,
165 | (rcTile.left + rcTile.right - szTile.cx) / 2 + szTile.cx, (rcTile.top + rcTile.bottom - szTile.cy) / 2 + szTile.cy};
166 | pControl->SetPos(rcPos, false);
167 |
168 | if( (++iCount % m_nColumns) == 0 ) {
169 | ptTile.x = iPosX;
170 | ptTile.y += cyHeight + m_iChildPadding;
171 | cyHeight = 0;
172 | }
173 | else {
174 | ptTile.x += cxWidth;
175 | }
176 | cyNeeded = rcTile.bottom - rc.top;
177 | if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() ) cyNeeded += m_pVerticalScrollBar->GetScrollPos();
178 | }
179 |
180 | // Process the scrollbar
181 | ProcessScrollBar(rc, 0, cyNeeded);
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UITileLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UITILELAYOUT_H__
2 | #define __UITILELAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 | SIZE GetItemSize() const;
19 | void SetItemSize(SIZE szItem);
20 | int GetColumns() const;
21 | void SetColumns(int nCols);
22 |
23 | void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
24 |
25 | protected:
26 | SIZE m_szItem;
27 | int m_nColumns;
28 | };
29 | }
30 | #endif // __UITILELAYOUT_H__
31 |
--------------------------------------------------------------------------------
/src/duilib/Layout/UIVerticalLayout.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIVERTICALLAYOUT_H__
2 | #define __UIVERTICALLAYOUT_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib
7 | {
8 | class UILIB_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 ptLastMouse;
33 | RECT m_rcNewPos;
34 | bool m_bImmMode;
35 | };
36 | }
37 | #endif // __UIVERTICALLAYOUT_H__
38 |
--------------------------------------------------------------------------------
/src/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 |
--------------------------------------------------------------------------------
/src/duilib/StdAfx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/StdAfx.h
--------------------------------------------------------------------------------
/src/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 |
54 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID /*lpReserved*/)
55 | {
56 | switch( dwReason ) {
57 | case DLL_PROCESS_ATTACH:
58 | case DLL_THREAD_ATTACH:
59 | case DLL_THREAD_DETACH:
60 | case DLL_PROCESS_DETACH:
61 | ::DisableThreadLibraryCalls((HMODULE)hModule);
62 | break;
63 | }
64 | return TRUE;
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/src/duilib/UIlib.h:
--------------------------------------------------------------------------------
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 | #ifdef UILIB_STATIC
31 | # define UILIB_API
32 | #else
33 | # if defined(UILIB_EXPORTS)
34 | # if defined(_MSC_VER)
35 | # define UILIB_API __declspec(dllexport)
36 | # else
37 | # define UILIB_API
38 | # endif
39 | # else
40 | # if defined(_MSC_VER)
41 | # define UILIB_API __declspec(dllimport)
42 | # else
43 | # define UILIB_API
44 | # endif
45 | # endif
46 | #endif
47 |
48 | #define UILIB_COMDAT __declspec(selectany)
49 |
50 | #if defined _M_IX86
51 | # pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
52 | #elif defined _M_IA64
53 | # pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
54 | #elif defined _M_X64
55 | # pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
56 | #else
57 | # pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
58 | #endif
59 |
60 | #include
61 | #include
62 | #include
63 | #include
64 | #include
65 | #include
66 | #include
67 | #include
68 | #include
69 |
70 | #include "Utils/Utils.h"
71 | #include "Utils/UIDelegate.h"
72 | #include "Core/UIDefine.h"
73 | #include "Core/UIManager.h"
74 | #include "Core/UIBase.h"
75 | #include "Core/UIControl.h"
76 | #include "Core/UIContainer.h"
77 | #include "Core/UIMarkup.h"
78 | #include "Core/UIDlgBuilder.h"
79 | #include "Core/UIRender.h"
80 | #include "Utils/WinImplBase.h"
81 |
82 | #include "Layout/UIVerticalLayout.h"
83 | #include "Layout/UIHorizontalLayout.h"
84 | #include "Layout/UITileLayout.h"
85 | #include "Layout/UITabLayout.h"
86 | #include "Layout/UIChildLayout.h"
87 |
88 | #include "Control/UIList.h"
89 | #include "Control/UICombo.h"
90 | #include "Control/UIScrollBar.h"
91 | #include "Control/UITreeView.h"
92 |
93 | #include "Control/UILabel.h"
94 | #include "Control/UIText.h"
95 | #include "Control/UIEdit.h"
96 |
97 | #include "Control/UIButton.h"
98 | #include "Control/UIOption.h"
99 | #include "Control/UICheckBox.h"
100 |
101 | #include "Control/UIProgress.h"
102 | #include "Control/UISlider.h"
103 |
104 | #include "Control/UIRichEdit.h"
105 | #include "Control/UIDateTime.h"
106 |
107 | #include "Control/UIActiveX.h"
108 | #include "Control/UIWebBrowser.h"
109 | //#include "Control/UIFlash.h"
110 |
111 |
--------------------------------------------------------------------------------
/src/duilib/Utils/FlashEventHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Utils/FlashEventHandler.h
--------------------------------------------------------------------------------
/src/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 |
--------------------------------------------------------------------------------
/src/duilib/Utils/UIDelegate.h:
--------------------------------------------------------------------------------
1 | #ifndef __UIDELEGATE_H__
2 | #define __UIDELEGATE_H__
3 |
4 | #pragma once
5 |
6 | namespace DuiLib {
7 |
8 | class UILIB_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, &pFn), m_pFn(pFn) { }
50 | CDelegate(const CDelegate& rhs) : CDelegateBase(rhs) { m_pFn = rhs.m_pFn; }
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 | return (pObject->*m_pFn)(param);
58 | }
59 |
60 | private:
61 | Fn m_pFn;
62 | };
63 |
64 | template
65 | CDelegate MakeDelegate(O* pObject, bool (T::* pFn)(void*))
66 | {
67 | return CDelegate(pObject, pFn);
68 | }
69 |
70 | inline CDelegateStatic MakeDelegate(bool (*pFn)(void*))
71 | {
72 | return CDelegateStatic(pFn);
73 | }
74 |
75 | class UILIB_API CEventSource
76 | {
77 | typedef bool (*FnType)(void*);
78 | public:
79 | ~CEventSource();
80 | operator bool();
81 | void operator+= (const CDelegateBase& d); // add const for gcc
82 | void operator+= (FnType pFn);
83 | void operator-= (const CDelegateBase& d);
84 | void operator-= (FnType pFn);
85 | bool operator() (void* param);
86 |
87 | protected:
88 | CStdPtrArray m_aDelegates;
89 | };
90 |
91 | } // namespace DuiLib
92 |
93 | #endif // __UIDELEGATE_H__
--------------------------------------------------------------------------------
/src/duilib/Utils/Utils.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Utils/Utils.cpp
--------------------------------------------------------------------------------
/src/duilib/Utils/WebBrowserEventHandler.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Utils/WebBrowserEventHandler.h
--------------------------------------------------------------------------------
/src/duilib/Utils/WinImplBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Utils/WinImplBase.cpp
--------------------------------------------------------------------------------
/src/duilib/Utils/WinImplBase.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeppeter/nsduilib/93f318d3e2e133fcfa8174d666c798367d7dbd63/src/duilib/Utils/WinImplBase.h
--------------------------------------------------------------------------------
/src/duilib/makefile.win:
--------------------------------------------------------------------------------
1 | CURDIR=$(MAKEDIR)
2 | TOPDIR=$(CURDIR)\..\..
3 | BASENAME=duilib
4 |
5 |
6 |
7 | !IFDEF UNICODE_MODE
8 | !IF $(UNICODE_MODE) != 0
9 | UNICODE_CFLAGS=/D UNICODE /D _UNICODE
10 | !ELSE
11 | UNICODE_CFLAGS=
12 | !ENDIF
13 | !ELSE
14 | UNICODE_CFLAGS=
15 | !ENDIF
16 |
17 | !IFDEF MAKEVERBOSE
18 | !IF $(MAKEVERBOSE) != 0
19 |
20 | QUIETCMD=
21 | NOLOGO_CFLAGS=
22 | NOLOGO_LDFLAGS=
23 | NOLOGO_ARFLAGS=
24 | VERBOSE_SOURCES=
25 | NOLOGO_MAKEFLAGS=
26 |
27 | !ELSE
28 |
29 | QUIETCMD=@
30 | NOLOGO_CFLAGS=/nologo
31 | NOLOGO_LDFLAGS=/nologo
32 | NOLOGO_ARFLAGS=/nologo
33 | VERBOSE_SOURCES=
34 | NOLOGO_MAKEFLAGS=/nologo
35 |
36 | !ENDIF
37 |
38 | !ELSE
39 | QUIETCMD=@
40 | NOLOGO_CFLAGS=/nologo
41 | NOLOGO_LDFLAGS=/nologo
42 | NOLOGO_ARFLAGS=/nologo
43 | VERBOSE_SOURCES=
44 | NOLOGO_MAKEFLAGS=/nologo
45 |
46 | !ENDIF
47 |
48 | !IF "$(INST_ARCH)" == "x64"
49 | ARCH_LIBFLAGS=/MACHINE:X64
50 | !ELSE
51 | ARCH_LIBFLAGS=/MACHINE:X86
52 | !ENDIF
53 |
54 |
55 |
56 | CC=cl.exe
57 | LIBEXE=lib.exe
58 |
59 | INCLUDE_CFLAGS=/I$(TOPDIR)\clibs\winlib /I$(MAKEDIR)
60 | PRE_CFLAGS=/c $(INCLUDE_CFLAGS) $(NOLOGO_CFLAGS) /W3 /WX- /O2 /Ob2 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG $(UNICODE_CFLAGS) /D UILIB_STATIC /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR
61 |
62 | POST_CFLAGS=/Fd"$(CURDIR)\$(BASENAME).pdb" /Gd /TP
63 |
64 |
65 |
66 | DUILIB_FLAGS=$(NOLOGO_LDFLAGS) $(ARCH_LIBFLAGS)
67 | DUILIB_CPP_SOURCES = $(CURDIR)\Control\UIActiveX.cpp $(CURDIR)\Control\UIButton.cpp $(CURDIR)\Control\UICheckBox.cpp \
68 | $(CURDIR)\Control\UICombo.cpp $(CURDIR)\Control\UIDateTime.cpp $(CURDIR)\Control\UIEdit.cpp $(CURDIR)\Control\UIFlash.cpp \
69 | $(CURDIR)\Control\UILabel.cpp $(CURDIR)\Control\UIList.cpp $(CURDIR)\Control\UIOption.cpp $(CURDIR)\Control\UIProgress.cpp \
70 | $(CURDIR)\Control\UIRichEdit.cpp $(CURDIR)\Control\UIScrollBar.cpp $(CURDIR)\Control\UISlider.cpp \
71 | $(CURDIR)\Control\UIText.cpp $(CURDIR)\Control\UITreeView.cpp $(CURDIR)\Control\UIWebBrowser.cpp $(CURDIR)\Core\UIBase.cpp \
72 | $(CURDIR)\Core\UIContainer.cpp $(CURDIR)\Core\UIControl.cpp $(CURDIR)\Core\UIDlgBuilder.cpp $(CURDIR)\Core\UIManager.cpp \
73 | $(CURDIR)\Core\UIMarkup.cpp $(CURDIR)\Core\UIRender.cpp $(CURDIR)\Layout\UIChildLayout.cpp \
74 | $(CURDIR)\Layout\UIHorizontalLayout.cpp $(CURDIR)\Layout\UITabLayout.cpp $(CURDIR)\Layout\UITileLayout.cpp \
75 | $(CURDIR)\Layout\UIVerticalLayout.cpp $(CURDIR)\Utils\UIDelegate.cpp $(CURDIR)\Utils\Utils.cpp \
76 | $(CURDIR)\Utils\WinImplBase.cpp
77 | DUILIB_C_SOURCES =
78 |
79 | DUILIB_CPP_OBJECTS = $(DUILIB_CPP_SOURCES:.cpp=.obj)
80 | DUILIB_C_OBJECTS = $(DUILIB_C_SOURCES:.c=.obj)
81 | DUILIB_OBJECTS = $(DUILIB_CPP_OBJECTS) $(DUILIB_C_OBJECTS)
82 |
83 |
84 | all:$(CURDIR)\$(BASENAME).lib
85 |
86 | $(CURDIR)\$(BASENAME).lib: header_files $(TOPDIR)\clibs $(DUILIB_OBJECTS) compiles_cc
87 | $(QUIETCMD)$(LIBEXE) /OUT:"$(CURDIR)\$(BASENAME).lib" $(DUILIB_FLAGS) $(DUILIB_OBJECTS) $(CURDIR)\Utils\XUnzip.obj $(CURDIR)\Utils\stb_image.obj $(CURDIR)\stdafx.obj
88 |
89 |
90 | header_files:
91 | $(QUIETCMD)$(CC) $(PRE_CFLAGS) /Yc"stdafx.h" /Fp$(CURDIR)\$(BASENAME).pch /Fo$(CURDIR)\stdafx.obj $(POST_CFLAGS) $(CURDIR)\stdafx.cpp
92 |
93 | compiles_cc:
94 | $(QUIETCMD)$(CC) $(PRE_CFLAGS) /Fo"$(CURDIR)\Utils\XUnzip.obj" $(POST_CFLAGS) $(CURDIR)\Utils\XUnzip.cpp
95 | $(QUIETCMD)$(CC) $(PRE_CFLAGS) /Fo"$(CURDIR)\Utils\stb_image.obj" /Fd"$(CURDIR)\$(BASENAME).pdb" /Gd /TC $(CURDIR)\Utils\stb_image.c
96 |
97 | .cpp.obj:
98 | $(QUIETCMD)$(CC) $(PRE_CFLAGS) /Yu"stdafx.h" /Fp$(CURDIR)\$(BASENAME).pch /Fo"$@" $(POST_CFLAGS) $*.cpp
99 |
100 | $(TOPDIR)\clibs:
101 | $(QUIETCMD)pushd $(MAKEDIR) && cd $(TOPDIR) && git clone https://github.com/jeppeter/clibs.git && popd
102 |
103 | clean:
104 | $(QUIETCMD)del $(DUILIB_OBJECTS) 2>NUL >NUL || echo "" >NUL
105 | $(QUIETCMD)del $(CURDIR)\$(BASENAME).lib $(CURDIR)\$(BASENAME).pdb 2>NUL >NUL || echo "" >NUL
106 | $(QUIETCMD)del $(CURDIR)\Utils\stb_image.obj $(CURDIR)\Utils\XUnzip.obj 2>NUL >NUL || echo "" >NUL
107 | $(QUIETCMD)del $(CURDIR)\$(BASENAME).pch $(CURDIR)\stdafx.obj 2>NUL >NUL || echo "" >NUL
--------------------------------------------------------------------------------
/src/fakewinlib/CMakelists.txt:
--------------------------------------------------------------------------------
1 | set(CMAKE_BUILD_TYPE Release)
2 |
3 | file(GLOB WINLIB_SRCS "win_*.cpp")
4 | add_library(winlib STATIC ${WINLIB_SRCS})
5 |
6 | target_include_directories(winlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7 |
8 | ChangeStaticRuntimeLib()
9 |
10 |
--------------------------------------------------------------------------------
/src/nsduilib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #project(nsduilib)
2 | set(CMAKE_BUILD_TYPE Release)
3 |
4 | set(CMAKE_MFC_FLAG 1)
5 | add_definitions(/DUILIB_STATIC /DNSDUILIB_EXPORTS)
6 | add_library(nsduilib SHARED dllmain.cpp nsduilib.cpp pluginapi.c SkinEngine.cpp StdAfx.cpp)
7 |
8 | target_include_directories(nsduilib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../clibs/winlib
9 | ${CMAKE_CURRENT_SOURCE_DIR}/../duilib)
10 | target_link_libraries(nsduilib duilib Shlwapi winlib)
11 |
12 | ChangeStaticRuntimeLib()
--------------------------------------------------------------------------------
/src/nsduilib/MsgDef.h:
--------------------------------------------------------------------------------
1 | #ifndef MSGDEF_H
2 | #define MSGDEF_H
3 | #pragma once
4 |
5 | #include
6 |
7 | #define WM_TBCIAMIN WM_USER + 888
8 | #define WM_TBCIACLOSE WM_USER + 889
9 | #define WM_TBCIABACK WM_USER + 890
10 | #define WM_TBCIANEXT WM_USER + 891
11 | #define WM_TBCIACANCEL WM_USER + 892
12 | #define WM_TBCIASTARTINSTALL WM_USER + 893
13 | #define WM_TBCIASTATE WM_USER + 894
14 | #define WM_TBCIAFINISHEDINSTALL WM_USER + 895
15 | #define WM_TBCIAOPENURL WM_USER + 896
16 | #define WM_TBCIASTARTUNINSTALL WM_USER + 897
17 |
18 | #endif
--------------------------------------------------------------------------------
/src/nsduilib/SkinEngine.h:
--------------------------------------------------------------------------------
1 | #ifndef __SKINENGINE_H__
2 | #define __SKINENGINE_H__
3 | #pragma once
4 |
5 | #include "UIlib.h"
6 | #include