comparison src/glyphs-widget.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 2f8bb876ab1d
children 501cfd01ee6d
comparison
equal deleted inserted replaced
405:0e08f63c74d2 406:b8cc9ab3f761
55 Lisp_Object Qtab_control; 55 Lisp_Object Qtab_control;
56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout); 56 DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout);
57 Lisp_Object Qlayout; 57 Lisp_Object Qlayout;
58 58
59 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items; 59 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
60 Lisp_Object Q_image, Q_text, Q_percent, Q_orientation, Q_justify, Q_border; 60 Lisp_Object Q_image, Q_text, Q_orientation, Q_justify, Q_border;
61 Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out; 61 Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
62 Lisp_Object Vwidget_callback_current_channel;
63 Lisp_Object Qwidget_callback_current_channel;
62 64
63 #ifdef DEBUG_WIDGETS 65 #ifdef DEBUG_WIDGETS
64 int debug_widget_instances; 66 int debug_widget_instances;
65 #endif 67 #endif
66 68
354 /* Device-format specific methods */ 356 /* Device-format specific methods */
355 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), 357 meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii),
356 IMAGE_INSTANCE_WIDGET_TYPE (ii), 358 IMAGE_INSTANCE_WIDGET_TYPE (ii),
357 ERROR_ME_NOT); 359 ERROR_ME_NOT);
358 MAYBE_IIFORMAT_METH (meths, update, (widget)); 360 MAYBE_IIFORMAT_METH (meths, update, (widget));
361
362 /* Pick up the items we recorded earlier. */
363 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
364 {
365 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
366 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii);
367 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
368 }
359 } 369 }
360 370
361 /* Query for a widgets desired geometry. If no type specific method is 371 /* Query for a widgets desired geometry. If no type specific method is
362 provided then use the widget text to calculate sizes. */ 372 provided then use the widget text to calculate sizes. */
363 static void 373 static void
509 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil; 519 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
510 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = Qnil; 520 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = Qnil;
511 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = Qnil; 521 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = Qnil;
512 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 1; 522 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 1;
513 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 1; 523 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 1;
514 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = 0; 524 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_HORIZONTAL;
515 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) = 0; 525 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) = 0;
516 } 526 }
517 527
518 /* Instantiate a button widget. Unfortunately instantiated widgets are 528 /* Instantiate a button widget. Unfortunately instantiated widgets are
519 particular to a frame since they need to have a parent. It's not 529 particular to a frame since they need to have a parent. It's not
595 /* make sure the image is instantiated */ 605 /* make sure the image is instantiated */
596 Lisp_Object gii = glyph_image_instance (XCAR (rest), domain, ERROR_ME, 1); 606 Lisp_Object gii = glyph_image_instance (XCAR (rest), domain, ERROR_ME, 1);
597 /* make sure we are designated as the parent. */ 607 /* make sure we are designated as the parent. */
598 XIMAGE_INSTANCE_PARENT (gii) = image_instance; 608 XIMAGE_INSTANCE_PARENT (gii) = image_instance;
599 children = Fcons (gii, children); 609 children = Fcons (gii, children);
600 /* Make sure elements in the layout are in the order the 610 }
601 user expected. */ 611 /* Make sure elements in the layout are in the order the
602 children = Fnreverse (children); 612 user expected. */
603 } 613 children = Fnreverse (children);
604 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children; 614 IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children;
605 } 615 }
606 /* retrieve the gui item information. This is easy if we have been 616 /* retrieve the gui item information. This is easy if we have been
607 provided with a vector, more difficult if we have just been given 617 provided with a vector, more difficult if we have just been given
608 keywords */ 618 keywords */
617 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = 627 IMAGE_INSTANCE_WIDGET_ITEMS (ii) =
618 gui_parse_item_keywords_no_errors (desc); 628 gui_parse_item_keywords_no_errors (desc);
619 629
620 /* Pick up the orientation before we do our first layout. */ 630 /* Pick up the orientation before we do our first layout. */
621 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical)) 631 if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical))
622 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = 1; 632 IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL;
623 633
624 /* parse more gui items out of the properties */ 634 /* parse more gui items out of the properties */
625 if (!NILP (props) 635 if (!NILP (props)
626 && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)) 636 && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout))
627 { 637 {
657 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; 667 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
658 } 668 }
659 669
660 if (!NILP (pixheight)) 670 if (!NILP (pixheight))
661 { 671 {
662 if (!INTP (pixwidth)) 672 if (!INTP (pixheight))
663 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight; 673 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = pixheight;
664 else 674 else
665 { 675 {
666 ph = XINT (pixheight); 676 ph = XINT (pixheight);
667 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; 677 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
712 debug_widget_instances++; 722 debug_widget_instances++;
713 stderr_out ("instantiated "); 723 stderr_out ("instantiated ");
714 debug_print (instantiator); 724 debug_print (instantiator);
715 stderr_out ("%d widgets instantiated\n", debug_widget_instances); 725 stderr_out ("%d widgets instantiated\n", debug_widget_instances);
716 #endif 726 #endif
727 }
728
729 /* Get the geometry of a button control. We need to adjust the size
730 depending on the type of button. */
731 static void
732 button_query_geometry (Lisp_Object image_instance,
733 unsigned int* width, unsigned int* height,
734 enum image_instance_geometry disp, Lisp_Object domain)
735 {
736 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
737 unsigned int w, h;
738 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
739 IMAGE_INSTANCE_WIDGET_FACE (ii),
740 &w, &h, 0, domain);
741 /* Adjust the size for borders. */
742 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
743 {
744 *width = w + 2 * WIDGET_BORDER_WIDTH;
745
746 if (EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qradio)
747 ||
748 EQ (XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (ii))->style, Qtoggle))
749 /* This is an approximation to the size of the actual button bit. */
750 *width += 12;
751 }
752 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii))
753 *height = h + 2 * WIDGET_BORDER_HEIGHT;
717 } 754 }
718 755
719 /* tree-view geometry - get the height right */ 756 /* tree-view geometry - get the height right */
720 static void 757 static void
721 tree_view_query_geometry (Lisp_Object image_instance, 758 tree_view_query_geometry (Lisp_Object image_instance,
814 Lisp_Object prop, 851 Lisp_Object prop,
815 Lisp_Object val) 852 Lisp_Object val)
816 { 853 {
817 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 854 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
818 855
819 if (EQ (prop, Q_percent)) 856 if (EQ (prop, Q_value))
820 { 857 {
821 CHECK_INT (val); 858 CHECK_INT (val);
822 IMAGE_INSTANCE_WIDGET_PROPS (ii) 859 #ifdef DEBUG_WIDGET_OUTPUT
823 = Fplist_put (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, val); 860 printf ("progress gauge value set to %ld\n", XINT (val));
824 IMAGE_INSTANCE_WIDGET_PERCENT_CHANGED (ii) = 1; 861 #endif
862 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) =
863 copy_gui_item_tree (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
864 #ifdef ERROR_CHECK_GLYPHS
865 assert (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)));
866 #endif
867 if (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
868 XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))->value = val;
869
870 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 1;
825 871
826 return Qt; 872 return Qt;
827 } 873 }
828 return Qunbound; 874 return Qunbound;
829 } 875 }
919 Lisp_Object domain) 965 Lisp_Object domain)
920 { 966 {
921 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); 967 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
922 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest; 968 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest;
923 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; 969 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0;
924 970 unsigned int gheight, gwidth;
971
972 /* First just set up what we already have. */
973 if (width) *width = IMAGE_INSTANCE_WIDTH (ii);
974 if (height) *height = IMAGE_INSTANCE_HEIGHT (ii);
975
976 /* If we are not allowed to dynamically size then return. */
977 if (!IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)
978 &&
979 !IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii))
980 return;
981
982 /* Pick up the border text if we have one. */
983 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
984 {
985 image_instance_query_geometry (XCAR (items), &gwidth, &gheight, disp, domain);
986 ph_adjust = gheight / 2;
987 items = XCDR (items);
988 }
989
925 /* Flip through the items to work out how much stuff we have to display */ 990 /* Flip through the items to work out how much stuff we have to display */
926 LIST_LOOP (rest, items) 991 LIST_LOOP (rest, items)
927 { 992 {
928 Lisp_Object glyph = XCAR (rest); 993 Lisp_Object glyph = XCAR (rest);
929 unsigned int gheight, gwidth;
930
931 image_instance_query_geometry (glyph, &gwidth, &gheight, disp, domain); 994 image_instance_query_geometry (glyph, &gwidth, &gheight, disp, domain);
932 995
933 /* Pick up the border text if we have one. */ 996 nitems ++;
934 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) 997 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
935 && NILP (XCDR (rest))) 998 == LAYOUT_HORIZONTAL)
936 { 999 {
937 ph_adjust = gheight / 2; 1000 maxph = max (maxph, gheight);
1001 maxpw += gwidth;
938 } 1002 }
939 else 1003 else
940 { 1004 {
941 1005 maxpw = max (maxpw, gwidth);
942 nitems ++; 1006 maxph += gheight;
943 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) 1007 }
944 == LAYOUT_HORIZONTAL) 1008 }
945 { 1009
946 maxph = max (maxph, gheight); 1010 /* Work out minimum space we need to fit all the items. This could
947 maxpw += gwidth; 1011 have been fixed by the user. */
948 } 1012 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
949 else 1013 {
950 { 1014 Lisp_Object dynamic_width =
951 maxpw = max (maxpw, gwidth); 1015 Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
952 maxph += gheight; 1016 if (INTP (dynamic_width))
953 } 1017 *width = XINT (dynamic_width);
954 } 1018 }
955 } 1019 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
956 1020 == LAYOUT_HORIZONTAL)
957 /* work out spacing between items and bounds of the layout. No user
958 provided width so we just do default spacing. */
959 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
960 == LAYOUT_HORIZONTAL)
961 *width = maxpw + (nitems + 1) * WIDGET_BORDER_WIDTH * 2; 1021 *width = maxpw + (nitems + 1) * WIDGET_BORDER_WIDTH * 2;
962 else 1022 else
963 *width = maxpw + 2 * WIDGET_BORDER_WIDTH * 2; 1023 *width = maxpw + 2 * WIDGET_BORDER_WIDTH * 2;
964 1024
965 /* Work out vertical spacings. */ 1025 /* Work out vertical spacings. */
966 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) 1026 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
967 == LAYOUT_VERTICAL) 1027 {
1028 Lisp_Object dynamic_height =
1029 Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
1030 if (INTP (dynamic_height))
1031 *height = XINT (dynamic_height);
1032 }
1033 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
1034 == LAYOUT_VERTICAL)
968 *height = maxph + (nitems + 1) * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; 1035 *height = maxph + (nitems + 1) * WIDGET_BORDER_HEIGHT * 2 + ph_adjust;
969 else 1036 else
970 *height = maxph + 2 * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; 1037 *height = maxph + 2 * WIDGET_BORDER_HEIGHT * 2 + ph_adjust;
971 } 1038 }
972
973 1039
974 static void 1040 static void
975 layout_layout (Lisp_Object image_instance, 1041 layout_layout (Lisp_Object image_instance,
976 unsigned int width, unsigned int height, Lisp_Object domain) 1042 unsigned int width, unsigned int height, Lisp_Object domain)
977 { 1043 {
979 Lisp_Object rest; 1045 Lisp_Object rest;
980 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii); 1046 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii);
981 int x, y, maxph = 0, maxpw = 0, nitems = 0, 1047 int x, y, maxph = 0, maxpw = 0, nitems = 0,
982 horiz_spacing, vert_spacing, ph_adjust = 0; 1048 horiz_spacing, vert_spacing, ph_adjust = 0;
983 unsigned int gheight, gwidth; 1049 unsigned int gheight, gwidth;
984 1050
985 /* flip through the items to work out how much stuff we have to display */ 1051 /* Pick up the border text if we have one. */
1052 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)))
1053 {
1054 Lisp_Object border = XCAR (items);
1055 items = XCDR (items);
1056 image_instance_query_geometry (border, &gwidth, &gheight,
1057 IMAGE_DESIRED_GEOMETRY, domain);
1058 /* #### Really, what should this be? */
1059 XIMAGE_INSTANCE_XOFFSET (border) = 10;
1060 XIMAGE_INSTANCE_YOFFSET (border) = 0;
1061 ph_adjust = gheight / 2;
1062 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust);
1063
1064 image_instance_layout (border, gwidth, gheight, domain);
1065 }
1066
1067 /* Flip through the items to work out how much stuff we have to display. */
986 LIST_LOOP (rest, items) 1068 LIST_LOOP (rest, items)
987 { 1069 {
988 Lisp_Object glyph = XCAR (rest); 1070 Lisp_Object glyph = XCAR (rest);
989 1071
990 image_instance_query_geometry (glyph, &gwidth, &gheight, 1072 image_instance_query_geometry (glyph, &gwidth, &gheight,
991 IMAGE_DESIRED_GEOMETRY, domain); 1073 IMAGE_DESIRED_GEOMETRY, domain);
992 1074 nitems ++;
993 /* Pick up the border text if we have one. */ 1075 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
994 if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) 1076 == LAYOUT_HORIZONTAL)
995 && NILP (XCDR (rest))) 1077 {
996 { 1078 maxph = max (maxph, gheight);
997 XIMAGE_INSTANCE_XOFFSET (glyph) = 10; /* Really, what should this be? */ 1079 maxpw += gwidth;
998 XIMAGE_INSTANCE_YOFFSET (glyph) = 0;
999 ph_adjust = gheight / 2;
1000 IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (ph_adjust);
1001 } 1080 }
1002 else 1081 else
1003 { 1082 {
1004 nitems ++; 1083 maxpw = max (maxpw, gwidth);
1005 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) 1084 maxph += gheight;
1006 == LAYOUT_HORIZONTAL)
1007 {
1008 maxph = max (maxph, gheight);
1009 maxpw += gwidth;
1010 }
1011 else
1012 {
1013 maxpw = max (maxpw, gwidth);
1014 maxph += gheight;
1015 }
1016 } 1085 }
1017 } 1086 }
1018 1087
1019 /* work out spacing between items and bounds of the layout */ 1088 /* work out spacing between items and bounds of the layout */
1020 if (width < maxpw) 1089 if (width < maxpw)
1049 Lisp_Object glyph = XCAR (rest); 1118 Lisp_Object glyph = XCAR (rest);
1050 1119
1051 image_instance_query_geometry (glyph, &gwidth, &gheight, 1120 image_instance_query_geometry (glyph, &gwidth, &gheight,
1052 IMAGE_DESIRED_GEOMETRY, domain); 1121 IMAGE_DESIRED_GEOMETRY, domain);
1053 1122
1054 if (!INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) 1123 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
1055 || !NILP (XCDR (rest))) 1124 == LAYOUT_HORIZONTAL)
1056 { 1125 {
1057 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) 1126 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
1058 == LAYOUT_HORIZONTAL) 1127 == LAYOUT_JUSTIFY_RIGHT)
1059 { 1128 y = height - (gheight + vert_spacing);
1060 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) 1129 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
1061 == LAYOUT_JUSTIFY_RIGHT) 1130 == LAYOUT_JUSTIFY_CENTER)
1062 y = height - (gheight + vert_spacing); 1131 y = (height - gheight) / 2;
1063 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) 1132 }
1064 == LAYOUT_JUSTIFY_CENTER) 1133 else
1065 y = (height - gheight) / 2; 1134 {
1066 } 1135 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
1067 else 1136 == LAYOUT_JUSTIFY_RIGHT)
1068 { 1137 x = width - (gwidth + horiz_spacing);
1069 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) 1138 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii)
1070 == LAYOUT_JUSTIFY_RIGHT) 1139 == LAYOUT_JUSTIFY_CENTER)
1071 x = width - (gwidth + horiz_spacing); 1140 x = (width - gwidth) / 2;
1072 if (IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (ii) 1141 }
1073 == LAYOUT_JUSTIFY_CENTER)
1074 x = (width - gwidth) / 2;
1075 }
1076 1142
1077 XIMAGE_INSTANCE_XOFFSET (glyph) = x; 1143 XIMAGE_INSTANCE_XOFFSET (glyph) = x;
1078 XIMAGE_INSTANCE_YOFFSET (glyph) = y; 1144 XIMAGE_INSTANCE_YOFFSET (glyph) = y;
1079 1145
1080 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) 1146 if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii)
1081 == LAYOUT_HORIZONTAL) 1147 == LAYOUT_HORIZONTAL)
1082 { 1148 {
1083 x += (gwidth + horiz_spacing); 1149 x += (gwidth + horiz_spacing);
1084 } 1150 }
1085 else 1151 else
1086 { 1152 {
1087 y += (gheight + vert_spacing); 1153 y += (gheight + vert_spacing);
1088 } 1154 }
1089 }
1090 1155
1091 /* Now layout subwidgets if they require it. */ 1156 /* Now layout subwidgets if they require it. */
1092 image_instance_layout (glyph, gwidth, gheight, domain); 1157 image_instance_layout (glyph, gwidth, gheight, domain);
1093 } 1158 }
1094 } 1159 }
1105 defkeyword (&Q_height, ":height"); 1170 defkeyword (&Q_height, ":height");
1106 defkeyword (&Q_width, ":width"); 1171 defkeyword (&Q_width, ":width");
1107 defkeyword (&Q_properties, ":properties"); 1172 defkeyword (&Q_properties, ":properties");
1108 defkeyword (&Q_items, ":items"); 1173 defkeyword (&Q_items, ":items");
1109 defkeyword (&Q_image, ":image"); 1174 defkeyword (&Q_image, ":image");
1110 defkeyword (&Q_percent, ":percent");
1111 defkeyword (&Q_text, ":text"); 1175 defkeyword (&Q_text, ":text");
1112 defkeyword (&Q_orientation, ":orientation"); 1176 defkeyword (&Q_orientation, ":orientation");
1113 defkeyword (&Q_justify, ":justify"); 1177 defkeyword (&Q_justify, ":justify");
1114 defkeyword (&Q_border, ":border"); 1178 defkeyword (&Q_border, ":border");
1115 1179
1116 defsymbol (&Qetched_in, "etched-in"); 1180 defsymbol (&Qetched_in, "etched-in");
1117 defsymbol (&Qetched_out, "etched-out"); 1181 defsymbol (&Qetched_out, "etched-out");
1118 defsymbol (&Qbevel_in, "bevel-in"); 1182 defsymbol (&Qbevel_in, "bevel-in");
1119 defsymbol (&Qbevel_out, "bevel-out"); 1183 defsymbol (&Qbevel_out, "bevel-out");
1184 defsymbol (&Qwidget_callback_current_channel, "widget-callback-current-channel");
1120 } 1185 }
1121 1186
1122 #define VALID_GUI_KEYWORDS(type) do { \ 1187 #define VALID_GUI_KEYWORDS(type) do { \
1123 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \ 1188 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \
1124 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \ 1189 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
1130 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \ 1195 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
1131 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \ 1196 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
1132 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \ 1197 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
1133 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \ 1198 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
1134 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \ 1199 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \
1200 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback_ex, check_valid_callback); \
1135 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector); \ 1201 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector); \
1136 } while (0) 1202 } while (0)
1137 1203
1138 #define VALID_WIDGET_KEYWORDS(type) do { \ 1204 #define VALID_WIDGET_KEYWORDS(type) do { \
1139 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \ 1205 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
1158 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button"); 1224 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (button, "button");
1159 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget); 1225 IIFORMAT_HAS_SHARED_METHOD (button, validate, widget);
1160 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget); 1226 IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget);
1161 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget); 1227 IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget);
1162 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget); 1228 IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget);
1229 IIFORMAT_HAS_METHOD (button, query_geometry);
1163 IIFORMAT_VALID_KEYWORD (button, 1230 IIFORMAT_VALID_KEYWORD (button,
1164 Q_image, check_valid_glyph_or_instantiator); 1231 Q_image, check_valid_glyph_or_instantiator);
1165 VALID_WIDGET_KEYWORDS (button); 1232 VALID_WIDGET_KEYWORDS (button);
1166 VALID_GUI_KEYWORDS (button); 1233 VALID_GUI_KEYWORDS (button);
1167 } 1234 }
1255 IIFORMAT_HAS_METHOD (layout, possible_dest_types); 1322 IIFORMAT_HAS_METHOD (layout, possible_dest_types);
1256 IIFORMAT_HAS_SHARED_METHOD (layout, instantiate, widget); 1323 IIFORMAT_HAS_SHARED_METHOD (layout, instantiate, widget);
1257 IIFORMAT_HAS_METHOD (layout, normalize); 1324 IIFORMAT_HAS_METHOD (layout, normalize);
1258 IIFORMAT_HAS_METHOD (layout, query_geometry); 1325 IIFORMAT_HAS_METHOD (layout, query_geometry);
1259 IIFORMAT_HAS_METHOD (layout, layout); 1326 IIFORMAT_HAS_METHOD (layout, layout);
1260 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_width, check_valid_int_or_function); 1327 VALID_WIDGET_KEYWORDS (layout);
1261 IIFORMAT_VALID_KEYWORD (layout, Q_pixel_height, check_valid_int_or_function);
1262 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); 1328 IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation);
1263 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); 1329 IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification);
1264 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); 1330 IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border);
1265 IIFORMAT_VALID_KEYWORD (layout, Q_items, 1331 IIFORMAT_VALID_KEYWORD (layout, Q_items,
1266 check_valid_glyph_or_instantiator_list); 1332 check_valid_glyph_or_instantiator_list);
1291 1357
1292 void 1358 void
1293 vars_of_glyphs_widget (void) 1359 vars_of_glyphs_widget (void)
1294 { 1360 {
1295 reinit_vars_of_glyphs_widget (); 1361 reinit_vars_of_glyphs_widget ();
1296 } 1362
1363 DEFVAR_LISP ("widget-callback-current-channel", &Vwidget_callback_current_channel /*
1364 The domain that is current when a widget callback is invoked.
1365 This is invariably the frame that the widget is instantiated in.
1366 */);
1367 Vwidget_callback_current_channel = Qnil;
1368 }