Added HotKey and IPAddress NSD controls

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6902 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-09-16 17:59:03 +00:00
parent 0bc1198413
commit 47630407be
3 changed files with 117 additions and 37 deletions

View file

@ -73,18 +73,18 @@ code
<li><a href="#mref-gettext">NSD_GetText</a></li>
<li><a href="#mref-settext">NSD_SetText</a></li>
<li><a href="#mref-settextlimit">NSD_SetTextLimit</a></li>
<li>CheckBox &amp; RadioButton:
<li>CheckBox &amp; RadioButton:
<a href="#mref-getstate">NSD_GetState</a>,
<a href="#mref-setstate">NSD_SetState</a>,
<a href="#mref-check">NSD_Check</a>,
<a href="#mref-uncheck">NSD_Uncheck</a>
</li>
<li>ComboBox &amp; DropList:
<li>ComboBox &amp; DropList:
<a href="#mref-cbaddstring">NSD_CB_AddString</a>,
<a href="#mref-cbselectstring">NSD_CB_SelectString</a>,
<a href="#mref-cbgetcount">NSD_CB_GetCount</a>
</li>
<li>ListBox:
<li>ListBox:
<a href="#mref-lbaddstring">NSD_LB_AddString</a>,
<a href="#mref-lbinsstring">NSD_LB_InsertString</a>,
<a href="#mref-lbdelstring">NSD_LB_DelString</a>,
@ -94,18 +94,21 @@ code
<a href="#mref-lbselectstring">NSD_LB_SelectString</a>,
<a href="#mref-lbgetselection">NSD_LB_GetSelection</a>
</li>
<li>Animation:
<li>Animation:
<a href="#mref-animopenfile">NSD_Anim_OpenFile</a>,
<a href="#mref-animplay">NSD_Anim_Play</a>,
<a href="#mref-animstop">NSD_Anim_Stop</a>
</li>
<li>HTrackBar &amp; VTrackBar:
<li>HTrackBar &amp; VTrackBar:
<a href="#mref-trackgetpos">NSD_TrackBar_GetPos</a>,
<a href="#mref-tracksetpos">NSD_TrackBar_SetPos</a>,
<a href="#mref-tracksetrmin">NSD_TrackBar_SetRangeMin</a>,
<a href="#mref-tracksetrmax">NSD_TrackBar_SetRangeMax</a>,
<a href="#mref-tracksetticfr">NSD_TrackBar_SetTicFreq</a>
</li>
<li>HotKey:
<a href="#mref-hkgethk">NSD_HotKey_GetHotKey</a>, <a href="#mref-hksethk">NSD_HotKey_SetHotKey</a>
</li>
<li><a href="#mref-setimage">NSD_SetImage</a></li>
<li><a href="#mref-setsimage">NSD_SetStretchedImage</a></li>
<li><a href="#mref-seticon">NSD_SetIcon</a></li>
@ -125,7 +128,7 @@ code
<p>nsDialogs is a new NSIS plug-in, introduced in version 2.29 as a replacement for <a href="../InstallOptions/Readme.html">InstallOptions</a>. nsDialogs doesn't use INI files, so it's way faster than InstallOptions. Integration with the script is tighter and more natural - creating controls is done using plug-in functions and notification is done by directly calling a function in the script. Unlike InstallOptions, there isn't a predefined set of available control type and by providing a lower level access to Windows API, every type of control can be created and pages can be more customizable.</p>
<p>The same thing that makes nsDialogs more flexible can also make it more complicated for users with no knowledge of Win32 API. This is solved by creating a library of predefined functions, defined in script, that allow creation and handling of controls. This way, novices get easy access to the flexibility, while advanced users still get access to the core functionality by modifying the library or simply avoid using it.</p>
<p>The same thing that makes nsDialogs more flexible can also make it more complicated for users with no knowledge of Win32 API. This is solved by creating a library of predefined functions, defined in script, that allow creation and handling of controls. This way, novices get easy access to the flexibility, while advanced users still get access to the <a href="http://msdn.microsoft.com/en-us/library/bb773169">core functionality</a> by modifying the library or simply avoid using it.</p>
<h2><a name="step"></a>Step-by-Step Tutorial</h2>
@ -286,34 +289,34 @@ Section
SectionEnd</pre></blockquote>
<p>Available control types that can be created with <a href="#mref-create">${NSD_Create*}</a> are:</p>
<ul>
<li>HLine</li>
<li>VLine</li>
<li>Label</li>
<li>Icon</li>
<li>Bitmap</li>
<li>BrowseButton</li>
<li>Link</li>
<li>Button</li>
<li>GroupBox</li>
<li>CheckBox</li>
<li>RadioButton</li>
<li>Text</li>
<li>Password</li>
<li>Number</li>
<li>FileRequest</li>
<li>DirRequest</li>
<li>ComboBox</li>
<li>DropList</li>
<li>ListBox</li>
<li>SortedListBox</li>
<li>ProgressBar</li>
<li>Animation</li>
<li>HTrackBar</li>
<li>VTrackBar</li>
</ul>
<p>Available control types that can be created with <a href="#mref-create">${NSD_Create*}</a> are:
HLine,
VLine,
Label,
Icon,
Bitmap,
BrowseButton,
Link,
Button,
GroupBox,
CheckBox,
RadioButton,
Text,
Password,
Number,
FileRequest,
DirRequest,
ComboBox,
DropList,
ListBox,
SortedListBox,
ProgressBar,
Animation,
HTrackBar,
VTrackBar,
HotKey,
IPAddress.
</p>
<h3><a name="step-state"></a>Control State</h3>
@ -674,6 +677,8 @@ SectionEnd</pre></blockquote>
<li>${NSD_CreateAnimation}</li>
<li>${NSD_CreateHTrackBar}</li>
<li>${NSD_CreateVTrackBar}</li>
<li>${NSD_CreateHotKey}</li>
<li>${NSD_CreateIPAddress} <small>(Requires IE4)</small></li>
</ul>
<p>Returns the new control's HWND on the stack or <i>error</i></p>
@ -894,6 +899,16 @@ SectionEnd</pre></blockquote>
<p>Sets the interval frequency for tick marks.</p>
<h3><a name="mref-hkgethk">NSD_HotKey_GetHotKey</a></h3>
<p><code>${NSD_HotKey_GetHotKey} <i>hk_HWND</i> <i>output</i></code></p>
<p>Bits 0..7 specify the virtual key code and bits 8..15 specify the HOTKEYF modifier flags.</p>
<h3><a name="mref-hksethk">NSD_HotKey_SetHotKey</a></h3>
<p><code>${NSD_HotKey_SetHotKey} <i>hk_HWND</i> <i>packedhotkey</i></code></p>
<h3><a name="mref-setimage"></a>NSD_SetImage</h3>
<p><code>${NSD_SetImage} <i>control_HWND</i> <i>image_path</i> <i>output_variable</i></code></p>

