Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Include / nsDialogs.nsh @ 3136

Historique | Voir | Annoter | Télécharger (43,11 ko)

1
/*
2

    
3
nsDialogs.nsh
4
Header file for creating custom installer pages with nsDialogs
5

    
6
*/
7

    
8
!ifndef NSDIALOGS_INCLUDED
9
!verbose push 2
10
!define NSDIALOGS_INCLUDED
11
!verbose 3
12

    
13
!include LogicLib.nsh
14
!include WinMessages.nsh
15

    
16
!define /ifndef WS_EX_DLGMODALFRAME  0x00000001
17
!define /ifndef WS_EX_NOPARENTNOTIFY 0x00000004
18
!define /ifndef WS_EX_TOPMOST        0x00000008
19
!define /ifndef WS_EX_ACCEPTFILES    0x00000010
20
!define /ifndef WS_EX_TRANSPARENT    0x00000020
21
!define /ifndef WS_EX_MDICHILD       0x00000040
22
!define /ifndef WS_EX_TOOLWINDOW     0x00000080
23
!define /ifndef WS_EX_WINDOWEDGE     0x00000100
24
!define /ifndef WS_EX_CLIENTEDGE     0x00000200
25
!define /ifndef WS_EX_CONTEXTHELP    0x00000400
26
!define /ifndef WS_EX_RIGHT          0x00001000
27
!define /ifndef WS_EX_LEFT           0x00000000
28
!define /ifndef WS_EX_RTLREADING     0x00002000
29
!define /ifndef WS_EX_LTRREADING     0x00000000
30
!define /ifndef WS_EX_LEFTSCROLLBAR  0x00004000
31
!define /ifndef WS_EX_RIGHTSCROLLBAR 0x00000000
32
!define /ifndef WS_EX_CONTROLPARENT  0x00010000
33
!define /ifndef WS_EX_STATICEDGE     0x00020000
34
!define /ifndef WS_EX_APPWINDOW      0x00040000
35

    
36
!define /ifndef WS_CHILD             0x40000000
37
!define /ifndef WS_VISIBLE           0x10000000
38
!define /ifndef WS_DISABLED          0x08000000
39
!define /ifndef WS_CLIPSIBLINGS      0x04000000
40
!define /ifndef WS_CLIPCHILDREN      0x02000000
41
!define /ifndef WS_MAXIMIZE          0x01000000
42
!define /ifndef WS_VSCROLL           0x00200000
43
!define /ifndef WS_HSCROLL           0x00100000
44
!define /ifndef WS_GROUP             0x00020000
45
!define /ifndef WS_TABSTOP           0x00010000
46

    
47
!define ES_LEFT              0x00000000
48
!define ES_CENTER            0x00000001
49
!define ES_RIGHT             0x00000002
50
!define ES_MULTILINE         0x00000004
51
!define ES_UPPERCASE         0x00000008
52
!define ES_LOWERCASE         0x00000010
53
!define ES_PASSWORD          0x00000020
54
!define ES_AUTOVSCROLL       0x00000040
55
!define ES_AUTOHSCROLL       0x00000080
56
!define ES_NOHIDESEL         0x00000100
57
!define ES_OEMCONVERT        0x00000400
58
!define ES_READONLY          0x00000800
59
!define ES_WANTRETURN        0x00001000
60
!define ES_NUMBER            0x00002000
61
!define ES_SAVESEL           0x00008000
62

    
63
!define SS_LEFT              0x00000000
64
!define SS_CENTER            0x00000001
65
!define SS_RIGHT             0x00000002
66
!define SS_ICON              0x00000003
67
!define SS_BLACKRECT         0x00000004
68
!define SS_GRAYRECT          0x00000005
69
!define SS_WHITERECT         0x00000006
70
!define SS_BLACKFRAME        0x00000007
71
!define SS_GRAYFRAME         0x00000008
72
!define SS_WHITEFRAME        0x00000009
73
!define SS_USERITEM          0x0000000A
74
!define SS_SIMPLE            0x0000000B
75
!define SS_LEFTNOWORDWRAP    0x0000000C
76
!define SS_OWNERDRAW         0x0000000D
77
!define SS_BITMAP            0x0000000E
78
!define SS_ENHMETAFILE       0x0000000F
79
!define SS_ETCHEDHORZ        0x00000010
80
!define SS_ETCHEDVERT        0x00000011
81
!define SS_ETCHEDFRAME       0x00000012
82
!define SS_TYPEMASK          0x0000001F
83
!define SS_REALSIZECONTROL   0x00000040
84
!define SS_NOPREFIX          0x00000080
85
!define SS_NOTIFY            0x00000100
86
!define SS_CENTERIMAGE       0x00000200
87
!define SS_RIGHTJUST         0x00000400
88
!define SS_REALSIZEIMAGE     0x00000800
89
!define SS_SUNKEN            0x00001000
90
!define SS_EDITCONTROL       0x00002000
91
!define SS_ENDELLIPSIS       0x00004000
92
!define SS_PATHELLIPSIS      0x00008000
93
!define SS_WORDELLIPSIS      0x0000C000
94
!define SS_ELLIPSISMASK      0x0000C000
95

    
96
!define BS_PUSHBUTTON        0x00000000
97
!define BS_DEFPUSHBUTTON     0x00000001
98
!define BS_CHECKBOX          0x00000002
99
!define BS_AUTOCHECKBOX      0x00000003
100
!define BS_RADIOBUTTON       0x00000004
101
!define BS_3STATE            0x00000005
102
!define BS_AUTO3STATE        0x00000006
103
!define BS_GROUPBOX          0x00000007
104
!define BS_USERBUTTON        0x00000008
105
!define BS_AUTORADIOBUTTON   0x00000009
106
!define BS_PUSHBOX           0x0000000A
107
!define BS_OWNERDRAW         0x0000000B
108
!define BS_TYPEMASK          0x0000000F
109
!define BS_LEFTTEXT          0x00000020
110
!define BS_TEXT              0x00000000
111
!define BS_ICON              0x00000040
112
!define BS_BITMAP            0x00000080
113
!define BS_LEFT              0x00000100
114
!define BS_RIGHT             0x00000200
115
!define BS_CENTER            0x00000300
116
!define BS_TOP               0x00000400
117
!define BS_BOTTOM            0x00000800
118
!define BS_VCENTER           0x00000C00
119
!define BS_PUSHLIKE          0x00001000
120
!define BS_MULTILINE         0x00002000
121
!define BS_NOTIFY            0x00004000
122
!define BS_FLAT              0x00008000
123
!define BS_RIGHTBUTTON       ${BS_LEFTTEXT}
124

    
125
!define CBS_SIMPLE            0x0001
126
!define CBS_DROPDOWN          0x0002
127
!define CBS_DROPDOWNLIST      0x0003
128
!define CBS_OWNERDRAWFIXED    0x0010
129
!define CBS_OWNERDRAWVARIABLE 0x0020
130
!define CBS_AUTOHSCROLL       0x0040
131
!define CBS_OEMCONVERT        0x0080
132
!define CBS_SORT              0x0100
133
!define CBS_HASSTRINGS        0x0200
134
!define CBS_NOINTEGRALHEIGHT  0x0400
135
!define CBS_DISABLENOSCROLL   0x0800
136
!define CBS_UPPERCASE         0x2000
137
!define CBS_LOWERCASE         0x4000
138

    
139
!define LBS_NOTIFY            0x0001
140
!define LBS_SORT              0x0002
141
!define LBS_NOREDRAW          0x0004
142
!define LBS_MULTIPLESEL       0x0008
143
!define LBS_OWNERDRAWFIXED    0x0010
144
!define LBS_OWNERDRAWVARIABLE 0x0020
145
!define LBS_HASSTRINGS        0x0040
146
!define LBS_USETABSTOPS       0x0080
147
!define LBS_NOINTEGRALHEIGHT  0x0100
148
!define LBS_MULTICOLUMN       0x0200
149
!define LBS_WANTKEYBOARDINPUT 0x0400
150
!define LBS_EXTENDEDSEL       0x0800
151
!define LBS_DISABLENOSCROLL   0x1000
152
!define LBS_NODATA            0x2000
153
!define LBS_NOSEL             0x4000
154
!define LBS_COMBOBOX          0x8000
155

    
156
!define ACS_CENTER      0x0001
157
!define ACS_TRANSPARENT 0x0002 ;  The parent of the animation control must not have the WS_CLIPCHILDREN style
158
!define ACS_AUTOPLAY    0x0004
159
!define ACS_TIMER       0x0008 ; < CC6
160

    
161
!define TBS_AUTOTICKS        0x0001
162
!define TBS_VERT             0x0002
163
!define TBS_HORZ             0x0000
164
!define TBS_TOP              0x0004
165
!define TBS_BOTTOM           0x0000
166
!define TBS_LEFT             0x0004
167
!define TBS_RIGHT            0x0000
168
!define TBS_BOTH             0x0008
169
!define TBS_NOTICKS          0x0010
170
!define TBS_ENABLESELRANGE   0x0020
171
!define TBS_FIXEDLENGTH      0x0040
172
!define TBS_NOTHUMB          0x0080
173
!define TBS_TOOLTIPS         0x0100 ; IE3
174
!define TBS_REVERSED         0x0200 ; IE5
175
!define TBS_DOWNISLEFT       0x0400 ; _WIN32_IE >= 0x0501
176
!define TBS_NOTIFYBEFOREMOVE 0x0800 ; IE6?
177
!define TBS_TRANSPARENTBKGND 0x1000 ; Vista
178

    
179
!define UDS_WRAP        0x0001
180
!define UDS_SETBUDDYINT 0x0002
181
!define UDS_ALIGNRIGHT  0x0004
182
!define UDS_ALIGNLEFT   0x0008
183
!define UDS_AUTOBUDDY   0x0010
184
!define UDS_ARROWKEYS   0x0020
185
!define UDS_HORZ        0x0040
186
!define UDS_NOTHOUSANDS 0x0080
187
!define UDS_HOTTRACK    0x0100 ; 98+
188

    
189
!define MCS_DAYSTATE        0x0001
190
!define MCS_MULTISELECT     0x0002
191
!define MCS_WEEKNUMBERS     0x0004
192
!define MCS_NOTODAYCIRCLE   0x0008
193
!define MCS_NOTODAY         0x0010 ; IE4+?
194
!define MCS_NOTRAILINGDATES  0x0040 ; Vista+
195
!define MCS_SHORTDAYSOFWEEK  0x0080 ; Vista+
196
!define MCS_NOSELCHANGEONNAV 0x0100 ; Vista+
197

    
198
!define DTS_UPDOWN          0x01
199
!define DTS_SHOWNONE        0x02
200
!define DTS_SHORTDATEFORMAT 0x00
201
!define DTS_LONGDATEFORMAT  0x04
202
!define DTS_SHORTDATECENTURYFORMAT 0x0C
203
!define DTS_TIMEFORMAT      0x09
204
!define DTS_APPCANPARSE     0x10
205
!define DTS_RIGHTALIGN      0x20
206

    
207
!define /ifndef LR_DEFAULTCOLOR     0x0000
208
!define /ifndef LR_MONOCHROME       0x0001
209
!define /ifndef LR_COLOR            0x0002
210
!define /ifndef LR_COPYRETURNORG    0x0004
211
!define /ifndef LR_COPYDELETEORG    0x0008
212
!define /ifndef LR_LOADFROMFILE     0x0010
213
!define /ifndef LR_LOADTRANSPARENT  0x0020
214
!define /ifndef LR_DEFAULTSIZE      0x0040
215
!define /ifndef LR_VGACOLOR         0x0080
216
!define /ifndef LR_LOADMAP3DCOLORS  0x1000
217
!define /ifndef LR_CREATEDIBSECTION 0x2000
218
!define /ifndef LR_COPYFROMRESOURCE 0x4000
219
!define /ifndef LR_SHARED           0x8000
220

    
221
!define /ifndef IMAGE_BITMAP        0
222
!define /ifndef IMAGE_ICON          1
223
!define /ifndef IMAGE_CURSOR        2
224
!define /ifndef IMAGE_ENHMETAFILE   3
225

    
226
!define /ifndef GWL_STYLE           -16
227
!define /ifndef GWL_EXSTYLE         -20
228

    
229
#define /ifndef ICC_LISTVIEW_CLASSES 0x0001 ; SysListView32 and SysHeader32
230
#define /ifndef ICC_TREEVIEW_CLASSES 0x0002 ; SysTabControl32 and tooltips_class32
231
#define /ifndef ICC_BAR_CLASSES      0x0004 ; ToolbarWindow32, msctls_statusbar32, msctls_trackbar32 and tooltips_class32
232
#define /ifndef ICC_TAB_CLASSES      0x0008 ; SysTabControl32 and tooltips_class32
233
#define /ifndef ICC_UPDOWN_CLASS     0x0010 ; msctls_updown32
234
#define /ifndef ICC_PROGRESS_CLASS   0x0020 ; msctls_progress32
235
#define /ifndef ICC_HOTKEY_CLASS     0x0040 ; msctls_hotkey32
236
#define /ifndef ICC_ANIMATE_CLASS    0x0080 ; SysAnimate32
237
#define /ifndef ICC_WIN95_CLASSES    0x00FF
238
!define /ifndef ICC_DATE_CLASSES     0x0100 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) SysDateTimePick32, SysMonthCal32 and CC6.10+(Vista+) DropDown
239
!define /ifndef ICC_USEREX_CLASSES   0x0200 ; CC4.??+ (NT4+/IE3.?+/Win95 OSR2) ComboBoxEx32
240
!define /ifndef ICC_COOL_CLASSES     0x0400 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) ReBarWindow32
241
!define /ifndef ICC_INTERNET_CLASSES 0x0800 ; CC4.71+ (IE4+) SysIPAddress32
242
!define /ifndef ICC_PAGESCROLLER_CLASS 0x1000 ; CC4.71+ (IE4+) SysPager
243
!define /ifndef ICC_NATIVEFNTCTL_CLASS 0x2000 ; CC4.71+ (IE4+) NativeFontCtl
244
!define /ifndef ICC_STANDARD_CLASSES 0x4000 ; WinXP+ Button, Static, Edit, ListBox, ComboBox, ComboLBox, ScrollBar and ReaderModeCtl
245
!define /ifndef ICC_LINK_CLASS       0x8000 ; WinXP+ SysLink
246

    
247

    
248
!define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS}
249

    
250
!define __NSD_HLine_CLASS STATIC
251
!define __NSD_HLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDHORZ}|${SS_SUNKEN}
252
!define __NSD_HLine_EXSTYLE ${WS_EX_TRANSPARENT}
253

    
254
!define __NSD_VLine_CLASS STATIC
255
!define __NSD_VLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDVERT}|${SS_SUNKEN}
256
!define __NSD_VLine_EXSTYLE ${WS_EX_TRANSPARENT}
257

    
258
!define __NSD_Label_CLASS STATIC
259
!define __NSD_Label_STYLE ${DEFAULT_STYLES}|${SS_NOTIFY}
260
!define __NSD_Label_EXSTYLE ${WS_EX_TRANSPARENT}
261

    
262
!define __NSD_Icon_CLASS STATIC
263
!define __NSD_Icon_STYLE ${DEFAULT_STYLES}|${SS_ICON}|${SS_NOTIFY}
264
!define __NSD_Icon_EXSTYLE 0
265

    
266
!define __NSD_Bitmap_CLASS STATIC
267
!define __NSD_Bitmap_STYLE ${DEFAULT_STYLES}|${SS_BITMAP}|${SS_NOTIFY}
268
!define __NSD_Bitmap_EXSTYLE 0
269

    
270
!define __NSD_BrowseButton_CLASS BUTTON
271
!define __NSD_BrowseButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
272
!define __NSD_BrowseButton_EXSTYLE 0
273

    
274
!define __NSD_Link_CLASS LINK
275
!define __NSD_Link_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_OWNERDRAW}
276
!define __NSD_Link_EXSTYLE 0
277

    
278
!define __NSD_Button_CLASS BUTTON
279
!define __NSD_Button_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
280
!define __NSD_Button_EXSTYLE 0
281

    
282
!define __NSD_GroupBox_CLASS BUTTON
283
!define __NSD_GroupBox_STYLE ${DEFAULT_STYLES}|${BS_GROUPBOX}
284
!define __NSD_GroupBox_EXSTYLE ${WS_EX_TRANSPARENT}
285

    
286
!define __NSD_CheckBox_CLASS BUTTON
287
!define __NSD_CheckBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTOCHECKBOX}|${BS_MULTILINE}
288
!define __NSD_CheckBox_EXSTYLE 0
289

    
290
!define __NSD_RadioButton_CLASS BUTTON
291
!define __NSD_RadioButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTORADIOBUTTON}|${BS_MULTILINE}
292
!define __NSD_RadioButton_EXSTYLE 0
293

    
294
!define __NSD_Text_CLASS EDIT
295
!define __NSD_Text_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
296
!define __NSD_Text_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
297

    
298
!define __NSD_MLText_CLASS EDIT
299
!define __NSD_MLText_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_AUTOVSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${WS_HSCROLL}|${WS_VSCROLL}
300
!define __NSD_MLText_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
301

    
302
!define __NSD_Password_CLASS EDIT
303
!define __NSD_Password_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_PASSWORD}
304
!define __NSD_Password_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
305

    
306
!define __NSD_Number_CLASS EDIT
307
!define __NSD_Number_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_NUMBER}
308
!define __NSD_Number_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
309

    
310
!define __NSD_FileRequest_CLASS EDIT
311
!define __NSD_FileRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
312
!define __NSD_FileRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
313

    
314
!define __NSD_DirRequest_CLASS EDIT
315
!define __NSD_DirRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
316
!define __NSD_DirRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
317

    
318
!define __NSD_RichEdit_CLASS_10  "RICHEDIT"    ; 1.0 (Riched32.dll) Win95/NT4
319
!define __NSD_RichEdit_CLASS_20A "RICHEDIT20A" ; 2.0 (Riched20.dll) Win98/NT4 (NSIS makes sure this is registered even on Windows 95)
320
!define __NSD_RichEdit_CLASS_20W "RICHEDIT20W"
321
!define __NSD_RichEdit_CLASS_41W "RICHEDIT50W" ; 4.1 (MsftEdit.DLL) WinXP.SP1
322
!ifdef NSIS_UNICODE
323
!define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20W}
324
!else
325
!define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20A}
326
!endif
327
!define __NSD_RichEdit_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_AUTOVSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${ES_SAVESEL}|${WS_HSCROLL}|${WS_VSCROLL}
328
!define __NSD_RichEdit_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
329

    
330
!define __NSD_ComboBox_CLASS COMBOBOX
331
!define __NSD_ComboBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWN}
332
!define __NSD_ComboBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
333

    
334
!define __NSD_DropList_CLASS COMBOBOX
335
!define __NSD_DropList_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWNLIST}
336
!define __NSD_DropList_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
337

    
338
!define __NSD_ListBox_CLASS LISTBOX
339
!define __NSD_ListBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY}
340
!define __NSD_ListBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
341

    
342
!define __NSD_SortedListBox_CLASS LISTBOX
343
!define __NSD_SortedListBox_STYLE ${__NSD_ListBox_STYLE}|${LBS_SORT}
344
!define __NSD_SortedListBox_EXSTYLE ${__NSD_ListBox_EXSTYLE}
345

    
346
!define __NSD_ProgressBar_CLASS msctls_progress32
347
!define __NSD_ProgressBar_STYLE ${DEFAULT_STYLES}
348
!define __NSD_ProgressBar_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
349

    
350
!define __NSD_Animation_CLASS SysAnimate32
351
!define __NSD_Animation_STYLE ${DEFAULT_STYLES}|${ACS_TRANSPARENT}|${ACS_AUTOPLAY}
352
!define __NSD_Animation_EXSTYLE 0
353

    
354
!define __NSD_HTrackBar_CLASS msctls_trackbar32
355
!define __NSD_HTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_HORZ}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
356
!define __NSD_HTrackBar_EXSTYLE 0
357

    
358
!define __NSD_VTrackBar_CLASS msctls_trackbar32
359
!define __NSD_VTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_VERT}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
360
!define __NSD_VTrackBar_EXSTYLE 0
361

    
362
!define __NSD_UpDown_CLASS msctls_updown32
363
!define __NSD_UpDown_STYLE ${DEFAULT_STYLES}|${UDS_SETBUDDYINT}|${UDS_ARROWKEYS}|${UDS_NOTHOUSANDS}|${UDS_ALIGNRIGHT}
364
!define __NSD_UpDown_EXSTYLE 0
365

    
366
!define __NSD_AutoUpDown_CLASS msctls_updown32
367
!define __NSD_AutoUpDown_STYLE ${__NSD_UpDown_STYLE}|${UDS_AUTOBUDDY}
368
!define __NSD_AutoUpDown_EXSTYLE ${__NSD_UpDown_EXSTYLE}
369

    
370
!define __NSD_HotKey_CLASS msctls_hotkey32
371
!define __NSD_HotKey_STYLE ${DEFAULT_STYLES}
372
!define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
373

    
374
!define __NSD_Calendar_CLASS SysMonthCal32
375
!define __NSD_Calendar_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
376
!define __NSD_Calendar_EXSTYLE 0
377

    
378
!define __NSD_DatePicker_CLASS SysDateTimePick32
379
!define __NSD_DatePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
380
!define __NSD_DatePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
381

    
382
!define __NSD_TimePicker_CLASS SysDateTimePick32
383
!define __NSD_TimePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${DTS_TIMEFORMAT}
384
!define __NSD_TimePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
385

    
386
!define __NSD_IPAddress_CLASS SysIPAddress32 ; IE4+/CC4.71+
387
!define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
388
!define __NSD_IPAddress_EXSTYLE 0
389

    
390
!define __NSD_NetAddress_CLASS msctls_netaddress ; Vista+
391
!define __NSD_NetAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
392
!define __NSD_NetAddress_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
393

    
394

    
395
!macro __NSD_DefineControl NAME
396
	!define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
