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