home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / prim / scrollbar.el < prev    next >
Encoding:
Text File  |  1995-08-04  |  4.1 KB  |  115 lines

  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
  17. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  18. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. (defun init-scrollbar-from-resources (locale)
  21.   (if (and (featurep 'x)
  22.        (or (eq locale 'global)
  23.            (eq 'x (device-or-frame-type locale)))
  24.        (x-init-scrollbar-from-resources locale))))
  25.  
  26. ;;
  27. ;; vertical scrollbar functions
  28. ;;
  29.  
  30.  
  31. ;;
  32. ;; horizontal scrollbar functions
  33. ;;
  34.  
  35. (defun scrollbar-char-left (window)
  36.   "Function called when the char-left arrow on the scrollbar is clicked.
  37. This is the little arrow to the left of the scrollbar.  One argument is
  38. passed, the scrollbar's window.  You can advise this function to
  39. change the scrollbar behavior."
  40.   (if (not (window-live-p window))
  41.       nil
  42.     (scrollbar-set-hscroll window (- (window-hscroll window) 1))
  43.     (setq zmacs-region-stays t)
  44.     nil))
  45.  
  46. (defun scrollbar-char-right (window)
  47.   "Function called when the char-right arrow on the scrollbar is clicked.
  48. This is the little arrow to the right of the scrollbar.  One argument is
  49. passed, the scrollbar's window.  You can advise this function to
  50. change the scrollbar behavior."
  51.   (if (not (window-live-p window))
  52.       nil
  53.     (scrollbar-set-hscroll window (+ (window-hscroll window) 1))
  54.     (setq zmacs-region-stays t)
  55.     nil))
  56.  
  57. (defun scrollbar-page-left (window)
  58.   "Function called when the user gives the \"page-left\" scrollbar action.
  59. \(The way this is done can vary from scrollbar to scrollbar.\) One argument is
  60. passed, the scrollbar's window.  You can advise this function to
  61. change the scrollbar behavior."
  62.   (if (not (window-live-p window))
  63.       nil
  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."
  74.   (if (not (window-live-p window))
  75.       nil
  76.     (scrollbar-set-hscroll window (+ (window-hscroll window)
  77.                      (- (window-width window) 2)))
  78.     (setq zmacs-region-stays t)
  79.     nil))
  80.  
  81. (defun scrollbar-to-left (window)
  82.   "Function called when the user gives the \"to-left\" scrollbar action.
  83. \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
  84. passed, the scrollbar's window.  You can advise this function to
  85. change the scrollbar behavior."
  86.   (if (not (window-live-p window))
  87.       nil
  88.     (scrollbar-set-hscroll window 0)
  89.     (setq zmacs-region-stays t)
  90.     nil))
  91.  
  92. (defun scrollbar-to-right (window)
  93.   "Function called when the user gives the \"to-right\" scrollbar action.
  94. \(The way this is done can vary from scrollbar to scrollbar.\). One argument is
  95. passed, the scrollbar's window.  You can advise this function to
  96. change the scrollbar behavior."
  97.   (if (not (window-live-p window))
  98.       nil
  99.     (scrollbar-set-hscroll window 'max)
  100.     (setq zmacs-region-stays t)
  101.     nil))
  102.  
  103. (defun scrollbar-horizontal-drag (data)
  104.   "Function called when the user drags the horizontal scrollbar thumb.
  105. One argument is passed, a cons containing the scrollbar's window and a value
  106. representing how many columns the thumb is slid over.  You can advise
  107. this function to change the scrollbar behavior."
  108.   (let ((window (car data))
  109.     (value (cdr data)))
  110.     (if (not (or (window-live-p window) (integerp value)))
  111.     nil
  112.       (scrollbar-set-hscroll window value)
  113.       (setq zmacs-region-stays t)
  114.       nil)))
  115.