397
!macroend
398
!insertmacro __NSD_DefineControl HLine
399
!insertmacro __NSD_DefineControl VLine
400
!insertmacro __NSD_DefineControl Label
401
!insertmacro __NSD_DefineControl Icon
402
!insertmacro __NSD_DefineControl Bitmap
403
!insertmacro __NSD_DefineControl BrowseButton
404
!insertmacro __NSD_DefineControl Link
405
!insertmacro __NSD_DefineControl Button
406
!insertmacro __NSD_DefineControl GroupBox
407
!insertmacro __NSD_DefineControl CheckBox
408
!insertmacro __NSD_DefineControl RadioButton
409
!insertmacro __NSD_DefineControl Text
410
!insertmacro __NSD_DefineControl MLText
411
!insertmacro __NSD_DefineControl Password
412
!insertmacro __NSD_DefineControl Number
413
!insertmacro __NSD_DefineControl FileRequest
414
!insertmacro __NSD_DefineControl DirRequest
415
!insertmacro __NSD_DefineControl RichEdit
416
!insertmacro __NSD_DefineControl ComboBox
417
!insertmacro __NSD_DefineControl DropList
418
!insertmacro __NSD_DefineControl ListBox
419
!insertmacro __NSD_DefineControl SortedListBox
420
!insertmacro __NSD_DefineControl ProgressBar
421
!insertmacro __NSD_DefineControl Animation
422
!insertmacro __NSD_DefineControl HTrackBar
423
!insertmacro __NSD_DefineControl VTrackBar
424
!insertmacro __NSD_DefineControl UpDown
425
!insertmacro __NSD_DefineControl AutoUpDown
426
!insertmacro __NSD_DefineControl HotKey
427
!insertmacro __NSD_DefineControl Calendar
428
!insertmacro __NSD_DefineControl DatePicker
429
!insertmacro __NSD_DefineControl TimePicker
430
!insertmacro __NSD_DefineControl IPAddress
431
!insertmacro __NSD_DefineControl NetAddress
432

    
433

    
434
!macro __NSD_OnControlEvent EVENT HWND FUNCTION
435
	Push $0
