annotate lisp/prim/scrollbar.el @ 42:8b8b7f3559a2 r19-15b104

Import from CVS: tag r19-15b104
author cvs
date Mon, 13 Aug 2007 08:54:51 +0200
parents 441bb1e64a06
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 ;; 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."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
43 (when (window-live-p window)
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."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
53 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (scrollbar-set-hscroll window (+ (window-hscroll window) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defun scrollbar-page-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "Function called when the user gives the \"page-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 \(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
61 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 change the scrollbar behavior."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
63 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (scrollbar-set-hscroll window (- (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 nil))
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 scrollbar-page-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "Function called when the user gives the \"page-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 \(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
72 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 change the scrollbar behavior."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
74 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (scrollbar-set-hscroll window (+ (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq zmacs-region-stays t)
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (defun scrollbar-to-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 "Function called when the user gives the \"to-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 \(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
83 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 change the scrollbar behavior."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
85 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (scrollbar-set-hscroll window 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (defun scrollbar-to-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "Function called when the user gives the \"to-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 \(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
93 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 change the scrollbar behavior."
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
95 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (scrollbar-set-hscroll window 'max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defun scrollbar-horizontal-drag (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Function called when the user drags the horizontal scrollbar thumb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 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
103 representing how many columns the thumb is slid over. You can advise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 this function to change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (let ((window (car data))
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
106 (value (cdr data)))
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 16
diff changeset
107 (when (and (window-live-p window) (integerp value))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (scrollbar-set-hscroll window value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 nil)))