applied patch #2135855 - Timer support for nsDialogs
also added progress bar support for the example git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5803 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
bbba2aaa6e
commit
dba6bb4210
6 changed files with 785 additions and 548 deletions
|
@ -53,6 +53,8 @@ code
|
|||
<li><a href="#ref-onchange">OnChange</a></li>
|
||||
<li><a href="#ref-onclick">OnClick</a></li>
|
||||
<li><a href="#ref-onnotify">OnNotify</a></li>
|
||||
<li><a href="#ref-ontimer">OnTimer</a></li>
|
||||
<li><a href="#ref-killtimer">KillTimer</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -63,6 +65,8 @@ code
|
|||
<li><a href="#mref-onchange">NSD_OnChange</a></li>
|
||||
<li><a href="#mref-onclick">NSD_OnClick</a></li>
|
||||
<li><a href="#mref-onnotify">NSD_OnNotify</a></li>
|
||||
<li><a href="#mref-ontimer">NSD_OnTimer</a></li>
|
||||
<li><a href="#mref-killtimer">NSD_KillTimer</a></li>
|
||||
<li><a href="#mref-addstyle">NSD_AddStyle</a></li>
|
||||
<li><a href="#mref-addexstyle">NSD_AddExStyle</a></li>
|
||||
<li><a href="#mref-gettext">NSD_GetText</a></li>
|
||||
|
@ -281,6 +285,7 @@ SectionEnd</pre></blockquote>
|
|||
<li>ComboBox</li>
|
||||
<li>DropList</li>
|
||||
<li>ListBox</li>
|
||||
<li>ProgressBar</li>
|
||||
</ul>
|
||||
|
||||
<h3><a name="step-state"></a>Control State</h3>
|
||||
|
@ -585,6 +590,26 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<p>Returns nothing.</p>
|
||||
|
||||
<h3><a name="ref-ontimer"></a>OnTimer</h3>
|
||||
|
||||
<p><code>nsDialogs::OnTimer /NOUNLOAD <i>function_address</i> <i>timer_interval</i></code></p>
|
||||
|
||||
<p>Sets a timer that'd call the callback function for the given control every in a constant interval. Interval times are specified in milliseconds.</p>
|
||||
|
||||
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
|
||||
|
||||
<p>Returns nothing.</p>
|
||||
|
||||
<h3><a name="ref-killtimer"></a>KillTimer</h3>
|
||||
|
||||
<p><code>nsDialogs::KillTimer /NOUNLOAD <i>function_address</i></code></p>
|
||||
|
||||
<p>Kills a previously set timer.</p>
|
||||
|
||||
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
|
||||
|
||||
<p>Returns nothing.</p>
|
||||
|
||||
<h2><a name="mref"></a>Macro Reference</h2>
|
||||
|
||||
<p>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.</p>
|
||||
|
@ -617,6 +642,7 @@ SectionEnd</pre></blockquote>
|
|||
<li>${NSD_CreateComboBox}</li>
|
||||
<li>${NSD_CreateDropList}</li>
|
||||
<li>${NSD_CreateListBox}</li>
|
||||
<li>${NSD_CreateProgressBar}</li>
|
||||
</ul>
|
||||
|
||||
<p>Returns the new dialog's HWND on the stack or error.</p>
|
||||
|
@ -649,6 +675,18 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<p>See <a href="#ref-onnotify">OnNotify</a> for more details.</p>
|
||||
|
||||
<h3><a name="mref-ontimer"></a>NSD_OnTimer</h3>
|
||||
|
||||
<p><code>${NSD_OnTimer} <i>function_address</i> <i>timer_interval</i></code></p>
|
||||
|
||||
<p>See <a href="#ref-ontimer">OnTimer</a> for more details.</p>
|
||||
|
||||
<h3><a name="mref-killtimer"></a>NSD_KillTimer</h3>
|
||||
|
||||
<p><code>${NSD_KillTimer} <i>function_address</i></code></p>
|
||||
|
||||
<p>See <a href="#ref-killtimer">KillTimer</a> for more details.</p>
|
||||
|
||||
<h3><a name="mref-addstyle"></a>NSD_AddStyle</h3>
|
||||
|
||||
<p><code>${NSD_AddStyle} <i>control_HWND</i> <i>style</i></code></p>
|
||||
|
|
|
@ -28,6 +28,7 @@ docs = Split("""
|
|||
examples = Split("""
|
||||
example.nsi
|
||||
InstallOptions.nsi
|
||||
timer.nsi
|
||||
welcome.nsi
|
||||
""")
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -252,6 +252,10 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!define __NSD_ListBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY}
|
||||
!define __NSD_ListBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
|
||||
|
||||
!define __NSD_ProgressBar_CLASS msctls_progress32
|
||||
!define __NSD_ProgressBar_STYLE ${DEFAULT_STYLES}
|
||||
!define __NSD_ProgressBar_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
|
||||
|
||||
!macro __NSD_DefineControl NAME
|
||||
|
||||
!define NSD_Create${NAME} "nsDialogs::CreateControl /NOUNLOAD ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
|
||||
|
@ -277,6 +281,7 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!insertmacro __NSD_DefineControl ComboBox
|
||||
!insertmacro __NSD_DefineControl DropList
|
||||
!insertmacro __NSD_DefineControl ListBox
|
||||
!insertmacro __NSD_DefineControl ProgressBar
|
||||
|
||||
!macro __NSD_OnControlEvent EVENT HWND FUNCTION
|
||||
|
||||
|
@ -321,6 +326,32 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!insertmacro __NSD_DefineControlCallback Notify
|
||||
!insertmacro __NSD_DefineDialogCallback Back
|
||||
|
||||
!macro _NSD_CreateTimer FUNCTION INTERVAL
|
||||
|
||||
Push $0
|
||||
|
||||
GetFunctionAddress $0 "${FUNCTION}"
|
||||
nsDialogs::CreateTimer /NOUNLOAD $0 "${INTERVAL}"
|
||||
|
||||
Pop $0
|
||||
|
||||
!macroend
|
||||
|
||||
!define NSD_CreateTimer `!insertmacro _NSD_CreateTimer`
|
||||
|
||||
!macro _NSD_KillTimer FUNCTION
|
||||
|
||||
Push $0
|
||||
|
||||
GetFunctionAddress $0 "${FUNCTION}"
|
||||
nsDialogs::KillTimer /NOUNLOAD $0
|
||||
|
||||
Pop $0
|
||||
|
||||
!macroend
|
||||
|
||||
!define NSD_KillTimer `!insertmacro _NSD_KillTimer`
|
||||
|
||||
!macro _NSD_AddStyle CONTROL STYLE
|
||||
|
||||
Push $0
|
||||
|
|
117
Contrib/nsDialogs/timer.nsi
Normal file
117
Contrib/nsDialogs/timer.nsi
Normal file
|
@ -0,0 +1,117 @@
|
|||
!include nsDialogs.nsh
|
||||
|
||||
!define PBM_SETPOS 0x0402
|
||||
!define PBM_DELTAPOS 0x0403
|
||||
!define PBM_GETPOS 1032
|
||||
|
||||
!addplugindir "."
|
||||
|
||||
Name "nsDialogs Example"
|
||||
OutFile "nsDialogs Example.exe"
|
||||
XpStyle on
|
||||
|
||||
Var DIALOG
|
||||
Var TEXT
|
||||
Var PROGBAR
|
||||
Var PROGBAR2
|
||||
Var PROGBAR3
|
||||
Var BUTTON
|
||||
Var BUTTON2
|
||||
Var TIMERID
|
||||
Var TIMERID2
|
||||
|
||||
Page custom nsDialogsPage
|
||||
|
||||
Function OnTimer
|
||||
Pop $0 ; Timer id
|
||||
|
||||
SendMessage $PROGBAR ${PBM_GETPOS} 0 0 $1
|
||||
StrCmp $1 100 0 +3
|
||||
SendMessage $PROGBAR ${PBM_SETPOS} 0 0
|
||||
Goto +2
|
||||
SendMessage $PROGBAR ${PBM_DELTAPOS} 10 0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer2
|
||||
Pop $0 ; Timer id
|
||||
|
||||
SendMessage $PROGBAR2 ${PBM_GETPOS} 0 0 $1
|
||||
StrCmp $1 100 0 +3
|
||||
SendMessage $PROGBAR2 ${PBM_SETPOS} 0 0
|
||||
Goto +2
|
||||
SendMessage $PROGBAR2 ${PBM_DELTAPOS} 5 0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer3
|
||||
Pop $0 ; Timer id
|
||||
|
||||
SendMessage $PROGBAR3 ${PBM_GETPOS} 0 0 $1
|
||||
IntCmp $1 85 0 +4 0
|
||||
nsDialogs::DestroyTimer /NOUNLOAD $0
|
||||
MessageBox MB_OK "Timer 3 killed"
|
||||
Goto +2
|
||||
SendMessage $PROGBAR3 ${PBM_DELTAPOS} 2 0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick
|
||||
Pop $0
|
||||
|
||||
nsDialogs::DestroyTimer /NOUNLOAD $TIMERID
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick2
|
||||
Pop $0
|
||||
|
||||
nsDialogs::DestroyTimer /NOUNLOAD $TIMERID2
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function nsDialogsPage
|
||||
|
||||
nsDialogs::Create /NOUNLOAD 1018
|
||||
Pop $DIALOG
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "STATIC" ${DEFAULT_STYLES} ${WS_EX_TRANSPARENT} 0u 0u 100% 9u "nsDialogs timer example"
|
||||
Pop $TEXT
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "msctls_progress32" ${DEFAULT_STYLES} "" 0u 10u 100% 12u ""
|
||||
Pop $PROGBAR
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "BUTTON" ${DEFAULT_STYLES}|${WS_TABSTOP} "" 0u 25u 100u 14u "Kill Timer 1"
|
||||
Pop $BUTTON
|
||||
GetFunctionAddress $0 OnClick
|
||||
nsDialogs::OnClick /NOUNLOAD $BUTTON $0
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "msctls_progress32" ${DEFAULT_STYLES} "" 0u 52u 100% 12u ""
|
||||
Pop $PROGBAR2
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "BUTTON" ${DEFAULT_STYLES}|${WS_TABSTOP} "" 0u 67u 100u 14u "Kill Timer 2"
|
||||
Pop $BUTTON2
|
||||
GetFunctionAddress $0 OnClick2
|
||||
nsDialogs::OnClick /NOUNLOAD $BUTTON2 $0
|
||||
|
||||
nsDialogs::CreateControl /NOUNLOAD "msctls_progress32" ${DEFAULT_STYLES} "" 0u 114u 100% 12u ""
|
||||
Pop $PROGBAR3
|
||||
|
||||
GetFunctionAddress $0 OnTimer
|
||||
nsDialogs::CreateTimer /NOUNLOAD 1000 $0
|
||||
Pop $TIMERID
|
||||
|
||||
GetFunctionAddress $0 OnTimer2
|
||||
nsDialogs::CreateTimer /NOUNLOAD 100 $0
|
||||
Pop $TIMERID2
|
||||
|
||||
GetFunctionAddress $0 OnTimer3
|
||||
nsDialogs::CreateTimer /NOUNLOAD 200 $0
|
||||
Pop $0
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
|
@ -39,6 +39,7 @@ SB Status bar window
|
|||
SBM Scroll bar control
|
||||
STM Static control
|
||||
TCM Tab control
|
||||
PBM Progress bar
|
||||
-----------------------------------
|
||||
|
||||
NOT included messages (WM_USER + X)
|
||||
|
@ -50,7 +51,6 @@ DTM Date and time picker control
|
|||
HKM Hot key control
|
||||
IPM IP address control
|
||||
MCM Month calendar control
|
||||
PBM Progress bar
|
||||
PGM Pager control
|
||||
PSM Property sheet
|
||||
RB Rebar control
|
||||
|
@ -579,5 +579,14 @@ UDM Up-down control
|
|||
#Tab control#
|
||||
!define TCM_FIRST 0x1300
|
||||
|
||||
#Progress bar control#
|
||||
!define PBM_SETRANGE 0x0401
|
||||
!define PBM_SETPOS 0x0402
|
||||
!define PBM_DELTAPOS 0x0403
|
||||
!define PBM_SETSTEP 0x0404
|
||||
!define PBM_STEPIT 0x0405
|
||||
!define PBM_GETPOS 0x0408
|
||||
!define PBM_SETMARQUEE 0x040a
|
||||
|
||||
!verbose pop
|
||||
!endif
|
Loading…
Add table
Add a link
Reference in a new issue