436
	Push $1
437

    
438
	StrCpy $1 "${HWND}"
439

    
440
	GetFunctionAddress $0 "${FUNCTION}"
441
	nsDialogs::On${EVENT} $1 $0
442

    
443
	Pop $1
444
	Pop $0
445
!macroend
446

    
447
!macro __NSD_DefineControlCallback EVENT
448
	!define NSD_On${EVENT} `!insertmacro __NSD_OnControlEvent ${EVENT} `
449
!macroend
450

    
451
!macro __NSD_OnDialogEvent EVENT FUNCTION
452
	Push $0
453

    
454
	GetFunctionAddress $0 "${FUNCTION}"
455
	nsDialogs::On${EVENT} $0
456

    
457
	Pop $0
458
!macroend
459

    
460
!macro __NSD_DefineDialogCallback EVENT
461
	!define NSD_On${EVENT} `!insertmacro __NSD_OnDialogEvent ${EVENT} `
462
!macroend
463
!insertmacro __NSD_DefineControlCallback Click
464
!insertmacro __NSD_DefineControlCallback Change
465
!insertmacro __NSD_DefineControlCallback Notify
466
!insertmacro __NSD_DefineDialogCallback Back
467

    
468
!define NSD_Return "!insertmacro NSD_Return "
469
!macro NSD_Return val
470
StrCpy $_OUTDIR ${val}
471
SetSilent silent
472
Return
473
!macroend
474

    
475

    
476
!define __NSD_MkCtlCmd "!insertmacro __NSD_MkCtlCmd "
477
!macro __NSD_MkCtlCmd msg wp lp hCtl
478
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
479
!macroend
480
!define __NSD_MkCtlCmd_WP "!insertmacro __NSD_MkCtlCmd_WP "
481
!macro __NSD_MkCtlCmd_WP msg lp hCtl wp
482
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
483
!macroend
484
!define __NSD_MkCtlCmd_LP "!insertmacro __NSD_MkCtlCmd_LP "
485
!macro __NSD_MkCtlCmd_LP msg wp hCtl lp
486
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
487
!macroend
488
!define __NSD_MkCtlCmd_WPLP "!insertmacro __NSD_MkCtlCmd_WPLP "
489
!macro __NSD_MkCtlCmd_WPLP msg hCtl wp lp
490
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
491
!macroend
492
!define __NSD_MkCtlCmd_RV "!insertmacro __NSD_MkCtlCmd_RV "
493
!macro __NSD_MkCtlCmd_RV msg wp lp hCtl VAR
494
SendMessage ${hCtl} ${${msg}} ${wp} ${lp} ${VAR}
495
!macroend
496

    
497

    
498
!define NSD_InitCommonControlsEx "!insertmacro __NSD_InitCommonControlsEx "
499
!macro __NSD_InitCommonControlsEx ICC
500
!pragma warning push
501
!pragma warning disable 7070 ; Invalid number
502
!if ${ICC} <> 0
503
!define /ReDef /IntFmt NSD_InitCommonControlsEx_TEMP "0x%X" ${ICC}
504
System::Call 'COMCTL32::InitCommonControlsEx(*l${NSD_InitCommonControlsEx_TEMP}00000008)'
505
!undef NSD_InitCommonControlsEx_TEMP
506
!else
507
System::Int64Op ${ICC} << 32
508
System::Int64Op 8 | 
509
System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UINT64
510
!endif
511
!pragma warning pop
512
!macroend
513
!define NSD_InitCommonControl_IPAddress `${NSD_InitCommonControlsEx} ${ICC_INTERNET_CLASSES}`
514
!define NSD_InitCommonControl_NetAddress `System::Call SHELL32::InitNetworkAddressControl()i`
515
!define NSD_InitCommonControl_SysLink `${NSD_InitCommonControlsEx} ${ICC_LINK_CLASS}`
516

    
517

    
518
!define NSD_CreateTimer `!insertmacro _NSD_CreateTimer `
519
!macro _NSD_CreateTimer FUNCTION INTERVAL
520
	Push $0
