annotate lisp/prim/scrollbar.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 0293115a14e9
children 441bb1e64a06
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 ;; Scrollbar support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; 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
17 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
18 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 0
diff changeset
19 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; Synched up with: Not in FSF. (Completely divergent from FSF scroll-bar.el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (defun init-scrollbar-from-resources (locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (if (and (featurep 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (or (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (eq 'x (device-or-frame-type locale)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (x-init-scrollbar-from-resources locale))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; vertical scrollbar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; horizontal scrollbar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defun scrollbar-char-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 "Function called when the char-left arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 This is the little arrow to the left of the scrollbar. One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (scrollbar-set-hscroll window (- (window-hscroll window) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (defun scrollbar-char-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "Function called when the char-right arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 This is the little arrow to the right of the scrollbar. One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (scrollbar-set-hscroll window (+ (window-hscroll window) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 nil))
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 scrollbar-page-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "Function called when the user gives the \"page-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 \(The way this is done can vary from scrollbar to scrollbar.\) One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (scrollbar-set-hscroll window (- (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun scrollbar-page-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Function called when the user gives the \"page-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 \(The way this is done can vary from scrollbar to scrollbar.\) One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (scrollbar-set-hscroll window (+ (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 nil))
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 scrollbar-to-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "Function called when the user gives the \"to-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (scrollbar-set-hscroll window 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defun scrollbar-to-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 "Function called when the user gives the \"to-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (if (not (window-live-p window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (scrollbar-set-hscroll window 'max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (defun scrollbar-horizontal-drag (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 "Function called when the user drags the horizontal scrollbar thumb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 One argument is passed, a cons containing the scrollbar's window and a value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 representing how many columns the thumb is slid over. You can advise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 this function to change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (let ((window (car data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (value (cdr data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (if (not (or (window-live-p window) (integerp value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (scrollbar-set-hscroll window value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 nil)))