xref: /reactos/sdk/lib/conutils/pager.h (revision a1fc312a)
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 typedef BOOL (__stdcall *PAGE_PROMPT)(
54     IN PCON_PAGER Pager,
55     IN DWORD Done,
56     IN DWORD Total);
57 
58 BOOL
59 ConWritePaging(
60     IN PCON_PAGER Pager,
61     IN PAGE_PROMPT PagePrompt,
62     IN BOOL StartPaging,
63     IN PCTCH szStr,
64     IN DWORD len);
65 
66 BOOL
67 ConPutsPaging(
68     IN PCON_PAGER Pager,
69     IN PAGE_PROMPT PagePrompt,
70     IN BOOL StartPaging,
71     IN PCTSTR szStr);
72 
73 BOOL
74 ConResPagingEx(
75     IN PCON_PAGER Pager,
76     IN PAGE_PROMPT PagePrompt,
77     IN BOOL StartPaging,
78     IN HINSTANCE hInstance OPTIONAL,
79     IN UINT uID);
80 
81 BOOL
82 ConResPaging(
83     IN PCON_PAGER Pager,
84     IN PAGE_PROMPT PagePrompt,
85     IN BOOL StartPaging,
86     IN UINT uID);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif  /* __PAGER_H__ */
93 
94 /* EOF */
95