]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/nanox/X11/Xlib.h
make cocoa mediactrl usable. Some touchups to carbon mediactrl code. Add notebook...
[wxWidgets.git] / include / wx / x11 / nanox / X11 / Xlib.h
CommitLineData
6ec507fd
JS
1/*
2 * Xlib compatibility
3 */
4
c79a329d
JS
5#ifndef _DUMMY_XLIBH_
6#define _DUMMY_XLIBH_
7
461e93f9
JS
8#ifdef __GNUG__
9 #pragma interface "Xlib.h"
10#endif
11
788519c6
JS
12/* Move away the typedef in XtoNX.h */
13#define XFontStruct XFontStruct1
c79a329d 14#include <XtoNX.h>
788519c6
JS
15#undef XFontStruct
16#undef XCharStruct
256d631a
JS
17
18/* Data types */
19
c79a329d 20typedef GR_PALETTE* Colormap;
e941874b
JS
21typedef GR_DRAW_ID Drawable ;
22typedef int Status;
c79a329d
JS
23typedef unsigned long VisualID;
24typedef int Bool;
25typedef long XID;
461e93f9
JS
26typedef GR_SCANCODE KeySym;
27typedef GR_EVENT_KEYSTROKE XKeyEvent;
788519c6
JS
28typedef struct {
29 GR_FONT_INFO info;
30 GR_FONT_ID fid;
31} XFontStruct;
32typedef struct {
33 short lbearing; /* origin to left edge of raster */
34 short rbearing; /* origin to right edge of raster */
35 short width; /* advance to next char's origin */
36 short ascent; /* baseline to top edge of raster */
37 short descent; /* baseline to bottom edge of raster */
38 unsigned short attributes; /* per char flags (not predefined) */
39} XCharStruct;
40
461e93f9
JS
41/* Configure window value mask bits */
42#define CWX (1<<0)
43#define CWY (1<<1)
44#define CWWidth (1<<2)
45#define CWHeight (1<<3)
46#define CWBorderWidth (1<<4)
47#define CWSibling (1<<5)
48#define CWStackMode (1<<6)
49
50/* Values */
51
52typedef struct {
53 int x, y;
54 int width, height;
55 int border_width;
56 Window sibling;
57 int stack_mode;
58} XWindowChanges;
788519c6 59
c79a329d 60/* typedef unsigned long Time; */
e941874b
JS
61
62#define Success 0
63#define GrabSuccess Success
64#define GrabNotViewable (Success+1)
65#define InputOutput 1
66#define InputOnly 2
67#define IsUnmapped 0
68#define IsUnviewable 1
69#define IsViewable 2
c79a329d
JS
70/* Is this right? */
71#define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED
72#define GraphicsExpose GR_EVENT_TYPE_EXPOSURE
73#define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE
788519c6
JS
74#define ColormapChangeMask 0
75#define FillSolid 0
76#define LineSolid 0
77#define LineOnOffDash 0
78#define CapNotLast 0
79#define CapRound 0
80#define CapProjecting 0
81#define CapButt 0
82#define JoinRound 0
83#define JoinBevel 0
84#define JoinMiter 0
85#define IncludeInferiors 0
86#define ClipByChildren 0
87#define DoRed 0
88#define DoGreen 0
89#define DoBlue 0
461e93f9
JS
90#define NoEventMask GR_EVENT_MASK_NONE
91#define RevertToParent 0
92#define CurrentTime 0
93#define GrabModeAsync 0
788519c6
JS
94
95#define GXcopy GR_MODE_COPY
96#define GXclear GR_MODE_CLEAR
97#ifndef GXxor
98#define GXxor GR_MODE_OR
99#endif
100#define GXinvert GR_MODE_INVERT
101#define GXorReverse GR_MODE_ORREVERSE
102#define GXandReverse GR_MODE_ANDREVERSE
103#define GXand GR_MODE_AND
104#define GXor GR_MODE_OR
105#define GXandInverted GR_MODE_ANDINVERTED
106#define GXnoop GR_MODE_NOOP
107#define GXnor GR_MODE_NOR
108#define GXequiv GR_MODE_EQUIV
109#define GXcopyInverted GR_MODE_COPYINVERTED
110#define GXorInverted GR_MODE_ORINVERTED
111#define GXnand GR_MODE_NAND
112#define GXset GR_MODE_SET
113
c79a329d
JS
114#define XSynchronize(display,sync)
115#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
461e93f9 116#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
c79a329d
JS
117#define XFreePixmap(d, p) GrDestroyWindow(p)
118#define XFreeCursor(d, c) GrDestroyCursor(c)
788519c6
JS
119#define XFreeGC(d, gc) GrDestroyGC(gc)
120#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c)
c79a329d 121#define DefaultVisual(d, s) ((Visual*) NULL)
788519c6 122#define DefaultColormap(d, s) DefaultColormapOfScreen((Screen*) NULL)
461e93f9 123#define DefaultScreenOfDisplay(d) 0
788519c6
JS
124#define XSetFillStyle(d, gc, s) wxNoop()
125#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop()
126#define XSetClipMask(d, gc, m) wxNoop()
127#define XSetTSOrigin(d, gc, x, y) wxNoop()
128#define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE)
129#define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC)
130#define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y)
131#define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p)
132#define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height)
133#define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y)
134#define XSetRegion(d, gc, r) GrSetGCRegion(gc, r)
135#define XSetTile(d, gc, p) wxNoop()
136#define XSetStipple(d, gc, p) wxNoop()
137#define XSetSubwindowMode(d, gc, mode) wxNoop()
138#define XFreeColormap(d, cmap) wxNoop()
139#define XSetTransientForHint(d, w, p) wxNoop()
140#define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2)
141#define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2)
142#define XEqualRegion(r1, r2) GrEqualRegion(r1, r2)
143#define XEmptyRegion(r) GrEmptyRegion(r)
144#define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y)
145#define XClipBox(r, rect) GrGetRegionBox(r, rect)
146#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y)
147#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2)
461e93f9
JS
148/* TODO: Cannot find equivalent for this. */
149#define XIconifyWindow(d, w, s) 0
150#define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \
151 GrNewWindow(p,x,y,w,h,bw,backColor,foreColor)
152#define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode)
153#define XBell(a, b) GrBell()
154#define DisplayWidthMM(d, s) 100
155#define DisplayHeightMM(d, s) 100
c79a329d
JS
156
157/* These defines are wrongly defined in XtoNX.h, IMHO,
158 * since they reference a static global.
159 * Redefined as functions, below.
160 */
161
162#undef DisplayWidth
163#undef DisplayHeight
164#undef DefaultDepth
165
166/*
167 * Data structure used by color operations
168 */
169typedef struct {
170 unsigned long pixel;
171 unsigned short red, green, blue;
172 char flags; /* do_red, do_green, do_blue */
173 char pad;
174} XColor;
175
176typedef struct {
177 int type;
178 Display *display; /* Display the event was read from */
179 XID resourceid; /* resource id */
180 unsigned long serial; /* serial number of failed request */
181 unsigned char error_code; /* error code of failed request */
182 unsigned char request_code; /* Major op-code of failed request */
183 unsigned char minor_code; /* Minor op-code of failed request */
184} XErrorEvent;
185
186/*
187 * Visual structure; contains information about colormapping possible.
188 */
189typedef struct {
190 void *ext_data; /* hook for extension to hang data */
191 VisualID visualid; /* visual id of this visual */
192#if defined(__cplusplus) || defined(c_plusplus)
193 int c_class; /* C++ class of screen (monochrome, etc.) */
194#else
195 int class; /* class of screen (monochrome, etc.) */
196#endif
197 unsigned long red_mask, green_mask, blue_mask; /* mask values */
198 int bits_per_rgb; /* log base 2 of distinct color values */
199 int map_entries; /* color map entries */
200} Visual;
201
202/*
203 * Depth structure; contains information for each possible depth.
204 */
205typedef struct {
206 int depth; /* this depth (Z) of the depth */
207 int nvisuals; /* number of Visual types at this depth */
208 Visual *visuals; /* list of visuals possible at this depth */
209} Depth;
210
211/*
212 * Information about the screen. The contents of this structure are
213 * implementation dependent. A Screen should be treated as opaque
214 * by application code.
215 */
216
217struct _XDisplay; /* Forward declare before use for C++ */
218
219typedef struct {
220 void *ext_data; /* hook for extension to hang data */
221 struct _XDisplay *display;/* back pointer to display structure */
222 Window root; /* Root window id. */
223 int width, height; /* width and height of screen */
224 int mwidth, mheight; /* width and height of in millimeters */
225 int ndepths; /* number of depths possible */
226 Depth *depths; /* list of allowable depths on the screen */
227 int root_depth; /* bits per pixel */
228 Visual *root_visual; /* root visual */
229 GC default_gc; /* GC for the root root visual */
230 Colormap cmap; /* default color map */
231 unsigned long white_pixel;
232 unsigned long black_pixel; /* White and Black pixel values */
233 int max_maps, min_maps; /* max and min color maps */
234 int backing_store; /* Never, WhenMapped, Always */
235 Bool save_unders;
236 long root_input_mask; /* initial root input mask */
237} Screen;
238
e941874b
JS
239
240typedef struct {
241 int x, y; /* location of window */
242 int width, height; /* width and height of window */
243 int border_width; /* border width of window */
244 int depth; /* depth of window */
245 Visual *visual; /* the associated visual structure */
246 Window root; /* root of screen containing window */
c79a329d 247 int _class; /* InputOutput, InputOnly*/
e941874b
JS
248 int bit_gravity; /* one of the bit gravity values */
249 int win_gravity; /* one of the window gravity values */
250 int backing_store; /* NotUseful, WhenMapped, Always */
251 unsigned long backing_planes;/* planes to be preserved if possible */
252 unsigned long backing_pixel;/* value to be used when restoring planes */
253 Bool save_under; /* boolean, should bits under be saved? */
254 Colormap colormap; /* color map to be associated with window */
255 Bool map_installed; /* boolean, is color map currently installed*/
256 int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
257 long all_event_masks; /* set of events all people have interest in*/
258 long your_event_mask; /* my event mask */
259 long do_not_propagate_mask;/* set of events that should not propagate */
260 Bool override_redirect; /* boolean value for override-redirect */
261 Screen *screen; /* back pointer to correct screen */
262} XWindowAttributes;
256d631a 263
c79a329d
JS
264typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
265 Display* /* display */,
266 XErrorEvent* /* error_event */
267);
268
256d631a
JS
269/* events*/
270
271/* What should this be? */
272#if 0
273#ifndef ResizeRequest
274#define ResizeRequest ??
275#endif
276#endif
277
278#ifndef MotionNotify
279#define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION
280#define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION
281#endif
282
788519c6
JS
283#define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION
284#define KeymapStateMask 0
285#define StructureNotifyMask GR_EVENT_MASK_UPDATE
286
c2ff68d3
JS
287#ifdef ConfigureNotify
288/* XtoNX.h gets it wrong */
289#undef ConfigureNotify
290#endif
291#define ConfigureNotify GR_EVENT_TYPE_UPDATE
292
256d631a
JS
293#ifndef FocusIn
294#define FocusIn GR_EVENT_TYPE_FOCUS_IN
295#define FocusOut GR_EVENT_TYPE_FOCUS_OUT
296#define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT
297#endif
298
299/* Fuunctions */
300
461e93f9 301#ifdef __cplusplus
256d631a
JS
302extern "C" {
303#endif
304
461e93f9 305Display *XOpenDisplay(char *name);
c79a329d 306Colormap DefaultColormapOfScreen(Screen* /* screen */) ;
e941874b 307int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ;
788519c6 308int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */,
e941874b
JS
309 int /* srcX */, int /* srcY */,
310 unsigned int /* srcWidth */,
311 unsigned int /* srcHeight */,
312 int destX, int destY);
313int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ;
314int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ;
315int XGrabPointer(Display* /* display */, Window /* grab_window */,
316 Bool /* owner_events */, unsigned int /* event_mask */,
317 int /* pointer_mode */, int /* keyboard_mode */,
318 Window /* confine_to */, Cursor /* cursor */, Time /* time */) ;
461e93f9 319int XUngrabPointer(Display* /* display */, Time /* time */) ;
e941874b
JS
320int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc,
321 int src_x, int src_y, unsigned int width, unsigned int height,
322 int dest_x, int dest_y) ;
323int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc,
324 int src_x, int src_y, unsigned int width, unsigned int height,
325 int dest_x, int dest_y, unsigned long /* plane */) ;
256d631a 326
c79a329d 327XErrorHandler XSetErrorHandler (XErrorHandler /* handler */);
c79a329d
JS
328Screen *XScreenOfDisplay(Display* /* display */,
329 int /* screen_number */);
330int DisplayWidth(Display* /* display */, int /* screen */);
331int DisplayHeight(Display* /* display */, int /* screen */);
332int DefaultDepth(Display* /* display */, int /* screen */);
333int XAllocColor(Display* /* display */, Colormap /* cmap */,
334 XColor* color);
335int XParseColor(Display* display, Colormap cmap,
336 const char* cname, XColor* color);
788519c6
JS
337int XDrawLine(Display* display, Window win, GC gc,
338 int x1, int y1, int x2, int y2);
339int XTextExtents( XFontStruct* font, char* s, int len, int* direction,
340 int* ascent, int* descent2, XCharStruct* overall);
341int XPending(Display *d);
342XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec);
343int XFreeFont(Display* display, XFontStruct* fontStruct);
344int XQueryColor(Display* display, Colormap cmap, XColor* color);
461e93f9
JS
345Status XGetWindowAttributes(Display* display, Window w,
346 XWindowAttributes* window_attributes);
347
348int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes);
349int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn);
c79a329d 350
0b5c0e1a
JS
351void wxNoop();
352
461e93f9 353#ifdef __cplusplus
256d631a
JS
354}
355#endif
356
c79a329d 357#define XMaxRequestSize(display) 16384
256d631a 358
c79a329d
JS
359#endif
360 /* _DUMMY_XLIBH_ */