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