]> git.saurik.com Git - wxWidgets.git/blob - src/xpm/simx.h
Cast both operands of ?: to (wxControl*) so BC++ compiles it
[wxWidgets.git] / src / xpm / simx.h
1 /*
2 * Copyright (C) 1989-94 GROUPE BULL
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 *
21 * Except as contained in this notice, the name of GROUPE BULL shall not be
22 * used in advertising or otherwise to promote the sale, use or other dealings
23 * in this Software without prior written authorization from GROUPE BULL.
24 */
25
26 /*****************************************************************************\
27 * simx.h: 0.1a *
28 * *
29 * This emulates some Xlib functionality for MSW. It's not a general solution, *
30 * it is close related to XPM-lib. It is only intended to satisfy what is need *
31 * there. Thus allowing to read XPM files under MS windows. *
32 * *
33 * Developed by HeDu 3/94 (hedu@cul-ipn.uni-kiel.de) *
34 \*****************************************************************************/
35
36
37 #ifndef _SIMX_H
38 #define _SIMX_H
39
40 #ifdef FOR_MSW
41
42 #if defined(__OS2__)
43 #define INCL_OS2
44 #include<os2.h>
45 #else
46 #include "windows.h" /* MS windows GDI types */
47 #endif
48
49 /*
50 * minimal portability layer between ansi and KR C
51 */
52 /* this comes from xpm.h, and is here again, to avoid complicated
53 includes, since this is included from xpm.h */
54 /* these defines get undefed at the end of this file */
55 #if __STDC__ || defined(__cplusplus) || defined(c_plusplus)
56 /* ANSI || C++ */
57 #define FUNC(f, t, p) extern t f p
58 #define LFUNC(f, t, p) static t f p
59 #else /* k&R */
60 #define FUNC(f, t, p) extern t f()
61 #define LFUNC(f, t, p) static t f()
62 #endif
63
64
65 FUNC(boundCheckingMalloc, void *, (long s));
66 FUNC(boundCheckingCalloc, void *, (long num, long s));
67 FUNC(boundCheckingRealloc, void *, (void *p, long s));
68
69 /* define MSW types for X window types,
70 I don't know much about MSW, but the following defines do the job */
71
72 typedef HDC Display; /* this should be similar */
73 typedef void *Screen; /* not used */
74 typedef void *Visual; /* not used yet, is for GRAY, COLOR,
75 * MONO */
76
77 typedef void *Colormap; /* should be COLORPALETTE, not done
78 * yet */
79
80 #if !defined(__OS2__)
81 typedef COLORREF Pixel;
82 #else
83 typedef unsigned long COLORREF;
84 typedef unsigned long Pixel;
85 #endif
86
87 #define PIXEL_ALREADY_TYPEDEFED /* to let xpm.h know about it */
88
89 typedef struct {
90 Pixel pixel;
91 BYTE red, green, blue;
92 } XColor;
93
94 typedef struct {
95 HBITMAP bitmap;
96 unsigned int width;
97 unsigned int height;
98 unsigned int depth;
99 } XImage;
100
101 #if defined(__cplusplus) || defined(c_plusplus)
102 extern "C" {
103 #endif
104 /* some replacements for X... functions */
105
106 /* XDefaultXXX */
107 FUNC(XDefaultVisual, Visual *, (Display *display, Screen *screen));
108 FUNC(XDefaultScreen, Screen *, (Display *d));
109 FUNC(XDefaultColormap, Colormap *, (Display *display, Screen *screen));
110 FUNC(XDefaultDepth, int, (Display *d, Screen *s));
111
112 /* color related */
113 FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *));
114 FUNC(XAllocColor, int, (Display *, Colormap *, XColor *));
115 FUNC(XQueryColors, void, (Display *display, Colormap *colormap,
116 XColor *xcolors, int ncolors));
117 FUNC(XFreeColors, int, (Display *d, Colormap cmap,
118 unsigned long pixels[],
119 int npixels, unsigned long planes));
120 /* XImage */
121 FUNC(XCreateImage, XImage *, (Display *, Visual *, int depth, int format,
122 int x, int y, int width, int height,
123 int pad, int foo));
124
125 /* free and destroy bitmap */
126 FUNC(XDestroyImage, void /* ? */ , (XImage *));
127 /* free only, bitmap remains */
128 FUNC(XImageFree, void, (XImage *));
129 #if defined(__cplusplus) || defined(c_plusplus)
130 } /* end of extern "C" */
131 #endif /* cplusplus */
132
133 #define ZPixmap 1 /* not really used */
134
135 #ifndef True
136 #define True 1
137 #define False 0
138 #endif
139
140 /*
141 #ifndef Bool
142 typedef BOOL Bool;
143 #endif
144 */
145
146 /* make these local here, simx.c gets the same from xpm.h */
147 #undef LFUNC
148 #undef FUNC
149
150 #endif /* def FOR_MSW */
151
152 #endif /* _SIMX_H */