annotate lisp/prim/scrollbar.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 441bb1e64a06
children a145efe76779
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
17 ;; along with XEmacs; see the file COPYING. If not, write to the Free
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
18 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; Synched up with: Not in FSF. (Completely divergent from FSF scroll-bar.el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (defun init-scrollbar-from-resources (locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (if (and (featurep 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (or (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (eq 'x (device-or-frame-type locale)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (x-init-scrollbar-from-resources locale))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; vertical scrollbar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;
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 ;; horizontal scrollbar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;
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 scrollbar-char-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "Function called when the char-left arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 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
40 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
42 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
43 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (scrollbar-set-hscroll window (- (window-hscroll window) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (defun scrollbar-char-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "Function called when the char-right arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 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
51 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
53 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
54 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (scrollbar-set-hscroll window (+ (window-hscroll window) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (defun scrollbar-page-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 "Function called when the user gives the \"page-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 \(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
62 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
64 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
65 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (scrollbar-set-hscroll window (- (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defun scrollbar-page-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "Function called when the user gives the \"page-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 \(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
74 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
76 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
77 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (scrollbar-set-hscroll window (+ (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun scrollbar-to-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "Function called when the user gives the \"to-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 \(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
86 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
88 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
89 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (scrollbar-set-hscroll window 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defun scrollbar-to-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 "Function called when the user gives the \"to-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 \(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
97 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 change the scrollbar behavior."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
99 (if (not (window-live-p window))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
100 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (scrollbar-set-hscroll window 'max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defun scrollbar-horizontal-drag (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 "Function called when the user drags the horizontal scrollbar thumb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 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
108 representing how many columns the thumb is slid over. You can advise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 this function to change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (let ((window (car data))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
111 (value (cdr data)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
112 (if (not (or (window-live-p window) (integerp value)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 26
diff changeset
113 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (scrollbar-set-hscroll window value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 nil)))