annotate lisp/prim/scrollbar.el @ 104:cf808b4c4290 r20-1b4

Import from CVS: tag r20-1b4
author cvs
date Mon, 13 Aug 2007 09:16:51 +0200
parents a145efe76779
children
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
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
17 ;; along with XEmacs; see the file COPYING. If not, write to the
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
18 ;; Free Software Foundation, 59 Temple Place - Suite 330,
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
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)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
24 (when (and (featurep 'x)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
25 (or (eq locale 'global)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
26 (eq 'x (device-or-frame-type locale))))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
27 (x-init-scrollbar-from-resources locale)))
0
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
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
33 ;;; ### Move functions from C into Lisp here!
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; horizontal scrollbar functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun scrollbar-char-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Function called when the char-left arrow on the scrollbar is clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 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
42 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 change the scrollbar behavior."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
44 (when (window-live-p window)
0
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."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
54 (when (window-live-p window)
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."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
64 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (scrollbar-set-hscroll window (- (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defun scrollbar-page-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Function called when the user gives the \"page-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 \(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
73 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 change the scrollbar behavior."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
75 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (scrollbar-set-hscroll window (+ (window-hscroll window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (- (window-width window) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defun scrollbar-to-left (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "Function called when the user gives the \"to-left\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 \(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
84 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 change the scrollbar behavior."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
86 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (scrollbar-set-hscroll window 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (defun scrollbar-to-right (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 "Function called when the user gives the \"to-right\" scrollbar action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 \(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
94 passed, the scrollbar's window. You can advise this function to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 change the scrollbar behavior."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
96 (when (window-live-p window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (scrollbar-set-hscroll window 'max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun scrollbar-horizontal-drag (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "Function called when the user drags the horizontal scrollbar thumb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 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
104 representing how many columns the thumb is slid over. You can advise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 this function to change the scrollbar behavior."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (let ((window (car data))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
107 (value (cdr data)))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 70
diff changeset
108 (when (and (window-live-p window) (integerp value))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (scrollbar-set-hscroll window value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (setq zmacs-region-stays t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 nil)))