521

    
522
	GetFunctionAddress $0 "${FUNCTION}"
523
	nsDialogs::CreateTimer $0 "${INTERVAL}"
524

    
525
	Pop $0
526
!macroend
527

    
528

    
529
!define NSD_KillTimer `!insertmacro _NSD_KillTimer `
530
!macro _NSD_KillTimer FUNCTION
531
	Push $0
532

    
533
	GetFunctionAddress $0 "${FUNCTION}"
534
	nsDialogs::KillTimer $0
535

    
536
	Pop $0
537
!macroend
538

    
539

    
540
!define NSD_AddStyle "!insertmacro _NSD_GWLAddFlags ${GWL_STYLE} "
541
!define NSD_AddExStyle "!insertmacro _NSD_GWLAddFlags ${GWL_EXSTYLE} "
542
!macro _NSD_GWLAddFlags GWL HWND DATA
543
	System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
544
	System::Int64Op "${DATA}" |
545
	System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)"
546
!macroend
547

    
548
!define NSD_RemoveStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_STYLE} " 
549
!define NSD_RemoveExStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_EXSTYLE} "
550
!macro _NSD_GWLRemoveFlags GWL HWND DATA
551
System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
552
System::Int64Op "${DATA}" ~ & ; Perform ~ and prepare the stack for &
553
System::Int64Op ; Perform &
554
System::Call "user32::SetWindowLong(p${HWND},i${GWL},ps)"
555
!macroend 
556

    
557
!define NSD_GetStyle "!insertmacro _NSD_GWLGetFlags ${GWL_STYLE} "
558
!define NSD_GetExStyle "!insertmacro _NSD_GWLGetFlags ${GWL_EXSTYLE} "
559
!macro _NSD_GWLGetFlags GWL HWND RET
560
System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s"
561
Pop ${RET}
562
!macroend
563

    
564
!macro __NSD_GetStyleBit GWL BIT HWND RET
565
!insertmacro _NSD_GWLGetFlags ${GWL} ${HWND} ${RET}
566
IntOp ${RET} ${RET} & ${BIT}
567
!macroend
568

    
569

    
570
!define NSD_SetFocus `!insertmacro __NSD_SetFocus `
571
!macro __NSD_SetFocus HWND
572
	System::Call "user32::SetFocus(p${HWND})"
573
!macroend
574

    
575

    
576
!define NSD_GetText "!insertmacro __NSD_GetText "
577
!macro __NSD_GetText CONTROL VAR
578
	System::Call user32::GetWindowText(p${CONTROL},t.s,i${NSIS_MAX_STRLEN})
579
	Pop ${VAR}
580
!macroend
581

    
582

    
583
!define NSD_SetText "!insertmacro __NSD_SetText "
584
!macro __NSD_SetText CONTROL TEXT
585
	SendMessage ${CONTROL} ${WM_SETTEXT} 0 `STR:${TEXT}`
586
!macroend
587

    
588

    
589
### Edit ###
590

    
591
!define NSD_Edit_GetTextLimit `${__NSD_MkCtlCmd_RV} EM_GETLIMITTEXT 0 0 `
592
!define NSD_Edit_SetTextLimit `${__NSD_MkCtlCmd_WP} EM_SETLIMITTEXT 0 `
593
!define NSD_Edit_SetPasswordChar `${__NSD_MkCtlCmd_WP} EM_SETPASSWORDCHAR 0 `
594
!define NSD_Edit_GetReadOnly `!insertmacro __NSD_GetStyleBit ${GWL_STYLE} ${ES_READONLY} ` ; Non-zero if read-only
595
!define NSD_Edit_SetReadOnly `${__NSD_MkCtlCmd_WP} EM_SETREADONLY 0 ` ; Toggles the ES_READONLY style
596
!define NSD_Edit_GetModify `${__NSD_MkCtlCmd_RV} EM_GETMODIFY 0 0 `
597
!define NSD_Edit_SetModify `${__NSD_MkCtlCmd_WP} EM_SETMODIFY 0 `
598
!define NSD_Edit_EmptyUndoBuffer `${__NSD_MkCtlCmd} EM_EMPTYUNDOBUFFER 0 0 `
599
!define NSD_Edit_CanUndo `${__NSD_MkCtlCmd_RV} EM_CANUNDO 0 0 `
600
!define NSD_Edit_ScrollCaret `${__NSD_MkCtlCmd} EM_SCROLLCARET 0 0 `
601
!define NSD_Edit_LineScroll `${__NSD_MkCtlCmd_WPLP} EM_LINESCROLL `
602
!define NSD_Edit_SetSel `${__NSD_MkCtlCmd_WPLP} EM_SETSEL ` ; WP:Start LP:End
603

    
604
!define NSD_Edit_SetCueBannerText "!insertmacro __NSD_Edit_SetCueBannerText " ; CC6+
605
!macro __NSD_Edit_SetCueBannerText CONTROL SHOWWHENFOCUSED TEXT
606
!if ${NSIS_CHAR_SIZE} > 1
607
	SendMessage ${CONTROL} ${EM_SETCUEBANNER} ${SHOWWHENFOCUSED} `STR:${TEXT}`
