Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. progbar.h
  5. Abstract:
  6. Declares the functions, variables and macros for the progress
  7. bar utilities. The progress bar utilities manage a single
  8. progress bar by dividing it into slices. Each slice has
  9. an initial static size. The count for each slice is scaled
  10. independently, so code can dynamically change the slice
  11. count as an aid to help tick the progress bar more smoothly.
  12. Author:
  13. Marc R. Whitten (marcw) 14-Apr-1997
  14. Revision History:
  15. jimschm 01-Jul-1998 Rewrite
  16. --*/
  17. #pragma once
  18. //
  19. // Variables for macros
  20. //
  21. extern HWND g_Component;
  22. extern HWND g_SubComponent;
  23. extern HANDLE g_ComponentCancelEvent;
  24. extern HANDLE g_SubComponentCancelEvent;
  25. //
  26. // Initialization and termination
  27. //
  28. VOID
  29. InitializeProgressBar (
  30. IN HWND ProgressBar,
  31. IN HWND Component, OPTIONAL
  32. IN HWND SubComponent, OPTIONAL
  33. IN BOOL *CancelFlagPtr OPTIONAL
  34. );
  35. VOID
  36. TerminateProgressBar (
  37. VOID
  38. );
  39. //
  40. // Registration, estimate revision and ticking
  41. //
  42. UINT
  43. RegisterProgressBarSlice (
  44. IN UINT InitialEstimate
  45. );
  46. VOID
  47. ReviseSliceEstimate (
  48. IN UINT SliceId,
  49. IN UINT RevisedEstimate
  50. );
  51. VOID
  52. BeginSliceProcessing (
  53. IN UINT SliceId
  54. );
  55. BOOL
  56. TickProgressBarDelta (
  57. IN UINT Ticks
  58. );
  59. BOOL
  60. TickProgressBar (
  61. VOID
  62. );
  63. VOID
  64. EndSliceProcessing (
  65. VOID
  66. );
  67. //
  68. // Delayed titles
  69. //
  70. BOOL
  71. ProgressBar_SetWindowStringA (
  72. IN HWND Window,
  73. IN HANDLE CancelEvent,
  74. IN LPCSTR Message, OPTIONAL
  75. IN DWORD MessageId OPTIONAL
  76. );
  77. BOOL
  78. ProgressBar_SetDelayedMessageA (
  79. IN HWND Window,
  80. IN HANDLE CancelEvent,
  81. IN LPCSTR Message,
  82. IN DWORD MessageId,
  83. IN DWORD Delay
  84. );
  85. VOID
  86. ProgressBar_CancelDelayedMessage (
  87. IN HANDLE CancelEvent
  88. );
  89. #if 0
  90. BOOL
  91. ProgressBar_CreateTickThread (
  92. IN HANDLE CancelEvent,
  93. IN DWORD TickCount
  94. );
  95. BOOL
  96. ProgressBar_CancelTickThread (
  97. IN HANDLE CancelEvent
  98. );
  99. #endif
  100. //
  101. // Macros
  102. //
  103. #define ProgressBar_CancelDelayedComponent() ProgressBar_CancelDelayedMessage(g_ComponentCancelEvent);
  104. #define ProgressBar_CancelDelayedSubComponent() ProgressBar_CancelDelayedMessage(g_SubComponentCancelEvent);
  105. #ifndef UNICODE
  106. #define ProgressBar_SetComponent(s) ProgressBar_SetWindowStringA(g_Component,g_ComponentCancelEvent,(s),0)
  107. #if !defined PRERELEASE || !defined DEBUG
  108. #define ProgressBar_SetSubComponent(s) ProgressBar_SetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0)
  109. #define ProgressBar_SetFnName(s)
  110. #define ProgressBar_ClearFnName()
  111. #else
  112. #define ProgressBar_SetSubComponent(s) ((s) == NULL ? 1 : ProgressBar_SetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0))
  113. #define ProgressBar_SetFnName(s) ProgressBar_SetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0)
  114. #define ProgressBar_ClearFnName() ProgressBar_SetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,NULL,0)
  115. #endif
  116. #define ProgressBar_SetComponentById(n) ProgressBar_SetWindowStringA(g_Component,g_ComponentCancelEvent,NULL,(n))
  117. #define ProgressBar_SetSubComponentById(n) ProgressBar_SetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,NULL,(n))
  118. #define ProgressBar_SetDelayedComponent(s,d) ProgressBar_SetDelayedMessageA(g_Component,g_ComponentCancelEvent,(s),0,(d))
  119. #define ProgressBar_SetDelayedSubComponent(s,d) ProgressBar_SetDelayedMessageA(g_SubComponent,g_SubComponentCancelEvent,(s),0,(d))
  120. #define ProgressBar_SetDelayedComponentById(n,d) ProgressBar_SetDelayedMessageA(g_Component,g_ComponentCancelEvent,NULL,(n),(d))
  121. #define ProgressBar_SetDelayedSubComponentById(n,d) ProgressBar_SetDelayedMessageA(g_SubComponent,g_SubComponentCancelEvent,NULL,(n),(d))
  122. #endif