annotate lisp/x-scrollbar.el @ 5926:da02ba75e50a cygwin

merge heads 3
author Henry Thompson <ht@markup.co.uk>
date Fri, 27 Feb 2015 17:48:44 +0000
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; x-scrollbar.el --- scrollbar resourcing and such.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Sun Microsystems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995, 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Author: Ben Wing <ben@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: extensions, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
13 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
14 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
15 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
16 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
19 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
20 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
21 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 502
diff changeset
24 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;;; Synched up with: Not synched.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;; This file is dumped with XEmacs (when X and menubar support is compiled in).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
34 (globally-declare-fboundp
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
35 '(x-init-specifier-from-resources x-get-resource))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 442
diff changeset
36
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (defun x-init-scrollbar-from-resources (locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 (x-init-specifier-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 (specifier-fallback scrollbar-width) 'natnum locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 '("scrollBarWidth" . "ScrollBarWidth")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; The name strings are wrong, but the scrollbar name is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;; non-deterministic so it is a poor way to set a resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 ;; for the scrollbar anyhow.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 (cond ((featurep 'athena-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 '("scrollbar.thickness" . "ScrollBar.Thickness"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ((featurep 'lucid-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 '("scrollbar.width" . "XlwScrollBar.Width"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ((featurep 'motif-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 '("scrollbar.width" . "XmScrollBar.Width"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ;; Athena scrollbars accept either 'thickness' or 'width'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;; If any of the previous resources succeeded, the following
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ;; call does nothing; so there's no harm in doing it all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 ;; time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 (if (featurep 'athena-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (x-init-specifier-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (specifier-fallback scrollbar-width) 'natnum locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 '("scrollbar.width" . "ScrollBar.Width")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ;; lather, rinse, repeat.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 (x-init-specifier-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (specifier-fallback scrollbar-height) 'natnum locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 '("scrollBarHeight" . "ScrollBarHeight")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; The name strings are wrong, but the scrollbar name is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;; non-deterministic so it is a poor way to set a resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;; for the scrollbar anyhow.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (cond ((featurep 'athena-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 '("scrollbar.thickness" . "ScrollBar.Thickness"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ((featurep 'lucid-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 '("scrollbar.height" . "XlwScrollBar.Height"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ((featurep 'motif-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 '("scrollbar.height" . "XmScrollBar.Height"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 ;; Athena scrollbars accept either 'thickness' or 'height'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ;; If any of the previous resources succeeded, the following
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ;; call does nothing; so there's no harm in doing it all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ;; time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 (if (featurep 'athena-scrollbars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (x-init-specifier-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (specifier-fallback scrollbar-height) 'natnum locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 '("scrollbar.height" . "ScrollBar.Height")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;; Now do ScrollBarPlacement.scrollBarPlacement
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 (let ((case-fold-search t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 (resval (x-get-resource "ScrollBarPlacement" "scrollBarPlacement"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
84 'string locale nil 'warn)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ((null resval))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ((string-match "^top[_-]left$" resval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 (set-specifier scrollbar-on-top-p t locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 (set-specifier scrollbar-on-left-p t locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ((string-match "^top[_-]right$" resval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 (set-specifier scrollbar-on-top-p t locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (set-specifier scrollbar-on-left-p nil locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ((string-match "^bottom[_-]left$" resval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (set-specifier scrollbar-on-top-p nil locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 (set-specifier scrollbar-on-left-p t locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ((string-match "^bottom[_-]right$" resval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (set-specifier scrollbar-on-top-p nil locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 (set-specifier scrollbar-on-left-p nil locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (display-warning 'resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (format "Illegal value '%s' for scrollBarPlacement resource" resval)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ;;; x-scrollbar.el ends here