- adapted kernel32 so that it no longer (directly) manages console
[wine.git] / include / wincon.h
blobb35bcca70fa223ac478c769a438e278a881cc367
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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,*LPINPUT_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 DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
179 inline static 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 COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
192 #endif /* __i386__ */
194 BOOL WINAPI AllocConsole(VOID);
195 HANDLE WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess, DWORD dwShareMode,
196 LPSECURITY_ATTRIBUTES sa, DWORD dwFlags,
197 LPVOID lpScreenBufferData);
198 BOOL WINAPI FillConsoleOutputAttribute( HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength,
199 COORD dwCoord, LPDWORD lpNumAttrsWritten);
200 BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
201 BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
202 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
203 BOOL WINAPI FlushConsoleInputBuffer( HANDLE handle);
204 BOOL WINAPI FreeConsole(VOID);
205 BOOL WINAPI GenerateConsoleCtrlEvent( DWORD dwCtrlEvent, DWORD dwProcessGroupID);
206 UINT WINAPI GetConsoleCP(VOID);
207 BOOL WINAPI GetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
208 BOOL WINAPI GetConsoleMode( HANDLE hcon,LPDWORD mode);
209 UINT WINAPI GetConsoleOutputCP(VOID);
210 BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
211 LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
212 DWORD WINAPI GetConsoleTitleA(LPSTR title,DWORD size);
213 DWORD WINAPI GetConsoleTitleW(LPWSTR title, DWORD size);
214 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
215 BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE hcon,LPDWORD nrofevents);
216 BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons);
217 BOOL WINAPI PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
218 BOOL WINAPI PeekConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
219 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
220 BOOL WINAPI ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
221 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
222 BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
223 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
224 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
225 BOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
226 LPDWORD lpNumberOfEventsRead);
227 BOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
228 LPDWORD lpNumberOfEventsRead);
229 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
230 BOOL WINAPI ReadConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
231 COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
232 BOOL WINAPI ReadConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
233 COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
234 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
235 BOOL WINAPI ReadConsoleOutputAttribute( HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength,
236 COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead);
237 BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
238 BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
239 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
240 BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
241 LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
242 LPCHAR_INFO lpFill);
243 BOOL WINAPI ScrollConsoleScreenBufferW( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
244 LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
245 LPCHAR_INFO lpFill);
246 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
247 BOOL WINAPI SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput);
248 BOOL WINAPI SetConsoleCP(UINT cp);
249 BOOL WINAPI SetConsoleCtrlHandler( PHANDLER_ROUTINE func, BOOL add);
250 BOOL WINAPI SetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
251 BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
252 BOOL WINAPI SetConsoleMode( HANDLE hcon, DWORD mode);
253 BOOL WINAPI SetConsoleOutputCP(UINT cp);
254 BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize);
255 BOOL WINAPI SetConsoleTextAttribute( HANDLE hConsoleOutput,WORD wAttr);
256 BOOL WINAPI SetConsoleTitleA(LPCSTR title);
257 BOOL WINAPI SetConsoleTitleW(LPCWSTR title);
258 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
259 BOOL WINAPI SetConsoleWindowInfo( HANDLE hcon, BOOL bAbsolute, LPSMALL_RECT window);
260 BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
261 BOOL WINAPI WriteConsoleW(HANDLE, CONST VOID *lpBuffer, DWORD,LPDWORD,LPVOID);
262 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
263 BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
264 BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
265 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
266 BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
267 BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
268 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
269 BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
270 BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
271 BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
272 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
274 #ifdef __cplusplus
276 #endif
278 #endif /* __WINE_WINCON_H */