View file

@ -305,6 +305,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_HotKey_CLASS msctls_hotkey32
!define __NSD_HotKey_STYLE ${DEFAULT_STYLES}
!define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define __NSD_IPAddress_CLASS SysIPAddress32 ; IE4+/CC4.71+
!define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}
!define __NSD_IPAddress_EXSTYLE 0
!macro __NSD_DefineControl NAME
!define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
@ -333,6 +341,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 HotKey
!insertmacro __NSD_DefineControl IPAddress
!macro __NSD_OnControlEvent EVENT HWND FUNCTION
@ -638,6 +648,16 @@ SendMessage ${CONTROL} ${LB_SETITEMDATA} ${INDEX} ${DATA}
!macroend
### 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 `
!define NSD_ProgressBar_AdvanceBy `${__NSD_MkCtlCmd_WP} PBM_DELTAPOS 0 `
!define NSD_ProgressBar_SetPackedRange `${__NSD_MkCtlCmd_LP} PBM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max)
!define NSD_ProgressBar_SetRange32 `${__NSD_MkCtlCmd_WPLP} PBM_SETRANGE32 ` ; [IE3+] WP:min LP:max
!define NSD_ProgressBar_GetPos `${__NSD_MkCtlCmd_RV} PBM_GETPOS 0 0 ` ; [IE3+]
### Animation ###
!define NSD_Anim_Close `${__NSD_MkCtlCmd} ACM_OPEN 0 0 `
@ -675,6 +695,26 @@ SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}"
!define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND
### 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 `
### IP Address ###
!define NSD_IPAddress_Clear `${__NSD_MkCtlCmd} IPM_CLEARADDRESS 0 0 `
!define NSD_IPAddress_SetPackedIPv4 `${__NSD_MkCtlCmd_LP} IPM_SETADDRESS 0 `
!define NSD_IPAddress_IsBlank `${__NSD_MkCtlCmd_RV} IPM_ISBLANK 0 0 `
!define NSD_IPAddress_GetPackedIPv4 `!insertmacro __NSD_IPAddress_GetPackedIPv4 `
!macro __NSD_IPAddress_GetPackedIPv4 CONTROL VAR
System::Call 'USER32::SendMessage(p${CONTROL},i${IPM_GETADDRESS},p0,*i0s)'
Pop ${VAR}
!macroend
### Static ###
!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE

