annotate lisp/prim/objects.el @ 9:6f2bbbbbe05a

Added tag r19-15b5 for changeset 4b173ad71786
author cvs
date Mon, 13 Aug 2007 08:47:36 +0200
parents 376386a54a3c
children 0293115a14e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; objects.el --- Lisp interface to C window-system objects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Keywords: faces internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1994 Board of Trustees, University of Illinois
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Ben Wing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Ben Wing <wing@666.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (defun ws-object-property-1 (function object domain &optional matchspec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (let ((instance (if matchspec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (specifier-matching-instance object matchspec domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (specifier-instance object domain))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (and instance (funcall function instance))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; font specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (defun make-font-specifier (spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 "Create a new `font' specifier object with the given specification list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 SPEC-LIST can be a list of specifications (each of which is a cons of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 locale and a list of instantiators), a single instantiator, or a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 of instantiators. See `make-specifier' for more information about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (make-specifier-and-init 'font spec-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defun font-name (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "Return the name of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 to using `specifier-instance' and applying `font-instance-name' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (ws-object-property-1 'font-instance-name font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (defun font-ascent (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 "Return the ascent of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 to using `specifier-instance' and applying `font-instance-ascent' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (ws-object-property-1 'font-instance-ascent font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defun font-descent (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "Return the descent of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 to using `specifier-instance' and applying `font-instance-descent' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (ws-object-property-1 'font-instance-descent font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defun font-width (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Return the width of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 to using `specifier-instance' and applying `font-instance-width' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (ws-object-property-1 'font-instance-width font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun font-height (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Return the height of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 to using `specifier-instance' and applying `font-instance-height' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (ws-object-property-1 'font-instance-height font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defun font-proportional-p (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "Return whether FONT is proportional in the specified DOMAIN, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 to using `specifier-instance' and applying `font-instance-proportional-p' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (ws-object-property-1 'font-instance-proportional-p font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (defun font-properties (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 "Return the properties of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 to using `specifier-instance' and applying `font-instance-properties'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (ws-object-property-1 'font-instance-properties font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defun font-truename (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Return the truename of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 to using `specifier-instance' and applying `font-instance-truename'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (ws-object-property-1 'font-instance-truename font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (defun font-instance-height (font-instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "Return the height in pixels of FONT-INSTANCE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 The returned value is the maximum height for all characters in the font,\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 and is equivalent to the sum of the font instance's ascent and descent."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (+ (font-instance-ascent font-instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (font-instance-descent font-instance)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; color specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defun make-color-specifier (spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "Create a new `color' specifier object with the given specification list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 SPEC-LIST can be a list of specifications (each of which is a cons of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 locale and a list of instantiators), a single instantiator, or a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 of instantiators. See `make-specifier' for a detailed description of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 how specifiers work."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (make-specifier-and-init 'color spec-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defun color-name (color &optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "Return the name of the COLOR in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 COLOR should be a color specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 to using `specifier-instance' and applying `color-instance-name' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (ws-object-property-1 'color-instance-name color domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (defun color-rgb-components (color &optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 "Return the RGB components of the COLOR in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 COLOR should be a color specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 to using `specifier-instance' and applying `color-instance-rgb-components'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (ws-object-property-1 'color-instance-rgb-components color domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;;; objects.el ends here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142