annotate lisp/prim/objects.el @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents 376386a54a3c
children 131b0175ea99
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
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
25 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (defun ws-object-property-1 (function object domain &optional matchspec)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (let ((instance (if matchspec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (specifier-matching-instance object matchspec domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (specifier-instance object domain))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (and instance (funcall function instance))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; font specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defun make-font-specifier (spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "Create a new `font' specifier object with the given specification list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 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
40 locale and a list of instantiators), a single instantiator, or a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 of instantiators. See `make-specifier' for more information about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (make-specifier-and-init 'font spec-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defun font-name (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "Return the name of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 to using `specifier-instance' and applying `font-instance-name' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (ws-object-property-1 'font-instance-name font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defun font-ascent (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Return the ascent of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 to using `specifier-instance' and applying `font-instance-ascent' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (ws-object-property-1 'font-instance-ascent font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (defun font-descent (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "Return the descent of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 to using `specifier-instance' and applying `font-instance-descent' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (ws-object-property-1 'font-instance-descent font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (defun font-width (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "Return the width of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 to using `specifier-instance' and applying `font-instance-width' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (ws-object-property-1 'font-instance-width font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defun font-height (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "Return the height of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 to using `specifier-instance' and applying `font-instance-height' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (ws-object-property-1 'font-instance-height font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defun font-proportional-p (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "Return whether FONT is proportional in the specified DOMAIN, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 to using `specifier-instance' and applying `font-instance-proportional-p' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (ws-object-property-1 'font-instance-proportional-p font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun font-properties (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 "Return the properties of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 to using `specifier-instance' and applying `font-instance-properties'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (ws-object-property-1 'font-instance-properties font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun font-truename (font &optional domain charset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "Return the truename of the FONT in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 FONT should be a font specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 to using `specifier-instance' and applying `font-instance-truename'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (ws-object-property-1 'font-instance-truename font domain charset))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (defun font-instance-height (font-instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 "Return the height in pixels of FONT-INSTANCE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 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
112 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
113 (+ (font-instance-ascent font-instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (font-instance-descent font-instance)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; color specifiers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (defun make-color-specifier (spec-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "Create a new `color' specifier object with the given specification list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 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
121 locale and a list of instantiators), a single instantiator, or a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 of instantiators. See `make-specifier' for a detailed description of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 how specifiers work."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (make-specifier-and-init 'color spec-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (defun color-name (color &optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 "Return the name of the COLOR in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 COLOR should be a color specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 to using `specifier-instance' and applying `color-instance-name' to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (ws-object-property-1 'color-instance-name color domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defun color-rgb-components (color &optional domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 "Return the RGB components of the COLOR in the specified DOMAIN, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 COLOR should be a color specifier object and DOMAIN is normally a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 and defaults to the selected window if omitted. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 to using `specifier-instance' and applying `color-instance-rgb-components'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 to the result. See `make-specifier' for more information about specifiers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (ws-object-property-1 'color-instance-rgb-components color domain))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;; objects.el ends here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143