comparison src/glyphs-widget.c @ 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
597 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border)); 597 substitute_keyword_value (inst, Q_border, glyph_instantiator_to_glyph (border));
598 } 598 }
599 return inst; 599 return inst;
600 } 600 }
601 601
602 /* Instantiate a layout widget. */ 602 /* Instantiate a layout widget. Sizing commentary: we have a number of
603 problems that we would like to address. Some consider some of these
604 more important than others. Currently size information is
605 determined at instantiation time and is then fixed forever
606 after. Generally this is not what we want. Users want size to be
607 "big enough" to accommodate whatever they are trying to show and
608 this is dependent on text length, lines, font metrics etc. Of
609 course these attributes can change dynamically and so the size
610 should changed dynamically also. Only in a few limited cases should
611 the size be fixed and remain fixed. Of course this actually means
612 that we don't really want to specifiy the size *at all* for most
613 widgets - we want it to be discovered dynamically. Thus we can
614 envisage the following scenarios:
615
616 1. A button is sized to accommodate its text, the text changes and the
617 button should change size also.
618
619 2. A button is given an explicit size. Its size should never change.
620
621 3. Layout is put inside an area. The size of the area changes, the
622 layout should change with it.
623
624 4. A button grows to accommodate additional text. The whitespace
625 around it should be modified to cope with the new layout
626 requirements.
627
628 5. A button grows. The area surrounding it should grow also if
629 possible.
630
631 What metrics are important?
632 1. Actual width and height.
633
634 2. Whether the width and height are what the widget actually wants, or
635 whether it can grow or shrink.
636
637 Text glyphs are particularly troublesome since their metrics depend
638 on the context in which they are being viewed. For instance they
639 can appear differently depending on the window face, frame face or
640 glyph face. All other glyphs are essentially fixed in
641 appearance. Perhaps the problem is that text glyphs are cached on a
642 device basis like most other glyphs. Instead they should be cached
643 per-window and then the instance would be fixed and we wouldn't
644 have to mess around with font metrics and the rest. */
603 static void 645 static void
604 layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 646 layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
605 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 647 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
606 int dest_mask, Lisp_Object domain) 648 int dest_mask, Lisp_Object domain)
607 { 649 {
793 835
794 void 836 void
795 image_instantiator_format_create_glyphs_widget (void) 837 image_instantiator_format_create_glyphs_widget (void)
796 { 838 {
797 #define VALID_GUI_KEYWORDS(type) \ 839 #define VALID_GUI_KEYWORDS(type) \
798 IIFORMAT_VALID_KEYWORD (type, Q_active, check_valid_anything); \ 840 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_active, check_valid_anything); \
799 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \ 841 IIFORMAT_VALID_KEYWORD (type, Q_suffix, check_valid_anything); \
800 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \ 842 IIFORMAT_VALID_KEYWORD (type, Q_keys, check_valid_string); \
801 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \ 843 IIFORMAT_VALID_KEYWORD (type, Q_style, check_valid_symbol); \
802 IIFORMAT_VALID_KEYWORD (type, Q_selected, check_valid_anything); \ 844 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_selected, check_valid_anything); \
803 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \ 845 IIFORMAT_VALID_KEYWORD (type, Q_filter, check_valid_anything); \
804 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \ 846 IIFORMAT_VALID_KEYWORD (type, Q_config, check_valid_symbol); \
805 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \ 847 IIFORMAT_VALID_KEYWORD (type, Q_included, check_valid_anything); \
806 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \ 848 IIFORMAT_VALID_KEYWORD (type, Q_key_sequence, check_valid_string); \
807 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \ 849 IIFORMAT_VALID_KEYWORD (type, Q_accelerator, check_valid_string); \
808 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \ 850 IIFORMAT_VALID_KEYWORD (type, Q_label, check_valid_anything); \
809 IIFORMAT_VALID_KEYWORD (type, Q_callback, check_valid_callback); \ 851 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_callback, check_valid_callback); \
810 IIFORMAT_VALID_KEYWORD (type, Q_descriptor, check_valid_string_or_vector) 852 IIFORMAT_VALID_NONCOPY_KEYWORD (type, Q_descriptor, check_valid_string_or_vector)
811 853
812 #define VALID_WIDGET_KEYWORDS(type) \ 854 #define VALID_WIDGET_KEYWORDS(type) \
813 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \ 855 IIFORMAT_VALID_KEYWORD (type, Q_width, check_valid_int); \
814 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \ 856 IIFORMAT_VALID_KEYWORD (type, Q_height, check_valid_int); \
815 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \ 857 IIFORMAT_VALID_KEYWORD (type, Q_pixel_width, check_valid_int); \