xref: /reactos/sdk/lib/conutils/pager.h (revision 50cf16b3)
1 /*
2  * PROJECT:     ReactOS Console Utilities Library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Console/terminal paging functionality.
5  * COPYRIGHT:   Copyright 2017-2018 ReactOS Team
6  *              Copyright 2017-2018 Hermes Belusca-Maito
7  */
8 
9 /**
10  * @file    pager.h
11  * @ingroup ConUtils
12  *
13  * @brief   Console/terminal paging functionality.
14  **/
15 
16 #ifndef __PAGER_H__
17 #define __PAGER_H__
18 
19 #pragma once
20 
21 #ifndef _UNICODE
22 #error The ConUtils library at the moment only supports compilation with _UNICODE defined!
23 #endif
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 // #include <wincon.h>
31 
32 
33 typedef struct _CON_PAGER
34 {
35     PCON_SCREEN Screen;
36 
37     // TODO: Add more properties. Maybe those extra parameters
38     // of PAGE_PROMPT could go there?
39 
40     /* Used to count number of lines since last pause */
41     DWORD LineCount;
42 } CON_PAGER, *PCON_PAGER;
43 
44 #define INIT_CON_PAGER(pScreen)     {(pScreen), 0}
45 
46 #define InitializeConPager(pPager, pScreen) \
47 do { \
48     (pPager)->Screen = (pScreen);   \
49     (pPager)->LineCount = 0;        \
50 } while (0)
51 
52 
53                                       // Pager,         Done,     Total
54 typedef BOOL (__stdcall *PAGE_PROMPT)(IN PCON_PAGER, IN DWORD, IN DWORD);
55 
56 BOOL
57 ConWritePaging(
58     IN PCON_PAGER Pager,
59     IN PAGE_PROMPT PagePrompt,
60     IN BOOL StartPaging,
61     IN PTCHAR szStr,
62     IN DWORD len);
63 
64 BOOL
65 ConPutsPaging(
66     IN PCON_PAGER Pager,
67     IN PAGE_PROMPT PagePrompt,
68     IN BOOL StartPaging,
69     IN LPTSTR szStr);
70 
71 BOOL
72 ConResPagingEx(
73     IN PCON_PAGER Pager,
74     IN PAGE_PROMPT PagePrompt,
75     IN BOOL StartPaging,
76     IN HINSTANCE hInstance OPTIONAL,
77     IN UINT uID);
78 
79 BOOL
80 ConResPaging(
81     IN PCON_PAGER Pager,
82     IN PAGE_PROMPT PagePrompt,
83     IN BOOL StartPaging,
84     IN UINT uID);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif  /* __PAGER_H__ */
91 
92 /* EOF */
93