Mercurial > hg > xemacs-beta
comparison src/glyphs.h @ 434:9d177e8d4150 r21-2-25
Import from CVS: tag r21-2-25
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:30:53 +0200 |
parents | 3ecd8885ac67 |
children | 84b14dcb0985 |
comparison
equal
deleted
inserted
replaced
433:892ca416f0fb | 434:9d177e8d4150 |
---|---|
72 struct ii_keyword_entry | 72 struct ii_keyword_entry |
73 { | 73 { |
74 Lisp_Object keyword; | 74 Lisp_Object keyword; |
75 void (*validate) (Lisp_Object data); | 75 void (*validate) (Lisp_Object data); |
76 int multiple_p; | 76 int multiple_p; |
77 int copy_p; | |
77 }; | 78 }; |
78 | 79 |
79 typedef struct | 80 typedef struct |
80 { | 81 { |
81 Dynarr_declare (ii_keyword_entry); | 82 Dynarr_declare (ii_keyword_entry); |
128 /* Set-property method: Given an image instance, set device specific | 129 /* Set-property method: Given an image instance, set device specific |
129 properties. */ | 130 properties. */ |
130 Lisp_Object (*set_property_method) (Lisp_Object image_instance, | 131 Lisp_Object (*set_property_method) (Lisp_Object image_instance, |
131 Lisp_Object property, | 132 Lisp_Object property, |
132 Lisp_Object val); | 133 Lisp_Object val); |
134 | |
135 /* Find out the geometry of this image instance. */ | |
136 void (*query_geometry_method) (Lisp_Object image_instance, | |
137 int* width, int* height, int disp); | |
138 | |
139 /* Layout the instances children. */ | |
140 void (*layout_children_method) (Lisp_Object image_instance); | |
133 }; | 141 }; |
134 | 142 |
135 /***** Calling an image-instantiator method *****/ | 143 /***** Calling an image-instantiator method *****/ |
136 | 144 |
137 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) | 145 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) |
200 (format##_image_instantiator_methods->m##_method = type##_##m) | 208 (format##_image_instantiator_methods->m##_method = type##_##m) |
201 | 209 |
202 /* Declare that KEYW is a valid keyword for image-instantiator format | 210 /* Declare that KEYW is a valid keyword for image-instantiator format |
203 FORMAT. VALIDATE_FUN if a function that returns whether the data | 211 FORMAT. VALIDATE_FUN if a function that returns whether the data |
204 is valid. The keyword may not appear more than once. */ | 212 is valid. The keyword may not appear more than once. */ |
205 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \ | 213 #define IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, copy, multi) \ |
206 do { \ | 214 do { \ |
207 struct ii_keyword_entry entry; \ | 215 struct ii_keyword_entry entry; \ |
208 \ | 216 \ |
209 entry.keyword = keyw; \ | 217 entry.keyword = keyw; \ |
210 entry.validate = validate_fun; \ | 218 entry.validate = validate_fun; \ |
211 entry.multiple_p = 0; \ | 219 entry.multiple_p = multi; \ |
220 entry.copy_p = copy; \ | |
212 Dynarr_add (format##_image_instantiator_methods->keywords, \ | 221 Dynarr_add (format##_image_instantiator_methods->keywords, \ |
213 entry); \ | 222 entry); \ |
214 } while (0) | 223 } while (0) |
215 | 224 |
225 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \ | |
226 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 0) | |
227 | |
216 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may | 228 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may |
217 appear multiple times. */ | 229 appear multiple times. */ |
218 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \ | 230 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \ |
219 do { \ | 231 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1) |
220 struct ii_keyword_entry entry; \ | 232 |
221 \ | 233 /* Same as IIFORMAT_VALID_KEYWORD execpt that the argument is not |
222 entry.keyword = keyword; \ | 234 copied by the specifier functions. This is necessary for things |
223 entry.validate = validate_fun; \ | 235 like callbacks etc. */ |
224 entry.multiple_p = 1; \ | 236 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \ |
225 Dynarr_add (format##_image_instantiator_methods->keywords, \ | 237 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0) |
226 entry); \ | |
227 } while (0) | |
228 | 238 |
229 /* Declare that image-instantiator format FORMAT is supported on | 239 /* Declare that image-instantiator format FORMAT is supported on |
230 CONSOLE type. */ | 240 CONSOLE type. */ |
231 #define IIFORMAT_VALID_CONSOLE(console, format) \ | 241 #define IIFORMAT_VALID_CONSOLE(console, format) \ |
232 do { \ | 242 do { \ |
360 IMAGE_SUBWINDOW, | 370 IMAGE_SUBWINDOW, |
361 IMAGE_WIDGET, | 371 IMAGE_WIDGET, |
362 IMAGE_LAYOUT | 372 IMAGE_LAYOUT |
363 }; | 373 }; |
364 | 374 |
375 enum image_instance_geometry | |
376 { | |
377 IMAGE_GEOMETRY, | |
378 IMAGE_DESIRED_GEOMETRY, | |
379 IMAGE_MIN_GEOMETRY, | |
380 IMAGE_MAX_GEOMETRY | |
381 }; | |
382 | |
365 #define IMAGE_NOTHING_MASK (1 << 0) | 383 #define IMAGE_NOTHING_MASK (1 << 0) |
366 #define IMAGE_TEXT_MASK (1 << 1) | 384 #define IMAGE_TEXT_MASK (1 << 1) |
367 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) | 385 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) |
368 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) | 386 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) |
369 #define IMAGE_POINTER_MASK (1 << 4) | 387 #define IMAGE_POINTER_MASK (1 << 4) |
444 { | 462 { |
445 struct lcrecord_header header; | 463 struct lcrecord_header header; |
446 Lisp_Object device; | 464 Lisp_Object device; |
447 Lisp_Object name; | 465 Lisp_Object name; |
448 enum image_instance_type type; | 466 enum image_instance_type type; |
449 int x_offset, y_offset; /* for layout purposes */ | 467 unsigned int x_offset, y_offset; /* for layout purposes */ |
468 unsigned int width, height; | |
450 unsigned int dirty : 1; | 469 unsigned int dirty : 1; |
451 union | 470 union |
452 { | 471 { |
453 struct | 472 struct |
454 { | 473 { |
474 unsigned int descent; | |
455 Lisp_Object string; | 475 Lisp_Object string; |
456 } text; | 476 } text; |
457 struct | 477 struct |
458 { | 478 { |
459 int width, height, depth; | 479 unsigned int depth; |
460 int slice, maxslice, timeout; | 480 unsigned int slice, maxslice, timeout; |
461 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */ | 481 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */ |
462 Lisp_Object filename; /* string or Qnil */ | 482 Lisp_Object filename; /* string or Qnil */ |
463 Lisp_Object mask_filename; /* string or Qnil */ | 483 Lisp_Object mask_filename; /* string or Qnil */ |
464 Lisp_Object fg, bg; /* foreground and background colors, | 484 Lisp_Object fg, bg; /* foreground and background colors, |
465 if this is a colorized mono-pixmap | 485 if this is a colorized mono-pixmap |
469 void* mask; /* mask that can be seen from all windowing systems */ | 489 void* mask; /* mask that can be seen from all windowing systems */ |
470 } pixmap; /* used for pointers as well */ | 490 } pixmap; /* used for pointers as well */ |
471 struct | 491 struct |
472 { | 492 { |
473 Lisp_Object frame; | 493 Lisp_Object frame; |
474 unsigned int width, height; | |
475 void* subwindow; /* specific devices can use this as necessary */ | 494 void* subwindow; /* specific devices can use this as necessary */ |
476 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */ | 495 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */ |
477 union | 496 union |
478 { | 497 { |
479 struct | 498 struct |
499 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) | 518 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) |
500 #define IMAGE_INSTANCE_NAME(i) ((i)->name) | 519 #define IMAGE_INSTANCE_NAME(i) ((i)->name) |
501 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) | 520 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) |
502 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) | 521 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) |
503 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) | 522 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) |
523 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) | |
524 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) | |
504 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ | 525 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ |
505 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ | 526 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ |
506 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) | 527 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) |
507 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) | 528 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) |
508 | 529 |
509 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) | 530 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) |
510 | 531 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \ |
511 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width) | 532 IMAGE_INSTANCE_WIDTH(i) |
512 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height) | 533 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \ |
534 IMAGE_INSTANCE_HEIGHT(i) | |
535 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent) | |
536 | |
537 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \ | |
538 IMAGE_INSTANCE_WIDTH(i) | |
539 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ | |
540 IMAGE_INSTANCE_HEIGHT(i) | |
513 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) | 541 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) |
514 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename) | 542 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename) |
515 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename) | 543 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename) |
516 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x) | 544 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x) |
517 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y) | 545 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y) |
521 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask) | 549 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask) |
522 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) | 550 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) |
523 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) | 551 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) |
524 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) | 552 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) |
525 | 553 |
526 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) ((i)->u.subwindow.width) | 554 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ |
527 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) ((i)->u.subwindow.height) | 555 IMAGE_INSTANCE_WIDTH(i) |
556 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ | |
557 IMAGE_INSTANCE_HEIGHT(i) | |
528 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) | 558 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) |
529 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) | 559 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) |
530 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ | 560 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
531 ((i)->u.subwindow.being_displayed) | 561 ((i)->u.subwindow.being_displayed) |
532 | 562 |
533 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ | 563 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ |
534 IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) | 564 IMAGE_INSTANCE_WIDTH(i) |
535 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ | 565 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ |
536 IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) | 566 IMAGE_INSTANCE_HEIGHT(i) |
537 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.s.widget.type) | 567 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.s.widget.type) |
538 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.s.widget.props) | 568 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.s.widget.props) |
539 #define IMAGE_INSTANCE_WIDGET_FACE(i) ((i)->u.subwindow.s.widget.face) | 569 #define IMAGE_INSTANCE_WIDGET_FACE(i) ((i)->u.subwindow.s.widget.face) |
540 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.s.widget.gui_item) | 570 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.s.widget.gui_item) |
541 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \ | 571 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \ |