Release 1.3.26.
[wine/gsoc-2012-control.git] / include / wincon.h
blob1cf94287d6ae272a8de7d065a4d7682f65910f42
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 #ifndef NOGDI
27 #include <wingdi.h>
28 #endif
30 /* AttachConsole special pid value */
31 #define ATTACH_PARENT_PROCESS ((DWORD) -1)
33 /* GetConsoleDisplayMode flags */
34 #define CONSOLE_FULLSCREEN 1
35 #define CONSOLE_FULLSCREEN_HARDWARE 2
37 /* SetConsoleDisplayMode flags */
38 #define CONSOLE_FULLSCREEN_MODE 1
39 #define CONSOLE_WINDOWED_MODE 2
41 /* CONSOLE_SELECTION_INFO.dwFlags */
42 #define CONSOLE_NO_SELECTION 0x00
43 #define CONSOLE_SELECTION_IN_PROGRESS 0x01
44 #define CONSOLE_SELECTION_NOT_EMPTY 0x02
45 #define CONSOLE_MOUSE_SELECTION 0x04
46 #define CONSOLE_MOUSE_DOWN 0x08
48 /* handler routine control signal type */
49 #define CTRL_C_EVENT 0
50 #define CTRL_BREAK_EVENT 1
51 #define CTRL_CLOSE_EVENT 2
52 #define CTRL_LOGOFF_EVENT 5
53 #define CTRL_SHUTDOWN_EVENT 6
55 /* Console Mode flags */
56 #define ENABLE_PROCESSED_INPUT 0x0001
57 #define ENABLE_LINE_INPUT 0x0002
58 #define ENABLE_ECHO_INPUT 0x0004
59 #define ENABLE_WINDOW_INPUT 0x0008
60 #define ENABLE_MOUSE_INPUT 0x0010
61 #define ENABLE_INSERT_MODE 0x0020
62 #define ENABLE_QUICK_EDIT_MODE 0x0040
63 #define ENABLE_EXTENDED_FLAGS 0x0080
64 #define ENABLE_AUTO_POSITION 0x0100
66 #define ENABLE_PROCESSED_OUTPUT 0x01
67 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
70 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
72 /* Attributes flags: */
74 #define FOREGROUND_BLUE 0x0001
75 #define FOREGROUND_GREEN 0x0002
76 #define FOREGROUND_RED 0x0004
77 #define FOREGROUND_INTENSITY 0x0008
78 #define BACKGROUND_BLUE 0x0010
79 #define BACKGROUND_GREEN 0x0020
80 #define BACKGROUND_RED 0x0040
81 #define BACKGROUND_INTENSITY 0x0080
82 #define COMMON_LVB_LEADING_BYTE 0x0100
83 #define COMMON_LVB_TRAILING_BYTE 0x0200
84 #define COMMON_LVB_GRID_HORIZONTAL 0x0400
85 #define COMMON_LVB_GRID_LVERTICAL 0x0800
86 #define COMMON_LVB_GRID_RVERTICAL 0x1000
87 #define COMMON_LVB_REVERSE_VIDEO 0x4000
88 #define COMMON_LVB_UNDERSCORE 0x8000
90 /* CONSOLE_HISTORY_INFO.dwFlags */
91 #define HISTORY_NO_DUP_FLAG 0x01
93 typedef struct _CONSOLE_CURSOR_INFO {
94 DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */
95 BOOL bVisible; /* Visibility of cursor */
96 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
98 typedef struct tagCOORD
100 SHORT X;
101 SHORT Y;
102 } COORD, *LPCOORD;
104 typedef struct tagSMALL_RECT
106 SHORT Left;
107 SHORT Top;
108 SHORT Right;
109 SHORT Bottom;
110 } SMALL_RECT,*LPSMALL_RECT;
112 typedef struct _CONSOLE_FONT_INFO
114 DWORD nFont;
115 COORD dwFontSize;
116 } CONSOLE_FONT_INFO,*LPCONSOLE_FONT_INFO;
118 #ifndef NOGDI
119 typedef struct _CONSOLE_FONT_INFOEX
121 ULONG cbSize;
122 DWORD nFont;
123 COORD dwFontSize;
124 UINT FontFamily;
125 UINT FontWeight;
126 WCHAR FaceName[LF_FACESIZE];
127 } CONSOLE_FONT_INFOEX,*LPCONSOLE_FONT_INFOEX;
128 #endif
130 typedef struct tagCONSOLE_HISTORY_INFO
132 UINT cbSize;
133 UINT HistoryBufferSize;
134 UINT NumberOfHistoryBuffers;
135 DWORD dwFlags;
136 } CONSOLE_HISTORY_INFO,*LPCONSOLE_HISTORY_INFO;
138 typedef struct _CONSOLE_READCONSOLE_CONTROL
140 ULONG nLength;
141 ULONG nInitialChars;
142 ULONG dwCtrlWakeupMask;
143 ULONG dwConsoleKeyState;
144 } CONSOLE_READCONSOLE_CONTROL,*LPCONSOLE_READCONSOLE_CONTROL;
146 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
148 COORD dwSize;
149 COORD dwCursorPosition;
150 WORD wAttributes;
151 SMALL_RECT srWindow;
152 COORD dwMaximumWindowSize;
153 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
155 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
157 ULONG cbSize;
158 COORD dwSize;
159 COORD dwCursorPosition;
160 WORD wAttributes;
161 SMALL_RECT srWindow;
162 COORD dwMaximumWindowSize;
163 WORD wPopupAttributes;
164 BOOL bFullscreenSupported;
165 COLORREF ColorTable[16];
166 } CONSOLE_SCREEN_BUFFER_INFOEX,*LPCONSOLE_SCREEN_BUFFER_INFOEX;
168 typedef struct _CONSOLE_SELECTION_INFO
170 DWORD dwFlags;
171 COORD dwSelectionAnchor;
172 SMALL_RECT srSelection;
173 } CONSOLE_SELECTION_INFO,*LPCONSOLE_SELECTION_INFO;
175 typedef struct tagCHAR_INFO
177 union
179 WCHAR UnicodeChar;
180 CHAR AsciiChar;
181 } Char;
182 WORD Attributes;
183 } CHAR_INFO,*LPCHAR_INFO;
185 typedef struct tagKEY_EVENT_RECORD
187 BOOL bKeyDown; /* 04 */
188 WORD wRepeatCount; /* 08 */
189 WORD wVirtualKeyCode; /* 0A */
190 WORD wVirtualScanCode; /* 0C */
191 union /* 0E */
193 WCHAR UnicodeChar; /* 0E */
194 CHAR AsciiChar; /* 0E */
195 } uChar;
196 DWORD dwControlKeyState; /* 10 */
197 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
199 /* dwControlKeyState bitmask */
200 #define RIGHT_ALT_PRESSED 0x0001
201 #define LEFT_ALT_PRESSED 0x0002
202 #define RIGHT_CTRL_PRESSED 0x0004
203 #define LEFT_CTRL_PRESSED 0x0008
204 #define SHIFT_PRESSED 0x0010
205 #define NUMLOCK_ON 0x0020
206 #define SCROLLLOCK_ON 0x0040
207 #define CAPSLOCK_ON 0x0080
208 #define ENHANCED_KEY 0x0100
210 typedef struct tagMOUSE_EVENT_RECORD
212 COORD dwMousePosition;
213 DWORD dwButtonState;
214 DWORD dwControlKeyState;
215 DWORD dwEventFlags;
216 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
218 /* MOUSE_EVENT_RECORD.dwButtonState */
219 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
220 #define RIGHTMOST_BUTTON_PRESSED 0x0002
221 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
222 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
223 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
225 /* MOUSE_EVENT_RECORD.dwEventFlags */
226 #define MOUSE_MOVED 0x0001
227 #define DOUBLE_CLICK 0x0002
228 #define MOUSE_WHEELED 0x0004
229 #define MOUSE_HWHEELED 0x0008
231 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
233 COORD dwSize;
234 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
236 typedef struct tagMENU_EVENT_RECORD
238 UINT dwCommandId; /* perhaps UINT16 ??? */
239 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
241 typedef struct tagFOCUS_EVENT_RECORD
243 BOOL bSetFocus; /* perhaps BOOL16 ??? */
244 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
246 typedef struct tagINPUT_RECORD
248 WORD EventType; /* 00 */
249 union
251 KEY_EVENT_RECORD KeyEvent;
252 MOUSE_EVENT_RECORD MouseEvent;
253 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
254 MENU_EVENT_RECORD MenuEvent;
255 FOCUS_EVENT_RECORD FocusEvent;
256 } Event;
257 } INPUT_RECORD,*PINPUT_RECORD;
259 /* INPUT_RECORD.wEventType */
260 #define KEY_EVENT 0x01
261 #define MOUSE_EVENT 0x02
262 #define WINDOW_BUFFER_SIZE_EVENT 0x04
263 #define MENU_EVENT 0x08
264 #define FOCUS_EVENT 0x10
266 #define CONSOLE_TEXTMODE_BUFFER 1
268 #ifdef __i386__
269 /* Note: this should return a COORD, but calling convention for returning
270 * structures is different between Windows and gcc on i386. */
271 WINBASEAPI DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
273 static inline COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
275 union {
276 COORD c;
277 DWORD dw;
278 } u;
279 u.dw = GetLargestConsoleWindowSize(h);
280 return u.c;
282 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
284 #else /* __i386__ */
285 WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
286 #endif /* __i386__ */
288 WINBASEAPI BOOL WINAPI AddConsoleAliasA(LPSTR,LPSTR,LPSTR);
289 WINBASEAPI BOOL WINAPI AddConsoleAliasW(LPWSTR,LPWSTR,LPWSTR);
290 #define AddConsoleAlias WINELIB_NAME_AW(AddConsoleAlias)
291 WINBASEAPI BOOL WINAPI AllocConsole(VOID);
292 WINBASEAPI BOOL WINAPI AttachConsole(DWORD);
293 WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer( DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,LPVOID);
294 WINBASEAPI BOOL WINAPI FillConsoleOutputAttribute( HANDLE,WORD,DWORD,COORD,LPDWORD);
295 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
296 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
297 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
298 WINBASEAPI BOOL WINAPI FlushConsoleInputBuffer( HANDLE);
299 WINBASEAPI BOOL WINAPI FreeConsole(VOID);
300 WINBASEAPI BOOL WINAPI GenerateConsoleCtrlEvent( DWORD,DWORD);
301 WINBASEAPI DWORD WINAPI GetConsoleAliasA(LPSTR,LPSTR,DWORD,LPSTR);
302 WINBASEAPI DWORD WINAPI GetConsoleAliasW(LPWSTR,LPWSTR,DWORD,LPWSTR);
303 #define GetConsoleAlias WINELIB_NAME_AW(GetConsoleAlias)
304 WINBASEAPI DWORD WINAPI GetConsoleAliasesA(LPSTR,DWORD,LPSTR);
305 WINBASEAPI DWORD WINAPI GetConsoleAliasesW(LPWSTR,DWORD,LPWSTR);
306 #define GetConsoleAliases WINELIB_NAME_AW(GetConsoleAliases)
307 WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthA(LPSTR);
308 WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR);
309 #define GetConsoleAliasesLength WINELIB_NAME_AW(GetConsoleAliasesLength)
310 WINBASEAPI DWORD WINAPI GetConsoleAliasExesA(LPSTR,DWORD);
311 WINBASEAPI DWORD WINAPI GetConsoleAliasExesW(LPWSTR,DWORD);
312 #define GetConsoleAliasExes WINELIB_NAME_AW(GetConsoleAliasExes)
313 WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthA(VOID);
314 WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthW(VOID);
315 #define GetConsoleAliasExesLength WINELIB_NAME_AW(GetConsoleAliasExesLength)
316 WINBASEAPI UINT WINAPI GetConsoleCP(VOID);
317 WINBASEAPI BOOL WINAPI GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
318 WINBASEAPI BOOL WINAPI GetConsoleDisplayMode(LPDWORD);
319 WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE,DWORD);
320 WINBASEAPI BOOL WINAPI GetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO);
321 WINBASEAPI BOOL WINAPI GetConsoleInputExeNameA(DWORD,LPSTR);
322 WINBASEAPI BOOL WINAPI GetConsoleInputExeNameW(DWORD,LPWSTR);
323 #define GetConsoleInputExeName WINELIB_NAME_AW(GetConsoleInputExeName)
324 WINBASEAPI BOOL WINAPI GetConsoleMode( HANDLE,LPDWORD);
325 WINBASEAPI DWORD WINAPI GetConsoleOriginalTitleA(LPSTR,DWORD);
326 WINBASEAPI DWORD WINAPI GetConsoleOriginalTitleW(LPWSTR,DWORD);
327 #define GetConsoleOriginalTitle WINELIB_NAME_AW(GetConsoleOriginalTitle)
328 WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID);
329 WINBASEAPI DWORD WINAPI GetConsoleProcessList(LPDWORD,DWORD);
330 WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFO);
331 WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfoEx(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFOEX);
332 WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
333 WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
334 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
335 WINBASEAPI HWND WINAPI GetConsoleWindow(void);
336 WINBASEAPI BOOL WINAPI GetCurrentConsoleFont(HANDLE,BOOL,LPCONSOLE_FONT_INFO);
337 WINBASEAPI BOOL WINAPI GetCurrentConsoleFontEx(HANDLE,BOOL,LPCONSOLE_FONT_INFOEX);
338 WINBASEAPI BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE,LPDWORD);
339 WINBASEAPI BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
340 WINBASEAPI BOOL WINAPI PeekConsoleInputA( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
341 WINBASEAPI BOOL WINAPI PeekConsoleInputW( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
342 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
343 WINBASEAPI BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
344 WINBASEAPI BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
345 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
346 WINBASEAPI BOOL WINAPI ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
347 WINBASEAPI BOOL WINAPI ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
348 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
349 WINBASEAPI BOOL WINAPI ReadConsoleOutputA( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
350 WINBASEAPI BOOL WINAPI ReadConsoleOutputW( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
351 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
352 WINBASEAPI BOOL WINAPI ReadConsoleOutputAttribute( HANDLE,LPWORD,DWORD,COORD,LPDWORD);
353 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
354 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
355 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
356 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
357 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferW( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
358 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
359 WINBASEAPI BOOL WINAPI SetConsoleActiveScreenBuffer( HANDLE);
360 WINBASEAPI BOOL WINAPI SetConsoleCP(UINT);
361 WINBASEAPI BOOL WINAPI SetConsoleCtrlHandler( PHANDLER_ROUTINE,BOOL);
362 WINBASEAPI BOOL WINAPI SetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
363 WINBASEAPI BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
364 WINBASEAPI BOOL WINAPI SetConsoleDisplayMode(HANDLE,DWORD,LPCOORD);
365 WINBASEAPI BOOL WINAPI SetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO);
366 WINBASEAPI BOOL WINAPI SetConsoleMode( HANDLE,DWORD);
367 WINBASEAPI BOOL WINAPI SetConsoleOutputCP(UINT);
368 WINBASEAPI BOOL WINAPI SetConsoleScreenBufferInfoEx(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFOEX);
369 WINBASEAPI BOOL WINAPI SetConsoleScreenBufferSize(HANDLE,COORD);
370 WINBASEAPI BOOL WINAPI SetConsoleTextAttribute( HANDLE,WORD);
371 WINBASEAPI BOOL WINAPI SetConsoleTitleA(LPCSTR);
372 WINBASEAPI BOOL WINAPI SetConsoleTitleW(LPCWSTR);
373 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
374 WINBASEAPI BOOL WINAPI SetConsoleWindowInfo( HANDLE,BOOL,LPSMALL_RECT);
375 WINBASEAPI BOOL WINAPI SetCurrentConsoleFontEx(HANDLE,BOOL,LPCONSOLE_FONT_INFOEX);
376 WINBASEAPI BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
377 WINBASEAPI BOOL WINAPI WriteConsoleW(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
378 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
379 WINBASEAPI BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
380 WINBASEAPI BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
381 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
382 WINBASEAPI BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
383 WINBASEAPI BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
384 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
385 WINBASEAPI BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
386 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
387 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
388 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
390 #ifdef __cplusplus
392 #endif
394 #endif /* __WINE_WINCON_H */