FLTK
platform_types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016-2018 by Bill Spitzak and others.
3  *
4  * This library is free software. Distribution and use rights are outlined in
5  * the file "COPYING" which should have been included with this file. If this
6  * file is missing or damaged, see the license at:
7  *
8  * https://www.fltk.org/COPYING.php
9  *
10  * Please see the following page on how to report bugs and issues:
11  *
12  * https://www.fltk.org/bugs.php
13  */
14 
22 #ifdef FL_DOXYGEN
23 
28 typedef opaque fl_intptr_t;
33 typedef opaque fl_uintptr_t;
34 
35 typedef opaque Fl_Offscreen;
36 typedef opaque Fl_Bitmask;
37 typedef opaque Fl_Region;
38 typedef opaque FL_SOCKET;
39 typedef opaque GLContext;
41 # define FL_COMMAND opaque
42 # define FL_CONTROL opaque
44 #else
45 
46 #ifndef FL_PLATFORM_TYPES_H
47 #define FL_PLATFORM_TYPES_H
48 
49 /* Platform-dependent types are defined here.
50  These types must be defined by any platform:
51  Fl_Offscreen, Fl_Bitmask, Fl_Region, FL_SOCKET, GLContext, struct dirent, struct stat,
52  fl_intptr_t, fl_uintptr_t
53 
54  NOTE: *FIXME* AlbrechtS 13 Apr 2016 (concerning FL_SOCKET)
55  ----------------------------------------------------------
56  The Fl::add_fd() API is partially inconsistent because some of the methods
57  explicitly use 'int', but the callback typedefs use FL_SOCKET. With the
58  definition of FL_SOCKET below we can have different data sizes and
59  different signedness of socket numbers on *some* platforms.
60  */
61 
62 #ifdef _WIN64
63 
64 #if defined(_MSC_VER)
65 # include <stddef.h> /* M$VC */
66 #else
67 # include <stdint.h>
68 #endif
69 
70 typedef intptr_t fl_intptr_t;
71 typedef uintptr_t fl_uintptr_t;
72 
73 #elif defined(__ANDROID__)
74 
75 #include <sys/stat.h>
76 typedef intptr_t fl_intptr_t;
77 typedef uintptr_t fl_uintptr_t;
78 
79 #else /* ! _WIN64 */
80 
81 typedef long fl_intptr_t;
82 typedef unsigned long fl_uintptr_t;
83 
84 #endif /* _WIN64 */
85 
86 
87 #ifdef __APPLE__
88 typedef struct CGContext* Fl_Offscreen;
89 typedef struct CGImage* Fl_Bitmask;
90 typedef struct flCocoaRegion* Fl_Region;
91 typedef int FL_SOCKET;
92 #ifdef __OBJC__
93  @class NSOpenGLContext;
94  typedef NSOpenGLContext* GLContext;
95 #elif defined(__cplusplus)
96  typedef class NSOpenGLContext* GLContext;
97 #endif /* __OBJC__ */
98 
99 #include <sys/stat.h>
100 #include <sys/types.h>
101 #include <dirent.h>
102 # define FL_COMMAND FL_META
103 # define FL_CONTROL FL_CTRL
104 
105 #elif defined(_WIN32)
106 typedef struct HBITMAP__ *HBITMAP;
107 typedef HBITMAP Fl_Offscreen;
108 typedef HBITMAP Fl_Bitmask;
109 typedef struct HRGN__ *Fl_Region;
110 # if defined(_WIN64) && defined(_MSC_VER)
111 typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET (see above) */
112 # else
113 typedef int FL_SOCKET;
114 # endif
115 typedef struct HGLRC__ *GLContext;
116 #include <sys/stat.h>
117 #ifdef __MINGW32__
118 # include <dirent.h>
119 #else
120  struct dirent {char d_name[1];};
121 #endif
122 
123 #elif defined(__ANDROID__)
124 
125 #ifdef __cplusplus
126 typedef class Fl_Rect_Region *Fl_Region;
127 #else
128 typedef struct Fl_Rect_Region *Fl_Region;
129 #endif
130 
131 // TODO: the types below have not yet been ported
132 typedef unsigned long Fl_Offscreen;
133 typedef unsigned long Fl_Bitmask;
134 typedef int FL_SOCKET;
135 typedef struct __GLXcontextRec *GLContext;
136 #include <sys/types.h>
137 #include <dirent.h>
138 
139 #else /* X11 */
140 
141 typedef unsigned long Fl_Offscreen;
142 typedef unsigned long Fl_Bitmask;
143 typedef struct _XRegion *Fl_Region;
144 typedef int FL_SOCKET;
145 typedef struct __GLXcontextRec *GLContext;
146 #include <sys/stat.h>
147 #include <sys/types.h>
148 #include <dirent.h>
149 
150 #endif /* __APPLE__ */
151 
152 
153 #ifndef __APPLE__
154 # define FL_COMMAND FL_CTRL
155 # define FL_CONTROL FL_META
156 #endif
157 
158 #endif /* FL_PLATFORM_TYPES_H */
159 
160 #endif // FL_DOXYGEN
opaque GLContext
an OpenGL graphics context, into which all OpenGL calls are rendered
Definition: platform_types.h:39
opaque Fl_Bitmask
mask
Definition: platform_types.h:36
opaque Fl_Offscreen
an offscreen drawing buffer
Definition: platform_types.h:35
opaque fl_intptr_t
An integral type large enough to store a pointer or a long value.
Definition: platform_types.h:28
opaque Fl_Region
a region made of several rectangles
Definition: platform_types.h:37
opaque fl_uintptr_t
An unsigned integral type large enough to store a pointer or an unsigned long value.
Definition: platform_types.h:33
opaque FL_SOCKET
socket or file descriptor
Definition: platform_types.h:38