riched20: Yet more tests for EM_STREAMIN.
[wine] / include / wincon.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __WINE_WINCON_H
20 #define __WINE_WINCON_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #define CONSOLE_FULLSCREEN          1
27 #define CONSOLE_FULLSCREEN_HARDWARE 2
28
29 #define CTRL_C_EVENT        0
30 #define CTRL_BREAK_EVENT    1
31 #define CTRL_CLOSE_EVENT    2
32 #define CTRL_LOGOFF_EVENT   5
33 #define CTRL_SHUTDOWN_EVENT 6
34
35 /* Console Mode flags */
36 #define ENABLE_PROCESSED_INPUT 0x01
37 #define ENABLE_LINE_INPUT      0x02
38 #define ENABLE_ECHO_INPUT      0x04
39 #define ENABLE_WINDOW_INPUT    0x08
40 #define ENABLE_MOUSE_INPUT     0x10
41
42 #define ENABLE_PROCESSED_OUTPUT   0x01
43 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
44
45
46 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
47
48 /* Attributes flags: */
49
50 #define FOREGROUND_BLUE      0x0001 /* text color contains blue. */
51 #define FOREGROUND_GREEN     0x0002 /* text color contains green. */
52 #define FOREGROUND_RED       0x0004 /* text color contains red. */
53 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
54 #define BACKGROUND_BLUE      0x0010 /* background color contains blue. */
55 #define BACKGROUND_GREEN     0x0020 /* background color contains green. */
56 #define BACKGROUND_RED       0x0040 /* background color contains red. */
57 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
58
59 typedef struct _CONSOLE_CURSOR_INFO {
60     DWORD       dwSize;   /* Between 1 & 100 for percentage of cell filled */
61     BOOL        bVisible; /* Visibility of cursor */
62 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
63
64 typedef struct tagCOORD
65 {
66     SHORT X;
67     SHORT Y;
68 } COORD, *LPCOORD;
69
70 typedef struct tagSMALL_RECT
71 {
72     SHORT Left;
73     SHORT Top;
74     SHORT Right;
75     SHORT Bottom;
76 } SMALL_RECT,*LPSMALL_RECT;
77
78 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
79 {
80     COORD       dwSize;
81     COORD       dwCursorPosition;
82     WORD        wAttributes;
83     SMALL_RECT  srWindow;
84     COORD       dwMaximumWindowSize;
85 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
86
87 typedef struct tagCHAR_INFO
88 {
89     union
90         {
91         WCHAR UnicodeChar;
92         CHAR AsciiChar;
93         } Char;
94     WORD        Attributes;
95 } CHAR_INFO,*LPCHAR_INFO;
96
97 typedef struct tagKEY_EVENT_RECORD
98 {
99     BOOL        bKeyDown;               /* 04 */
100     WORD        wRepeatCount;           /* 08 */
101     WORD        wVirtualKeyCode;        /* 0A */
102     WORD        wVirtualScanCode;       /* 0C */
103     union                               /* 0E */
104         {
105         WCHAR UnicodeChar;              /* 0E */
106         CHAR AsciiChar;                 /* 0E */
107         } uChar;
108     DWORD       dwControlKeyState;      /* 10 */
109 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
110
111 /* dwControlKeyState bitmask */
112 #define RIGHT_ALT_PRESSED       0x0001
113 #define LEFT_ALT_PRESSED        0x0002
114 #define RIGHT_CTRL_PRESSED      0x0004
115 #define LEFT_CTRL_PRESSED       0x0008
116 #define SHIFT_PRESSED           0x0010
117 #define NUMLOCK_ON              0x0020
118 #define SCROLLLOCK_ON           0x0040
119 #define CAPSLOCK_ON             0x0080
120 #define ENHANCED_KEY            0x0100
121
122 typedef struct tagMOUSE_EVENT_RECORD
123 {
124     COORD       dwMousePosition;
125     DWORD       dwButtonState;
126     DWORD       dwControlKeyState;
127     DWORD       dwEventFlags;
128 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
129
130 #define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
131 #define RIGHTMOST_BUTTON_PRESSED        0x0002
132 #define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
133 #define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
134 #define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010
135
136 #define MOUSE_MOVED                     0x0001
137 #define DOUBLE_CLICK                    0x0002
138 #define MOUSE_WHEELED                   0x0004
139
140 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
141 {
142     COORD       dwSize;
143 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
144
145 typedef struct tagMENU_EVENT_RECORD
146 {
147     UINT        dwCommandId; /* perhaps UINT16 ??? */
148 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
149
150 typedef struct tagFOCUS_EVENT_RECORD
151 {
152     BOOL      bSetFocus; /* perhaps BOOL16 ??? */
153 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
154
155 typedef struct tagINPUT_RECORD
156 {
157     WORD                EventType;              /* 00 */
158     union
159         {
160         KEY_EVENT_RECORD KeyEvent;
161         MOUSE_EVENT_RECORD MouseEvent;
162         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
163         MENU_EVENT_RECORD MenuEvent;
164         FOCUS_EVENT_RECORD FocusEvent;
165         } Event;
166 } INPUT_RECORD,*PINPUT_RECORD;
167
168 /* INPUT_RECORD.wEventType */
169 #define KEY_EVENT                       0x01
170 #define MOUSE_EVENT                     0x02
171 #define WINDOW_BUFFER_SIZE_EVENT        0x04
172 #define MENU_EVENT                      0x08
173 #define FOCUS_EVENT                     0x10
174
175 #define CONSOLE_TEXTMODE_BUFFER  1
176
177 #ifdef __i386__
178 /* Note: this should return a COORD, but calling convention for returning
179  * structures is different between Windows and gcc on i386. */
180 WINBASEAPI DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
181
182 static inline COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
183 {
184     union {
185       COORD c;
186       DWORD dw;
187     } u;
188     u.dw = GetLargestConsoleWindowSize(h);
189     return u.c;
190 }
191 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
192
193 #else  /* __i386__ */
194 WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
195 #endif  /* __i386__ */
196
197 WINBASEAPI BOOL   WINAPI AllocConsole(VOID);
198 WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer( DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,LPVOID);
199 WINBASEAPI BOOL WINAPI   FillConsoleOutputAttribute( HANDLE,WORD,DWORD,COORD,LPDWORD);
200 WINBASEAPI BOOL WINAPI   FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
201 WINBASEAPI BOOL WINAPI   FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
202 #define                  FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
203 WINBASEAPI BOOL WINAPI   FlushConsoleInputBuffer( HANDLE);
204 WINBASEAPI BOOL WINAPI   FreeConsole(VOID);
205 WINBASEAPI BOOL WINAPI   GenerateConsoleCtrlEvent( DWORD,DWORD);
206 WINBASEAPI UINT WINAPI   GetConsoleCP(VOID);
207 WINBASEAPI BOOL WINAPI   GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
208 WINBASEAPI BOOL WINAPI   GetConsoleMode( HANDLE,LPDWORD);
209 WINBASEAPI UINT WINAPI   GetConsoleOutputCP(VOID);
210 WINBASEAPI BOOL WINAPI   GetConsoleScreenBufferInfo(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFO);
211 WINBASEAPI DWORD WINAPI  GetConsoleTitleA(LPSTR,DWORD);
212 WINBASEAPI DWORD WINAPI  GetConsoleTitleW(LPWSTR,DWORD);
213 #define                  GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
214 WINBASEAPI HWND WINAPI   GetConsoleWindow(void);
215 WINBASEAPI BOOL WINAPI   GetNumberOfConsoleInputEvents( HANDLE,LPDWORD);
216 WINBASEAPI BOOL WINAPI   GetNumberOfConsoleMouseButtons(LPDWORD);
217 WINBASEAPI BOOL WINAPI   PeekConsoleInputA( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
218 WINBASEAPI BOOL WINAPI   PeekConsoleInputW( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
219 #define                  PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
220 WINBASEAPI BOOL WINAPI   ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
221 WINBASEAPI BOOL WINAPI   ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
222 #define                  ReadConsole WINELIB_NAME_AW(ReadConsole)
223 WINBASEAPI BOOL WINAPI   ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
224 WINBASEAPI BOOL WINAPI   ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
225 #define                  ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
226 WINBASEAPI BOOL WINAPI   ReadConsoleOutputA( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
227 WINBASEAPI BOOL WINAPI   ReadConsoleOutputW( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
228 #define                  ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
229 WINBASEAPI BOOL WINAPI   ReadConsoleOutputAttribute( HANDLE,LPWORD,DWORD,COORD,LPDWORD);
230 WINBASEAPI BOOL WINAPI   ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
231 WINBASEAPI BOOL WINAPI   ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
232 #define                  ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
233 WINBASEAPI BOOL WINAPI   ScrollConsoleScreenBufferA( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
234 WINBASEAPI BOOL WINAPI   ScrollConsoleScreenBufferW( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
235 #define                  ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
236 WINBASEAPI BOOL WINAPI   SetConsoleActiveScreenBuffer( HANDLE);
237 WINBASEAPI BOOL WINAPI   SetConsoleCP(UINT);
238 WINBASEAPI BOOL WINAPI   SetConsoleCtrlHandler( PHANDLER_ROUTINE,BOOL);
239 WINBASEAPI BOOL WINAPI   SetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
240 WINBASEAPI BOOL WINAPI   SetConsoleCursorPosition(HANDLE,COORD);
241 WINBASEAPI BOOL WINAPI   SetConsoleMode( HANDLE,DWORD);
242 WINBASEAPI BOOL WINAPI   SetConsoleOutputCP(UINT);
243 WINBASEAPI BOOL WINAPI   SetConsoleScreenBufferSize(HANDLE,COORD);
244 WINBASEAPI BOOL WINAPI   SetConsoleTextAttribute( HANDLE,WORD);
245 WINBASEAPI BOOL WINAPI   SetConsoleTitleA(LPCSTR);
246 WINBASEAPI BOOL WINAPI   SetConsoleTitleW(LPCWSTR);
247 #define                  SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
248 WINBASEAPI BOOL WINAPI   SetConsoleWindowInfo( HANDLE,BOOL,LPSMALL_RECT);
249 WINBASEAPI BOOL WINAPI   WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
250 WINBASEAPI BOOL WINAPI   WriteConsoleW(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
251 #define                  WriteConsole WINELIB_NAME_AW(WriteConsole)
252 WINBASEAPI BOOL WINAPI   WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
253 WINBASEAPI BOOL WINAPI   WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
254 #define                  WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
255 WINBASEAPI BOOL WINAPI   WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
256 WINBASEAPI BOOL WINAPI   WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
257 #define                  WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
258 WINBASEAPI BOOL WINAPI   WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
259 WINBASEAPI BOOL WINAPI   WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
260 WINBASEAPI BOOL WINAPI   WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
261 #define                  WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
262
263 #ifdef __cplusplus
264 }
265 #endif
266
267 #endif  /* __WINE_WINCON_H */