]>
Commit | Line | Data |
---|---|---|
1 | typedef int int32; | |
2 | typedef unsigned int uint32; | |
3 | typedef short int16; | |
4 | typedef unsigned short uint16; | |
5 | typedef unsigned char uint8; | |
6 | typedef uint16 unichar_t; | |
7 | enum charset { | |
8 | em_none = | |
9 | -1, em_iso8859_1, em_iso8859_2, em_iso8859_3, em_iso8859_4, | |
10 | em_iso8859_5, em_iso8859_6, em_iso8859_7, em_iso8859_8, | |
11 | em_iso8859_9, em_iso8859_10, em_iso8859_11, em_iso8859_13, | |
12 | em_iso8859_14, em_iso8859_15, em_koi8_r, em_jis201, em_win, em_mac, | |
13 | em_symbol, em_zapfding, em_user, em_adobestandard = | |
14 | em_user, em_jis208, em_jis212, em_ksc5601, em_gb2312, em_big5, | |
15 | em_big5hkscs, em_johab, em_unicode, em_unicode4, em_gb18030, em_max, | |
16 | em_first2byte = em_jis208, em_last94x94 = em_gb2312 | |
17 | }; | |
18 | typedef uint32 Color; | |
19 | typedef struct gimage { | |
20 | } GImage; | |
21 | typedef struct grect { | |
22 | } GRect; | |
23 | typedef struct gpoint { | |
24 | } GPoint; | |
25 | typedef struct { | |
26 | } FontRequest; | |
27 | typedef struct { | |
28 | } FontMods; | |
29 | enum gic_style { | |
30 | gic_overspot = 2, gic_root = 1, gic_hidden = 0, gic_orlesser = | |
31 | 4, gic_type = 3 | |
32 | }; | |
33 | typedef struct ginput_context GIC; | |
34 | enum selnames { | |
35 | sn_primary, sn_clipboard, sn_drag_and_drop, sn_max | |
36 | }; | |
37 | typedef struct gwindow *GWindow; | |
38 | typedef struct gdisplay GDisplay; | |
39 | typedef struct gtimer GTimer; | |
40 | typedef struct gevent { | |
41 | enum event_type { | |
42 | et_noevent = | |
43 | -1, et_char, et_charup, et_mousemove, et_mousedown, | |
44 | et_mouseup, et_crossing, et_focus, et_expose, et_visibility, | |
45 | et_resize, et_timer, et_close, et_create, et_map, | |
46 | et_destroy, et_selclear, et_drag, et_dragout, et_drop, | |
47 | et_lastnativeevent = et_drop, et_controlevent, et_user | |
48 | } type; | |
49 | } GEvent; | |
50 | typedef enum cursor_types { | |
51 | ct_default, ct_pointer, ct_backpointer, ct_hand, ct_question, ct_cross, | |
52 | ct_4way, ct_text, ct_watch, ct_draganddrop, ct_invisible, ct_user, | |
53 | ct_user2 | |
54 | } GCursor; | |
55 | typedef struct gwindow_attrs { | |
56 | } GWindowAttrs; | |
57 | typedef struct gprinter_attrs { | |
58 | } GPrinterAttrs; | |
59 | enum gzoom_flags { | |
60 | gzf_pos = 1, gzf_size = 2 | |
61 | }; | |
62 | typedef struct { | |
63 | } GChar2b; | |
64 | struct displayfuncs { | |
65 | void (*init) (GDisplay *); | |
66 | void (*term) (GDisplay *); | |
67 | void *(*nativeDisplay) (GDisplay *); | |
68 | void (*setDefaultIcon) (GWindow); | |
69 | GWindow(*createTopWindow) (GDisplay *, GRect * pos, | |
70 | int (*eh) (GWindow, GEvent *), | |
71 | void *user_data, GWindowAttrs *); | |
72 | GWindow(*createSubWindow) (GWindow, GRect * pos, | |
73 | int (*eh) (GWindow, GEvent *), | |
74 | void *user_data, GWindowAttrs *); | |
75 | GWindow(*createPixmap) (GDisplay *, uint16 width, uint16 height); | |
76 | GWindow(*createBitmap) (GDisplay *, uint16 width, uint16 height, | |
77 | uint8 * data); | |
78 | GCursor(*createCursor) (GWindow src, GWindow mask, Color fg, Color bg, | |
79 | int16 x, int16 y); | |
80 | void (*destroyWindow) (GWindow); | |
81 | void (*destroyCursor) (GDisplay *, GCursor); | |
82 | int (*nativeWindowExists) (GDisplay *, void *native_window); | |
83 | void (*setZoom) (GWindow, GRect * size, enum gzoom_flags flags); | |
84 | void (*setWindowBorder) (GWindow, int width, Color); | |
85 | int (*setDither) (GDisplay *, int); | |
86 | void (*reparentWindow) (GWindow, GWindow, int, int); | |
87 | void (*setVisible) (GWindow, int); | |
88 | void (*move) (GWindow, int32, int32); | |
89 | void (*trueMove) (GWindow, int32, int32); | |
90 | void (*resize) (GWindow, int32, int32); | |
91 | void (*moveResize) (GWindow, int32, int32, int32, int32); | |
92 | void (*raise) (GWindow); | |
93 | void (*raiseAbove) (GWindow, GWindow); | |
94 | int (*isAbove) (GWindow, GWindow); | |
95 | void (*lower) (GWindow); | |
96 | void (*setWindowTitles) (GWindow, const unichar_t * title, | |
97 | const unichar_t * icontitle); | |
98 | void (*setWindowTitles8) (GWindow, const char *title, | |
99 | const char *icontitle); | |
100 | unichar_t *(*getWindowTitle) (GWindow); | |
101 | char *(*getWindowTitle8) (GWindow); | |
102 | void (*getPointerPos) (GWindow, GEvent *); | |
103 | void (*setCursor) (GWindow, GCursor); | |
104 | GCursor(*getCursor) (GWindow); | |
105 | GWindow(*getRedirectWindow) (GDisplay * gd); | |
106 | void (*translateCoordinates) (GWindow from, GWindow to, GPoint * pt); | |
107 | void (*beep) (GDisplay *); | |
108 | void (*flush) (GDisplay *); | |
109 | void (*pushClip) (GWindow, GRect * rct, GRect * old); | |
110 | void (*popClip) (GWindow, GRect * old); | |
111 | void (*eventLoop) (GDisplay *); | |
112 | void (*postEvent) (GEvent * e); | |
113 | void (*postDragEvent) (GWindow w, GEvent * mouse, enum event_type et); | |
114 | int (*requestDeviceEvents) (GWindow w, int devcnt, | |
115 | struct gdeveventmask * de); | |
116 | GTimer *(*requestTimer) (GWindow w, int32 time_from_now, | |
117 | int32 frequency, void *userdata); | |
118 | void (*cancelTimer) (GTimer * timer); | |
119 | int (*endJob) (GWindow w, int cancel); | |
120 | }; | |
121 | typedef struct gpswindow { | |
122 | } *GPSWindow; | |
123 | typedef struct gpsdisplay { | |
124 | struct displayfuncs *funcs; | |
125 | } GPSDisplay; | |
126 | extern void _GPSDraw_Image(GWindow, GImage *, GRect * src, int32 x, int32 y); | |
127 | extern void _GPSDraw_TileImage(GWindow, GImage *, GRect * src, int32 x, | |
128 | int32 y); | |
129 | extern void _GPSDraw_ImageMagnified(GWindow, GImage *, GRect * src, int32 x, | |
130 | int32 y, int32 width, int32 height); | |
131 | extern void *_GPSDraw_LoadFontMetrics(GDisplay * gdisp, struct font_data *fd); | |
132 | extern struct font_data *_GPSDraw_ScaleFont(GDisplay * gdisp, | |
133 | struct font_data *fd, | |
134 | FontRequest * rq); | |
135 | extern struct font_data *_GPSDraw_StylizeFont(GDisplay * gdisp, | |
136 | struct font_data *fd, | |
137 | FontRequest * rq); | |
138 | static void PSDrawInit(GDisplay * gdisp) | |
139 | { | |
140 | } | |
141 | static void PSDrawTerm(GDisplay * gdisp) | |
142 | { | |
143 | } | |
144 | static void *PSDrawNativeDisplay(GDisplay * gdisp) | |
145 | { | |
146 | } | |
147 | static void PSDrawSetDefaultIcon(GWindow icon) | |
148 | { | |
149 | } | |
150 | static GWindow PSDrawCreateSubWindow(GWindow w, GRect * pos, | |
151 | int (*eh) (GWindow, GEvent *), | |
152 | void *user_data, GWindowAttrs * wattrs) | |
153 | { | |
154 | } | |
155 | static GWindow PSDrawCreatePixmap(GDisplay * gdisp, uint16 width, uint16 height) | |
156 | { | |
157 | } | |
158 | static GWindow PSDrawCreateBitmap(GDisplay * gdisp, uint16 width, uint16 height, | |
159 | uint8 * data) | |
160 | { | |
161 | } | |
162 | static GCursor PSDrawCreateCursor(GWindow src, GWindow mask, Color fg, Color bg, | |
163 | int16 x, int16 y) | |
164 | { | |
165 | } | |
166 | static void PSSetZoom(GWindow w, GRect * r, enum gzoom_flags flags) | |
167 | { | |
168 | } | |
169 | static void PSDestroyCursor(GDisplay * gdisp, GCursor ct) | |
170 | { | |
171 | } | |
172 | static int PSNativeWindowExists(GDisplay * gdisp, void *native) | |
173 | { | |
174 | } | |
175 | static void PSSetWindowBorder(GWindow w, int width, Color col) | |
176 | { | |
177 | } | |
178 | static int PSSetDither(GDisplay * gdisp, int dither) | |
179 | { | |
180 | } | |
181 | static void PSDrawReparentWindow(GWindow child, GWindow newparent, int x, int y) | |
182 | { | |
183 | } | |
184 | static void PSDrawSetVisible(GWindow w, int vis) | |
185 | { | |
186 | } | |
187 | static void PSDrawMove(GWindow w, int32 x, int32 y) | |
188 | { | |
189 | } | |
190 | static void PSDrawResize(GWindow w, int32 width, int32 height) | |
191 | { | |
192 | } | |
193 | static void PSDrawMoveResize(GWindow w, int32 x, int32 y, int32 width, | |
194 | int32 height) | |
195 | { | |
196 | } | |
197 | static void PSDrawRaise(GWindow w) | |
198 | { | |
199 | } | |
200 | static void PSDrawRaiseAbove(GWindow w, GWindow below) | |
201 | { | |
202 | } | |
203 | static int PSDrawIsAbove(GWindow w, GWindow below) | |
204 | { | |
205 | } | |
206 | static void PSDrawLower(GWindow w) | |
207 | { | |
208 | } | |
209 | static void PSDrawSetWindowTitles(GWindow w, const unichar_t * title, | |
210 | const unichar_t * icontit) | |
211 | { | |
212 | } | |
213 | static void PSDrawSetWindowTitles8(GWindow w, const char *title, | |
214 | const char *icontit) | |
215 | { | |
216 | } | |
217 | static void PSDrawGetPointerPosition(GWindow w, GEvent * ret) | |
218 | { | |
219 | } | |
220 | static void PSDrawSetCursor(GWindow w, GCursor ct) | |
221 | { | |
222 | } | |
223 | static GCursor PSDrawGetCursor(GWindow w) | |
224 | { | |
225 | } | |
226 | static GWindow PSDrawGetRedirectWindow(GDisplay * gd) | |
227 | { | |
228 | } | |
229 | static unichar_t *PSDrawGetWindowTitle(GWindow w) | |
230 | { | |
231 | } | |
232 | static char *PSDrawGetWindowTitle8(GWindow w) | |
233 | { | |
234 | } | |
235 | static void PSDrawTranslateCoordinates(GWindow _from, GWindow _to, GPoint * pt) | |
236 | { | |
237 | } | |
238 | static void PSDrawScroll(GWindow w, GRect * rect, int32 hor, int32 vert) | |
239 | { | |
240 | } | |
241 | static void PSDrawBeep(GDisplay * gdisp) | |
242 | { | |
243 | } | |
244 | static void PSDrawFlush(GDisplay * gdisp) | |
245 | { | |
246 | } | |
247 | static GIC *PSDrawCreateInputContext(GWindow w, enum gic_style def_style) | |
248 | { | |
249 | } | |
250 | static void PSDrawSetGIC(GWindow w, GIC * gic, int x, int y) | |
251 | { | |
252 | } | |
253 | static void PSDrawPointerUngrab(GDisplay * gdisp) | |
254 | { | |
255 | } | |
256 | static void PSDrawPointerGrab(GWindow w) | |
257 | { | |
258 | } | |
259 | static void PSDrawGrabSelection(GWindow w, enum selnames sel) | |
260 | { | |
261 | } | |
262 | static void PSDrawAddSelectionType(GWindow w, enum selnames sel, char *type, | |
263 | void *data, int32 len, int32 unitsize, | |
264 | void *(*gendata) (void *, int32 * len), | |
265 | void (*freedata) (void *)) | |
266 | { | |
267 | } | |
268 | static void *PSDrawRequestSelection(GWindow w, enum selnames sn, char *typename, | |
269 | int32 * len) | |
270 | { | |
271 | } | |
272 | static int PSDrawSelectionHasType(GWindow w, enum selnames sn, char *typename) | |
273 | { | |
274 | } | |
275 | static void PSDrawRequestExpose(GWindow gw, GRect * rect, int doclear) | |
276 | { | |
277 | } | |
278 | static GTimer *PSDrawRequestTimer(GWindow w, int32 time_from_now, | |
279 | int32 frequency, void *userdata) | |
280 | { | |
281 | } | |
282 | static void PSDrawCancelTimer(GTimer * timer) | |
283 | { | |
284 | } | |
285 | static void PSDrawSyncThread(GDisplay * gdisp, void (*func) (void *), | |
286 | void *data) | |
287 | { | |
288 | } | |
289 | static void PSDrawForceUpdate(GWindow gw) | |
290 | { | |
291 | } | |
292 | static void PSDrawSync(GDisplay * gdisp) | |
293 | { | |
294 | } | |
295 | static void PSDrawSkipMouseMoveEvents(GWindow gw, GEvent * last) | |
296 | { | |
297 | } | |
298 | static void PSDrawProcessPendingEvents(GDisplay * gdisp) | |
299 | { | |
300 | } | |
301 | static void PSDrawProcessWindowEvents(GWindow gw) | |
302 | { | |
303 | } | |
304 | static void PSDrawEventLoop(GDisplay * gd) | |
305 | { | |
306 | } | |
307 | static void PSDrawPostEvent(GEvent * e) | |
308 | { | |
309 | } | |
310 | static void PSDrawPostDragEvent(GWindow w, GEvent * mouse, enum event_type et) | |
311 | { | |
312 | } | |
313 | static int PSDrawRequestDeviceEvents(GWindow w, int devcnt, | |
314 | struct gdeveventmask *de) | |
315 | { | |
316 | } | |
317 | static GImage *_PSDraw_CopyScreenToImage(GWindow w, GRect * rect) | |
318 | { | |
319 | } | |
320 | static void _PSDraw_Pixmap(GWindow _w, GWindow _pixmap, GRect * src, int32 x, | |
321 | int32 y) | |
322 | { | |
323 | } | |
324 | static void _PSDraw_TilePixmap(GWindow _w, GWindow _pixmap, GRect * src, | |
325 | int32 x, int32 y) | |
326 | { | |
327 | } | |
328 | static void PSMyArc(GPSWindow ps, double cx, double cy, double radx, | |
329 | double rady, double sa, double ta) | |
330 | { | |
331 | double ea, temp; | |
332 | ea = sa + ta; | |
333 | while (sa < ea) { | |
334 | temp = ((int)((sa + 90) / 90)) * 90; | |
335 | PSDoArc(ps, cx, cy, radx, rady, sa, ea < temp ? ea : temp); | |
336 | sa = temp; | |
337 | } | |
338 | } | |
339 | static void PSDrawElipse(GPSWindow ps, GRect * rct, char *command) | |
340 | { | |
341 | float cx, cy, radx, rady; | |
342 | if (radx != rady) | |
343 | PSMyArc(ps, cx, cy, radx, rady, 0, 360); | |
344 | } | |
345 | static void PSDrawPushClip(GWindow w, GRect * rct, GRect * old) | |
346 | { | |
347 | } | |
348 | static void PSDrawPopClip(GWindow w, GRect * old) | |
349 | { | |
350 | } | |
351 | static void PSDrawDrawLine(GWindow w, int32 x, int32 y, int32 xend, int32 yend, | |
352 | Color col) | |
353 | { | |
354 | } | |
355 | static void PSDrawDrawArrowLine(GWindow w, int32 x, int32 y, int32 xend, | |
356 | int32 yend, int16 arrows, Color col) | |
357 | { | |
358 | } | |
359 | static void PSDrawDrawRect(GWindow w, GRect * rct, Color col) | |
360 | { | |
361 | } | |
362 | static void PSDrawFillRect(GWindow w, GRect * rct, Color col) | |
363 | { | |
364 | } | |
365 | static void PSDrawClear(GWindow w, GRect * rect) | |
366 | { | |
367 | } | |
368 | static void PSDrawDrawCircle(GWindow w, GRect * rct, Color col) | |
369 | { | |
370 | } | |
371 | static void PSDrawFillCircle(GWindow w, GRect * rct, Color col) | |
372 | { | |
373 | GPSWindow ps = (GPSWindow) w; | |
374 | PSDrawElipse(ps, rct, "fill"); | |
375 | } | |
376 | static void PSDrawDrawArc(GWindow w, GRect * rct, int32 sa, int32 ta, Color col) | |
377 | { | |
378 | } | |
379 | static void PSDrawDrawPoly(GWindow w, GPoint * pt, int16 cnt, Color col) | |
380 | { | |
381 | } | |
382 | static void PSDrawFillPoly(GWindow w, GPoint * pt, int16 cnt, Color col) | |
383 | { | |
384 | } | |
385 | static void _GPSDraw_Text1(GWindow gw, struct font_data *fd, int32 x, int32 y, | |
386 | char *txt, int32 cnt, FontMods * mods, Color col) | |
387 | { | |
388 | } | |
389 | static void _GPSDraw_Text2(GWindow gw, struct font_data *fd, int32 x, int32 y, | |
390 | GChar2b * txt, int32 cnt, FontMods * mods, Color col) | |
391 | { | |
392 | } | |
393 | static GWindow GPSPrinterStartJob(GDisplay * gd, void *user_data, | |
394 | GPrinterAttrs * attrs) | |
395 | { | |
396 | } | |
397 | static void GPSPrinterNextPage(GWindow w) | |
398 | { | |
399 | } | |
400 | static int GPSPrinterEndJob(GWindow w, int cancel) | |
401 | { | |
402 | } | |
403 | static GWindow PSDrawCreateTopWindow(GDisplay * gdisp, GRect * pos, | |
404 | int (*eh) (GWindow, GEvent *), | |
405 | void *user_data, GWindowAttrs * wattrs) | |
406 | { | |
407 | } | |
408 | static void PSDrawDestroyWindow(GWindow w) | |
409 | { | |
410 | } | |
411 | static struct displayfuncs psfuncs = { | |
412 | PSDrawInit, PSDrawTerm, PSDrawNativeDisplay, PSDrawSetDefaultIcon, | |
413 | PSDrawCreateTopWindow, PSDrawCreateSubWindow, PSDrawCreatePixmap, | |
414 | PSDrawCreateBitmap, PSDrawCreateCursor, PSDrawDestroyWindow, | |
415 | PSDestroyCursor, PSNativeWindowExists, PSSetZoom, PSSetWindowBorder, | |
416 | PSSetDither, PSDrawReparentWindow, PSDrawSetVisible, PSDrawMove, | |
417 | PSDrawMove, PSDrawResize, PSDrawMoveResize, PSDrawRaise, | |
418 | PSDrawRaiseAbove, PSDrawIsAbove, PSDrawLower, PSDrawSetWindowTitles, | |
419 | PSDrawSetWindowTitles8, PSDrawGetWindowTitle, PSDrawGetWindowTitle8, | |
420 | PSDrawGetPointerPosition, PSDrawSetCursor, PSDrawGetCursor, | |
421 | PSDrawGetRedirectWindow, PSDrawTranslateCoordinates, PSDrawBeep, | |
422 | PSDrawFlush, PSDrawPushClip, PSDrawPopClip, PSDrawClear, | |
423 | PSDrawDrawLine, PSDrawDrawArrowLine, PSDrawDrawRect, PSDrawFillRect, | |
424 | PSDrawDrawCircle, PSDrawFillCircle, PSDrawDrawArc, PSDrawDrawPoly, | |
425 | PSDrawFillPoly, PSDrawScroll, _GPSDraw_Image, _GPSDraw_TileImage, | |
426 | _GPSDraw_ImageMagnified, _PSDraw_CopyScreenToImage, _PSDraw_Pixmap, | |
427 | _PSDraw_TilePixmap, _GPSDraw_ScaleFont, _GPSDraw_StylizeFont, | |
428 | _GPSDraw_LoadFontMetrics, _GPSDraw_Text1, _GPSDraw_Text2, | |
429 | PSDrawCreateInputContext, PSDrawSetGIC, PSDrawGrabSelection, | |
430 | PSDrawAddSelectionType, PSDrawRequestSelection, | |
431 | PSDrawSelectionHasType, PSDrawPointerUngrab, PSDrawPointerGrab, | |
432 | PSDrawRequestExpose, PSDrawForceUpdate, PSDrawSync, | |
433 | PSDrawSkipMouseMoveEvents, PSDrawProcessPendingEvents, | |
434 | PSDrawProcessWindowEvents, PSDrawProcessPendingEvents, | |
435 | PSDrawEventLoop, PSDrawPostEvent, PSDrawPostDragEvent, | |
436 | PSDrawRequestDeviceEvents, PSDrawRequestTimer, PSDrawCancelTimer, | |
437 | PSDrawSyncThread, GPSPrinterStartJob, GPSPrinterNextPage, | |
438 | GPSPrinterEndJob | |
439 | }; | |
440 | GDisplay *_GPSDraw_CreateDisplay() | |
441 | { | |
442 | GPSDisplay *gdisp; | |
443 | gdisp->funcs = &psfuncs; | |
444 | } |