author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 16 Apr 2010 15:50:13 +0300 | |
changeset 18 | 2f34d5167611 |
parent 3 | 41300fa6a67c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QFUNCTIONS_WCE_H |
|
43 |
#define QFUNCTIONS_WCE_H |
|
44 |
#ifdef Q_OS_WINCE |
|
45 |
#include <stdio.h> |
|
46 |
#include <stdlib.h> |
|
47 |
#include <windows.h> |
|
48 |
#include <winuser.h> |
|
49 |
#include <winbase.h> |
|
50 |
#include <objbase.h> |
|
51 |
#include <kfuncs.h> |
|
52 |
#include <ctype.h> |
|
53 |
#include <time.h> |
|
54 |
#include <crtdefs.h> |
|
55 |
#include <altcecrt.h> |
|
56 |
#include <winsock.h> |
|
57 |
#include <ceconfig.h> |
|
58 |
||
59 |
QT_BEGIN_HEADER |
|
60 |
QT_BEGIN_NAMESPACE |
|
61 |
||
62 |
#ifdef QT_BUILD_CORE_LIB |
|
63 |
QT_MODULE(Core) |
|
64 |
#endif |
|
65 |
||
66 |
QT_END_NAMESPACE |
|
67 |
QT_END_HEADER |
|
68 |
||
69 |
||
70 |
// The standard SDK misses this define... |
|
71 |
#define _control87 _controlfp |
|
72 |
||
73 |
#if !defined __cplusplus |
|
74 |
#define bool int |
|
75 |
#define true 1 |
|
76 |
#define false 0 |
|
77 |
#endif |
|
78 |
||
79 |
// Environment ------------------------------------------------------ |
|
80 |
errno_t qt_wince_getenv_s(size_t*, char*, size_t, const char*); |
|
81 |
errno_t qt_wince__putenv_s(const char*, const char*); |
|
82 |
||
83 |
#ifdef __cplusplus // have this as tiff plugin is written in C |
|
84 |
extern "C" { |
|
85 |
#endif |
|
86 |
||
87 |
#define SetWindowLongA SetWindowLong |
|
88 |
#define GetWindowLongA GetWindowLong |
|
89 |
#define SendMessageA SendMessage |
|
90 |
||
91 |
#if !defined(NO_ERRNO_H) |
|
92 |
#define NO_ERRNO_H |
|
93 |
#endif |
|
94 |
||
95 |
// Environment ------------------------------------------------------ |
|
96 |
int qt_wince__getpid(void); |
|
97 |
||
98 |
||
99 |
// Time ------------------------------------------------------------- |
|
100 |
#ifndef _TM_DEFINED |
|
101 |
#define _TM_DEFINED |
|
102 |
struct tm { |
|
103 |
int tm_sec; /* seconds after the minute - [0,59] */ |
|
104 |
int tm_min; /* minutes after the hour - [0,59] */ |
|
105 |
int tm_hour; /* hours since midnight - [0,23] */ |
|
106 |
int tm_mday; /* day of the month - [1,31] */ |
|
107 |
int tm_mon; /* months since January - [0,11] */ |
|
108 |
int tm_year; /* years since 1900 */ |
|
109 |
int tm_wday; /* days since Sunday - [0,6] */ |
|
110 |
int tm_yday; /* days since January 1 - [0,365] */ |
|
111 |
int tm_isdst; /* daylight savings time flag */ |
|
112 |
}; |
|
113 |
#endif // _TM_DEFINED |
|
114 |
||
115 |
FILETIME qt_wince_time_tToFt( time_t tt ); |
|
116 |
||
117 |
// File I/O --------------------------------------------------------- |
|
118 |
#define _O_RDONLY 0x0001 |
|
119 |
#define _O_RDWR 0x0002 |
|
120 |
#define _O_WRONLY 0x0004 |
|
121 |
#define _O_CREAT 0x0008 |
|
122 |
#define _O_TRUNC 0x0010 |
|
123 |
#define _O_APPEND 0x0020 |
|
124 |
#define _O_EXCL 0x0040 |
|
125 |
||
126 |
#define O_RDONLY _O_RDONLY |
|
127 |
#define O_RDWR _O_RDWR |
|
128 |
#define O_WRONLY _O_WRONLY |
|
129 |
#define O_CREAT _O_CREAT |
|
130 |
#define O_TRUNC _O_TRUNC |
|
131 |
#define O_APPEND _O_APPEND |
|
132 |
#define O_EXCL _O_EXCL |
|
133 |
||
134 |
#define _S_IFMT 0x0600 |
|
135 |
#define _S_IFDIR 0x0200 |
|
136 |
#define _S_IFCHR 0x0100 |
|
137 |
#define _S_IFREG 0x0400 |
|
138 |
#define _S_IREAD 0x0010 |
|
139 |
#define _S_IWRITE 0x0008 |
|
140 |
||
141 |
#define S_IFMT _S_IFMT |
|
142 |
#define S_IFDIR _S_IFDIR |
|
143 |
#define S_IFCHR _S_IFCHR |
|
144 |
#define S_IFREG _S_IFREG |
|
145 |
#define S_IREAD _S_IREAD |
|
146 |
#define S_IWRITE _S_IWRITE |
|
147 |
||
148 |
#ifndef _IOFBF |
|
149 |
#define _IOFBF 0x0000 |
|
150 |
#endif |
|
151 |
||
152 |
#ifndef _IOLBF |
|
153 |
#define _IOLBF 0x0040 |
|
154 |
#endif |
|
155 |
||
156 |
#ifndef _IONBF |
|
157 |
#define _IONBF 0x0004 |
|
158 |
#endif |
|
159 |
||
160 |
// Regular Berkeley error constants |
|
161 |
#ifndef _STAT_DEFINED |
|
162 |
#define _STAT_DEFINED |
|
163 |
struct stat |
|
164 |
{ |
|
165 |
int st_mode; |
|
166 |
int st_size; |
|
167 |
int st_nlink; |
|
168 |
time_t st_mtime; |
|
169 |
time_t st_atime; |
|
170 |
time_t st_ctime; |
|
171 |
}; |
|
172 |
#endif |
|
173 |
||
174 |
typedef int mode_t; |
|
175 |
extern int errno; |
|
176 |
||
177 |
int qt_wince__getdrive( void ); |
|
178 |
int qt_wince__waccess( const wchar_t *path, int pmode ); |
|
179 |
int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode ); |
|
180 |
long qt_wince__lseek( int handle, long offset, int origin ); |
|
181 |
int qt_wince__read( int handle, void *buffer, unsigned int count ); |
|
182 |
int qt_wince__write( int handle, const void *buffer, unsigned int count ); |
|
183 |
int qt_wince__close( int handle ); |
|
184 |
FILE *qt_wince__fdopen(int handle, const char *mode); |
|
185 |
FILE *qt_wince_fdopen(int handle, const char *mode); |
|
186 |
void qt_wince_rewind( FILE *stream ); |
|
187 |
int qt_wince___fileno(FILE *); |
|
188 |
FILE *qt_wince_tmpfile( void ); |
|
189 |
||
190 |
int qt_wince__mkdir(const char *dirname); |
|
191 |
int qt_wince__rmdir(const char *dirname); |
|
192 |
int qt_wince__access( const char *path, int pmode ); |
|
193 |
int qt_wince__rename( const char *oldname, const char *newname ); |
|
194 |
int qt_wince__remove( const char *name ); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
#ifdef __cplusplus |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
#else |
0 | 198 |
int qt_wince_open( const char *filename, int oflag, int pmode ); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
199 |
#endif |
0 | 200 |
int qt_wince_stat( const char *path, struct stat *buffer ); |
201 |
int qt_wince__fstat( int handle, struct stat *buffer); |
|
202 |
||
203 |
#define SEM_FAILCRITICALERRORS 0x0001 |
|
204 |
#define SEM_NOOPENFILEERRORBOX 0x0002 |
|
205 |
int qt_wince_SetErrorMode(int); |
|
206 |
#ifndef CoInitialize |
|
207 |
#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) |
|
208 |
#endif |
|
209 |
||
210 |
bool qt_wince__chmod(const char *file, int mode); |
|
211 |
bool qt_wince__wchmod(const wchar_t *file, int mode); |
|
212 |
||
213 |
#pragma warning(disable: 4273) |
|
214 |
HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); |
|
215 |
||
216 |
// Printer ---------------------------------------------------------- |
|
217 |
#define ETO_GLYPH_INDEX 0x0010 |
|
218 |
||
219 |
// Graphics --------------------------------------------------------- |
|
220 |
#ifndef SM_CXCURSOR |
|
221 |
# define SM_CXCURSOR 13 |
|
222 |
#endif |
|
223 |
#ifndef SM_CYCURSOR |
|
224 |
# define SM_CYCURSOR 14 |
|
225 |
#endif |
|
226 |
BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint ); |
|
227 |
||
228 |
// Other stuff ------------------------------------------------------ |
|
229 |
#define MWMO_ALERTABLE 0x0002 |
|
230 |
// ### not the real values |
|
231 |
#define CREATE_NO_WINDOW 2 |
|
232 |
#define CF_HDROP 15 |
|
233 |
||
234 |
void *qt_wince_calloc(size_t num, size_t size); |
|
235 |
#if !defined(TLS_OUT_OF_INDEXES) |
|
236 |
# define TLS_OUT_OF_INDEXES 0xffffffff |
|
237 |
#endif |
|
238 |
DWORD qt_wince_GetThreadLocale(void); |
|
239 |
||
240 |
HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist); |
|
241 |
||
242 |
unsigned long qt_wince__beginthreadex( void *security, |
|
243 |
unsigned stack_size, |
|
244 |
unsigned (__stdcall *start_address)(void *), |
|
245 |
void *arglist, |
|
246 |
unsigned initflag, |
|
247 |
unsigned *thrdaddr ); |
|
248 |
void qt_wince__endthreadex(unsigned nExitCode); |
|
249 |
||
250 |
||
251 |
// bsearch is needed for building the tiff plugin |
|
252 |
// otherwise it could go into qguifunctions_wce |
|
253 |
void *qt_wince_bsearch(const void *key, |
|
254 |
const void *base, |
|
255 |
size_t num, |
|
256 |
size_t size, |
|
257 |
int (__cdecl *compare)(const void *, const void *)); |
|
258 |
||
259 |
// Missing typedefs |
|
260 |
#ifndef _TIME_T_DEFINED |
|
261 |
typedef unsigned long time_t; |
|
262 |
#define _TIME_T_DEFINED |
|
263 |
#endif |
|
264 |
typedef HANDLE HDROP; |
|
265 |
||
266 |
#ifndef WS_THICKFRAME |
|
267 |
#define WS_THICKFRAME WS_DLGFRAME |
|
268 |
#endif |
|
269 |
||
270 |
typedef UINT UWORD; |
|
271 |
||
272 |
// Missing definitions: not necessary equal to their Win32 values |
|
273 |
// (the goal is to just have a clean compilation of MFC) |
|
274 |
#define WS_MAXIMIZE 0 |
|
275 |
#define WS_MINIMIZE 0 |
|
276 |
#ifndef WS_EX_TOOLWINDOW |
|
277 |
#define WS_EX_TOOLWINDOW 0 |
|
278 |
#endif |
|
279 |
#define WS_EX_NOPARENTNOTIFY 0 |
|
280 |
#define WM_ENTERIDLE 0x0121 |
|
281 |
#define WM_PRINT WM_PAINT |
|
282 |
#define WM_NCCREATE (0x0081) |
|
283 |
#define WM_PARENTNOTIFY 0 |
|
284 |
#define WM_NCDESTROY (WM_APP-1) |
|
285 |
#ifndef SW_RESTORE |
|
286 |
#define SW_RESTORE (SW_SHOWNORMAL) |
|
287 |
#endif |
|
288 |
#define SW_NORMAL (SW_SHOWNORMAL) |
|
289 |
#define WAIT_OBJECT_0 0x00000000L |
|
290 |
#define DEFAULT_GUI_FONT SYSTEM_FONT |
|
291 |
#ifndef SWP_NOREDRAW |
|
292 |
#define SWP_NOREDRAW 0 |
|
293 |
#endif |
|
294 |
#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) |
|
295 |
#define HWND_TOPMOST ((HWND)-1) |
|
296 |
#define HWND_NOTOPMOST ((HWND)-2) |
|
297 |
#define PS_DOT 2 |
|
298 |
#define PD_ALLPAGES 0 |
|
299 |
#define PD_USEDEVMODECOPIES 0 |
|
300 |
#define PD_NOSELECTION 0 |
|
301 |
#define PD_HIDEPRINTTOFILE 0 |
|
302 |
#define PD_NOPAGENUMS 0 |
|
303 |
#define CF_METAFILEPICT 3 |
|
304 |
#define MM_ANISOTROPIC 8 |
|
305 |
#define KF_ALTDOWN 0x2000 |
|
306 |
#define SPI_GETWORKAREA 48 |
|
307 |
||
308 |
#ifndef WM_SETCURSOR |
|
309 |
#define WM_SETCURSOR 0x0020 |
|
310 |
#define IDC_ARROW MAKEINTRESOURCE(32512) |
|
311 |
#define IDC_IBEAM MAKEINTRESOURCE(32513) |
|
312 |
#define IDC_WAIT MAKEINTRESOURCE(32514) |
|
313 |
#define IDC_CROSS MAKEINTRESOURCE(32515) |
|
314 |
#define IDC_UPARROW MAKEINTRESOURCE(32516) |
|
315 |
#define IDC_SIZE MAKEINTRESOURCE(32646) |
|
316 |
#define IDC_ICON MAKEINTRESOURCE(32512) |
|
317 |
#define IDC_SIZENWSE MAKEINTRESOURCE(32642) |
|
318 |
#define IDC_SIZENESW MAKEINTRESOURCE(32643) |
|
319 |
#define IDC_SIZEWE MAKEINTRESOURCE(32644) |
|
320 |
#define IDC_SIZENS MAKEINTRESOURCE(32645) |
|
321 |
#define IDC_SIZEALL MAKEINTRESOURCE(32646) |
|
322 |
#define IDC_NO MAKEINTRESOURCE(32648) |
|
323 |
#define IDC_APPSTARTING MAKEINTRESOURCE(32650) |
|
324 |
#define IDC_HELP MAKEINTRESOURCE(32651) |
|
325 |
#define IDC_HAND MAKEINTRESOURCE(32649) |
|
326 |
#endif |
|
327 |
||
328 |
#define GMEM_MOVEABLE LMEM_MOVEABLE |
|
329 |
#define GPTR LPTR |
|
330 |
||
331 |
// WinCE: CESYSGEN prunes the following FRP defines, |
|
332 |
// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h |
|
333 |
#undef FTP_TRANSFER_TYPE_ASCII |
|
334 |
#define FTP_TRANSFER_TYPE_ASCII 0x00000001 |
|
335 |
#undef FTP_TRANSFER_TYPE_BINARY |
|
336 |
#define FTP_TRANSFER_TYPE_BINARY 0x00000002 |
|
337 |
||
338 |
typedef DWORD OLE_COLOR; |
|
339 |
||
340 |
// Define the Windows Styles which are not defined by MS |
|
341 |
#ifndef WS_POPUPWINDOW |
|
342 |
#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION |
|
343 |
#endif |
|
344 |
||
345 |
#ifndef WS_OVERLAPPEDWINDOW |
|
346 |
#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX |
|
347 |
#endif |
|
348 |
||
349 |
#ifndef WS_TILED |
|
350 |
#define WS_TILED WS_OVERLAPPED |
|
351 |
#endif |
|
352 |
||
353 |
#ifndef WS_TILEDWINDOW |
|
354 |
#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW |
|
355 |
#endif |
|
356 |
||
357 |
#ifndef WS_EX_CAPTIONOKBTN |
|
358 |
#define WS_EX_CAPTIONOKBTN 0x80000000L |
|
359 |
#endif |
|
360 |
||
361 |
#ifndef WS_EX_NODRAG |
|
362 |
#define WS_EX_NODRAG 0x40000000L |
|
363 |
#endif |
|
364 |
||
365 |
// As Windows CE lacks some standard functions used in Qt, these got |
|
366 |
// reimplented. Other projects do this as well and to not fill the |
|
367 |
// global namespace with this implementation, prepend qt_wince* and use |
|
368 |
// these versions inside of Qt. |
|
369 |
// The other declarations available in this file are being used per |
|
370 |
// define inside qplatformdefs.h of the corresponding WinCE mkspec. |
|
371 |
#define getenv_s(a,b,c,d) qt_wince_getenv_s(a,b,c,d) |
|
372 |
#define _putenv_s(a,b) qt_wince__putenv_s(a,b) |
|
373 |
#define _getpid() qt_wince__getpid() |
|
374 |
#define time_tToFt(a) qt_wince_time_tToFt(a) |
|
375 |
#define _getdrive() qt_wince__getdrive() |
|
376 |
#define _waccess(a,b) qt_wince__waccess(a,b) |
|
377 |
#define _wopen(a,b,c) qt_wince__wopen(a,b,c) |
|
378 |
#define _fdopen(a,b) qt_wince__fdopen(a,b) |
|
379 |
#define fdopen(a,b) qt_wince_fdopen(a,b) |
|
380 |
#define rewind(a) qt_wince_rewind(a) |
|
381 |
#define tmpfile() qt_wince_tmpfile() |
|
382 |
#define _rename(a,b) qt_wince__rename(a,b) |
|
383 |
#define _remove(a) qt_wince__remove(a) |
|
384 |
#define SetErrorMode(a) qt_wince_SetErrorMode(a) |
|
385 |
#define _chmod(a,b) qt_wince__chmod(a,b) |
|
386 |
#define _wchmod(a,b) qt_wince__wchmod(a,b) |
|
387 |
#define CreateFileA(a,b,c,d,e,f,g) qt_wince_CreateFileA(a,b,c,d,e,f,g) |
|
388 |
#define SetWindowOrgEx(a,b,c,d) qt_wince_SetWindowOrgEx(a,b,c,d) |
|
389 |
#define calloc(a,b) qt_wince_calloc(a,b) |
|
390 |
#define GetThreadLocale() qt_wince_GetThreadLocale() |
|
391 |
#define _beginthread(a,b,c) qt_wince__beginthread(a,b,c) |
|
392 |
#define _beginthreadex(a,b,c,d,e,f) qt_wince__beginthreadex(a,b,c,d,e,f) |
|
393 |
#define _endthreadex(a) qt_wince__endthreadex(a) |
|
394 |
#define bsearch(a,b,c,d,e) qt_wince_bsearch(a,b,c,d,e) |
|
395 |
||
396 |
#ifdef __cplusplus |
|
397 |
} // Extern C. |
|
398 |
#endif |
|
399 |
||
400 |
#endif // Q_OS_WINCE |
|
401 |
#endif // QFUNCTIONS_WCE_H |