Added NSD NetAddress control and Date macros

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7177 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-04-27 12:36:57 +00:00
parent b3044b36c1
commit 3d93d9c010
3 changed files with 80 additions and 35 deletions

View file

@ -6,7 +6,7 @@
<style type="text/css">
body { color: #000000; background-color: #ffffff; }
b { color: red; }
code { margin-left: 1.2em; padding: 0.5em; background-color: #f0f0f0; display:inline-block; }
code { margin-left: 1.2em; padding: 0.5em; background-color: #f0f0f0; display:inline-block; font-size:95%; }
span.inlcod i { padding: 0px 0.2em; color: #222222; font-family: monospace; font-style: normal; }
blockquote pre { background-color: #fcfcfc; font-family: monospace; }
abbr { font-variant: none; cursor: help; }
@ -115,11 +115,14 @@ NSD_CB_Clear,
<li>HotKey:
<a href="#mref-hkgethk">NSD_HK_GetHotKey</a>, <a href="#mref-hksethk">NSD_HK_SetHotKey</a>
</li>
<li>DatePicker:
<a href="#mref-dategetdatefields">NSD_Date_GetDateFields</a>
</li>
<li>Bitmap:
<a href="#mref-setimage">NSD_SetImage</a>,
<a href="#mref-setsimage">NSD_SetStretchedImage</a>,
<a href="#mref-clearimage">NSD_ClearImage</a>,
<a href="#mref-freeimage">NSD_FreeImage</a>
<a href="#mref-setbitmap">NSD_SetBitmap</a>,
<a href="#mref-setsbitmap">NSD_SetStretchedBitmap</a>,
<a href="#mref-clearbitmap">NSD_ClearBitmap</a>,
<a href="#mref-freebitmap">NSD_FreeBitmap</a>
</li>
<li>Icon:
<a href="#mref-seticon">NSD_SetIcon</a>,
@ -252,9 +255,10 @@ Animation,
HTrackBar,
VTrackBar,
UpDown,
HotKey,
DatePicker,
IPAddress.
HotKey,
DatePicker,
IPAddress,
NetAddress.
</p>
<h3><a name="step-state"></a>Control State</h3>
@ -563,8 +567,9 @@ StrCmp $0 "" ...
<li>${NSD_CreateVTrackBar}</li>
<li>${NSD_CreateUpDown}</li>
<li>${NSD_CreateHotKey}</li>
<li>${NSD_CreateDatePicker} <small>(Requires <abbr title="Internet Explorer">IE</abbr> 3.1)</small></li>
<li>${NSD_CreateIPAddress} <small>(Requires <abbr title="Internet Explorer">IE</abbr> 4)</small></li>
<li>${NSD_CreateDatePicker} <small>(Requires <abbr title="Internet Explorer">IE</abbr> 3.1 and <span class="inlcod"><i>${NSD_InitCommonControlsEx}</i></span>)</small></li>
<li>${NSD_CreateIPAddress} <small>(Requires <abbr title="Internet Explorer">IE</abbr> 4 and <span class="inlcod"><i>${NSD_InitCommonControl_IPAddress}</i></span>)</small></li>
<li>${NSD_CreateNetAddress} <small>(Requires Vista and <span class="inlcod"><i>${NSD_InitCommonControl_NetAddress}</i></span>)</small></li>
</ul>
<p>Returns the new control's HWND on the stack or <i>error</i></p>
@ -768,9 +773,13 @@ StrCmp $0 "" ...
<h3><a name="mref-hksethk">NSD_HK_SetHotKey</a></h3>
<p><code>${NSD_HK_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>
<p>Loads a bitmap from <i>image_path</i> and displays it on <i>control_HWND</i> created by <a href="#mref-create">${NSD_CreateBitmap}</a>. The image handle is stored in <i>output_variable</i> and should be freed using <a href="#mref-freeimage">${NSD_FreeImage}</a> once no longer necessary.</p>
<h3><a name="mref-dategetdatefields">NSD_Date_GetDateFields</a></h3>
<p><code>${NSD_Date_GetDateFields} <i>HWND</i></code></p>
<p>Returns the month, day and year on the stack.</p>
<h3><a name="mref-setbitmap"></a><a name="mref-setimage"></a>NSD_SetBitmap</h3>
<p><code>${NSD_SetBitmap} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Loads a bitmap from <i>image_path</i> and displays it on <i>control_HWND</i> created by <a href="#mref-create">${NSD_CreateBitmap}</a>. The image handle is stored in <i>output_variable</i> and should be freed using <a href="#mref-freebitmap">${NSD_FreeBitmap}</a> once no longer necessary.</p>
<p>The image must be extracted to the user's computer prior to calling this macro. A good place to extract images is $PLUGINSDIR.</p>
<blockquote><pre>!include nsDialogs.nsh
@ -781,8 +790,8 @@ Page custom nsDialogsImage
Page instfiles
Var Dialog
Var Image
Var ImageHandle
Var ImageCtrl
Var BmpHandle
Function .onInit
InitPluginsDir
@ -798,28 +807,28 @@ Function nsDialogsImage
${EndIf}
${NSD_CreateBitmap} 0 0 100% 100% ""
Pop $Image
${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $ImageHandle
Pop $ImageCtrl
${NSD_SetBitmap} $ImageCtrl $PLUGINSDIR\image.bmp $BmpHandle
nsDialogs::Show
${NSD_FreeImage} $ImageHandle
${NSD_FreeBitmap} $BmpHandle
FunctionEnd
Section
SectionEnd</pre></blockquote>
<h3><a name="mref-setsimage"></a>NSD_SetStretchedImage</h3>
<p><code>${NSD_SetStretchedImage} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Loads and displays a bitmap just like <a href="#mref-setimage">${NSD_SetImage}</a>, but stretched the image to fit the control.</p>
<h3><a name="mref-setsbitmap"></a><a name="mref-setsimage"></a>NSD_SetStretchedBitmap</h3>
<p><code>${NSD_SetStretchedBitmap} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Loads and displays a bitmap just like <a href="#mref-setbitmap">${NSD_SetImage}</a> but stretches the image to fit the control.</p>
<h3><a name="mref-clearimage"></a>NSD_ClearImage</h3>
<p><code>${NSD_ClearImage} <i>control_HWND</i></code></p>
<p>Clears an image from a control.</p>
<h3><a name="mref-clearbitmap"></a><a name="mref-clearimage"></a>NSD_ClearBitmap</h3>
<p><code>${NSD_ClearBitmap} <i>control_HWND</i></code></p>
<p>Clears a bitmap from a image control.</p>
<h3><a name="mref-freeimage"></a>NSD_FreeImage</h3>
<h3><a name="mref-freebitmap"></a><a name="mref-freeimage"></a>NSD_FreeBitmap</h3>
<p><code>${NSD_FreeImage} <i>image_handle</i></code></p>
<p>Frees an image handle previously loaded with <a href="#mref-setimage">${NSD_SetImage}</a> or <a href="#mref-setsimage">${NSD_SetStretchedImage}</a>.</p>
<p>Frees an image handle previously loaded with <a href="#mref-setbitmap">${NSD_SetImage}</a> or <a href="#mref-setsbitmap">${NSD_SetStretchedBitmap}</a>.</p>
<h3><a name="mref-seticon"></a>NSD_SetIcon</h3>
<p><code>${NSD_SetIcon} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>

View file

@ -226,18 +226,22 @@ Header file for creating custom installer pages with nsDialogs
!define /ifndef GWL_STYLE -16
!define /ifndef GWL_EXSTYLE -20
!define /ifndef ICC_BAR_CLASSES 0x0004 ; Toolbar, Statusbar, Trackbar and ToolTip
!define /ifndef ICC_UPDOWN_CLASS 0x0010
!define /ifndef ICC_HOTKEY_CLASS 0x0040
!define /ifndef ICC_ANIMATE_CLASS 0x0080
#define /ifndef ICC_LISTVIEW_CLASSES 0x0001 ; SysListView32 and SysHeader32
#define /ifndef ICC_TREEVIEW_CLASSES 0x0002 ; SysTabControl32 and tooltips_class32
#define /ifndef ICC_BAR_CLASSES 0x0004 ; ToolbarWindow32, msctls_statusbar32, msctls_trackbar32 and tooltips_class32
#define /ifndef ICC_TAB_CLASSES 0x0008 ; SysTabControl32 and tooltips_class32
#define /ifndef ICC_UPDOWN_CLASS 0x0010 ; msctls_updown32
#define /ifndef ICC_PROGRESS_CLASS 0x0020 ; msctls_progress32
#define /ifndef ICC_HOTKEY_CLASS 0x0040 ; msctls_hotkey32
#define /ifndef ICC_ANIMATE_CLASS 0x0080 ; SysAnimate32
#define /ifndef ICC_WIN95_CLASSES 0x00FF
!define /ifndef ICC_DATE_CLASSES 0x0100 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) SysDateTimePick32 and SysMonthCal32
!define /ifndef ICC_DATE_CLASSES 0x0100 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) SysDateTimePick32, SysMonthCal32 and CC6.10+(Vista+) DropDown
!define /ifndef ICC_USEREX_CLASSES 0x0200 ; CC4.??+ (NT4+/IE3.?+/Win95 OSR2) ComboBoxEx32
!define /ifndef ICC_COOL_CLASSES 0x0400 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) ReBarWindow32
!define /ifndef ICC_INTERNET_CLASSES 0x0800
!define /ifndef ICC_INTERNET_CLASSES 0x0800 ; CC4.71+ (IE4+) SysIPAddress32
!define /ifndef ICC_PAGESCROLLER_CLASS 0x1000 ; CC4.71+ (IE4+) SysPager
!define /ifndef ICC_NATIVEFNTCTL_CLASS 0x2000
#define /ifndef ICC_STANDARD_CLASSES 0x4000 ; WinXP+
!define /ifndef ICC_NATIVEFNTCTL_CLASS 0x2000 ; CC4.71+ (IE4+) NativeFontCtl
!define /ifndef ICC_STANDARD_CLASSES 0x4000 ; WinXP+ Button, Static, Edit, ListBox, ComboBox, ComboLBox, ScrollBar and ReaderModeCtl
!define /ifndef ICC_LINK_CLASS 0x8000 ; WinXP+ SysLink
@ -380,9 +384,13 @@ Header file for creating custom installer pages with nsDialogs
!define __NSD_TimePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define __NSD_IPAddress_CLASS SysIPAddress32 ; IE4+/CC4.71+
!define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}
!define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
!define __NSD_IPAddress_EXSTYLE 0
!define __NSD_NetAddress_CLASS msctls_netaddress ; Vista+
!define __NSD_NetAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
!define __NSD_NetAddress_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!macro __NSD_DefineControl NAME
!define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
@ -420,6 +428,7 @@ Header file for creating custom installer pages with nsDialogs
!insertmacro __NSD_DefineControl DatePicker
!insertmacro __NSD_DefineControl TimePicker
!insertmacro __NSD_DefineControl IPAddress
!insertmacro __NSD_DefineControl NetAddress
!macro __NSD_OnControlEvent EVENT HWND FUNCTION
@ -501,6 +510,9 @@ System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UIN
!endif
!pragma warning pop
!macroend
!define NSD_InitCommonControl_IPAddress `${NSD_InitCommonControlsEx} ${ICC_INTERNET_CLASSES}`
!define NSD_InitCommonControl_NetAddress `System::Call SHELL32::InitNetworkAddressControl()i`
!define NSD_InitCommonControl_SysLink `${NSD_InitCommonControlsEx} ${ICC_LINK_CLASS}`
!define NSD_CreateTimer `!insertmacro _NSD_CreateTimer `
@ -911,6 +923,27 @@ Pop ${VAR}
!macroend
### Date ###
!define NSD_Date_GetDateFields `!insertmacro __NSD_Date_GetDateFields `
!macro __NSD_Date_GetDateFields CONTROL
Push $0
System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)'
System::Call '*$0(&i2.s,&i2.s,&i2,&i2.s)'
Exch 3
Pop $0
!macroend
!define NSD_Time_GetTimeFields `!insertmacro __NSD_Time_GetTimeFields `
!macro __NSD_Time_GetTimeFields CONTROL
Push $0
System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)'
System::Call '*$0(&i2,&i2,&i2,&i2,&i2.s,&i2.s,&i2.s)'
Exch 3
Pop $0
Exch
!macroend
### Static ###
!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE
@ -952,6 +985,7 @@ Pop ${VAR}
!define NSD_SetStretchedImage `!insertmacro __NSD_SetStretchedImage `
!define NSD_SetStretchedBitmap `!insertmacro __NSD_SetStretchedImage `
!macro __NSD_SetStretchedImage CONTROL IMAGE HANDLE
Push $0
Push $R0