1 ;;; x-scrollbar.el --- scrollbar resourcing and such.
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Sun Microsystems.
5 ;; Copyright (C) 1995, 1996 Ben Wing.
7 ;; Author: Ben Wing <ben@xemacs.org>
8 ;; Maintainer: XEmacs Development Team
9 ;; Keywords: extensions, dumped
11 ;; This file is part of XEmacs.
13 ;; XEmacs is free software; you can redistribute it and/or modify it
14 ;; under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; XEmacs is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with XEmacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
28 ;;; Synched up with: Not synched.
32 ;; This file is dumped with XEmacs (when X and menubar support is compiled in).
36 (defun x-init-scrollbar-from-resources (locale)
37 (x-init-specifier-from-resources
38 (specifier-fallback scrollbar-width) 'natnum locale
39 '("scrollBarWidth" . "ScrollBarWidth")
40 ;; The name strings are wrong, but the scrollbar name is
41 ;; non-deterministic so it is a poor way to set a resource
42 ;; for the scrollbar anyhow.
43 (cond ((featurep 'athena-scrollbars)
44 '("scrollbar.thickness" . "ScrollBar.Thickness"))
45 ((featurep 'lucid-scrollbars)
46 '("scrollbar.width" . "XlwScrollBar.Width"))
47 ((featurep 'motif-scrollbars)
48 '("scrollbar.width" . "XmScrollBar.Width"))))
49 ;; Athena scrollbars accept either 'thickness' or 'width'.
50 ;; If any of the previous resources succeeded, the following
51 ;; call does nothing; so there's no harm in doing it all the
53 (if (featurep 'athena-scrollbars)
54 (x-init-specifier-from-resources
55 (specifier-fallback scrollbar-width) 'natnum locale
56 '("scrollbar.width" . "ScrollBar.Width")))
58 ;; lather, rinse, repeat.
59 (x-init-specifier-from-resources
60 (specifier-fallback scrollbar-height) 'natnum locale
61 '("scrollBarHeight" . "ScrollBarHeight")
62 ;; The name strings are wrong, but the scrollbar name is
63 ;; non-deterministic so it is a poor way to set a resource
64 ;; for the scrollbar anyhow.
65 (cond ((featurep 'athena-scrollbars)
66 '("scrollbar.thickness" . "ScrollBar.Thickness"))
67 ((featurep 'lucid-scrollbars)
68 '("scrollbar.height" . "XlwScrollBar.Height"))
69 ((featurep 'motif-scrollbars)
70 '("scrollbar.height" . "XmScrollBar.Height"))))
71 ;; Athena scrollbars accept either 'thickness' or 'height'.
72 ;; If any of the previous resources succeeded, the following
73 ;; call does nothing; so there's no harm in doing it all the
75 (if (featurep 'athena-scrollbars)
76 (x-init-specifier-from-resources
77 (specifier-fallback scrollbar-height) 'natnum locale
78 '("scrollbar.height" . "ScrollBar.Height")))
80 ;; Now do ScrollBarPlacement.scrollBarPlacement
81 (let ((case-fold-search t)
82 (resval (x-get-resource "ScrollBarPlacement" "scrollBarPlacement"
83 'string locale nil 'warn)))
86 ((string-match "^top[_-]left$" resval)
87 (set-specifier scrollbar-on-top-p t locale)
88 (set-specifier scrollbar-on-left-p t locale))
89 ((string-match "^top[_-]right$" resval)
90 (set-specifier scrollbar-on-top-p t locale)
91 (set-specifier scrollbar-on-left-p nil locale))
92 ((string-match "^bottom[_-]left$" resval)
93 (set-specifier scrollbar-on-top-p nil locale)
94 (set-specifier scrollbar-on-left-p t locale))
95 ((string-match "^bottom[_-]right$" resval)
96 (set-specifier scrollbar-on-top-p nil locale)
97 (set-specifier scrollbar-on-left-p nil locale))
99 (display-warning 'resource
100 (format "Illegal value '%s' for scrollBarPlacement resource" resval)))))
104 ;;; x-scrollbar.el ends here