Added DatePicker NSD control

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7176 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-04-23 18:31:23 +00:00
parent 2e11d853b7
commit b3044b36c1
5 changed files with 150 additions and 17 deletions

View file

@ -1033,6 +1033,7 @@ LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle"
Function CustomPageFunction
!insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)
nsDialogs::...
...
FunctionEnd
</pre>

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; }
code { margin-left: 1.2em; padding: 0.5em; background-color: #f0f0f0; display:inline-block; }
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; }
@ -78,8 +78,11 @@ abbr { font-variant: none; cursor: help; }
<li>ComboBox &amp; DropList:
<a href="#mref-cbaddstring">NSD_CB_AddString</a>,
<a href="#mref-cbinsstring">NSD_CB_PrependString, NSD_CB_AppendString, NSD_CB_InsertString</a>,
<a href="#mref-cbselectstring">NSD_CB_SelectString</a>,
<a href="#mref-cbgetcount">NSD_CB_GetCount</a>
NSD_CB_DelString,
NSD_CB_DelItem,
NSD_CB_Clear,
<a href="#mref-cbgetcount">NSD_CB_GetCount</a>,
<a href="#mref-cbselectstring">NSD_CB_SelectString</a>
</li>
<li>ListBox:
<a href="#mref-lbaddstring">NSD_LB_AddString</a>,
@ -250,6 +253,7 @@ HTrackBar,
VTrackBar,
UpDown,
HotKey,
DatePicker,
IPAddress.
</p>
@ -559,7 +563,8 @@ StrCmp $0 "" ...
<li>${NSD_CreateVTrackBar}</li>
<li>${NSD_CreateUpDown}</li>
<li>${NSD_CreateHotKey}</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)</small></li>
<li>${NSD_CreateIPAddress} <small>(Requires <abbr title="Internet Explorer">IE</abbr> 4)</small></li>
</ul>
<p>Returns the new control's HWND on the stack or <i>error</i></p>

View file

@ -176,7 +176,7 @@ FunctionEnd
Function NotifyPage
!insertmacro BeginControlsTestPage "WM_NOTIFY"
nsDialogs::CreateControl "${__NSD_RichEdit_CLASS_20A}" "${__NSD_RichEdit_STYLE}" "${__NSD_RichEdit_EXSTYLE}" 1 1 -2 -2 "" ; Forcing ANSI control, see forums.winamp.com/showthread.php?p=3169999
nsDialogs::CreateControl "${__NSD_RichEdit_CLASS_20A}" "${__NSD_RichEdit_STYLE}" "${__NSD_RichEdit_EXSTYLE}" 1 1 -2 50u "" ; Forcing ANSI control, see forums.winamp.com/showthread.php?p=3169999
Pop $9
${NSD_OnNotify} $9 OnNotify
IntOp $8 ${ENM_LINK} | ${ENM_KEYEVENTS}
@ -184,6 +184,24 @@ Function NotifyPage
SendMessage $9 ${EM_AUTOURLDETECT} 1 0
${NSD_SetText} $9 "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard http://nsis.sf.net\par {\b Click the link!}\par\par Type something and I will block every other character...}"
${NSD_InitCommonControlsEx} ${ICC_DATE_CLASSES}
${NSD_CreateDatePicker} 1% 55u 48% 12u ""
Pop $1
${NSD_OnNotify} $1 onDateTimeNotify
${NSD_CreateLabel} 51% 56u 48% 12u "Change the date..."
Pop $9
/*
${NSD_CreateCalendar} 1% 23% 150u 90u ""
Pop $1
${NSD_AddStyle} $1 ${MCS_NOTODAY}
System::Call 'USER32::SendMessage(p$1, i${MCM_GETMINREQRECT}, p0, @r2)'
System::Call '*$2(i,i,i.r2,i.r3)'
#System::Call 'USER32::SendMessage(p$1, i${MCM_GETMAXTODAYWIDTH}, p0, *i0r4)'
#${IfThen} $4 > $2 ${|} StrCpy $2 $4 ${|}
System::Call 'USER32::SetWindowPos(p$1,p0,i,i,ir2,ir3,i0x16)'
*/
nsDialogs::Show
FunctionEnd
@ -217,5 +235,21 @@ Function OnNotify
${EndIf}
FunctionEnd
Function onDateTimeNotify
Pop $1 ; HWND
Pop $2 ; Code
Pop $3 ; NMHDR*
${If} $2 = ${DTN_DATETIMECHANGE}
System::Call 'USER32::SendMessage(p$1, i${DTM_GETSYSTEMTIME}, p0, @r3)i.r0'
${If} $0 = ${GDT_VALID}
System::Call '*$3(&i2.R1, &i2.R2, &i2, &i2.R3, &i2, &i2, &i2, &i2)' ; SYSTEMTIME
StrCpy $0 "$R1/$R2/$R3"
${Else}
StrCpy $0 "N/A"
${EndIf}
${NSD_SetText} $9 $0
${EndIf}
FunctionEnd
Section
SectionEnd

