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