- implement WM_NOTIFYFORMAT
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 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
31
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
38 /* Wine only code (extension) */
39 #define WINE_ENABLE_LINE_INPUT_EMACS 0x80
40
41 #define ENABLE_PROCESSED_OUTPUT   0x01
42 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
43
44
45 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
46
47 /* Attributes flags: */
48
49 #define FOREGROUND_BLUE      0x0001 /* text color contains blue. */
50 #define FOREGROUND_GREEN     0x0002 /* text color contains green. */
51 #define FOREGROUND_RED       0x0004 /* text color contains red. */
52 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
53 #define BACKGROUND_BLUE      0x0010 /* background color contains blue. */
54 #define BACKGROUND_GREEN     0x0020 /* background color contains green. */
55 #define BACKGROUND_RED       0x0040 /* background color contains red. */
56 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
57
58 typedef struct _CONSOLE_CURSOR_INFO {
59     DWORD       dwSize;   /* Between 1 & 100 for percentage of cell filled */
60     BOOL        bVisible; /* Visibility of cursor */
61 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
62
63 typedef struct tagCOORD
64 {
65     SHORT X;
66     SHORT Y;
67 } COORD, *LPCOORD;
68
69 typedef struct tagSMALL_RECT
70 {
71     SHORT Left;
72     SHORT Top;
73     SHORT Right;
74     SHORT Bottom;
75 } SMALL_RECT,*LPSMALL_RECT;
76
77 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
78 {
79     COORD       dwSize;
80     COORD       dwCursorPosition;
81     WORD        wAttributes;
82     SMALL_RECT  srWindow;
83     COORD       dwMaximumWindowSize;
84 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
85
86 typedef struct tagCHAR_INFO
87 {
88     union
89         {
90         WCHAR UnicodeChar;
91         CHAR AsciiChar;
92         } Char;
93     WORD        Attributes;
94 } CHAR_INFO,*LPCHAR_INFO;
95
96 typedef struct tagKEY_EVENT_RECORD
97 {
98     BOOL        bKeyDown;               /* 04 */
99     WORD        wRepeatCount;           /* 08 */
100     WORD        wVirtualKeyCode;        /* 0A */
101     WORD        wVirtualScanCode;       /* 0C */
102     union                               /* 0E */
103         {
104         WCHAR UnicodeChar;              /* 0E */
105         CHAR AsciiChar;                 /* 0E */
106         } uChar;
107     DWORD       dwControlKeyState;      /* 10 */
108 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
109
110 /* dwControlKeyState bitmask */
111 #define RIGHT_ALT_PRESSED       0x0001
112 #define LEFT_ALT_PRESSED        0x0002
113 #define RIGHT_CTRL_PRESSED      0x0004
114 #define LEFT_CTRL_PRESSED       0x0008
115 #define SHIFT_PRESSED           0x0010
116 #define NUMLOCK_ON              0x0020
117 #define SCROLLLOCK_ON           0x0040
118 #define CAPSLOCK_ON             0x0080
119 #define ENHANCED_KEY            0x0100
120
121 typedef struct tagMOUSE_EVENT_RECORD
122 {
123     COORD       dwMousePosition;
124     DWORD       dwButtonState;
125     DWORD       dwControlKeyState;
126     DWORD       dwEventFlags;
127 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
128
129 #define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
130 #define RIGHTMOST_BUTTON_PRESSED        0x0002
131 #define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
132 #define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
133 #define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010
134
135 #define MOUSE_MOVED                     0x0001
136 #define DOUBLE_CLICK                    0x0002
137 #define MOUSE_WHEELED                   0x0004
138
139 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
140 {
141     COORD       dwSize;
142 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
143
144 typedef struct tagMENU_EVENT_RECORD
145 {
146     UINT        dwCommandId; /* perhaps UINT16 ??? */
147 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
148
149 typedef struct tagFOCUS_EVENT_RECORD
150 {
151     BOOL      bSetFocus; /* perhaps BOOL16 ??? */
152 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
153
154 typedef struct tagINPUT_RECORD
155 {
156     WORD                EventType;              /* 00 */
157     union
158         {
159         KEY_EVENT_RECORD KeyEvent;
160         MOUSE_EVENT_RECORD MouseEvent;
161         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
162         MENU_EVENT_RECORD MenuEvent;
163         FOCUS_EVENT_RECORD FocusEvent;
164         } Event;
165 } INPUT_RECORD,*LPINPUT_RECORD;
166
167 /* INPUT_RECORD.wEventType */
168 #define KEY_EVENT                       0x01
169 #define MOUSE_EVENT                     0x02
170 #define WINDOW_BUFFER_SIZE_EVENT        0x04
171 #define MENU_EVENT                      0x08
172 #define FOCUS_EVENT                     0x10
173
174 #define CONSOLE_TEXTMODE_BUFFER  1
175
176 #ifdef __i386__
177 /* Note: this should return a COORD, but calling convention for returning
178  * structures is different between Windows and gcc on i386. */
179 DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
180
181 inline static COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
182 {
183     DWORD dw = GetLargestConsoleWindowSize(h);
184     return *(COORD *)&dw;
185 }
186 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
187
188 #else  /* __i386__ */
189 COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
190 #endif  /* __i386__ */
191
192 BOOL WINAPI   AllocConsole(VOID);
193 HANDLE WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess, DWORD dwShareMode,
194                                          LPSECURITY_ATTRIBUTES sa, DWORD dwFlags,
195                                          LPVOID lpScreenBufferData);
196 BOOL WINAPI   FillConsoleOutputAttribute( HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength,
197                                           COORD dwCoord, LPDWORD lpNumAttrsWritten);
198 BOOL WINAPI   FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
199 BOOL WINAPI   FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
200 #define       FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
201 BOOL WINAPI   FlushConsoleInputBuffer( HANDLE handle);
202 BOOL WINAPI   FreeConsole(VOID);
203 BOOL WINAPI   GenerateConsoleCtrlEvent( DWORD dwCtrlEvent, DWORD dwProcessGroupID);
204 UINT WINAPI   GetConsoleCP(VOID);
205 BOOL WINAPI   GetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
206 BOOL WINAPI   GetConsoleMode( HANDLE hcon,LPDWORD mode);
207 UINT WINAPI   GetConsoleOutputCP(VOID);
208 BOOL WINAPI   GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
209                                          LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
210 DWORD WINAPI  GetConsoleTitleA(LPSTR title,DWORD size);
211 DWORD WINAPI  GetConsoleTitleW(LPWSTR title, DWORD size);
212 #define       GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
213 BOOL WINAPI   GetNumberOfConsoleInputEvents( HANDLE hcon,LPDWORD nrofevents);
214 BOOL WINAPI   GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons);
215 BOOL WINAPI   PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
216 BOOL WINAPI   PeekConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
217 #define       PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
218 BOOL WINAPI   ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
219                            LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
220 BOOL WINAPI   ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
221                            LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
222 #define       ReadConsole WINELIB_NAME_AW(ReadConsole)
223 BOOL WINAPI   ReadConsoleInputA(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
224                                 LPDWORD lpNumberOfEventsRead);
225 BOOL WINAPI   ReadConsoleInputW(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
226                                 LPDWORD lpNumberOfEventsRead);
227 #define       ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
228 BOOL WINAPI   ReadConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
229                                   COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
230 BOOL WINAPI   ReadConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
231                                   COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
232 #define       ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
233 BOOL WINAPI   ReadConsoleOutputAttribute( HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength,
234                                           COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead);
235 BOOL WINAPI   ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
236 BOOL WINAPI   ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
237 #define       ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
238 BOOL WINAPI   ScrollConsoleScreenBufferA( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
239                                           LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
240                                           LPCHAR_INFO lpFill);
241 BOOL WINAPI   ScrollConsoleScreenBufferW( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
242                                           LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
243                                           LPCHAR_INFO lpFill);
244 #define       ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
245 BOOL WINAPI   SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput);
246 BOOL WINAPI   SetConsoleCP(UINT cp);
247 BOOL WINAPI   SetConsoleCtrlHandler( PHANDLER_ROUTINE func, BOOL add);
248 BOOL WINAPI   SetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
249 BOOL WINAPI   SetConsoleCursorPosition(HANDLE,COORD);
250 BOOL WINAPI   SetConsoleMode( HANDLE hcon, DWORD mode);
251 BOOL WINAPI   SetConsoleOutputCP(UINT cp);
252 BOOL WINAPI   SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize);
253 BOOL WINAPI   SetConsoleTextAttribute( HANDLE hConsoleOutput,WORD wAttr);
254 BOOL WINAPI   SetConsoleTitleA(LPCSTR title);
255 BOOL WINAPI   SetConsoleTitleW(LPCWSTR title);
256 #define       SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
257 BOOL WINAPI   SetConsoleWindowInfo( HANDLE hcon, BOOL bAbsolute, LPSMALL_RECT window);
258 BOOL WINAPI   WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
259 BOOL WINAPI   WriteConsoleW(HANDLE, CONST VOID *lpBuffer, DWORD,LPDWORD,LPVOID);
260 #define       WriteConsole WINELIB_NAME_AW(WriteConsole)
261 BOOL WINAPI   WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
262 BOOL WINAPI   WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
263 #define       WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
264 BOOL WINAPI   WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
265 BOOL WINAPI   WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
266 #define       WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
267 BOOL WINAPI   WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
268 BOOL WINAPI   WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
269 BOOL WINAPI   WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
270 #define       WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
271
272 #ifdef __cplusplus
273 }
274 #endif
275
276 #endif  /* __WINE_WINCON_H */