- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qfunctions_wince.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtCore module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QFUNCTIONS_WCE_H
    00043 #define QFUNCTIONS_WCE_H
    00044 #ifdef Q_OS_WINCE
    00045 #include <stdio.h>
    00046 #include <stdlib.h>
    00047 #include <windows.h>
    00048 #include <winuser.h>
    00049 #include <winbase.h>
    00050 #include <objbase.h>
    00051 #include <kfuncs.h>
    00052 #include <ctype.h>
    00053 #include <time.h>
    00054 #include <crtdefs.h>
    00055 #include <altcecrt.h>
    00056 #include <winsock.h>
    00057 #include <ceconfig.h>
    00058
    00059 QT_BEGIN_HEADER
    00060 QT_BEGIN_NAMESPACE
    00061
    00062 #ifdef QT_BUILD_CORE_LIB
    00063 QT_MODULE(Core)
    00064 #endif
    00065
    00066 QT_END_NAMESPACE
    00067 QT_END_HEADER
    00068
    00069
    00070 // The standard SDK misses this define...
    00071 #define _control87 _controlfp
    00072
    00073 #if !defined __cplusplus
    00074 #define bool int
    00075 #define true 1
    00076 #define false 0
    00077 #endif
    00078
    00079 // Environment ------------------------------------------------------
    00080 errno_t qt_wince_getenv_s(size_t*, char*, size_t, const char*);
    00081 errno_t qt_wince__putenv_s(const char*, const char*);
    00082
    00083 #ifdef __cplusplus // have this as tiff plugin is written in C
    00084 extern "C" {
    00085 #endif
    00086
    00087 #define SetWindowLongA      SetWindowLong
    00088 #define GetWindowLongA      GetWindowLong
    00089 #define SendMessageA        SendMessage
    00090
    00091 #if !defined(NO_ERRNO_H)
    00092 #define NO_ERRNO_H
    00093 #endif
    00094
    00095 // Environment ------------------------------------------------------
    00096 int qt_wince__getpid(void);
    00097
    00098
    00099 // Time -------------------------------------------------------------
    00100 #ifndef _TM_DEFINED
    00101 #define _TM_DEFINED
    00102 struct tm {
    00103     int tm_sec;     /* seconds after the minute - [0,59] */
    00104     int tm_min;     /* minutes after the hour - [0,59] */
    00105     int tm_hour;    /* hours since midnight - [0,23] */
    00106     int tm_mday;    /* day of the month - [1,31] */
    00107     int tm_mon;     /* months since January - [0,11] */
    00108     int tm_year;    /* years since 1900 */
    00109     int tm_wday;    /* days since Sunday - [0,6] */
    00110     int tm_yday;    /* days since January 1 - [0,365] */
    00111     int tm_isdst;   /* daylight savings time flag */
    00112 };
    00113 #endif // _TM_DEFINED
    00114
    00115 FILETIME qt_wince_time_tToFt( time_t tt );
    00116
    00117 // File I/O ---------------------------------------------------------
    00118 #define _O_RDONLY       0x0001
    00119 #define _O_RDWR         0x0002
    00120 #define _O_WRONLY       0x0004
    00121 #define _O_CREAT        0x0008
    00122 #define _O_TRUNC        0x0010
    00123 #define _O_APPEND       0x0020
    00124 #define _O_EXCL         0x0040
    00125
    00126 #define O_RDONLY        _O_RDONLY
    00127 #define O_RDWR          _O_RDWR
    00128 #define O_WRONLY        _O_WRONLY
    00129 #define O_CREAT         _O_CREAT
    00130 #define O_TRUNC         _O_TRUNC
    00131 #define O_APPEND        _O_APPEND
    00132 #define O_EXCL          _O_EXCL
    00133
    00134 #define _S_IFMT         0x0600
    00135 #define _S_IFDIR        0x0200
    00136 #define _S_IFCHR        0x0100
    00137 #define _S_IFREG        0x0400
    00138 #define _S_IREAD        0x0010
    00139 #define _S_IWRITE       0x0008
    00140
    00141 #define S_IFMT          _S_IFMT
    00142 #define S_IFDIR         _S_IFDIR
    00143 #define S_IFCHR         _S_IFCHR
    00144 #define S_IFREG         _S_IFREG
    00145 #define S_IREAD         _S_IREAD
    00146 #define S_IWRITE        _S_IWRITE
    00147
    00148 #ifndef _IOFBF
    00149 #define _IOFBF          0x0000
    00150 #endif
    00151
    00152 #ifndef _IOLBF
    00153 #define _IOLBF          0x0040
    00154 #endif
    00155
    00156 #ifndef _IONBF
    00157 #define _IONBF          0x0004
    00158 #endif
    00159
    00160 // Regular Berkeley error constants
    00161 #ifndef _STAT_DEFINED
    00162 #define _STAT_DEFINED
    00163 struct stat
    00164 {
    00165     int st_mode;
    00166     int st_size;
    00167     int st_nlink;
    00168     time_t st_mtime;
    00169     time_t st_atime;
    00170     time_t st_ctime;
    00171 };
    00172 #endif
    00173
    00174 typedef int mode_t;
    00175 extern int errno;
    00176
    00177 int     qt_wince__getdrive( void );
    00178 int     qt_wince__waccess( const wchar_t *path, int pmode );
    00179 int     qt_wince__wopen( const wchar_t *filename, int oflag, int pmode );
    00180 long    qt_wince__lseek( int handle, long offset, int origin );
    00181 int     qt_wince__read( int handle, void *buffer, unsigned int count );
    00182 int     qt_wince__write( int handle, const void *buffer, unsigned int count );
    00183 int     qt_wince__close( int handle );
    00184 FILE   *qt_wince__fdopen(int handle, const char *mode);
    00185 FILE   *qt_wince_fdopen(int handle, const char *mode);
    00186 void    qt_wince_rewind( FILE *stream );
    00187 int     qt_wince___fileno(FILE *);
    00188 FILE   *qt_wince_tmpfile( void );
    00189
    00190 int qt_wince__mkdir(const char *dirname);
    00191 int qt_wince__rmdir(const char *dirname);
    00192 int qt_wince__access( const char *path, int pmode );
    00193 int qt_wince__rename( const char *oldname, const char *newname );
    00194 int qt_wince__remove( const char *name );
    00195 #ifdef __cplusplus
    00196 int qt_wince_open( const char *filename, int oflag, int pmode = 0 );
    00197 #else
    00198 int qt_wince_open( const char *filename, int oflag, int pmode );
    00199 #endif
    00200 int qt_wince_stat( const char *path, struct stat *buffer );
    00201 int qt_wince__fstat( int handle, struct stat *buffer);
    00202
    00203 #define SEM_FAILCRITICALERRORS 0x0001
    00204 #define SEM_NOOPENFILEERRORBOX 0x0002
    00205 int qt_wince_SetErrorMode(int);
    00206 #ifndef CoInitialize
    00207 #define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED)
    00208 #endif
    00209
    00210 bool qt_wince__chmod(const char *file, int mode);
    00211 bool qt_wince__wchmod(const wchar_t *file, int mode);
    00212
    00213 #pragma warning(disable: 4273)
    00214 HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
    00215
    00216 // Printer ----------------------------------------------------------
    00217 #define ETO_GLYPH_INDEX     0x0010
    00218
    00219 // Graphics ---------------------------------------------------------
    00220 #ifndef SM_CXCURSOR
    00221 #  define SM_CXCURSOR       13
    00222 #endif
    00223 #ifndef SM_CYCURSOR
    00224 #  define SM_CYCURSOR      14
    00225 #endif
    00226 BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint );
    00227
    00228 // Other stuff ------------------------------------------------------
    00229 #define MWMO_ALERTABLE 0x0002
    00230 // ### not the real values
    00231 #define CREATE_NO_WINDOW        2
    00232 #define CF_HDROP                15
    00233
    00234 void *qt_wince_calloc(size_t num, size_t size);
    00235 #if !defined(TLS_OUT_OF_INDEXES)
    00236 #  define TLS_OUT_OF_INDEXES 0xffffffff
    00237 #endif
    00238 DWORD qt_wince_GetThreadLocale(void);
    00239
    00240 HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist);
    00241
    00242 unsigned long qt_wince__beginthreadex( void *security,
    00243                               unsigned stack_size,
    00244                               unsigned (__stdcall *start_address)(void *),
    00245                               void *arglist,
    00246                               unsigned initflag,
    00247                               unsigned *thrdaddr );
    00248 void qt_wince__endthreadex(unsigned nExitCode);
    00249
    00250
    00251 // bsearch is needed for building the tiff plugin
    00252 // otherwise it could go into qguifunctions_wce
    00253 void *qt_wince_bsearch(const void *key,
    00254                const void *base,
    00255                size_t num,
    00256                size_t size,
    00257                int (__cdecl *compare)(const void *, const void *));
    00258
    00259 // Missing typedefs
    00260 #ifndef _TIME_T_DEFINED
    00261 typedef unsigned long time_t;
    00262 #define _TIME_T_DEFINED
    00263 #endif
    00264 typedef HANDLE HDROP;
    00265
    00266 #ifndef WS_THICKFRAME
    00267 #define WS_THICKFRAME   WS_DLGFRAME
    00268 #endif
    00269
    00270 typedef UINT    UWORD;
    00271
    00272 // Missing definitions: not necessary equal to their Win32 values
    00273 // (the goal is to just have a clean compilation of MFC)
    00274 #define WS_MAXIMIZE               0
    00275 #define WS_MINIMIZE               0
    00276 #ifndef WS_EX_TOOLWINDOW
    00277 #define WS_EX_TOOLWINDOW          0
    00278 #endif
    00279 #define WS_EX_NOPARENTNOTIFY      0
    00280 #define WM_ENTERIDLE              0x0121
    00281 #define WM_PRINT                  WM_PAINT
    00282 #define WM_NCCREATE               (0x0081)
    00283 #define WM_PARENTNOTIFY           0
    00284 #define WM_NCDESTROY              (WM_APP-1)
    00285 #ifndef SW_RESTORE
    00286 #define SW_RESTORE                (SW_SHOWNORMAL)
    00287 #endif
    00288 #define SW_NORMAL                 (SW_SHOWNORMAL)
    00289 #define WAIT_OBJECT_0             0x00000000L
    00290 #define DEFAULT_GUI_FONT          SYSTEM_FONT
    00291 #ifndef SWP_NOREDRAW
    00292 #define SWP_NOREDRAW               0
    00293 #endif
    00294 #define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
    00295 #define HWND_TOPMOST              ((HWND)-1)
    00296 #define HWND_NOTOPMOST            ((HWND)-2)
    00297 #define PS_DOT                    2
    00298 #define PD_ALLPAGES               0
    00299 #define PD_USEDEVMODECOPIES       0
    00300 #define PD_NOSELECTION            0
    00301 #define PD_HIDEPRINTTOFILE        0
    00302 #define PD_NOPAGENUMS             0
    00303 #define CF_METAFILEPICT           3
    00304 #define MM_ANISOTROPIC            8
    00305 #define KF_ALTDOWN                0x2000
    00306 #define SPI_GETWORKAREA           48
    00307
    00308 #ifndef WM_SETCURSOR
    00309         #define WM_SETCURSOR 0x0020
    00310         #define IDC_ARROW           MAKEINTRESOURCE(32512)
    00311         #define IDC_IBEAM           MAKEINTRESOURCE(32513)
    00312         #define IDC_WAIT            MAKEINTRESOURCE(32514)
    00313         #define IDC_CROSS           MAKEINTRESOURCE(32515)
    00314         #define IDC_UPARROW         MAKEINTRESOURCE(32516)
    00315         #define IDC_SIZE            MAKEINTRESOURCE(32646)
    00316         #define IDC_ICON            MAKEINTRESOURCE(32512)
    00317         #define IDC_SIZENWSE        MAKEINTRESOURCE(32642)
    00318         #define IDC_SIZENESW        MAKEINTRESOURCE(32643)
    00319         #define IDC_SIZEWE          MAKEINTRESOURCE(32644)
    00320         #define IDC_SIZENS          MAKEINTRESOURCE(32645)
    00321         #define IDC_SIZEALL         MAKEINTRESOURCE(32646)
    00322         #define IDC_NO              MAKEINTRESOURCE(32648)
    00323         #define IDC_APPSTARTING     MAKEINTRESOURCE(32650)
    00324         #define IDC_HELP            MAKEINTRESOURCE(32651)
    00325         #define IDC_HAND            MAKEINTRESOURCE(32649)
    00326 #endif
    00327
    00328 #define GMEM_MOVEABLE             LMEM_MOVEABLE
    00329 #define GPTR                      LPTR
    00330
    00331 // WinCE: CESYSGEN prunes the following FRP defines,
    00332 // and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h
    00333 #undef FTP_TRANSFER_TYPE_ASCII
    00334 #define FTP_TRANSFER_TYPE_ASCII 0x00000001
    00335 #undef FTP_TRANSFER_TYPE_BINARY
    00336 #define FTP_TRANSFER_TYPE_BINARY 0x00000002
    00337
    00338 typedef DWORD OLE_COLOR;
    00339
    00340 // Define the Windows Styles which are not defined by MS
    00341 #ifndef WS_POPUPWINDOW
    00342 #define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION
    00343 #endif
    00344
    00345 #ifndef WS_OVERLAPPEDWINDOW
    00346 #define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX
    00347 #endif
    00348
    00349 #ifndef WS_TILED
    00350 #define WS_TILED WS_OVERLAPPED
    00351 #endif
    00352
    00353 #ifndef WS_TILEDWINDOW
    00354 #define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW
    00355 #endif
    00356
    00357 #ifndef WS_EX_CAPTIONOKBTN
    00358 #define WS_EX_CAPTIONOKBTN 0x80000000L
    00359 #endif
    00360
    00361 #ifndef WS_EX_NODRAG
    00362 #define WS_EX_NODRAG       0x40000000L
    00363 #endif
    00364
    00365 // As Windows CE lacks some standard functions used in Qt, these got
    00366 // reimplented. Other projects do this as well and to not fill the
    00367 // global namespace with this implementation, prepend qt_wince* and use
    00368 // these versions inside of Qt.
    00369 // The other declarations available in this file are being used per
    00370 // define inside qplatformdefs.h of the corresponding WinCE mkspec.
    00371 #define getenv_s(a,b,c,d)       qt_wince_getenv_s(a,b,c,d)
    00372 #define _putenv_s(a,b)          qt_wince__putenv_s(a,b)
    00373 #define _getpid()               qt_wince__getpid()
    00374 #define time_tToFt(a)           qt_wince_time_tToFt(a)
    00375 #define _getdrive()             qt_wince__getdrive()
    00376 #define _waccess(a,b)           qt_wince__waccess(a,b)
    00377 #define _wopen(a,b,c)           qt_wince__wopen(a,b,c)
    00378 #define _fdopen(a,b)            qt_wince__fdopen(a,b)
    00379 #define fdopen(a,b)             qt_wince_fdopen(a,b)
    00380 #define rewind(a)               qt_wince_rewind(a)
    00381 #define tmpfile()               qt_wince_tmpfile()
    00382 #define _rename(a,b)            qt_wince__rename(a,b)
    00383 #define _remove(a)              qt_wince__remove(a)
    00384 #define SetErrorMode(a)         qt_wince_SetErrorMode(a)
    00385 #define _chmod(a,b)             qt_wince__chmod(a,b)
    00386 #define _wchmod(a,b)            qt_wince__wchmod(a,b)
    00387 #define CreateFileA(a,b,c,d,e,f,g) qt_wince_CreateFileA(a,b,c,d,e,f,g)
    00388 #define SetWindowOrgEx(a,b,c,d) qt_wince_SetWindowOrgEx(a,b,c,d)
    00389 #define calloc(a,b)             qt_wince_calloc(a,b)
    00390 #define GetThreadLocale()       qt_wince_GetThreadLocale()
    00391 #define _beginthread(a,b,c)     qt_wince__beginthread(a,b,c)
    00392 #define _beginthreadex(a,b,c,d,e,f) qt_wince__beginthreadex(a,b,c,d,e,f)
    00393 #define _endthreadex(a)         qt_wince__endthreadex(a)
    00394 #define bsearch(a,b,c,d,e)      qt_wince_bsearch(a,b,c,d,e)
    00395
    00396 #ifdef __cplusplus
    00397 } // Extern C.
    00398 #endif
    00399
    00400 #endif // Q_OS_WINCE
    00401 #endif // QFUNCTIONS_WCE_H