Mercurial > hg > xemacs-beta
comparison src/glyphs-widget.c @ 410:de805c49cfc1 r21-2-35
Import from CVS: tag r21-2-35
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:19:21 +0200 |
parents | 501cfd01ee6d |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
409:301b9ebbdf3b | 410:de805c49cfc1 |
---|---|
373 | 373 |
374 /* Query for a widgets desired geometry. If no type specific method is | 374 /* Query for a widgets desired geometry. If no type specific method is |
375 provided then use the widget text to calculate sizes. */ | 375 provided then use the widget text to calculate sizes. */ |
376 static void | 376 static void |
377 widget_query_geometry (Lisp_Object image_instance, | 377 widget_query_geometry (Lisp_Object image_instance, |
378 unsigned int* width, unsigned int* height, | 378 int* width, int* height, |
379 enum image_instance_geometry disp, Lisp_Object domain) | 379 enum image_instance_geometry disp, Lisp_Object domain) |
380 { | 380 { |
381 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 381 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
382 struct image_instantiator_methods* meths; | 382 struct image_instantiator_methods* meths; |
383 Lisp_Object dynamic_width = Qnil; | 383 Lisp_Object dynamic_width = Qnil; |
408 IIFORMAT_METH (meths, query_geometry, (image_instance, | 408 IIFORMAT_METH (meths, query_geometry, (image_instance, |
409 width, height, disp, | 409 width, height, disp, |
410 domain)); | 410 domain)); |
411 else | 411 else |
412 { | 412 { |
413 unsigned int w, h; | 413 int w, h; |
414 | 414 |
415 /* Then if we are allowed to resize the widget, make the | 415 /* Then if we are allowed to resize the widget, make the |
416 size the same as the text dimensions. */ | 416 size the same as the text dimensions. */ |
417 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), | 417 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), |
418 IMAGE_INSTANCE_WIDGET_FACE (ii), | 418 IMAGE_INSTANCE_WIDGET_FACE (ii), |
440 } | 440 } |
441 } | 441 } |
442 | 442 |
443 static int | 443 static int |
444 widget_layout (Lisp_Object image_instance, | 444 widget_layout (Lisp_Object image_instance, |
445 unsigned int width, unsigned int height, Lisp_Object domain) | 445 int width, int height, Lisp_Object domain) |
446 { | 446 { |
447 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 447 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
448 struct image_instantiator_methods* meths; | 448 struct image_instantiator_methods* meths; |
449 | 449 |
450 /* .. then try device specific methods ... */ | 450 /* .. then try device specific methods ... */ |
696 | 696 |
697 /* Get the geometry of a button control. We need to adjust the size | 697 /* Get the geometry of a button control. We need to adjust the size |
698 depending on the type of button. */ | 698 depending on the type of button. */ |
699 static void | 699 static void |
700 button_query_geometry (Lisp_Object image_instance, | 700 button_query_geometry (Lisp_Object image_instance, |
701 unsigned int* width, unsigned int* height, | 701 int* width, int* height, |
702 enum image_instance_geometry disp, Lisp_Object domain) | 702 enum image_instance_geometry disp, Lisp_Object domain) |
703 { | 703 { |
704 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 704 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
705 unsigned int w, h; | 705 int w, h; |
706 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), | 706 query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii), |
707 IMAGE_INSTANCE_WIDGET_FACE (ii), | 707 IMAGE_INSTANCE_WIDGET_FACE (ii), |
708 &w, &h, 0, domain); | 708 &w, &h, 0, domain); |
709 /* Adjust the size for borders. */ | 709 /* Adjust the size for borders. */ |
710 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) | 710 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) |
722 } | 722 } |
723 | 723 |
724 /* tree-view geometry - get the height right */ | 724 /* tree-view geometry - get the height right */ |
725 static void | 725 static void |
726 tree_view_query_geometry (Lisp_Object image_instance, | 726 tree_view_query_geometry (Lisp_Object image_instance, |
727 unsigned int* width, unsigned int* height, | 727 int* width, int* height, |
728 enum image_instance_geometry disp, Lisp_Object domain) | 728 enum image_instance_geometry disp, Lisp_Object domain) |
729 { | 729 { |
730 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 730 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
731 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); | 731 Lisp_Object items = IMAGE_INSTANCE_WIDGET_ITEMS (ii); |
732 | 732 |
749 | 749 |
750 /* Get the geometry of a tab control. This is based on the number of | 750 /* Get the geometry of a tab control. This is based on the number of |
751 items and text therin in the tab control. */ | 751 items and text therin in the tab control. */ |
752 static void | 752 static void |
753 tab_control_query_geometry (Lisp_Object image_instance, | 753 tab_control_query_geometry (Lisp_Object image_instance, |
754 unsigned int* width, unsigned int* height, | 754 int* width, int* height, |
755 enum image_instance_geometry disp, Lisp_Object domain) | 755 enum image_instance_geometry disp, Lisp_Object domain) |
756 { | 756 { |
757 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 757 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
758 Lisp_Object items = XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)); | 758 Lisp_Object items = XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)); |
759 Lisp_Object rest; | 759 Lisp_Object rest; |
760 unsigned int tw = 0, th = 0; | 760 unsigned int tw = 0, th = 0; |
761 | 761 |
762 LIST_LOOP (rest, items) | 762 LIST_LOOP (rest, items) |
763 { | 763 { |
764 unsigned int h, w; | 764 int h, w; |
765 | 765 |
766 query_string_geometry (XGUI_ITEM (XCAR (rest))->name, | 766 query_string_geometry (XGUI_ITEM (XCAR (rest))->name, |
767 IMAGE_INSTANCE_WIDGET_FACE (ii), | 767 IMAGE_INSTANCE_WIDGET_FACE (ii), |
768 &w, &h, 0, domain); | 768 &w, &h, 0, domain); |
769 tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */ | 769 tw += 5 * WIDGET_BORDER_WIDTH; /* some bias */ |
993 rest. */ | 993 rest. */ |
994 | 994 |
995 /* Query the geometry of a layout widget. We assume that we can only | 995 /* Query the geometry of a layout widget. We assume that we can only |
996 get here if the size is not already fixed. */ | 996 get here if the size is not already fixed. */ |
997 static void | 997 static void |
998 layout_query_geometry (Lisp_Object image_instance, unsigned int* width, | 998 layout_query_geometry (Lisp_Object image_instance, int* width, |
999 unsigned int* height, enum image_instance_geometry disp, | 999 int* height, enum image_instance_geometry disp, |
1000 Lisp_Object domain) | 1000 Lisp_Object domain) |
1001 { | 1001 { |
1002 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1002 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1003 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest; | 1003 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest; |
1004 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; | 1004 int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; |
1005 unsigned int gheight, gwidth; | 1005 int gheight, gwidth; |
1006 | 1006 |
1007 /* If we are not initialized then we won't have any children. */ | 1007 /* If we are not initialized then we won't have any children. */ |
1008 if (!IMAGE_INSTANCE_INITIALIZED (ii)) | 1008 if (!IMAGE_INSTANCE_INITIALIZED (ii)) |
1009 return; | 1009 return; |
1010 | 1010 |
1080 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; | 1080 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; |
1081 } | 1081 } |
1082 | 1082 |
1083 int | 1083 int |
1084 layout_layout (Lisp_Object image_instance, | 1084 layout_layout (Lisp_Object image_instance, |
1085 unsigned int width, unsigned int height, Lisp_Object domain) | 1085 int width, int height, Lisp_Object domain) |
1086 { | 1086 { |
1087 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1087 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1088 Lisp_Object rest; | 1088 Lisp_Object rest; |
1089 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii); | 1089 Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii); |
1090 int x, y, maxph = 0, maxpw = 0, nitems = 0, | 1090 int x, y, maxph = 0, maxpw = 0, nitems = 0, |
1091 horiz_spacing, vert_spacing, ph_adjust = 0; | 1091 horiz_spacing, vert_spacing, ph_adjust = 0; |
1092 unsigned int gheight, gwidth; | 1092 int gheight, gwidth; |
1093 | 1093 |
1094 /* If we are not initialized then we won't have any children. */ | 1094 /* If we are not initialized then we won't have any children. */ |
1095 if (!IMAGE_INSTANCE_INITIALIZED (ii)) | 1095 if (!IMAGE_INSTANCE_INITIALIZED (ii)) |
1096 return 0; | 1096 return 0; |
1097 | 1097 |
1213 } | 1213 } |
1214 | 1214 |
1215 /* Layout subwindows if they are real subwindows. */ | 1215 /* Layout subwindows if they are real subwindows. */ |
1216 static int | 1216 static int |
1217 native_layout_layout (Lisp_Object image_instance, | 1217 native_layout_layout (Lisp_Object image_instance, |
1218 unsigned int width, unsigned int height, | 1218 int width, int height, |
1219 Lisp_Object domain) | 1219 Lisp_Object domain) |
1220 { | 1220 { |
1221 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); | 1221 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); |
1222 Lisp_Object rest; | 1222 Lisp_Object rest; |
1223 | 1223 |