user32/tests: Flush events after showing/hiding a window to avoid z-order race condit...
[wine.git] / include / wincon.h
blobf17961ef598171e1273d4a699ea270f53502ca60
1 /*
2 * Copyright (C) the Wine project
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.
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.
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
19 #ifndef __WINE_WINCON_H
20 #define __WINE_WINCON_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 #define CTRL_C_EVENT 0
27 #define CTRL_BREAK_EVENT 1
28 #define CTRL_CLOSE_EVENT 2
29 #define CTRL_LOGOFF_EVENT 5
30 #define CTRL_SHUTDOWN_EVENT 6
32 /* Console Mode flags */
33 #define ENABLE_PROCESSED_INPUT 0x01
34 #define ENABLE_LINE_INPUT 0x02
35 #define ENABLE_ECHO_INPUT 0x04
36 #define ENABLE_WINDOW_INPUT 0x08
37 #define ENABLE_MOUSE_INPUT 0x10
39 #define ENABLE_PROCESSED_OUTPUT 0x01
40 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
43 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
45 /* Attributes flags: */
47 #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
48 #define FOREGROUND_GREEN 0x0002 /* text color contains green. */
49 #define FOREGROUND_RED 0x0004 /* text color contains red. */
50 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
51 #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
52 #define BACKGROUND_GREEN 0x0020 /* background color contains green. */
53 #define BACKGROUND_RED 0x0040 /* background color contains red. */
54 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
56 typedef struct _CONSOLE_CURSOR_INFO {
57 DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */
58 BOOL bVisible; /* Visibility of cursor */
59 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
61 typedef struct tagCOORD
63 SHORT X;
64 SHORT Y;
65 } COORD, *LPCOORD;
67 typedef struct tagSMALL_RECT
69 SHORT Left;
70 SHORT Top;
71 SHORT Right;
72 SHORT Bottom;
73 } SMALL_RECT,*LPSMALL_RECT;
75 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
77 COORD dwSize;
78 COORD dwCursorPosition;
79 WORD wAttributes;
80 SMALL_RECT srWindow;
81 COORD dwMaximumWindowSize;
82 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
84 typedef struct tagCHAR_INFO
86 union
88 WCHAR UnicodeChar;
89 CHAR AsciiChar;
90 } Char;
91 WORD Attributes;
92 } CHAR_INFO,*LPCHAR_INFO;
94 typedef struct tagKEY_EVENT_RECORD
96 BOOL bKeyDown; /* 04 */
97 WORD wRepeatCount; /* 08 */
98 WORD wVirtualKeyCode; /* 0A */
99 WORD wVirtualScanCode; /* 0C */
100 union /* 0E */
102 WCHAR UnicodeChar; /* 0E */
103 CHAR AsciiChar; /* 0E */
104 } uChar;
105 DWORD dwControlKeyState; /* 10 */
106 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
108 /* dwControlKeyState bitmask */
109 #define RIGHT_ALT_PRESSED 0x0001
110 #define LEFT_ALT_PRESSED 0x0002
111 #define RIGHT_CTRL_PRESSED 0x0004
112 #define LEFT_CTRL_PRESSED 0x0008
113 #define SHIFT_PRESSED 0x0010
114 #define NUMLOCK_ON 0x0020
115 #define SCROLLLOCK_ON 0x0040
116 #define CAPSLOCK_ON 0x0080
117 #define ENHANCED_KEY 0x0100
119 typedef struct tagMOUSE_EVENT_RECORD
121 COORD dwMousePosition;
122 DWORD dwButtonState;
123 DWORD dwControlKeyState;
124 DWORD dwEventFlags;
125 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
127 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
128 #define RIGHTMOST_BUTTON_PRESSED 0x0002
129 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
130 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
131 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
133 #define MOUSE_MOVED 0x0001
134 #define DOUBLE_CLICK 0x0002
135 #define MOUSE_WHEELED 0x0004
137 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
139 COORD dwSize;
140 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
142 typedef struct tagMENU_EVENT_RECORD
144 UINT dwCommandId; /* perhaps UINT16 ??? */
145 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
147 typedef struct tagFOCUS_EVENT_RECORD
149 BOOL bSetFocus; /* perhaps BOOL16 ??? */
150 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
152 typedef struct tagINPUT_RECORD
154 WORD EventType; /* 00 */
155 union
157 KEY_EVENT_RECORD KeyEvent;
158 MOUSE_EVENT_RECORD MouseEvent;
159 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
160 MENU_EVENT_RECORD MenuEvent;
161 FOCUS_EVENT_RECORD FocusEvent;
162 } Event;
163 } INPUT_RECORD,*PINPUT_RECORD;
165 /* INPUT_RECORD.wEventType */
166 #define KEY_EVENT 0x01
167 #define MOUSE_EVENT 0x02
168 #define WINDOW_BUFFER_SIZE_EVENT 0x04
169 #define MENU_EVENT 0x08
170 #define FOCUS_EVENT 0x10
172 #define CONSOLE_TEXTMODE_BUFFER 1
174 #ifdef __i386__
175 /* Note: this should return a COORD, but calling convention for returning
176 * structures is different between Windows and gcc on i386. */
177 WINBASEAPI DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
179 static inline COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
181 union {
182 COORD c;
183 DWORD dw;
184 } u;
185 u.dw = GetLargestConsoleWindowSize(h);
186 return u.c;
188 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
190 #else /* __i386__ */
191 WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
192 #endif /* __i386__ */
194 WINBASEAPI BOOL WINAPI AllocConsole(VOID);
195 WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer( DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,LPVOID);
196 WINBASEAPI BOOL WINAPI FillConsoleOutputAttribute( HANDLE,WORD,DWORD,COORD,LPDWORD);
197 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
198 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
199 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
200 WINBASEAPI BOOL WINAPI FlushConsoleInputBuffer( HANDLE);
201 WINBASEAPI BOOL WINAPI FreeConsole(VOID);
202 WINBASEAPI BOOL WINAPI GenerateConsoleCtrlEvent( DWORD,DWORD);
203 WINBASEAPI UINT WINAPI GetConsoleCP(VOID);
204 WINBASEAPI BOOL WINAPI GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
205 WINBASEAPI BOOL WINAPI GetConsoleMode( HANDLE,LPDWORD);
206 WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID);
207 WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFO);
208 WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
209 WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
210 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
211 WINBASEAPI HWND WINAPI GetConsoleWindow(void);
212 WINBASEAPI BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE,LPDWORD);
213 WINBASEAPI BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
214 WINBASEAPI BOOL WINAPI PeekConsoleInputA( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
215 WINBASEAPI BOOL WINAPI PeekConsoleInputW( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
216 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
217 WINBASEAPI BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
218 WINBASEAPI BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
219 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
220 WINBASEAPI BOOL WINAPI ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
221 WINBASEAPI BOOL WINAPI ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
222 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
223 WINBASEAPI BOOL WINAPI ReadConsoleOutputA( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
224 WINBASEAPI BOOL WINAPI ReadConsoleOutputW( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
225 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
226 WINBASEAPI BOOL WINAPI ReadConsoleOutputAttribute( HANDLE,LPWORD,DWORD,COORD,LPDWORD);
227 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
228 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
229 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
230 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
231 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferW( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
232 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
233 WINBASEAPI BOOL WINAPI SetConsoleActiveScreenBuffer( HANDLE);
234 WINBASEAPI BOOL WINAPI SetConsoleCP(UINT);
235 WINBASEAPI BOOL WINAPI SetConsoleCtrlHandler( PHANDLER_ROUTINE,BOOL);
236 WINBASEAPI BOOL WINAPI SetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
237 WINBASEAPI BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
238 WINBASEAPI BOOL WINAPI SetConsoleMode( HANDLE,DWORD);
239 WINBASEAPI BOOL WINAPI SetConsoleOutputCP(UINT);
240 WINBASEAPI BOOL WINAPI SetConsoleScreenBufferSize(HANDLE,COORD);
241 WINBASEAPI BOOL WINAPI SetConsoleTextAttribute( HANDLE,WORD);
242 WINBASEAPI BOOL WINAPI SetConsoleTitleA(LPCSTR);
243 WINBASEAPI BOOL WINAPI SetConsoleTitleW(LPCWSTR);
244 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
245 WINBASEAPI BOOL WINAPI SetConsoleWindowInfo( HANDLE,BOOL,LPSMALL_RECT);
246 WINBASEAPI BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
247 WINBASEAPI BOOL WINAPI WriteConsoleW(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
248 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
249 WINBASEAPI BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
250 WINBASEAPI BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
251 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
252 WINBASEAPI BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
253 WINBASEAPI BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
254 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
255 WINBASEAPI BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
256 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
257 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
258 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
260 #ifdef __cplusplus
262 #endif
264 #endif /* __WINE_WINCON_H */