View file

@ -186,6 +186,24 @@ Header file for creating custom installer pages with nsDialogs
!define UDS_NOTHOUSANDS 0x0080
!define UDS_HOTTRACK 0x0100 ; 98+
!define MCS_DAYSTATE 0x0001
!define MCS_MULTISELECT 0x0002
!define MCS_WEEKNUMBERS 0x0004
!define MCS_NOTODAYCIRCLE 0x0008
!define MCS_NOTODAY 0x0010 ; IE4+?
!define MCS_NOTRAILINGDATES 0x0040 ; Vista+
!define MCS_SHORTDAYSOFWEEK 0x0080 ; Vista+
!define MCS_NOSELCHANGEONNAV 0x0100 ; Vista+
!define DTS_UPDOWN 0x01
!define DTS_SHOWNONE 0x02
!define DTS_SHORTDATEFORMAT 0x00
!define DTS_LONGDATEFORMAT 0x04
!define DTS_SHORTDATECENTURYFORMAT 0x0C
!define DTS_TIMEFORMAT 0x09
!define DTS_APPCANPARSE 0x10
!define DTS_RIGHTALIGN 0x20
!define /ifndef LR_DEFAULTCOLOR 0x0000
!define /ifndef LR_MONOCHROME 0x0001
!define /ifndef LR_COLOR 0x0002
@ -208,20 +226,19 @@ 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
!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_WIN95_CLASSES 0x00FF
!define /ifndef ICC_DATE_CLASSES 0x0100
!define /ifndef ICC_USEREX_CLASSES 0x0200
!define /ifndef ICC_USEREX_CLASSES 0x0200
!define /ifndef ICC_COOL_CLASSES 0x0400
!define /ifndef ICC_DATE_CLASSES 0x0100 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) SysDateTimePick32 and SysMonthCal32
!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_PAGESCROLLER_CLASS 0x1000
!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_LINK_CLASS 0x8000 ; WinXP+
!define /ifndef ICC_LINK_CLASS 0x8000 ; WinXP+ SysLink
!define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS}
@ -350,6 +367,18 @@ Header file for creating custom installer pages with nsDialogs
!define __NSD_HotKey_STYLE ${DEFAULT_STYLES}
!define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define __NSD_Calendar_CLASS SysMonthCal32
!define __NSD_Calendar_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
!define __NSD_Calendar_EXSTYLE 0
!define __NSD_DatePicker_CLASS SysDateTimePick32
!define __NSD_DatePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}
!define __NSD_DatePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define __NSD_TimePicker_CLASS SysDateTimePick32
!define __NSD_TimePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${DTS_TIMEFORMAT}
!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_EXSTYLE 0
@ -387,6 +416,9 @@ Header file for creating custom installer pages with nsDialogs
!insertmacro __NSD_DefineControl UpDown
!insertmacro __NSD_DefineControl AutoUpDown
!insertmacro __NSD_DefineControl HotKey
!insertmacro __NSD_DefineControl Calendar
!insertmacro __NSD_DefineControl DatePicker
!insertmacro __NSD_DefineControl TimePicker
!insertmacro __NSD_DefineControl IPAddress
@ -670,8 +702,14 @@ SendMessage ${CONTROL} ${CB_GETITEMDATA} ${INDEX} 0 ${VAR}
!define NSD_CB_LimitText `${__NSD_MkCtlCmd_WP} CB_LIMITTEXT 0 `
!define /IfNDef NSD_CB_Clear `${__NSD_MkCtlCmd} CB_RESETCONTENT 0 0 `
!define /IfNDef NSD_CB_GetCount `${__NSD_MkCtlCmd_RV} CB_GETCOUNT 0 0 `
;define /IfNDef NSD_CB_DelString ; /IfNDef to try to stay compatible with
;define /IfNDef NSD_CB_GetSelection ; the ListView header from the Wiki.
!ifndef NSD_CB_DelString
!define NSD_CB_DelString `!insertmacro __NSD_CB_DelString `
!macro __NSD_CB_DelString CONTROL STRING
System::Call 'USER32::SendMessage(p${CONTROL},i${CB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}`
System::Call 'USER32::SendMessage(p${CONTROL},i${CB_DELETESTRING},ps,p0)'
!macroend
!endif
;define /IfNDef NSD_CB_GetSelection
### ListBox ###