xref: /reactos/sdk/lib/conutils/pager.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Console Utilities Library
4  * FILE:            sdk/lib/conutils/pager.h
5  * PURPOSE:         Console/terminal paging functionality.
6  * PROGRAMMERS:     - Hermes Belusca-Maito (for the library);
7  *                  - All programmers who wrote the different console applications
8  *                    from which I took those functions and improved them.
9  */
10 
11 #ifndef __PAGER_H__
12 #define __PAGER_H__
13 
14 #ifndef _UNICODE
15 #error The ConUtils library at the moment only supports compilation with _UNICODE defined!
16 #endif
17 
18 
19 // #include <wincon.h>
20 
21 
22 typedef struct _CON_PAGER
23 {
24     PCON_SCREEN Screen;
25 
26     // TODO: Add more properties. Maybe those extra parameters
27     // of PAGE_PROMPT could go there?
28 
29     /* Used to count number of lines since last pause */
30     DWORD LineCount;
31 } CON_PAGER, *PCON_PAGER;
32 
33 #define INIT_CON_PAGER(pScreen)     {(pScreen), 0}
34 
35 #define InitializeConPager(pPager, pScreen) \
36 do { \
37     (pPager)->Screen = (pScreen);   \
38     (pPager)->LineCount = 0;        \
39 } while (0)
40 
41                                       // Pager,         Done,     Total
42 typedef BOOL (__stdcall *PAGE_PROMPT)(IN PCON_PAGER, IN DWORD, IN DWORD);
43 
44 BOOL
45 ConWritePaging(
46     IN PCON_PAGER Pager,
47     IN PAGE_PROMPT PagePrompt,
48     IN BOOL StartPaging,
49     IN PTCHAR szStr,
50     IN DWORD len);
51 
52 BOOL
53 ConPutsPaging(
54     IN PCON_PAGER Pager,
55     IN PAGE_PROMPT PagePrompt,
56     IN BOOL StartPaging,
57     IN LPTSTR szStr);
58 
59 BOOL
60 ConResPagingEx(
61     IN PCON_PAGER Pager,
62     IN PAGE_PROMPT PagePrompt,
63     IN BOOL StartPaging,
64     IN HINSTANCE hInstance OPTIONAL,
65     IN UINT uID);
66 
67 BOOL
68 ConResPaging(
69     IN PCON_PAGER Pager,
70     IN PAGE_PROMPT PagePrompt,
71     IN BOOL StartPaging,
72     IN UINT uID);
73 
74 #endif  /* __PAGER_H__ */
75