608
!else
609
	System::Call 'USER32::SendMessage(p${CONTROL},i${EM_SETCUEBANNER},p${SHOWWHENFOCUSED},ws)' `${TEXT}` ; Must be PWSTR
610
!endif
611
!macroend
612

    
613
!define NSD_Edit_GetLineCount `${__NSD_MkCtlCmd_RV} EM_GETLINECOUNT 0 0 `
614
!define NSD_Edit_GetLine "!insertmacro __NSD_Edit_GetLine "
615
!macro __NSD_Edit_GetLine CONTROL LINEINDEX OUTPUT
616
	System::Call '*(&i2 ${NSIS_MAX_STRLEN},&t${NSIS_MAX_STRLEN})p.s'
617
	System::Call 'USER32::SendMessage(p${CONTROL},i${EM_GETLINE},p${LINEINDEX},pss)'
618
	System::Call 'KERNEL32::lstrcpyn(t.s,pss,i${NSIS_MAX_STRLEN})'
619
	Pop ${OUTPUT}
620
	System::Free
621
!macroend
622

    
623
!define NSD_SetTextLimit `${NSD_Edit_SetTextLimit} ` ; Legacy alias
624

    
625

    
626
### RichEdit ###
627

    
628
!define NSD_RichEd_SetTextLimit `${__NSD_MkCtlCmd_LP} EM_EXLIMITTEXT 0 `
629
!define NSD_RichEd_GetEventMask `${__NSD_MkCtlCmd_RV} EM_GETEVENTMASK 0 0 `
630
!define NSD_RichEd_SetEventMask `${__NSD_MkCtlCmd_LP} EM_SETEVENTMASK 0 ` ; LP:ENM_*
631
!define NSD_RichEd_SetSystemBackgroundColor `${__NSD_MkCtlCmd} EM_SETBKGNDCOLOR 1 0 ` ; COLOR_WINDOW
632
!define NSD_RichEd_SetCustomBackgroundColor `${__NSD_MkCtlCmd_LP} EM_SETBKGNDCOLOR 0 ` ; LP:COLORREF
633
!define NSD_RichEd_SetHideSelection `${__NSD_MkCtlCmd_WP} EM_HIDESELECTION 0 ` ; WP(BOOL):HideSelWithoutFocus (Toggles ES_NOHIDESEL & TXTBIT_HIDESELECTION)
634

    
635

    
636
### CheckBox ###
637

    
638
!define NSD_GetState `!insertmacro __NSD_GetState `
639
!macro __NSD_GetState CONTROL VAR
640
	SendMessage ${CONTROL} ${BM_GETCHECK} 0 0 ${VAR}
641
!macroend
642

    
643

    
644
!define NSD_SetState `!insertmacro __NSD_SetState `
645
!macro __NSD_SetState CONTROL STATE
646
	SendMessage ${CONTROL} ${BM_SETCHECK} ${STATE} 0
647
!macroend
648

    
649
!define NSD_Check `!insertmacro __NSD_Check `
650
!macro __NSD_Check CONTROL
651
	${NSD_SetState} ${CONTROL} ${BST_CHECKED}
652
!macroend
653

    
654

    
655
!define NSD_Uncheck `!insertmacro __NSD_Uncheck `
656
!macro __NSD_Uncheck CONTROL
657
	${NSD_SetState} ${CONTROL} ${BST_UNCHECKED}
658
!macroend
659

    
660
!define NSD_GetChecked `!insertmacro __NSD_GetState `
661
!define NSD_SetChecked `!insertmacro __NSD_SetState `
662

    
663

    
664
### ComboBox ###
665

    
666
!define NSD_CB_AddString "!insertmacro _NSD_CB_AddString "
667
!macro _NSD_CB_AddString CONTROL STRING
668
	SendMessage ${CONTROL} ${CB_ADDSTRING} 0 `STR:${STRING}`
669
!macroend
670

    
671

    
672
!define NSD_CB_InsertString "!insertmacro _NSD_CB_InsertString "
673
!macro _NSD_CB_InsertString CONTROL INDEX STRING
674
SendMessage ${CONTROL} ${CB_INSERTSTRING} ${INDEX} `STR:${STRING}`
675
!macroend
676

    
677
!define NSD_CB_PrependString "!insertmacro _NSD_CB_PrependString "
678
!macro _NSD_CB_PrependString CONTROL STRING
679
SendMessage ${CONTROL} ${CB_INSERTSTRING} 0 `STR:${STRING}`
680
!macroend
681

    
682
!define NSD_CB_AppendString "!insertmacro _NSD_CB_AppendString "
683
!macro _NSD_CB_AppendString CONTROL STRING
684
SendMessage ${CONTROL} ${CB_INSERTSTRING} -1 `STR:${STRING}`
685
!macroend
686

    
687

    
688
!define NSD_CB_SelectString "!insertmacro _NSD_CB_SelectString "
689
!macro _NSD_CB_SelectString CONTROL STRING
690
	SendMessage ${CONTROL} ${CB_SELECTSTRING} -1 `STR:${STRING}`
691
!macroend
692

    
693

    
694
!define NSD_CB_GetSelectionIndex `!insertmacro __NSD_CB_GetSelectionIndex `
695
!macro __NSD_CB_GetSelectionIndex CONTROL VAR
696
	SendMessage ${CONTROL} ${CB_GETCURSEL} 0 0 ${VAR}
697
!macroend
698

    
699

    
700
!define NSD_CB_SetSelectionIndex `!insertmacro __NSD_CB_SetSelectionIndex `
701
!macro __NSD_CB_SetSelectionIndex CONTROL INDEX
702
	SendMessage ${CONTROL} ${CB_SETCURSEL} ${INDEX} 0
703
!macroend
704

    
705

    
706
!define NSD_CB_GetItemData `!insertmacro __NSD_CB_GetItemData `
707
!macro __NSD_CB_GetItemData CONTROL INDEX VAR
708
SendMessage ${CONTROL} ${CB_GETITEMDATA} ${INDEX} 0 ${VAR}
709
!macroend
710
!define NSD_CB_SetItemData `${__NSD_MkCtlCmd_WPLP} CB_SETITEMDATA ` ; Index Data
711

    
712

    
713
!define NSD_CB_DelItem `${__NSD_MkCtlCmd_WP} CB_DELETESTRING 0 `
714
!define NSD_CB_LimitText `${__NSD_MkCtlCmd_WP} CB_LIMITTEXT 0 `
715
!define /IfNDef NSD_CB_Clear `${__NSD_MkCtlCmd} CB_RESETCONTENT 0 0 `
716
!define /IfNDef NSD_CB_GetCount `${__NSD_MkCtlCmd_RV} CB_GETCOUNT 0 0 `
717
!ifndef NSD_CB_DelString
718
!define NSD_CB_DelString `!insertmacro __NSD_CB_DelString `
719
!macro __NSD_CB_DelString CONTROL STRING
720
	System::Call 'USER32::SendMessage(p${CONTROL},i${CB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}`
721
	System::Call 'USER32::SendMessage(p${CONTROL},i${CB_DELETESTRING},ps,p0)'
722
!macroend
723
!endif
724
;define /IfNDef NSD_CB_GetSelection
725

    
726

    
727
### ListBox ###
728

    
729
!define NSD_LB_AddString "!insertmacro _NSD_LB_AddString "
730
!macro _NSD_LB_AddString CONTROL STRING
731
	SendMessage ${CONTROL} ${LB_ADDSTRING} 0 `STR:${STRING}`
732
!macroend
733

    
734

    
735
!define NSD_LB_InsertString "!insertmacro _NSD_LB_InsertString "
736
!macro _NSD_LB_InsertString CONTROL INDEX STRING
737
SendMessage ${CONTROL} ${LB_INSERTSTRING} ${INDEX} `STR:${STRING}`
738
!macroend
739

    
740
!define NSD_LB_PrependString "!insertmacro _NSD_LB_PrependString "
741
!macro _NSD_LB_PrependString CONTROL STRING
742
SendMessage ${CONTROL} ${LB_INSERTSTRING} 0 `STR:${STRING}`
743
!macroend
744

    
745
!define NSD_LB_AppendString "!insertmacro _NSD_LB_AppendString "
746
!macro _NSD_LB_AppendString CONTROL STRING
747
SendMessage ${CONTROL} ${LB_INSERTSTRING} -1 `STR:${STRING}`
748
!macroend
749

    
750

    
751
!define NSD_LB_DelString `!insertmacro __NSD_LB_DelString `
752
!macro __NSD_LB_DelString CONTROL STRING
753
	System::Call 'USER32::SendMessage(p${CONTROL},i${LB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}`
