Mercurial > hg > xemacs-beta
comparison src/glyphs-widget.c @ 440:8de8e3f6228a r21-2-28
Import from CVS: tag r21-2-28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:33:38 +0200 |
parents | 84b14dcb0985 |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
439:357dd071b03c | 440:8de8e3f6228a |
---|---|
63 #ifdef DEBUG_WIDGETS | 63 #ifdef DEBUG_WIDGETS |
64 int debug_widget_instances; | 64 int debug_widget_instances; |
65 #endif | 65 #endif |
66 | 66 |
67 /* TODO: | 67 /* TODO: |
68 - more complex controls. | |
69 - tooltips for controls, especially buttons. | 68 - tooltips for controls, especially buttons. |
69 - keyboard traversal. | |
70 - lisp configurable layout. | |
70 */ | 71 */ |
71 | 72 |
72 /* In MS-Windows normal windows work in pixels, dialog boxes work in | 73 /* In MS-Windows normal windows work in pixels, dialog boxes work in |
73 dialog box units. Why? sigh. We could reuse the metrics for dialogs | 74 dialog box units. Why? sigh. We could reuse the metrics for dialogs |
74 if this were not the case. As it is we have to position things | 75 if this were not the case. As it is we have to position things |
254 wire things in this generalised way rather than treating widgets | 255 wire things in this generalised way rather than treating widgets |
255 specially in image_instance_property. */ | 256 specially in image_instance_property. */ |
256 static Lisp_Object | 257 static Lisp_Object |
257 widget_property (Lisp_Object image_instance, Lisp_Object prop) | 258 widget_property (Lisp_Object image_instance, Lisp_Object prop) |
258 { | 259 { |
259 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 260 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
260 struct image_instantiator_methods* meths; | 261 struct image_instantiator_methods* meths; |
261 | 262 |
262 /* first see if its a general property ... */ | 263 /* first see if its a general property ... */ |
263 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop))) | 264 if (!NILP (Fplist_member (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop))) |
264 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil); | 265 return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil); |
279 } | 280 } |
280 | 281 |
281 static Lisp_Object | 282 static Lisp_Object |
282 widget_set_property (Lisp_Object image_instance, Lisp_Object prop, Lisp_Object val) | 283 widget_set_property (Lisp_Object image_instance, Lisp_Object prop, Lisp_Object val) |
283 { | 284 { |
284 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 285 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
285 struct image_instantiator_methods* meths; | 286 struct image_instantiator_methods* meths; |
286 Lisp_Object ret; | 287 Lisp_Object ret; |
287 | 288 |
288 /* PIck up any generic properties that we might need to keep hold | 289 /* PIck up any generic properties that we might need to keep hold |
289 of. */ | 290 of. */ |
324 static void | 325 static void |
325 widget_query_geometry (Lisp_Object image_instance, | 326 widget_query_geometry (Lisp_Object image_instance, |
326 unsigned int* width, unsigned int* height, | 327 unsigned int* width, unsigned int* height, |
327 enum image_instance_geometry disp, Lisp_Object domain) | 328 enum image_instance_geometry disp, Lisp_Object domain) |
328 { | 329 { |
329 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 330 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
330 struct image_instantiator_methods* meths; | 331 struct image_instantiator_methods* meths; |
331 | 332 |
332 /* First just set up what we already have. */ | 333 /* First just set up what we already have. */ |
333 if (width) *width = IMAGE_INSTANCE_WIDTH (ii); | 334 if (width) *width = IMAGE_INSTANCE_WIDTH (ii); |
334 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii); | 335 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii); |
375 | 376 |
376 static void | 377 static void |
377 widget_layout (Lisp_Object image_instance, | 378 widget_layout (Lisp_Object image_instance, |
378 unsigned int width, unsigned int height, Lisp_Object domain) | 379 unsigned int width, unsigned int height, Lisp_Object domain) |
379 { | 380 { |
380 struct Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 381 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
381 struct image_instantiator_methods* meths; | 382 struct image_instantiator_methods* meths; |
382 | 383 |
383 /* .. then try device specific methods ... */ | 384 /* .. then try device specific methods ... */ |
384 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), | 385 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), |
385 IMAGE_INSTANCE_WIDGET_TYPE (ii), | 386 IMAGE_INSTANCE_WIDGET_TYPE (ii), |
443 | 444 |
444 return inst; | 445 return inst; |
445 } | 446 } |
446 | 447 |
447 static void | 448 static void |
448 initialize_widget_image_instance (struct Lisp_Image_Instance *ii, Lisp_Object type) | 449 initialize_widget_image_instance (Lisp_Image_Instance *ii, Lisp_Object type) |
449 { | 450 { |
450 /* initialize_subwindow_image_instance (ii);*/ | 451 /* initialize_subwindow_image_instance (ii);*/ |
451 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type; | 452 IMAGE_INSTANCE_WIDGET_TYPE (ii) = type; |
452 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil; | 453 IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil; |
453 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Qnil); | 454 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Qnil); |
467 void | 468 void |
468 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 469 widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
469 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 470 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
470 int dest_mask, Lisp_Object domain) | 471 int dest_mask, Lisp_Object domain) |
471 { | 472 { |
472 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 473 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
473 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face); | 474 Lisp_Object face = find_keyword_in_vector (instantiator, Q_face); |
474 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height); | 475 Lisp_Object height = find_keyword_in_vector (instantiator, Q_height); |
475 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width); | 476 Lisp_Object width = find_keyword_in_vector (instantiator, Q_width); |
476 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width); | 477 Lisp_Object pixwidth = find_keyword_in_vector (instantiator, Q_pixel_width); |
477 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height); | 478 Lisp_Object pixheight = find_keyword_in_vector (instantiator, Q_pixel_height); |
478 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor); | 479 Lisp_Object desc = find_keyword_in_vector (instantiator, Q_descriptor); |
479 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image); | 480 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image); |
480 Lisp_Object props = find_keyword_in_vector (instantiator, Q_properties); | 481 Lisp_Object props = find_keyword_in_vector (instantiator, Q_properties); |
482 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items); | |
481 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation); | 483 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation); |
482 int pw=0, ph=0, tw=0, th=0; | 484 int pw=0, ph=0, tw=0, th=0; |
483 | 485 |
484 /* this just does pixel type sizing */ | 486 /* this just does pixel type sizing */ |
485 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg, | 487 subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg, |
486 dest_mask, domain); | 488 dest_mask, domain); |
487 | 489 |
488 if (!(dest_mask & IMAGE_WIDGET_MASK)) | 490 if (!(dest_mask & (IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK))) |
489 incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK); | 491 incompatible_image_types (instantiator, dest_mask, |
492 IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK); | |
490 | 493 |
491 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]); | 494 initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]); |
495 | |
496 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; | |
497 IMAGE_INSTANCE_WIDGET_PROPS (ii) = props; | |
492 | 498 |
493 /* retrieve the fg and bg colors */ | 499 /* retrieve the fg and bg colors */ |
494 if (!NILP (face)) | 500 if (!NILP (face)) |
495 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Fget_face (face)); | 501 SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Fget_face (face)); |
496 | 502 |
497 /* data items for some widgets */ | 503 /* Do layout specific initialisation. This feels a bit tacky, but |
498 IMAGE_INSTANCE_WIDGET_PROPS (ii) = props; | 504 the alternative is a myriad of different little functions. */ |
499 | 505 if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)) |
500 /* Pick up the orientation before we do our first layout. */ | 506 { |
501 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical)) | 507 Lisp_Object rest, children = Qnil; |
502 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = 1; | 508 Lisp_Object border = find_keyword_in_vector (instantiator, Q_border); |
503 | 509 |
510 if (NILP (orient)) | |
511 { | |
512 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL; | |
513 } | |
514 IMAGE_INSTANCE_TYPE (ii) = IMAGE_LAYOUT; | |
515 | |
516 if (EQ (border, Qt)) | |
517 { | |
518 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = Qetched_in; | |
519 } | |
520 else if (GLYPHP (border)) | |
521 { | |
522 /* We are going to be sneaky here and add the border text as | |
523 just another child, the layout and output routines don't know | |
524 this and will just display at the offsets we prescribe. */ | |
525 children = Fcons (glyph_image_instance (border, domain, ERROR_ME, 1), | |
526 children); | |
527 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0); | |
528 } | |
529 else | |
530 { | |
531 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border; | |
532 } | |
533 | |
534 /* Pick up the sub-widgets. */ | |
535 LIST_LOOP (rest, items) | |
536 { | |
537 /* make sure the image is instantiated */ | |
538 Lisp_Object gii = glyph_image_instance (XCAR (rest), domain, ERROR_ME, 1); | |
539 children = Fcons (gii, children); | |
540 /* Make sure elements in the layout are in the order the | |
541 user expected. */ | |
542 children = Fnreverse (children); | |
543 } | |
544 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children; | |
545 } | |
504 /* retrieve the gui item information. This is easy if we have been | 546 /* retrieve the gui item information. This is easy if we have been |
505 provided with a vector, more difficult if we have just been given | 547 provided with a vector, more difficult if we have just been given |
506 keywords */ | 548 keywords */ |
507 if (STRINGP (desc) || NILP (desc)) | 549 else if (STRINGP (desc) || NILP (desc)) |
508 { | 550 { |
509 /* big cheat - we rely on the fact that a gui item looks like an instantiator */ | 551 /* big cheat - we rely on the fact that a gui item looks like an instantiator */ |
510 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = | 552 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = |
511 gui_parse_item_keywords_no_errors (instantiator); | 553 gui_parse_item_keywords_no_errors (instantiator); |
512 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc; | 554 IMAGE_INSTANCE_WIDGET_TEXT (ii) = desc; |
513 } | 555 } |
514 else | 556 else |
515 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = | 557 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = |
516 gui_parse_item_keywords_no_errors (desc); | 558 gui_parse_item_keywords_no_errors (desc); |
517 | 559 |
560 /* Pick up the orientation before we do our first layout. */ | |
561 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical)) | |
562 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = 1; | |
563 | |
518 /* parse more gui items out of the properties */ | 564 /* parse more gui items out of the properties */ |
519 if (!NILP (props)) | 565 if (!NILP (props) |
520 { | 566 && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)) |
521 Lisp_Object items = Fplist_get (props, Q_items, Qnil); | 567 { |
568 if (NILP (items)) | |
569 { | |
570 items = Fplist_get (props, Q_items, Qnil); | |
571 } | |
522 if (!NILP (items)) | 572 if (!NILP (items)) |
523 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = | 573 { |
524 Fcons (IMAGE_INSTANCE_WIDGET_ITEMS (ii), | 574 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = |
525 parse_gui_item_tree_children (items)); | 575 Fcons (IMAGE_INSTANCE_WIDGET_ITEMS (ii), |
576 parse_gui_item_tree_children (items)); | |
577 } | |
526 } | 578 } |
527 | 579 |
528 /* Normalize size information. We now only assign sizes if the user | 580 /* Normalize size information. We now only assign sizes if the user |
529 gives us some explicitly, or there are some constraints that we | 581 gives us some explicitly, or there are some constraints that we |
530 can't change later on. Otherwise we postpone sizing until query | 582 can't change later on. Otherwise we postpone sizing until query |
574 if (!ph) | 626 if (!ph) |
575 ph = glyph_height (glyph, domain) + 2 * WIDGET_BORDER_HEIGHT; | 627 ph = glyph_height (glyph, domain) + 2 * WIDGET_BORDER_HEIGHT; |
576 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; | 628 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; |
577 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; | 629 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; |
578 } | 630 } |
579 | |
580 /* have to set the type this late in case there is no device | |
581 instantiation for a widget */ | |
582 IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET; | |
583 | 631 |
584 /* When we create the widgets the window system expects a valid | 632 /* When we create the widgets the window system expects a valid |
585 size, so If we still don' t have sizes, call layout to pick them | 633 size, so If we still don' t have sizes, call layout to pick them |
586 up. If query_geometry or layout relies on the widget being in | 634 up. If query_geometry or layout relies on the widget being in |
587 existence then we are in catch 22. */ | 635 existence then we are in catch 22. */ |
604 static void | 652 static void |
605 tree_view_query_geometry (Lisp_Object image_instance, | 653 tree_view_query_geometry (Lisp_Object image_instance, |
606 unsigned int* width, unsigned int* height, | 654 unsigned int* width, unsigned int* height, |
607 enum image_instance_geometry disp, Lisp_Object domain) | 655 enum image_instance_geometry disp, Lisp_Object domain) |
608 { | 656 { |
609 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 657 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
610 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); | 658 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); |
611 | 659 |
612 | 660 |
613 if (*width) | 661 if (*width) |
614 { | 662 { |
631 static void | 679 static void |
632 tab_control_query_geometry (Lisp_Object image_instance, | 680 tab_control_query_geometry (Lisp_Object image_instance, |
633 unsigned int* width, unsigned int* height, | 681 unsigned int* width, unsigned int* height, |
634 enum image_instance_geometry disp, Lisp_Object domain) | 682 enum image_instance_geometry disp, Lisp_Object domain) |
635 { | 683 { |
636 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 684 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
637 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); | 685 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); |
638 Lisp_Object rest; | 686 Lisp_Object rest; |
639 unsigned int tw = 0, th = 0; | 687 unsigned int tw = 0, th = 0; |
640 | 688 |
641 LIST_LOOP (rest, items) | 689 LIST_LOOP (rest, items) |
698 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border)); | 746 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border)); |
699 } | 747 } |
700 return inst; | 748 return inst; |
701 } | 749 } |
702 | 750 |
703 /* Instantiate a layout widget. Sizing commentary: we have a number of | 751 /* Layout widget. Sizing commentary: we have a number of problems that |
704 problems that we would like to address. Some consider some of these | 752 we would like to address. Some consider some of these more |
705 more important than others. Currently size information is | 753 important than others. It used to be that size information was |
706 determined at instantiation time and is then fixed forever | 754 determined at instantiation time and was then fixed forever |
707 after. Generally this is not what we want. Users want size to be | 755 after. Generally this is not what we want. Users want size to be |
708 "big enough" to accommodate whatever they are trying to show and | 756 "big enough" to accommodate whatever they are trying to show and |
709 this is dependent on text length, lines, font metrics etc. Of | 757 this is dependent on text length, lines, font metrics etc. Of |
710 course these attributes can change dynamically and so the size | 758 course these attributes can change dynamically and so the size |
711 should changed dynamically also. Only in a few limited cases should | 759 should changed dynamically also. Only in a few limited cases should |
736 whether it can grow or shrink. | 784 whether it can grow or shrink. |
737 | 785 |
738 Text glyphs are particularly troublesome since their metrics depend | 786 Text glyphs are particularly troublesome since their metrics depend |
739 on the context in which they are being viewed. For instance they | 787 on the context in which they are being viewed. For instance they |
740 can appear differently depending on the window face, frame face or | 788 can appear differently depending on the window face, frame face or |
741 glyph face. All other glyphs are essentially fixed in | 789 glyph face. In order to simplify this text glyphs can now only have |
742 appearance. Perhaps the problem is that text glyphs are cached on a | 790 a glyph-face or image-instance face. All other glyphs are |
743 device basis like most other glyphs. Instead they should be cached | 791 essentially fixed in appearance. Perhaps the problem is that text |
744 per-window and then the instance would be fixed and we wouldn't | 792 glyphs are cached on a device basis like most other glyphs. Instead |
745 have to mess around with font metrics and the rest. */ | 793 they should be cached per-window and then the instance would be |
746 static void | 794 fixed and we wouldn't have to mess around with font metrics and the |
747 layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 795 rest. */ |
748 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 796 |
749 int dest_mask, Lisp_Object domain) | 797 /* Query the geometry of a layout widget. We assume that we can only |
750 { | 798 get here if the size is not already fixed. */ |
751 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 799 static void |
752 Lisp_Object rest, device = IMAGE_INSTANCE_DEVICE (ii); | 800 layout_query_geometry (Lisp_Object image_instance, unsigned int* width, |
753 Lisp_Object frame = FW_FRAME (domain); | 801 unsigned int* height, enum image_instance_geometry disp, |
754 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items); | 802 Lisp_Object domain) |
755 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width); | 803 { |
756 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height); | 804 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
757 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation); | 805 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest; |
758 Lisp_Object justify = find_keyword_in_vector (instantiator, Q_justify); | 806 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; |
759 Lisp_Object border = find_keyword_in_vector (instantiator, Q_border); | 807 |
760 Lisp_Object children = Qnil; | 808 /* Flip through the items to work out how much stuff we have to display */ |
761 int pw = 0, ph = 0, x, y, maxph = 0, maxpw = 0, nitems = 0, | 809 LIST_LOOP (rest, items) |
810 { | |
811 Lisp_Object glyph = XCAR (rest); | |
812 unsigned int gheight, gwidth; | |
813 | |
814 image_instance_query_geometry (glyph, &gwidth, &gheight, disp, domain); | |
815 | |
816 /* Pick up the border text if we have one. */ | |
817 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) | |
818 && NILP (XCDR (rest))) | |
819 { | |
820 ph_adjust = gheight / 2; | |
821 } | |
822 else | |
823 { | |
824 | |
825 nitems ++; | |
826 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) | |
827 == LAYOUT_HORIZONTAL) | |
828 { | |
829 maxph = max (maxph, gheight); | |
830 maxpw += gwidth; | |
831 } | |
832 else | |
833 { | |
834 maxpw = max (maxpw, gwidth); | |
835 maxph += gheight; | |
836 } | |
837 } | |
838 } | |
839 | |
840 /* work out spacing between items and bounds of the layout. No user | |
841 provided width so we just do default spacing. */ | |
842 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) | |
843 == LAYOUT_HORIZONTAL) | |
844 *width = maxpw + (nitems + 1) * WIDGET_BORDER_WIDTH * 2; | |
845 else | |
846 *width = maxpw + 2 * WIDGET_BORDER_WIDTH * 2; | |
847 | |
848 /* Work out vertical spacings. */ | |
849 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) | |
850 == LAYOUT_VERTICAL) | |
851 *height = maxph + (nitems + 1) * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; | |
852 else | |
853 *height = maxph + 2 * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; | |
854 } | |
855 | |
856 | |
857 static void | |
858 layout_layout (Lisp_Object image_instance, | |
859 unsigned int width, unsigned int height, Lisp_Object domain) | |
860 { | |
861 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | |
862 Lisp_Object rest; | |
863 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii); | |
864 int x, y, maxph = 0, maxpw = 0, nitems = 0, | |
762 horiz_spacing, vert_spacing, ph_adjust = 0; | 865 horiz_spacing, vert_spacing, ph_adjust = 0; |
763 | 866 unsigned int gheight, gwidth; |
764 if (NILP (frame)) | |
765 signal_simple_error ("No selected frame", device); | |
766 | |
767 if (!(dest_mask & IMAGE_LAYOUT_MASK)) | |
768 incompatible_image_types (instantiator, dest_mask, IMAGE_LAYOUT_MASK); | |
769 | |
770 if (NILP (orient)) | |
771 orient = Qvertical; | |
772 | |
773 if (EQ (border, Qt)) | |
774 border = Qetched_in; | |
775 | |
776 ii->data = 0; | |
777 IMAGE_INSTANCE_TYPE (ii) = IMAGE_LAYOUT; | |
778 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0; | |
779 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; | |
780 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii) = frame; | |
781 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border; | |
782 | |
783 /* normalize size information */ | |
784 if (!NILP (width)) | |
785 pw = XINT (width); | |
786 if (!NILP (height)) | |
787 ph = XINT (height); | |
788 | 867 |
789 /* flip through the items to work out how much stuff we have to display */ | 868 /* flip through the items to work out how much stuff we have to display */ |
790 LIST_LOOP (rest, items) | 869 LIST_LOOP (rest, items) |
791 { | 870 { |
792 Lisp_Object glyph = XCAR (rest); | 871 Lisp_Object glyph = XCAR (rest); |
793 int gheight = glyph_height (glyph, domain); | 872 |
794 int gwidth = glyph_width (glyph, domain); | 873 image_instance_query_geometry (glyph, &gwidth, &gheight, |
795 nitems ++; | 874 IMAGE_DESIRED_GEOMETRY, domain); |
796 if (EQ (orient, Qhorizontal)) | 875 |
797 { | 876 /* Pick up the border text if we have one. */ |
798 maxph = max (maxph, gheight); | 877 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) |
799 maxpw += gwidth; | 878 && NILP (XCDR (rest))) |
800 } | 879 { |
801 else if (EQ (orient, Qvertical)) | 880 XIMAGE_INSTANCE_XOFFSET (glyph) = 10; /* Really, what should this be? */ |
802 { | 881 XIMAGE_INSTANCE_YOFFSET (glyph) = 0; |
803 maxpw = max (maxpw, gwidth); | 882 ph_adjust = gheight / 2; |
804 maxph += gheight; | 883 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust); |
884 } | |
885 else | |
886 { | |
887 | |
888 nitems ++; | |
889 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) | |
890 == LAYOUT_HORIZONTAL) | |
891 { | |
892 maxph = max (maxph, gheight); | |
893 maxpw += gwidth; | |
894 } | |
895 else | |
896 { | |
897 maxpw = max (maxpw, gwidth); | |
898 maxph += gheight; | |
899 } | |
805 } | 900 } |
806 } | 901 } |
807 | 902 |
808 /* work out spacing between items and bounds of the layout */ | 903 /* work out spacing between items and bounds of the layout */ |
809 if (!pw) | 904 if (width < maxpw) |
810 { | |
811 /* No user provided width so we just do default spacing. */ | |
812 horiz_spacing = WIDGET_BORDER_WIDTH * 2; | |
813 if (EQ (orient, Qhorizontal)) | |
814 pw = maxpw + (nitems + 1) * horiz_spacing; | |
815 else | |
816 pw = maxpw + 2 * horiz_spacing; | |
817 } | |
818 else if (pw < maxpw) | |
819 /* The user wants a smaller space than the largest item, so we | 905 /* The user wants a smaller space than the largest item, so we |
820 just provide default spacing and will let the output routines | 906 just provide default spacing and will let the output routines |
821 clip.. */ | 907 clip.. */ |
822 horiz_spacing = WIDGET_BORDER_WIDTH * 2; | 908 horiz_spacing = WIDGET_BORDER_WIDTH * 2; |
823 else if (EQ (orient, Qhorizontal)) | 909 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) |
910 == LAYOUT_HORIZONTAL) | |
824 /* We have a larger area to display in so distribute the space | 911 /* We have a larger area to display in so distribute the space |
825 evenly. */ | 912 evenly. */ |
826 horiz_spacing = (pw - maxpw) / (nitems + 1); | 913 horiz_spacing = (width - maxpw) / (nitems + 1); |
827 else | 914 else |
828 horiz_spacing = (pw - maxpw) / 2; | 915 horiz_spacing = (width - maxpw) / 2; |
829 | 916 |
830 /* Do the border now so that we can adjust the layout. */ | 917 if (height < maxph) |
831 if (GLYPHP (border)) | |
832 { | |
833 /* We are going to be sneaky here and add the border text as | |
834 just another child, the layout and output routines don't know | |
835 this and will just display at the offsets we prescribe. */ | |
836 Lisp_Object bglyph = glyph_image_instance (border, domain, ERROR_ME, 1); | |
837 | |
838 children = Fcons (bglyph, children); | |
839 XIMAGE_INSTANCE_XOFFSET (bglyph) = 10; /* Really, what should this be? */ | |
840 XIMAGE_INSTANCE_YOFFSET (bglyph) = 0; | |
841 | |
842 ph_adjust = (glyph_height (border, domain) / 2); | |
843 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust); | |
844 } | |
845 | |
846 /* Work out vertical spacings. */ | |
847 if (!ph) | |
848 { | |
849 vert_spacing = WIDGET_BORDER_HEIGHT * 2; | |
850 if (EQ (orient, Qvertical)) | |
851 ph = maxph + (nitems + 1) * vert_spacing + ph_adjust; | |
852 else | |
853 ph = maxph + 2 * vert_spacing + ph_adjust; | |
854 } | |
855 else if (ph < maxph) | |
856 vert_spacing = WIDGET_BORDER_HEIGHT * 2; | 918 vert_spacing = WIDGET_BORDER_HEIGHT * 2; |
857 else if (EQ (orient, Qvertical)) | 919 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) |
858 vert_spacing = (ph - (maxph + ph_adjust)) / (nitems + 1); | 920 == LAYOUT_VERTICAL) |
921 vert_spacing = (height - (maxph + ph_adjust)) / (nitems + 1); | |
859 else | 922 else |
860 vert_spacing = (ph - (maxph + ph_adjust)) / 2; | 923 vert_spacing = (height - (maxph + ph_adjust)) / 2; |
861 | 924 |
862 y = vert_spacing + ph_adjust; | 925 y = vert_spacing + ph_adjust; |
863 x = horiz_spacing; | 926 x = horiz_spacing; |
864 | 927 |
865 /* Now flip through putting items where we want them, paying | 928 /* Now flip through putting items where we want them, paying |
866 attention to justification. */ | 929 attention to justification. Make sure we don't mess with the |
930 border glyph. */ | |
867 LIST_LOOP (rest, items) | 931 LIST_LOOP (rest, items) |
868 { | 932 { |
869 /* make sure the image is instantiated */ | |
870 Lisp_Object glyph = XCAR (rest); | 933 Lisp_Object glyph = XCAR (rest); |
871 Lisp_Object gii = glyph_image_instance (glyph, domain, ERROR_ME, 1); | 934 |
872 int gwidth = glyph_width (glyph, domain); | 935 image_instance_query_geometry (glyph, &gwidth, &gheight, |
873 int gheight = glyph_height (glyph, domain); | 936 IMAGE_DESIRED_GEOMETRY, domain); |
874 | 937 |
875 children = Fcons (gii, children); | 938 if (!INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) |
876 | 939 || !NILP (XCDR (rest))) |
877 if (EQ (orient, Qhorizontal)) | 940 { |
878 { | 941 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) |
879 if (EQ (justify, Qright)) | 942 == LAYOUT_HORIZONTAL) |
880 y = ph - (gheight + vert_spacing); | 943 { |
881 else if (EQ (justify, Qcenter)) | 944 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) |
882 y = (ph - gheight) / 2; | 945 == LAYOUT_JUSTIFY_RIGHT) |
883 } | 946 y = height - (gheight + vert_spacing); |
884 else if (EQ (orient, Qvertical)) | 947 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) |
885 { | 948 == LAYOUT_JUSTIFY_CENTER) |
886 if (EQ (justify, Qright)) | 949 y = (height - gheight) / 2; |
887 x = pw - (gwidth + horiz_spacing); | 950 } |
888 else if (EQ (justify, Qcenter)) | 951 else |
889 x = (pw - gwidth) / 2; | 952 { |
890 } | 953 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) |
891 | 954 == LAYOUT_JUSTIFY_RIGHT) |
892 XIMAGE_INSTANCE_XOFFSET (gii) = x; | 955 x = width - (gwidth + horiz_spacing); |
893 XIMAGE_INSTANCE_YOFFSET (gii) = y; | 956 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) |
894 | 957 == LAYOUT_JUSTIFY_CENTER) |
895 if (EQ (orient, Qhorizontal)) | 958 x = (width - gwidth) / 2; |
896 { | 959 } |
897 x += (gwidth + horiz_spacing); | 960 |
898 } | 961 XIMAGE_INSTANCE_XOFFSET (glyph) = x; |
899 else if (EQ (orient, Qvertical)) | 962 XIMAGE_INSTANCE_YOFFSET (glyph) = y; |
900 { | 963 |
901 y += (gheight + vert_spacing); | 964 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) |
902 } | 965 == LAYOUT_HORIZONTAL) |
903 } | 966 { |
904 | 967 x += (gwidth + horiz_spacing); |
905 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children; | 968 } |
906 assert (pw && ph); | 969 else |
907 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = pw; | 970 { |
908 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = ph; | 971 y += (gheight + vert_spacing); |
972 } | |
973 } | |
974 | |
975 /* Now layout subwidgets if they require it. */ | |
976 image_instance_layout (glyph, gwidth, gheight, domain); | |
977 } | |
978 | |
979 IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = width; | |
980 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = height; | |
909 } | 981 } |
910 | 982 |
911 | 983 |
912 /************************************************************************/ | 984 /************************************************************************/ |
913 /* initialization */ | 985 /* initialization */ |
932 defsymbol (&Qetched_out, "etched-out"); | 1004 defsymbol (&Qetched_out, "etched-out"); |
933 defsymbol (&Qbevel_in, "bevel-in"); | 1005 defsymbol (&Qbevel_in, "bevel-in"); |
934 defsymbol (&Qbevel_out, "bevel-out"); | 1006 defsymbol (&Qbevel_out, "bevel-out"); |
935 } | 1007 } |
936 | 1008 |
937 void | 1009 #define VALID_GUI_KEYWORDS(type) do { \ |
938 image_instantiator_format_create_glyphs_widget (void) | 1010 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \ |
939 { | 1011 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \ |
940 #define VALID_GUI_KEYWORDS(type) \ | 1012 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \ |
941 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \ | 1013 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \ |
942 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \ | 1014 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_selected, check_valid_anything); \ |
943 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \ | 1015 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \ |
944 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \ | 1016 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \ |
945 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_selected, check_valid_anything); \ | 1017 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \ |
946 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \ | 1018 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \ |
947 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \ | 1019 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \ |
948 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \ | 1020 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \ |
949 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \ | 1021 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \ |
950 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \ | 1022 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector); \ |
951 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \ | 1023 } while (0) |
952 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \ | 1024 |
953 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector) | 1025 #define VALID_WIDGET_KEYWORDS(type) do { \ |
954 | |
955 #define VALID_WIDGET_KEYWORDS(type) \ | |
956 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \ | 1026 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \ |
957 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \ | 1027 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \ |
958 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \ | 1028 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \ |
959 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int); \ | 1029 IIFORMAT_VALID_KEYWORD (type, Q_pixel_height, check_valid_int); \ |
960 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face) | 1030 IIFORMAT_VALID_KEYWORD (type, Q_face, check_valid_face); \ |
961 | 1031 } while (0) |
962 /* we only do this for properties */ | 1032 |
1033 | |
1034 static void image_instantiator_widget (void) | |
1035 { /* we only do this for properties */ | |
963 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget"); | 1036 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM (widget, "widget"); |
964 IIFORMAT_HAS_METHOD (widget, property); | 1037 IIFORMAT_HAS_METHOD (widget, property); |
965 IIFORMAT_HAS_METHOD (widget, set_property); | 1038 IIFORMAT_HAS_METHOD (widget, set_property); |
966 IIFORMAT_HAS_METHOD (widget, query_geometry); | 1039 IIFORMAT_HAS_METHOD (widget, query_geometry); |
967 IIFORMAT_HAS_METHOD (widget, layout); | 1040 IIFORMAT_HAS_METHOD (widget, layout); |
968 | 1041 } |
969 /* widget image-instantiator types - buttons */ | 1042 |
1043 static void image_instantiator_buttons (void) | |
1044 { | |
970 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button"); | 1045 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button"); |
971 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget); | 1046 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget); |
972 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget); | 1047 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget); |
973 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget); | 1048 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget); |
974 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget); | 1049 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget); |
975 IIFORMAT_VALID_KEYWORD (button, | 1050 IIFORMAT_VALID_KEYWORD (button, |
976 Q_image, check_valid_glyph_or_instantiator); | 1051 Q_image, check_valid_glyph_or_instantiator); |
977 VALID_WIDGET_KEYWORDS (button); | 1052 VALID_WIDGET_KEYWORDS (button); |
978 VALID_GUI_KEYWORDS (button); | 1053 VALID_GUI_KEYWORDS (button); |
979 | 1054 } |
980 /* edit fields */ | 1055 |
1056 static void image_instantiator_edit_fields (void) | |
1057 { | |
981 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field"); | 1058 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field"); |
982 IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget); | 1059 IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget); |
983 IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget); | 1060 IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget); |
984 IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget); | 1061 IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget); |
985 VALID_WIDGET_KEYWORDS (edit_field); | 1062 VALID_WIDGET_KEYWORDS (edit_field); |
986 VALID_GUI_KEYWORDS (edit_field); | 1063 VALID_GUI_KEYWORDS (edit_field); |
987 | 1064 } |
988 /* combo box */ | 1065 |
1066 static void image_instantiator_combo_box (void) | |
1067 { | |
989 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box"); | 1068 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box"); |
990 IIFORMAT_HAS_METHOD (combo_box, validate); | 1069 IIFORMAT_HAS_METHOD (combo_box, validate); |
991 IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget); | 1070 IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget); |
992 VALID_GUI_KEYWORDS (combo_box); | 1071 VALID_GUI_KEYWORDS (combo_box); |
993 | 1072 |
994 IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int); | 1073 IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int); |
995 IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int); | 1074 IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int); |
996 IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int); | 1075 IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int); |
997 IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face); | 1076 IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face); |
998 IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list); | 1077 IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list); |
999 | 1078 } |
1000 /* scrollbar */ | 1079 |
1080 static void image_instantiator_scrollbar (void) | |
1081 { | |
1001 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar"); | 1082 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar"); |
1002 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget); | 1083 IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget); |
1003 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget); | 1084 IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget); |
1004 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget); | 1085 IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget); |
1005 VALID_GUI_KEYWORDS (scrollbar); | 1086 VALID_GUI_KEYWORDS (scrollbar); |
1006 | 1087 |
1007 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int); | 1088 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int); |
1008 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int); | 1089 IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_height, check_valid_int); |
1009 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face); | 1090 IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face); |
1010 | 1091 } |
1011 /* progress guage */ | 1092 |
1093 static void image_instantiator_progress_guage (void) | |
1094 { | |
1012 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge"); | 1095 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge"); |
1013 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget); | 1096 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget); |
1014 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget); | 1097 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget); |
1015 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget); | 1098 IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget); |
1016 VALID_WIDGET_KEYWORDS (progress_gauge); | 1099 VALID_WIDGET_KEYWORDS (progress_gauge); |
1017 VALID_GUI_KEYWORDS (progress_gauge); | 1100 VALID_GUI_KEYWORDS (progress_gauge); |
1018 | 1101 } |
1019 /* tree view */ | 1102 |
1103 static void image_instantiator_tree_view (void) | |
1104 { | |
1020 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view"); | 1105 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view"); |
1021 IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box); | 1106 IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box); |
1022 IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget); | 1107 IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget); |
1023 IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, widget); | 1108 IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, widget); |
1024 IIFORMAT_HAS_METHOD (tree_view, query_geometry); | 1109 IIFORMAT_HAS_METHOD (tree_view, query_geometry); |
1025 VALID_WIDGET_KEYWORDS (tree_view); | 1110 VALID_WIDGET_KEYWORDS (tree_view); |
1026 VALID_GUI_KEYWORDS (tree_view); | 1111 VALID_GUI_KEYWORDS (tree_view); |
1027 IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list); | 1112 IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list); |
1028 | 1113 } |
1029 /* tab control */ | 1114 |
1115 static void image_instantiator_tab_control (void) | |
1116 { | |
1030 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control"); | 1117 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control"); |
1031 IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box); | 1118 IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box); |
1032 IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget); | 1119 IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget); |
1033 IIFORMAT_HAS_SHARED_METHOD (tab_control, instantiate, widget); | 1120 IIFORMAT_HAS_SHARED_METHOD (tab_control, instantiate, widget); |
1034 IIFORMAT_HAS_METHOD (tab_control, query_geometry); | 1121 IIFORMAT_HAS_METHOD (tab_control, query_geometry); |
1035 VALID_WIDGET_KEYWORDS (tab_control); | 1122 VALID_WIDGET_KEYWORDS (tab_control); |
1036 VALID_GUI_KEYWORDS (tab_control); | 1123 VALID_GUI_KEYWORDS (tab_control); |
1037 IIFORMAT_VALID_KEYWORD (tab_control, Q_orientation, check_valid_tab_orientation); | 1124 IIFORMAT_VALID_KEYWORD (tab_control, Q_orientation, check_valid_tab_orientation); |
1038 IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list); | 1125 IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list); |
1039 | 1126 } |
1040 /* labels */ | 1127 |
1128 static void image_instantiator_labels (void) | |
1129 { | |
1041 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label"); | 1130 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label"); |
1042 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget); | 1131 IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget); |
1043 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, widget); | 1132 IIFORMAT_HAS_SHARED_METHOD (label, instantiate, widget); |
1044 VALID_WIDGET_KEYWORDS (label); | 1133 VALID_WIDGET_KEYWORDS (label); |
1045 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string); | 1134 IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string); |
1046 | 1135 } |
1047 /* layout */ | 1136 |
1137 static void image_instantiator_layout (void) | |
1138 { | |
1048 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout"); | 1139 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout"); |
1049 IIFORMAT_HAS_METHOD (layout, possible_dest_types); | 1140 IIFORMAT_HAS_METHOD (layout, possible_dest_types); |
1050 IIFORMAT_HAS_METHOD (layout, instantiate); | 1141 IIFORMAT_HAS_SHARED_METHOD (layout, instantiate, widget); |
1051 IIFORMAT_HAS_METHOD (layout, normalize); | 1142 IIFORMAT_HAS_METHOD (layout, normalize); |
1143 IIFORMAT_HAS_METHOD (layout, query_geometry); | |
1144 IIFORMAT_HAS_METHOD (layout, layout); | |
1052 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_width, check_valid_int); | 1145 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_width, check_valid_int); |
1053 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_height, check_valid_int); | 1146 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_height, check_valid_int); |
1054 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); | 1147 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); |
1055 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); | 1148 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); |
1056 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); | 1149 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); |
1057 IIFORMAT_VALID_KEYWORD (layout, Q_items, | 1150 IIFORMAT_VALID_KEYWORD (layout, Q_items, |
1058 check_valid_glyph_or_instantiator_list); | 1151 check_valid_glyph_or_instantiator_list); |
1152 } | |
1153 | |
1154 void | |
1155 image_instantiator_format_create_glyphs_widget (void) | |
1156 { | |
1157 image_instantiator_widget(); | |
1158 image_instantiator_buttons(); | |
1159 image_instantiator_edit_fields(); | |
1160 image_instantiator_combo_box(); | |
1161 image_instantiator_scrollbar(); | |
1162 image_instantiator_progress_guage(); | |
1163 image_instantiator_tree_view(); | |
1164 image_instantiator_tab_control(); | |
1165 image_instantiator_labels(); | |
1166 image_instantiator_layout(); | |
1059 } | 1167 } |
1060 | 1168 |
1061 void | 1169 void |
1062 reinit_vars_of_glyphs_widget (void) | 1170 reinit_vars_of_glyphs_widget (void) |
1063 { | 1171 { |