nsDialogs.nsh 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. /*
  2. nsDialogs.nsh
  3. Header file for creating custom installer pages with nsDialogs
  4. */
  5. !ifndef NSDIALOGS_INCLUDED
  6. !verbose push 2
  7. !define NSDIALOGS_INCLUDED
  8. !verbose 3
  9. !include LogicLib.nsh
  10. !include WinMessages.nsh
  11. !define /ifndef WS_EX_DLGMODALFRAME 0x00000001
  12. !define /ifndef WS_EX_NOPARENTNOTIFY 0x00000004
  13. !define /ifndef WS_EX_TOPMOST 0x00000008
  14. !define /ifndef WS_EX_ACCEPTFILES 0x00000010
  15. !define /ifndef WS_EX_TRANSPARENT 0x00000020
  16. !define /ifndef WS_EX_MDICHILD 0x00000040
  17. !define /ifndef WS_EX_TOOLWINDOW 0x00000080
  18. !define /ifndef WS_EX_WINDOWEDGE 0x00000100
  19. !define /ifndef WS_EX_CLIENTEDGE 0x00000200
  20. !define /ifndef WS_EX_CONTEXTHELP 0x00000400
  21. !define /ifndef WS_EX_RIGHT 0x00001000
  22. !define /ifndef WS_EX_LEFT 0x00000000
  23. !define /ifndef WS_EX_RTLREADING 0x00002000
  24. !define /ifndef WS_EX_LTRREADING 0x00000000
  25. !define /ifndef WS_EX_LEFTSCROLLBAR 0x00004000
  26. !define /ifndef WS_EX_RIGHTSCROLLBAR 0x00000000
  27. !define /ifndef WS_EX_CONTROLPARENT 0x00010000
  28. !define /ifndef WS_EX_STATICEDGE 0x00020000
  29. !define /ifndef WS_EX_APPWINDOW 0x00040000
  30. !define /ifndef WS_CHILD 0x40000000
  31. !define /ifndef WS_VISIBLE 0x10000000
  32. !define /ifndef WS_DISABLED 0x08000000
  33. !define /ifndef WS_CLIPSIBLINGS 0x04000000
  34. !define /ifndef WS_CLIPCHILDREN 0x02000000
  35. !define /ifndef WS_MAXIMIZE 0x01000000
  36. !define /ifndef WS_VSCROLL 0x00200000
  37. !define /ifndef WS_HSCROLL 0x00100000
  38. !define /ifndef WS_GROUP 0x00020000
  39. !define /ifndef WS_TABSTOP 0x00010000
  40. !define ES_LEFT 0x00000000
  41. !define ES_CENTER 0x00000001
  42. !define ES_RIGHT 0x00000002
  43. !define ES_MULTILINE 0x00000004
  44. !define ES_UPPERCASE 0x00000008
  45. !define ES_LOWERCASE 0x00000010
  46. !define ES_PASSWORD 0x00000020
  47. !define ES_AUTOVSCROLL 0x00000040
  48. !define ES_AUTOHSCROLL 0x00000080
  49. !define ES_NOHIDESEL 0x00000100
  50. !define ES_OEMCONVERT 0x00000400
  51. !define ES_READONLY 0x00000800
  52. !define ES_WANTRETURN 0x00001000
  53. !define ES_NUMBER 0x00002000
  54. !define ES_SAVESEL 0x00008000
  55. !define SS_LEFT 0x00000000
  56. !define SS_CENTER 0x00000001
  57. !define SS_RIGHT 0x00000002
  58. !define SS_ICON 0x00000003
  59. !define SS_BLACKRECT 0x00000004
  60. !define SS_GRAYRECT 0x00000005
  61. !define SS_WHITERECT 0x00000006
  62. !define SS_BLACKFRAME 0x00000007
  63. !define SS_GRAYFRAME 0x00000008
  64. !define SS_WHITEFRAME 0x00000009
  65. !define SS_USERITEM 0x0000000A
  66. !define SS_SIMPLE 0x0000000B
  67. !define SS_LEFTNOWORDWRAP 0x0000000C
  68. !define SS_OWNERDRAW 0x0000000D
  69. !define SS_BITMAP 0x0000000E
  70. !define SS_ENHMETAFILE 0x0000000F
  71. !define SS_ETCHEDHORZ 0x00000010
  72. !define SS_ETCHEDVERT 0x00000011
  73. !define SS_ETCHEDFRAME 0x00000012
  74. !define SS_TYPEMASK 0x0000001F
  75. !define SS_REALSIZECONTROL 0x00000040
  76. !define SS_NOPREFIX 0x00000080
  77. !define SS_NOTIFY 0x00000100
  78. !define SS_CENTERIMAGE 0x00000200
  79. !define SS_RIGHTJUST 0x00000400
  80. !define SS_REALSIZEIMAGE 0x00000800
  81. !define SS_SUNKEN 0x00001000
  82. !define SS_EDITCONTROL 0x00002000
  83. !define SS_ENDELLIPSIS 0x00004000
  84. !define SS_PATHELLIPSIS 0x00008000
  85. !define SS_WORDELLIPSIS 0x0000C000
  86. !define SS_ELLIPSISMASK 0x0000C000
  87. !define BS_PUSHBUTTON 0x00000000
  88. !define BS_DEFPUSHBUTTON 0x00000001
  89. !define BS_CHECKBOX 0x00000002
  90. !define BS_AUTOCHECKBOX 0x00000003
  91. !define BS_RADIOBUTTON 0x00000004
  92. !define BS_3STATE 0x00000005
  93. !define BS_AUTO3STATE 0x00000006
  94. !define BS_GROUPBOX 0x00000007
  95. !define BS_USERBUTTON 0x00000008
  96. !define BS_AUTORADIOBUTTON 0x00000009
  97. !define BS_PUSHBOX 0x0000000A
  98. !define BS_OWNERDRAW 0x0000000B
  99. !define BS_TYPEMASK 0x0000000F
  100. !define BS_LEFTTEXT 0x00000020
  101. !define BS_TEXT 0x00000000
  102. !define BS_ICON 0x00000040
  103. !define BS_BITMAP 0x00000080
  104. !define BS_LEFT 0x00000100
  105. !define BS_RIGHT 0x00000200
  106. !define BS_CENTER 0x00000300
  107. !define BS_TOP 0x00000400
  108. !define BS_BOTTOM 0x00000800
  109. !define BS_VCENTER 0x00000C00
  110. !define BS_PUSHLIKE 0x00001000
  111. !define BS_MULTILINE 0x00002000
  112. !define BS_NOTIFY 0x00004000
  113. !define BS_FLAT 0x00008000
  114. !define BS_RIGHTBUTTON ${BS_LEFTTEXT}
  115. !define CBS_SIMPLE 0x0001
  116. !define CBS_DROPDOWN 0x0002
  117. !define CBS_DROPDOWNLIST 0x0003
  118. !define CBS_OWNERDRAWFIXED 0x0010
  119. !define CBS_OWNERDRAWVARIABLE 0x0020
  120. !define CBS_AUTOHSCROLL 0x0040
  121. !define CBS_OEMCONVERT 0x0080
  122. !define CBS_SORT 0x0100
  123. !define CBS_HASSTRINGS 0x0200
  124. !define CBS_NOINTEGRALHEIGHT 0x0400
  125. !define CBS_DISABLENOSCROLL 0x0800
  126. !define CBS_UPPERCASE 0x2000
  127. !define CBS_LOWERCASE 0x4000
  128. !define LBS_NOTIFY 0x0001
  129. !define LBS_SORT 0x0002
  130. !define LBS_NOREDRAW 0x0004
  131. !define LBS_MULTIPLESEL 0x0008
  132. !define LBS_OWNERDRAWFIXED 0x0010
  133. !define LBS_OWNERDRAWVARIABLE 0x0020
  134. !define LBS_HASSTRINGS 0x0040
  135. !define LBS_USETABSTOPS 0x0080
  136. !define LBS_NOINTEGRALHEIGHT 0x0100
  137. !define LBS_MULTICOLUMN 0x0200
  138. !define LBS_WANTKEYBOARDINPUT 0x0400
  139. !define LBS_EXTENDEDSEL 0x0800
  140. !define LBS_DISABLENOSCROLL 0x1000
  141. !define LBS_NODATA 0x2000
  142. !define LBS_NOSEL 0x4000
  143. !define LBS_COMBOBOX 0x8000
  144. !define ACS_CENTER 0x0001
  145. !define ACS_TRANSPARENT 0x0002 ; The parent of the animation control must not have the WS_CLIPCHILDREN style
  146. !define ACS_AUTOPLAY 0x0004
  147. !define ACS_TIMER 0x0008 ; < CC6
  148. !define TBS_AUTOTICKS 0x0001
  149. !define TBS_VERT 0x0002
  150. !define TBS_HORZ 0x0000
  151. !define TBS_TOP 0x0004
  152. !define TBS_BOTTOM 0x0000
  153. !define TBS_LEFT 0x0004
  154. !define TBS_RIGHT 0x0000
  155. !define TBS_BOTH 0x0008
  156. !define TBS_NOTICKS 0x0010
  157. !define TBS_ENABLESELRANGE 0x0020
  158. !define TBS_FIXEDLENGTH 0x0040
  159. !define TBS_NOTHUMB 0x0080
  160. !define TBS_TOOLTIPS 0x0100 ; IE3
  161. !define TBS_REVERSED 0x0200 ; IE5
  162. !define TBS_DOWNISLEFT 0x0400 ; _WIN32_IE >= 0x0501
  163. !define TBS_NOTIFYBEFOREMOVE 0x0800 ; IE6?
  164. !define TBS_TRANSPARENTBKGND 0x1000 ; Vista
  165. !define UDS_WRAP 0x0001
  166. !define UDS_SETBUDDYINT 0x0002
  167. !define UDS_ALIGNRIGHT 0x0004
  168. !define UDS_ALIGNLEFT 0x0008
  169. !define UDS_AUTOBUDDY 0x0010
  170. !define UDS_ARROWKEYS 0x0020
  171. !define UDS_HORZ 0x0040
  172. !define UDS_NOTHOUSANDS 0x0080
  173. !define UDS_HOTTRACK 0x0100 ; 98+
  174. !define /ifndef LR_DEFAULTCOLOR 0x0000
  175. !define /ifndef LR_MONOCHROME 0x0001
  176. !define /ifndef LR_COLOR 0x0002
  177. !define /ifndef LR_COPYRETURNORG 0x0004
  178. !define /ifndef LR_COPYDELETEORG 0x0008
  179. !define /ifndef LR_LOADFROMFILE 0x0010
  180. !define /ifndef LR_LOADTRANSPARENT 0x0020
  181. !define /ifndef LR_DEFAULTSIZE 0x0040
  182. !define /ifndef LR_VGACOLOR 0x0080
  183. !define /ifndef LR_LOADMAP3DCOLORS 0x1000
  184. !define /ifndef LR_CREATEDIBSECTION 0x2000
  185. !define /ifndef LR_COPYFROMRESOURCE 0x4000
  186. !define /ifndef LR_SHARED 0x8000
  187. !define /ifndef IMAGE_BITMAP 0
  188. !define /ifndef IMAGE_ICON 1
  189. !define /ifndef IMAGE_CURSOR 2
  190. !define /ifndef IMAGE_ENHMETAFILE 3
  191. !define /ifndef GWL_STYLE -16
  192. !define /ifndef GWL_EXSTYLE -20
  193. !define /ifndef ICC_BAR_CLASSES 0x0004
  194. !define /ifndef ICC_UPDOWN_CLASS 0x0010
  195. !define /ifndef ICC_HOTKEY_CLASS 0x0040
  196. !define /ifndef ICC_ANIMATE_CLASS 0x0080
  197. !define /ifndef ICC_DATE_CLASSES 0x0100
  198. !define /ifndef ICC_USEREX_CLASSES 0x0200
  199. !define /ifndef ICC_INTERNET_CLASSES 0x0800
  200. !define /ifndef ICC_LINK_CLASS 0x8000
  201. !define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS}
  202. !define __NSD_HLine_CLASS STATIC
  203. !define __NSD_HLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDHORZ}|${SS_SUNKEN}
  204. !define __NSD_HLine_EXSTYLE ${WS_EX_TRANSPARENT}
  205. !define __NSD_VLine_CLASS STATIC
  206. !define __NSD_VLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDVERT}|${SS_SUNKEN}
  207. !define __NSD_VLine_EXSTYLE ${WS_EX_TRANSPARENT}
  208. !define __NSD_Label_CLASS STATIC
  209. !define __NSD_Label_STYLE ${DEFAULT_STYLES}|${SS_NOTIFY}
  210. !define __NSD_Label_EXSTYLE ${WS_EX_TRANSPARENT}
  211. !define __NSD_Icon_CLASS STATIC
  212. !define __NSD_Icon_STYLE ${DEFAULT_STYLES}|${SS_ICON}|${SS_NOTIFY}
  213. !define __NSD_Icon_EXSTYLE 0
  214. !define __NSD_Bitmap_CLASS STATIC
  215. !define __NSD_Bitmap_STYLE ${DEFAULT_STYLES}|${SS_BITMAP}|${SS_NOTIFY}
  216. !define __NSD_Bitmap_EXSTYLE 0
  217. !define __NSD_BrowseButton_CLASS BUTTON
  218. !define __NSD_BrowseButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
  219. !define __NSD_BrowseButton_EXSTYLE 0
  220. !define __NSD_Link_CLASS LINK
  221. !define __NSD_Link_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_OWNERDRAW}
  222. !define __NSD_Link_EXSTYLE 0
  223. !define __NSD_Button_CLASS BUTTON
  224. !define __NSD_Button_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
  225. !define __NSD_Button_EXSTYLE 0
  226. !define __NSD_GroupBox_CLASS BUTTON
  227. !define __NSD_GroupBox_STYLE ${DEFAULT_STYLES}|${BS_GROUPBOX}
  228. !define __NSD_GroupBox_EXSTYLE ${WS_EX_TRANSPARENT}
  229. !define __NSD_CheckBox_CLASS BUTTON
  230. !define __NSD_CheckBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTOCHECKBOX}|${BS_MULTILINE}
  231. !define __NSD_CheckBox_EXSTYLE 0
  232. !define __NSD_RadioButton_CLASS BUTTON
  233. !define __NSD_RadioButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTORADIOBUTTON}|${BS_MULTILINE}
  234. !define __NSD_RadioButton_EXSTYLE 0
  235. !define __NSD_Text_CLASS EDIT
  236. !define __NSD_Text_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
  237. !define __NSD_Text_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  238. !define __NSD_Password_CLASS EDIT
  239. !define __NSD_Password_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_PASSWORD}
  240. !define __NSD_Password_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  241. !define __NSD_Number_CLASS EDIT
  242. !define __NSD_Number_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_NUMBER}
  243. !define __NSD_Number_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  244. !define __NSD_FileRequest_CLASS EDIT
  245. !define __NSD_FileRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
  246. !define __NSD_FileRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  247. !define __NSD_DirRequest_CLASS EDIT
  248. !define __NSD_DirRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
  249. !define __NSD_DirRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  250. !define __NSD_RichEdit_CLASS_10 "RICHEDIT" ; 1.0 (Riched32.dll) Win95/NT4
  251. !define __NSD_RichEdit_CLASS_20A "RICHEDIT20A" ; 2.0 (Riched20.dll) Win98/NT4 (NSIS makes sure this is registered even on Windows 95)
  252. !define __NSD_RichEdit_CLASS_20W "RICHEDIT20W"
  253. !define __NSD_RichEdit_CLASS_41W "RICHEDIT50W" ; 4.1 (MsftEdit.DLL) WinXP.SP1
  254. !ifdef NSIS_UNICODE
  255. !define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20W}
  256. !else
  257. !define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20A}
  258. !endif
  259. !define __NSD_RichEdit_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_AUTOVSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${ES_SAVESEL}|${WS_HSCROLL}|${WS_VSCROLL}
  260. !define __NSD_RichEdit_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  261. !define __NSD_ComboBox_CLASS COMBOBOX
  262. !define __NSD_ComboBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWN}
  263. !define __NSD_ComboBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  264. !define __NSD_DropList_CLASS COMBOBOX
  265. !define __NSD_DropList_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWNLIST}
  266. !define __NSD_DropList_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  267. !define __NSD_ListBox_CLASS LISTBOX
  268. !define __NSD_ListBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY}
  269. !define __NSD_ListBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  270. !define __NSD_SortedListBox_CLASS LISTBOX
  271. !define __NSD_SortedListBox_STYLE ${__NSD_ListBox_STYLE}|${LBS_SORT}
  272. !define __NSD_SortedListBox_EXSTYLE ${__NSD_ListBox_EXSTYLE}
  273. !define __NSD_ProgressBar_CLASS msctls_progress32
  274. !define __NSD_ProgressBar_STYLE ${DEFAULT_STYLES}
  275. !define __NSD_ProgressBar_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  276. !define __NSD_Animation_CLASS SysAnimate32
  277. !define __NSD_Animation_STYLE ${DEFAULT_STYLES}|${ACS_TRANSPARENT}|${ACS_AUTOPLAY}
  278. !define __NSD_Animation_EXSTYLE 0
  279. !define __NSD_HTrackBar_CLASS msctls_trackbar32
  280. !define __NSD_HTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_HORZ}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
  281. !define __NSD_HTrackBar_EXSTYLE 0
  282. !define __NSD_VTrackBar_CLASS msctls_trackbar32
  283. !define __NSD_VTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_VERT}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
  284. !define __NSD_VTrackBar_EXSTYLE 0
  285. !define __NSD_UpDown_CLASS msctls_updown32
  286. !define __NSD_UpDown_STYLE ${DEFAULT_STYLES}|${UDS_SETBUDDYINT}|${UDS_ARROWKEYS}|${UDS_NOTHOUSANDS}|${UDS_ALIGNRIGHT}
  287. !define __NSD_UpDown_EXSTYLE 0
  288. !define __NSD_AutoUpDown_CLASS msctls_updown32
  289. !define __NSD_AutoUpDown_STYLE ${__NSD_UpDown_STYLE}|${UDS_AUTOBUDDY}
  290. !define __NSD_AutoUpDown_EXSTYLE ${__NSD_UpDown_EXSTYLE}
  291. !define __NSD_HotKey_CLASS msctls_hotkey32
  292. !define __NSD_HotKey_STYLE ${DEFAULT_STYLES}
  293. !define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  294. !define __NSD_IPAddress_CLASS SysIPAddress32 ; IE4+/CC4.71+
  295. !define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}
  296. !define __NSD_IPAddress_EXSTYLE 0
  297. !macro __NSD_DefineControl NAME
  298. !define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
  299. !macroend
  300. !insertmacro __NSD_DefineControl HLine
  301. !insertmacro __NSD_DefineControl VLine
  302. !insertmacro __NSD_DefineControl Label
  303. !insertmacro __NSD_DefineControl Icon
  304. !insertmacro __NSD_DefineControl Bitmap
  305. !insertmacro __NSD_DefineControl BrowseButton
  306. !insertmacro __NSD_DefineControl Link
  307. !insertmacro __NSD_DefineControl Button
  308. !insertmacro __NSD_DefineControl GroupBox
  309. !insertmacro __NSD_DefineControl CheckBox
  310. !insertmacro __NSD_DefineControl RadioButton
  311. !insertmacro __NSD_DefineControl Text
  312. !insertmacro __NSD_DefineControl Password
  313. !insertmacro __NSD_DefineControl Number
  314. !insertmacro __NSD_DefineControl FileRequest
  315. !insertmacro __NSD_DefineControl DirRequest
  316. !insertmacro __NSD_DefineControl RichEdit
  317. !insertmacro __NSD_DefineControl ComboBox
  318. !insertmacro __NSD_DefineControl DropList
  319. !insertmacro __NSD_DefineControl ListBox
  320. !insertmacro __NSD_DefineControl SortedListBox
  321. !insertmacro __NSD_DefineControl ProgressBar
  322. !insertmacro __NSD_DefineControl Animation
  323. !insertmacro __NSD_DefineControl HTrackBar
  324. !insertmacro __NSD_DefineControl VTrackBar
  325. !insertmacro __NSD_DefineControl UpDown
  326. !insertmacro __NSD_DefineControl AutoUpDown
  327. !insertmacro __NSD_DefineControl HotKey
  328. !insertmacro __NSD_DefineControl IPAddress
  329. !macro __NSD_OnControlEvent EVENT HWND FUNCTION
  330. Push $0
  331. Push $1
  332. StrCpy $1 "${HWND}"
  333. GetFunctionAddress $0 "${FUNCTION}"
  334. nsDialogs::On${EVENT} $1 $0
  335. Pop $1
  336. Pop $0
  337. !macroend
  338. !macro __NSD_DefineControlCallback EVENT
  339. !define NSD_On${EVENT} `!insertmacro __NSD_OnControlEvent ${EVENT} `
  340. !macroend
  341. !macro __NSD_OnDialogEvent EVENT FUNCTION
  342. Push $0
  343. GetFunctionAddress $0 "${FUNCTION}"
  344. nsDialogs::On${EVENT} $0
  345. Pop $0
  346. !macroend
  347. !macro __NSD_DefineDialogCallback EVENT
  348. !define NSD_On${EVENT} `!insertmacro __NSD_OnDialogEvent ${EVENT} `
  349. !macroend
  350. !insertmacro __NSD_DefineControlCallback Click
  351. !insertmacro __NSD_DefineControlCallback Change
  352. !insertmacro __NSD_DefineControlCallback Notify
  353. !insertmacro __NSD_DefineDialogCallback Back
  354. !define NSD_Return "!insertmacro NSD_Return "
  355. !macro NSD_Return val
  356. StrCpy $_OUTDIR ${val}
  357. SetSilent silent
  358. Return
  359. !macroend
  360. !define __NSD_MkCtlCmd "!insertmacro __NSD_MkCtlCmd "
  361. !macro __NSD_MkCtlCmd msg wp lp hCtl
  362. SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
  363. !macroend
  364. !define __NSD_MkCtlCmd_WP "!insertmacro __NSD_MkCtlCmd_WP "
  365. !macro __NSD_MkCtlCmd_WP msg lp hCtl wp
  366. SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
  367. !macroend
  368. !define __NSD_MkCtlCmd_LP "!insertmacro __NSD_MkCtlCmd_LP "
  369. !macro __NSD_MkCtlCmd_LP msg wp hCtl lp
  370. SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
  371. !macroend
  372. !define __NSD_MkCtlCmd_WPLP "!insertmacro __NSD_MkCtlCmd_WPLP "
  373. !macro __NSD_MkCtlCmd_WPLP msg hCtl wp lp
  374. SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
  375. !macroend
  376. !define __NSD_MkCtlCmd_RV "!insertmacro __NSD_MkCtlCmd_RV "
  377. !macro __NSD_MkCtlCmd_RV msg wp lp hCtl VAR
  378. SendMessage ${hCtl} ${${msg}} ${wp} ${lp} ${VAR}
  379. !macroend
  380. !define NSD_InitCommonControlsEx "!insertmacro __NSD_InitCommonControlsEx "
  381. !macro __NSD_InitCommonControlsEx ICC
  382. System::Int64Op ${ICC} << 32
  383. System::Int64Op 0x08 |
  384. System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UINT64
  385. !macroend
  386. !define NSD_CreateTimer `!insertmacro _NSD_CreateTimer `
  387. !macro _NSD_CreateTimer FUNCTION INTERVAL
  388. Push $0
  389. GetFunctionAddress $0 "${FUNCTION}"
  390. nsDialogs::CreateTimer $0 "${INTERVAL}"
  391. Pop $0
  392. !macroend
  393. !define NSD_KillTimer `!insertmacro _NSD_KillTimer `
  394. !macro _NSD_KillTimer FUNCTION
  395. Push $0
  396. GetFunctionAddress $0 "${FUNCTION}"
  397. nsDialogs::KillTimer $0
  398. Pop $0
  399. !macroend
  400. !define NSD_AddStyle "!insertmacro _NSD_GWLAddFlags ${GWL_STYLE} "
  401. !define NSD_AddExStyle "!insertmacro _NSD_GWLAddFlags ${GWL_EXSTYLE} "
  402. !macro _NSD_GWLAddFlags GWL HWND DATA
  403. System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
  404. System::Int64Op "${DATA}" |
  405. System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)"
  406. !macroend
  407. !define NSD_GetStyle "!insertmacro _NSD_GWLGetFlags ${GWL_STYLE} "
  408. !define NSD_GetExStyle "!insertmacro _NSD_GWLGetFlags ${GWL_EXSTYLE} "
  409. !macro _NSD_GWLGetFlags GWL HWND RET
  410. System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
  411. Pop ${RET}
  412. !macroend
  413. !macro __NSD_GetStyleBit GWL BIT HWND RET
  414. !insertmacro _NSD_GWLGetFlags ${GWL} ${HWND} ${RET}
  415. IntOp ${RET} ${RET} & ${BIT}
  416. !macroend
  417. !define NSD_SetFocus `!insertmacro __NSD_SetFocus `
  418. !macro __NSD_SetFocus HWND
  419. System::Call "user32::SetFocus(p${HWND})"
  420. !macroend
  421. !define NSD_GetText "!insertmacro __NSD_GetText "
  422. !macro __NSD_GetText CONTROL VAR
  423. System::Call user32::GetWindowText(p${CONTROL},t.s,i${NSIS_MAX_STRLEN})
  424. Pop ${VAR}
  425. !macroend
  426. !define NSD_SetText "!insertmacro __NSD_SetText "
  427. !macro __NSD_SetText CONTROL TEXT
  428. SendMessage ${CONTROL} ${WM_SETTEXT} 0 `STR:${TEXT}`
  429. !macroend
  430. ### Edit ###
  431. !define NSD_Edit_GetTextLimit `${__NSD_MkCtlCmd_RV} EM_GETLIMITTEXT 0 0 `
  432. !define NSD_Edit_SetTextLimit `${__NSD_MkCtlCmd_WP} EM_SETLIMITTEXT 0 `
  433. !define NSD_Edit_SetPasswordChar `${__NSD_MkCtlCmd_WP} EM_SETPASSWORDCHAR 0 `
  434. !define NSD_Edit_GetReadOnly `!insertmacro __NSD_GetStyleBit ${GWL_STYLE} ${ES_READONLY} ` ; Non-zero if read-only
  435. !define NSD_Edit_SetReadOnly `${__NSD_MkCtlCmd_WP} EM_SETREADONLY 0 ` ; Toggles the ES_READONLY style
  436. !define NSD_Edit_GetModify `${__NSD_MkCtlCmd_RV} EM_GETMODIFY 0 0 `
  437. !define NSD_Edit_SetModify `${__NSD_MkCtlCmd_WP} EM_SETMODIFY 0 `
  438. !define NSD_Edit_EmptyUndoBuffer `${__NSD_MkCtlCmd} EM_EMPTYUNDOBUFFER 0 0 `
  439. !define NSD_Edit_CanUndo `${__NSD_MkCtlCmd_RV} EM_CANUNDO 0 0 `
  440. !define NSD_Edit_ScrollCaret `${__NSD_MkCtlCmd} EM_SCROLLCARET 0 0 `
  441. !define NSD_Edit_SetSel `${__NSD_MkCtlCmd_WPLP} EM_SETSEL ` ; WP:Start LP:End
  442. !define NSD_Edit_SetCueBannerText "!insertmacro __NSD_Edit_SetCueBannerText " ; CC6+
  443. !macro __NSD_Edit_SetCueBannerText CONTROL SHOWWHENFOCUSED TEXT
  444. !if ${NSIS_CHAR_SIZE} > 1
  445. SendMessage ${CONTROL} ${EM_SETCUEBANNER} ${SHOWWHENFOCUSED} `STR:${TEXT}`
  446. !else
  447. System::Call 'USER32::SendMessage(p${CONTROL},i${EM_SETCUEBANNER},p${SHOWWHENFOCUSED},ws)' `${TEXT}` ; Must be PWSTR
  448. !endif
  449. !macroend
  450. !define NSD_SetTextLimit `${NSD_Edit_SetTextLimit} ` ; Legacy alias
  451. ### RichEdit ###
  452. !define NSD_RichEd_SetTextLimit `${__NSD_MkCtlCmd_LP} EM_EXLIMITTEXT 0 `
  453. !define NSD_RichEd_GetEventMask `${__NSD_MkCtlCmd_RV} EM_GETEVENTMASK 0 0 `
  454. !define NSD_RichEd_SetEventMask `${__NSD_MkCtlCmd_LP} EM_SETEVENTMASK 0 ` ; LP:ENM_*
  455. !define NSD_RichEd_SetSystemBackgroundColor `${__NSD_MkCtlCmd} EM_SETBKGNDCOLOR 1 0 ` ; COLOR_WINDOW
  456. !define NSD_RichEd_SetCustomBackgroundColor `${__NSD_MkCtlCmd_LP} EM_SETBKGNDCOLOR 0 ` ; LP:COLORREF
  457. !define NSD_RichEd_SetHideSelection `${__NSD_MkCtlCmd_WP} EM_HIDESELECTION 0 ` ; WP(BOOL):HideSelWithoutFocus (Toggles ES_NOHIDESEL & TXTBIT_HIDESELECTION)
  458. ### CheckBox ###
  459. !define NSD_GetState `!insertmacro __NSD_GetState `
  460. !macro __NSD_GetState CONTROL VAR
  461. SendMessage ${CONTROL} ${BM_GETCHECK} 0 0 ${VAR}
  462. !macroend
  463. !define NSD_SetState `!insertmacro __NSD_SetState `
  464. !macro __NSD_SetState CONTROL STATE
  465. SendMessage ${CONTROL} ${BM_SETCHECK} ${STATE} 0
  466. !macroend
  467. !define NSD_Check `!insertmacro __NSD_Check `
  468. !macro __NSD_Check CONTROL
  469. ${NSD_SetState} ${CONTROL} ${BST_CHECKED}
  470. !macroend
  471. !define NSD_Uncheck `!insertmacro __NSD_Uncheck `
  472. !macro __NSD_Uncheck CONTROL
  473. ${NSD_SetState} ${CONTROL} ${BST_UNCHECKED}
  474. !macroend
  475. !define NSD_GetChecked `!insertmacro __NSD_GetState `
  476. !define NSD_SetChecked `!insertmacro __NSD_SetState `
  477. ### ComboBox ###
  478. !define NSD_CB_AddString "!insertmacro _NSD_CB_AddString "
  479. !macro _NSD_CB_AddString CONTROL STRING
  480. SendMessage ${CONTROL} ${CB_ADDSTRING} 0 `STR:${STRING}`
  481. !macroend
  482. !define NSD_CB_InsertString "!insertmacro _NSD_CB_InsertString "
  483. !macro _NSD_CB_InsertString CONTROL INDEX STRING
  484. SendMessage ${CONTROL} ${CB_INSERTSTRING} ${INDEX} `STR:${STRING}`
  485. !macroend
  486. !define NSD_CB_PrependString "!insertmacro _NSD_CB_PrependString "
  487. !macro _NSD_CB_PrependString CONTROL STRING
  488. SendMessage ${CONTROL} ${CB_INSERTSTRING} 0 `STR:${STRING}`
  489. !macroend
  490. !define NSD_CB_AppendString "!insertmacro _NSD_CB_AppendString "
  491. !macro _NSD_CB_AppendString CONTROL STRING
  492. SendMessage ${CONTROL} ${CB_INSERTSTRING} -1 `STR:${STRING}`
  493. !macroend
  494. !define NSD_CB_SelectString "!insertmacro _NSD_CB_SelectString "
  495. !macro _NSD_CB_SelectString CONTROL STRING
  496. SendMessage ${CONTROL} ${CB_SELECTSTRING} -1 `STR:${STRING}`
  497. !macroend
  498. !define NSD_CB_GetSelectionIndex `!insertmacro __NSD_CB_GetSelectionIndex `
  499. !macro __NSD_CB_GetSelectionIndex CONTROL VAR
  500. SendMessage ${CONTROL} ${CB_GETCURSEL} 0 0 ${VAR}
  501. !macroend
  502. !define NSD_CB_SetSelectionIndex `!insertmacro __NSD_CB_SetSelectionIndex `
  503. !macro __NSD_CB_SetSelectionIndex CONTROL INDEX
  504. SendMessage ${CONTROL} ${CB_SETCURSEL} ${INDEX} 0
  505. !macroend
  506. !define NSD_CB_GetItemData `!insertmacro __NSD_CB_GetItemData `
  507. !macro NSD_CB_GetItemData CONTROL INDEX VAR
  508. SendMessage ${CONTROL} ${CB_GETITEMDATA} ${INDEX} 0 ${VAR}
  509. !macroend
  510. !define NSD_CB_SetItemData `!insertmacro __NSD_CB_SetItemData `
  511. !macro NSD_CB_SetItemData CONTROL INDEX DATA
  512. SendMessage ${CONTROL} ${CB_SETITEMDATA} ${INDEX} ${DATA}
  513. !macroend
  514. !define NSD_CB_DelItem `${__NSD_MkCtlCmd_WP} CB_DELETESTRING 0 `
  515. !define NSD_CB_LimitText `${__NSD_MkCtlCmd_WP} CB_LIMITTEXT 0 `
  516. !define /IfNDef NSD_CB_Clear `${__NSD_MkCtlCmd} CB_RESETCONTENT 0 0 `
  517. !define /IfNDef NSD_CB_GetCount `${__NSD_MkCtlCmd_RV} CB_GETCOUNT 0 0 `
  518. ;define /IfNDef NSD_CB_DelString ; /IfNDef to try to stay compatible with
  519. ;define /IfNDef NSD_CB_GetSelection ; the ListView header from the Wiki.
  520. ### ListBox ###
  521. !define NSD_LB_AddString "!insertmacro _NSD_LB_AddString "
  522. !macro _NSD_LB_AddString CONTROL STRING
  523. SendMessage ${CONTROL} ${LB_ADDSTRING} 0 `STR:${STRING}`
  524. !macroend
  525. !define NSD_LB_InsertString "!insertmacro _NSD_LB_InsertString "
  526. !macro _NSD_LB_InsertString CONTROL INDEX STRING
  527. SendMessage ${CONTROL} ${LB_INSERTSTRING} ${INDEX} `STR:${STRING}`
  528. !macroend
  529. !define NSD_LB_PrependString "!insertmacro _NSD_LB_PrependString "
  530. !macro _NSD_LB_PrependString CONTROL STRING
  531. SendMessage ${CONTROL} ${LB_INSERTSTRING} 0 `STR:${STRING}`
  532. !macroend
  533. !define NSD_LB_AppendString "!insertmacro _NSD_LB_AppendString "
  534. !macro _NSD_LB_AppendString CONTROL STRING
  535. SendMessage ${CONTROL} ${LB_INSERTSTRING} -1 `STR:${STRING}`
  536. !macroend
  537. !define NSD_LB_DelString `!insertmacro __NSD_LB_DelString `
  538. !macro __NSD_LB_DelString CONTROL STRING
  539. System::Call 'USER32::SendMessage(p${CONTROL},i${LB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}`
  540. System::Call 'USER32::SendMessage(p${CONTROL},i${LB_DELETESTRING},ps,p0)'
  541. !macroend
  542. !define NSD_LB_DelItem "!insertmacro __NSD_LB_DelItem "
  543. !macro __NSD_LB_DelItem CONTROL INDEX
  544. SendMessage ${CONTROL} ${LB_DELETESTRING} ${INDEX} 0
  545. !macroend
  546. !define NSD_LB_Clear `${__NSD_MkCtlCmd} LB_RESETCONTENT 0 0 `
  547. !define NSD_LB_GetCount `!insertmacro __NSD_LB_GetCount `
  548. !macro __NSD_LB_GetCount CONTROL VAR
  549. SendMessage ${CONTROL} ${LB_GETCOUNT} 0 0 ${VAR}
  550. !macroend
  551. !define NSD_LB_SelectString "!insertmacro _NSD_LB_SelectString "
  552. !macro _NSD_LB_SelectString CONTROL STRING
  553. SendMessage ${CONTROL} ${LB_SELECTSTRING} -1 `STR:${STRING}`
  554. !macroend
  555. !define NSD_LB_GetSelection `!insertmacro __NSD_LB_GetSelection `
  556. !macro __NSD_LB_GetSelection CONTROL VAR
  557. SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
  558. System::Call 'user32::SendMessage(p ${CONTROL}, i ${LB_GETTEXT}, p ${VAR}, t .s)'
  559. Pop ${VAR}
  560. !macroend
  561. !define NSD_LB_GetSelectionIndex `!insertmacro __NSD_LB_GetSelectionIndex `
  562. !macro __NSD_LB_GetSelectionIndex CONTROL VAR
  563. SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
  564. !macroend
  565. !define NSD_LB_SetSelectionIndex `!insertmacro __NSD_LB_SetSelectionIndex `
  566. !macro __NSD_LB_SetSelectionIndex CONTROL INDEX
  567. SendMessage ${CONTROL} ${LB_SETCURSEL} ${INDEX} 0
  568. !macroend
  569. !define NSD_LB_GetSelectionCount `!insertmacro __NSD_LB_GetSelectionCount `
  570. !macro __NSD_LB_GetSelectionCount CONTROL VAR
  571. SendMessage ${CONTROL} ${LB_GETSELCOUNT} 0 0 ${VAR}
  572. !macroend
  573. !define NSD_LB_GetItemText `!insertmacro __NSD_LB_GetItemText `
  574. !macro __NSD_LB_GetItemText CONTROL INDEX VAR
  575. System::Call 'user32::SendMessage(p${CONTROL}, i${LB_GETTEXT}, p${INDEX}, t.s)'
  576. Pop ${VAR}
  577. !macroend
  578. !define NSD_LB_GetItemData `!insertmacro __NSD_LB_GetItemData `
  579. !macro NSD_LB_GetItemData CONTROL INDEX VAR
  580. SendMessage ${CONTROL} ${LB_GETITEMDATA} ${INDEX} 0 ${VAR}
  581. !macroend
  582. !define NSD_LB_SetItemData `!insertmacro __NSD_LB_SetItemData `
  583. !macro NSD_LB_SetItemData CONTROL INDEX DATA
  584. SendMessage ${CONTROL} ${LB_SETITEMDATA} ${INDEX} ${DATA}
  585. !macroend
  586. !define NSD_LB_FindStringPrefix `!insertmacro __NSD_LB_FindStringPrefix `
  587. !macro __NSD_LB_FindStringPrefix CONTROL STRING VAR
  588. SendMessage ${CONTROL} ${LB_FINDSTRING} -1 `STR:${STRING}` ${VAR}
  589. !macroend
  590. !define NSD_LB_FindStringExact `!insertmacro __NSD_LB_FindStringExact `
  591. !macro __NSD_LB_FindStringExact CONTROL STRING VAR
  592. SendMessage ${CONTROL} ${LB_FINDSTRINGEXACT} -1 `STR:${STRING}` ${VAR}
  593. !macroend
  594. ### ProgressBar ###
  595. !define NSD_ProgressBar_SetPos `${__NSD_MkCtlCmd_WP} PBM_SETPOS 0 `
  596. !define NSD_ProgressBar_SetStep `${__NSD_MkCtlCmd_WP} PBM_SETSTEP 0 `
  597. !define NSD_ProgressBar_StepIt `${__NSD_MkCtlCmd} PBM_STEPIT 0 0 `
  598. !define NSD_ProgressBar_AdvanceBy `${__NSD_MkCtlCmd_WP} PBM_DELTAPOS 0 `
  599. !define NSD_ProgressBar_SetPackedRange `${__NSD_MkCtlCmd_LP} PBM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max)
  600. !define NSD_ProgressBar_SetRange32 `${__NSD_MkCtlCmd_WPLP} PBM_SETRANGE32 ` ; [IE3+] WP:min LP:max
  601. !define NSD_ProgressBar_GetPos `${__NSD_MkCtlCmd_RV} PBM_GETPOS 0 0 ` ; [IE3+]
  602. ### Animation ###
  603. !define NSD_Anim_Close `${__NSD_MkCtlCmd} ACM_OPEN 0 0 `
  604. !define NSD_Anim_Play `${__NSD_MkCtlCmd} ACM_PLAY -1 0xFFFF0000 `
  605. !define NSD_Anim_PlayLoops `${__NSD_MkCtlCmd_WP} ACM_PLAY 0xFFFF0000 ` ; WP(UINT16):LoopCount
  606. !define NSD_Anim_Stop `${__NSD_MkCtlCmd} ACM_STOP 0 0 `
  607. !define NSD_Anim_IsPlaying `${__NSD_MkCtlCmd_RV} ACM_ISPLAYING 0 0 `
  608. !define NSD_Anim_OpenFile `!insertmacro __NSD_Anim_OpenFile `
  609. !macro __NSD_Anim_OpenFile CONTROL PATH
  610. SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}"
  611. !macroend
  612. !define NSD_Anim_OpenResource `!insertmacro __NSD_Anim_OpenResource `
  613. !macro __NSD_Anim_OpenResource CONTROL HINSTANCE_CC471 RESID
  614. SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}"
  615. !macroend
  616. ### TrackBar ###
  617. !define NSD_TrackBar_GetPos `${__NSD_MkCtlCmd_RV} TBM_GETPOS 0 0 `
  618. !define NSD_TrackBar_SetPos `${__NSD_MkCtlCmd_LP} TBM_SETPOS 1 `
  619. !define NSD_TrackBar_SetRangeMin `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMIN 1 `
  620. !define NSD_TrackBar_SetRangeMax `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMAX 1 `
  621. !define NSD_TrackBar_GetLineSize `${__NSD_MkCtlCmd_RV} TBM_GETLINESIZE 0 0 `
  622. !define NSD_TrackBar_SetLineSize `${__NSD_MkCtlCmd_LP} TBM_SETLINESIZE 0 `
  623. !define NSD_TrackBar_GetPageSize `${__NSD_MkCtlCmd_RV} TBM_GETPAGESIZE 0 0 `
  624. !define NSD_TrackBar_SetPageSize `${__NSD_MkCtlCmd_LP} TBM_SETPAGESIZE 0 `
  625. !define NSD_TrackBar_ClearTics `${__NSD_MkCtlCmd} TBM_CLEARTICS 0 0 `
  626. !define NSD_TrackBar_GetNumTics `${__NSD_MkCtlCmd_RV} TBM_GETNUMTICS 0 0 `
  627. !define NSD_TrackBar_SetTic `${__NSD_MkCtlCmd_LP} TBM_SETTIC 0 `
  628. !define NSD_TrackBar_SetTicFreq `${__NSD_MkCtlCmd_WP} TBM_SETTICFREQ 0 `
  629. !define NSD_TrackBar_GetThumbLength `${__NSD_MkCtlCmd_RV} TBM_GETTHUMBLENGTH 0 0 `
  630. !define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND
  631. ### UpDown ###
  632. !define NSD_UD_SetBuddy `${__NSD_MkCtlCmd_WP} UDM_SETBUDDY 0 `
  633. !define NSD_UD_GetPos `${__NSD_MkCtlCmd_RV} UDM_GETPOS 0 0 `
  634. !define NSD_UD_SetPos `${__NSD_MkCtlCmd_LP} UDM_SETPOS 0 `
  635. !define NSD_UD_GetPackedRange `${__NSD_MkCtlCmd_RV} UDM_GETRANGE 0 0 `
  636. !define NSD_UD_SetPackedRange `${__NSD_MkCtlCmd_LP} UDM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max)
  637. !define NSD_UD_GetPos32 `${__NSD_MkCtlCmd_RV} UDM_GETPOS32 0 0 `
  638. !define NSD_UD_SetPos32 `${__NSD_MkCtlCmd_LP} UDM_SETPOS32 0 `
  639. !define NSD_UD_SetRange32 `${__NSD_MkCtlCmd_WPLP} UDM_SETRANGE32 ` ; WP(INT32):min LP(INT32):max
  640. !define NSD_UD_GetRange32 `!insertmacro __NSD_UD_GetRange32 `
  641. !macro __NSD_UD_GetRange32 CONTROL OUTLO OUTHI
  642. System::Call 'USER32::SendMessage(p${CONTROL},i${UDM_GETRANGE32},*i.s,*i.s)'
  643. Pop ${OUTLO}
  644. Pop ${OUTHI}
  645. !macroend
  646. !define NSD_UD_SetStaticRange `!insertmacro __NSD_UD_SetStaticRange `
  647. !macro __NSD_UD_SetStaticRange CONTROL MI MA
  648. !define /redef /math MI ${MI} << 16
  649. !define /redef /math MA ${MA} & 0xffff
  650. !define /redef /math MA ${MI} | ${MA}
  651. SendMessage ${CONTROL} ${UDM_SETRANGE} 0 ${MA}
  652. !macroend
  653. ### HotKey ###
  654. !define NSD_HK_GetHotKey `${__NSD_MkCtlCmd_RV} HKM_GETHOTKEY 0 0 ` ; RV(WORD):MAKEWORD(VK,HOTKEYF)
  655. !define NSD_HK_SetHotKey `${__NSD_MkCtlCmd_WP} HKM_SETHOTKEY 0 `
  656. !define NSD_HK_SetRules `${__NSD_MkCtlCmd_WPLP} HKM_SETRULES `
  657. ### IP Address ###
  658. !define NSD_IPAddress_Clear `${__NSD_MkCtlCmd} IPM_CLEARADDRESS 0 0 `
  659. !define NSD_IPAddress_SetPackedIPv4 `${__NSD_MkCtlCmd_LP} IPM_SETADDRESS 0 `
  660. !define NSD_IPAddress_IsBlank `${__NSD_MkCtlCmd_RV} IPM_ISBLANK 0 0 `
  661. !define NSD_IPAddress_GetPackedIPv4 `!insertmacro __NSD_IPAddress_GetPackedIPv4 `
  662. !macro __NSD_IPAddress_GetPackedIPv4 CONTROL VAR
  663. System::Call 'USER32::SendMessage(p${CONTROL},i${IPM_GETADDRESS},p0,*i0s)'
  664. Pop ${VAR}
  665. !macroend
  666. ### Static ###
  667. !macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE
  668. Push $0
  669. Push $R0
  670. Push "${IMAGE}" # in case ${IMAGE} is $R0
  671. StrCpy $R0 ${CONTROL} # in case ${CONTROL} is $0
  672. !if "${_LIHINSTMODE}" == "exeresource"
  673. !undef _LIHINSTSRC # If (internal?) _* macro params starts using $0,
  674. !define _LIHINSTSRC r0 # _LIHINSTSRC can be changed to s
  675. System::Call 'kernel32::GetModuleHandle(p0)p.${_LIHINSTSRC}'
  676. !endif
  677. System::Call 'user32::LoadImage(p ${_LIHINSTSRC}, ts, i ${_IMGTYPE}, i0, i0, i${_LIFLAGS})p.r0'
  678. SendMessage $R0 ${STM_SETIMAGE} ${_IMGTYPE} $0
  679. Pop $R0
  680. Exch $0
  681. Pop ${HANDLE}
  682. !macroend
  683. !macro __NSD_SetIconFromExeResource CONTROL IMAGE HANDLE
  684. !insertmacro __NSD_LoadAndSetImage exeresource ${IMAGE_ICON} 0 ${LR_DEFAULTSIZE} "${CONTROL}" "${IMAGE}" ${HANDLE}
  685. !macroend
  686. !macro __NSD_SetIconFromInstaller CONTROL HANDLE
  687. !insertmacro __NSD_SetIconFromExeResource "${CONTROL}" "#103" ${HANDLE}
  688. !macroend
  689. !define NSD_SetImage `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_BITMAP} 0 "${LR_LOADFROMFILE}" `
  690. !define NSD_SetBitmap `${NSD_SetImage} `
  691. !define NSD_SetIcon `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_ICON} 0 "${LR_LOADFROMFILE}|${LR_DEFAULTSIZE}" `
  692. !define NSD_SetIconFromExeResource `!insertmacro __NSD_SetIconFromExeResource `
  693. !define NSD_SetIconFromInstaller `!insertmacro __NSD_SetIconFromInstaller `
  694. !define NSD_SetStretchedImage `!insertmacro __NSD_SetStretchedImage `
  695. !macro __NSD_SetStretchedImage CONTROL IMAGE HANDLE
  696. Push $0
  697. Push $R0
  698. Push "${IMAGE}" # in case ${IMAGE} is $0 or $R0
  699. StrCpy $R0 ${CONTROL} # in case ${CONTROL} is $0
  700. System::Call 'user32::GetClientRect(pR0,@r0)'
  701. System::Call '*$0(i,i,i.r0,i.s)'
  702. Exch # swap so stack contains ImagePath and then ControlHeight
  703. System::Call 'user32::LoadImage(p0, ts, i${IMAGE_BITMAP}, ir0, is, i${LR_LOADFROMFILE}) p.r0'
  704. SendMessage $R0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $0
  705. Pop $R0
  706. Exch $0
  707. Pop ${HANDLE}
  708. !macroend
  709. !define NSD_FreeImage `!insertmacro __NSD_FreeImage `
  710. !define NSD_FreeBitmap `${NSD_FreeImage} `
  711. !macro __NSD_FreeImage IMAGE
  712. ${If} ${IMAGE} P<> 0
  713. System::Call gdi32::DeleteObject(ps) ${IMAGE}
  714. ${EndIf}
  715. !macroend
  716. !define NSD_FreeIcon `!insertmacro __NSD_FreeIcon `
  717. !macro __NSD_FreeIcon IMAGE
  718. System::Call user32::DestroyIcon(ps) ${IMAGE}
  719. !macroend
  720. !define NSD_ClearImage `!insertmacro __NSD_ClearImage ${IMAGE_BITMAP} `
  721. !define NSD_ClearBitmap `${NSD_ClearImage} `
  722. !define NSD_ClearIcon `!insertmacro __NSD_ClearImage ${IMAGE_ICON } `
  723. !macro __NSD_ClearImage _IMGTYPE CONTROL
  724. SendMessage ${CONTROL} ${STM_SETIMAGE} ${_IMGTYPE} 0
  725. !macroend
  726. ### INI ###
  727. !define /IfNDef NSD_Debug `System::Call kernel32::OutputDebugString(ts)`
  728. !macro __NSD_ControlCase TYPE
  729. ${Case} ${TYPE}
  730. ${NSD_Create${TYPE}} $R3u $R4u $R5u $R6u $R7
  731. Pop $R9
  732. ${Break}
  733. !macroend
  734. !macro __NSD_ControlCaseEx TYPE
  735. ${Case} ${TYPE}
  736. Call ${TYPE}
  737. ${Break}
  738. !macroend
  739. !macro NSD_FUNCTION_INIFILE
  740. !insertmacro NSD_INIFILE ""
  741. !macroend
  742. !macro NSD_UNFUNCTION_INIFILE
  743. !insertmacro NSD_INIFILE un.
  744. !macroend
  745. !macro NSD_INIFILE UNINSTALLER_FUNCPREFIX
  746. ;Functions to create dialogs based on old InstallOptions INI files
  747. Function ${UNINSTALLER_FUNCPREFIX}CreateDialogFromINI
  748. # $0 = ini
  749. ReadINIStr $R0 $0 Settings RECT
  750. ${If} $R0 == ""
  751. StrCpy $R0 1018
  752. ${EndIf}
  753. nsDialogs::Create $R0
  754. Pop $R9
  755. ReadINIStr $R0 $0 Settings RTL
  756. nsDialogs::SetRTL $R0
  757. ReadINIStr $R0 $0 Settings NumFields
  758. ${NSD_Debug} "NumFields = $R0"
  759. ${For} $R1 1 $R0
  760. ${NSD_Debug} "Creating field $R1"
  761. ReadINIStr $R2 $0 "Field $R1" Type
  762. ${NSD_Debug} " Type = $R2"
  763. ReadINIStr $R3 $0 "Field $R1" Left
  764. ${NSD_Debug} " Left = $R3"
  765. ReadINIStr $R4 $0 "Field $R1" Top
  766. ${NSD_Debug} " Top = $R4"
  767. ReadINIStr $R5 $0 "Field $R1" Right
  768. ${NSD_Debug} " Right = $R5"
  769. ReadINIStr $R6 $0 "Field $R1" Bottom
  770. ${NSD_Debug} " Bottom = $R6"
  771. IntOp $R5 $R5 - $R3
  772. ${NSD_Debug} " Width = $R5"
  773. IntOp $R6 $R6 - $R4
  774. ${NSD_Debug} " Height = $R6"
  775. ReadINIStr $R7 $0 "Field $R1" Text
  776. ${NSD_Debug} " Text = $R7"
  777. ${Switch} $R2
  778. !insertmacro __NSD_ControlCase HLine
  779. !insertmacro __NSD_ControlCase VLine
  780. !insertmacro __NSD_ControlCase Label
  781. !insertmacro __NSD_ControlCase Icon
  782. !insertmacro __NSD_ControlCase Bitmap
  783. !insertmacro __NSD_ControlCaseEx Link
  784. !insertmacro __NSD_ControlCase Button
  785. !insertmacro __NSD_ControlCase GroupBox
  786. !insertmacro __NSD_ControlCase CheckBox
  787. !insertmacro __NSD_ControlCase RadioButton
  788. !insertmacro __NSD_ControlCase Text
  789. !insertmacro __NSD_ControlCase Password
  790. !insertmacro __NSD_ControlCaseEx FileRequest
  791. !insertmacro __NSD_ControlCaseEx DirRequest
  792. !insertmacro __NSD_ControlCase ComboBox
  793. !insertmacro __NSD_ControlCase DropList
  794. !insertmacro __NSD_ControlCase ListBox
  795. ${EndSwitch}
  796. WriteINIStr $0 "Field $R1" HWND $R9
  797. ${Next}
  798. nsDialogs::Show
  799. FunctionEnd
  800. Function ${UNINSTALLER_FUNCPREFIX}UpdateINIState
  801. ${NSD_Debug} "Updating INI state"
  802. ReadINIStr $R0 $0 Settings NumFields
  803. ${NSD_Debug} "NumField = $R0"
  804. ${For} $R1 1 $R0
  805. ReadINIStr $R2 $0 "Field $R1" HWND
  806. ReadINIStr $R3 $0 "Field $R1" "Type"
  807. ${Switch} $R3
  808. ${Case} "CheckBox"
  809. ${Case} "RadioButton"
  810. ${NSD_Debug} " HWND = $R2"
  811. ${NSD_GetState} $R2 $R2
  812. ${NSD_Debug} " Window selection = $R2"
  813. ${Break}
  814. ${CaseElse}
  815. ${NSD_Debug} " HWND = $R2"
  816. ${NSD_GetText} $R2 $R2
  817. ${NSD_Debug} " Window text = $R2"
  818. ${Break}
  819. ${EndSwitch}
  820. WriteINIStr $0 "Field $R1" STATE $R2
  821. ${Next}
  822. FunctionEnd
  823. Function ${UNINSTALLER_FUNCPREFIX}FileRequest
  824. IntOp $R5 $R5 - 15
  825. IntOp $R8 $R3 + $R5
  826. ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ...
  827. Pop $R8
  828. nsDialogs::SetUserData $R8 $R1 # remember field id
  829. WriteINIStr $0 "Field $R1" HWND2 $R8
  830. ${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton
  831. ReadINIStr $R9 $0 "Field $R1" State
  832. ${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9
  833. Pop $R9
  834. FunctionEnd
  835. Function ${UNINSTALLER_FUNCPREFIX}DirRequest
  836. IntOp $R5 $R5 - 15
  837. IntOp $R8 $R3 + $R5
  838. ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ...
  839. Pop $R8
  840. nsDialogs::SetUserData $R8 $R1 # remember field id
  841. WriteINIStr $0 "Field $R1" HWND2 $R8
  842. ${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton
  843. ReadINIStr $R9 $0 "Field $R1" State
  844. ${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9
  845. Pop $R9
  846. FunctionEnd
  847. Function ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton
  848. Pop $R0
  849. nsDialogs::GetUserData $R0
  850. Pop $R1
  851. ReadINIStr $R2 $0 "Field $R1" HWND
  852. ReadINIStr $R4 $0 "Field $R1" Filter
  853. ${NSD_GetText} $R2 $R3
  854. nsDialogs::SelectFileDialog save $R3 $R4
  855. Pop $R3
  856. ${If} $R3 != ""
  857. SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3
  858. ${EndIf}
  859. FunctionEnd
  860. Function ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton
  861. Pop $R0
  862. nsDialogs::GetUserData $R0
  863. Pop $R1
  864. ReadINIStr $R2 $0 "Field $R1" HWND
  865. ReadINIStr $R3 $0 "Field $R1" Text
  866. ${NSD_GetText} $R2 $R4
  867. nsDialogs::SelectFolderDialog $R3 $R4
  868. Pop $R3
  869. ${If} $R3 != error
  870. SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3
  871. ${EndIf}
  872. FunctionEnd
  873. Function ${UNINSTALLER_FUNCPREFIX}Link
  874. ${NSD_CreateLink} $R3u $R4u $R5u $R6u $R7
  875. Pop $R9
  876. nsDialogs::SetUserData $R9 $R1 # remember field id
  877. ${NSD_OnClick} $R9 ${UNINSTALLER_FUNCPREFIX}OnLink
  878. FunctionEnd
  879. Function ${UNINSTALLER_FUNCPREFIX}OnLink
  880. Pop $R0
  881. nsDialogs::GetUserData $R0
  882. Pop $R1
  883. ReadINIStr $R1 $0 "Field $R1" STATE
  884. ExecShell "" $R1
  885. FunctionEnd
  886. !macroend
  887. !verbose pop
  888. !endif