754
	System::Call 'USER32::SendMessage(p${CONTROL},i${LB_DELETESTRING},ps,p0)'
755
!macroend
756

    
757

    
758
!define NSD_LB_DelItem "!insertmacro __NSD_LB_DelItem "
759
!macro __NSD_LB_DelItem CONTROL INDEX
760
	SendMessage ${CONTROL} ${LB_DELETESTRING} ${INDEX} 0
761
!macroend
762

    
763

    
764
!define NSD_LB_Clear `${__NSD_MkCtlCmd} LB_RESETCONTENT 0 0 `
765

    
766

    
767
!define NSD_LB_GetCount `!insertmacro __NSD_LB_GetCount `
768
!macro __NSD_LB_GetCount CONTROL VAR
769
	SendMessage ${CONTROL} ${LB_GETCOUNT} 0 0 ${VAR}
770
!macroend
771

    
772

    
773
!define NSD_LB_SelectString "!insertmacro _NSD_LB_SelectString "
774
!macro _NSD_LB_SelectString CONTROL STRING
775
	SendMessage ${CONTROL} ${LB_SELECTSTRING} -1 `STR:${STRING}`
776
!macroend
777

    
778

    
779
!define NSD_LB_GetSelection `!insertmacro __NSD_LB_GetSelection `
780
!macro __NSD_LB_GetSelection CONTROL VAR
781
	SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
782
	System::Call 'user32::SendMessage(p ${CONTROL}, i ${LB_GETTEXT}, p ${VAR}, t .s)'
783
	Pop ${VAR}
784
!macroend
785

    
786

    
787
!define NSD_LB_GetSelectionIndex `!insertmacro __NSD_LB_GetSelectionIndex `
788
!macro __NSD_LB_GetSelectionIndex CONTROL VAR
789
	SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR}
790
!macroend
791

    
792

    
793
!define NSD_LB_SetSelectionIndex `!insertmacro __NSD_LB_SetSelectionIndex `
794
!macro __NSD_LB_SetSelectionIndex CONTROL INDEX
795
	SendMessage ${CONTROL} ${LB_SETCURSEL} ${INDEX} 0
796
!macroend
797

    
798

    
799
!define NSD_LB_GetSelectionCount `!insertmacro __NSD_LB_GetSelectionCount `
800
!macro __NSD_LB_GetSelectionCount CONTROL VAR
801
	SendMessage ${CONTROL} ${LB_GETSELCOUNT} 0 0 ${VAR}
802
!macroend
803

    
804

    
805
!define NSD_LB_GetItemText `!insertmacro __NSD_LB_GetItemText `
806
!macro __NSD_LB_GetItemText CONTROL INDEX VAR
807
	System::Call 'user32::SendMessage(p${CONTROL}, i${LB_GETTEXT}, p${INDEX}, t.s)'
808
	Pop ${VAR}
809
!macroend
810

    
811

    
812
!define NSD_LB_GetItemData `!insertmacro __NSD_LB_GetItemData `
813
!macro __NSD_LB_GetItemData CONTROL INDEX VAR
814
SendMessage ${CONTROL} ${LB_GETITEMDATA} ${INDEX} 0 ${VAR}
815
!macroend
816
!define NSD_LB_SetItemData `${__NSD_MkCtlCmd_WPLP} LB_SETITEMDATA ` ; Index Data
817

    
818

    
819
!define NSD_LB_FindStringPrefix `!insertmacro __NSD_LB_FindStringPrefix `
820
!macro __NSD_LB_FindStringPrefix CONTROL STRING VAR
821
	SendMessage ${CONTROL} ${LB_FINDSTRING} -1 `STR:${STRING}` ${VAR}
822
!macroend
823

    
824

    
825
!define NSD_LB_FindStringExact `!insertmacro __NSD_LB_FindStringExact `
826
!macro __NSD_LB_FindStringExact CONTROL STRING VAR
827
	SendMessage ${CONTROL} ${LB_FINDSTRINGEXACT} -1 `STR:${STRING}` ${VAR}
828
!macroend
829

    
830

    
831
### ProgressBar ###
832

    
833
!define NSD_ProgressBar_SetPos `${__NSD_MkCtlCmd_WP} PBM_SETPOS 0 `
834
!define NSD_ProgressBar_SetStep `${__NSD_MkCtlCmd_WP} PBM_SETSTEP 0 `
835
!define NSD_ProgressBar_StepIt `${__NSD_MkCtlCmd} PBM_STEPIT 0 0 `
836
!define NSD_ProgressBar_AdvanceBy `${__NSD_MkCtlCmd_WP} PBM_DELTAPOS 0 `
837
!define NSD_ProgressBar_SetPackedRange `${__NSD_MkCtlCmd_LP} PBM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max)
838
!define NSD_ProgressBar_SetRange32 `${__NSD_MkCtlCmd_WPLP} PBM_SETRANGE32 ` ; [IE3+] WP:min LP:max
839
!define NSD_ProgressBar_GetPos `${__NSD_MkCtlCmd_RV} PBM_GETPOS 0 0 ` ; [IE3+]
840

    
841

    
842
### Animation ###
843

    
844
!define NSD_Anim_Close `${__NSD_MkCtlCmd} ACM_OPEN 0 0 `
845
!define NSD_Anim_Play `${__NSD_MkCtlCmd} ACM_PLAY -1 0xFFFF0000 `
846
!define NSD_Anim_PlayLoops `${__NSD_MkCtlCmd_WP} ACM_PLAY 0xFFFF0000 ` ; WP(UINT16):LoopCount
847
!define NSD_Anim_Stop `${__NSD_MkCtlCmd} ACM_STOP 0 0 `
848
!define NSD_Anim_IsPlaying `${__NSD_MkCtlCmd_RV} ACM_ISPLAYING 0 0 `
849

    
850
!define NSD_Anim_OpenFile `!insertmacro __NSD_Anim_OpenFile `
851
!macro __NSD_Anim_OpenFile CONTROL PATH
852
	SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}"
853
!macroend
854

    
855
!define NSD_Anim_OpenResource `!insertmacro __NSD_Anim_OpenResource `
856
!macro __NSD_Anim_OpenResource CONTROL HINSTANCE_CC471 RESID
857
	SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}"
858
!macroend
859

    
860

    
861
### TrackBar ###
862

    
863
!define NSD_TrackBar_GetPos `${__NSD_MkCtlCmd_RV} TBM_GETPOS 0 0 `
864
!define NSD_TrackBar_SetPos `${__NSD_MkCtlCmd_LP} TBM_SETPOS 1 `
865
!define NSD_TrackBar_SetRangeMin `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMIN 1 `
866
!define NSD_TrackBar_SetRangeMax `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMAX 1 `
867
!define NSD_TrackBar_GetLineSize `${__NSD_MkCtlCmd_RV} TBM_GETLINESIZE 0 0 `
868
!define NSD_TrackBar_SetLineSize `${__NSD_MkCtlCmd_LP} TBM_SETLINESIZE 0 `
869
!define NSD_TrackBar_GetPageSize `${__NSD_MkCtlCmd_RV} TBM_GETPAGESIZE 0 0 `
870
!define NSD_TrackBar_SetPageSize `${__NSD_MkCtlCmd_LP} TBM_SETPAGESIZE 0 `
871
!define NSD_TrackBar_ClearTics `${__NSD_MkCtlCmd} TBM_CLEARTICS 0 0 `
872
!define NSD_TrackBar_GetNumTics `${__NSD_MkCtlCmd_RV} TBM_GETNUMTICS 0 0 `
873
!define NSD_TrackBar_SetTic `${__NSD_MkCtlCmd_LP} TBM_SETTIC 0 `
874
!define NSD_TrackBar_SetTicFreq `${__NSD_MkCtlCmd_WP} TBM_SETTICFREQ 0 `
875
!define NSD_TrackBar_GetThumbLength `${__NSD_MkCtlCmd_RV} TBM_GETTHUMBLENGTH 0 0 `
876
!define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND
877

    
878

    
879
### UpDown ###
880

    
881
!define NSD_UD_SetBuddy `${__NSD_MkCtlCmd_WP} UDM_SETBUDDY 0 `
882
!define NSD_UD_GetPos `${__NSD_MkCtlCmd_RV} UDM_GETPOS 0 0 `
883
!define NSD_UD_SetPos `${__NSD_MkCtlCmd_LP} UDM_SETPOS 0 `
884
!define NSD_UD_GetPackedRange `${__NSD_MkCtlCmd_RV} UDM_GETRANGE 0 0 `
885
!define NSD_UD_SetPackedRange `${__NSD_MkCtlCmd_LP} UDM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max)
886
!define NSD_UD_GetPos32 `${__NSD_MkCtlCmd_RV} UDM_GETPOS32 0 0 `
887
!define NSD_UD_SetPos32 `${__NSD_MkCtlCmd_LP} UDM_SETPOS32 0 `
888
!define NSD_UD_SetRange32 `${__NSD_MkCtlCmd_WPLP} UDM_SETRANGE32 ` ; WP(INT32):min LP(INT32):max
889

    
890
!define NSD_UD_GetRange32 `!insertmacro __NSD_UD_GetRange32 `
891
!macro __NSD_UD_GetRange32 CONTROL OUTLO OUTHI
892
	System::Call 'USER32::SendMessage(p${CONTROL},i${UDM_GETRANGE32},*i.s,*i.s)'