View file

@ -43,6 +43,8 @@ TCM Tab control
PBM Progress bar
ACM Animation control
TBM Track bar
HKM Hot key control
IPM IP address control
-----------------------------------
NOT included messages (WM_USER + X)
@ -51,8 +53,6 @@ CBEM Extended combo box control
CDM Common dialog box
DL Drag list box
DTM Date and time picker control
HKM Hot key control
IPM IP address control
MCM Month calendar control
PGM Pager control
PSM Property sheet
@ -651,8 +651,8 @@ ${_NSIS_DEFAW} LVM_SETITEMTEXT
!define SBM_SETSCROLLINFO 0x00E9
#Static control#
!define STM_GETICON 0x0171
!define STM_SETICON 0x0170
!define STM_GETICON 0x0171
!define STM_SETIMAGE 0x0172
!define STM_GETIMAGE 0x0173
!define STM_MSGMAX 0x0174
@ -738,5 +738,30 @@ ${_NSIS_DEFAW} ACM_OPEN
!define TBM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4
!define /math TBM_SETPOSNOTIFY ${WM_USER} + 34 ; 7?
#HotKey control#
!define /math HKM_SETHOTKEY ${WM_USER} + 1
!define /math HKM_GETHOTKEY ${WM_USER} + 2
!define /math HKM_SETRULES ${WM_USER} + 3
!define /IfNDef HOTKEYF_SHIFT 0x01
!define /IfNDef HOTKEYF_CONTROL 0x02
!define /IfNDef HOTKEYF_ALT 0x04
!define /IfNDef HOTKEYF_EXT 0x08
!define HKCOMB_NONE 0x01
!define HKCOMB_S 0x02
!define HKCOMB_C 0x04
!define HKCOMB_A 0x08
!define HKCOMB_SC 0x10
!define HKCOMB_SA 0x20
!define HKCOMB_CA 0x40
!define HKCOMB_SCA 0x80
#IPAddress control#
!define /math IPM_CLEARADDRESS ${WM_USER} + 100
!define /math IPM_SETADDRESS ${WM_USER} + 101
!define /math IPM_GETADDRESS ${WM_USER} + 102
!define /math IPM_SETRANGE ${WM_USER} + 103
!define /math IPM_SETFOCUS ${WM_USER} + 104
!define /math IPM_ISBLANK ${WM_USER} + 105
!verbose pop
!endif