Leaked source code of windows server 2003
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.

226 lines
4.4 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 bar
  7. utilities. The progress bar utilities manage a single progress bar by
  8. dividing it into slices. Each slice has an initial static size. The
  9. count for each slice is scaled independently, so code can dynamically
  10. change the slice count as an aid to help tick the progress bar more
  11. 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. // Includes
  20. //
  21. // None
  22. //
  23. // Strings
  24. //
  25. // None
  26. //
  27. // Constants
  28. //
  29. // None
  30. //
  31. // Macros
  32. //
  33. // None
  34. //
  35. // Types
  36. //
  37. // None
  38. //
  39. // Globals
  40. //
  41. // exposed for the macros
  42. extern HWND g_Component;
  43. extern HWND g_SubComponent;
  44. extern HANDLE g_ComponentCancelEvent;
  45. extern HANDLE g_SubComponentCancelEvent;
  46. //
  47. // Macro expansion list
  48. //
  49. // None
  50. //
  51. // Public function prototypes
  52. //
  53. // initialization and termination
  54. //
  55. VOID
  56. PbInitialize (
  57. IN HWND ProgressBar,
  58. IN HWND Component, OPTIONAL
  59. IN HWND SubComponent, OPTIONAL
  60. IN BOOL *CancelFlagPtr OPTIONAL
  61. );
  62. VOID
  63. PbTerminate (
  64. VOID
  65. );
  66. //
  67. // registration, estimate revision and ticking
  68. //
  69. UINT
  70. PbRegisterSlice (
  71. IN UINT InitialEstimate
  72. );
  73. VOID
  74. PbReviseSliceEstimate (
  75. IN UINT SliceId,
  76. IN UINT RevisedEstimate
  77. );
  78. VOID
  79. PbBeginSliceProcessing (
  80. IN UINT SliceId
  81. );
  82. VOID
  83. PbGetSliceInfo (
  84. IN UINT SliceId,
  85. OUT PBOOL SliceStarted, OPTIONAL
  86. OUT PBOOL SliceFinished, OPTIONAL
  87. OUT PUINT TicksCompleted, OPTIONAL
  88. OUT PUINT TotalTicks OPTIONAL
  89. );
  90. BOOL
  91. PbTickDelta (
  92. IN UINT Ticks
  93. );
  94. BOOL
  95. PbTick (
  96. VOID
  97. );
  98. VOID
  99. PbEndSliceProcessing (
  100. VOID
  101. );
  102. //
  103. // delayed titles
  104. //
  105. BOOL
  106. PbSetWindowStringA (
  107. IN HWND Window,
  108. IN HANDLE CancelEvent,
  109. IN PCSTR Message, OPTIONAL
  110. IN DWORD MessageId OPTIONAL
  111. );
  112. BOOL
  113. PbSetDelayedMessageA (
  114. IN HWND Window,
  115. IN HANDLE CancelEvent,
  116. IN PCSTR Message,
  117. IN DWORD MessageId,
  118. IN DWORD Delay
  119. );
  120. VOID
  121. PbCancelDelayedMessage (
  122. IN HANDLE CancelEvent
  123. );
  124. #if 0
  125. BOOL
  126. PbCreateTickThread (
  127. IN HANDLE CancelEvent,
  128. IN DWORD TickCount
  129. );
  130. BOOL
  131. PbCancelTickThread (
  132. IN HANDLE CancelEvent
  133. );
  134. #endif
  135. //
  136. // Macro expansion definition
  137. //
  138. // None
  139. //
  140. // Macros, including ANSI/UNICODE macros
  141. //
  142. #define PbCancelDelayedComponent() PbCancelDelayedMessage(g_ComponentCancelEvent);
  143. #define PbCancelDelayedSubComponent() PbCancelDelayedMessage(g_SubComponentCancelEvent);
  144. #ifndef UNICODE
  145. #define PbSetComponent(s) PbSetWindowStringA(g_Component,g_ComponentCancelEvent,(s),0)
  146. #if !defined PRERELEASE || !defined DEBUG
  147. #define PbSetSubComponent(s) PbSetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0)
  148. #define PbSetFnName(s)
  149. #define PbClearFnName()
  150. #else
  151. #define PbSetSubComponent(s) ((s) == NULL ? 1 : PbSetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0))
  152. #define PbSetFnName(s) PbSetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,(s),0)
  153. #define PbClearFnName() PbSetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,NULL,0)
  154. #endif
  155. #define PbSetComponentById(n) PbSetWindowStringA(g_Component,g_ComponentCancelEvent,NULL,(n))
  156. #define PbSetSubComponentById(n) PbSetWindowStringA(g_SubComponent,g_SubComponentCancelEvent,NULL,(n))
  157. #define PbSetDelayedComponent(s,d) PbSetDelayedMessageA(g_Component,g_ComponentCancelEvent,(s),0,(d))
  158. #define PbSetDelayedSubComponent(s,d) PbSetDelayedMessageA(g_SubComponent,g_SubComponentCancelEvent,(s),0,(d))
  159. #define PbSetDelayedComponentById(n,d) PbSetDelayedMessageA(g_Component,g_ComponentCancelEvent,NULL,(n),(d))
  160. #define PbSetDelayedSubComponentById(n,d) PbSetDelayedMessageA(g_SubComponent,g_SubComponentCancelEvent,NULL,(n),(d))
  161. #endif