893
	Pop ${OUTLO}
894
	Pop ${OUTHI}
895
!macroend
896

    
897
!define NSD_UD_SetStaticRange `!insertmacro __NSD_UD_SetStaticRange `
898
!macro __NSD_UD_SetStaticRange CONTROL MI MA
899
	!define /redef /math MI ${MI} << 16
900
	!define /redef /math MA ${MA} & 0xffff
901
	!define /redef /math MA ${MI} | ${MA}
902
	SendMessage ${CONTROL} ${UDM_SETRANGE} 0 ${MA}
903
!macroend
904

    
905

    
906
### HotKey ###
907

    
908
!define NSD_HK_GetHotKey `${__NSD_MkCtlCmd_RV} HKM_GETHOTKEY 0 0 ` ; RV(WORD):MAKEWORD(VK,HOTKEYF)
909
!define NSD_HK_SetHotKey `${__NSD_MkCtlCmd_WP} HKM_SETHOTKEY 0 `
910
!define NSD_HK_SetRules `${__NSD_MkCtlCmd_WPLP} HKM_SETRULES `
911

    
912

    
913
### IP Address ###
914

    
915
!define NSD_IPAddress_Clear `${__NSD_MkCtlCmd} IPM_CLEARADDRESS 0 0 `
916
!define NSD_IPAddress_SetPackedIPv4 `${__NSD_MkCtlCmd_LP} IPM_SETADDRESS 0 `
917
!define NSD_IPAddress_IsBlank `${__NSD_MkCtlCmd_RV} IPM_ISBLANK 0 0 `
918

    
919
!define NSD_IPAddress_GetPackedIPv4 `!insertmacro __NSD_IPAddress_GetPackedIPv4 `
920
!macro __NSD_IPAddress_GetPackedIPv4 CONTROL VAR
921
System::Call 'USER32::SendMessage(p${CONTROL},i${IPM_GETADDRESS},p0,*i0s)'
922
Pop ${VAR}
923
!macroend
924

    
925

    
926
### Date ###
927
!define NSD_Date_GetDateFields `!insertmacro __NSD_Date_GetDateFields `
928
!macro __NSD_Date_GetDateFields CONTROL
929
Push $0
930
System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)'
931
System::Call '*$0(&i2.s,&i2.s,&i2,&i2.s)'
932
Exch 3
933
Pop $0
934
!macroend
935

    
936
!define NSD_Time_GetTimeFields `!insertmacro __NSD_Time_GetTimeFields `
937
!macro __NSD_Time_GetTimeFields CONTROL
938
Push $0
939
System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)'
940
System::Call '*$0(&i2,&i2,&i2,&i2,&i2.s,&i2.s,&i2.s)'
941
Exch 3
942
Pop $0
943
Exch
944
!macroend
945

    
946

    
947
### Static ###
948

    
949
!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE
950
	!if "${_LIHINSTMODE}" == "exeresource"
951
		LoadAndSetImage /EXERESOURCE /STRINGID "${CONTROL}" ${_IMGTYPE} ${_LIFLAGS} "${IMAGE}" ${HANDLE}
952
	!else #if "${_LIHINSTMODE}" == "file"
953
		LoadAndSetImage /STRINGID "${CONTROL}" ${_IMGTYPE} ${_LIFLAGS} "${IMAGE}" ${HANDLE}
954
	!endif
955
!macroend
956

    
957
!macro __NSD_SetIconFromExeResource CONTROL IMAGE HANDLE
958
	LoadAndSetImage /EXERESOURCE /STRINGID "${CONTROL}" ${IMAGE_ICON} ${LR_DEFAULTSIZE} "${IMAGE}" ${HANDLE}
959
!macroend
960

    
961
!macro __NSD_SetIconFromInstaller CONTROL HANDLE
962
	LoadAndSetImage /EXERESOURCE "${CONTROL}" ${IMAGE_ICON} ${LR_DEFAULTSIZE} 103 ${HANDLE}
963
!macroend
964

    
965
!define NSD_SetImage `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_BITMAP} 0 "${LR_LOADFROMFILE}" `
966
!define NSD_SetBitmap `${NSD_SetImage} `
967

    
968
!define NSD_SetIcon `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_ICON} 0 "${LR_LOADFROMFILE}|${LR_DEFAULTSIZE}" `
969
!define NSD_SetIconFromExeResource `!insertmacro __NSD_SetIconFromExeResource `
970
!define NSD_SetIconFromInstaller `!insertmacro __NSD_SetIconFromInstaller `
971

    
972

    
973
!define NSD_SetStretchedImage `!insertmacro __NSD_SetStretchedImage `
974
!define NSD_SetStretchedBitmap `!insertmacro __NSD_SetStretchedImage `
975
!macro __NSD_SetStretchedImage CONTROL IMAGE HANDLE
976
	LoadAndSetImage /STRINGID /RESIZETOFIT "${CONTROL}" ${IMAGE_BITMAP} ${LR_LOADFROMFILE} "${IMAGE}" ${HANDLE}
977
!macroend
978

    
979

    
980
!define NSD_FreeImage `!insertmacro __NSD_FreeImage `
981
!define NSD_FreeBitmap `${NSD_FreeImage} `
982
!macro __NSD_FreeImage IMAGE
983
	${If} ${IMAGE} P<> 0
984
		System::Call gdi32::DeleteObject(ps) ${IMAGE}
985
	${EndIf}
986
!macroend
987

    
988

    
989
!define NSD_FreeIcon `!insertmacro __NSD_FreeIcon `
990
!macro __NSD_FreeIcon IMAGE
991
	System::Call user32::DestroyIcon(ps) ${IMAGE}
992
!macroend
993

    
994

    
995
!define NSD_ClearImage `!insertmacro __NSD_ClearImage ${IMAGE_BITMAP} `
996
!define NSD_ClearBitmap `${NSD_ClearImage} `
997
!define NSD_ClearIcon  `!insertmacro __NSD_ClearImage ${IMAGE_ICON } `
998
!macro __NSD_ClearImage _IMGTYPE CONTROL
999
	SendMessage ${CONTROL} ${STM_SETIMAGE} ${_IMGTYPE} 0
1000
!macroend
1001

    
1002

    
1003
### INI ###
1004

    
1005
!define /IfNDef NSD_Debug `System::Call kernel32::OutputDebugString(ts)`
1006

    
1007
!macro __NSD_ControlCase TYPE
1008
	${Case} ${TYPE}
1009
		${NSD_Create${TYPE}} $R3u $R4u $R5u $R6u $R7
1010
		Pop $R9
1011
		${Break}
1012
!macroend
1013

    
1014
!macro __NSD_ControlCaseEx TYPE
1015
	${Case} ${TYPE}
1016
		Call ${TYPE}
1017
		${Break}
