diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index 87f00aec..8a826242 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -81,21 +81,19 @@ code
Available control types that can be created with ${NSD_Create*} are: @@ -317,6 +310,7 @@ ProgressBar, Animation, HTrackBar, VTrackBar, +UpDown, HotKey, IPAddress.
@@ -369,9 +363,6 @@ FunctionEnd FunctionEnd Section - - DetailPrint "hello world" - SectionEndnsDialogs::Create rect
Creates a new dialog. rect specific the identifier of the control whose location will be mimiced. This should usually be 1018, which is control mimiced for creation of built-in pages. The Modern UI also has control 1044 for the welcome and the finish page.
-Returns the new dialog's HWND on the stack or error.
nsDialogs::CreateControl class style extended_style x y width height text
Create a new control in the current dialog. A dialog must exist for this to work, so nsDialogs::Create must be called prior to this function.
-Returns the new control's HWND on the stack or error.
nsDialogs::Show
Displays the page. Call this once finished with nsDialogs::Create, nsDialogs::CreateControl and the rest.
-Returns nothing.
nsDialogs::SelectFileDialog mode initial_selection filter
Displays a file selection dialog to the user. If mode is set to save, displays a file save dialog. If mode is set to open, displays a file open dialog. filter is a list of available file filters separated by pipes. If an empty string is passed, the default is used - All Files|*.*.
-initial_selection can be used to provide the user with a default file to look for and/or a default folder to look in. If initial_selection is empty no default filename will be provided for the user and the dialog will start in the current working directory. If initial_selection specifies just a filename, for example "test.exe", the dialog will be set up to look for a file called test.exe in the current working directory. If initial_selection specifies just a directory, for example "C:\Program Files", the dialog starts in the provided directory with no file name provided. If initial_selection specifies a directory and a filename, for example "C:\Windows\System32\calc.exe", the dialog will be set up to look for a file called calc.exe in the directory C:\Windows\System32.
-Returns the selected file on the stack or an empty string if the user canceled the operation.
nsDialogs::SelectFolderDialog title initial_selection
Displays a directory selection dialog to the user.
-Returns the selected directory on the stack or "error" in case the user canceled the operation or an error occured.
nsDialogs::SetRTL rtl_setting
Sets right-to-left mode on or off. If rtl_setting is 0, it's set to off. If rtl_setting is 1, it's set to on. This function must be called before any calls to nsDialogs::CreateControl.
-Returns nothing.
nsDialogs::GetUserData control_HWND
Returns user data associated with the control on the stack. Use nsDialogs::SetUserData to set this data.
nsDialogs::SetUserData control_HWND data
Associates data with the control. Use nsDialogs::GetUserData to get this data.
-Returns nothing.
nsDialogs::OnBack function_address
Sets the callback function for the Back button. This function will be called when the user clicks the back button. Call Abort in this function to prevent the user from going back to the last page.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs::OnChange control_HWND function_address
Sets a change notification callback function for the given control. Whenever the control changes, the function will be called and the control's HWND will be waiting on its stack.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs::OnClick control_HWND function_address
Sets a click notification callback function for the given control. Whenever the control is clicked, the function will be called and the control's HWND will be waiting on its stack.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs::OnNotify control_HWND function_address
Sets a notification callback function for the given control. Whenever the control receives the WM_NOTIFY message, the function will be called and the control's HWND, notification code and a pointer to the MNHDR structure will be waiting on its stack.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs::CreateTimer function_address timer_interval
Sets a timer that'd call the callback function for the given control every in a constant interval. Interval times are specified in milliseconds.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs::KillTimer function_address
Kills a previously set timer.
-Use GetFunctionAddress to get the address of the desired callback function.
-Returns nothing.
nsDialogs.nsh contains a lot of macros that can make nsDialogs usage a lot easier. Below is a description of each of those macros including purpose, syntax, input and output.
${NSD_Create*} x y width height text
Create a new control in the current dialog. A dialog must exist for this to work, so nsDialogs::Create must be called prior to this function.
-Available variants:
-Returns the new control's HWND on the stack or error
${NSD_OnBack} function_name
See OnBack for more details.
${NSD_OnChange} control_HWND function_name
See OnChange for more details.
-See Real-time Notification for usage example.
${NSD_OnClick} control_HWND function_name
See OnClick for more details.
${NSD_OnNotify} control_HWND function_name
See OnNotify for more details.
${NSD_SetFocus} control_HWND
Sets focus to a control.
${NSD_CreateTimer} function_name timer_interval
See CreateTimer for more details.
${NSD_KillTimer} function_name
See KillTimer for more details.
${NSD_AddStyle} control_HWND style
Adds one or more window styles to a control. Multiple styles should be separated with pipes `|'.
-See MSDN for style descriptions.
${NSD_AddExStyle} control_HWND style
Adds one or more extended window styles to a control. Multiple styles should be separated with pipes `|'.
-See MSDN for style descriptions.
${NSD_GetText} control_HWND output_variable
${NSD_GetText} control_HWND $output_variable
Retrieves the text of a control and stores it into output_variable. Especially useful for textual controls.
-See Control State for usage example.
${NSD_SetText} control_HWND text
Sets the text of a control.
${NSD_SetTextLimit} control_HWND limit
Sets input size limit for a text control.
${NSD_GetState} control_HWND output_variable
${NSD_GetState} control_HWND $output_variable
Retrieves the state of a check box or a radio button control. Possible outputs are ${BST_CHECKED} and ${BST_UNCHECKED}.
-See Memory for usage example.
${NSD_SetState} control_HWND state
Sets the state of a check box or a radio button control. Possible values for state are ${BST_CHECKED} and ${BST_UNCHECKED}.
-See Memory for usage example.
${NSD_Check} control_HWND
Checks a check box or a radio button control. Same as calling ${NSD_SetState} with ${BST_CHECKED}.
${NSD_Uncheck} control_HWND
Unchecks a check box or a radio button control. Same as calling ${NSD_SetState} with ${BST_UNCHECKED}.
-See Memory for usage example.
${NSD_CB_AddString} combo_HWND string
Adds a string to a combo box.
${NSD_CB_InsertString} combo_HWND index string
Insert a string in a specified position in a combo box.
${NSD_CB_SelectString} combo_HWND string
Selects a string in a combo box.
${NSD_CB_GetCount} combo_HWND output_variable
${NSD_CB_GetCount} combo_HWND $output_variable
${NSD_LB_AddString} listbox_HWND string
Adds a string to a list box.
${NSD_LB_InsertString} listbox_HWND index string
Insert a string in a specified position in a list box.
${NSD_LB_DelString} listbox_HWND string
Deletes a string from a list box.
${NSD_LB_DelItem} listbox_HWND itemindex
Deletes a string from a list box.
${NSD_LB_Clear} listbox_HWND
Deletes all strings from a list box.
${NSD_LB_GetCount} listbox_HWND output_variable
${NSD_LB_GetCount} listbox_HWND $output_variable
Retrieves the number of strings from a list box.
${NSD_LB_SelectString} listbox_HWND string
Selects a string in a list box.
${NSD_LB_GetSelection} listbox_HWND output_variable
${NSD_LB_GetSelection} listbox_HWND $output_variable
Retrieves the selected stringed from a list box. Returns an empty string if no string is selected.
${NSD_Anim_OpenFile} anim_HWND avi_path
Opens the specified (silent) .AVI movie clip.
${NSD_Anim_Play} anim_HWND
Plays the movie clip repeatedly.
${NSD_Anim_Stop} anim_HWND
Stops playback.
${NSD_TrackBar_GetPos} track_HWND output
${NSD_TrackBar_GetPos} track_HWND $output
${NSD_TrackBar_SetPos} track_HWND pos
${NSD_TrackBar_SetRangeMin} track_HWND minpos
${NSD_TrackBar_SetRangeMax} track_HWND maxpos
${NSD_TrackBar_SetTicFreq} track_HWND frequency
Sets the interval frequency for tick marks.
-${NSD_UD_SetBuddy} ud_HWND buddy_HWND
${NSD_HotKey_GetHotKey} hk_HWND output
${NSD_UD_GetPos} ud_HWND $output
${NSD_UD_SetPos} ud_HWND pos
${NSD_UD_SetPackedRange} ud_HWND packedrange
Sets the min-max range. Two signed 16-bit numbers packed into 32-bits.
+ +${NSD_HK_GetHotKey} hk_HWND $output
Bits 0..7 specify the virtual key code and bits 8..15 specify the HOTKEYF modifier flags.
-${NSD_HotKey_SetHotKey} hk_HWND packedhotkey
${NSD_HK_SetHotKey} hk_HWND packedhotkey
${NSD_SetImage} control_HWND image_path output_variable
${NSD_SetImage} control_HWND image_path $output_variable
Loads a bitmap from image_path and displays it on control_HWND created by ${NSD_CreateBitmap}. The image handle is stored in output_variable and should be freed using ${NSD_FreeImage} once no longer necessary.
-The image must be extracted to the user's computer prior to calling this macro. A good place to extract images is $PLUGINSDIR.
-!include nsDialogs.nsh Name nsDialogs OutFile nsDialogs.exe -XPStyle on - Page custom nsDialogsImage Page instfiles @@ -941,14 +803,11 @@ Var Image Var ImageHandle Function .onInit - InitPluginsDir File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis-r.bmp" - FunctionEnd Function nsDialogsImage - nsDialogs::Create 1018 Pop $Dialog @@ -963,52 +822,37 @@ Function nsDialogsImage nsDialogs::Show ${NSD_FreeImage} $ImageHandle - FunctionEnd Section SectionEnd
${NSD_SetStretchedImage} control_HWND image_path output_variable
${NSD_SetStretchedImage} control_HWND image_path $output_variable
Loads and displays a bitmap just like ${NSD_SetImage}, but stretched the image to fit the control.
+${NSD_ClearImage} control_HWND
Clears an image from a control.
+ +${NSD_FreeImage} image_handle
Frees an image handle previously loaded with ${NSD_SetImage} or ${NSD_SetStretchedImage}.
+${NSD_SetIcon} control_HWND image_path output_variable
${NSD_SetIcon} control_HWND image_path $output_variable
Same as ${NSD_SetImage}, but used for loading and setting an icon in a control created by ${NSD_CreateIcon}. The image handle is stored in output_variable and should be freed using ${NSD_FreeIcon} once no longer necessary.
${NSD_SetIconFromInstaller} control_HWND output_variable
${NSD_SetIconFromInstaller} control_HWND $output_variable
Loads the icon used in the installer and displays it on control_HWND created by ${NSD_CreateIcon}. The image handle is stored in output_variable and should be freed using ${NSD_FreeIcon} once no longer necessary.
-${NSD_ClearImage} control_HWND
Clears an image from a control.
-${NSD_ClearIcon} control_HWND
Clears an icon from a control.
-${NSD_FreeImage} image_handle
Frees an image handle previously loaded with ${NSD_SetImage} or ${NSD_SetStretchedImage}.
-${NSD_FreeIcon} icon_handle
Frees an icon handle previously loaded with ${NSD_SetIcon} or ${NSD_SetIconFromInstaller}.
diff --git a/Contrib/nsDialogs/example.nsi b/Contrib/nsDialogs/example.nsi index a1e73276..715500ec 100644 --- a/Contrib/nsDialogs/example.nsi +++ b/Contrib/nsDialogs/example.nsi @@ -1,5 +1,6 @@ !include nsDialogs.nsh !include LogicLib.nsh +!include WinCore.nsh ; MAKELONG Name "nsDialogs Example" OutFile "nsDialogs Example.exe" @@ -147,6 +148,14 @@ Function RangesPage Pop $2 ${NSD_CreateTimer} RangesTimer 1000 + ${NSD_CreateNumber} 1 40u 50u 12u "42" + Pop $3 + ${NSD_CreateUpDown} 0 0 0 0 "" + Pop $4 + ${NSD_UD_SetBuddy} $4 $3 + ${MAKELONG} $5 $0 50 0 ; 0..50 + ${NSD_UD_SetPackedRange} $4 $5 + nsDialogs::Show FunctionEnd diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index 8f716db0..f1d0a259 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -175,6 +175,16 @@ Header file for creating custom installer pages with nsDialogs !define TBS_NOTIFYBEFOREMOVE 0x0800 ; IE6? !define TBS_TRANSPARENTBKGND 0x1000 ; Vista +!define UDS_WRAP 0x0001 +!define UDS_SETBUDDYINT 0x0002 +!define UDS_ALIGNRIGHT 0x0004 +!define UDS_ALIGNLEFT 0x0008 +!define UDS_AUTOBUDDY 0x0010 +!define UDS_ARROWKEYS 0x0020 +!define UDS_HORZ 0x0040 +!define UDS_NOTHOUSANDS 0x0080 +!define UDS_HOTTRACK 0x0100 ; 98+ + !define /ifndef LR_DEFAULTCOLOR 0x0000 !define /ifndef LR_MONOCHROME 0x0001 !define /ifndef LR_COLOR 0x0002 @@ -305,6 +315,14 @@ Header file for creating custom installer pages with nsDialogs !define __NSD_VTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_VERT}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS} !define __NSD_VTrackBar_EXSTYLE 0 +!define __NSD_UpDown_CLASS msctls_updown32 +!define __NSD_UpDown_STYLE ${DEFAULT_STYLES}|${UDS_SETBUDDYINT}|${UDS_ARROWKEYS}|${UDS_NOTHOUSANDS}|${UDS_ALIGNRIGHT} +!define __NSD_UpDown_EXSTYLE 0 + +!define __NSD_AutoUpDown_CLASS msctls_updown32 +!define __NSD_AutoUpDown_STYLE ${__NSD_UpDown_STYLE}|${UDS_AUTOBUDDY} +!define __NSD_AutoUpDown_EXSTYLE ${__NSD_UpDown_EXSTYLE} + !define __NSD_HotKey_CLASS msctls_hotkey32 !define __NSD_HotKey_STYLE ${DEFAULT_STYLES} !define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} @@ -341,6 +359,8 @@ Header file for creating custom installer pages with nsDialogs !insertmacro __NSD_DefineControl Animation !insertmacro __NSD_DefineControl HTrackBar !insertmacro __NSD_DefineControl VTrackBar +!insertmacro __NSD_DefineControl UpDown +!insertmacro __NSD_DefineControl AutoUpDown !insertmacro __NSD_DefineControl HotKey !insertmacro __NSD_DefineControl IPAddress @@ -678,6 +698,7 @@ SendMessage ${CONTROL} ${LB_SETITEMDATA} ${INDEX} ${DATA} ### ProgressBar ### + !define NSD_ProgressBar_SetPos `${__NSD_MkCtlCmd_WP} PBM_SETPOS 0 ` !define NSD_ProgressBar_SetStep `${__NSD_MkCtlCmd_WP} PBM_SETSTEP 0 ` !define NSD_ProgressBar_StepIt `${__NSD_MkCtlCmd} PBM_STEPIT 0 0 ` @@ -697,12 +718,12 @@ SendMessage ${CONTROL} ${LB_SETITEMDATA} ${INDEX} ${DATA} !define NSD_Anim_OpenFile `!insertmacro __NSD_Anim_OpenFile ` !macro __NSD_Anim_OpenFile CONTROL PATH -SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}" + SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}" !macroend !define NSD_Anim_OpenResource `!insertmacro __NSD_Anim_OpenResource ` !macro __NSD_Anim_OpenResource CONTROL HINSTANCE_CC471 RESID -SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}" + SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}" !macroend @@ -724,11 +745,38 @@ SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}" !define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND +### UpDown ### + +!define NSD_UD_SetBuddy `${__NSD_MkCtlCmd_WP} UDM_SETBUDDY 0 ` +!define NSD_UD_GetPos `${__NSD_MkCtlCmd_RV} UDM_GETPOS 0 0 ` +!define NSD_UD_SetPos `${__NSD_MkCtlCmd_LP} UDM_SETPOS 0 ` +!define NSD_UD_GetPackedRange `${__NSD_MkCtlCmd_RV} UDM_GETRANGE 0 0 ` +!define NSD_UD_SetPackedRange `${__NSD_MkCtlCmd_LP} UDM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max) +!define NSD_UD_GetPos32 `${__NSD_MkCtlCmd_RV} UDM_GETPOS32 0 0 ` +!define NSD_UD_SetPos32 `${__NSD_MkCtlCmd_LP} UDM_SETPOS32 0 ` +!define NSD_UD_SetRange32 `${__NSD_MkCtlCmd_WPLP} UDM_SETRANGE32 ` ; WP(INT32):min LP(INT32):max + +!define NSD_UD_GetRange32 `!insertmacro __NSD_UD_GetRange32 ` +!macro __NSD_UD_GetRange32 CONTROL OUTLO OUTHI + System::Call 'USER32::SendMessage(p${CONTROL},i${UDM_GETRANGE32},*i.s,*i.s)' + Pop ${OUTLO} + Pop ${OUTHI} +!macroend + +!define NSD_UD_SetStaticRange `!insertmacro __NSD_UD_SetStaticRange ` +!macro __NSD_UD_SetStaticRange CONTROL MI MA + !define /redef /math MI ${MI} << 16 + !define /redef /math MA ${MA} & 0xffff + !define /redef /math MA ${MI} | ${MA} + SendMessage ${CONTROL} ${UDM_SETRANGE} 0 ${MA} +!macroend + + ### HotKey ### -!define NSD_HotKey_GetHotKey `${__NSD_MkCtlCmd_RV} HKM_GETHOTKEY 0 0 ` ; RV(WORD):MAKEWORD(VK,HOTKEYF) -!define NSD_HotKey_SetHotKey `${__NSD_MkCtlCmd_WP} HKM_SETHOTKEY 0 ` -!define NSD_HotKey_SetRules `${__NSD_MkCtlCmd_WPLP} HKM_SETRULES ` +!define NSD_HK_GetHotKey `${__NSD_MkCtlCmd_RV} HKM_GETHOTKEY 0 0 ` ; RV(WORD):MAKEWORD(VK,HOTKEYF) +!define NSD_HK_SetHotKey `${__NSD_MkCtlCmd_WP} HKM_SETHOTKEY 0 ` +!define NSD_HK_SetRules `${__NSD_MkCtlCmd_WPLP} HKM_SETRULES ` ### IP Address ### @@ -777,7 +825,7 @@ Pop ${VAR} !macroend !define NSD_SetImage `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_BITMAP} 0 "${LR_LOADFROMFILE}" ` -!define NSD_SetBitmap `${NSD_SetImage}` +!define NSD_SetBitmap `${NSD_SetImage} ` !define NSD_SetIcon `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_ICON} 0 "${LR_LOADFROMFILE}|${LR_DEFAULTSIZE}" ` !define NSD_SetIconFromExeResource `!insertmacro __NSD_SetIconFromExeResource ` @@ -822,6 +870,7 @@ Pop ${VAR} !define NSD_ClearImage `!insertmacro __NSD_ClearImage ${IMAGE_BITMAP} ` +!define NSD_ClearBitmap `${NSD_ClearImage} ` !define NSD_ClearIcon `!insertmacro __NSD_ClearImage ${IMAGE_ICON } ` !macro __NSD_ClearImage _IMGTYPE CONTROL SendMessage ${CONTROL} ${STM_SETIMAGE} ${_IMGTYPE} 0 diff --git a/Include/WinMessages.nsh b/Include/WinMessages.nsh index a54b245a..ee9e79b7 100644 --- a/Include/WinMessages.nsh +++ b/Include/WinMessages.nsh @@ -43,6 +43,7 @@ TCM Tab control PBM Progress bar ACM Animation control TBM Track bar +UDM Up-down control HKM Hot key control IPM IP address control ----------------------------------- @@ -60,7 +61,6 @@ RB Rebar control TB Toolbar TTM Tooltip control TVM Tree-view control -UDM Up-down control ----------------------------------- */ @@ -738,6 +738,24 @@ ${_NSIS_DEFAW} ACM_OPEN !define TBM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4 !define /math TBM_SETPOSNOTIFY ${WM_USER} + 34 ; 7? +#UpDown controls# +!define /math UDM_SETRANGE ${WM_USER} + 101 +!define /math UDM_GETRANGE ${WM_USER} + 102 +!define /math UDM_SETPOS ${WM_USER} + 103 +!define /math UDM_GETPOS ${WM_USER} + 104 +!define /math UDM_SETBUDDY ${WM_USER} + 105 +!define /math UDM_GETBUDDY ${WM_USER} + 106 +!define /math UDM_SETACCEL ${WM_USER} + 107 +!define /math UDM_GETACCEL ${WM_USER} + 108 +!define /math UDM_SETBASE ${WM_USER} + 109 +!define /math UDM_GETBASE ${WM_USER} + 110 +!define /math UDM_SETRANGE32 ${WM_USER} + 111 ; IE4 +!define /math UDM_GETRANGE32 ${WM_USER} + 112 ; IE4 +!define UDM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4 +!define UDM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4 +!define /math UDM_SETPOS32 ${WM_USER} + 113 ; IE5 +!define /math UDM_GETPOS32 ${WM_USER} + 114 ; IE5 + #HotKey control# !define /math HKM_SETHOTKEY ${WM_USER} + 1 !define /math HKM_GETHOTKEY ${WM_USER} + 2