xref: /reactos/dll/cpl/console/console.h (revision c4e2826c)
1 #ifndef CONSOLE_H__
2 #define CONSOLE_H__
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <wchar.h>
7 
8 #define WIN32_NO_STATUS
9 
10 #include <windef.h>
11 #include <winbase.h>
12 
13 #include <wincon.h>
14 #include <wingdi.h>
15 #include <winnls.h>
16 #include <winreg.h>
17 
18 #include <winuser.h>
19 #include <commctrl.h>
20 #include <cpl.h>
21 
22 #include <strsafe.h>
23 
24 #include "resource.h"
25 
26 #define EnableDlgItem(hDlg, nID, bEnable)   \
27     EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
28 
29 /* Shared header with the GUI Terminal Front-End from consrv.dll */
30 #include "concfg.h" // in /winsrv/concfg/
31 
32 typedef enum _TEXT_TYPE
33 {
34     Screen,
35     Popup
36 } TEXT_TYPE;
37 
38 typedef struct _FONT_PREVIEW
39 {
40     HFONT hFont;
41     UINT  CharWidth;
42     UINT  CharHeight;
43 } FONT_PREVIEW;
44 
45 /* Globals */
46 extern HINSTANCE hApplet;
47 extern PCONSOLE_STATE_INFO ConInfo;
48 extern FONT_PREVIEW FontPreview;
49 
50 VOID ApplyConsoleInfo(HWND hwndDlg);
51 
52 
53 VOID
54 RefreshFontPreview(
55     IN FONT_PREVIEW* Preview,
56     IN PCONSOLE_STATE_INFO pConInfo);
57 
58 VOID
59 UpdateFontPreview(
60     IN FONT_PREVIEW* Preview,
61     IN HFONT hFont,
62     IN UINT  CharWidth,
63     IN UINT  CharHeight);
64 
65 #define ResetFontPreview(Preview)   \
66     UpdateFontPreview((Preview), NULL, 0, 0)
67 
68 
69 /* Preview Windows */
70 BOOL
71 RegisterWinPrevClass(
72     IN HINSTANCE hInstance);
73 
74 BOOL
75 UnRegisterWinPrevClass(
76     IN HINSTANCE hInstance);
77 
78 
79 VOID
80 PaintText(
81     IN LPDRAWITEMSTRUCT drawItem,
82     IN PCONSOLE_STATE_INFO pConInfo,
83     IN TEXT_TYPE TextMode);
84 
85 
86 struct _LIST_CTL;
87 
88 typedef INT (*PLIST_GETCOUNT)(IN struct _LIST_CTL* ListCtl);
89 typedef ULONG_PTR (*PLIST_GETDATA)(IN struct _LIST_CTL* ListCtl, IN INT Index);
90 
91 typedef struct _LIST_CTL
92 {
93     HWND hWndList;
94     PLIST_GETCOUNT GetCount;
95     PLIST_GETDATA  GetData;
96 } LIST_CTL, *PLIST_CTL;
97 
98 UINT
99 BisectListSortedByValueEx(
100     IN PLIST_CTL ListCtl,
101     IN ULONG_PTR Value,
102     IN UINT itemStart,
103     IN UINT itemEnd,
104     OUT PUINT pValueItem OPTIONAL,
105     IN BOOL BisectRightOrLeft);
106 
107 UINT
108 BisectListSortedByValue(
109     IN PLIST_CTL ListCtl,
110     IN ULONG_PTR Value,
111     OUT PUINT pValueItem OPTIONAL,
112     IN BOOL BisectRightOrLeft);
113 
114 #endif /* CONSOLE_H__ */
115