1018
!macroend
1019

    
1020
!macro NSD_FUNCTION_INIFILE
1021
	!insertmacro NSD_INIFILE ""
1022
!macroend
1023

    
1024
!macro NSD_UNFUNCTION_INIFILE
1025
	!insertmacro NSD_INIFILE un.
1026
!macroend
1027

    
1028
!macro NSD_INIFILE UNINSTALLER_FUNCPREFIX
1029

    
1030
	;Functions to create dialogs based on old InstallOptions INI files
1031

    
1032
	Function ${UNINSTALLER_FUNCPREFIX}CreateDialogFromINI
1033

    
1034
		# $0 = ini
1035

    
1036
		ReadINIStr $R0 $0 Settings RECT
1037
		${If} $R0 == ""
1038
			StrCpy $R0 1018
1039
		${EndIf}
1040

    
1041
		nsDialogs::Create $R0
1042
		Pop $R9
1043

    
1044
		ReadINIStr $R0 $0 Settings RTL
1045
		nsDialogs::SetRTL $R0
1046

    
1047
		ReadINIStr $R0 $0 Settings NumFields
1048

    
1049
		${NSD_Debug} "NumFields = $R0"
1050

    
1051
		${For} $R1 1 $R0
1052
			${NSD_Debug} "Creating field $R1"
1053
			ReadINIStr $R2 $0 "Field $R1" Type
1054
			${NSD_Debug} "  Type = $R2"
1055
			ReadINIStr $R3 $0 "Field $R1" Left
1056
			${NSD_Debug} "  Left = $R3"
1057
			ReadINIStr $R4 $0 "Field $R1" Top
1058
			${NSD_Debug} "  Top = $R4"
1059
			ReadINIStr $R5 $0 "Field $R1" Right
1060
			${NSD_Debug} "  Right = $R5"
1061
			ReadINIStr $R6 $0 "Field $R1" Bottom
1062
			${NSD_Debug} "  Bottom = $R6"
1063
			IntOp $R5 $R5 - $R3
1064
			${NSD_Debug} "  Width = $R5"
1065
			IntOp $R6 $R6 - $R4
1066
			${NSD_Debug} "  Height = $R6"
1067
			ReadINIStr $R7 $0 "Field $R1" Text
1068
			${NSD_Debug} "  Text = $R7"
1069
			${Switch} $R2
1070
				!insertmacro __NSD_ControlCase   HLine
1071
				!insertmacro __NSD_ControlCase   VLine
1072
				!insertmacro __NSD_ControlCase   Label
1073
				!insertmacro __NSD_ControlCase   Icon
1074
				!insertmacro __NSD_ControlCase   Bitmap
1075
				!insertmacro __NSD_ControlCaseEx Link
1076
				!insertmacro __NSD_ControlCase   Button
1077
				!insertmacro __NSD_ControlCase   GroupBox
1078
				!insertmacro __NSD_ControlCase   CheckBox
1079
				!insertmacro __NSD_ControlCase   RadioButton
1080
				!insertmacro __NSD_ControlCase   Text
1081
				!insertmacro __NSD_ControlCase   Password
1082
				!insertmacro __NSD_ControlCaseEx FileRequest
1083
				!insertmacro __NSD_ControlCaseEx DirRequest
1084
				!insertmacro __NSD_ControlCase   ComboBox
1085
				!insertmacro __NSD_ControlCase   DropList
1086
				!insertmacro __NSD_ControlCase   ListBox
1087
			${EndSwitch}
1088

    
1089
			WriteINIStr $0 "Field $R1" HWND $R9
1090
		${Next}
1091

    
1092
		nsDialogs::Show
1093

    
1094
	FunctionEnd
1095

    
1096
	Function ${UNINSTALLER_FUNCPREFIX}UpdateINIState
1097

    
1098
		${NSD_Debug} "Updating INI state"
1099

    
1100
		ReadINIStr $R0 $0 Settings NumFields
1101

    
1102
		${NSD_Debug} "NumField = $R0"
1103

    
1104
		${For} $R1 1 $R0
1105
			ReadINIStr $R2 $0 "Field $R1" HWND
1106
			ReadINIStr $R3 $0 "Field $R1" "Type"
1107
			${Switch} $R3
1108
				${Case} "CheckBox"
1109
				${Case} "RadioButton"
1110
					${NSD_Debug} "  HWND = $R2"
1111
					${NSD_GetState} $R2 $R2
1112
					${NSD_Debug} "  Window selection = $R2"
1113
				${Break}
1114
				${CaseElse}
1115
					${NSD_Debug} "  HWND = $R2"
1116
					${NSD_GetText} $R2 $R2
1117
					${NSD_Debug} "  Window text = $R2"
1118
				${Break}
1119
			${EndSwitch}
1120
			WriteINIStr $0 "Field $R1" STATE $R2
1121
		${Next}
1122

    
1123
	FunctionEnd
1124

    
1125
	Function ${UNINSTALLER_FUNCPREFIX}FileRequest
1126

    
1127
		IntOp $R5 $R5 - 15
1128
		IntOp $R8 $R3 + $R5
1129

    
1130
		${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ...
1131
		Pop $R8
1132

    
1133
		nsDialogs::SetUserData $R8 $R1 # remember field id
1134

    
1135
		WriteINIStr $0 "Field $R1" HWND2 $R8
1136

    
1137
		${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton
1138

    
1139
		ReadINIStr $R9 $0 "Field $R1" State
1140

    
1141
		${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9
1142
		Pop $R9
1143

    
1144
	FunctionEnd
1145

    
1146
	Function ${UNINSTALLER_FUNCPREFIX}DirRequest
1147

    
1148
		IntOp $R5 $R5 - 15
1149
		IntOp $R8 $R3 + $R5
1150

    
1151
		${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ...
1152
		Pop $R8
1153

    
1154
		nsDialogs::SetUserData $R8 $R1 # remember field id
1155

    
1156
		WriteINIStr $0 "Field $R1" HWND2 $R8
1157

    
1158
		${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton
1159

    
1160
		ReadINIStr $R9 $0 "Field $R1" State
1161

    
1162
		${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9
1163
		Pop $R9
1164

    
1165
	FunctionEnd
1166

    
1167
	Function ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton
1168

    
1169
		Pop $R0
1170

    
1171
		nsDialogs::GetUserData $R0
1172
		Pop $R1
1173

    
1174
		ReadINIStr $R2 $0 "Field $R1" HWND
1175
		ReadINIStr $R4 $0 "Field $R1" Filter
1176

    
1177
		${NSD_GetText} $R2 $R3
1178

    
1179
		nsDialogs::SelectFileDialog save $R3 $R4
1180
		Pop $R3
1181

    
1182
		${If} $R3 != ""
1183
			SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3
1184
		${EndIf}
1185

    
1186
	FunctionEnd
1187

    
1188
	Function ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton
1189

    
1190
		Pop $R0
1191

    
1192
		nsDialogs::GetUserData $R0
1193
		Pop $R1
1194

    
1195
		ReadINIStr $R2 $0 "Field $R1" HWND
1196
		ReadINIStr $R3 $0 "Field $R1" Text
1197

    
1198
		${NSD_GetText} $R2 $R4
1199

    
1200
		nsDialogs::SelectFolderDialog $R3 $R4
1201
		Pop $R3
1202

    
1203
		${If} $R3 != error
1204
			SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3
1205
		${EndIf}
1206

    
1207
	FunctionEnd
1208

    
1209
	Function ${UNINSTALLER_FUNCPREFIX}Link
1210

    
1211
		${NSD_CreateLink} $R3u $R4u $R5u $R6u $R7
1212
		Pop $R9
1213

    
1214
		nsDialogs::SetUserData $R9 $R1 # remember field id
1215

    
1216
		${NSD_OnClick} $R9 ${UNINSTALLER_FUNCPREFIX}OnLink
1217

    
1218
	FunctionEnd
1219

    
1220
	Function ${UNINSTALLER_FUNCPREFIX}OnLink
1221

    
1222
		Pop $R0
1223

    
1224
		nsDialogs::GetUserData $R0
1225
		Pop $R1
1226

    
1227
		ReadINIStr $R1 $0 "Field $R1" STATE
1228

    
1229
		ExecShell "" $R1
1230

    
1231
	FunctionEnd
1232

    
1233
!macroend
1234

    
1235
!verbose pop
1236
!endif