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 ###

View file

@ -54,8 +54,6 @@ NOT included messages (WM_USER + X)
CBEM Extended combo box control
CDM Common dialog box
DL Drag list box
DTM Date and time picker control
MCM Month calendar control
PGM Pager control
PSM Property sheet
RB Rebar control
@ -831,5 +829,62 @@ ${_NSIS_DEFAW} ACM_OPEN
!define /math NCM_GETALLOWTYPE ${WM_USER} + 3
!define /math NCM_DISPLAYERRORTIP ${WM_USER} + 4
#Month calendar control#
!define MCM_FIRST 0x1000
!define /math MCM_GETCURSEL ${MCM_FIRST} + 1
!define /math MCM_SETCURSEL ${MCM_FIRST} + 2
!define /math MCM_GETMAXSELCOUNT ${MCM_FIRST} + 3
!define /math MCM_SETMAXSELCOUNT ${MCM_FIRST} + 4
!define /math MCM_GETSELRANGE ${MCM_FIRST} + 5
!define /math MCM_SETSELRANGE ${MCM_FIRST} + 6
!define /math MCM_GETMONTHRANGE ${MCM_FIRST} + 7
!define /math MCM_SETDAYSTATE ${MCM_FIRST} + 8
!define /math MCM_GETMINREQRECT ${MCM_FIRST} + 9
!define /math MCM_SETCOLOR ${MCM_FIRST} + 10
!define /math MCM_GETCOLOR ${MCM_FIRST} + 11
!define /math MCM_SETTODAY ${MCM_FIRST} + 12
!define /math MCM_GETTODAY ${MCM_FIRST} + 13
!define /math MCM_HITTEST ${MCM_FIRST} + 14
!define /math MCM_SETFIRSTDAYOFWEEK ${MCM_FIRST} + 15
!define /math MCM_GETFIRSTDAYOFWEEK ${MCM_FIRST} + 16
!define /math MCM_GETRANGE ${MCM_FIRST} + 17
!define /math MCM_SETRANGE ${MCM_FIRST} + 18
!define /math MCM_GETMONTHDELTA ${MCM_FIRST} + 19
!define /math MCM_SETMONTHDELTA ${MCM_FIRST} + 20
!define /math MCM_GETMAXTODAYWIDTH ${MCM_FIRST} + 21
!define MCM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4+
!define MCM_GETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4+
!define /math MCM_GETCURRENTVIEW ${MCM_FIRST} + 22 ; Vista+
!define /math MCM_GETCALENDARCOUNT ${MCM_FIRST} + 23
!define /math MCM_GETCALENDARGRIDINFO ${MCM_FIRST} + 24
!define /math MCM_GETCALID ${MCM_FIRST} + 27
!define /math MCM_SETCALID ${MCM_FIRST} + 28
!define /math MCM_SIZERECTTOMIN ${MCM_FIRST} + 29
!define /math MCM_SETCALENDARBORDER ${MCM_FIRST} + 30
!define /math MCM_GETCALENDARBORDER ${MCM_FIRST} + 31
!define /math MCM_SETCURRENTVIEW ${MCM_FIRST} + 32
!define MCN_SELCHANGE -749
!define MCN_GETDAYSTATE -747
!define MCN_SELECT -746
!define MCN_VIEWCHANGE -750 ; Vista+?
#DateTime control#
!define DTM_FIRST 0x1000
!define /math DTM_GETSYSTEMTIME ${DTM_FIRST} + 1
!define /math DTM_SETSYSTEMTIME ${DTM_FIRST} + 2
!define /math DTM_SETFORMATA ${DTM_FIRST} + 5
!define /math DTM_SETFORMATW ${DTM_FIRST} + 50
${_NSIS_DEFAW} DTM_SETFORMAT
!define /math DTM_GETMONTHCAL ${DTM_FIRST} + 8
!define /math DTM_SETMCFONT ${DTM_FIRST} + 9 ; IE4+?
!define /math DTM_GETMCFONT ${DTM_FIRST} + 10 ; IE4+?
!define /math DTM_SETMCSTYLE ${DTM_FIRST} + 11 ; Vista+?
!define /math DTM_GETMCSTYLE ${DTM_FIRST} + 12 ; Vista+?
!define /math DTM_CLOSEMONTHCAL ${DTM_FIRST} + 13 ; Vista+?
!define DTN_DATETIMECHANGE -759
!define /IfNDef GDT_ERROR -1
!define /IfNDef GDT_VALID 0
!define /IfNDef GDT_NONE 1
!verbose pop
!endif
!endif